Revision 0b8d8887
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/fragment.e4xmi | ||
---|---|---|
299 | 299 |
<elements xsi:type="commands:Command" xmi:id="_1CaG8K21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.command.new.name" commandName="%command.name.24"/> |
300 | 300 |
<elements xsi:type="commands:Command" xmi:id="_2vSfgK21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.command.new.team" commandName="%command.name.25"/> |
301 | 301 |
<elements xsi:type="commands:Command" xmi:id="_4nv18K21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.command.new.person" commandName="%command.name.26"/> |
302 |
<elements xsi:type="commands:Command" xmi:id="_gtN1MNBAEee0suQUeQx36A" elementId="eu.etaxonomy.taxeditor.editor.command.workingSet.openWorkingSetEditor" commandName="Open Wokring Set Editor"/> |
|
302 | 303 |
</fragments> |
303 | 304 |
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_pZmusEalEeeXMc6kSYO7Xg" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.workbench.menuseparator.navigation"> |
304 | 305 |
<elements xsi:type="menu:HandledMenuItem" xmi:id="_5s52EIZ3EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.concept" label="%command.label.6" tooltip="%command.label.6" command="_WPjpoDSnEeek0dKsFNy--Q"> |
... | ... | |
317 | 318 |
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_WbFAcKNxEeebGZ23ERGMGw" coreExpressionId="isCdmStoreConnectedAndShowExperimental"/> |
318 | 319 |
<parameters xmi:id="_FPIuUaNwEeebGZ23ERGMGw" elementId="eu.etaxonomy.taxeditor.editor.showView.parameter.conceptGraph" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.editor.view.concept.graph.e4.ConceptGraphViewE4"/> |
319 | 320 |
</elements> |
320 |
<elements xsi:type="menu:HandledMenuItem" xmi:id="_QvOWgM7XEeex0rHJ7p8Zdw" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.workingSetEditor" label="Working Set Editor" tooltip="Working Set Editor" command="_WPjpoDSnEeek0dKsFNy--Q"> |
|
321 |
<parameters xmi:id="_QvOWgs7XEeex0rHJ7p8Zdw" elementId="eu.etaxonomy.taxeditor.editor.showView.parameter.conceptview" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.editor.view.workingSet.WorkingSetEditor"/> |
|
322 |
</elements> |
|
321 |
<elements xsi:type="menu:HandledMenuItem" xmi:id="_QvOWgM7XEeex0rHJ7p8Zdw" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.workingSetEditor" label="Working Set Editor" tooltip="Working Set Editor" command="_gtN1MNBAEee0suQUeQx36A"/> |
|
323 | 322 |
</fragments> |
324 | 323 |
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_P9N9YJMkEeeR4YRjNqCKeA" featurename="handlers" parentElementId="xpath:/"> |
325 | 324 |
<elements xsi:type="commands:Handler" xmi:id="_SL3mQJMkEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenSpecimenEditorForTypeSpecimenHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenSpecimenEditorForTypeSpecimenHandler" command="_2Bn-EJMjEeeR4YRjNqCKeA"/> |
... | ... | |
334 | 333 |
<elements xsi:type="commands:Handler" xmi:id="_Xi9w8K22EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handler.create.NewNameHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.create.NewNameHandler" command="_1CaG8K21EeeykrJkROy5EA"/> |
335 | 334 |
<elements xsi:type="commands:Handler" xmi:id="_ahCroK22EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handler.create.NewTeamHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.create.NewTeamHandler" command="_2vSfgK21EeeykrJkROy5EA"/> |
336 | 335 |
<elements xsi:type="commands:Handler" xmi:id="_c0Ba4K22EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handler.create.NewPersonHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.create.NewPersonHandler" command="_4nv18K21EeeykrJkROy5EA"/> |
336 |
<elements xsi:type="commands:Handler" xmi:id="_OYb2QNBAEee0suQUeQx36A" elementId="eu.etaxonomy.taxeditor.editor.workingSet.handler.OpenWorkingSetEditorHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.workingSet.handler.OpenWorkingSetEditorHandler" command="_gtN1MNBAEee0suQUeQx36A"/> |
|
337 | 337 |
</fragments> |
338 | 338 |
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_OyvD8KNOEee5fYT78qEx0A" featurename="children" parentElementId="bulkeditor.menus.openmenu" positionInList="last"> |
339 | 339 |
<elements xsi:type="menu:HandledMenuItem" xmi:id="_SZZBkKNOEee5fYT78qEx0A" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.specimen_editor" label="%command.label.DERIVATIVE_EDITOR" tooltip="%command.label.DERIVATIVE_EDITOR" command="_PDjFMLsKEeeQJq8FDGEi1g"/> |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/WorkingSetEditor.java | ||
---|---|---|
16 | 16 |
import org.eclipse.swt.widgets.Composite; |
17 | 17 |
import org.eclipse.swt.widgets.Display; |
18 | 18 |
|
19 |
import eu.etaxonomy.cdm.model.description.WorkingSet; |
|
19 | 20 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
20 | 21 |
|
21 | 22 |
/** |
... | ... | |
25 | 26 |
*/ |
26 | 27 |
public class WorkingSetEditor { |
27 | 28 |
|
29 |
private WorkingSetComposite composite; |
|
30 |
|
|
28 | 31 |
@PostConstruct |
29 | 32 |
public void create(Composite parent, IEclipseContext context){ |
30 | 33 |
CdmFormFactory cdmFormFactory = new CdmFormFactory(Display.getCurrent()); |
31 | 34 |
ContextInjectionFactory.inject(cdmFormFactory, context); |
32 |
WorkingSetComposite composite = new WorkingSetComposite(parent, SWT.NONE); |
|
35 |
composite = new WorkingSetComposite(parent, SWT.NONE); |
|
36 |
} |
|
37 |
|
|
38 |
public void init(WorkingSet workingSet) { |
|
39 |
composite.getTxt_label().setText(workingSet.getLabel()); |
|
33 | 40 |
} |
34 | 41 |
|
35 | 42 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/handler/OpenWorkingSetEditorHandler.java | ||
---|---|---|
1 |
|
|
2 |
package eu.etaxonomy.taxeditor.editor.workingSet.handler; |
|
3 |
|
|
4 |
import org.eclipse.e4.core.di.annotations.Execute; |
|
5 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
6 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
|
7 |
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; |
|
8 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
9 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
10 |
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; |
|
11 |
import org.eclipse.swt.widgets.Shell; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.model.description.WorkingSet; |
|
14 |
import eu.etaxonomy.taxeditor.editor.workingSet.WorkingSetEditor; |
|
15 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.WorkingSetSelectionDialog; |
|
16 |
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility; |
|
17 |
|
|
18 |
public class OpenWorkingSetEditorHandler { |
|
19 |
|
|
20 |
@Execute |
|
21 |
public void execute(Shell shell, EPartService partService, MApplication application, EModelService modelService) { |
|
22 |
WorkingSet workingSet = WorkingSetSelectionDialog.select(shell, null, null); |
|
23 |
MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.view.workingSet.WorkingSetEditor"); |
|
24 |
|
|
25 |
MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService); |
|
26 |
if(editorAreaPartStack!=null){ |
|
27 |
editorAreaPartStack.getChildren().add(part); |
|
28 |
} |
|
29 |
part = partService.showPart(part, PartState.ACTIVATE); |
|
30 |
|
|
31 |
WorkingSetEditor editor = (WorkingSetEditor) part.getObject(); |
|
32 |
editor.init(workingSet); |
|
33 |
|
|
34 |
} |
|
35 |
|
|
36 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/WorkingSetSelectionDialog.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2014 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.ui.dialog.selection; |
|
10 |
|
|
11 |
import java.util.UUID; |
|
12 |
|
|
13 |
import org.eclipse.jface.dialogs.InputDialog; |
|
14 |
import org.eclipse.jface.window.Window; |
|
15 |
import org.eclipse.swt.events.SelectionAdapter; |
|
16 |
import org.eclipse.swt.events.SelectionEvent; |
|
17 |
import org.eclipse.swt.events.SelectionListener; |
|
18 |
import org.eclipse.swt.widgets.Button; |
|
19 |
import org.eclipse.swt.widgets.Control; |
|
20 |
import org.eclipse.swt.widgets.Shell; |
|
21 |
import org.eclipse.swt.widgets.Text; |
|
22 |
|
|
23 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
|
24 |
import eu.etaxonomy.cdm.api.service.IWorkingSetService; |
|
25 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
|
26 |
import eu.etaxonomy.cdm.model.description.WorkingSet; |
|
27 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
28 |
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard; |
|
29 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
30 |
|
|
31 |
/** |
|
32 |
* @author pplitzner |
|
33 |
* @date 11.03.2014 |
|
34 |
* |
|
35 |
*/ |
|
36 |
public class WorkingSetSelectionDialog extends |
|
37 |
AbstractFilteredCdmResourceSelectionDialog<WorkingSet> { |
|
38 |
|
|
39 |
public static WorkingSet select(Shell shell, ConversationHolder conversation, WorkingSet workingSet){ |
|
40 |
WorkingSetSelectionDialog dialog = new WorkingSetSelectionDialog(shell, conversation, |
|
41 |
"Choose working set", false, WorkingSetSelectionDialog.class.getCanonicalName(), workingSet); |
|
42 |
return getSelectionFromDialog(dialog); |
|
43 |
} |
|
44 |
|
|
45 |
/** |
|
46 |
* <p>Constructor for FilteredDerivedUnitSelectionDialog.</p> |
|
47 |
*/ |
|
48 |
protected WorkingSetSelectionDialog(Shell shell, ConversationHolder conversation, String title, |
|
49 |
boolean multi, String settings, WorkingSet cdmObject) { |
|
50 |
super(shell, conversation, title, multi, settings, cdmObject); |
|
51 |
} |
|
52 |
|
|
53 |
/** {@inheritDoc} */ |
|
54 |
@Override |
|
55 |
protected WorkingSet getPersistentObject(UUID uuid) { |
|
56 |
Object object = CdmStore.getService(IWorkingSetService.class).load(uuid); |
|
57 |
|
|
58 |
WorkingSet workingSet = (WorkingSet) HibernateProxyHelper.deproxy(object); |
|
59 |
|
|
60 |
if(workingSet != null){ |
|
61 |
return workingSet; |
|
62 |
} |
|
63 |
MessagingUtils.error(this.getClass(), "Selected element is not a working set", null); |
|
64 |
return null; |
|
65 |
} |
|
66 |
|
|
67 |
/** {@inheritDoc} */ |
|
68 |
@Override |
|
69 |
protected void search() { |
|
70 |
Control control =getSearchField(); |
|
71 |
String pattern = null; |
|
72 |
if (control != null){ |
|
73 |
pattern = ((Text)control).getText(); |
|
74 |
} |
|
75 |
|
|
76 |
if (pattern == null || pattern.equals("?")){ |
|
77 |
model = CdmStore.getService(IWorkingSetService.class).getUuidAndTitleCache(null, null); |
|
78 |
}else{ |
|
79 |
model = CdmStore.getService(IWorkingSetService.class).getUuidAndTitleCache(limitOfInitialElements, pattern); |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
@Override |
|
84 |
protected String getTitle(WorkingSet cdmObject) { |
|
85 |
if(cdmObject!=null){ |
|
86 |
return cdmObject.getLabel(); |
|
87 |
} |
|
88 |
return super.getTitle(cdmObject); |
|
89 |
} |
|
90 |
|
|
91 |
/** {@inheritDoc} */ |
|
92 |
@Override |
|
93 |
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) { |
|
94 |
return null; |
|
95 |
} |
|
96 |
|
|
97 |
@Override |
|
98 |
protected SelectionListener getNewWizardButtonSelectionListener(){ |
|
99 |
return new SelectionAdapter() { |
|
100 |
|
|
101 |
@Override |
|
102 |
public void widgetSelected(SelectionEvent e) { |
|
103 |
Object source = e.getSource(); |
|
104 |
if (source instanceof Button){ |
|
105 |
Button sourceButton = (Button) source; |
|
106 |
} |
|
107 |
InputDialog dialog = new InputDialog(getShell(), "Working set label", "Enter label for working set", null, null); |
|
108 |
if (dialog.open() == Window.OK) { |
|
109 |
// User clicked OK; update the label with the input |
|
110 |
WorkingSet workingSet = WorkingSet.NewInstance(); |
|
111 |
CdmStore.getService(IWorkingSetService.class).merge(workingSet,true); |
|
112 |
workingSet.setLabel(dialog.getValue()); |
|
113 |
refresh(); |
|
114 |
setPattern(workingSet); |
|
115 |
} |
|
116 |
} |
|
117 |
}; |
|
118 |
} |
|
119 |
|
|
120 |
/** {@inheritDoc} */ |
|
121 |
@Override |
|
122 |
protected String[] getNewWizardText() { |
|
123 |
return new String[]{"Working set "}; |
|
124 |
} |
|
125 |
} |
Also available in: Unified diff
ref #7086 Open WS editor via selection dialog