Revision 57aa2fdb
Added by Katja Luther about 7 years ago
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/messages.properties | ||
---|---|---|
55 | 55 |
ConceptGraphView_VIEWER_NAME=Concept Graph |
56 | 56 |
ConceptViewPart_VIEWER_NAME=Concept Relations |
57 | 57 |
UsesViewPart_VIEWER_NAME=Uses |
58 |
|
|
59 |
SetSecundumHandler_configureSettings=Configure the settings for secundum reference exchange of the subtree |
|
60 |
SetSecundumHandler_confirm=Confirm the exchange of secundum reference |
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/messages_de.properties | ||
---|---|---|
55 | 55 |
ConceptGraphView_VIEWER_NAME=Konzeptgraph |
56 | 56 |
ConceptViewPart_VIEWER_NAME=Konzeptrelationen |
57 | 57 |
UsesViewPart_VIEWER_NAME=Nutzung |
58 |
|
|
59 |
SetSecundumHandler_configureSettings=Konfigurieren Sie das Ersetzen der Secundum Referenz f?r den ausgew?hlten Teilbaum. |
|
60 |
SetSecundumHandler_confirm=Ersetzen der Secundum Referenz best?tigen |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/Messages.java | ||
---|---|---|
65 | 65 |
public static String SingleReadSequenceContextMenu_REUSE_FOR_SEQUENCE; |
66 | 66 |
public static String SingleReadSequenceContextMenu_REUSE_SINGLE_READ_HERE; |
67 | 67 |
public static String UsesViewPart_VIEWER_NAME; |
68 |
public static String SetSecundumHandler_configureSettings; |
|
69 |
public static String SetSecundumHandler_confirm; |
|
68 | 70 |
static { |
69 | 71 |
// initialize resource bundle |
70 | 72 |
NLS.initializeMessages(BUNDLE_NAME, Messages.class); |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteTaxonBaseHandler.java | ||
---|---|---|
36 | 36 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
37 | 37 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
38 | 38 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
39 |
import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog; |
|
39 |
import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
|
|
40 | 40 |
|
41 | 41 |
/** |
42 | 42 |
* @author n.hoffmann |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.java | ||
---|---|---|
20 | 20 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
21 | 21 |
import eu.etaxonomy.cdm.api.service.DeleteResult; |
22 | 22 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
23 |
import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator; |
|
23 | 24 |
import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator; |
24 | 25 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
25 | 26 |
import eu.etaxonomy.cdm.model.taxon.SynonymType; |
... | ... | |
75 | 76 |
|
76 | 77 |
} else { |
77 | 78 |
//TODO: this should be moved to the handler, the operations should not contain ui code |
78 |
setResult(service.deleteSynonym(synonym.getUuid(), null));
|
|
79 |
result = service.deleteSynonym(synonym.getUuid(), (SynonymDeletionConfigurator)configurator);
|
|
79 | 80 |
|
80 | 81 |
} |
81 | 82 |
// taxon.removeSynonym(synonym); |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java | ||
---|---|---|
31 | 31 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
32 | 32 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
33 | 33 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
34 |
import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog; |
|
34 |
import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
|
|
35 | 35 |
|
36 | 36 |
/** |
37 | 37 |
* |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DeleteHandler.java | ||
---|---|---|
43 | 43 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
44 | 44 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
45 | 45 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
46 |
import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog; |
|
46 |
import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
|
|
47 | 47 |
|
48 | 48 |
/** |
49 | 49 |
* <p>DeleteDescriptionHandler class.</p> |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/DeleteMediaHandler.java | ||
---|---|---|
25 | 25 |
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; |
26 | 26 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
27 | 27 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
28 |
import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog; |
|
28 |
import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
|
|
29 | 29 |
|
30 | 30 |
/** |
31 | 31 |
* <p>DeleteMediaHandler class.</p> |
eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties | ||
---|---|---|
43 | 43 |
navigatorContent.name.0 = TaxonNode |
44 | 44 |
navigatorContent.name.1 = Synonyms (experimental) |
45 | 45 |
command.label.moveFactualData = Move factual data to another taxon |
46 |
command.name.moveFactualData = Move factual data |
|
46 |
command.name.moveFactualData = Move factual data |
|
47 |
command.label.setSecForSubtree = Set secundum for subtree |
|
48 |
command.name.setSecForSubtree = set secundum for subtree |
eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties | ||
---|---|---|
44 | 44 |
navigatorContent.name.0 = Taxonknoten |
45 | 45 |
navigatorContent.name.1 = Synonyme (experimentell) |
46 | 46 |
command.label.moveFactualData = Verschiebe Faktendaten zu Taxon |
47 |
command.name.moveFactualData = Verschiebe Faktendaten |
|
47 |
command.name.moveFactualData = Verschiebe Faktendaten |
|
48 |
command.label.setSecForSubtree = Setze Secundum f?r Teilbaum |
|
49 |
command.name.setSecForSubtree = Setze Secundum f?r Teilbaum |
eu.etaxonomy.taxeditor.navigation/plugin.xml | ||
---|---|---|
192 | 192 |
</reference> |
193 | 193 |
</and> |
194 | 194 |
</visibleWhen> |
195 |
</command> |
|
196 |
<command |
|
197 |
commandId="eu.etaxonomy.taxeditor.navigator.command.update.setSecundumForSubtree" |
|
198 |
label="%command.label.setSecForSubtree" |
|
199 |
style="push"> |
|
200 |
<visibleWhen |
|
201 |
checkEnabled="true"> |
|
202 |
<and> |
|
203 |
<reference |
|
204 |
definitionId="isCdmStoreConnected"> |
|
205 |
</reference> |
|
206 |
<reference |
|
207 |
definitionId="isTaxonNode"> |
|
208 |
</reference> |
|
209 |
</and> |
|
210 |
</visibleWhen> |
|
195 | 211 |
</command> |
196 | 212 |
<command |
197 | 213 |
commandId="eu.etaxonomy.taxeditor.navigation.command.update.moveTaxon" |
... | ... | |
416 | 432 |
defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.ChangeAcceptedTaxonToSynonymHandler" |
417 | 433 |
id="eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym" |
418 | 434 |
name="%command.name.5"> |
435 |
</command> |
|
436 |
<command |
|
437 |
defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.SetSecReferenceForSubtreeHandler" |
|
438 |
id="eu.etaxonomy.taxeditor.navigator.command.update.setSecundumForSubtree" |
|
439 |
name="%command.name.setSecForSubtree"> |
|
419 | 440 |
</command> |
420 | 441 |
<command |
421 | 442 |
defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.NewClassificationHandler" |
... | ... | |
507 | 528 |
definitionId="isRemoting"> |
508 | 529 |
</reference> |
509 | 530 |
</activeWhen> |
531 |
</handler> |
|
532 |
<handler |
|
533 |
class="eu.etaxonomy.taxeditor.navigation.navigator.handler.SetSecReferenceForSubtreeHandler" |
|
534 |
commandId="eu.etaxonomy.taxeditor.navigator.command.update.setSecundumForSubtree"> |
|
535 |
<activeWhen> |
|
536 |
<reference |
|
537 |
definitionId="isRemoting"> |
|
538 |
</reference> |
|
539 |
</activeWhen> |
|
510 | 540 |
</handler> |
511 | 541 |
<handler |
512 | 542 |
class="eu.etaxonomy.taxeditor.navigation.navigator.handler.RemotingMoveFactualDataHandler" |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorLabels.java | ||
---|---|---|
29 | 29 |
"Please close it manually and try again."; |
30 | 30 |
public static final String SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE = "Selected object is not a taxon tree node"; |
31 | 31 |
public static final String UNSAVED_CHANGES_MESSAGE = "There are unsaved changes in the source taxon. Please save first."; |
32 |
public static final String CHANGE_SECUNDUM_FOR_SUBTREE = "Set new Secundum Reference for all children."; |
|
32 | 33 |
|
33 | 34 |
|
34 | 35 |
|
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java | ||
---|---|---|
38 | 38 |
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator; |
39 | 39 |
import eu.etaxonomy.taxeditor.navigation.navigator.operation.DeleteOperation; |
40 | 40 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
41 |
import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog; |
|
41 |
import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
|
|
42 | 42 |
|
43 | 43 |
/** |
44 | 44 |
* <p>DeleteTreeNodeHandler class.</p> |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingDeleteTaxonNodeHandler.java | ||
---|---|---|
33 | 33 |
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels; |
34 | 34 |
import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingDeleteTaxonNodeOperation; |
35 | 35 |
import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler; |
36 |
import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog; |
|
36 |
import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
|
|
37 | 37 |
|
38 | 38 |
/** |
39 | 39 |
* @author cmathew |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/SetSecReferenceForSubtreeHandler.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.navigation.navigator.handler; |
|
10 |
|
|
11 |
import java.util.ArrayList; |
|
12 |
import java.util.List; |
|
13 |
import java.util.UUID; |
|
14 |
|
|
15 |
import org.apache.log4j.Logger; |
|
16 |
import org.eclipse.core.commands.ExecutionEvent; |
|
17 |
import org.eclipse.core.commands.operations.AbstractOperation; |
|
18 |
import org.eclipse.core.runtime.IStatus; |
|
19 |
import org.eclipse.core.runtime.Status; |
|
20 |
import org.eclipse.jface.viewers.TreeSelection; |
|
21 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
22 |
|
|
23 |
import eu.etaxonomy.cdm.api.service.config.SetSecundumForSubtreeConfigurator; |
|
24 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
|
25 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
26 |
import eu.etaxonomy.taxeditor.editor.Messages; |
|
27 |
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels; |
|
28 |
import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetSecundumForSubtreeOperation; |
|
29 |
import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler; |
|
30 |
import eu.etaxonomy.taxeditor.ui.dialog.configurator.SetSecundumForSubtreeConfigurationDialog; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author k.luther |
|
34 |
* @date 10.02.2017 |
|
35 |
* |
|
36 |
*/ |
|
37 |
public class SetSecReferenceForSubtreeHandler extends RemotingCdmHandler { |
|
38 |
|
|
39 |
private static final Logger logger = Logger |
|
40 |
.getLogger(SetSecReferenceForSubtreeHandler.class); |
|
41 |
|
|
42 |
|
|
43 |
private ITaxonTreeNode taxonNode; |
|
44 |
private SetSecundumForSubtreeConfigurator configurator; |
|
45 |
|
|
46 |
/** |
|
47 |
* @param label |
|
48 |
*/ |
|
49 |
public SetSecReferenceForSubtreeHandler() { |
|
50 |
super(TaxonNavigatorLabels.CHANGE_SECUNDUM_FOR_SUBTREE); |
|
51 |
} |
|
52 |
/* (non-Javadoc) |
|
53 |
* @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent) |
|
54 |
*/ |
|
55 |
@Override |
|
56 |
public IStatus allowOperations(ExecutionEvent event) { |
|
57 |
TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event); |
|
58 |
// check that only a single taxon tree node has been selected |
|
59 |
if(selection.size() > 1) { } |
|
60 |
|
|
61 |
// check for no taxon tree node selected |
|
62 |
if(selection.size() == 0) { |
|
63 |
return new Status(IStatus.ERROR, |
|
64 |
"unknown", |
|
65 |
TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE); |
|
66 |
} |
|
67 |
|
|
68 |
// check that selected object is a taxon node |
|
69 |
Object obj = selection.iterator().next(); |
|
70 |
if(obj instanceof ITaxonTreeNode) { |
|
71 |
taxonNode = (ITaxonTreeNode)obj; |
|
72 |
} else { |
|
73 |
return new Status(IStatus.ERROR, |
|
74 |
"unknown", |
|
75 |
TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE); |
|
76 |
} |
|
77 |
|
|
78 |
|
|
79 |
// check if corresponding name editor is closed |
|
80 |
boolean editorClosed = NavigatorHandlerUtils.closeObsoleteEditor(event, (TaxonNode) taxonNode); |
|
81 |
if(editorClosed != true) { |
|
82 |
return new Status(IStatus.ERROR, |
|
83 |
"unknown", |
|
84 |
TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE); |
|
85 |
} |
|
86 |
|
|
87 |
configurator = new SetSecundumForSubtreeConfigurator(taxonNode.getUuid()); |
|
88 |
if(!SetSecundumForSubtreeConfigurationDialog.openConfirmWithConfigurator(configurator, HandlerUtil.getActiveShell(event), Messages.SetSecundumHandler_confirm, Messages.SetSecundumHandler_configureSettings)){ |
|
89 |
|
|
90 |
return Status.CANCEL_STATUS; |
|
91 |
} |
|
92 |
|
|
93 |
|
|
94 |
return Status.OK_STATUS; |
|
95 |
} |
|
96 |
/* (non-Javadoc) |
|
97 |
* @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#doOperations(org.eclipse.core.commands.ExecutionEvent) |
|
98 |
*/ |
|
99 |
@Override |
|
100 |
public AbstractOperation prepareOperation(ExecutionEvent event) { |
|
101 |
List<UUID> excludeTaxa = new ArrayList<UUID>(); |
|
102 |
excludeTaxa.add(((TaxonNode)taxonNode).getTaxon().getUuid()); |
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
SetSecundumForSubtreeOperation operation = |
|
108 |
new SetSecundumForSubtreeOperation(event.getTrigger(), |
|
109 |
false, |
|
110 |
taxonNode.getUuid(), |
|
111 |
configurator); |
|
112 |
|
|
113 |
return operation; |
|
114 |
} |
|
115 |
|
|
116 |
/* (non-Javadoc) |
|
117 |
* @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete(org.eclipse.core.commands.ExecutionEvent) |
|
118 |
*/ |
|
119 |
@Override |
|
120 |
public void onComplete() { |
|
121 |
// TODO Auto-generated method stub |
|
122 |
|
|
123 |
} |
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/SetSecundumForSubtreeOperation.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.navigation.navigator.operation; |
|
10 |
|
|
11 |
import java.util.UUID; |
|
12 |
|
|
13 |
import org.eclipse.core.runtime.IAdaptable; |
|
14 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
15 |
|
|
16 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
|
17 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action; |
|
18 |
import eu.etaxonomy.cdm.api.service.ITaxonNodeService; |
|
19 |
import eu.etaxonomy.cdm.api.service.UpdateResult; |
|
20 |
import eu.etaxonomy.cdm.api.service.config.SetSecundumForSubtreeConfigurator; |
|
21 |
import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; |
|
22 |
|
|
23 |
/** |
|
24 |
* @author k.luther |
|
25 |
* @date 10.02.2017 |
|
26 |
* |
|
27 |
*/ |
|
28 |
public class SetSecundumForSubtreeOperation extends RemotingCdmUpdateOperation{ |
|
29 |
|
|
30 |
private final static String LABEL = "Change secundum reference for all children"; |
|
31 |
|
|
32 |
UUID parentUuid; |
|
33 |
SetSecundumForSubtreeConfigurator config; |
|
34 |
|
|
35 |
/** |
|
36 |
* @param label |
|
37 |
* @param action |
|
38 |
* @param source |
|
39 |
* @param async |
|
40 |
*/ |
|
41 |
public SetSecundumForSubtreeOperation(Object source, |
|
42 |
boolean async, |
|
43 |
UUID taxonNodeUuid, |
|
44 |
SetSecundumForSubtreeConfigurator config) { |
|
45 |
super(LABEL, Action.Update, source, async); |
|
46 |
parentUuid = taxonNodeUuid; |
|
47 |
this.config = config; |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* {@inheritDoc} |
|
52 |
*/ |
|
53 |
@Override |
|
54 |
protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception { |
|
55 |
monitor.beginTask("Set secundum reference for subtree", 10); |
|
56 |
UpdateResult result = CdmApplicationState.getService(ITaxonNodeService.class).setSecundumForSubtree(config, null); |
|
57 |
monitor.done(); |
|
58 |
return result; |
|
59 |
} |
|
60 |
|
|
61 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/Messages.java | ||
---|---|---|
26 | 26 |
public static String SearchBar_7; |
27 | 27 |
public static String SearchBar_8; |
28 | 28 |
public static String SearchBar_9; |
29 |
|
|
29 | 30 |
static { |
30 | 31 |
// initialize resource bundle |
31 | 32 |
NLS.initializeMessages(BUNDLE_NAME, Messages.class); |
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages.properties | ||
---|---|---|
142 | 142 |
DeleteConfiguration_media_deleteIfUsedInSpecimenDescription=Delete also if media is used in specimen description |
143 | 143 |
DeleteConfiguration_media_delete=Delete the media completely |
144 | 144 |
|
145 |
NewGrantedAuthority_AlreadyInDb=The granted authority already exists. |
|
145 |
NewGrantedAuthority_AlreadyInDb=The granted authority already exists. |
|
146 |
|
|
147 |
SetSecundumConfiguration_IncludeAcceptedTaxa=include accepted taxa |
|
148 |
SetSecundumConfiguration_IncludeSynonyms=include synonyms |
|
149 |
SetSecundumConfiguration_OverwriteExistingAccepted=overwrite existing references for accepted taxa |
|
150 |
SetSecundumConfiguration_OverwriteExistingSynonyms=overwrite existing references for synonyms |
|
151 |
SetSecundumConfiguration_EmptySecundumDetail=empty existing details |
|
152 |
SetSecundumConfiguration_IncludeSharedtaxa=include shared taxa |
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages_de.properties | ||
---|---|---|
142 | 142 |
|
143 | 143 |
NewGrantedAuthority_AlreadyInDb=Die GrantedAuthority ist bereits in der DB enthalten. |
144 | 144 |
|
145 |
|
|
145 |
SetSecundumConfiguration_IncludeAcceptedTaxa=anwenden auf akzeptierten Taxa |
|
146 |
SetSecundumConfiguration_IncludeSynonyms=anwenden auf Synonyme |
|
147 |
SetSecundumConfiguration_OverwriteExistingAccepted=bestehende Secundum Referenzen bei akzeptierten Taxa ?berschreiben |
|
148 |
SetSecundumConfiguration_OverwriteExistingSynonyms=bestehende Secundum Referenzen bei Synonymen ?berschreiben |
|
149 |
SetSecundumConfiguration_EmptySecundumDetail=bestehende Details von Secundum Referenzen l?schen |
|
150 |
SetSecundumConfiguration_IncludeSharedtaxa=auch geteilte Taxa mit einbeziehen |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/Messages.java | ||
---|---|---|
150 | 150 |
public static String DeleteConfiguration_media_deleteIfUsedInSpecimenDescription; |
151 | 151 |
public static String DeleteConfiguration_media_delete; |
152 | 152 |
public static String NewGrantedAuthority_AlreadyInDb; |
153 |
static { |
|
153 |
|
|
154 |
public static String SetSecundumConfiguration_IncludeAcceptedTaxa; |
|
155 |
public static String SetSecundumConfiguration_IncludeSynonyms; |
|
156 |
public static String SetSecundumConfiguration_OverwriteExistingAccepted; |
|
157 |
public static String SetSecundumConfiguration_OverwriteExistingSynonyms; |
|
158 |
public static String SetSecundumConfiguration_EmptySecundumDetail; |
|
159 |
public static String SetSecundumConfiguration_IncludeSharedtaxa; |
|
160 |
|
|
161 |
static { |
|
154 | 162 |
// initialize resource bundle |
155 | 163 |
NLS.initializeMessages(BUNDLE_NAME, Messages.class); |
156 | 164 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/ConfiguratorComposite.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2015 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.ui.dialog.configurator; |
|
10 |
|
|
11 |
import org.eclipse.swt.SWT; |
|
12 |
import org.eclipse.swt.events.DisposeEvent; |
|
13 |
import org.eclipse.swt.events.DisposeListener; |
|
14 |
import org.eclipse.swt.layout.FillLayout; |
|
15 |
import org.eclipse.swt.widgets.Composite; |
|
16 |
import org.eclipse.swt.widgets.Display; |
|
17 |
import org.eclipse.ui.forms.events.ExpansionEvent; |
|
18 |
import org.eclipse.ui.forms.events.IExpansionListener; |
|
19 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
|
20 |
import org.eclipse.ui.forms.widgets.Section; |
|
21 |
|
|
22 |
/** |
|
23 |
* @author pplitzner |
|
24 |
* @date Feb 16, 2015 |
|
25 |
* |
|
26 |
*/ |
|
27 |
public class ConfiguratorComposite extends Composite implements IExpansionListener{ |
|
28 |
|
|
29 |
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent()); |
|
30 |
private final Section sctnConfigure; |
|
31 |
/** |
|
32 |
* Create the composite. |
|
33 |
* @param parent |
|
34 |
* @param style |
|
35 |
*/ |
|
36 |
public ConfiguratorComposite(final Composite parent, int style) { |
|
37 |
super(parent, SWT.NONE); |
|
38 |
|
|
39 |
addDisposeListener(new DisposeListener() { |
|
40 |
@Override |
|
41 |
public void widgetDisposed(DisposeEvent e) { |
|
42 |
toolkit.dispose(); |
|
43 |
} |
|
44 |
}); |
|
45 |
toolkit.paintBordersFor(this); |
|
46 |
setLayout(new FillLayout(SWT.HORIZONTAL)); |
|
47 |
|
|
48 |
sctnConfigure = toolkit.createSection(this, Section.CLIENT_INDENT | Section.TWISTIE); |
|
49 |
sctnConfigure.addExpansionListener(this); |
|
50 |
sctnConfigure.setBackground(getBackground()); |
|
51 |
toolkit.paintBordersFor(sctnConfigure); |
|
52 |
sctnConfigure.setText("Configure"); |
|
53 |
|
|
54 |
|
|
55 |
} |
|
56 |
|
|
57 |
|
|
58 |
public void addConfiguratorComposite(Composite configuratorComposite){ |
|
59 |
toolkit.paintBordersFor(configuratorComposite); |
|
60 |
sctnConfigure.setClient(configuratorComposite); |
|
61 |
} |
|
62 |
|
|
63 |
@Override |
|
64 |
public void expansionStateChanged(ExpansionEvent e) { |
|
65 |
getShell().setSize(getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT)); |
|
66 |
} |
|
67 |
@Override |
|
68 |
public void expansionStateChanging(ExpansionEvent e) { |
|
69 |
} |
|
70 |
public Section getSectionConfigure() { |
|
71 |
return sctnConfigure; |
|
72 |
} |
|
73 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetSecundumConfiguratorComposite.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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.configurator; |
|
10 |
|
|
11 |
import org.eclipse.core.databinding.DataBindingContext; |
|
12 |
import org.eclipse.core.databinding.beans.PojoProperties; |
|
13 |
import org.eclipse.core.databinding.observable.value.IObservableValue; |
|
14 |
import org.eclipse.jface.databinding.swt.WidgetProperties; |
|
15 |
import org.eclipse.swt.SWT; |
|
16 |
import org.eclipse.swt.events.DisposeEvent; |
|
17 |
import org.eclipse.swt.events.DisposeListener; |
|
18 |
import org.eclipse.swt.layout.GridLayout; |
|
19 |
import org.eclipse.swt.widgets.Button; |
|
20 |
import org.eclipse.swt.widgets.Composite; |
|
21 |
import org.eclipse.swt.widgets.Display; |
|
22 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
|
23 |
|
|
24 |
import eu.etaxonomy.cdm.api.service.config.SetSecundumForSubtreeConfigurator; |
|
25 |
import eu.etaxonomy.taxeditor.Messages; |
|
26 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
|
27 |
|
|
28 |
/** |
|
29 |
* @author k.luther |
|
30 |
* @date 10.02.2017 |
|
31 |
* |
|
32 |
*/ |
|
33 |
public class SetSecundumConfiguratorComposite extends Composite { |
|
34 |
private final DataBindingContext m_bindingContext; |
|
35 |
|
|
36 |
private final FormToolkit toolkit = new CdmFormFactory(Display.getCurrent()); |
|
37 |
private final SetSecundumForSubtreeConfigurator configurator; |
|
38 |
|
|
39 |
|
|
40 |
private final Button btnIncludeAcceptedTaxa; |
|
41 |
private final Button btnIncludeSynonyms; |
|
42 |
private final Button btnOverwriteExistingAccepted; |
|
43 |
private final Button btnOverwriteExistingSynonyms; |
|
44 |
private final Button btnEmptySecundumDetail; |
|
45 |
private final Button btnIncludeSharedTaxa; |
|
46 |
|
|
47 |
|
|
48 |
/** |
|
49 |
* Create the composite. |
|
50 |
* @param parent |
|
51 |
* @param style |
|
52 |
*/ |
|
53 |
public SetSecundumConfiguratorComposite(SetSecundumForSubtreeConfigurator configurator, Composite parent, int style ) { |
|
54 |
super(parent, style); |
|
55 |
this.configurator = configurator; |
|
56 |
|
|
57 |
addDisposeListener(new DisposeListener() { |
|
58 |
@Override |
|
59 |
public void widgetDisposed(DisposeEvent e) { |
|
60 |
toolkit.dispose(); |
|
61 |
} |
|
62 |
}); |
|
63 |
toolkit.paintBordersFor(this); |
|
64 |
setLayout(new GridLayout()); |
|
65 |
setBackground(getBackground()); |
|
66 |
|
|
67 |
|
|
68 |
btnIncludeAcceptedTaxa = new Button(this, SWT.CHECK); |
|
69 |
btnIncludeAcceptedTaxa.setText(Messages.SetSecundumConfiguration_IncludeAcceptedTaxa); |
|
70 |
btnIncludeAcceptedTaxa.setSelection(configurator.isIncludeAcceptedTaxa()); |
|
71 |
|
|
72 |
btnIncludeSynonyms = new Button(this, SWT.CHECK); |
|
73 |
btnIncludeSynonyms.setText(Messages.SetSecundumConfiguration_IncludeSynonyms); |
|
74 |
btnIncludeSynonyms.setSelection(configurator.isIncludeSynonyms()); |
|
75 |
btnOverwriteExistingAccepted = new Button(this, SWT.CHECK); |
|
76 |
btnOverwriteExistingAccepted.setText(Messages.SetSecundumConfiguration_OverwriteExistingAccepted); |
|
77 |
btnOverwriteExistingAccepted.setSelection(configurator.isOverwriteExistingAccepted()); |
|
78 |
btnOverwriteExistingSynonyms = new Button(this, SWT.CHECK); |
|
79 |
btnOverwriteExistingSynonyms.setText(Messages.SetSecundumConfiguration_OverwriteExistingSynonyms); |
|
80 |
btnOverwriteExistingSynonyms.setSelection(configurator.isOverwriteExistingSynonyms()); |
|
81 |
btnEmptySecundumDetail = new Button(this, SWT.CHECK); |
|
82 |
btnEmptySecundumDetail.setText(Messages.SetSecundumConfiguration_EmptySecundumDetail); |
|
83 |
btnEmptySecundumDetail.setSelection(configurator.isEmptySecundumDetail()); |
|
84 |
|
|
85 |
btnIncludeSharedTaxa = new Button(this, SWT.CHECK); |
|
86 |
btnIncludeSharedTaxa.setText(Messages.SetSecundumConfiguration_IncludeSharedtaxa); |
|
87 |
btnIncludeSharedTaxa.setSelection(configurator.isIncludeSharedTaxa()); |
|
88 |
|
|
89 |
m_bindingContext = initDataBindings(); |
|
90 |
|
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* @return |
|
95 |
*/ |
|
96 |
private DataBindingContext initDataBindings() { |
|
97 |
DataBindingContext bindingContext = new DataBindingContext(); |
|
98 |
// |
|
99 |
|
|
100 |
// private final Button btnIncludeAcceptedTaxa; |
|
101 |
// private final Button btnIncludeSynonyms; |
|
102 |
// private final Button btnOverwriteExistingAccepted; |
|
103 |
// private final Button btnOverwriteExistingSynonyms; |
|
104 |
// private final Button btnEmptySecundumDetail; |
|
105 |
// private final Button btnIncludeSharedTaxa; |
|
106 |
|
|
107 |
IObservableValue observeSelectionBtnIncludeAcceptedTaxa = WidgetProperties.selection().observe(btnIncludeAcceptedTaxa); |
|
108 |
IObservableValue includeAcceptedTaxaConfiguratorObserveValue = PojoProperties.value("includeAcceptedTaxa").observe(configurator); |
|
109 |
bindingContext.bindValue(observeSelectionBtnIncludeAcceptedTaxa, includeAcceptedTaxaConfiguratorObserveValue, null, null); |
|
110 |
|
|
111 |
IObservableValue observeSelectionBtnIncludeSynonyms = WidgetProperties.selection().observe(btnIncludeSynonyms); |
|
112 |
IObservableValue includeSynonymsConfiguratorObserveValue = PojoProperties.value("includeSynonyms").observe(configurator); |
|
113 |
bindingContext.bindValue(observeSelectionBtnIncludeSynonyms, includeSynonymsConfiguratorObserveValue, null, null); |
|
114 |
|
|
115 |
IObservableValue observeSelectionBtnOverwriteExistingAccepted = WidgetProperties.selection().observe(btnOverwriteExistingAccepted); |
|
116 |
IObservableValue overwriteExistingAcceptedConfiguratorObserveValue = PojoProperties.value("overwriteExistingAccepted").observe(configurator); |
|
117 |
bindingContext.bindValue(observeSelectionBtnOverwriteExistingAccepted, overwriteExistingAcceptedConfiguratorObserveValue, null, null); |
|
118 |
|
|
119 |
IObservableValue observeSelectionBtnOverwriteExistingSynonyms = WidgetProperties.selection().observe(btnOverwriteExistingSynonyms); |
|
120 |
IObservableValue overwriteExistingSynonymsConfiguratorObserveValue = PojoProperties.value("overwriteExistingSynonyms").observe(configurator); |
|
121 |
bindingContext.bindValue(observeSelectionBtnOverwriteExistingSynonyms, overwriteExistingSynonymsConfiguratorObserveValue, null, null); |
|
122 |
|
|
123 |
IObservableValue observeSelectionBtnEmptySecundumDetail = WidgetProperties.selection().observe(btnEmptySecundumDetail); |
|
124 |
IObservableValue emptySecundumDetailConfiguratorObserveValue = PojoProperties.value("emptySecundumDetail").observe(configurator); |
|
125 |
bindingContext.bindValue(observeSelectionBtnEmptySecundumDetail, emptySecundumDetailConfiguratorObserveValue, null, null); |
|
126 |
|
|
127 |
IObservableValue observeSelectionBtnIncludeSharedTaxal = WidgetProperties.selection().observe(btnIncludeSharedTaxa); |
|
128 |
IObservableValue includeSharedTaxaConfiguratorObserveValue = PojoProperties.value("includeSharedTaxa").observe(configurator); |
|
129 |
bindingContext.bindValue(observeSelectionBtnIncludeSharedTaxal, includeSharedTaxaConfiguratorObserveValue, null, null); |
|
130 |
return bindingContext; |
|
131 |
} |
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetSecundumForSubtreeConfigurationDialog.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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.configurator; |
|
10 |
|
|
11 |
import org.eclipse.jface.dialogs.IDialogConstants; |
|
12 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
13 |
import org.eclipse.swt.SWT; |
|
14 |
import org.eclipse.swt.graphics.Image; |
|
15 |
import org.eclipse.swt.layout.GridData; |
|
16 |
import org.eclipse.swt.layout.GridLayout; |
|
17 |
import org.eclipse.swt.widgets.Button; |
|
18 |
import org.eclipse.swt.widgets.Composite; |
|
19 |
import org.eclipse.swt.widgets.Control; |
|
20 |
import org.eclipse.swt.widgets.Event; |
|
21 |
import org.eclipse.swt.widgets.Label; |
|
22 |
import org.eclipse.swt.widgets.Listener; |
|
23 |
import org.eclipse.swt.widgets.Shell; |
|
24 |
import org.eclipse.swt.widgets.Text; |
|
25 |
import org.eclipse.wb.swt.ResourceManager; |
|
26 |
|
|
27 |
import eu.etaxonomy.cdm.api.service.config.SetSecundumForSubtreeConfigurator; |
|
28 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
29 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory; |
|
30 |
|
|
31 |
/** |
|
32 |
* @author k.luther |
|
33 |
* @date 10.02.2017 |
|
34 |
* |
|
35 |
*/ |
|
36 |
public class SetSecundumForSubtreeConfigurationDialog extends MessageDialog implements Listener{ |
|
37 |
|
|
38 |
Reference newSecRef; |
|
39 |
private final SetSecundumForSubtreeConfigurator configurator; |
|
40 |
private Button btnBrowseReference = null; |
|
41 |
private Text textReference = null; |
|
42 |
private Button btnClear = null; |
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
/** |
|
47 |
* @param parentShell |
|
48 |
* @param dialogTitle |
|
49 |
* @param dialogTitleImage |
|
50 |
* @param dialogMessage |
|
51 |
* @param dialogImageType |
|
52 |
* @param dialogButtonLabels |
|
53 |
* @param defaultIndex |
|
54 |
* @param config |
|
55 |
*/ |
|
56 |
public SetSecundumForSubtreeConfigurationDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, |
|
57 |
String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex, SetSecundumForSubtreeConfigurator config) { |
|
58 |
super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex); |
|
59 |
this.configurator = config; |
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
} |
|
64 |
|
|
65 |
@Override |
|
66 |
protected Control createCustomArea(Composite parent) { |
|
67 |
final Composite composite = new Composite(parent, SWT.NULL); |
|
68 |
|
|
69 |
GridLayout gridLayout = new GridLayout(); |
|
70 |
gridLayout.numColumns = 1; |
|
71 |
composite.setLayout(gridLayout); |
|
72 |
final Composite compositeRef = new Composite(composite, SWT.NULL); |
|
73 |
|
|
74 |
GridLayout gridLayoutRef = new GridLayout(); |
|
75 |
gridLayoutRef.numColumns = 4; |
|
76 |
|
|
77 |
compositeRef.setLayout(gridLayoutRef); |
|
78 |
compositeRef.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true)); |
|
79 |
Label label = new Label(compositeRef, SWT.NONE); |
|
80 |
label.setText("New secundum reference"); |
|
81 |
//label.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); |
|
82 |
|
|
83 |
textReference = new Text(compositeRef, SWT.BORDER); |
|
84 |
textReference.setEditable(false); |
|
85 |
textReference.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
|
86 |
textReference.setTextLimit(Text.LIMIT); |
|
87 |
|
|
88 |
btnBrowseReference = new Button(compositeRef, SWT.NONE); |
|
89 |
btnBrowseReference.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif")); |
|
90 |
btnBrowseReference.addListener(SWT.Selection, this); |
|
91 |
btnClear = new Button(compositeRef, SWT.NONE); |
|
92 |
btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif")); |
|
93 |
btnClear.addListener(SWT.Selection, this); |
|
94 |
ConfiguratorComposite compositeConfigure = new ConfiguratorComposite(composite, NONE); |
|
95 |
|
|
96 |
compositeConfigure.addConfiguratorComposite(new SetSecundumConfiguratorComposite(configurator, compositeConfigure.getSectionConfigure(), SWT.NONE)); |
|
97 |
return composite; |
|
98 |
|
|
99 |
} |
|
100 |
|
|
101 |
/** |
|
102 |
* @param configurator |
|
103 |
* @param activeShell |
|
104 |
* @param setSecundumHandler_confirm |
|
105 |
* @param setSecundumHandler_configureSettings |
|
106 |
* @return |
|
107 |
*/ |
|
108 |
public static boolean openConfirmWithConfigurator(SetSecundumForSubtreeConfigurator configurator, Shell parent, String title, String message) { |
|
109 |
|
|
110 |
SetSecundumForSubtreeConfigurationDialog dialog = new SetSecundumForSubtreeConfigurationDialog(parent, title, getDefaultImage(), message, QUESTION, getButtonLabels(QUESTION), 0, configurator); |
|
111 |
|
|
112 |
return dialog.open() == 0; |
|
113 |
} |
|
114 |
|
|
115 |
|
|
116 |
protected static String[] getButtonLabels(int kind) { |
|
117 |
String[] dialogButtonLabels; |
|
118 |
switch (kind) { |
|
119 |
case ERROR: |
|
120 |
case INFORMATION: |
|
121 |
case WARNING: { |
|
122 |
dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL }; |
|
123 |
break; |
|
124 |
} |
|
125 |
case CONFIRM: { |
|
126 |
dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, |
|
127 |
IDialogConstants.CANCEL_LABEL }; |
|
128 |
break; |
|
129 |
} |
|
130 |
case QUESTION: { |
|
131 |
dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, |
|
132 |
IDialogConstants.NO_LABEL }; |
|
133 |
break; |
|
134 |
} |
|
135 |
case QUESTION_WITH_CANCEL: { |
|
136 |
dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, |
|
137 |
IDialogConstants.NO_LABEL, |
|
138 |
IDialogConstants.CANCEL_LABEL }; |
|
139 |
break; |
|
140 |
} |
|
141 |
default: { |
|
142 |
throw new IllegalArgumentException( |
|
143 |
"Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$ |
|
144 |
} |
|
145 |
} |
|
146 |
return dialogButtonLabels; |
|
147 |
} |
|
148 |
|
|
149 |
/** |
|
150 |
* {@inheritDoc} |
|
151 |
*/ |
|
152 |
@Override |
|
153 |
public void handleEvent(Event event) { |
|
154 |
Reference reference; |
|
155 |
if(event.widget==btnBrowseReference){ |
|
156 |
reference = SelectionDialogFactory.getSelectionFromDialog(Reference.class, this.getShell(), null, null); |
|
157 |
if(reference!=null){ |
|
158 |
this.configurator.setNewSecundum(reference); |
|
159 |
textReference.setText(reference.getTitleCache()); |
|
160 |
} |
|
161 |
|
|
162 |
} |
|
163 |
else if(event.widget==btnClear){ |
|
164 |
reference = null; |
|
165 |
textReference.setText(""); |
|
166 |
this.configurator.setNewSecundum(null); |
|
167 |
} |
|
168 |
|
|
169 |
} |
|
170 |
|
|
171 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/ConfiguratorComposite.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2015 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator; |
|
10 |
|
|
11 |
import org.eclipse.swt.SWT; |
|
12 |
import org.eclipse.swt.events.DisposeEvent; |
|
13 |
import org.eclipse.swt.events.DisposeListener; |
|
14 |
import org.eclipse.swt.layout.FillLayout; |
|
15 |
import org.eclipse.swt.widgets.Composite; |
|
16 |
import org.eclipse.swt.widgets.Display; |
|
17 |
import org.eclipse.ui.forms.events.ExpansionEvent; |
|
18 |
import org.eclipse.ui.forms.events.IExpansionListener; |
|
19 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
|
20 |
import org.eclipse.ui.forms.widgets.Section; |
|
21 |
|
|
22 |
/** |
|
23 |
* @author pplitzner |
|
24 |
* @date Feb 16, 2015 |
|
25 |
* |
|
26 |
*/ |
|
27 |
public class ConfiguratorComposite extends Composite implements IExpansionListener{ |
|
28 |
|
|
29 |
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent()); |
|
30 |
private final Section sctnConfigure; |
|
31 |
/** |
|
32 |
* Create the composite. |
|
33 |
* @param parent |
|
34 |
* @param style |
|
35 |
*/ |
|
36 |
public ConfiguratorComposite(final Composite parent, int style) { |
|
37 |
super(parent, SWT.NONE); |
|
38 |
|
|
39 |
addDisposeListener(new DisposeListener() { |
|
40 |
@Override |
|
41 |
public void widgetDisposed(DisposeEvent e) { |
|
42 |
toolkit.dispose(); |
|
43 |
} |
|
44 |
}); |
|
45 |
toolkit.paintBordersFor(this); |
|
46 |
setLayout(new FillLayout(SWT.HORIZONTAL)); |
|
47 |
|
|
48 |
sctnConfigure = toolkit.createSection(this, Section.CLIENT_INDENT | Section.TWISTIE); |
|
49 |
sctnConfigure.addExpansionListener(this); |
|
50 |
sctnConfigure.setBackground(getBackground()); |
|
51 |
toolkit.paintBordersFor(sctnConfigure); |
|
52 |
sctnConfigure.setText("Configure"); |
|
53 |
|
|
54 |
|
|
55 |
} |
|
56 |
|
|
57 |
|
|
58 |
public void addConfiguratorComposite(Composite configuratorComposite){ |
|
59 |
toolkit.paintBordersFor(configuratorComposite); |
|
60 |
sctnConfigure.setClient(configuratorComposite); |
|
61 |
} |
|
62 |
|
|
63 |
@Override |
|
64 |
public void expansionStateChanged(ExpansionEvent e) { |
|
65 |
getShell().setSize(getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT)); |
|
66 |
} |
|
67 |
@Override |
|
68 |
public void expansionStateChanging(ExpansionEvent e) { |
|
69 |
} |
|
70 |
public Section getSectionConfigure() { |
|
71 |
return sctnConfigure; |
|
72 |
} |
|
73 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteConfiguratorDialog.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2015 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator; |
|
10 |
|
|
11 |
import org.eclipse.jface.dialogs.IDialogConstants; |
|
12 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
13 |
import org.eclipse.swt.SWT; |
|
14 |
import org.eclipse.swt.graphics.Image; |
|
15 |
import org.eclipse.swt.widgets.Composite; |
|
16 |
import org.eclipse.swt.widgets.Control; |
|
17 |
import org.eclipse.swt.widgets.Shell; |
|
18 |
|
|
19 |
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase; |
|
20 |
import eu.etaxonomy.cdm.api.service.config.MediaDeletionConfigurator; |
|
21 |
import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator; |
|
22 |
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator; |
|
23 |
import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator; |
|
24 |
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; |
|
25 |
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator; |
|
26 |
|
|
27 |
/** |
|
28 |
* Abstract subclass of MessageDialog providing the functionality to configure |
|
29 |
* a {@link DeleteConfiguratorBase} |
|
30 |
* @author pplitzner |
|
31 |
* @date Jan 28, 2015 |
|
32 |
* |
|
33 |
*/ |
|
34 |
public class DeleteConfiguratorDialog extends MessageDialog{ |
|
35 |
|
|
36 |
private final DeleteConfiguratorBase configurator; |
|
37 |
private final boolean fromBulkEditor; |
|
38 |
|
|
39 |
public DeleteConfiguratorDialog(DeleteConfiguratorBase configurator, Shell parentShell, String dialogTitle, |
|
40 |
Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex, boolean fromBulkEditor) { |
|
41 |
super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex); |
|
42 |
this.configurator = configurator; |
|
43 |
this.fromBulkEditor = fromBulkEditor; |
|
44 |
} |
|
45 |
|
|
46 |
public DeleteConfiguratorDialog(DeleteConfiguratorBase configurator, Shell parentShell, String dialogTitle, |
|
47 |
Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) { |
|
48 |
super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex); |
|
49 |
this.configurator = configurator; |
|
50 |
this.fromBulkEditor = false; |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
protected Control createCustomArea(Composite parent) { |
|
55 |
ConfiguratorComposite composite = new ConfiguratorComposite(parent, NONE); |
|
56 |
if(configurator instanceof TaxonDeletionConfigurator){ |
|
57 |
composite.addConfiguratorComposite(new DeleteTaxonConfiguratorComposite((TaxonDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE)); |
|
58 |
}else if (configurator instanceof SynonymDeletionConfigurator){ |
|
59 |
composite.addConfiguratorComposite(new DeleteTaxonBaseConfiguratorComposite((SynonymDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE)); |
|
60 |
}else if(configurator instanceof SpecimenDeleteConfigurator){ |
|
61 |
composite.addConfiguratorComposite(new DeleteSpecimenConfiguratorComposite((SpecimenDeleteConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE)); |
|
62 |
} else if(configurator instanceof TaxonNodeDeletionConfigurator){ |
|
63 |
composite.addConfiguratorComposite(new DeleteNodeConfiguratorComposite((TaxonNodeDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE)); |
|
64 |
} else if(configurator instanceof NameDeletionConfigurator){ |
|
65 |
composite.addConfiguratorComposite(new DeleteNameConfiguratorComposite((NameDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE)); |
|
66 |
} else if(configurator instanceof MediaDeletionConfigurator){ |
|
67 |
if (!fromBulkEditor){ |
|
68 |
composite.addConfiguratorComposite(new DeleteMediaConfiguratorComposite((MediaDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE, fromBulkEditor)); |
|
69 |
}else{ |
|
70 |
composite.addConfiguratorComposite(new DeleteMediaConfiguratorComposite((MediaDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE)); |
|
71 |
} |
|
72 |
} |
|
73 |
|
|
74 |
|
|
75 |
return composite; |
|
76 |
} |
|
77 |
|
|
78 |
public static boolean openConfirmWithConfigurator(DeleteConfiguratorBase configurator, Shell parent, String title, String message) { |
|
79 |
DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(configurator, parent, title, getDefaultImage(), message, QUESTION, getButtonLabels(QUESTION), 0); |
|
80 |
return dialog.open() == 0; |
|
81 |
} |
|
82 |
|
|
83 |
@Override |
|
84 |
protected boolean isResizable() { |
|
85 |
return true; |
|
86 |
} |
|
87 |
|
|
88 |
|
|
89 |
protected static String[] getButtonLabels(int kind) { |
|
90 |
String[] dialogButtonLabels; |
|
91 |
switch (kind) { |
|
92 |
case ERROR: |
|
93 |
case INFORMATION: |
|
94 |
case WARNING: { |
|
95 |
dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL }; |
|
96 |
break; |
|
97 |
} |
|
98 |
case CONFIRM: { |
|
99 |
dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, |
|
100 |
IDialogConstants.CANCEL_LABEL }; |
|
101 |
break; |
|
102 |
} |
|
103 |
case QUESTION: { |
|
104 |
dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, |
|
105 |
IDialogConstants.NO_LABEL }; |
|
106 |
break; |
|
107 |
} |
|
108 |
case QUESTION_WITH_CANCEL: { |
|
109 |
dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, |
|
110 |
IDialogConstants.NO_LABEL, |
|
111 |
IDialogConstants.CANCEL_LABEL }; |
|
112 |
break; |
|
113 |
} |
|
114 |
default: { |
|
115 |
throw new IllegalArgumentException( |
|
116 |
"Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$ |
|
117 |
} |
|
118 |
} |
|
119 |
return dialogButtonLabels; |
|
120 |
} |
|
121 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteMediaConfiguratorComposite.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2016 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.configurator.deleteConfigurator; |
|
10 |
|
|
11 |
import org.eclipse.core.databinding.DataBindingContext; |
|
12 |
import org.eclipse.core.databinding.beans.PojoProperties; |
|
13 |
import org.eclipse.core.databinding.observable.value.IObservableValue; |
|
14 |
import org.eclipse.jface.databinding.swt.WidgetProperties; |
|
15 |
import org.eclipse.swt.SWT; |
|
16 |
import org.eclipse.swt.events.DisposeEvent; |
|
17 |
import org.eclipse.swt.events.DisposeListener; |
|
18 |
import org.eclipse.swt.layout.GridData; |
|
19 |
import org.eclipse.swt.layout.GridLayout; |
|
20 |
import org.eclipse.swt.layout.RowLayout; |
|
21 |
import org.eclipse.swt.widgets.Button; |
|
22 |
import org.eclipse.swt.widgets.Composite; |
|
23 |
import org.eclipse.swt.widgets.Display; |
|
24 |
import org.eclipse.swt.widgets.Event; |
|
25 |
import org.eclipse.swt.widgets.Listener; |
|
26 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
|
27 |
|
|
28 |
import eu.etaxonomy.cdm.api.service.config.MediaDeletionConfigurator; |
|
29 |
import eu.etaxonomy.taxeditor.Messages; |
|
30 |
|
|
31 |
/** |
|
32 |
* @author k.luther |
|
33 |
* @date 02.11.2016 |
|
34 |
* |
|
35 |
*/ |
|
36 |
public class DeleteMediaConfiguratorComposite extends Composite { |
|
37 |
private final DataBindingContext m_bindingContext; |
|
38 |
|
|
39 |
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent()); |
|
40 |
private final MediaDeletionConfigurator configurator; |
|
41 |
private final Button btnDeleteIfUsedInTaxonDescription; |
|
42 |
private final Button btnDeleteIfUsedInSpecimenDescription; |
|
43 |
private final Button btnRemoveFromImageGallery; |
|
44 |
private final boolean isInBulkEditor; |
|
45 |
|
|
46 |
|
|
47 |
/** |
|
48 |
* Create the composite. |
|
49 |
* @param parent |
|
50 |
* @param style |
|
51 |
*/ |
|
52 |
public DeleteMediaConfiguratorComposite(MediaDeletionConfigurator configurator, Composite parent, int style) { |
|
53 |
super(parent, style); |
|
54 |
this.configurator = configurator; |
|
55 |
this.isInBulkEditor = false; |
|
56 |
addDisposeListener(new DisposeListener() { |
|
57 |
@Override |
|
58 |
public void widgetDisposed(DisposeEvent e) { |
|
59 |
toolkit.dispose(); |
|
60 |
} |
|
61 |
}); |
|
62 |
toolkit.paintBordersFor(this); |
|
63 |
setLayout(new RowLayout(SWT.VERTICAL)); |
|
64 |
setBackground(getBackground()); |
|
65 |
|
|
66 |
btnRemoveFromImageGallery = null; |
|
67 |
|
|
68 |
btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.CHECK); |
|
69 |
btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInTaxonDescription); |
|
70 |
btnDeleteIfUsedInTaxonDescription.setSelection(false); |
|
71 |
|
|
72 |
btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK); |
|
73 |
btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription); |
|
74 |
btnDeleteIfUsedInSpecimenDescription.setSelection(false); |
|
75 |
|
|
76 |
|
|
77 |
m_bindingContext = initDataBindings(); |
|
78 |
|
|
79 |
} |
|
80 |
|
|
81 |
public DeleteMediaConfiguratorComposite(MediaDeletionConfigurator configurator, Composite parent, int style, boolean inBulkEditor) { |
|
82 |
super(parent, style); |
|
83 |
this.configurator = configurator; |
|
84 |
this.isInBulkEditor = inBulkEditor; |
|
85 |
addDisposeListener(new DisposeListener() { |
|
86 |
@Override |
|
87 |
public void widgetDisposed(DisposeEvent e) { |
|
88 |
toolkit.dispose(); |
|
89 |
} |
|
90 |
}); |
|
91 |
toolkit.paintBordersFor(this); |
|
92 |
setLayout(new GridLayout()); |
|
93 |
setBackground(getBackground()); |
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
if (!inBulkEditor){ |
|
99 |
btnRemoveFromImageGallery = new Button(this, SWT.RADIO); |
|
100 |
btnRemoveFromImageGallery.setText(Messages.DeleteConfiguration_media_removeFromGallery); |
|
101 |
|
|
102 |
btnRemoveFromImageGallery.setSelection(true); |
|
103 |
btnRemoveFromImageGallery.setVisible(true); |
|
104 |
btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.RADIO); |
|
105 |
btnDeleteIfUsedInTaxonDescription.setSelection(false); |
|
106 |
btnDeleteIfUsedInTaxonDescription.setVisible(true); |
|
107 |
btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_delete); |
|
108 |
btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK); |
|
109 |
btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription); |
|
110 |
btnDeleteIfUsedInSpecimenDescription.setVisible(false); |
|
111 |
btnDeleteIfUsedInTaxonDescription.addListener(SWT.Selection, new Listener() { |
|
112 |
@Override |
|
113 |
public void handleEvent(Event e) { |
|
114 |
Button b = (Button) e.widget; |
|
115 |
GridData data = (GridData) btnDeleteIfUsedInTaxonDescription.getLayoutData(); |
|
116 |
data.exclude = b.getSelection(); |
|
117 |
btnDeleteIfUsedInSpecimenDescription.setVisible(data.exclude); |
|
118 |
|
|
119 |
} |
|
120 |
}); |
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
} else{ |
|
126 |
btnRemoveFromImageGallery =null; |
|
127 |
btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.CHECK); |
|
128 |
btnDeleteIfUsedInTaxonDescription.setSelection(false); |
|
129 |
btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInTaxonDescription); |
|
130 |
btnDeleteIfUsedInTaxonDescription.setVisible(true); |
|
131 |
|
|
132 |
btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK); |
|
133 |
btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription); |
|
134 |
btnDeleteIfUsedInSpecimenDescription.setVisible(true); |
|
135 |
} |
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
m_bindingContext = initDataBindings(); |
|
144 |
|
|
145 |
} |
|
146 |
|
|
147 |
protected DataBindingContext initDataBindings() { |
|
148 |
DataBindingContext bindingContext = new DataBindingContext(); |
|
149 |
// |
|
150 |
IObservableValue observeSelectionBtnDeleteIfUsedInTaxonDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInTaxonDescription); |
|
151 |
IObservableValue deleteIfUsedInTaxonDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInTaxonDescription").observe(configurator); |
|
152 |
bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInTaxonDescription, deleteIfUsedInTaxonDescriptionConfiguratorObserveValue, null, null); |
|
153 |
if (isInBulkEditor){ |
|
154 |
IObservableValue observeSelectionBtnDeleteIfUsedInSpecimenDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInSpecimenDescription); |
|
155 |
IObservableValue deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInSpecimenDescription").observe(configurator); |
|
156 |
bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInSpecimenDescription, deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue, null, null); |
|
157 |
}else{ |
|
158 |
IObservableValue observeSelectionBtnRemoveFromImageGallery = WidgetProperties.selection().observe(btnRemoveFromImageGallery); |
|
159 |
IObservableValue removeFromImageGalleryConfiguratorObserveValue = PojoProperties.value("onlyRemoveFromGallery").observe(configurator); |
|
160 |
bindingContext.bindValue(observeSelectionBtnRemoveFromImageGallery, removeFromImageGalleryConfiguratorObserveValue, null, null); |
|
161 |
|
|
162 |
IObservableValue observeSelectionBtnDeleteIfUsedInSpecimenDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInSpecimenDescription); |
|
163 |
IObservableValue deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInSpecimenDescription").observe(configurator); |
|
164 |
bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInSpecimenDescription, deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue, null, null); |
|
165 |
} |
|
166 |
|
|
167 |
return bindingContext; |
|
168 |
} |
|
169 |
|
|
170 |
|
|
171 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteNameConfiguratorComposite.java | ||
---|---|---|
1 |
package eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator; |
|
2 |
|
|
3 |
import org.eclipse.core.databinding.DataBindingContext; |
|
4 |
import org.eclipse.core.databinding.beans.PojoProperties; |
|
5 |
import org.eclipse.core.databinding.observable.value.IObservableValue; |
|
6 |
import org.eclipse.jface.databinding.swt.WidgetProperties; |
|
7 |
import org.eclipse.swt.SWT; |
|
8 |
import org.eclipse.swt.events.DisposeEvent; |
|
9 |
import org.eclipse.swt.events.DisposeListener; |
|
10 |
import org.eclipse.swt.layout.RowLayout; |
|
11 |
import org.eclipse.swt.widgets.Button; |
|
12 |
import org.eclipse.swt.widgets.Combo; |
|
13 |
import org.eclipse.swt.widgets.Composite; |
|
14 |
import org.eclipse.swt.widgets.Display; |
|
15 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
|
16 |
|
|
17 |
import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator; |
|
18 |
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; |
|
19 |
/** |
|
20 |
* @author kluther |
|
21 |
* @date Nov 2, 2015 |
|
22 |
* |
|
23 |
*/ |
|
24 |
public class DeleteNameConfiguratorComposite extends Composite { |
|
25 |
private final DataBindingContext m_bindingContext; |
|
26 |
|
|
27 |
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent()); |
|
28 |
private final NameDeletionConfigurator configurator; |
|
29 |
private final Button btnRemoveAllNameRelationships; |
|
30 |
private final Button btnIgnoreIsBasionym; |
|
31 |
private final Button btnIgnoreIsReplacedSynonymFor; |
|
32 |
private final Button btnIgnoreHasBasionym; |
|
33 |
private final Button btnIgnoreHasReplacedSynonym; |
|
34 |
private final Button btnRemoveAllTypeDesignations; |
|
35 |
|
|
36 |
/* |
|
37 |
* private boolean removeAllNameRelationships = false; |
|
38 |
|
|
39 |
private boolean ignoreIsBasionymFor = false; |
|
40 |
|
|
41 |
private boolean ignoreIsReplacedSynonymFor = false; |
|
42 |
|
|
43 |
private boolean ignoreHasBasionym = true; |
|
44 |
|
|
45 |
private boolean ignoreHasReplacedSynonym = true; |
|
46 |
|
|
47 |
private boolean removeAllNameTypeDesignations = true; |
|
48 |
*/ |
|
49 |
|
|
50 |
|
|
51 |
/** |
|
52 |
* Create the composite. |
|
53 |
* @param parent |
|
54 |
* @param style |
|
55 |
*/ |
|
56 |
public DeleteNameConfiguratorComposite(NameDeletionConfigurator configurator, Composite parent, int style) { |
|
57 |
super(parent, style); |
|
58 |
this.configurator = configurator; |
|
59 |
addDisposeListener(new DisposeListener() { |
|
60 |
@Override |
|
61 |
public void widgetDisposed(DisposeEvent e) { |
|
62 |
toolkit.dispose(); |
|
63 |
} |
|
64 |
}); |
|
65 |
toolkit.paintBordersFor(this); |
|
66 |
setLayout(new RowLayout(SWT.VERTICAL)); |
|
67 |
setBackground(getBackground()); |
|
68 |
|
|
69 |
btnRemoveAllNameRelationships = new Button(this, SWT.CHECK); |
|
70 |
btnRemoveAllNameRelationships.setText("Remove all Name Relationships"); |
|
71 |
btnRemoveAllNameRelationships.setSelection(true); |
|
72 |
|
|
73 |
btnIgnoreIsBasionym = new Button(this, SWT.CHECK); |
|
74 |
btnIgnoreIsBasionym.setText("Ignore is Basionym"); |
|
75 |
btnIgnoreIsBasionym.setSelection(true); |
|
76 |
|
|
77 |
btnIgnoreIsReplacedSynonymFor = new Button(this, SWT.CHECK); |
|
78 |
btnIgnoreIsReplacedSynonymFor.setText("Ignore is Replaced Synonym"); |
|
79 |
btnIgnoreIsReplacedSynonymFor.setSelection(true); |
|
80 |
|
|
81 |
btnIgnoreHasBasionym = new Button(this, SWT.CHECK); |
|
82 |
btnIgnoreHasBasionym.setText("Ignore has Basionym"); |
|
83 |
btnIgnoreHasBasionym.setSelection(true); |
|
84 |
|
|
85 |
btnIgnoreHasReplacedSynonym = new Button(this, SWT.CHECK); |
|
86 |
btnIgnoreHasReplacedSynonym.setText("Ignore has Replaced Synonym"); |
|
87 |
btnIgnoreHasReplacedSynonym.setSelection(true); |
|
88 |
|
|
89 |
btnRemoveAllTypeDesignations = new Button(this, SWT.CHECK); |
|
90 |
btnRemoveAllTypeDesignations.setText("Remove all Type Designations"); |
|
91 |
btnRemoveAllTypeDesignations.setSelection(true); |
|
92 |
|
|
93 |
m_bindingContext = initDataBindings(); |
|
94 |
|
|
95 |
} |
|
96 |
|
|
97 |
protected DataBindingContext initDataBindings() { |
|
98 |
DataBindingContext bindingContext = new DataBindingContext(); |
|
99 |
// |
|
100 |
IObservableValue observeSelectionBtnRemoveAllNameRelationshipsWidget = WidgetProperties.selection().observe(btnRemoveAllNameRelationships); |
|
101 |
IObservableValue removeAllNameRelationshipsConfiguratorObserveValue = PojoProperties.value("removeAllNameRelationships").observe(configurator); |
|
102 |
bindingContext.bindValue(observeSelectionBtnRemoveAllNameRelationshipsWidget, removeAllNameRelationshipsConfiguratorObserveValue, null, null); |
|
103 |
|
|
104 |
IObservableValue observeSelectionBtnbtnIgnoreIsBasionymObserveWidget = WidgetProperties.selection().observe(btnIgnoreIsBasionym); |
|
105 |
IObservableValue ignoreIsBasionymConfiguratorObserveValue = PojoProperties.value("ignoreIsBasionymFor").observe(configurator); |
|
106 |
bindingContext.bindValue(observeSelectionBtnbtnIgnoreIsBasionymObserveWidget, ignoreIsBasionymConfiguratorObserveValue, null, null); |
|
107 |
|
|
108 |
IObservableValue observeSelectionBtnIgnoreIsReplacedSynonymForWidget = WidgetProperties.selection().observe(btnIgnoreIsReplacedSynonymFor); |
|
109 |
IObservableValue ignoreIsReplacedSynonymForConfiguratorObserveValue = PojoProperties.value("ignoreIsReplacedSynonymFor").observe(configurator); |
|
110 |
bindingContext.bindValue(observeSelectionBtnIgnoreIsReplacedSynonymForWidget, ignoreIsReplacedSynonymForConfiguratorObserveValue, null, null); |
|
111 |
|
|
112 |
IObservableValue observeSelectionBtnIgnoreHasBasionymWidget = WidgetProperties.selection().observe(btnIgnoreHasBasionym); |
|
113 |
IObservableValue ignoreHasBasionymConfiguratorObserveValue = PojoProperties.value("ignoreHasBasionym").observe(configurator); |
|
114 |
bindingContext.bindValue(observeSelectionBtnIgnoreHasBasionymWidget, ignoreHasBasionymConfiguratorObserveValue, null, null); |
|
115 |
|
|
116 |
IObservableValue observeSelectionBtnIgnoreHasReplacedSynonymWidget = WidgetProperties.selection().observe(btnIgnoreHasReplacedSynonym); |
|
117 |
IObservableValue ignoreHasReplacedSynonymConfiguratorObserveValue = PojoProperties.value("ignoreHasReplacedSynonym").observe(configurator); |
|
118 |
bindingContext.bindValue(observeSelectionBtnIgnoreHasReplacedSynonymWidget, ignoreHasReplacedSynonymConfiguratorObserveValue, null, null); |
|
119 |
|
|
120 |
IObservableValue observeSelectionBtnRemoveAllTypeDesignationsWidget = WidgetProperties.selection().observe(btnRemoveAllTypeDesignations); |
|
121 |
IObservableValue removeAllNameTypeDesignationsConfiguratorObserveValue = PojoProperties.value("removeAllNameTypeDesignations").observe(configurator); |
|
122 |
bindingContext.bindValue(observeSelectionBtnRemoveAllTypeDesignationsWidget, removeAllNameTypeDesignationsConfiguratorObserveValue, null, null); |
|
123 |
|
|
124 |
// |
|
125 |
return bindingContext; |
|
126 |
} |
|
127 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteNodeConfiguratorComposite.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2015 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator; |
|
11 |
|
|
12 |
import org.eclipse.core.databinding.DataBindingContext; |
|
13 |
import org.eclipse.core.databinding.beans.PojoProperties; |
|
14 |
import org.eclipse.core.databinding.observable.value.IObservableValue; |
|
15 |
import org.eclipse.jface.databinding.swt.WidgetProperties; |
|
16 |
import org.eclipse.swt.SWT; |
|
17 |
import org.eclipse.swt.widgets.Button; |
|
18 |
import org.eclipse.swt.widgets.Composite; |
|
19 |
import org.eclipse.swt.widgets.Display; |
|
20 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
|
21 |
import org.eclipse.swt.events.DisposeEvent; |
|
22 |
import org.eclipse.swt.events.DisposeListener; |
|
23 |
import org.eclipse.swt.layout.RowLayout; |
|
24 |
|
|
25 |
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; |
|
26 |
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator; |
|
27 |
/** |
|
28 |
* @author kluther |
|
29 |
* @date Jul 13, 2015 |
|
30 |
* |
|
31 |
*/ |
|
32 |
public class DeleteNodeConfiguratorComposite extends Composite { |
|
33 |
// $Id$ |
|
34 |
|
|
35 |
private final DataBindingContext m_bindingContext; |
|
36 |
|
|
37 |
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent()); |
|
38 |
private final TaxonNodeDeletionConfigurator configurator; |
|
39 |
private final Button btnDeleteTaxon; |
|
40 |
|
|
41 |
|
|
42 |
/** |
|
43 |
* Create the composite. |
|
44 |
* @param parent |
|
45 |
* @param style |
|
46 |
*/ |
|
47 |
public DeleteNodeConfiguratorComposite(TaxonNodeDeletionConfigurator configurator, Composite parent, int style) { |
|
48 |
super(parent, style); |
|
49 |
this.configurator = configurator; |
|
50 |
addDisposeListener(new DisposeListener() { |
|
51 |
@Override |
|
52 |
public void widgetDisposed(DisposeEvent e) { |
|
53 |
toolkit.dispose(); |
|
54 |
} |
|
55 |
}); |
|
56 |
toolkit.paintBordersFor(this); |
|
57 |
setLayout(new RowLayout(SWT.VERTICAL)); |
|
58 |
setBackground(getBackground()); |
|
59 |
|
|
60 |
btnDeleteTaxon = new Button(this, SWT.CHECK); |
|
61 |
btnDeleteTaxon.setText("Delete taxon if possible"); |
|
62 |
|
|
63 |
m_bindingContext = initDataBindings(); |
|
64 |
|
|
65 |
} |
|
66 |
|
|
67 |
protected DataBindingContext initDataBindings() { |
|
68 |
DataBindingContext bindingContext = new DataBindingContext(); |
|
69 |
// |
|
70 |
IObservableValue observeSelectionBtnDeleteTaxonObserveWidget = WidgetProperties.selection().observe(btnDeleteTaxon); |
|
71 |
IObservableValue deleteTaxonIfPossibleConfiguratorObserveValue = PojoProperties.value("deleteTaxon").observe(configurator); |
|
72 |
bindingContext.bindValue(observeSelectionBtnDeleteTaxonObserveWidget, deleteTaxonIfPossibleConfiguratorObserveValue, null, null); |
|
73 |
// |
|
74 |
return bindingContext; |
|
75 |
} |
|
76 |
} |
|
77 |
|
|
78 |
|
Also available in: Unified diff
ref #6315: implement set secundum reference for subtree in editor