Revision 22f2d1a4
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java | ||
---|---|---|
135 | 135 |
editor.init(input); |
136 | 136 |
} |
137 | 137 |
|
138 |
public static void openTaxonBaseE4(UUID taxonBaseUuid) throws PartInitException{
|
|
138 |
public static void openTaxonBaseE4(UUID taxonBaseUuid) { |
|
139 | 139 |
//FIXME E4 this can probably be removed when fully migrated |
140 | 140 |
TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid); |
141 | 141 |
|
... | ... | |
163 | 163 |
* should appear in neither the list of recent names nor in the taxonomic |
164 | 164 |
* tree when opened. |
165 | 165 |
* |
166 |
* @throws org.eclipse.ui.PartInitException |
|
167 |
* if any. |
|
168 | 166 |
* @param parentNodeUuid |
169 | 167 |
* a {@link java.util.UUID} object. |
170 | 168 |
*/ |
171 |
public static void openEmptyE4(UUID parentNodeUuid) throws PartInitException {
|
|
169 |
public static void openEmptyE4(UUID parentNodeUuid) { |
|
172 | 170 |
TaxonEditorInputE4 input = TaxonEditorInputE4 |
173 | 171 |
.NewEmptyInstance(parentNodeUuid); |
174 | 172 |
EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class); |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/EditNewTaxonHandler.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
14 | 14 |
import org.eclipse.core.commands.ExecutionEvent; |
15 | 15 |
import org.eclipse.core.commands.ExecutionException; |
16 | 16 |
import org.eclipse.core.commands.IHandler; |
17 |
import org.eclipse.swt.widgets.Display; |
|
18 |
import org.eclipse.ui.PartInitException; |
|
19 | 17 |
|
20 | 18 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
21 | 19 |
|
... | ... | |
34 | 32 |
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
35 | 33 |
*/ |
36 | 34 |
/** {@inheritDoc} */ |
37 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
38 |
|
|
35 |
@Override |
|
36 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
37 |
|
|
39 | 38 |
logger.debug("Handler called: " + this.getClass().getCanonicalName()); //$NON-NLS-1$ |
40 |
|
|
41 |
try { |
|
42 |
EditorUtil.openEmptyE4(null); |
|
43 |
} catch (PartInitException e) { |
|
44 |
e.printStackTrace(); |
|
45 |
} |
|
39 |
|
|
40 |
EditorUtil.openEmptyE4(null); |
|
46 | 41 |
|
47 | 42 |
return null; |
48 | 43 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenTaxonEditorForTaxonBaseHandler.java | ||
---|---|---|
3 | 3 |
|
4 | 4 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
5 | 5 |
import org.eclipse.swt.widgets.Shell; |
6 |
import org.eclipse.ui.PartInitException; |
|
7 | 6 |
|
8 | 7 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
9 | 8 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
10 | 9 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
11 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
|
12 | 10 |
import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4; |
13 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
14 | 11 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
15 | 12 |
|
16 | 13 |
|
... | ... | |
23 | 20 |
|
24 | 21 |
@Override |
25 | 22 |
protected void open(TaxonBase entity, Shell shell, EPartService partService) { |
26 |
try { |
|
27 |
EditorUtil.openTaxonBaseE4(entity.getUuid()); |
|
28 |
} catch (PartInitException e) { |
|
29 |
MessagingUtils.error(DefaultOpenTaxonEditorForTaxonBaseHandler.class, Messages.DefaultOpenTaxonEditorForTaxonBaseHandler_COULD_NOT_OPEN+entity, e); |
|
30 |
} |
|
23 |
EditorUtil.openTaxonBaseE4(entity.getUuid()); |
|
31 | 24 |
} |
32 | 25 |
|
33 | 26 |
/** |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListEditor.java | ||
---|---|---|
47 | 47 |
import eu.etaxonomy.taxeditor.editor.key.KeyEditor; |
48 | 48 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
49 | 49 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkable; |
50 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
51 | 50 |
|
52 | 51 |
/** |
53 | 52 |
* @author n.hoffmann |
... | ... | |
99 | 98 |
if (selectedColumn == 5) { |
100 | 99 |
Taxon taxon = getItemTaxon(node); |
101 | 100 |
if (taxon != null) { |
102 |
try { |
|
103 |
EditorUtil.openTaxonBaseE4((taxon).getUuid()); |
|
104 |
} catch (PartInitException e) { |
|
105 |
MessagingUtils.error(getClass(), e); |
|
106 |
} |
|
101 |
EditorUtil.openTaxonBaseE4((taxon).getUuid()); |
|
107 | 102 |
} |
108 | 103 |
} |
109 | 104 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListItem.java | ||
---|---|---|
16 | 16 |
import org.eclipse.swt.widgets.Composite; |
17 | 17 |
import org.eclipse.swt.widgets.Label; |
18 | 18 |
import org.eclipse.swt.widgets.Link; |
19 |
import org.eclipse.ui.PartInitException; |
|
20 | 19 |
import org.eclipse.ui.PlatformUI; |
21 | 20 |
import org.eclipse.ui.forms.IFormPart; |
22 | 21 |
import org.eclipse.ui.forms.IManagedForm; |
... | ... | |
98 | 97 |
Object data = e.widget.getData(); |
99 | 98 |
|
100 | 99 |
if (data instanceof Taxon) { |
101 |
try { |
|
102 |
EditorUtil.openTaxonBaseE4(((Taxon) data).getUuid()); |
|
103 |
} catch (PartInitException e1) { |
|
104 |
// TODO Auto-generated catch block |
|
105 |
e1.printStackTrace(); |
|
106 |
} |
|
100 |
EditorUtil.openTaxonBaseE4(((Taxon) data).getUuid()); |
|
107 | 101 |
} |
108 | 102 |
} |
109 | 103 |
}; |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/PolytomousKeyListEditorE4.java | ||
---|---|---|
34 | 34 |
import org.eclipse.swt.widgets.Composite; |
35 | 35 |
import org.eclipse.swt.widgets.Table; |
36 | 36 |
import org.eclipse.swt.widgets.TableItem; |
37 |
import org.eclipse.ui.PartInitException; |
|
38 | 37 |
|
39 | 38 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
40 | 39 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
... | ... | |
54 | 53 |
import eu.etaxonomy.taxeditor.model.DataChangeBridge; |
55 | 54 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkable; |
56 | 55 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
57 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
58 | 56 |
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart; |
59 | 57 |
|
60 | 58 |
/** |
... | ... | |
100 | 98 |
if (selectedColumn == 5) { |
101 | 99 |
Taxon taxon = getItemTaxon(node); |
102 | 100 |
if (taxon != null) { |
103 |
try { |
|
104 |
EditorUtil.openTaxonBaseE4((taxon).getUuid()); |
|
105 |
} catch (PartInitException e) { |
|
106 |
MessagingUtils.error(getClass(), e); |
|
107 |
} |
|
101 |
EditorUtil.openTaxonBaseE4((taxon).getUuid()); |
|
108 | 102 |
} |
109 | 103 |
} |
110 | 104 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/TaxonNameEditorE4.java | ||
---|---|---|
42 | 42 |
import org.eclipse.ui.ISelectionListener; |
43 | 43 |
import org.eclipse.ui.IWorkbenchPart; |
44 | 44 |
import org.eclipse.ui.IWorkbenchPartReference; |
45 |
import org.eclipse.ui.PartInitException; |
|
46 | 45 |
import org.eclipse.ui.PlatformUI; |
47 | 46 |
import org.eclipse.ui.forms.ManagedForm; |
48 | 47 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
... | ... | |
80 | 79 |
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData; |
81 | 80 |
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia; |
82 | 81 |
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; |
82 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
83 | 83 |
import eu.etaxonomy.taxeditor.model.TaxeditorPartService; |
84 | 84 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
85 | 85 |
import eu.etaxonomy.taxeditor.preference.Resources; |
... | ... | |
378 | 378 |
monitor.done(); |
379 | 379 |
} |
380 | 380 |
|
381 |
public void init(TaxonEditorInputE4 input) |
|
382 |
throws PartInitException { |
|
381 |
public void init(TaxonEditorInputE4 input) { |
|
383 | 382 |
|
384 | 383 |
if (!(input != null)) { |
385 |
throw new PartInitException(Messages.TaxonNameEditor_INVALID_INPUT); |
|
384 |
MessagingUtils.error(this.getClass(), new Exception(Messages.TaxonNameEditor_INVALID_INPUT)); |
|
385 |
return; |
|
386 | 386 |
} |
387 | 387 |
|
388 | 388 |
if (input.getAdapter(Taxon.class) != null) { |
389 | 389 |
taxon = CdmBase.deproxy(input.getAdapter(Taxon.class), Taxon.class); |
390 | 390 |
} else { |
391 |
throw new PartInitException(Messages.TaxonNameEditor_INVALID_INPUT_TAXON_NULL); |
|
391 |
MessagingUtils.error(this.getClass(), new Exception(Messages.TaxonNameEditor_INVALID_INPUT_TAXON_NULL)); |
|
392 |
return; |
|
392 | 393 |
} |
393 | 394 |
|
394 | 395 |
this.input = input; |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/handler/OpenRelatedConceptHandlerE4.java | ||
---|---|---|
16 | 16 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
17 | 17 |
import org.eclipse.e4.ui.services.IServiceConstants; |
18 | 18 |
import org.eclipse.jface.viewers.ISelection; |
19 |
import org.eclipse.ui.PartInitException; |
|
20 | 19 |
|
21 | 20 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
22 | 21 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
... | ... | |
81 | 80 |
* @param relatedTaxon |
82 | 81 |
*/ |
83 | 82 |
protected void openConcept(TaxonBase<?> relatedTaxon) { |
84 |
try { |
|
85 |
EditorUtil.openTaxonBaseE4(relatedTaxon.getUuid()); |
|
86 |
} catch (PartInitException e) { |
|
87 |
MessagingUtils.messageDialog(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN, getClass(), |
|
88 |
String.format(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE ,relatedTaxon), e); |
|
89 |
} |
|
83 |
EditorUtil.openTaxonBaseE4(relatedTaxon.getUuid()); |
|
90 | 84 |
} |
91 | 85 |
|
92 | 86 |
private Taxon getRelatedTaxon(TaxonRelationship relationship, Taxon taxon){ |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.navigation; |
11 | 11 |
|
12 | 12 |
import java.util.Collection; |
13 |
import java.util.HashMap; |
|
14 | 13 |
import java.util.HashSet; |
15 |
import java.util.Map; |
|
16 | 14 |
import java.util.Set; |
17 | 15 |
import java.util.UUID; |
18 | 16 |
|
19 |
import org.eclipse.core.commands.Command; |
|
20 |
import org.eclipse.core.commands.ParameterizedCommand; |
|
21 |
import org.eclipse.core.commands.common.NotDefinedException; |
|
22 | 17 |
import org.eclipse.core.commands.operations.IUndoContext; |
23 | 18 |
import org.eclipse.core.commands.operations.UndoContext; |
24 | 19 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
25 | 20 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
26 | 21 |
import org.eclipse.jface.wizard.WizardDialog; |
27 | 22 |
import org.eclipse.swt.widgets.Shell; |
28 |
import org.eclipse.ui.IWorkbenchWindow; |
|
29 |
import org.eclipse.ui.PartInitException; |
|
30 |
import org.eclipse.ui.PlatformUI; |
|
31 |
import org.eclipse.ui.commands.ICommandService; |
|
32 |
import org.eclipse.ui.handlers.IHandlerService; |
|
33 | 23 |
|
34 | 24 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
35 | 25 |
import eu.etaxonomy.cdm.api.service.INameService; |
... | ... | |
46 | 36 |
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache; |
47 | 37 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
48 | 38 |
import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4; |
49 |
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin; |
|
50 | 39 |
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4; |
51 | 40 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
52 | 41 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
53 | 42 |
import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin; |
54 | 43 |
import eu.etaxonomy.taxeditor.navigation.l10n.Messages; |
55 |
import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4; |
|
56 | 44 |
import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard; |
57 | 45 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
58 | 46 |
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; |
59 | 47 |
|
60 | 48 |
/** |
61 |
* <p>NavigationUtil class.</p> |
|
62 | 49 |
* |
63 | 50 |
* @author n.hoffmann |
64 | 51 |
* @created 24.03.2009 |
... | ... | |
67 | 54 |
public class NavigationUtil extends AbstractUtility{ |
68 | 55 |
|
69 | 56 |
private static final String NOT_IMPLEMENTED_YET = Messages.NavigationUtil_NOT_IMPLEMENTED; |
70 |
private static final String ERROR_OPENING_THE_EDITOR = Messages.NavigationUtil_OPEN_ERROR; |
|
71 | 57 |
private static IUndoContext defaultUndoContext; |
72 | 58 |
|
73 | 59 |
/** |
... | ... | |
75 | 61 |
* |
76 | 62 |
* @param selectedObject a {@link eu.etaxonomy.cdm.model.common.CdmBase} object. |
77 | 63 |
*/ |
78 |
public static void openEditor(UuidAndTitleCache uuidAndTitleCache){ |
|
64 |
public static void openEditor(UuidAndTitleCache uuidAndTitleCache, Shell shell){
|
|
79 | 65 |
Class<?> type = uuidAndTitleCache.getType(); |
80 | 66 |
ICdmBase cdmBase = null; |
81 | 67 |
if(type.equals(Classification.class)){ |
... | ... | |
94 | 80 |
MessagingUtils.warningDialog(Messages.NavigationUtil_UNKNOWN_TYPE, NavigationUtil.class, Messages.NavigationUtil_UNKNOWN_TYPE_MESSAGE); |
95 | 81 |
} |
96 | 82 |
if(cdmBase!=null){ |
97 |
openEditor(cdmBase, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
|
|
83 |
openEditor(cdmBase, shell);
|
|
98 | 84 |
} |
99 | 85 |
else{ |
100 | 86 |
MessagingUtils.warningDialog(Messages.NavigationUtil_NOT_FOUND, NavigationUtil.class, Messages.NavigationUtil_NOT_FOUND_MESSAGE); |
... | ... | |
117 | 103 |
else{ |
118 | 104 |
EditorUtil.openTaxonNodeE4(entityUuid); |
119 | 105 |
} |
120 |
}else if(selectedObject instanceof TaxonBase){ |
|
121 |
TaxonBase taxonBase = (TaxonBase)selectedObject; |
|
122 |
if(taxonBase.isOrphaned()){ |
|
123 |
openInBulkEditor(taxonBase); |
|
124 |
} |
|
125 |
else{ |
|
126 |
EditorUtil.openTaxonBaseE4(entityUuid); |
|
127 |
} |
|
128 |
}else if(selectedObject instanceof TaxonName){ |
|
129 |
openInBulkEditor(selectedObject); |
|
130 | 106 |
}else if(selectedObject instanceof PolytomousKey){ |
131 | 107 |
EditorUtil.openPolytomousKey(entityUuid); |
132 | 108 |
}else{ |
133 | 109 |
MessagingUtils.warningDialog(Messages.NavigationUtil_UNSUPPORTED_TYPE, NavigationUtil.class, Messages.NavigationUtil_UNSUPPORTED_TYPE_MESSAGE + selectedObject); |
134 | 110 |
} |
135 |
} catch (PartInitException e) { |
|
136 |
MessagingUtils.error(NavigationUtil.class, ERROR_OPENING_THE_EDITOR, e); |
|
137 | 111 |
} catch (Exception e) { |
138 | 112 |
MessagingUtils.errorDialog(Messages.NavigationUtil_CREATE_FAILED, |
139 | 113 |
NavigationUtil.class, |
... | ... | |
144 | 118 |
} |
145 | 119 |
} |
146 | 120 |
|
147 |
private static void openInBulkEditor(ICdmBase selectedObject) { |
|
148 |
ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class); |
|
149 |
IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class); |
|
150 |
String openInBulkEditorCommand = "eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity"; //$NON-NLS-1$ |
|
151 |
Command command = commandService.getCommand(openInBulkEditorCommand); |
|
152 |
if(command.isDefined()){ |
|
153 |
Map<String, UUID> params = new HashMap<String, UUID>(); |
|
154 |
params.put(openInBulkEditorCommand+".uuid", selectedObject.getUuid()); //$NON-NLS-1$ |
|
155 |
ParameterizedCommand parameterizedCommand = ParameterizedCommand.generateCommand(command, params); |
|
156 |
try { |
|
157 |
if(parameterizedCommand!=null){ |
|
158 |
handlerService.executeCommand(parameterizedCommand, null); |
|
159 |
return; |
|
160 |
} |
|
161 |
else{ |
|
162 |
handlerService.executeCommand(command.getId(), null); |
|
163 |
return; |
|
164 |
} |
|
165 |
} catch (NotDefinedException nde) { |
|
166 |
throw new RuntimeException("Could not find open command: " + command.getId()); //$NON-NLS-1$ |
|
167 |
} catch (Exception exception) { |
|
168 |
MessagingUtils.error(NavigationUtil.class, "An exception occured while trying to execute "+command.getId(), exception); //$NON-NLS-1$ |
|
169 |
} |
|
170 |
} |
|
171 |
} |
|
172 |
|
|
173 | 121 |
/** |
174 | 122 |
* <p>openEmpty</p> |
175 | 123 |
* |
176 | 124 |
* @param parentNodeUuid a {@link java.util.UUID} object. |
177 | 125 |
*/ |
178 | 126 |
public static void openEmpty(UUID parentNodeUuid) { |
179 |
try { |
|
180 |
EditorUtil.openEmptyE4(parentNodeUuid); |
|
181 |
} catch (PartInitException e) { |
|
182 |
MessagingUtils.error(NavigationUtil.class, ERROR_OPENING_THE_EDITOR, e); |
|
183 |
} |
|
184 |
} |
|
185 |
|
|
186 |
/** |
|
187 |
* <p>getShell</p> |
|
188 |
* |
|
189 |
* @return a {@link org.eclipse.swt.widgets.Shell} object. |
|
190 |
*/ |
|
191 |
public static Shell getShell() { |
|
192 |
return getActiveWindow().getShell(); |
|
193 |
} |
|
194 |
|
|
195 |
/** |
|
196 |
* <p>getActiveWindow</p> |
|
197 |
* |
|
198 |
* @return a {@link org.eclipse.ui.IWorkbenchWindow} object. |
|
199 |
*/ |
|
200 |
public static IWorkbenchWindow getActiveWindow() { |
|
201 |
return TaxeditorNavigationPlugin.getDefault().getWorkbench(). |
|
202 |
getActiveWorkbenchWindow(); |
|
203 |
} |
|
204 |
|
|
205 |
/** |
|
206 |
* <p>getWorkbenchUndoContext</p> |
|
207 |
* |
|
208 |
* @return a {@link org.eclipse.core.commands.operations.IUndoContext} object. |
|
209 |
*/ |
|
210 |
public static IUndoContext getWorkbenchUndoContext() { |
|
211 |
return TaxeditorEditorPlugin.getDefault().getWorkbench(). |
|
212 |
getOperationSupport().getUndoContext(); |
|
127 |
EditorUtil.openEmptyE4(parentNodeUuid); |
|
213 | 128 |
} |
214 | 129 |
|
215 | 130 |
/** |
... | ... | |
277 | 192 |
} |
278 | 193 |
|
279 | 194 |
private static void handleOpeningOfMultipleTaxa(Set<Taxon> acceptedTaxa) { |
280 |
if(acceptedTaxa.size() == 1){ |
|
281 |
openEditor(acceptedTaxa.iterator().next(), PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
|
282 |
}else if(acceptedTaxa.size() > 1){ |
|
283 |
// FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open. |
|
284 |
MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_MULTI_TREE); |
|
285 |
}else if(acceptedTaxa.size() == 0){ |
|
286 |
// this is an undesired state |
|
287 |
MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_ORPHAN_TAXON); |
|
288 |
} |
|
195 |
//FIXME E4 migrate/delete |
|
196 |
// if(acceptedTaxa.size() == 1){ |
|
197 |
// openEditor(acceptedTaxa.iterator().next(), PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
|
198 |
// }else if(acceptedTaxa.size() > 1){ |
|
199 |
// // FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open. |
|
200 |
// MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_MULTI_TREE); |
|
201 |
// }else if(acceptedTaxa.size() == 0){ |
|
202 |
// // this is an undesired state |
|
203 |
// MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_ORPHAN_TAXON); |
|
204 |
// } |
|
289 | 205 |
} |
290 | 206 |
|
291 | 207 |
/** |
... | ... | |
293 | 209 |
*/ |
294 | 210 |
private static void handleOpeningOfMultipleTaxonNodes( |
295 | 211 |
Set<TaxonNode> taxonNodes) { |
296 |
|
|
297 |
if(taxonNodes.size() == 1){ |
|
298 |
openEditor(taxonNodes.iterator().next(), PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
|
299 |
}else if(taxonNodes.size() > 1){ |
|
300 |
// FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open. |
|
301 |
MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open. This case is not handled yet by the software."); |
|
302 |
}else if(taxonNodes.size() == 0){ |
|
303 |
// this is an undesired state |
|
304 |
MessagingUtils.warningDialog(Messages.NavigationUtil_INCORRECT_STATE, NavigationUtil.class, Messages.NavigationUtil_INCORRECT_STATE_MESSAGE); |
|
305 |
} |
|
306 |
} |
|
307 |
|
|
308 |
public static TaxonNavigatorE4 getNavigator(boolean restore) { |
|
309 |
//FIXME E4 migrate or delete |
|
310 |
return null; |
|
311 |
// return (TaxonNavigatorE4) getView(TaxonNavigator.ID, restore); |
|
212 |
//FIXME E4 migrate/delete |
|
213 |
// |
|
214 |
// if(taxonNodes.size() == 1){ |
|
215 |
// openEditor(taxonNodes.iterator().next(), PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
|
216 |
// }else if(taxonNodes.size() > 1){ |
|
217 |
// // FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open. |
|
218 |
// MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open. This case is not handled yet by the software."); |
|
219 |
// }else if(taxonNodes.size() == 0){ |
|
220 |
// // this is an undesired state |
|
221 |
// MessagingUtils.warningDialog(Messages.NavigationUtil_INCORRECT_STATE, NavigationUtil.class, Messages.NavigationUtil_INCORRECT_STATE_MESSAGE); |
|
222 |
// } |
|
312 | 223 |
} |
313 | 224 |
|
314 | 225 |
/** |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigatorStateManager.java | ||
---|---|---|
5 | 5 |
import org.eclipse.ui.IMemento; |
6 | 6 |
|
7 | 7 |
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter; |
8 |
import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4; |
|
9 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
10 | 8 |
|
11 | 9 |
/** |
12 | 10 |
* @author n.hoffmann |
... | ... | |
22 | 20 |
*/ |
23 | 21 |
@Override |
24 | 22 |
public void contextStart(IMemento memento, IProgressMonitor monitor) { |
25 |
TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(true); |
|
26 |
if(navigator != null){ |
|
27 |
navigator.init(); |
|
28 |
if (PreferencesUtil.isStoreNavigatorState()){ |
|
29 |
navigator.restore(memento, monitor); |
|
30 |
} else { |
|
31 |
navigator.restore(null, monitor); |
|
32 |
} |
|
33 |
|
|
34 |
} |
|
23 |
// TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(true);
|
|
24 |
// if(navigator != null){
|
|
25 |
// navigator.init();
|
|
26 |
// if (PreferencesUtil.isStoreNavigatorState()){
|
|
27 |
// navigator.restore(memento, monitor);
|
|
28 |
// } else {
|
|
29 |
// navigator.restore(null, monitor);
|
|
30 |
// }
|
|
31 |
// |
|
32 |
// }
|
|
35 | 33 |
} |
36 | 34 |
|
37 | 35 |
@Override |
38 | 36 |
public void contextRefresh(IProgressMonitor monitor) { |
39 |
TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(true); |
|
40 |
if(navigator != null){ |
|
41 |
navigator.refresh(); |
|
42 |
} |
|
37 |
// TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(true);
|
|
38 |
// if(navigator != null){
|
|
39 |
// navigator.refresh();
|
|
40 |
// }
|
|
43 | 41 |
} |
44 | 42 |
|
45 | 43 |
/** |
... | ... | |
49 | 47 |
*/ |
50 | 48 |
@Override |
51 | 49 |
public void contextStop(IMemento memento, IProgressMonitor monitor) { |
52 |
saveNavigatorState(memento, monitor); |
|
53 |
clearNavigator(); |
|
50 |
// saveNavigatorState(memento, monitor);
|
|
51 |
// clearNavigator();
|
|
54 | 52 |
} |
55 | 53 |
|
56 | 54 |
/** {@inheritDoc} */ |
57 | 55 |
@Override |
58 | 56 |
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) { |
59 |
saveNavigatorState(memento, monitor); |
|
57 |
// saveNavigatorState(memento, monitor);
|
|
60 | 58 |
|
61 | 59 |
} |
62 | 60 |
|
... | ... | |
64 | 62 |
* @param memento |
65 | 63 |
*/ |
66 | 64 |
private void saveNavigatorState(IMemento memento, IProgressMonitor monitor) { |
67 |
TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(false); |
|
68 |
if(navigator != null){ |
|
69 |
//FIXME E4 migrate or delete |
|
70 |
// navigator.save(memento, monitor); |
|
71 |
} |
|
65 |
// TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(false);
|
|
66 |
// if(navigator != null){
|
|
67 |
// //FIXME E4 migrate or delete
|
|
68 |
//// navigator.save(memento, monitor);
|
|
69 |
// }
|
|
72 | 70 |
} |
73 | 71 |
|
74 | 72 |
/** |
75 | 73 |
* Removes all content form the TaxonNavigator |
76 | 74 |
*/ |
77 | 75 |
private void clearNavigator() { |
78 |
TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(false); |
|
79 |
if(navigator != null){ |
|
80 |
navigator.clear(); |
|
81 |
} |
|
76 |
// TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(false);
|
|
77 |
// if(navigator != null){
|
|
78 |
// navigator.clear();
|
|
79 |
// }
|
|
82 | 80 |
} |
83 | 81 |
|
84 | 82 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/RecentNamesContributionItem.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
14 | 14 |
import org.eclipse.jface.action.IContributionItem; |
15 | 15 |
import org.eclipse.jface.action.IContributionManager; |
16 | 16 |
import org.eclipse.swt.widgets.Menu; |
17 |
import org.eclipse.ui.actions.ContributionItemFactory; |
|
18 |
import org.eclipse.ui.internal.IPreferenceConstants; |
|
19 |
import org.eclipse.ui.internal.Workbench; |
|
20 |
import org.eclipse.ui.internal.WorkbenchPlugin; |
|
21 |
|
|
22 |
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin; |
|
23 |
import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin; |
|
24 |
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; |
|
25 | 17 |
|
26 | 18 |
/** |
27 | 19 |
* This is a wrapper for Eclipse's recently opened editors functionality. IsDirty() |
... | ... | |
32 | 24 |
* @version 1.0 |
33 | 25 |
*/ |
34 | 26 |
public class RecentNamesContributionItem extends ContributionItem { |
27 |
//FIXME E4 migrate recent menu items |
|
35 | 28 |
private static final Logger logger = Logger |
36 | 29 |
.getLogger(RecentNamesContributionItem.class); |
37 | 30 |
|
... | ... | |
43 | 36 |
//// WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RECENT_FILES, 10); |
44 | 37 |
// TaxeditorNavigationPlugin.getDefault().getPreferenceStore().setValue("RECENT_FILES", 10); |
45 | 38 |
// } |
46 |
|
|
39 |
|
|
47 | 40 |
private IContributionItem getRecentWindows() { |
48 |
if (recentWindows == null) { |
|
49 |
|
|
50 |
// int itemsToShow = TaxeditorNavigationPlugin.getDefault().getPreferenceStore() |
|
51 |
// .getInt("RECENT_FILES"); |
|
52 |
|
|
53 |
recentWindows = ContributionItemFactory.REOPEN_EDITORS.create(NavigationUtil.getActiveWindow()); |
|
54 |
recentWindows.setParent(parent); |
|
55 |
} |
|
41 |
// if (recentWindows == null) {
|
|
42 |
// |
|
43 |
//// int itemsToShow = TaxeditorNavigationPlugin.getDefault().getPreferenceStore()
|
|
44 |
//// .getInt("RECENT_FILES");
|
|
45 |
// |
|
46 |
// recentWindows = ContributionItemFactory.REOPEN_EDITORS.create(NavigationUtil.getActiveWindow());
|
|
47 |
// recentWindows.setParent(parent);
|
|
48 |
// }
|
|
56 | 49 |
return recentWindows; |
57 | 50 |
} |
58 |
|
|
51 |
|
|
59 | 52 |
/* (non-Javadoc) |
60 | 53 |
* @see org.eclipse.jface.action.IContributionItem#dispose() |
61 | 54 |
*/ |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/WorkbenchUndoContextAdapterFactory.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
28 | 28 |
private UndoContext defaultUndoContext; |
29 | 29 |
|
30 | 30 |
private static final Class[] ADAPTER_LIST = new Class[] { IUndoContext.class }; |
31 |
|
|
31 |
|
|
32 | 32 |
/* (non-Javadoc) |
33 | 33 |
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) |
34 | 34 |
*/ |
35 | 35 |
/** {@inheritDoc} */ |
36 |
public Object getAdapter(Object adaptableObject, Class adapterType) { |
|
37 |
if (IUndoContext.class.equals(adapterType)) { |
|
38 |
return NavigationUtil.getWorkbenchUndoContext(); |
|
39 |
} |
|
36 |
@Override |
|
37 |
public Object getAdapter(Object adaptableObject, Class adapterType) { |
|
38 |
// if (IUndoContext.class.equals(adapterType)) { |
|
39 |
// return NavigationUtil.getWorkbenchUndoContext(); |
|
40 |
// } |
|
40 | 41 |
return null; |
41 | 42 |
} |
42 | 43 |
|
... | ... | |
58 | 59 |
* |
59 | 60 |
* @return an array of {@link java.lang.Class} objects. |
60 | 61 |
*/ |
61 |
public Class[] getAdapterList() { |
|
62 |
@Override |
|
63 |
public Class[] getAdapterList() { |
|
62 | 64 |
return ADAPTER_LIST; |
63 | 65 |
} |
64 | 66 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/EditPolytomousKeyNodesHandler.java | ||
---|---|---|
19 | 19 |
import org.eclipse.jface.viewers.ISelection; |
20 | 20 |
import org.eclipse.jface.viewers.StructuredSelection; |
21 | 21 |
import org.eclipse.swt.widgets.Display; |
22 |
import org.eclipse.ui.PlatformUI; |
|
23 | 22 |
|
24 | 23 |
import eu.etaxonomy.cdm.model.description.PolytomousKey; |
25 | 24 |
import eu.etaxonomy.taxeditor.navigation.NavigationUtil; |
... | ... | |
58 | 57 |
|
59 | 58 |
@Override |
60 | 59 |
public void run() { |
61 |
NavigationUtil.openEditor((PolytomousKey) selectedObject, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
|
60 |
// NavigationUtil.openEditor((PolytomousKey) selectedObject, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
|
|
62 | 61 |
} |
63 | 62 |
|
64 | 63 |
}); |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/Messages.java | ||
---|---|---|
72 | 72 |
public static String NavigationUtil_NOT_FOUND; |
73 | 73 |
public static String NavigationUtil_NOT_FOUND_MESSAGE; |
74 | 74 |
public static String NavigationUtil_NOT_IMPLEMENTED; |
75 |
public static String NavigationUtil_OPEN_ERROR; |
|
76 | 75 |
public static String NavigationUtil_ORPHAN_NAME_MESSAGE; |
77 | 76 |
public static String NavigationUtil_ORPHAN_TAXON; |
78 | 77 |
public static String NavigationUtil_UNKNOWN_TYPE; |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages.properties | ||
---|---|---|
53 | 53 |
NavigationUtil_NOT_FOUND=Cdm entity not found |
54 | 54 |
NavigationUtil_NOT_FOUND_MESSAGE=CDM entity could not be found in the database. |
55 | 55 |
NavigationUtil_NOT_IMPLEMENTED=Not implemented yet |
56 |
NavigationUtil_OPEN_ERROR=Error opening the editor |
|
57 | 56 |
NavigationUtil_ORPHAN_NAME_MESSAGE=You chose to open a name that has no connection to a taxon. The Editor does not support editing of such a content type at the moment. |
58 | 57 |
NavigationUtil_ORPHAN_TAXON=This taxon is not connected to a classification. Currently editing of such taxa is not supported yet. |
59 | 58 |
NavigationUtil_UNKNOWN_TYPE=Unknown type |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages_de.properties | ||
---|---|---|
53 | 53 |
NavigationUtil_NOT_FOUND=Cdm entity not found |
54 | 54 |
NavigationUtil_NOT_FOUND_MESSAGE=CDM entity could not be found in the database. |
55 | 55 |
NavigationUtil_NOT_IMPLEMENTED=Noch nicht implementiert |
56 |
NavigationUtil_OPEN_ERROR=Fehler beim ?ffnen des Editors |
|
57 | 56 |
NavigationUtil_ORPHAN_NAME_MESSAGE=Sie versuchen eine Namen ohne Verbindung zu einem Taxon zu ?ffnen. Der Taxonomic Editor unterst?tzt aktuell kein Editieren solcher Objekte. |
58 | 57 |
NavigationUtil_ORPHAN_TAXON=Das Taxon ist in keine Klassifikation vorhanden. Der Taxonomic Editor unterst?tzt aktuell kein Editieren solcher Objekte. |
59 | 58 |
NavigationUtil_UNKNOWN_TYPE=Unknown type |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/Root.java | ||
---|---|---|
25 | 25 |
import eu.etaxonomy.cdm.model.common.ITreeNode; |
26 | 26 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
27 | 27 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
28 |
import eu.etaxonomy.taxeditor.navigation.NavigationUtil; |
|
29 |
import eu.etaxonomy.taxeditor.navigation.l10n.Messages; |
|
30 |
import eu.etaxonomy.taxeditor.navigation.operation.CreateClassification; |
|
31 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
|
32 | 28 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
33 | 29 |
|
34 | 30 |
/** |
... | ... | |
63 | 59 |
|
64 | 60 |
List<Classification> classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, propertyPaths); |
65 | 61 |
List<ITreeNode> rootNodes = new ArrayList<>(); |
66 |
|
|
67 |
if(classifications.size() == 0){ |
|
68 |
Classification classification = Classification.NewInstance(Messages.Root_MY_CLASSIFICATION); |
|
69 |
AbstractPostOperation operation = new CreateClassification(Messages.Root_CREATE_CLASSIFICATION, NavigationUtil.getUndoContext(), classification, NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false)); |
|
70 |
NavigationUtil.executeOperation(operation); |
|
71 | 62 |
|
72 |
classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, propertyPaths); |
|
63 |
if(classifications.size() == 0){ |
|
64 |
//FIXME E4 migrate or delete; when does this happen and SHOULD this happen? |
|
65 |
// Classification classification = Classification.NewInstance(Messages.Root_MY_CLASSIFICATION); |
|
66 |
// AbstractPostOperation operation = new CreateClassification(Messages.Root_CREATE_CLASSIFICATION, NavigationUtil.getUndoContext(), classification, NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false)); |
|
67 |
// NavigationUtil.executeOperation(operation); |
|
68 |
// |
|
69 |
// classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, propertyPaths); |
|
73 | 70 |
} |
74 | 71 |
for (Classification classification: classifications){ |
75 | 72 |
rootNodes.add(classification.getRootNode()); |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java | ||
---|---|---|
24 | 24 |
import org.eclipse.core.runtime.IAdaptable; |
25 | 25 |
import org.eclipse.core.runtime.IProgressMonitor; |
26 | 26 |
import org.eclipse.jface.viewers.DoubleClickEvent; |
27 |
import org.eclipse.jface.viewers.ISelection; |
|
28 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
29 | 27 |
import org.eclipse.jface.viewers.TreePath; |
30 | 28 |
import org.eclipse.ui.IMemento; |
31 | 29 |
import org.eclipse.ui.IViewSite; |
32 | 30 |
import org.eclipse.ui.PartInitException; |
33 |
import org.eclipse.ui.PlatformUI; |
|
34 | 31 |
import org.eclipse.ui.navigator.CommonNavigator; |
35 | 32 |
|
36 | 33 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
... | ... | |
40 | 37 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
41 | 38 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
42 | 39 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
43 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
|
44 | 40 |
import eu.etaxonomy.cdm.model.common.ITreeNode; |
45 | 41 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
46 | 42 |
import eu.etaxonomy.cdm.model.taxon.TaxonNaturalComparator; |
... | ... | |
465 | 461 |
/** {@inheritDoc} */ |
466 | 462 |
@Override |
467 | 463 |
protected void handleDoubleClick(DoubleClickEvent event) { |
468 |
ISelection selection = event.getSelection(); |
|
469 |
if(selection instanceof IStructuredSelection){ |
|
470 |
Object firstElement = ((IStructuredSelection) selection).getFirstElement(); |
|
471 |
if(firstElement instanceof ICdmBase){ |
|
472 |
NavigationUtil.openEditor((ICdmBase) firstElement, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
|
473 |
} |
|
474 |
} |
|
464 |
// ISelection selection = event.getSelection();
|
|
465 |
// if(selection instanceof IStructuredSelection){
|
|
466 |
// Object firstElement = ((IStructuredSelection) selection).getFirstElement();
|
|
467 |
// if(firstElement instanceof ICdmBase){
|
|
468 |
// NavigationUtil.openEditor((ICdmBase) firstElement, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
|
|
469 |
// }
|
|
470 |
// }
|
|
475 | 471 |
// If the double click is passed up to the super-class it will |
476 | 472 |
// expand/collapse trees. |
477 | 473 |
// We do not want that |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapter.java | ||
---|---|---|
13 | 13 |
import java.util.HashSet; |
14 | 14 |
import java.util.Iterator; |
15 | 15 |
import java.util.Set; |
16 |
import java.util.UUID; |
|
17 | 16 |
|
18 | 17 |
import org.apache.log4j.Logger; |
19 |
import org.eclipse.core.commands.operations.IUndoContext; |
|
20 | 18 |
import org.eclipse.jface.dialogs.MessageDialog; |
21 | 19 |
import org.eclipse.jface.util.LocalSelectionTransfer; |
22 | 20 |
import org.eclipse.jface.viewers.ISelection; |
... | ... | |
32 | 30 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
33 | 31 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
34 | 32 |
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD; |
35 |
import eu.etaxonomy.taxeditor.navigation.NavigationUtil; |
|
36 | 33 |
import eu.etaxonomy.taxeditor.navigation.l10n.Messages; |
37 |
import eu.etaxonomy.taxeditor.navigation.navigator.operation.MoveTaxonOperation; |
|
38 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
|
39 | 34 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
40 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
41 | 35 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
42 | 36 |
|
43 | 37 |
/** |
... | ... | |
189 | 183 |
*/ |
190 | 184 |
private boolean moveTaxon(Set<TaxonNode> taxonNodes, ITaxonTreeNode targetITaxonTreeNode) { |
191 | 185 |
|
192 |
TaxonNavigator taxonNavigator; |
|
193 |
taxonNavigator = (TaxonNavigator) NavigationUtil.showView(TaxonNavigator.ID); |
|
194 |
|
|
195 |
if(targetITaxonTreeNode instanceof TaxonNode){ |
|
196 |
|
|
197 |
TaxonNode targetTaxonNode = (TaxonNode) targetITaxonTreeNode; |
|
198 |
// Make sure parent taxon does not have unsaved changes |
|
199 |
if (NavigationUtil.isDirty(targetTaxonNode)){ |
|
200 |
MessageDialog.openWarning(NavigationUtil.getShell(), TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT, TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE); |
|
201 |
return false; |
|
202 |
} |
|
203 |
|
|
204 |
} |
|
205 |
Iterator<TaxonNode> taxIterator = taxonNodes.iterator(); |
|
206 |
Set<UUID> uuids = new HashSet<UUID>(); |
|
207 |
TaxonNode node = null; |
|
208 |
while(taxIterator.hasNext()){ |
|
209 |
node = taxIterator.next(); |
|
210 |
uuids.add(node.getUuid()); |
|
211 |
} |
|
212 |
if (!PreferencesUtil.getSortNodesNaturally()){ |
|
213 |
IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
214 |
if (workspaceUndoContext == null) { |
|
215 |
logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
|
216 |
return false; |
|
217 |
} |
|
218 |
|
|
219 |
AbstractPostOperation<?> operation = new MoveTaxonOperation |
|
220 |
(TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD); |
|
221 |
NavigationUtil.executeOperation(operation); |
|
222 |
|
|
223 |
logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
224 |
return true; |
|
225 |
}else{ |
|
226 |
String[] buttonLables = {TREE_NODE_DROP_ADAPTER_CHILD, TREE_NODE_DROP_ADAPTER_BEHIND,TREE_NODE_DROP_ADAPTER_CANCEL}; |
|
227 |
MessageDialog dialog = new MessageDialog(null, TARGET_NODE, null, DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0); |
|
228 |
dialog.open(); |
|
229 |
int returnCode = dialog.getReturnCode(); |
|
230 |
if (returnCode == 0){ |
|
231 |
IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
232 |
if (workspaceUndoContext == null) { |
|
233 |
logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
|
234 |
return false; |
|
235 |
} |
|
236 |
|
|
237 |
AbstractPostOperation<?> operation = new MoveTaxonOperation |
|
238 |
(TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD); |
|
239 |
NavigationUtil.executeOperation(operation); |
|
240 |
|
|
241 |
logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
242 |
return true; |
|
243 |
}else if (returnCode == 1){ |
|
244 |
IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
245 |
if (workspaceUndoContext == null) { |
|
246 |
logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
|
247 |
return false; |
|
248 |
} |
|
249 |
TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode; |
|
250 |
|
|
251 |
AbstractPostOperation<?> operation = new MoveTaxonOperation |
|
252 |
(TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.PREVIOUS); |
|
253 |
NavigationUtil.executeOperation(operation); |
|
254 |
|
|
255 |
logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
256 |
return true; |
|
257 |
} |
|
258 |
// } else if (returnCode == 2){ |
|
259 |
// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
260 |
// if (workspaceUndoContext == null) { |
|
261 |
// logger.error("Workspace undo context is null. DND operation cancelled"); |
|
262 |
// return false; |
|
263 |
// } |
|
264 |
// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode; |
|
186 |
// TaxonNavigator taxonNavigator; |
|
187 |
// taxonNavigator = (TaxonNavigator) NavigationUtil.showView(TaxonNavigator.ID); |
|
188 |
// |
|
189 |
// if(targetITaxonTreeNode instanceof TaxonNode){ |
|
190 |
// |
|
191 |
// TaxonNode targetTaxonNode = (TaxonNode) targetITaxonTreeNode; |
|
192 |
// // Make sure parent taxon does not have unsaved changes |
|
193 |
//// if (NavigationUtil.isDirty(targetTaxonNode)){ |
|
194 |
//// MessageDialog.openWarning(NavigationUtil.getShell(), TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT, TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE); |
|
195 |
//// return false; |
|
196 |
//// } |
|
197 |
// |
|
198 |
// } |
|
199 |
// Iterator<TaxonNode> taxIterator = taxonNodes.iterator(); |
|
200 |
// Set<UUID> uuids = new HashSet<UUID>(); |
|
201 |
// TaxonNode node = null; |
|
202 |
// while(taxIterator.hasNext()){ |
|
203 |
// node = taxIterator.next(); |
|
204 |
// uuids.add(node.getUuid()); |
|
205 |
// } |
|
206 |
// if (!PreferencesUtil.getSortNodesNaturally()){ |
|
207 |
// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
208 |
// if (workspaceUndoContext == null) { |
|
209 |
// logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
|
210 |
// return false; |
|
211 |
// } |
|
212 |
// |
|
213 |
// AbstractPostOperation<?> operation = new MoveTaxonOperation |
|
214 |
// (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD); |
|
215 |
// NavigationUtil.executeOperation(operation); |
|
216 |
// |
|
217 |
// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
218 |
// return true; |
|
219 |
// }else{ |
|
220 |
// String[] buttonLables = {TREE_NODE_DROP_ADAPTER_CHILD, TREE_NODE_DROP_ADAPTER_BEHIND,TREE_NODE_DROP_ADAPTER_CANCEL}; |
|
221 |
// MessageDialog dialog = new MessageDialog(null, TARGET_NODE, null, DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0); |
|
222 |
// dialog.open(); |
|
223 |
// int returnCode = dialog.getReturnCode(); |
|
224 |
// if (returnCode == 0){ |
|
225 |
// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
226 |
// if (workspaceUndoContext == null) { |
|
227 |
// logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
|
228 |
// return false; |
|
229 |
// } |
|
265 | 230 |
// |
266 |
// AbstractPostOperation operation = new MoveTaxonOperation
|
|
267 |
// ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.BEHIND);
|
|
268 |
// NavigationUtil.executeOperation(operation);
|
|
231 |
// AbstractPostOperation<?> operation = new MoveTaxonOperation
|
|
232 |
// (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD);
|
|
233 |
// NavigationUtil.executeOperation(operation);
|
|
269 | 234 |
// |
270 |
// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); |
|
271 |
// return true; |
|
272 |
// } |
|
273 |
else{ |
|
235 |
// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
236 |
// return true; |
|
237 |
// }else if (returnCode == 1){ |
|
238 |
// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
239 |
// if (workspaceUndoContext == null) { |
|
240 |
// logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
|
241 |
// return false; |
|
242 |
// } |
|
243 |
// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode; |
|
244 |
// |
|
245 |
// AbstractPostOperation<?> operation = new MoveTaxonOperation |
|
246 |
// (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.PREVIOUS); |
|
247 |
// NavigationUtil.executeOperation(operation); |
|
248 |
// |
|
249 |
// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
250 |
// return true; |
|
251 |
// } |
|
252 |
//// } else if (returnCode == 2){ |
|
253 |
//// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
254 |
//// if (workspaceUndoContext == null) { |
|
255 |
//// logger.error("Workspace undo context is null. DND operation cancelled"); |
|
256 |
//// return false; |
|
257 |
//// } |
|
258 |
//// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode; |
|
259 |
//// |
|
260 |
//// AbstractPostOperation operation = new MoveTaxonOperation |
|
261 |
//// ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.BEHIND); |
|
262 |
//// NavigationUtil.executeOperation(operation); |
|
263 |
//// |
|
264 |
//// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); |
|
265 |
//// return true; |
|
266 |
//// } |
|
267 |
// else{ |
|
274 | 268 |
return false; |
275 |
} |
|
276 |
|
|
277 |
|
|
278 |
} |
|
269 |
// }
|
|
270 |
// |
|
271 |
// |
|
272 |
// }
|
|
279 | 273 |
} |
280 | 274 |
|
281 | 275 |
/** {@inheritDoc} */ |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapterAssistant.java | ||
---|---|---|
13 | 13 |
import java.util.HashSet; |
14 | 14 |
import java.util.Iterator; |
15 | 15 |
import java.util.Set; |
16 |
import java.util.UUID; |
|
17 | 16 |
|
18 | 17 |
import org.apache.log4j.Logger; |
19 |
import org.eclipse.core.commands.operations.AbstractOperation; |
|
20 |
import org.eclipse.core.commands.operations.IUndoContext; |
|
21 | 18 |
import org.eclipse.core.runtime.IStatus; |
22 | 19 |
import org.eclipse.core.runtime.Status; |
23 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
24 | 20 |
import org.eclipse.jface.util.LocalSelectionTransfer; |
25 | 21 |
import org.eclipse.jface.viewers.ISelection; |
26 | 22 |
import org.eclipse.jface.viewers.TreeSelection; |
... | ... | |
35 | 31 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
36 | 32 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
37 | 33 |
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD; |
38 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
39 |
import eu.etaxonomy.taxeditor.navigation.NavigationUtil; |
|
40 |
import eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapter.MovingType; |
|
41 |
import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingMoveTaxonOperation; |
|
42 | 34 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
43 |
import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4; |
|
44 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
45 | 35 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
46 | 36 |
|
47 | 37 |
/** |
... | ... | |
168 | 158 |
*/ |
169 | 159 |
private IStatus moveTaxon(Set<TaxonNode> taxonNodes, ITaxonTreeNode targetITaxonTreeNode) { |
170 | 160 |
|
171 |
TaxonNavigator taxonNavigator; |
|
172 |
taxonNavigator = (TaxonNavigator) AbstractUtility.showView(TaxonNavigator.ID); |
|
173 |
|
|
174 |
if(targetITaxonTreeNode instanceof TaxonNode){ |
|
175 |
|
|
176 |
TaxonNode targetTaxonNode = (TaxonNode) targetITaxonTreeNode; |
|
177 |
// Make sure parent taxon does not have unsaved changes |
|
178 |
if (NavigationUtil.isDirty(targetTaxonNode)){ |
|
179 |
MessageDialog.openWarning(NavigationUtil.getShell(), TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE); |
|
180 |
return Status.CANCEL_STATUS; |
|
181 |
} |
|
182 |
|
|
183 |
} |
|
184 |
Iterator<TaxonNode> taxIterator = taxonNodes.iterator(); |
|
185 |
Set<UUID> uuids = new HashSet<>(); |
|
186 |
TaxonNode node = null; |
|
187 |
while(taxIterator.hasNext()){ |
|
188 |
node = taxIterator.next(); |
|
189 |
uuids.add(node.getUuid()); |
|
190 |
} |
|
191 |
if (!PreferencesUtil.getSortNodesNaturally()){ |
|
192 |
IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
193 |
if (workspaceUndoContext == null) { |
|
194 |
logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
|
195 |
return Status.CANCEL_STATUS; |
|
196 |
} |
|
197 |
|
|
198 |
AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD); |
|
199 |
AbstractUtility.executeOperation(operation, (RemotingCdmHandlerE4)null); |
|
200 |
|
|
201 |
|
|
202 |
logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
203 |
return Status.OK_STATUS; |
|
204 |
}else{ |
|
205 |
String[] buttonLables = {TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_CHILD, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_BEHIND, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_CANCEL}; |
|
206 |
MessageDialog dialog = new MessageDialog(null, TreeNodeDropAdapter.TARGET_NODE, null, TreeNodeDropAdapter.DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0); |
|
207 |
dialog.open(); |
|
208 |
int returnCode = dialog.getReturnCode(); |
|
209 |
if (returnCode == 0){ |
|
210 |
IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
211 |
if (workspaceUndoContext == null) { |
|
212 |
logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
|
213 |
return Status.CANCEL_STATUS; |
|
214 |
} |
|
215 |
|
|
216 |
AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD); |
|
217 |
AbstractUtility.executeOperation(operation, (RemotingCdmHandlerE4)null); |
|
218 |
|
|
219 |
|
|
220 |
logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
221 |
return Status.OK_STATUS; |
|
222 |
}else if (returnCode == 1){ |
|
223 |
IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
224 |
if (workspaceUndoContext == null) { |
|
225 |
logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
|
226 |
return Status.CANCEL_STATUS; |
|
227 |
} |
|
228 |
TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode; |
|
229 |
|
|
230 |
AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, targetNode, MovingType.BEHIND); |
|
231 |
AbstractUtility.executeOperation(operation, (RemotingCdmHandlerE4)null); |
|
232 |
|
|
233 |
logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
234 |
return Status.OK_STATUS; |
|
235 |
// }else if (returnCode == 2){ |
|
236 |
// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
237 |
// if (workspaceUndoContext == null) { |
|
238 |
// logger.error("Workspace undo context is null. DND operation cancelled"); |
|
239 |
// return Status.CANCEL_STATUS; |
|
240 |
// } |
|
241 |
// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode; |
|
161 |
// TaxonNavigator taxonNavigator; |
|
162 |
// taxonNavigator = (TaxonNavigator) AbstractUtility.showView(TaxonNavigator.ID); |
|
163 |
// |
|
164 |
// if(targetITaxonTreeNode instanceof TaxonNode){ |
|
165 |
// |
|
166 |
// TaxonNode targetTaxonNode = (TaxonNode) targetITaxonTreeNode; |
|
167 |
// // Make sure parent taxon does not have unsaved changes |
|
168 |
//// if (NavigationUtil.isDirty(targetTaxonNode)){ |
|
169 |
//// MessageDialog.openWarning(NavigationUtil.getShell(), TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE); |
|
170 |
//// return Status.CANCEL_STATUS; |
|
171 |
//// } |
|
172 |
// |
|
173 |
// } |
|
174 |
// Iterator<TaxonNode> taxIterator = taxonNodes.iterator(); |
|
175 |
// Set<UUID> uuids = new HashSet<>(); |
|
176 |
// TaxonNode node = null; |
|
177 |
// while(taxIterator.hasNext()){ |
|
178 |
// node = taxIterator.next(); |
|
179 |
// uuids.add(node.getUuid()); |
|
180 |
// } |
|
181 |
// if (!PreferencesUtil.getSortNodesNaturally()){ |
|
182 |
// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
183 |
// if (workspaceUndoContext == null) { |
|
184 |
// logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
|
185 |
// return Status.CANCEL_STATUS; |
|
186 |
// } |
|
187 |
// |
|
188 |
// AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD); |
|
189 |
// AbstractUtility.executeOperation(operation, (RemotingCdmHandlerE4)null); |
|
242 | 190 |
// |
243 |
// if(CdmStore.getCurrentSessionManager().isRemoting()) { |
|
244 |
// AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, targetNode, MovingType.PREVIOUS); |
|
245 |
// NavigationUtil.executeOperation(operation, null); |
|
246 |
// } else { |
|
247 |
// AbstractPostOperation operation = new MoveTaxonOperation |
|
248 |
// ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.PREVIOUS); |
|
249 |
// NavigationUtil.executeOperation(operation); |
|
250 |
// } |
|
251 |
// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); |
|
252 |
// return Status.OK_STATUS; |
|
253 |
} else{ |
|
191 |
// |
|
192 |
// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
193 |
// return Status.OK_STATUS; |
|
194 |
// }else{ |
|
195 |
// String[] buttonLables = {TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_CHILD, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_BEHIND, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_CANCEL}; |
|
196 |
// MessageDialog dialog = new MessageDialog(null, TreeNodeDropAdapter.TARGET_NODE, null, TreeNodeDropAdapter.DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0); |
|
197 |
// dialog.open(); |
|
198 |
// int returnCode = dialog.getReturnCode(); |
|
199 |
// if (returnCode == 0){ |
|
200 |
// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
201 |
// if (workspaceUndoContext == null) { |
|
202 |
// logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
|
203 |
// return Status.CANCEL_STATUS; |
|
204 |
// } |
|
205 |
// |
|
206 |
// AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD); |
|
207 |
// AbstractUtility.executeOperation(operation, (RemotingCdmHandlerE4)null); |
|
208 |
// |
|
209 |
// |
|
210 |
// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
211 |
// return Status.OK_STATUS; |
|
212 |
// }else if (returnCode == 1){ |
|
213 |
// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
214 |
// if (workspaceUndoContext == null) { |
|
215 |
// logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
|
216 |
// return Status.CANCEL_STATUS; |
|
217 |
// } |
|
218 |
// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode; |
|
219 |
// |
|
220 |
// AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, targetNode, MovingType.BEHIND); |
|
221 |
// AbstractUtility.executeOperation(operation, (RemotingCdmHandlerE4)null); |
|
222 |
// |
|
223 |
// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
224 |
// return Status.OK_STATUS; |
|
225 |
//// }else if (returnCode == 2){ |
|
226 |
//// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
227 |
//// if (workspaceUndoContext == null) { |
|
228 |
//// logger.error("Workspace undo context is null. DND operation cancelled"); |
|
229 |
//// return Status.CANCEL_STATUS; |
|
230 |
//// } |
|
231 |
//// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode; |
|
232 |
//// |
|
233 |
//// if(CdmStore.getCurrentSessionManager().isRemoting()) { |
|
234 |
//// AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, targetNode, MovingType.PREVIOUS); |
|
235 |
//// NavigationUtil.executeOperation(operation, null); |
|
236 |
//// } else { |
|
237 |
//// AbstractPostOperation operation = new MoveTaxonOperation |
|
238 |
//// ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.PREVIOUS); |
|
239 |
//// NavigationUtil.executeOperation(operation); |
|
240 |
//// } |
|
241 |
//// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); |
|
242 |
//// return Status.OK_STATUS; |
|
243 |
// } else{ |
|
254 | 244 |
return Status.CANCEL_STATUS; |
255 |
} |
|
256 |
} |
|
245 |
// }
|
|
246 |
// }
|
|
257 | 247 |
} |
258 | 248 |
|
259 | 249 |
/** {@inheritDoc} */ |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/CloneClassificationHandlerE4.java | ||
---|---|---|
16 | 16 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
17 | 17 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
18 | 18 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
19 |
import eu.etaxonomy.taxeditor.navigation.NavigationUtil; |
|
20 | 19 |
import eu.etaxonomy.taxeditor.navigation.l10n.Messages; |
21 | 20 |
import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4; |
22 | 21 |
import eu.etaxonomy.taxeditor.navigation.operation.CloneClassificationOperation; |
... | ... | |
53 | 52 |
|
54 | 53 |
CloneClassificationOperation operation = new CloneClassificationOperation(Messages.CloneClassificationHandler_CLONE_CLASSIFICATION, |
55 | 54 |
StoreUtil.getUndoContext(), classification, classificationName, reference, relationType, |
56 |
NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false));
|
|
55 |
taxonNavigator, taxonNavigator);
|
|
57 | 56 |
|
58 | 57 |
AbstractUtility.executeOperation(operation); |
59 | 58 |
taxonNavigator.refresh(); |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java | ||
---|---|---|
47 | 47 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
48 | 48 |
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter; |
49 | 49 |
import eu.etaxonomy.taxeditor.model.IContextListener; |
50 |
import eu.etaxonomy.taxeditor.navigation.NavigationUtil; |
|
51 | 50 |
import eu.etaxonomy.taxeditor.navigation.l10n.Messages; |
52 | 51 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
53 | 52 |
|
... | ... | |
116 | 115 |
if(selection instanceof IStructuredSelection){ |
117 | 116 |
Object firstElement = ((IStructuredSelection) selection).getFirstElement(); |
118 | 117 |
if(firstElement instanceof UuidAndTitleCache){ |
119 |
NavigationUtil.openEditor((UuidAndTitleCache) firstElement); |
|
118 |
// NavigationUtil.openEditor((UuidAndTitleCache) firstElement);
|
|
120 | 119 |
} |
121 | 120 |
} |
122 | 121 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/e4/SearchResultViewE4.java | ||
---|---|---|
139 | 139 |
if(selection instanceof IStructuredSelection){ |
140 | 140 |
Object firstElement = ((IStructuredSelection) selection).getFirstElement(); |
141 | 141 |
if(firstElement instanceof UuidAndTitleCache){ |
142 |
NavigationUtil.openEditor((UuidAndTitleCache) firstElement); |
|
142 |
NavigationUtil.openEditor((UuidAndTitleCache) firstElement, resultViewer.getControl().getShell());
|
|
143 | 143 |
} |
144 | 144 |
} |
145 | 145 |
} |
Also available in: Unified diff
ref #6913 Remove org.eclipse.ui dependency from NavigationUtil