27 |
27 |
import org.eclipse.jface.viewers.TreeNode;
|
28 |
28 |
import org.eclipse.swt.widgets.Shell;
|
29 |
29 |
import org.eclipse.ui.IEditorPart;
|
30 |
|
import org.eclipse.ui.PartInitException;
|
31 |
30 |
import org.eclipse.ui.handlers.HandlerUtil;
|
32 |
31 |
|
33 |
32 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
|
... | ... | |
63 |
62 |
private static final String NAME_EDITOR_ID = "eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4";
|
64 |
63 |
private static boolean isSaving = false;
|
65 |
64 |
|
66 |
|
/**
|
67 |
|
* Opens a new {@link DataImportEditor} for the given input
|
68 |
|
* @param input a {@link DataImportEditorInput}
|
69 |
|
* @throws PartInitException
|
70 |
|
*/
|
71 |
|
// public static void open(DataImportEditorInput<?> input)
|
72 |
|
// throws PartInitException {
|
73 |
|
// if(input instanceof BioCaseEditorInput){
|
74 |
|
// open(input, SpecimenImportEditor.ID);
|
75 |
|
// }
|
76 |
|
// else if(input instanceof GbifImportEditorInput){
|
77 |
|
// open(input, GbifImportEditor.ID);
|
78 |
|
// }
|
79 |
|
// }
|
80 |
|
|
81 |
65 |
public static void openWorkingSetEditor(UUID workingSetUuid, EModelService modelService, EPartService partService, MApplication application){
|
82 |
|
MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.view.workingSet.WorkingSetEditor");
|
83 |
|
MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
|
84 |
|
if(editorAreaPartStack!=null){
|
85 |
|
editorAreaPartStack.getChildren().add(part);
|
86 |
|
}
|
87 |
|
part = partService.showPart(part, PartState.ACTIVATE);
|
|
66 |
String partId = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_WORKINGSET_WORKINGSETEDITOR;
|
|
67 |
MPart part = showPart(partId, modelService, partService, application);
|
88 |
68 |
WorkingSetEditor editor = (WorkingSetEditor) part.getObject();
|
89 |
69 |
editor.init(workingSetUuid);
|
90 |
70 |
}
|
91 |
71 |
|
92 |
72 |
public static void openCharacterMatrix(UUID workingSetUuid, EModelService modelService, EPartService partService, MApplication application){
|
93 |
|
MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_WORKINGSET_MATRIX_CHARACTERMATRIXPART);
|
94 |
|
MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
|
95 |
|
if(editorAreaPartStack!=null){
|
96 |
|
editorAreaPartStack.getChildren().add(part);
|
97 |
|
}
|
98 |
|
part = partService.showPart(part, PartState.ACTIVATE);
|
|
73 |
String partId = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_WORKINGSET_MATRIX_CHARACTERMATRIXPART;
|
|
74 |
MPart part = showPart(partId, modelService, partService, application);
|
99 |
75 |
CharacterMatrixPart editor = (CharacterMatrixPart) part.getObject();
|
100 |
76 |
editor.init(workingSetUuid, true);
|
101 |
77 |
}
|
102 |
78 |
|
103 |
79 |
public static void openSpecimenEditor(DerivateViewEditorInput input, EModelService modelService, EPartService partService, MApplication application){
|
104 |
|
MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW);
|
|
80 |
String partId = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW;
|
|
81 |
MPart part = showPart(partId, modelService, partService, application);
|
|
82 |
DerivateView derivateView = (DerivateView) part.getObject();
|
|
83 |
derivateView.init(input);
|
|
84 |
}
|
|
85 |
|
|
86 |
public static void openRightsEditor(CdmAuthorityEditorInput input, EModelService modelService, EPartService partService, MApplication application){
|
|
87 |
String partId = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_GROUP_AUTHORITY_E4_CDMAUTHORITYEDITORE4;
|
|
88 |
MPart part = showPart(partId, modelService, partService, application);
|
|
89 |
CdmAuthorityEditorE4 authorityView = (CdmAuthorityEditorE4) part.getObject();
|
|
90 |
authorityView.init(input);
|
|
91 |
}
|
|
92 |
|
|
93 |
private static MPart showPart(String partId, EModelService modelService, EPartService partService, MApplication application){
|
|
94 |
MPart part = partService.findPart(partId);
|
|
95 |
if(part==null || modelService.getPartDescriptor(partId).isAllowMultiple()){
|
|
96 |
part = partService.createPart(partId);
|
|
97 |
}
|
105 |
98 |
MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
|
106 |
99 |
if(editorAreaPartStack!=null){
|
107 |
100 |
editorAreaPartStack.getChildren().add(part);
|
108 |
101 |
}
|
109 |
|
part = partService.showPart(part, PartState.ACTIVATE);
|
110 |
|
DerivateView derivateView = (DerivateView) part.getObject();
|
111 |
|
derivateView.init(input);
|
|
102 |
return partService.showPart(part, PartState.ACTIVATE);
|
112 |
103 |
}
|
113 |
104 |
|
114 |
105 |
public static void openTaxonNodeE4(UUID taxonNodeUuid, EModelService modelService, EPartService partService, MApplication application) {
|
... | ... | |
156 |
147 |
break;
|
157 |
148 |
}
|
158 |
149 |
}
|
159 |
|
MPart part = partService.createPart(NAME_EDITOR_ID);
|
160 |
|
|
161 |
|
MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
|
162 |
|
if(editorAreaPartStack!=null){
|
163 |
|
editorAreaPartStack.getChildren().add(part);
|
164 |
|
}
|
165 |
|
part = partService.showPart(part, PartState.ACTIVATE);
|
166 |
|
|
|
150 |
MPart part = showPart(NAME_EDITOR_ID, modelService, partService, application);
|
167 |
151 |
TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
|
168 |
152 |
editor.init(input);
|
169 |
153 |
}
|
170 |
|
public static void openRightsEditor(CdmAuthorityEditorInput input, EModelService modelService, EPartService partService, MApplication application){
|
171 |
|
MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.group.authority.e4.CdmAuthorityEditorE4");
|
172 |
|
MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
|
173 |
|
if(editorAreaPartStack!=null){
|
174 |
|
editorAreaPartStack.getChildren().add(part);
|
175 |
|
}
|
176 |
|
part = partService.showPart(part, PartState.ACTIVATE);
|
177 |
|
CdmAuthorityEditorE4 authorityView = (CdmAuthorityEditorE4) part.getObject();
|
178 |
|
authorityView.init(input);
|
179 |
|
}
|
180 |
154 |
|
181 |
155 |
/**
|
182 |
156 |
* An uninitialized taxon is one that hasn't been saved yet. As such, it
|
ref #7011 harmonize creation and showing of MParts