Revision 3c258b8a
Added by Patrick Plitzner over 8 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java | ||
---|---|---|
34 | 34 |
import org.eclipse.swt.widgets.Control; |
35 | 35 |
import org.eclipse.ui.IEditorInput; |
36 | 36 |
import org.eclipse.ui.IEditorSite; |
37 |
import org.eclipse.ui.IViewPart; |
|
38 | 37 |
import org.eclipse.ui.PartInitException; |
39 |
import org.eclipse.ui.PlatformUI; |
|
40 | 38 |
import org.eclipse.ui.texteditor.ITextEditorActionConstants; |
41 | 39 |
|
42 | 40 |
import eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineDocumentProvider; |
... | ... | |
44 | 42 |
import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation; |
45 | 43 |
import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel; |
46 | 44 |
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput; |
47 |
import eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsView; |
|
48 | 45 |
import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart; |
49 | 46 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkable; |
50 | 47 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
... | ... | |
54 | 51 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
55 | 52 |
|
56 | 53 |
/** |
57 |
* <p> |
|
58 |
* BulkEditor class. |
|
59 |
* </p> |
|
60 |
* |
|
61 | 54 |
* @author p.ciardelli |
62 | 55 |
* @created 07.07.2009 |
63 | 56 |
* @version 1.0 |
... | ... | |
76 | 69 |
|
77 | 70 |
private boolean isDirty; |
78 | 71 |
|
79 |
/** |
|
80 |
* <p>Constructor for BulkEditor.</p> |
|
81 |
*/ |
|
82 | 72 |
public BulkEditor() { |
83 | 73 |
super(CdmStore.createConversation()); |
84 | 74 |
} |
85 | 75 |
|
86 |
/* (non-Javadoc) |
|
87 |
* @see org.eclipse.ui.editors.text.TextEditor#initializeEditor() |
|
88 |
*/ |
|
89 | 76 |
/** {@inheritDoc} */ |
90 | 77 |
@Override |
91 | 78 |
protected void initializeEditor() { |
... | ... | |
103 | 90 |
setSourceViewerConfiguration(new BulkEditorViewerConfiguration(lineDisplayStrategy)); |
104 | 91 |
} |
105 | 92 |
|
106 |
/* (non-Javadoc) |
|
107 |
* @see eu.etaxonomy.taxeditor.bulkeditor.ListEditor#createSourceViewer(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.source.IVerticalRuler, int) |
|
108 |
*/ |
|
109 | 93 |
/** {@inheritDoc} */ |
110 | 94 |
@Override |
111 | 95 |
protected ISourceViewer createSourceViewer(Composite parent, |
... | ... | |
117 | 101 |
return viewer; |
118 | 102 |
} |
119 | 103 |
|
120 |
/* (non-Javadoc) |
|
121 |
* @see eu.etaxonomy.taxeditor.bulkeditor.AnnotatedLineEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput) |
|
122 |
*/ |
|
123 | 104 |
/** {@inheritDoc} */ |
124 | 105 |
@Override |
125 | 106 |
public void init(IEditorSite site, IEditorInput input) |
... | ... | |
132 | 113 |
super.init(site, input); |
133 | 114 |
} |
134 | 115 |
|
135 |
/* (non-Javadoc) |
|
136 |
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createPartControl(org.eclipse.swt.widgets.Composite) |
|
137 |
*/ |
|
138 | 116 |
/** {@inheritDoc} */ |
139 | 117 |
@Override |
140 | 118 |
public void createPartControl(Composite parent) { |
... | ... | |
164 | 142 |
} |
165 | 143 |
} |
166 | 144 |
|
167 |
/* (non-Javadoc) |
|
168 |
* @see org.eclipse.ui.editors.text.TextEditor#dispose() |
|
169 |
*/ |
|
170 | 145 |
/** {@inheritDoc} */ |
171 | 146 |
@Override |
172 | 147 |
public void dispose() { |
... | ... | |
177 | 152 |
} |
178 | 153 |
|
179 | 154 |
|
180 |
/* (non-Javadoc) |
|
181 |
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#isEditable() |
|
182 |
*/ |
|
183 | 155 |
/** {@inheritDoc} */ |
184 | 156 |
@Override |
185 | 157 |
public boolean isEditable() { |
186 | 158 |
return false; |
187 | 159 |
} |
188 | 160 |
|
189 |
/* (non-Javadoc) |
|
190 |
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor#setFocus() |
|
191 |
*/ |
|
192 | 161 |
/** {@inheritDoc} */ |
193 | 162 |
@Override |
194 | 163 |
public void setFocus() { |
... | ... | |
203 | 172 |
} |
204 | 173 |
} |
205 | 174 |
|
206 |
/** |
|
207 |
* |
|
208 |
*/ |
|
209 | 175 |
private void displayWarningDialog() { |
210 | 176 |
IPreferenceStore prefs = PreferencesUtil.getPreferenceStore(); |
211 | 177 |
if (!prefs.getBoolean(PreferencesUtil.HIDE_BULKEDITOR_INFO)) { |
... | ... | |
221 | 187 |
} |
222 | 188 |
} |
223 | 189 |
|
224 |
/** |
|
225 |
* @param control |
|
226 |
*/ |
|
227 | 190 |
private void addToggleMergeCandidateListener(Control control) { |
228 | 191 |
control.addMouseListener(new MouseAdapter() { |
229 | 192 |
@Override |
... | ... | |
235 | 198 |
}); |
236 | 199 |
} |
237 | 200 |
|
238 |
/** |
|
239 |
* <p>toggleMergeCandidateAnnotation</p> |
|
240 |
* |
|
241 |
* @param line a int. |
|
242 |
*/ |
|
243 | 201 |
public void toggleMergeCandidateAnnotation(int line) { |
244 | 202 |
|
245 | 203 |
IDocument document = getSourceViewer().getDocument(); |
... | ... | |
261 | 219 |
} |
262 | 220 |
} |
263 | 221 |
|
264 |
/* (non-Javadoc) |
|
265 |
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor#isDirty() |
|
266 |
*/ |
|
267 | 222 |
@Override |
268 | 223 |
public boolean isDirty() { |
269 | 224 |
if(isDirty){ |
... | ... | |
280 | 235 |
firePropertyChange(PROP_DIRTY); |
281 | 236 |
} |
282 | 237 |
|
283 |
/* (non-Javadoc) |
|
284 |
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor#doSave(org.eclipse.core.runtime.IProgressMonitor) |
|
285 |
*/ |
|
286 | 238 |
@Override |
287 | 239 |
public void doSave(IProgressMonitor progressMonitor) { |
288 | 240 |
isDirty = false; |
289 |
|
|
241 |
|
|
290 | 242 |
super.doSave(progressMonitor); |
291 |
|
|
243 |
|
|
292 | 244 |
selectFirstItem(); |
293 |
|
|
245 |
|
|
294 | 246 |
getSourceViewer().getTextWidget().setFocus(); |
295 | 247 |
|
296 | 248 |
} |
... | ... | |
304 | 256 |
// firePropertyChange(PROP_DIRTY); |
305 | 257 |
} |
306 | 258 |
|
307 |
/* (non-Javadoc) |
|
308 |
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) |
|
309 |
*/ |
|
310 | 259 |
/** {@inheritDoc} */ |
311 | 260 |
public void performSearch(BulkEditorQuery query) { |
312 | 261 |
if (query != null) { |
... | ... | |
323 | 272 |
} |
324 | 273 |
conversation.commit(); |
325 | 274 |
conversation.clear(); |
326 |
|
|
275 |
|
|
327 | 276 |
getEditorInput().performSearch(query); |
328 | 277 |
|
329 | 278 |
refresh(); |
... | ... | |
339 | 288 |
getSelectionProvider().setSelection(selection); |
340 | 289 |
} |
341 | 290 |
|
342 |
/** |
|
343 |
* |
|
344 |
*/ |
|
345 | 291 |
public void refresh() { |
346 | 292 |
if(getDocumentProvider().getAnnotationModel(getEditorInput()) != null){ |
347 | 293 |
((AnnotationModel) getDocumentProvider().getAnnotationModel(getEditorInput())).removeAllAnnotations(); |
Also available in: Unified diff
Remove comments