Revision 708e6614
Added by Niels Hoffmann almost 13 years ago
.gitattributes | ||
---|---|---|
806 | 806 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/TextHelper.java -text |
807 | 807 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/TimeHelper.java -text |
808 | 808 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AbstractNewEntityWizard.java -text |
809 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/ClassificationWizardPage.java -text |
|
810 | 809 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/ExternalReferenceServiceWizardPage.java -text |
811 | 810 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewClassificationWizard.java -text |
812 | 811 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewCollectionWizard.java -text |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/DeleteHandler.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler; |
12 | 12 |
|
13 |
import java.util.List; |
|
14 |
|
|
13 | 15 |
import org.eclipse.core.commands.AbstractHandler; |
14 | 16 |
import org.eclipse.core.commands.ExecutionEvent; |
15 | 17 |
import org.eclipse.core.commands.ExecutionException; |
... | ... | |
37 | 39 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
38 | 40 |
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
39 | 41 |
|
40 |
PolytomousKey key = (PolytomousKey) selection.getFirstElement(); |
|
42 |
List<PolytomousKey> keys = selection.toList(); |
|
43 |
|
|
44 |
if(keys.isEmpty()){ |
|
45 |
return null; |
|
46 |
} |
|
47 |
|
|
48 |
boolean confirmation = NavigationUtil.confirmDialog("Confirm deletaion", "Do you want to delete the selected key" + (keys.size() == 1 ? "" : "s") + "?"); |
|
41 | 49 |
|
42 |
if(NavigationUtil.confirmDialog("Confirm deletaion", "Do you really want to delete the key: " + key.getTitleCache())){
|
|
50 |
if(confirmation){
|
|
43 | 51 |
|
44 |
try { |
|
45 |
AbstractPostOperation operation = new DeleteOperation( |
|
46 |
event.getCommand().getName(), |
|
47 |
NavigationUtil.getUndoContext(), key, |
|
48 |
(PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false), |
|
49 |
(PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false)); |
|
50 |
NavigationUtil.executeOperation(operation); |
|
51 |
} catch (NotDefinedException e) { |
|
52 |
NavigationUtil.error(getClass(), e); |
|
52 |
for(PolytomousKey key : keys){ |
|
53 |
try { |
|
54 |
AbstractPostOperation operation = new DeleteOperation( |
|
55 |
event.getCommand().getName(), |
|
56 |
NavigationUtil.getUndoContext(), key, |
|
57 |
(PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false), |
|
58 |
(PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false)); |
|
59 |
NavigationUtil.executeOperation(operation); |
|
60 |
} catch (NotDefinedException e) { |
|
61 |
NavigationUtil.error(getClass(), e); |
|
62 |
} |
|
53 | 63 |
} |
54 | 64 |
} |
55 | 65 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/ClassificationWizardPage.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2007 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
|
|
11 |
package eu.etaxonomy.taxeditor.newWizard; |
|
12 |
|
|
13 |
import org.apache.log4j.Logger; |
|
14 |
import org.eclipse.jface.util.IPropertyChangeListener; |
|
15 |
import org.eclipse.jface.util.PropertyChangeEvent; |
|
16 |
import org.eclipse.jface.wizard.WizardPage; |
|
17 |
import org.eclipse.swt.SWT; |
|
18 |
import org.eclipse.swt.graphics.Color; |
|
19 |
import org.eclipse.swt.widgets.Composite; |
|
20 |
import org.eclipse.swt.widgets.Display; |
|
21 |
|
|
22 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
|
23 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
|
24 |
import eu.etaxonomy.cdm.common.CdmUtils; |
|
25 |
import eu.etaxonomy.cdm.model.common.LanguageString; |
|
26 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
|
27 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
|
28 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
29 |
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory; |
|
30 |
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType; |
|
31 |
import eu.etaxonomy.taxeditor.ui.forms.RootElement; |
|
32 |
import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement; |
|
33 |
import eu.etaxonomy.taxeditor.ui.selection.ReferenceSelectionElement; |
|
34 |
|
|
35 |
/** |
|
36 |
* <p> |
|
37 |
* ClassificationWizardPage class. |
|
38 |
* </p> |
|
39 |
* |
|
40 |
* @author n.hoffmann |
|
41 |
* @created Sep 29, 2010 |
|
42 |
* @version 1.0 |
|
43 |
*/ |
|
44 |
@Deprecated |
|
45 |
// remove this file when refactoring is complete |
|
46 |
public class ClassificationWizardPage extends WizardPage implements |
|
47 |
IPropertyChangeListener, IConversationEnabled { |
|
48 |
private static final Logger logger = Logger |
|
49 |
.getLogger(ClassificationWizardPage.class); |
|
50 |
private Classification classification; |
|
51 |
|
|
52 |
private final ConversationHolder conversation; |
|
53 |
private final CdmFormFactory formFactory; |
|
54 |
private Composite control; |
|
55 |
private TextWithLabelElement text_classificationLabel; |
|
56 |
private ReferenceSelectionElement selection_reference; |
|
57 |
private TextWithLabelElement text_referenceDetail; |
|
58 |
|
|
59 |
/** |
|
60 |
* <p> |
|
61 |
* Constructor for ClassificationWizardPage. |
|
62 |
* </p> |
|
63 |
* |
|
64 |
* @param conversation |
|
65 |
* a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} |
|
66 |
* object. |
|
67 |
* @param classification |
|
68 |
* a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object. |
|
69 |
*/ |
|
70 |
protected ClassificationWizardPage(ConversationHolder conversation, |
|
71 |
Classification classification) { |
|
72 |
super("Classification"); |
|
73 |
this.setTitle("Classification"); |
|
74 |
this.setDescription(classification == null ? "Create a new Classification." |
|
75 |
: "Edit Classification."); |
|
76 |
|
|
77 |
this.classification = classification; |
|
78 |
this.conversation = conversation; |
|
79 |
|
|
80 |
this.formFactory = new CdmFormFactory(Display.getCurrent()); |
|
81 |
|
|
82 |
formFactory.addPropertyChangeListener(this); |
|
83 |
|
|
84 |
initialize(); |
|
85 |
} |
|
86 |
|
|
87 |
/* |
|
88 |
* (non-Javadoc) |
|
89 |
* |
|
90 |
* @see |
|
91 |
* org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets |
|
92 |
* .Composite) |
|
93 |
*/ |
|
94 |
/** {@inheritDoc} */ |
|
95 |
@Override |
|
96 |
public void createControl(Composite parent) { |
|
97 |
control = formFactory.createComposite(parent); |
|
98 |
|
|
99 |
control.setLayout(CdmFormFactory.LAYOUT(2, false)); |
|
100 |
RootElement rootElement = new RootElement(formFactory, control); |
|
101 |
|
|
102 |
text_classificationLabel = formFactory.createTextWithLabelElement( |
|
103 |
rootElement, "Label", classification.getName().getText(), |
|
104 |
SWT.NULL); |
|
105 |
selection_reference = (ReferenceSelectionElement) formFactory |
|
106 |
.createSelectionElement(SelectionType.REFERENCE, |
|
107 |
getConversationHolder(), rootElement, "Reference", |
|
108 |
classification.getReference(), |
|
109 |
ReferenceSelectionElement.DEFAULT, SWT.NULL); |
|
110 |
text_referenceDetail = formFactory.createTextWithLabelElement( |
|
111 |
rootElement, "Reference Detail", |
|
112 |
classification.getMicroReference(), SWT.NULL); |
|
113 |
|
|
114 |
Color bgColor = getShell().getBackground(); |
|
115 |
|
|
116 |
rootElement.setBackground(bgColor); |
|
117 |
control.setBackground(bgColor); |
|
118 |
|
|
119 |
setControl(control); |
|
120 |
} |
|
121 |
|
|
122 |
private void initialize() { |
|
123 |
if (classification == null) { |
|
124 |
classification = Classification.NewInstance(null, null, |
|
125 |
CdmStore.getDefaultLanguage()); |
|
126 |
} |
|
127 |
} |
|
128 |
|
|
129 |
/* |
|
130 |
* (non-Javadoc) |
|
131 |
* |
|
132 |
* @see |
|
133 |
* org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse |
|
134 |
* .jface.util.PropertyChangeEvent) |
|
135 |
*/ |
|
136 |
/** {@inheritDoc} */ |
|
137 |
@Override |
|
138 |
public void propertyChange(PropertyChangeEvent event) { |
|
139 |
Object eventSource = event.getSource(); |
|
140 |
|
|
141 |
if (eventSource == text_classificationLabel) { |
|
142 |
classification.setName(LanguageString.NewInstance( |
|
143 |
text_classificationLabel.getText(), |
|
144 |
CdmStore.getDefaultLanguage())); |
|
145 |
} else if (eventSource == selection_reference) { |
|
146 |
classification.setReference(selection_reference.getEntity()); |
|
147 |
} else if (eventSource == text_referenceDetail) { |
|
148 |
classification.setMicroReference(text_referenceDetail.getText()); |
|
149 |
} |
|
150 |
|
|
151 |
checkComplete(); |
|
152 |
} |
|
153 |
|
|
154 |
/** |
|
155 |
* |
|
156 |
*/ |
|
157 |
private void checkComplete() { |
|
158 |
if (CdmUtils.isEmpty(text_classificationLabel.getText())) { |
|
159 |
setMessage("A Classifications label may not be empty"); |
|
160 |
setPageComplete(false); |
|
161 |
} else { |
|
162 |
setMessage(null); |
|
163 |
setPageComplete(true); |
|
164 |
} |
|
165 |
} |
|
166 |
|
|
167 |
/** |
|
168 |
* <p> |
|
169 |
* Getter for the field <code>classification</code>. |
|
170 |
* </p> |
|
171 |
* |
|
172 |
* @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object. |
|
173 |
*/ |
|
174 |
public Classification getClassification() { |
|
175 |
return classification; |
|
176 |
} |
|
177 |
|
|
178 |
/* |
|
179 |
* (non-Javadoc) |
|
180 |
* |
|
181 |
* @see |
|
182 |
* eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update |
|
183 |
* (eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap) |
|
184 |
*/ |
|
185 |
/** {@inheritDoc} */ |
|
186 |
@Override |
|
187 |
public void update(CdmDataChangeMap changeEvents) { |
|
188 |
} |
|
189 |
|
|
190 |
/* |
|
191 |
* (non-Javadoc) |
|
192 |
* |
|
193 |
* @see |
|
194 |
* eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder |
|
195 |
* () |
|
196 |
*/ |
|
197 |
/** {@inheritDoc} */ |
|
198 |
@Override |
|
199 |
public ConversationHolder getConversationHolder() { |
|
200 |
return conversation; |
|
201 |
} |
|
202 |
|
|
203 |
/* |
|
204 |
* (non-Javadoc) |
|
205 |
* |
|
206 |
* @see org.eclipse.jface.dialogs.DialogPage#dispose() |
|
207 |
*/ |
|
208 |
/** {@inheritDoc} */ |
|
209 |
@Override |
|
210 |
public void dispose() { |
|
211 |
formFactory.removePropertyChangeListener(this); |
|
212 |
super.dispose(); |
|
213 |
} |
|
214 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/PolytomousKeyWizardPage.java | ||
---|---|---|
29 | 29 |
public AbstractCdmDetailElement createElement(ICdmFormElement rootElement) { |
30 | 30 |
PolytomousKeyDetailElement element = (PolytomousKeyDetailElement) formFactory.createCdmDetailElement(DetailType.POLYTOMOUS_KEY, rootElement, SWT.NULL); |
31 | 31 |
element.setEntity(entity); |
32 |
setPageComplete(true); |
|
32 | 33 |
return element; |
33 | 34 |
} |
34 | 35 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailElement.java | ||
---|---|---|
11 | 11 |
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement; |
12 | 12 |
import eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement; |
13 | 13 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; |
14 |
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement; |
|
14 | 15 |
|
15 | 16 |
/** |
16 | 17 |
* @author n.hoffmann |
17 | 18 |
* |
18 | 19 |
*/ |
19 | 20 |
public class PolytomousKeyDetailElement extends |
20 |
AbstractCdmDetailElement<PolytomousKey> {
|
|
21 |
AbstractIdentifiableEntityDetailElement<PolytomousKey> {
|
|
21 | 22 |
|
22 | 23 |
public PolytomousKeyDetailElement(CdmFormFactory formFactory, |
23 | 24 |
ICdmFormElement formElement) { |
24 | 25 |
super(formFactory, formElement); |
25 | 26 |
} |
26 | 27 |
|
27 |
private ToggleableTextElement text_title; |
|
28 |
|
|
29 | 28 |
@Override |
30 | 29 |
protected void createControls(ICdmFormElement formElement, |
31 | 30 |
PolytomousKey entity, int style) { |
32 |
text_title = formFactory.createToggleableTextField(formElement,
|
|
31 |
toggleable_cache = formFactory.createToggleableTextField(formElement,
|
|
33 | 32 |
"Title Cache", entity.getTitleCache(), |
34 | 33 |
entity.isProtectedTitleCache(), SWT.NULL); |
35 | 34 |
} |
... | ... | |
43 | 42 |
*/ |
44 | 43 |
@Override |
45 | 44 |
public void handleEvent(Object eventSource) { |
46 |
if (eventSource == text_title) { |
|
47 |
getEntity().setTitleCache(text_title.getText()); |
|
48 |
} |
|
45 |
handleToggleableCacheField(); |
|
49 | 46 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null)); |
50 | 47 |
} |
51 | 48 |
} |
Also available in: Unified diff
Fixes #2436; PolytomousKeyListView now allows deletion of multiple elements