Revision 41e7e87f
Added by Patrick Plitzner almost 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/e4/handler/ApplyLayoutHandlerE4.java | ||
---|---|---|
3 | 3 |
*/ |
4 | 4 |
package eu.etaxonomy.taxeditor.editor.key.e4.handler; |
5 | 5 |
|
6 |
import org.eclipse.core.commands.AbstractHandler;
|
|
7 |
import org.eclipse.core.commands.ExecutionEvent; |
|
8 |
import org.eclipse.core.commands.ExecutionException;
|
|
9 |
import org.eclipse.ui.IEditorPart;
|
|
10 |
import org.eclipse.ui.handlers.HandlerUtil;
|
|
6 |
import javax.inject.Named;
|
|
7 |
|
|
8 |
import org.eclipse.e4.core.di.annotations.Execute;
|
|
9 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
|
10 |
import org.eclipse.e4.ui.services.IServiceConstants;
|
|
11 | 11 |
|
12 | 12 |
import eu.etaxonomy.taxeditor.editor.key.e4.AbstractGraphKeyEditorE4; |
13 | 13 |
|
... | ... | |
15 | 15 |
* @author n.hoffmann |
16 | 16 |
* |
17 | 17 |
*/ |
18 |
public class ApplyLayoutHandlerE4 extends AbstractHandler { |
|
19 |
|
|
20 |
@Override |
|
21 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
22 |
IEditorPart editor = HandlerUtil.getActiveEditor(event); |
|
23 |
|
|
24 |
if(editor instanceof AbstractGraphKeyEditorE4){ |
|
25 |
((AbstractGraphKeyEditorE4) editor).applyLayout(); |
|
26 |
} |
|
18 |
public class ApplyLayoutHandlerE4 { |
|
27 | 19 |
|
28 |
return null; |
|
20 |
@Execute |
|
21 |
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) { |
|
22 |
AbstractGraphKeyEditorE4 graphKeyEditorE4 = (AbstractGraphKeyEditorE4) activePart.getObject(); |
|
23 |
graphKeyEditorE4.applyLayout(); |
|
29 | 24 |
} |
30 | 25 |
|
31 | 26 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/DeleteHandler.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler; |
|
11 |
|
|
12 |
import java.util.List; |
|
13 |
|
|
14 |
import org.eclipse.core.commands.AbstractHandler; |
|
15 |
import org.eclipse.core.commands.ExecutionEvent; |
|
16 |
import org.eclipse.core.commands.ExecutionException; |
|
17 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
18 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
19 |
|
|
20 |
import eu.etaxonomy.cdm.model.description.PolytomousKey; |
|
21 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
22 |
import eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingDeletePolytomousKeyHandlerE4; |
|
23 |
|
|
24 |
/** |
|
25 |
* @author n.hoffmann |
|
26 |
* @created Dec 3, 2010 |
|
27 |
* @version 1.0 |
|
28 |
*/ |
|
29 |
public class DeleteHandler extends AbstractHandler { |
|
30 |
|
|
31 |
/* (non-Javadoc) |
|
32 |
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
33 |
*/ |
|
34 |
@Override |
|
35 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
36 |
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
|
37 |
|
|
38 |
List<PolytomousKey> keys = selection.toList(); |
|
39 |
|
|
40 |
if(keys.isEmpty()){ |
|
41 |
return null; |
|
42 |
} |
|
43 |
|
|
44 |
boolean confirmation = MessagingUtils.confirmDialog(RemotingDeletePolytomousKeyHandlerE4.CONFIRM, RemotingDeletePolytomousKeyHandlerE4.CONFIRM_MESSAGE); |
|
45 |
|
|
46 |
if(confirmation){ |
|
47 |
|
|
48 |
// for(PolytomousKey key : keys){ |
|
49 |
// try { |
|
50 |
// PolytomousKeyViewPart pkvp = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false); |
|
51 |
// AbstractPostOperation operation = new DeleteOperation( |
|
52 |
// event.getCommand().getName(), |
|
53 |
// NavigationUtil.getUndoContext(), key, |
|
54 |
// pkvp, |
|
55 |
// pkvp, |
|
56 |
// pkvp); |
|
57 |
// NavigationUtil.executeOperation(operation); |
|
58 |
// } catch (NotDefinedException e) { |
|
59 |
// MessagingUtils.error(getClass(), e); |
|
60 |
// } |
|
61 |
// } |
|
62 |
} |
|
63 |
|
|
64 |
return null; |
|
65 |
} |
|
66 |
|
|
67 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/EditPolytomousKeyNodesHandler.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler; |
|
11 |
|
|
12 |
import org.eclipse.core.commands.AbstractHandler; |
|
13 |
import org.eclipse.core.commands.ExecutionEvent; |
|
14 |
import org.eclipse.core.commands.ExecutionException; |
|
15 |
|
|
16 |
/** |
|
17 |
* @author n.hoffmann |
|
18 |
* @created Dec 3, 2010 |
|
19 |
* @version 1.0 |
|
20 |
*/ |
|
21 |
public class EditPolytomousKeyNodesHandler extends AbstractHandler { |
|
22 |
|
|
23 |
/* (non-Javadoc) |
|
24 |
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
25 |
*/ |
|
26 |
@Override |
|
27 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
28 |
// PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false); |
|
29 |
// |
|
30 |
// ISelection selection = view.getSite().getSelectionProvider().getSelection(); |
|
31 |
// if(selection instanceof StructuredSelection){ |
|
32 |
// |
|
33 |
// final StructuredSelection structuredSelection = (StructuredSelection) selection; |
|
34 |
// |
|
35 |
// Job job = new Job(RemotingEditPolytomousKeyNodesHandlerE4.OPENING_POLYTOMOUS_KEYS){ |
|
36 |
// |
|
37 |
// @Override |
|
38 |
// protected IStatus run(IProgressMonitor monitor) { |
|
39 |
// monitor.beginTask(RemotingEditPolytomousKeyNodesHandlerE4.OPENING_POLYTOMOUS_KEYS, structuredSelection.size()); |
|
40 |
// |
|
41 |
// for(final Object selectedObject : structuredSelection.toArray()){ |
|
42 |
// if(selectedObject instanceof PolytomousKey){ |
|
43 |
// |
|
44 |
// Display.getDefault().asyncExec(new Runnable(){ |
|
45 |
// |
|
46 |
// @Override |
|
47 |
// public void run() { |
|
48 |
//// NavigationUtil.openEditor((PolytomousKey) selectedObject, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
|
49 |
// } |
|
50 |
// |
|
51 |
// }); |
|
52 |
// monitor.worked(1); |
|
53 |
// } |
|
54 |
// } |
|
55 |
// monitor.done(); |
|
56 |
// return Status.OK_STATUS; |
|
57 |
// } |
|
58 |
// |
|
59 |
// }; |
|
60 |
// |
|
61 |
// job.setPriority(Job.SHORT); |
|
62 |
// job.schedule(); |
|
63 |
// |
|
64 |
// } |
|
65 |
return null; |
|
66 |
} |
|
67 |
|
|
68 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/NewPolytomousKeyHandler.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler; |
|
11 |
|
|
12 |
import org.eclipse.core.commands.AbstractHandler; |
|
13 |
import org.eclipse.core.commands.ExecutionEvent; |
|
14 |
import org.eclipse.core.commands.ExecutionException; |
|
15 |
import org.eclipse.core.commands.IHandler; |
|
16 |
|
|
17 |
/** |
|
18 |
* <p>NewTaxonNodeHandler class.</p> |
|
19 |
* |
|
20 |
* @author n.hoffmann |
|
21 |
* @created Sep 15, 2009 |
|
22 |
* @version 1.0 |
|
23 |
*/ |
|
24 |
public class NewPolytomousKeyHandler extends AbstractHandler implements IHandler { |
|
25 |
|
|
26 |
/* (non-Javadoc) |
|
27 |
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
28 |
*/ |
|
29 |
/** {@inheritDoc} */ |
|
30 |
@Override |
|
31 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
32 |
// NewPolytomousKeyWizard wizard = new NewPolytomousKeyWizard(); |
|
33 |
// wizard.init(null,null); |
|
34 |
// WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard); |
|
35 |
// int status = dialog.open(); |
|
36 |
// if(status == Status.OK) { |
|
37 |
// PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false); |
|
38 |
// //List<PolytomousKey> pklist = CdmStore.getService(IPolytomousKeyService.class).list(PolytomousKey.class, null, null, null, null); |
|
39 |
// view.refresh(); |
|
40 |
// view.setViewerSelection(new StructuredSelection(wizard.getEntity()),true); |
|
41 |
// view.openSelectedKeyNodes(); |
|
42 |
// } |
|
43 |
return null; |
|
44 |
} |
|
45 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RefreshPolytomousKeyListHandler.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler; |
|
11 |
|
|
12 |
import org.eclipse.core.commands.AbstractHandler; |
|
13 |
import org.eclipse.core.commands.ExecutionEvent; |
|
14 |
import org.eclipse.core.commands.ExecutionException; |
|
15 |
import org.eclipse.core.commands.IHandler; |
|
16 |
|
|
17 |
|
|
18 |
/** |
|
19 |
* <p>Handler class which Refreshes each key node in the polytomous key navigation view</p> |
|
20 |
* |
|
21 |
* @author c.mathew |
|
22 |
* @created Jan 17 2013 |
|
23 |
* @version 1.0 |
|
24 |
*/ |
|
25 |
public class RefreshPolytomousKeyListHandler extends AbstractHandler implements IHandler { |
|
26 |
|
|
27 |
/* (non-Javadoc) |
|
28 |
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
29 |
*/ |
|
30 |
/** {@inheritDoc} */ |
|
31 |
@Override |
|
32 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
33 |
// PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false); |
|
34 |
// view.refresh(); |
|
35 |
return null; |
|
36 |
} |
|
37 |
} |
|
38 |
|
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RefreshPolytomousKeyNodesHandler.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler; |
|
11 |
|
|
12 |
import org.eclipse.core.commands.AbstractHandler; |
|
13 |
import org.eclipse.core.commands.ExecutionEvent; |
|
14 |
import org.eclipse.core.commands.ExecutionException; |
|
15 |
import org.eclipse.core.commands.IHandler; |
|
16 |
|
|
17 |
import eu.etaxonomy.taxeditor.navigation.l10n.Messages; |
|
18 |
|
|
19 |
|
|
20 |
/** |
|
21 |
* <p>RefreshPolytomousKeyNodesHandler class, which refreshes each key node in the polytomous key navigation view</p> |
|
22 |
* |
|
23 |
* @author c.mathew |
|
24 |
* @created Jan 17 2013 |
|
25 |
* @version 1.0 |
|
26 |
*/ |
|
27 |
public class RefreshPolytomousKeyNodesHandler extends AbstractHandler implements IHandler { |
|
28 |
|
|
29 |
private static final String REFRESHING_POLYTOMOUS_KEY_NODES = Messages.RefreshPolytomousKeyNodesHandler_REFRESHING; |
|
30 |
|
|
31 |
@Override |
|
32 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
33 |
// final PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false); |
|
34 |
// final List<PolytomousKey> keys = view.getKeys(); |
|
35 |
// |
|
36 |
// final String label = Messages.RefreshPolytomousKeyNodesHandler_REFRESH; |
|
37 |
// |
|
38 |
// final IUndoContext undoContext = NavigationUtil.getUndoContext(); |
|
39 |
// if (keys.size() > 0) { |
|
40 |
// Job job = new Job(REFRESHING_POLYTOMOUS_KEY_NODES){ |
|
41 |
// |
|
42 |
// @Override |
|
43 |
// protected IStatus run(IProgressMonitor monitor) { |
|
44 |
// monitor.beginTask(REFRESHING_POLYTOMOUS_KEY_NODES, keys.size()); |
|
45 |
// |
|
46 |
// |
|
47 |
// for (final PolytomousKey key : keys) { |
|
48 |
// if(key.getRoot() != null) { |
|
49 |
// |
|
50 |
// Display.getDefault().asyncExec(new Runnable(){ |
|
51 |
// |
|
52 |
// @Override |
|
53 |
// public void run() { |
|
54 |
// AbstractPostOperation operation = new RefreshNodesOperation(label, undoContext, key, view); |
|
55 |
// NavigationUtil.executeOperation(operation); |
|
56 |
// } |
|
57 |
// |
|
58 |
// }); |
|
59 |
// monitor.worked(1); |
|
60 |
// } |
|
61 |
// } |
|
62 |
// monitor.done(); |
|
63 |
// return Status.OK_STATUS; |
|
64 |
// } |
|
65 |
// |
|
66 |
// }; |
|
67 |
// |
|
68 |
// job.setPriority(Job.SHORT); |
|
69 |
// job.schedule(); |
|
70 |
// |
|
71 |
// } |
|
72 |
return null; |
|
73 |
} |
|
74 |
} |
|
75 |
|
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingDeletePolytomousKeyHandler.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2015 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler; |
|
10 |
|
|
11 |
import java.util.List; |
|
12 |
import java.util.UUID; |
|
13 |
|
|
14 |
import org.eclipse.core.commands.ExecutionEvent; |
|
15 |
import org.eclipse.core.commands.operations.AbstractOperation; |
|
16 |
import org.eclipse.core.runtime.IStatus; |
|
17 |
import org.eclipse.core.runtime.Status; |
|
18 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
19 |
import org.eclipse.ui.IEditorInput; |
|
20 |
import org.eclipse.ui.IEditorReference; |
|
21 |
import org.eclipse.ui.IWorkbenchPage; |
|
22 |
import org.eclipse.ui.PartInitException; |
|
23 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
24 |
|
|
25 |
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput; |
|
26 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
27 |
import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels; |
|
28 |
import eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingDeletePolytomousKeyHandlerE4; |
|
29 |
import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingDeletePolytomousKeyOperation; |
|
30 |
import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler; |
|
31 |
import eu.etaxonomy.taxeditor.util.OperationsUtil; |
|
32 |
|
|
33 |
/** |
|
34 |
* @author cmathew |
|
35 |
* @date 25 Jun 2015 |
|
36 |
* |
|
37 |
*/ |
|
38 |
public class RemotingDeletePolytomousKeyHandler extends RemotingCdmHandler { |
|
39 |
|
|
40 |
List<UUID> keysToDelete; |
|
41 |
/** |
|
42 |
* @param label |
|
43 |
*/ |
|
44 |
public RemotingDeletePolytomousKeyHandler() { |
|
45 |
super(PolytomousKeyViewLabels.DELETE_POLYTOMOUS_KEY_LABEL); |
|
46 |
} |
|
47 |
|
|
48 |
/* (non-Javadoc) |
|
49 |
* @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent) |
|
50 |
*/ |
|
51 |
@Override |
|
52 |
public IStatus allowOperations(ExecutionEvent event) { |
|
53 |
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
|
54 |
|
|
55 |
keysToDelete = OperationsUtil.convertToUuidList(selection.toList()); |
|
56 |
|
|
57 |
if(keysToDelete.isEmpty()){ |
|
58 |
return Status.CANCEL_STATUS; |
|
59 |
} |
|
60 |
|
|
61 |
boolean confirmation = MessagingUtils.confirmDialog(RemotingDeletePolytomousKeyHandlerE4.CONFIRM, RemotingDeletePolytomousKeyHandlerE4.CONFIRM_MESSAGE); |
|
62 |
|
|
63 |
if(!confirmation) { |
|
64 |
return Status.CANCEL_STATUS; |
|
65 |
} |
|
66 |
closeObsoleteEditor(event); |
|
67 |
return Status.OK_STATUS; |
|
68 |
} |
|
69 |
|
|
70 |
/* (non-Javadoc) |
|
71 |
* @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent) |
|
72 |
*/ |
|
73 |
@Override |
|
74 |
public AbstractOperation prepareOperation(ExecutionEvent event) { |
|
75 |
return new RemotingDeletePolytomousKeyOperation(event.getTrigger(), |
|
76 |
false, |
|
77 |
keysToDelete); |
|
78 |
} |
|
79 |
|
|
80 |
/* (non-Javadoc) |
|
81 |
* @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete() |
|
82 |
*/ |
|
83 |
@Override |
|
84 |
public void onComplete() { |
|
85 |
// TODO Auto-generated method stub |
|
86 |
|
|
87 |
} |
|
88 |
protected boolean closeObsoleteEditor(ExecutionEvent event){ |
|
89 |
boolean result = true; |
|
90 |
IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); |
|
91 |
|
|
92 |
for (IEditorReference ref : activePage.getEditorReferences()) { |
|
93 |
try { |
|
94 |
IEditorInput input = ref.getEditorInput(); |
|
95 |
if (input instanceof PolytomousKeyEditorInput) { |
|
96 |
UUID uuidForKey = ((PolytomousKeyEditorInput) input).getKey().getUuid(); |
|
97 |
for (UUID keyUuid :keysToDelete) { |
|
98 |
if( uuidForKey.equals(keyUuid)){ |
|
99 |
result &= activePage.closeEditor(ref.getEditor(false), false); |
|
100 |
} |
|
101 |
} |
|
102 |
|
|
103 |
} |
|
104 |
} catch (PartInitException e) { |
|
105 |
continue; |
|
106 |
} |
|
107 |
} |
|
108 |
return result; |
|
109 |
} |
|
110 |
|
|
111 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingEditPolytomousKeyNodesHandler.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2015 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler; |
|
10 |
|
|
11 |
import org.eclipse.core.commands.AbstractHandler; |
|
12 |
import org.eclipse.core.commands.ExecutionEvent; |
|
13 |
import org.eclipse.core.commands.ExecutionException; |
|
14 |
|
|
15 |
/** |
|
16 |
* @author cmathew |
|
17 |
* @date 29 Jun 2015 |
|
18 |
* |
|
19 |
*/ |
|
20 |
public class RemotingEditPolytomousKeyNodesHandler extends AbstractHandler { |
|
21 |
|
|
22 |
/* (non-Javadoc) |
|
23 |
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
24 |
*/ |
|
25 |
@Override |
|
26 |
public Object execute(final ExecutionEvent event) throws ExecutionException { |
|
27 |
// PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false); |
|
28 |
// |
|
29 |
// ISelection selection = view.getSite().getSelectionProvider().getSelection(); |
|
30 |
// if(selection instanceof StructuredSelection){ |
|
31 |
// |
|
32 |
// final StructuredSelection structuredSelection = (StructuredSelection) selection; |
|
33 |
// |
|
34 |
// Job job = new Job(RemotingEditPolytomousKeyNodesHandlerE4.OPENING_POLYTOMOUS_KEYS){ |
|
35 |
// |
|
36 |
// @Override |
|
37 |
// protected IStatus run(IProgressMonitor monitor) { |
|
38 |
// monitor.beginTask(RemotingEditPolytomousKeyNodesHandlerE4.OPENING_POLYTOMOUS_KEYS, structuredSelection.size()); |
|
39 |
// |
|
40 |
// for(final Object selectedObject : structuredSelection.toArray()){ |
|
41 |
// if(selectedObject instanceof PolytomousKey){ |
|
42 |
// |
|
43 |
// Display.getDefault().asyncExec(new Runnable(){ |
|
44 |
// |
|
45 |
// @Override |
|
46 |
// public void run() { |
|
47 |
// try { |
|
48 |
// PolytomousKey key = (PolytomousKey) selectedObject; |
|
49 |
// EditorUtil.openPolytomousKey(key.getUuid()); |
|
50 |
// } catch(Exception ex) { |
|
51 |
// MessagingUtils.warningDialog(PolytomousKeyViewLabels.ERROR_OPENING_KEY_EDITOR_MESSAGE, |
|
52 |
// event.getTrigger(), |
|
53 |
// ex.getLocalizedMessage()); |
|
54 |
// ex.printStackTrace(); |
|
55 |
// } |
|
56 |
// } |
|
57 |
// |
|
58 |
// }); |
|
59 |
// monitor.worked(1); |
|
60 |
// } |
|
61 |
// } |
|
62 |
// monitor.done(); |
|
63 |
// return Status.OK_STATUS; |
|
64 |
// } |
|
65 |
// |
|
66 |
// }; |
|
67 |
// |
|
68 |
// job.setPriority(Job.SHORT); |
|
69 |
// job.schedule(); |
|
70 |
// |
|
71 |
// } |
|
72 |
return null; |
|
73 |
} |
|
74 |
|
|
75 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingUpdatePolytomousKeyAllNodesHandler.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2015 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler; |
|
10 |
|
|
11 |
import org.eclipse.core.commands.ExecutionEvent; |
|
12 |
import org.eclipse.core.commands.operations.AbstractOperation; |
|
13 |
import org.eclipse.core.runtime.IStatus; |
|
14 |
import org.eclipse.core.runtime.Status; |
|
15 |
|
|
16 |
import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels; |
|
17 |
import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingUpdatePolytomousKeyAllNodesOperation; |
|
18 |
import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler; |
|
19 |
|
|
20 |
/** |
|
21 |
* @author cmathew |
|
22 |
* @date 29 Jun 2015 |
|
23 |
* |
|
24 |
*/ |
|
25 |
public class RemotingUpdatePolytomousKeyAllNodesHandler extends RemotingCdmHandler { |
|
26 |
|
|
27 |
/** |
|
28 |
* @param label |
|
29 |
*/ |
|
30 |
public RemotingUpdatePolytomousKeyAllNodesHandler() { |
|
31 |
super(PolytomousKeyViewLabels.UPDATE_ALL_POLYTOMOUS_KEY_NODES_LABEL); |
|
32 |
} |
|
33 |
|
|
34 |
/* (non-Javadoc) |
|
35 |
* @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent) |
|
36 |
*/ |
|
37 |
@Override |
|
38 |
public IStatus allowOperations(ExecutionEvent event) { |
|
39 |
return Status.OK_STATUS; |
|
40 |
} |
|
41 |
|
|
42 |
/* (non-Javadoc) |
|
43 |
* @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent) |
|
44 |
*/ |
|
45 |
@Override |
|
46 |
public AbstractOperation prepareOperation(ExecutionEvent event) { |
|
47 |
return new RemotingUpdatePolytomousKeyAllNodesOperation(event.getTrigger(), false); |
|
48 |
} |
|
49 |
|
|
50 |
/* (non-Javadoc) |
|
51 |
* @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete() |
|
52 |
*/ |
|
53 |
@Override |
|
54 |
public void onComplete() { |
|
55 |
// TODO Auto-generated method stub |
|
56 |
|
|
57 |
} |
|
58 |
|
|
59 |
} |
Also available in: Unified diff
ref #6913 Remove polytomous handler