Revision 8481f952
Added by Andreas Müller almost 4 years ago
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/Application.java | ||
---|---|---|
10 | 10 |
* This class controls all aspects of the application's execution |
11 | 11 |
* |
12 | 12 |
* @author n.hoffmann |
13 |
* @version $Id: $ |
|
14 | 13 |
*/ |
15 | 14 |
public class Application implements IApplication { |
16 | 15 |
|
17 |
/* (non-Javadoc) |
|
18 |
* @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) |
|
19 |
*/ |
|
20 |
/** {@inheritDoc} */ |
|
21 |
public Object start(IApplicationContext context) { |
|
16 |
@Override |
|
17 |
public Object start(IApplicationContext context) { |
|
22 | 18 |
Display display = PlatformUI.createDisplay(); |
23 | 19 |
try { |
24 | 20 |
int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); |
... | ... | |
31 | 27 |
} |
32 | 28 |
} |
33 | 29 |
|
34 |
/* (non-Javadoc) |
|
35 |
* @see org.eclipse.equinox.app.IApplication#stop() |
|
36 |
*/ |
|
37 |
/** |
|
38 |
* <p>stop</p> |
|
39 |
*/ |
|
40 |
public void stop() { |
|
30 |
@Override |
|
31 |
public void stop() { |
|
41 | 32 |
final IWorkbench workbench = PlatformUI.getWorkbench(); |
42 |
if (workbench == null) |
|
43 |
return; |
|
33 |
if (workbench == null) { |
|
34 |
return; |
|
35 |
} |
|
44 | 36 |
final Display display = workbench.getDisplay(); |
45 | 37 |
display.syncExec(new Runnable() { |
46 |
public void run() { |
|
47 |
if (!display.isDisposed()) |
|
48 |
workbench.close(); |
|
38 |
@Override |
|
39 |
public void run() { |
|
40 |
if (!display.isDisposed()) { |
|
41 |
workbench.close(); |
|
42 |
} |
|
49 | 43 |
} |
50 | 44 |
}); |
51 | 45 |
} |
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationActionBarAdvisor.java | ||
---|---|---|
14 | 14 |
* new actions. |
15 | 15 |
* |
16 | 16 |
* @author n.hoffmann |
17 |
* @version $Id: $ |
|
18 | 17 |
*/ |
19 | 18 |
public class ApplicationActionBarAdvisor extends ActionBarAdvisor { |
20 | 19 |
|
... | ... | |
30 | 29 |
super(configurer); |
31 | 30 |
} |
32 | 31 |
|
33 |
/** {@inheritDoc} */
|
|
34 |
protected void makeActions(final IWorkbenchWindow window) {
|
|
32 |
@Override
|
|
33 |
protected void makeActions(final IWorkbenchWindow window) {
|
|
35 | 34 |
StoreUtil.setStatusLineManager(getActionBarConfigurer().getStatusLineManager()); |
36 |
|
|
35 |
|
|
37 | 36 |
saveAction = ActionFactory.SAVE.create(window); |
38 | 37 |
register(saveAction); |
39 | 38 |
|
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchAdvisor.java | ||
---|---|---|
20 | 20 |
* <p>ApplicationWorkbenchAdvisor class.</p> |
21 | 21 |
* |
22 | 22 |
* @author n.hoffmann |
23 |
* @version $Id: $ |
|
24 | 23 |
*/ |
25 | 24 |
public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { |
26 | 25 |
|
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchWindowAdvisor.java | ||
---|---|---|
21 | 21 |
import eu.etaxonomy.taxeditor.util.ApplicationUtil; |
22 | 22 |
|
23 | 23 |
/** |
24 |
* |
|
25 | 24 |
* @author n.hoffmann |
26 |
* @version $Id: $ |
|
27 | 25 |
*/ |
28 | 26 |
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { |
29 | 27 |
|
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/TaxonomicEditorPlugin.java | ||
---|---|---|
19 | 19 |
* The activator class controls the plug-in life cycle |
20 | 20 |
* |
21 | 21 |
* @author n.hoffmann |
22 |
* @version $Id: $ |
|
23 | 22 |
*/ |
24 | 23 |
public class TaxonomicEditorPlugin extends AbstractUIPlugin { |
25 | 24 |
private static final Logger logger = Logger |
... | ... | |
34 | 33 |
|
35 | 34 |
private PackageAdmin packageAdmin; |
36 | 35 |
|
37 |
private ServiceReference packageAdminRef; |
|
36 |
private ServiceReference<?> packageAdminRef;
|
|
38 | 37 |
|
39 | 38 |
/** Constant <code>bundleContext</code> */ |
40 | 39 |
protected static BundleContext bundleContext; |
41 | 40 |
|
42 | 41 |
|
43 |
private ServiceRegistration policyRegistration; |
|
42 |
private ServiceRegistration<?> policyRegistration;
|
|
44 | 43 |
|
45 | 44 |
private ProvisioningSession session; |
46 | 45 |
private ProvisioningUI ui; |
... | ... | |
53 | 52 |
public TaxonomicEditorPlugin() { |
54 | 53 |
} |
55 | 54 |
|
56 |
/* |
|
57 |
* (non-Javadoc) |
|
58 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) |
|
59 |
*/ |
|
60 |
/** {@inheritDoc} */ |
|
61 | 55 |
@Override |
62 | 56 |
public void start(BundleContext context) throws Exception { |
63 | 57 |
super.start(context); |
... | ... | |
88 | 82 |
return null; |
89 | 83 |
} |
90 | 84 |
|
91 |
/* |
|
92 |
* (non-Javadoc) |
|
93 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) |
|
94 |
*/ |
|
95 |
/** {@inheritDoc} */ |
|
96 | 85 |
@Override |
97 | 86 |
public void stop(BundleContext context) throws Exception { |
98 | 87 |
plugin = null; |
... | ... | |
116 | 105 |
public ProvisioningUI getProvisioningUI() { |
117 | 106 |
|
118 | 107 |
if (ui == null) { |
119 |
ServiceReference reference = bundleContext.getServiceReference(IProvisioningAgent.SERVICE_NAME); |
|
108 |
ServiceReference<?> reference = bundleContext.getServiceReference(IProvisioningAgent.SERVICE_NAME);
|
|
120 | 109 |
IProvisioningAgent agent = (IProvisioningAgent) bundleContext.getService(reference); |
121 | 110 |
session = new ProvisioningSession(agent); |
122 | 111 |
Policy policy = null;// = (Policy) ServiceHelper.getService(ProvUIActivator.getContext(), Policy.class.getName()); |
... | ... | |
127 | 116 |
} |
128 | 117 |
return ui; |
129 | 118 |
} |
130 |
|
|
131 |
|
|
132 | 119 |
} |
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/Uses.java | ||
---|---|---|
11 | 11 |
* Uses Class |
12 | 12 |
* @author a.theys |
13 | 13 |
* @created mar 13, 2012 |
14 |
* @version 1.0 |
|
15 | 14 |
*/ |
16 | 15 |
public class Uses extends Default { |
17 | 16 |
|
18 |
/* (non-Javadoc) |
|
19 |
* @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout) |
|
20 |
*/ |
|
21 |
/** {@inheritDoc} */ |
|
22 | 17 |
@Override |
23 | 18 |
public void createInitialLayout(IPageLayout layout) { |
24 | 19 |
layout.addView(NAVIGATOR, IPageLayout.LEFT, 0.25f, layout.getEditorArea()); |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/EntityListener.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 |
*/ |
... | ... | |
19 | 19 |
* |
20 | 20 |
* @author p.ciardelli |
21 | 21 |
* @created 31.08.2009 |
22 |
* @version 1.0 |
|
23 | 22 |
*/ |
24 | 23 |
abstract public class EntityListener implements PropertyChangeListener { |
25 |
private static final Logger logger = Logger |
|
26 |
.getLogger(EntityListener.class); |
|
27 | 24 |
|
28 |
/* (non-Javadoc)
|
|
29 |
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
|
|
30 |
*/ |
|
31 |
/** {@inheritDoc} */
|
|
32 |
public void propertyChange(PropertyChangeEvent evt) {
|
|
25 |
@SuppressWarnings("unused")
|
|
26 |
private static final Logger logger = Logger.getLogger(EntityListener.class);
|
|
27 |
|
|
28 |
@Override
|
|
29 |
public void propertyChange(PropertyChangeEvent evt) {
|
|
33 | 30 |
updateEntity(); |
34 | 31 |
} |
35 | 32 |
|
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditorUtil.java | ||
---|---|---|
29 | 29 |
* |
30 | 30 |
* @author n.hoffmann |
31 | 31 |
* @created Mar 12, 2010 |
32 |
* @version 1.0 |
|
33 | 32 |
*/ |
34 | 33 |
public class BulkEditorUtil extends AbstractUtility{ |
35 | 34 |
|
36 |
|
|
37 | 35 |
/** |
38 | 36 |
* <p>getPluginId</p> |
39 | 37 |
* |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorPropertyTester.java | ||
---|---|---|
40 | 40 |
public static final String IS_TEAM = "isTeam"; |
41 | 41 |
public static final String IS_MEDIA_EDITOR = "isMediaEditor"; |
42 | 42 |
|
43 |
/** {@inheritDoc} */ |
|
44 | 43 |
@Override |
45 | 44 |
public boolean test(Object receiver, String property, Object[] args, |
46 | 45 |
Object expectedValue) { |
... | ... | |
48 | 47 |
|
49 | 48 |
bulkEditor = (BulkEditorE4) receiver; |
50 | 49 |
if (IS_MERGING_ENABLED.equals(property)) { |
51 |
AbstractBulkEditorInput input = bulkEditor.getEditorInput(); |
|
50 |
AbstractBulkEditorInput<?> input = bulkEditor.getEditorInput();
|
|
52 | 51 |
return ((AbstractBulkEditorInput<?>) input).isMergingEnabled(); |
53 | 52 |
} |
54 | 53 |
if (IS_CONVERT_ENABLED.equals(property)) { |
55 |
AbstractBulkEditorInput input = bulkEditor.getEditorInput(); |
|
54 |
AbstractBulkEditorInput<?> input = bulkEditor.getEditorInput();
|
|
56 | 55 |
return ((AbstractBulkEditorInput<?>) input).isConvertingEnabled(); |
57 | 56 |
} |
58 | 57 |
else if(IS_GROUP_EDITOR.equals(property)){ |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4.java | ||
---|---|---|
65 | 65 |
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart; |
66 | 66 |
|
67 | 67 |
/** |
68 |
* |
|
69 | 68 |
* @author pplitzner |
70 | 69 |
* @since Sep 8, 2017 |
71 |
* |
|
72 | 70 |
*/ |
73 | 71 |
public class BulkEditorE4 implements IPartContentHasDetails, IConversationEnabled, IPostOperationEnabled, |
74 | 72 |
IDirtyMarkable, IDerivedUnitFacadePart, IPartContentHasFactualData, |
... | ... | |
98 | 96 |
public BulkEditorE4() { |
99 | 97 |
} |
100 | 98 |
|
101 |
@SuppressWarnings("unused") |
|
102 | 99 |
public void init(AbstractBulkEditorInput<?> input){ |
103 | 100 |
this.input = input; |
104 | 101 |
this.conversation = input.getConversation(); |
... | ... | |
107 | 104 |
bulkEditorComposite.init(input); |
108 | 105 |
} |
109 | 106 |
|
110 |
/** {@inheritDoc} */ |
|
111 | 107 |
@PostConstruct |
112 | 108 |
public void createPartControl(Composite parent, IEclipseContext context) { |
113 | 109 |
bulkEditorComposite = new BulkEditorE4Composite(this, parent, SWT.NONE); |
... | ... | |
314 | 310 |
return null; |
315 | 311 |
} |
316 | 312 |
|
317 |
/** |
|
318 |
* {@inheritDoc} |
|
319 |
*/ |
|
320 | 313 |
@Override |
321 | 314 |
public void update() { |
322 | 315 |
input.performSearch(lastQuery, getSelection()); |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/command/DynamicMarkerTypeEditingMenuE4.java | ||
---|---|---|
32 | 32 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
33 | 33 |
|
34 | 34 |
/** |
35 |
* |
|
36 | 35 |
* @author pplitzner |
37 | 36 |
* @date 26.09.2017 |
38 |
* |
|
39 | 37 |
*/ |
40 | 38 |
public class DynamicMarkerTypeEditingMenuE4 { |
41 | 39 |
|
... | ... | |
43 | 41 |
public static final String COMMAND_PARAMETER_MARKER_TYPE = COMMAND_ID+".markerType"; //$NON-NLS-1$ |
44 | 42 |
public static final String COMMAND_PARAMETER_MARKER_STATE = COMMAND_ID+".markerState"; //$NON-NLS-1$ |
45 | 43 |
|
46 |
/** {@inheritDoc} */ |
|
47 | 44 |
@AboutToShow |
48 | 45 |
public void aboutToShow(List<MMenuElement> items, @Named(IServiceConstants.ACTIVE_SELECTION)Object selection) { |
49 | 46 |
if(selection instanceof StructuredSelection && ((StructuredSelection)selection).isEmpty()){ |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/command/DynamicNewObjectMenuE4.java | ||
---|---|---|
32 | 32 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
33 | 33 |
|
34 | 34 |
/** |
35 |
* |
|
36 | 35 |
* @author pplitzner |
37 | 36 |
* @date 12.09.2017 |
38 |
* |
|
39 | 37 |
*/ |
40 | 38 |
public class DynamicNewObjectMenuE4 { |
41 | 39 |
|
42 | 40 |
private Map<? extends Object, String> classLabelPairs; |
43 | 41 |
private BulkEditorE4 editor; |
44 | 42 |
|
45 |
/** {@inheritDoc} */ |
|
46 | 43 |
@AboutToShow |
47 | 44 |
public void aboutToShow(@Named(IServiceConstants.ACTIVE_PART)MPart activePart, |
48 | 45 |
List<MMenuElement> items) { |
... | ... | |
71 | 68 |
|
72 | 69 |
menuItem.setCommand(mCommand); |
73 | 70 |
menu.getChildren().add(menuItem); |
74 |
|
|
75 | 71 |
} |
76 | 72 |
|
77 | 73 |
/** |
... | ... | |
80 | 76 |
*/ |
81 | 77 |
private Map<? extends Object, String> getClassLabelPairs() { |
82 | 78 |
if (editor != null){ |
83 |
AbstractBulkEditorInput input = editor.getEditorInput(); |
|
79 |
AbstractBulkEditorInput<?> input = editor.getEditorInput();
|
|
84 | 80 |
|
85 | 81 |
IEntityCreator<?> entityCreator = input.getEntityCreator(); |
86 | 82 |
if(entityCreator!=null){ |
... | ... | |
88 | 84 |
} |
89 | 85 |
} |
90 | 86 |
|
91 |
return Collections.EMPTY_MAP; |
|
87 |
@SuppressWarnings("unchecked") |
|
88 |
Map<? extends Object, String> result = Collections.EMPTY_MAP; |
|
89 |
return result; |
|
92 | 90 |
} |
93 | 91 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java | ||
---|---|---|
52 | 52 |
/** |
53 | 53 |
* @author p.ciardelli |
54 | 54 |
* @created 25.06.2009 |
55 |
* @version 1.0 |
|
56 |
* @param <T> |
|
57 | 55 |
*/ |
58 | 56 |
public abstract class AbstractBulkEditorInput<T extends CdmBase> extends CdmEntitySessionInput implements |
59 | 57 |
IEntityPersistenceService<T> { |
... | ... | |
336 | 334 |
return false; |
337 | 335 |
} |
338 | 336 |
|
339 |
|
|
340 |
/** {@inheritDoc} */ |
|
341 | 337 |
@Override |
342 | 338 |
public boolean merge(T entity, T mergeTarget) { |
343 | 339 |
if (entity instanceof IMergable) { |
... | ... | |
390 | 386 |
mergedEntities.clear(); |
391 | 387 |
} |
392 | 388 |
|
393 |
/** {@inheritDoc} */ |
|
394 | 389 |
@Override |
395 | 390 |
public T create(T entity) { |
396 | 391 |
return save(entity); |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java | ||
---|---|---|
115 | 115 |
return instance; |
116 | 116 |
} |
117 | 117 |
|
118 |
/** {@inheritDoc} */ |
|
119 | 118 |
@Override |
120 | 119 |
public boolean isMergingEnabled() { |
121 | 120 |
return true; |
122 | 121 |
} |
123 | 122 |
|
124 |
|
|
125 |
/** {@inheritDoc} */ |
|
126 | 123 |
@Override |
127 | 124 |
public boolean isConvertingEnabled() { |
128 | 125 |
return true; |
129 | 126 |
} |
130 | 127 |
|
131 |
/** {@inheritDoc} */ |
|
132 | 128 |
@Override |
133 | 129 |
public boolean merge(TeamOrPersonBase entity, TeamOrPersonBase mergeTarget) { |
134 | 130 |
if (entity instanceof IMergable) { |
... | ... | |
163 | 159 |
return CdmStore.getService(IAgentService.class).countByTitle(configurator); |
164 | 160 |
} |
165 | 161 |
|
166 |
/** {@inheritDoc} */ |
|
167 | 162 |
@Override |
168 | 163 |
public List<TeamOrPersonBase> listEntities(IIdentifiableEntityServiceConfigurator configurator) { |
169 | 164 |
|
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.java | ||
---|---|---|
150 | 150 |
return CdmStore.getService(IReferenceService.class).countByTitle(configurator); |
151 | 151 |
} |
152 | 152 |
|
153 |
/** {@inheritDoc} */ |
|
154 | 153 |
@Override |
155 | 154 |
public List listEntities(IIdentifiableEntityServiceConfigurator configurator) { |
156 | 155 |
return CdmStore.getSearchManager().findReferences(configurator); |
... | ... | |
158 | 157 |
|
159 | 158 |
// Entity persistence |
160 | 159 |
|
161 |
/** {@inheritDoc} */ |
|
162 | 160 |
@Override |
163 | 161 |
public Reference loadEntity(UUID entityUuid) { |
164 | 162 |
List<String> propertyPaths = Arrays.asList(new String[]{"*", "inReference.*", "authorTeam.*"}); |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/AgentCreator.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 |
*/ |
... | ... | |
24 | 24 |
* |
25 | 25 |
* @author p.ciardelli |
26 | 26 |
* @created 18.09.2009 |
27 |
* @version 1.0 |
|
28 | 27 |
*/ |
29 | 28 |
public class AgentCreator implements IEntityCreator<TeamOrPersonBase> { |
30 |
private static final Logger logger = Logger.getLogger(AgentCreator.class); |
|
31 | 29 |
|
30 |
private static final Logger logger = Logger.getLogger(AgentCreator.class); |
|
32 | 31 |
|
33 |
/** {@inheritDoc} */
|
|
34 |
public TeamOrPersonBase createEntity(String text) {
|
|
32 |
@Override
|
|
33 |
public TeamOrPersonBase createEntity(String text) {
|
|
35 | 34 |
// FIXME |
36 | 35 |
logger.error("FIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXME"); |
37 | 36 |
logger.error("We can only create Persons at the moment. See #1820"); |
... | ... | |
39 | 38 |
return createEntity(Person.class, text); |
40 | 39 |
} |
41 | 40 |
|
42 |
/** {@inheritDoc} */
|
|
43 |
public TeamOrPersonBase createEntity(Object key, String text) {
|
|
44 |
TeamOrPersonBase teamOrPerson = null; |
|
41 |
@Override
|
|
42 |
public TeamOrPersonBase createEntity(Object key, String text) {
|
|
43 |
TeamOrPersonBase<?> teamOrPerson = null;
|
|
45 | 44 |
if (Team.class.equals((key))) { |
46 | 45 |
teamOrPerson = Team.NewInstance(); |
47 | 46 |
} |
48 | 47 |
if (Person.class.equals((key))) { |
49 | 48 |
teamOrPerson = Person.NewInstance(); |
50 |
}
|
|
49 |
} |
|
51 | 50 |
if (teamOrPerson != null) { |
52 | 51 |
teamOrPerson.setTitleCache(text, true); |
53 | 52 |
} |
... | ... | |
59 | 58 |
* |
60 | 59 |
* @return a {@link java.util.Map} object. |
61 | 60 |
*/ |
62 |
public Map<Object, String> getKeyLabelPairs() { |
|
61 |
@Override |
|
62 |
public Map<Object, String> getKeyLabelPairs() { |
|
63 | 63 |
Map<Object, String> result = new HashMap<Object, String>(); |
64 | 64 |
result.put(Team.class, "Team"); |
65 | 65 |
result.put(Person.class, "Person"); |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/NameCreator.java | ||
---|---|---|
26 | 26 |
* |
27 | 27 |
* @author p.ciardelli |
28 | 28 |
* @created 07.07.2009 |
29 |
* @version 1.0 |
|
30 | 29 |
*/ |
31 | 30 |
public class NameCreator implements IEntityCreator<TaxonName> { |
32 | 31 |
|
33 |
/** {@inheritDoc} */ |
|
34 | 32 |
@Override |
35 | 33 |
public TaxonName createEntity(String text) { |
36 | 34 |
TaxonName name = PreferencesUtil.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null); |
... | ... | |
39 | 37 |
return name; |
40 | 38 |
} |
41 | 39 |
|
42 |
/** {@inheritDoc} */ |
|
43 | 40 |
@Override |
44 | 41 |
public TaxonName createEntity(Object key, String text) { |
45 | 42 |
return ParseHandler.parseName(text, (Rank) key); |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/OccurrenceCreator.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator; |
11 | 11 |
|
12 | 12 |
import java.util.Arrays; |
13 |
import java.util.HashMap; |
|
14 | 13 |
import java.util.LinkedHashMap; |
15 | 14 |
import java.util.Map; |
16 | 15 |
|
... | ... | |
22 | 21 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
23 | 22 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; |
24 | 23 |
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator; |
25 |
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil; |
|
26 | 24 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
27 | 25 |
import eu.etaxonomy.taxeditor.newWizard.NewDerivedUnitBaseWizard; |
28 | 26 |
|
... | ... | |
40 | 38 |
private static final Logger logger = Logger |
41 | 39 |
.getLogger(OccurrenceCreator.class); |
42 | 40 |
|
43 |
/** {@inheritDoc} */ |
|
44 | 41 |
@Override |
45 | 42 |
public SpecimenOrObservationBase createEntity(String text) { |
46 | 43 |
|
47 | 44 |
return createEntity(DerivedUnit.class, text); |
48 | 45 |
} |
49 | 46 |
|
50 |
/** {@inheritDoc} */ |
|
51 | 47 |
@Override |
52 | 48 |
public SpecimenOrObservationBase createEntity(Object key, String text) { |
53 | 49 |
|
54 |
SpecimenOrObservationBase specimenOrObservation = null; |
|
50 |
SpecimenOrObservationBase<?> specimenOrObservation = null;
|
|
55 | 51 |
NewDerivedUnitBaseWizard wizard = new NewDerivedUnitBaseWizard((SpecimenOrObservationType)key); |
56 | 52 |
wizard.init(null, null); |
57 | 53 |
if(wizard.getEntity() != null) { |
58 |
WizardDialog dialog = new WizardDialog(BulkEditorUtil.getShell(), wizard);
|
|
54 |
WizardDialog dialog = new WizardDialog(AbstractUtility.getShell(), wizard);
|
|
59 | 55 |
int status = dialog.open(); |
60 | 56 |
|
61 | 57 |
if (status == IStatus.OK) { |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/ReferenceCreator.java | ||
---|---|---|
23 | 23 |
* |
24 | 24 |
* @author p.ciardelli |
25 | 25 |
* @created 07.07.2009 |
26 |
* @version 1.0 |
|
27 | 26 |
*/ |
28 | 27 |
public class ReferenceCreator implements IEntityCreator<Reference> { |
29 | 28 |
|
30 |
/* (non-Javadoc) |
|
31 |
* @see eu.etaxonomy.taxeditor.bulkeditor.IEntityCreator#createEntity(java.lang.String) |
|
32 |
*/ |
|
33 |
/** {@inheritDoc} */ |
|
34 | 29 |
@Override |
35 | 30 |
public Reference createEntity(String text) { |
36 | 31 |
return createEntity(Reference.class, text); |
37 | 32 |
} |
38 | 33 |
|
39 |
/* (non-Javadoc) |
|
40 |
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Class, java.lang.String) |
|
41 |
*/ |
|
42 |
/** {@inheritDoc} */ |
|
43 | 34 |
@Override |
44 | 35 |
public Reference createEntity(Object key, String text) { |
45 | 36 |
Reference reference = null; |
... | ... | |
104 | 95 |
return reference; |
105 | 96 |
} |
106 | 97 |
|
107 |
/* (non-Javadoc) |
|
108 |
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#getClassLabelPairs() |
|
109 |
*/ |
|
110 | 98 |
/** |
111 | 99 |
* <p>getKeyLabelPairs</p> |
112 | 100 |
* |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/TitleCacheComparator.java | ||
---|---|---|
18 | 18 |
* |
19 | 19 |
* @author p.ciardelli |
20 | 20 |
* @created 19.08.2009 |
21 |
* @version 1.0 |
|
22 | 21 |
*/ |
23 | 22 |
public class TitleCacheComparator<T extends IIdentifiableEntity> implements Comparator<T> { |
24 | 23 |
|
... | ... | |
28 | 27 |
return o == null ? null : o.getTitleCache(); |
29 | 28 |
} |
30 | 29 |
|
31 |
/* (non-Javadoc) |
|
32 |
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) |
|
33 |
*/ |
|
34 |
/** {@inheritDoc} */ |
|
35 | 30 |
@Override |
36 | 31 |
public int compare(T o1, T o2) { |
37 | 32 |
String titleCache1 = getTitleCache(o1); |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/internal/TaxeditorBulkeditorPlugin.java | ||
---|---|---|
7 | 7 |
* The activator class controls the plug-in life cycle |
8 | 8 |
* |
9 | 9 |
* @author n.hoffmann |
10 |
* @version $Id: $ |
|
11 | 10 |
*/ |
12 | 11 |
public class TaxeditorBulkeditorPlugin extends AbstractUIPlugin { |
13 | 12 |
|
... | ... | |
17 | 16 |
|
18 | 17 |
// The shared instance |
19 | 18 |
private static TaxeditorBulkeditorPlugin plugin; |
20 |
|
|
19 |
|
|
21 | 20 |
/** |
22 | 21 |
* The constructor |
23 | 22 |
*/ |
24 | 23 |
public TaxeditorBulkeditorPlugin() { |
25 | 24 |
} |
26 | 25 |
|
27 |
/* |
|
28 |
* (non-Javadoc) |
|
29 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) |
|
30 |
*/ |
|
31 |
/** {@inheritDoc} */ |
|
32 |
public void start(BundleContext context) throws Exception { |
|
26 |
@Override |
|
27 |
public void start(BundleContext context) throws Exception { |
|
33 | 28 |
super.start(context); |
34 |
plugin = this;
|
|
35 |
|
|
29 |
plugin = this; |
|
30 |
|
|
36 | 31 |
} |
37 | 32 |
|
38 |
/* |
|
39 |
* (non-Javadoc) |
|
40 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) |
|
41 |
*/ |
|
42 |
/** {@inheritDoc} */ |
|
43 |
public void stop(BundleContext context) throws Exception { |
|
33 |
@Override |
|
34 |
public void stop(BundleContext context) throws Exception { |
|
44 | 35 |
plugin = null; |
45 | 36 |
super.stop(context); |
46 | 37 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsContentProvider.java | ||
---|---|---|
20 | 20 |
* |
21 | 21 |
* @author p.ciardelli |
22 | 22 |
* @created 09.07.2009 |
23 |
* @version 1.0 |
|
24 | 23 |
*/ |
25 | 24 |
public class ReferencingObjectsContentProvider implements |
26 | 25 |
IStructuredContentProvider { |
27 |
@SuppressWarnings("unused") |
|
28 |
private static final Logger logger = Logger |
|
29 |
.getLogger(ReferencingObjectsContentProvider.class); |
|
30 | 26 |
|
31 |
/** {@inheritDoc} */ |
|
27 |
@SuppressWarnings("unused") |
|
28 |
private static final Logger logger = Logger.getLogger(ReferencingObjectsContentProvider.class); |
|
29 |
|
|
32 | 30 |
@Override |
33 | 31 |
public Object[] getElements(Object inputElement) { |
34 | 32 |
if (inputElement instanceof Collection) { |
... | ... | |
37 | 35 |
return new Object[0]; |
38 | 36 |
} |
39 | 37 |
|
40 |
/** |
|
41 |
* <p>dispose</p> |
|
42 |
*/ |
|
43 | 38 |
@Override |
44 | 39 |
public void dispose() {} |
45 | 40 |
|
46 |
/** {@inheritDoc} */ |
|
47 | 41 |
@Override |
48 | 42 |
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} |
49 | 43 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsLabelProvider.java | ||
---|---|---|
26 | 26 |
* |
27 | 27 |
* @author p.ciardelli |
28 | 28 |
* @created 09.07.2009 |
29 |
* @version 1.0 |
|
30 | 29 |
*/ |
31 | 30 |
public class ReferencingObjectsLabelProvider extends LabelProvider implements ITableLabelProvider { |
32 |
private static final Logger logger = Logger |
|
33 |
.getLogger(ReferencingObjectsLabelProvider.class); |
|
31 |
|
|
32 |
@SuppressWarnings("unused") |
|
33 |
private static final Logger logger = Logger.getLogger(ReferencingObjectsLabelProvider.class); |
|
34 | 34 |
|
35 | 35 |
/** |
36 | 36 |
* <p>Constructor for ReferencingObjectsLabelProvider.</p> |
... | ... | |
38 | 38 |
public ReferencingObjectsLabelProvider() { |
39 | 39 |
} |
40 | 40 |
|
41 |
|
|
42 |
/** {@inheritDoc} */ |
|
43 | 41 |
@Override |
44 | 42 |
public Image getColumnImage(Object element, int columnIndex) { |
45 | 43 |
return null; |
46 | 44 |
} |
47 | 45 |
|
48 |
/** {@inheritDoc} */ |
|
49 | 46 |
@Override |
50 | 47 |
public String getColumnText(Object element, int columnIndex) { |
51 | 48 |
String text = null; |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/e4/ReferencingObjectsViewE4.java | ||
---|---|---|
414 | 414 |
} |
415 | 415 |
} |
416 | 416 |
|
417 |
/** {@inheritDoc} */ |
|
418 | 417 |
@Override |
419 | 418 |
public void showViewer(IStructuredSelection selection, MPart activePart, Viewer viewer){ |
420 | 419 |
// this.part = part; |
... | ... | |
465 | 464 |
} |
466 | 465 |
} |
467 | 466 |
|
468 |
/** {@inheritDoc} */ |
|
469 | 467 |
@PreDestroy |
470 | 468 |
public void dispose() { |
471 | 469 |
if(conversation!=null){ |
... | ... | |
474 | 472 |
} |
475 | 473 |
} |
476 | 474 |
|
477 |
/** {@inheritDoc} */ |
|
478 | 475 |
@Override |
479 | 476 |
public void changed(Object object) { |
480 | 477 |
// no editing in this view |
481 | 478 |
} |
482 | 479 |
|
483 |
/** {@inheritDoc} */ |
|
484 | 480 |
@Override |
485 | 481 |
public boolean onComplete() { |
486 | 482 |
return false; |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/CdmDataTransfer.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 |
*/ |
... | ... | |
34 | 34 |
* |
35 | 35 |
* @author n.hoffmann |
36 | 36 |
* @created Jun 18, 2010 |
37 |
* @version 1.0 |
|
38 | 37 |
*/ |
39 | 38 |
public class CdmDataTransfer extends ByteArrayTransfer { |
40 |
private static final Logger logger = Logger |
|
41 |
.getLogger(CdmDataTransfer.class); |
|
39 |
|
|
40 |
@SuppressWarnings("unused") |
|
41 |
private static final Logger logger = Logger.getLogger(CdmDataTransfer.class); |
|
42 | 42 |
|
43 | 43 |
private static int SEPARATOR = -10; |
44 | 44 |
private static int EOF = -20; |
45 | 45 |
private static final String TYPE_NAME = "cdmdata-transfer-format"; //$NON-NLS-1$ |
46 |
private static final int TYPE_ID = registerType (TYPE_NAME);
|
|
46 |
private static final int TYPE_ID = registerType (TYPE_NAME); |
|
47 | 47 |
private static final CdmDataTransfer instance = new CdmDataTransfer(); |
48 |
|
|
48 |
|
|
49 | 49 |
/** |
50 | 50 |
* <p>Getter for the field <code>instance</code>.</p> |
51 | 51 |
* |
... | ... | |
56 | 56 |
} |
57 | 57 |
|
58 | 58 |
private ICdmBase cdmBase; |
59 |
|
|
60 |
/* (non-Javadoc) |
|
61 |
* @see org.eclipse.swt.dnd.Transfer#getTypeIds() |
|
62 |
*/ |
|
63 |
/** {@inheritDoc} */ |
|
59 |
|
|
64 | 60 |
@Override |
65 | 61 |
protected int[] getTypeIds() { |
66 |
return new int[] { TYPE_ID };
|
|
62 |
return new int[] { TYPE_ID }; |
|
67 | 63 |
} |
68 | 64 |
|
69 |
/* (non-Javadoc) |
|
70 |
* @see org.eclipse.swt.dnd.Transfer#getTypeNames() |
|
71 |
*/ |
|
72 |
/** {@inheritDoc} */ |
|
73 | 65 |
@Override |
74 | 66 |
protected String[] getTypeNames() { |
75 | 67 |
return new String[]{ TYPE_NAME }; |
76 | 68 |
} |
77 | 69 |
|
78 |
/** {@inheritDoc} */ |
|
79 | 70 |
@Override |
80 | 71 |
protected void javaToNative(Object object, TransferData transferData) { |
81 | 72 |
byte[] bytes = toByteArray((ICdmBase[]) object); |
82 |
if (bytes != null) |
|
83 |
super.javaToNative(bytes, transferData); |
|
73 |
if (bytes != null) { |
|
74 |
super.javaToNative(bytes, transferData); |
|
75 |
} |
|
84 | 76 |
} |
85 | 77 |
|
86 |
|
|
87 |
|
|
88 |
/** {@inheritDoc} */ |
|
89 | 78 |
@Override |
90 | 79 |
protected Object nativeToJava(TransferData transferData) { |
91 | 80 |
byte[] bytes = (byte[]) super.nativeToJava(transferData); |
... | ... | |
105 | 94 |
byte[] bytes = null; |
106 | 95 |
|
107 | 96 |
try { |
108 |
|
|
97 |
|
|
109 | 98 |
for(ICdmBase cdmBaseObject : cdmBaseObjects){ |
110 | 99 |
writeCdmBaseObject(cdmBaseObject, out); |
111 | 100 |
} |
... | ... | |
116 | 105 |
} |
117 | 106 |
return bytes; |
118 | 107 |
} |
119 |
|
|
120 |
|
|
108 |
|
|
109 |
|
|
121 | 110 |
private ICdmBase[] fromByteArray(byte[] bytes) { |
122 | 111 |
DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes)); |
123 |
|
|
112 |
|
|
124 | 113 |
try { |
125 | 114 |
List<ICdmBase> cdmBaseObjects = new ArrayList<ICdmBase>(); |
126 |
|
|
115 |
|
|
127 | 116 |
try{ |
128 | 117 |
while(true){ |
129 | 118 |
cdmBaseObjects.add(readCdmBaseObject(in)); |
... | ... | |
135 | 124 |
return null; |
136 | 125 |
} |
137 | 126 |
} |
138 |
|
|
127 |
|
|
139 | 128 |
private ICdmBase readCdmBaseObject(DataInputStream in) throws IOException{ |
140 | 129 |
String className = in.readUTF(); |
141 | 130 |
in.readInt(); |
142 | 131 |
String idString = in.readUTF(); |
143 | 132 |
in.readInt(); |
144 |
|
|
133 |
|
|
145 | 134 |
if(className.equals(Synonym.class.getName()) || className.equals(Taxon.class.getName())){ |
146 | 135 |
ICdmBase object = CdmStore.getService(ITaxonService.class).load(UUID.fromString(idString)); |
147 |
|
|
136 |
|
|
148 | 137 |
if(object == null){ |
149 | 138 |
return cdmBase; |
150 | 139 |
} |
151 |
|
|
140 |
|
|
152 | 141 |
return object; |
153 | 142 |
} |
154 |
|
|
143 |
|
|
155 | 144 |
return null; |
156 | 145 |
} |
157 |
|
|
146 |
|
|
158 | 147 |
private void writeCdmBaseObject(ICdmBase cdmBase, DataOutputStream out) throws IOException{ |
159 | 148 |
/** |
160 | 149 |
* CdmBase object serialization: |
161 |
*
|
|
150 |
* |
|
162 | 151 |
*/ |
163 | 152 |
out.writeUTF(cdmBase.getClass().getName()); |
164 | 153 |
out.writeInt(SEPARATOR); |
165 | 154 |
out.writeUTF(cdmBase.getUuid().toString()); |
166 | 155 |
out.writeInt(EOF); |
167 |
|
|
156 |
|
|
168 | 157 |
if(cdmBase.getId() == 0){ |
169 | 158 |
// fallback for unsaved instances |
170 | 159 |
this.cdmBase = cdmBase; |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/SimpleSelectionProvider.java | ||
---|---|---|
32 | 32 |
* @author p.ciardelli |
33 | 33 |
* @author n.hoffmann |
34 | 34 |
* @created 16.05.2008 |
35 |
* @version 1.0 |
|
36 | 35 |
*/ |
37 | 36 |
public class SimpleSelectionProvider implements ISelectionProvider { |
38 | 37 |
|
... | ... | |
41 | 40 |
private ISelection selection; |
42 | 41 |
private Job job; |
43 | 42 |
|
44 |
/* |
|
45 |
* (non-Javadoc) |
|
46 |
* @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) |
|
47 |
*/ |
|
48 |
/** {@inheritDoc} */ |
|
49 | 43 |
@Override |
50 | 44 |
public void addSelectionChangedListener( |
51 | 45 |
ISelectionChangedListener listener) { |
52 | 46 |
selectionChangedListeners.add(listener); |
53 | 47 |
} |
54 | 48 |
|
55 |
/* |
|
56 |
* (non-Javadoc) |
|
57 |
* @see org.eclipse.jface.viewers.ISelectionProvider#getSelection() |
|
58 |
*/ |
|
59 | 49 |
/** |
60 | 50 |
* <p>Getter for the field <code>selection</code>.</p> |
61 | 51 |
* |
... | ... | |
71 | 61 |
return new StructuredSelection(); |
72 | 62 |
} |
73 | 63 |
|
74 |
/* |
|
75 |
* (non-Javadoc) |
|
76 |
* @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) |
|
77 |
*/ |
|
78 |
/** {@inheritDoc} */ |
|
79 | 64 |
@Override |
80 | 65 |
public void removeSelectionChangedListener( |
81 | 66 |
ISelectionChangedListener listener) { |
82 | 67 |
selectionChangedListeners.remove(listener); |
83 | 68 |
} |
84 | 69 |
|
85 |
/* |
|
86 |
* (non-Javadoc) |
|
87 |
* @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection) |
|
88 |
*/ |
|
89 |
/** {@inheritDoc} */ |
|
90 | 70 |
@Override |
91 | 71 |
public void setSelection(ISelection selection) { |
92 | 72 |
this.selection = selection; |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/ViewerConfiguration.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 |
*/ |
... | ... | |
19 | 19 |
* |
20 | 20 |
* @author p.ciardelli |
21 | 21 |
* @created 22.01.2009 |
22 |
* @version 1.0 |
|
23 | 22 |
*/ |
24 | 23 |
public class ViewerConfiguration extends SourceViewerConfiguration { |
25 |
|
|
24 |
|
|
26 | 25 |
private IAnnotationHover annotationHover = new DefaultAnnotationHover(); |
27 |
|
|
28 |
/** {@inheritDoc} */
|
|
29 |
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
|
|
26 |
|
|
27 |
@Override
|
|
28 |
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
|
|
30 | 29 |
return annotationHover; |
31 | 30 |
} |
32 | 31 |
|
33 |
// /* (non-Javadoc) |
|
34 |
// * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer) |
|
35 |
// */ |
|
36 | 32 |
// @Override |
37 | 33 |
// public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { |
38 | 34 |
// ContentAssistant contentAssistant = new ContentAssistant(); |
... | ... | |
42 | 38 |
// contentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer)); |
43 | 39 |
// return contentAssistant; |
44 | 40 |
// } |
45 |
|
|
46 |
|
|
41 |
|
|
42 |
|
|
47 | 43 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/DescriptiveDataSetNavigator.java | ||
---|---|---|
205 | 205 |
return selService; |
206 | 206 |
} |
207 | 207 |
|
208 |
/** {@inheritDoc} */ |
|
209 | 208 |
@PreDestroy |
210 | 209 |
public void dispose() { |
211 | 210 |
if (conversation != null) { |
... | ... | |
218 | 217 |
} |
219 | 218 |
} |
220 | 219 |
|
221 |
/** {@inheritDoc} */ |
|
222 | 220 |
@Focus |
223 | 221 |
public void setFocus() { |
224 | 222 |
if (getConversationHolder() != null) { |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputDataChangeBehaviourE4.java | ||
---|---|---|
13 | 13 |
import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour; |
14 | 14 |
|
15 | 15 |
/** |
16 |
* |
|
17 | 16 |
* @author pplitzner |
18 | 17 |
* @date Aug 24, 2017 |
19 |
* |
|
20 | 18 |
*/ |
21 | 19 |
public class TaxonEditorInputDataChangeBehaviourE4 extends |
22 | 20 |
AbstractDataChangeBehaviour { |
... | ... | |
27 | 25 |
source = taxonEditorInput; |
28 | 26 |
} |
29 | 27 |
|
30 |
/** {@inheritDoc} */ |
|
31 | 28 |
@Override |
32 | 29 |
public void reactOnDataChange(CdmDataChangeMap events) { |
33 | 30 |
source.update(events); |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputE4.java | ||
---|---|---|
63 | 63 |
|
64 | 64 |
|
65 | 65 |
/** |
66 |
* |
|
67 | 66 |
* @author pplitzner |
68 | 67 |
* @date Aug 24, 2017 |
69 |
* |
|
70 | 68 |
*/ |
71 | 69 |
public class TaxonEditorInputE4 extends CdmEntitySessionInput implements IConversationEnabled { |
72 | 70 |
|
... | ... | |
121 | 119 |
this.taxonNode = taxonNode; |
122 | 120 |
} |
123 | 121 |
|
124 |
|
|
125 | 122 |
private void initForTaxonNode(UUID taxonNodeUuid) { |
126 | 123 |
this.getCdmEntitySession().bind(); |
127 | 124 |
TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNodeUuid, getTaxonNodePropertyPaths()); |
... | ... | |
137 | 134 |
private void initForTaxonBase(UUID taxonBaseUuid) { |
138 | 135 |
this.getCdmEntitySession().bind(); |
139 | 136 |
// TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonBaseUuid, getTaxonBasePropertyPaths()); |
140 |
TaxonBase taxonBase = getCdmEntitySession().remoteLoad(CdmStore.getService(ITaxonService.class), taxonBaseUuid, getTaxonBasePropertyPaths()); |
|
137 |
TaxonBase<?> taxonBase = getCdmEntitySession().remoteLoad(CdmStore.getService(ITaxonService.class), taxonBaseUuid, getTaxonBasePropertyPaths());
|
|
141 | 138 |
if (taxonBase != null){ |
142 | 139 |
if(taxonBase.isInstanceOf(Taxon.class)){ |
143 | 140 |
Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class); |
... | ... | |
324 | 321 |
return conversation; |
325 | 322 |
} |
326 | 323 |
|
327 |
/** {@inheritDoc} */ |
|
328 | 324 |
@Override |
329 | 325 |
public void update(CdmDataChangeMap events) { |
330 | 326 |
if(dataChangeBehavior == null){ |
... | ... | |
368 | 364 |
delete(entry.getKey(), entry.getValue()); |
369 | 365 |
} |
370 | 366 |
toDeletes.clear(); |
371 |
for(AbstractPostOperation entry:operations){ |
|
367 |
for(AbstractPostOperation<?> entry:operations){
|
|
372 | 368 |
IStatus status = Status.CANCEL_STATUS; |
373 | 369 |
final IAdaptable uiInfoAdapter = WorkspaceUndoUtil |
374 | 370 |
.getUIInfoAdapter(AbstractUtility.getShell()); |
... | ... | |
408 | 404 |
} |
409 | 405 |
} |
410 | 406 |
|
411 |
for (TaxonBase concept: toSaveNewConcepts){ |
|
407 |
for (TaxonBase<?> concept: toSaveNewConcepts){
|
|
412 | 408 |
for (HybridRelationship rel : concept.getName().getHybridChildRelations()){ |
413 | 409 |
// if (!rel.getParentName().isPersited()) { |
414 | 410 |
toSaveNewNames.add(rel.getParentName()); |
... | ... | |
430 | 426 |
|
431 | 427 |
} |
432 | 428 |
|
433 |
/** |
|
434 |
* @param key |
|
435 |
* @param value |
|
436 |
*/ |
|
437 | 429 |
private void delete(TaxonBase key, TaxonBaseDeletionConfigurator value) { |
438 | 430 |
if (key instanceof Synonym){ |
439 | 431 |
CdmStore.getService(ITaxonService.class).deleteSynonym(((Synonym)key).getUuid(), (SynonymDeletionConfigurator) value); |
440 | 432 |
}else{ |
441 | 433 |
CdmStore.getService(ITaxonService.class).deleteTaxon(((Taxon)key).getUuid(), (TaxonDeletionConfigurator) value, null); |
442 | 434 |
} |
443 |
|
|
444 | 435 |
} |
445 | 436 |
|
446 | 437 |
@Override |
... | ... | |
493 | 484 |
return taxonBasePropertyPaths; |
494 | 485 |
} |
495 | 486 |
|
496 |
/** |
|
497 |
* @param selectedElement |
|
498 |
* @param deleteConfig |
|
499 |
*/ |
|
500 | 487 |
public void addTaxonBaseToDelete(TaxonBase selectedElement, TaxonBaseDeletionConfigurator deleteConfig) { |
501 | 488 |
this.toDeletes.put(selectedElement, deleteConfig); |
502 | 489 |
|
503 | 490 |
} |
504 | 491 |
|
505 |
/** |
|
506 |
* @param newName |
|
507 |
*/ |
|
508 | 492 |
public void addToSaveNewName(TaxonName newName) { |
509 | 493 |
this.toSaveNewNames.add(newName); |
510 | 494 |
} |
511 |
|
|
512 | 495 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SpecimenPropertyTester.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.taxeditor.editor.handler; |
2 | 2 |
|
3 |
|
|
4 | 3 |
import org.eclipse.core.expressions.PropertyTester; |
5 | 4 |
import org.eclipse.jface.viewers.IStructuredSelection; |
6 | 5 |
import org.eclipse.jface.viewers.TreeNode; |
... | ... | |
11 | 10 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
12 | 11 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
13 | 12 |
|
14 |
|
|
15 |
|
|
16 | 13 |
/** |
17 | 14 |
* Tests types of specimens to add items to the context menu. |
18 | 15 |
* |
... | ... | |
29 | 26 |
|
30 | 27 |
public SpecimenPropertyTester() {} |
31 | 28 |
|
32 |
/** {@inheritDoc} */ |
|
33 | 29 |
@Override |
34 | 30 |
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { |
35 | 31 |
if (receiver instanceof IStructuredSelection) { |
... | ... | |
78 | 74 |
private boolean isSequence(Object object) { |
79 | 75 |
return (object instanceof Sequence); |
80 | 76 |
} |
81 |
|
|
82 | 77 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/internal/TaxeditorEditorPlugin.java | ||
---|---|---|
12 | 12 |
* The activator class controls the plug-in life cycle |
13 | 13 |
* |
14 | 14 |
* @author n.hoffmann |
15 |
* @version $Id: $ |
|
16 | 15 |
*/ |
17 | 16 |
public class TaxeditorEditorPlugin extends AbstractUIPlugin { |
18 | 17 |
|
... | ... | |
32 | 31 |
public TaxeditorEditorPlugin() { |
33 | 32 |
} |
34 | 33 |
|
35 |
/** {@inheritDoc} */ |
|
36 | 34 |
@Override |
37 | 35 |
public void start(BundleContext context) throws Exception { |
38 | 36 |
super.start(context); |
... | ... | |
47 | 45 |
logger.trace("Plugin started: " + this.getBundle().getSymbolicName()); //$NON-NLS-1$ |
48 | 46 |
} |
49 | 47 |
|
50 |
|
|
51 |
/** {@inheritDoc} */ |
|
52 | 48 |
@Override |
53 | 49 |
public void stop(BundleContext context) throws Exception { |
54 | 50 |
plugin = null; |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/e4/KeyEditorDataChangeBehaviourE4.java | ||
---|---|---|
22 | 22 |
/** |
23 | 23 |
* @author n.hoffmann |
24 | 24 |
* @created May 5, 2011 |
25 |
* @version 1.0 |
|
26 | 25 |
*/ |
27 | 26 |
public class KeyEditorDataChangeBehaviourE4 extends AbstractDataChangeBehaviour { |
28 | 27 |
|
... | ... | |
42 | 41 |
} |
43 | 42 |
} |
44 | 43 |
|
45 |
/** {@inheritDoc} */ |
|
46 | 44 |
@Override |
47 | 45 |
public void reactOnUpdate(Vector<CdmDataChangeEvent> events){ |
48 | 46 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/EditorAnnotation.java | ||
---|---|---|
20 | 20 |
* <p>EditorAnnotation class.</p> |
21 | 21 |
* |
22 | 22 |
* @author n.hoffmann |
23 |
* @version $Id: $ |
|
24 | 23 |
*/ |
25 | 24 |
public class EditorAnnotation extends Annotation implements IAnnotationPresentation { |
26 |
private static final Logger logger = Logger |
|
27 |
.getLogger(EditorAnnotation.class); |
|
25 |
|
|
26 |
@SuppressWarnings("unused") |
|
27 |
private static final Logger logger = Logger.getLogger(EditorAnnotation.class); |
|
28 | 28 |
private final IMarker marker; |
29 | 29 |
private String text; |
30 | 30 |
private int line; |
... | ... | |
33 | 33 |
public enum EditorAnnotationType{ |
34 | 34 |
WARNING(ImageResources.WARNING_ANNOTATION_ICON, 244, 200, 45), |
35 | 35 |
ERROR(ImageResources.ERROR_ANNOTATION_ICON, 255, 0, 0); |
36 |
|
|
36 |
|
|
37 | 37 |
public Image image; |
38 | 38 |
public RGB color; |
39 |
|
|
39 |
|
|
40 | 40 |
EditorAnnotationType(String imageResource, int r, int g, int b){ |
41 | 41 |
image = ImageResources.getImage(imageResource); |
42 | 42 |
color = new RGB(r, g, b); |
... | ... | |
55 | 55 |
} |
56 | 56 |
return null; |
57 | 57 |
} |
58 |
|
|
58 |
|
|
59 | 59 |
} |
60 |
|
|
60 |
|
|
61 | 61 |
// // error identifiers, images and colors |
62 | 62 |
// /** Constant <code>ERROR_TYPE="editor.error.type"</code> */ |
63 | 63 |
// public static String ERROR_TYPE = "editor.error.type"; |
64 | 64 |
// /** Constant <code>ERROR_IMAGE</code> */ |
65 | 65 |
// public static Image ERROR_IMAGE = ImageResources.getImage(ImageResources.ERROR_ANNOTATION_ICON); |
66 | 66 |
// /** Constant <code>ERROR_RGB</code> */ |
67 |
// public static final RGB ERROR_RGB = new RGB(255, 0, 0);
|
|
68 |
//
|
|
67 |
// public static final RGB ERROR_RGB = new RGB(255, 0, 0); |
|
68 |
// |
|
69 | 69 |
// /** Constant <code>WARNING_TYPE="editor.warning.type"</code> */ |
70 | 70 |
// public static String WARNING_TYPE = "editor.warning.type"; |
71 | 71 |
// /** Constant <code>WARNING_IMAGE</code> */ |
72 | 72 |
// public static Image WARNING_IMAGE = ImageResources.getImage(ImageResources.WARNING_ANNOTATION_ICON); |
73 | 73 |
// /** Constant <code>WARNING_RGB</code> */ |
74 |
// public static final RGB WARNING_RGB = new RGB(244, 200, 45);
|
|
75 |
|
|
76 |
|
|
74 |
// public static final RGB WARNING_RGB = new RGB(244, 200, 45); |
|
75 |
|
|
76 |
|
|
77 | 77 |
public EditorAnnotation(ParserProblem problem){ |
78 | 78 |
this(EditorAnnotationType.getTypeByProblem(problem), 0, problem.getMessage()); |
79 | 79 |
} |
80 |
|
|
81 |
|
|
80 |
|
|
81 |
|
|
82 | 82 |
/** |
83 | 83 |
* <p>Constructor for EditorAnnotation.</p> |
84 | 84 |
* |
... | ... | |
111 | 111 |
this.line = line; |
112 | 112 |
this.text = text; |
113 | 113 |
} |
114 |
|
|
114 |
|
|
115 | 115 |
/** |
116 | 116 |
* <p>Getter for the field <code>marker</code>.</p> |
117 | 117 |
* |
... | ... | |
152 | 152 |
private Image getImage() { |
153 | 153 |
return EditorAnnotationType.valueOf(getType()).image; |
154 | 154 |
} |
155 |
|
|
155 |
|
|
156 | 156 |
/** |
157 | 157 |
* <p>getLayer</p> |
158 | 158 |
* |
159 | 159 |
* @return a int. |
160 | 160 |
*/ |
161 |
@Override |
|
161 | 162 |
public int getLayer() { |
162 | 163 |
return 3; |
163 | 164 |
} |
... | ... | |
181 | 182 |
this.position = position; |
182 | 183 |
} |
183 | 184 |
|
184 |
|
|
185 |
/** {@inheritDoc} */ |
|
186 |
public void paint(GC gc, Canvas canvas, Rectangle bounds) { |
|
185 |
@Override |
|
186 |
public void paint(GC gc, Canvas canvas, Rectangle bounds) { |
|
187 | 187 |
Point canvasSize= canvas.getSize(); |
188 | 188 |
|
189 | 189 |
int x= 0; |
... | ... | |
191 | 191 |
int w= canvasSize.x; |
192 | 192 |
int h= bounds.height; |
193 | 193 |
|
194 |
if (y + h > canvasSize.y) |
|
195 |
h= canvasSize.y - y; |
|
194 |
if (y + h > canvasSize.y) { |
|
195 |
h= canvasSize.y - y; |
|
196 |
} |
|
196 | 197 |
|
197 | 198 |
if (y < 0) { |
198 | 199 |
h= h + y; |
199 | 200 |
y= 0; |
200 | 201 |
} |
201 | 202 |
|
202 |
if (h <= 0) |
|
203 |
return; |
|
203 |
if (h <= 0) { |
|
204 |
return; |
|
205 |
} |
|
204 | 206 |
|
205 | 207 |
Image image = getImage(); |
206 |
|
|
208 |
|
|
207 | 209 |
if (image == null) { |
208 | 210 |
return; |
209 | 211 |
} |
210 |
|
|
212 |
|
|
211 | 213 |
Rectangle r = image.getBounds(); |
212 |
|
|
214 |
|
|
213 | 215 |
int destX = x + w - r.width; |
214 | 216 |
int destY = y + h - r.height; |
215 |
|
|
217 |
|
|
216 | 218 |
gc.drawImage(image, 0, 0, r.width, r.height, destX, destY, r.width, r.height); |
217 | 219 |
} |
218 | 220 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineWrapSquigglesStrategy.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 |
*/ |
... | ... | |
23 | 23 |
* |
24 | 24 |
* @author p.ciardelli |
25 | 25 |
* @created 21.11.2008 |
26 |
* @version 1.0 |
|
27 | 26 |
*/ |
28 | 27 |
public class LineWrapSquigglesStrategy extends SquigglesStrategy { |
29 |
|
|
28 |
|
|
30 | 29 |
/** Constant <code>ID="linewrap_squigglesstrategy"</code> */ |
31 | 30 |
public static final String ID = "linewrap_squigglesstrategy"; //$NON-NLS-1$ |
32 | 31 |
|
... | ... | |
41 | 40 |
private StyledText textWidget; |
42 | 41 |
|
43 | 42 |
private int offset; |
44 |
|
|
45 |
/* (non-Javadoc) |
|
46 |
* @see org.eclipse.jface.text.source.AnnotationPainter$SquigglesStrategy#draw(org.eclipse.jface.text.source.Annotation, org.eclipse.swt.graphics.GC, org.eclipse.swt.custom.StyledText, int, int, org.eclipse.swt.graphics.Color) |
|
47 |
*/ |
|
48 |
/** {@inheritDoc} */ |
|
49 |
public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color) { |
|
50 |
|
|
43 |
|
|
44 |
@Override |
|
45 |
public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color) { |
|
46 |
|
|
51 | 47 |
this.gc = gc; |
52 | 48 |
this.color = color; |
53 | 49 |
this.textWidget = textWidget; |
54 | 50 |
this.offset = offset; |
55 |
|
|
51 |
|
Also available in: Unified diff
cleanup