package eu.etaxonomy.taxeditor.bulkeditor;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;
import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
-import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider;
+import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
+import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
+import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>BulkEditor class.</p>
- *
* @author p.ciardelli
* @created 07.07.2009
* @version 1.0
*/
-public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDetails, IDirtyMarkableSelectionProvider{
+public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDetails,
+ IDirtyMarkable, IDerivedUnitFacadePart, IPartContentHasFactualData, IPartContentHasMedia {
/** Constant <code>ID="bulkeditor.editor"</code> */
public static final String ID = "bulkeditor.editor";
private IPropertyChangeListener markerPreferenceListener;
- /**
- * <p>Constructor for BulkEditor.</p>
- */
+ private boolean isDirty;
+
public BulkEditor() {
super(CdmStore.createConversation());
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.editors.text.TextEditor#initializeEditor()
- */
/** {@inheritDoc} */
@Override
protected void initializeEditor() {
setSourceViewerConfiguration(new BulkEditorViewerConfiguration(lineDisplayStrategy));
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.bulkeditor.ListEditor#createSourceViewer(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.source.IVerticalRuler, int)
- */
/** {@inheritDoc} */
@Override
protected ISourceViewer createSourceViewer(Composite parent,
return viewer;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.bulkeditor.AnnotatedLineEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
- */
/** {@inheritDoc} */
@Override
public void init(IEditorSite site, IEditorInput input)
super.init(site, input);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createPartControl(org.eclipse.swt.widgets.Composite)
- */
/** {@inheritDoc} */
@Override
public void createPartControl(Composite parent) {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.editors.text.TextEditor#dispose()
- */
/** {@inheritDoc} */
@Override
public void dispose() {
super.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#isEditable()
- */
+
/** {@inheritDoc} */
@Override
public boolean isEditable() {
return false;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor#setFocus()
- */
/** {@inheritDoc} */
@Override
public void setFocus() {
+ conversation.bind();
searchBar.setFocus();
// TODO find a better place to put this - this dialog should be shown after initial contents of
displayWarningDialog();
isInitialFocus = false;
}
+ super.setFocus();
}
- /**
- *
- */
private void displayWarningDialog() {
IPreferenceStore prefs = PreferencesUtil.getPreferenceStore();
if (!prefs.getBoolean(PreferencesUtil.HIDE_BULKEDITOR_INFO)) {
}
}
- /**
- * @param control
- */
private void addToggleMergeCandidateListener(Control control) {
control.addMouseListener(new MouseAdapter() {
@Override
});
}
- /**
- * <p>toggleMergeCandidateAnnotation</p>
- *
- * @param line a int.
- */
public void toggleMergeCandidateAnnotation(int line) {
IDocument document = getSourceViewer().getDocument();
}
}
+ @Override
+ public boolean isDirty() {
+ if(isDirty){
+ return isDirty;
+ }
+ else{
+ return super.isDirty();
+ }
+ }
+
+ @Override
+ public void forceDirty(){
+ isDirty = true;
+ firePropertyChange(PROP_DIRTY);
+ }
+
+ @Override
+ public void doSave(IProgressMonitor progressMonitor) {
+ isDirty = false;
+
+ super.doSave(progressMonitor);
+
+ selectFirstItem();
+
+ getSourceViewer().getTextWidget().setFocus();
+
+ }
+
/** {@inheritDoc} */
@Override
public void changed(Object object) {
// firePropertyChange(PROP_DIRTY);
}
- /* (non-Javadoc)
- * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
- */
/** {@inheritDoc} */
public void performSearch(BulkEditorQuery query) {
if (query != null) {
return;
}
}
+ conversation.commit();
+ conversation.clear();
getEditorInput().performSearch(query);
getSelectionProvider().setSelection(selection);
}
- /**
- *
- */
public void refresh() {
if(getDocumentProvider().getAnnotationModel(getEditorInput()) != null){
((AnnotationModel) getDocumentProvider().getAnnotationModel(getEditorInput())).removeAllAnnotations();
menu.remove(ITextEditorActionConstants.SHIFT_LEFT);
menu.remove(ITextEditorActionConstants.CONTEXT_PREFERENCES);
}
+
+ @Override
+ public boolean canAttachMedia() {
+ return getEditorInput() instanceof TaxonEditorInput?true:false;
+ }
}