- disabled PreservationMethod related widget as they have not been adapted to the model changes yet
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsContentProvider.java -text
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsLabelProvider.java -text
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java -text
+eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/DataImportEditor.java -text
+eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/DataImportEditorLineDisplayStrategy.java -text
+eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/SpecimenEditorInput.java -text
+eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/wizard/SpecimenSearchWizard.java -text
+eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/wizard/SpecimenSearchWizardPage.java -text
eu.etaxonomy.taxeditor.bulkeditor/src/test/java/eu/etaxonomy/taxeditor/bulkeditor/Application.java -text
eu.etaxonomy.taxeditor.bulkeditor/src/test/java/eu/etaxonomy/taxeditor/bulkeditor/ApplicationActionBarAdvisor.java -text
eu.etaxonomy.taxeditor.bulkeditor/src/test/java/eu/etaxonomy/taxeditor/bulkeditor/ApplicationWorkbenchAdvisor.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/SpecimenCdmExcelImportWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/TcsExportWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/TcsImportWizard.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/specimenSearch/SpecimenSearchResultWizardPage.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/specimenSearch/SpecimenSearchWizard.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/specimenSearch/SpecimenSearchWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/labels/DefaultLabelStrategy.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/labels/ILabelImageStrategy.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/labels/LabelImageProvider.java -text
Bundle-Version: 3.2.3.201308261400
Bundle-Activator: eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin
Bundle-Vendor: EDIT
-Export-Package: eu.etaxonomy.taxeditor.annotatedlineeditor,eu.etaxonomy.taxeditor.annotatedlineeditor.handler,eu.etaxonomy.taxeditor.bulkeditor,eu.etaxonomy.taxeditor.bulkeditor.command,eu.etaxonomy.taxeditor.bulkeditor.handler,eu.etaxonomy.taxeditor.bulkeditor.input,eu.etaxonomy.taxeditor.bulkeditor.internal,eu.etaxonomy.taxeditor.bulkeditor.referencingobjects
+Export-Package: eu.etaxonomy.taxeditor.annotatedlineeditor,
+ eu.etaxonomy.taxeditor.annotatedlineeditor.handler,
+ eu.etaxonomy.taxeditor.bulkeditor,
+ eu.etaxonomy.taxeditor.bulkeditor.command,
+ eu.etaxonomy.taxeditor.bulkeditor.handler,
+ eu.etaxonomy.taxeditor.bulkeditor.input,
+ eu.etaxonomy.taxeditor.bulkeditor.internal,
+ eu.etaxonomy.taxeditor.bulkeditor.referencingobjects,
+ eu.etaxonomy.taxeditor.dataimport,
+ eu.etaxonomy.taxeditor.dataimport.wizard
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ui.editors,
id="nameeditor.editor"\r
name="Name Editor">\r
</editor>\r
+ <editor\r
+ class="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"\r
+ default="false"\r
+ id="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"\r
+ name="Data Import Editor">\r
+ </editor>\r
</extension>\r
<extension\r
point="org.eclipse.ui.menus">\r
id="bulkeditor.menus.openmenu"\r
label="Bulk Editor">\r
</menu>\r
+ <menu\r
+ label="Search Specimen">\r
+ </menu>\r
</menuContribution>\r
<menuContribution\r
locationURI="menu:bulkeditor.menus.openmenu">\r
style="push">\r
</command>\r
</menuContribution>\r
+ <menuContribution\r
+ allPopups="false"\r
+ locationURI="popup:eu.etaxonomy.taxeditor.editor.view.media">\r
+ <command\r
+ commandId="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addDerivedUnitMedia"\r
+ label="Add Derived Unit Media"\r
+ style="push">\r
+ </command>\r
+ <command\r
+ commandId="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addFieldObjectMedia"\r
+ label="Add Field Object Media"\r
+ style="push">\r
+ </command>\r
+ </menuContribution>\r
</extension>\r
<extension\r
point="org.eclipse.ui.commands">\r
id="bulkeditor.commands.removemergecandidate"\r
name="Remove as Candidate for Group Merge">\r
</command>\r
+ <command\r
+ defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMarkerFlagHandler"\r
+ id="taxeditor-bulkeditor.command.setMarkerFlag"\r
+ name="Set Marker Flag">\r
+ </command>\r
+ <command\r
+ defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.derivedunit.handler.AddDerivedUnitMediaHandler"\r
+ id="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addDerivedUnitMedia"\r
+ name="Add Derived Unit Media">\r
+ </command>\r
+ <command\r
+ defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.derivedunit.handler.AddFieldObjectMediaHandler"\r
+ id="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addFieldObjectMedia"\r
+ name="Add Field Object Media">\r
+ </command>\r
<!--command\r
defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.NewEntityHandler"\r
id="eu.etaxonomy.taxeditor.bulkeditor.command.new"\r
type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">\r
</propertyTester>\r
</extension>\r
- <extension\r
- point="org.eclipse.ui.commands">\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMarkerFlagHandler"\r
- id="taxeditor-bulkeditor.command.setMarkerFlag"\r
- name="Set Marker Flag">\r
- </command>\r
- </extension>\r
<extension\r
point="org.eclipse.ui.handlers">\r
<handler\r
name="Bulk Editor">\r
</page>\r
</extension>\r
- <extension\r
- point="org.eclipse.ui.menus">\r
- <menuContribution\r
- allPopups="false"\r
- locationURI="popup:eu.etaxonomy.taxeditor.editor.view.media">\r
- <command\r
- commandId="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addDerivedUnitMedia"\r
- label="Add Derived Unit Media"\r
- style="push">\r
- </command>\r
- <command\r
- commandId="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addFieldObjectMedia"\r
- label="Add Field Object Media"\r
- style="push">\r
- </command>\r
- </menuContribution>\r
- </extension>\r
- <extension\r
- point="org.eclipse.ui.commands">\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.derivedunit.handler.AddDerivedUnitMediaHandler"\r
- id="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addDerivedUnitMedia"\r
- name="Add Derived Unit Media">\r
- </command>\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.derivedunit.handler.AddFieldObjectMediaHandler"\r
- id="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addFieldObjectMedia"\r
- name="Add Field Object Media">\r
- </command>\r
- </extension>\r
<extension\r
point="org.eclipse.core.expressions.propertyTesters">\r
<propertyTester\r
id="eu.etaxonomy.taxeditor.view.detail">\r
</showInPart>\r
</perspectiveExtension>\r
+ </extension>\r
+ <extension\r
+ point="org.eclipse.ui.importWizards">\r
+ <wizard\r
+ category="eu.etaxonomy.taxeditor.import.category.cdm"\r
+ class="eu.etaxonomy.taxeditor.dataimport.wizard.SpecimenSearchWizard"\r
+ id="eu.etaxonomy.taxeditor.dataimport.wizard.SpecimenSearchWizard"\r
+ name="Query BioCASE">\r
+ </wizard>\r
</extension>
<!-- start set marker -->\r
\r
// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.texteditor.AbstractDocumentProvider;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.dataimport.SpecimenEditorInput;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
private LineAnnotationModel annotationModel;
private IEntityCreator<?> entityCreator;
-
+
private ILineDisplayStrategy lineDisplayStrategy;
private IEditorInput input;
-
+
/**
* <p>Constructor for AnnotatedLineDocumentProvider.</p>
*
public AnnotatedLineDocumentProvider(IEditorInput input){
this.input = input;
}
-
+
/** {@inheritDoc} */
@Override
public IAnnotationModel getAnnotationModel(Object element) {
if (element == input) {
-
+
// Create model as necessary
if (annotationModel == null) {
annotationModel = new LineAnnotationModel(getLineDisplayStrategy(element));
}
return annotationModel;
}
-
+
return null;
}
-
+
/** {@inheritDoc} */
@Override
protected IAnnotationModel createAnnotationModel(Object element)
public IDocument getDocument(Object element) {
return document;
}
-
+
/** {@inheritDoc} */
@Override
protected IDocument createDocument(Object element) throws CoreException {
-
+
if (element instanceof IEditorInput) {
IEditorInput input = (IEditorInput) element;
document = new Document("");
// IAnnotationModel model = getAnnotationModel(element);
-
+
List<?> entityList = getEntityList(element);
-
+
if(entityList != null){
for (Object entity : entityList) {
try {
createAnnotatedLine(input, entity);
} catch (BadLocationException e) {
- BulkEditorUtil.error(getClass(), "Problems creating annotated line: ", e);
+ AbstractUtility.error(getClass(), "Problems creating annotated line: ", e);
}
- }
+ }
}
-
+
return document;
}
return null;
* @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
*/
protected LineAnnotation createAnnotatedLine(Object element, Object entity) throws BadLocationException {
-
+
Document document = (Document) getDocument(element);
ILineDisplayStrategy lineDisplayStrategy = getLineDisplayStrategy(element);
-
+
LineAnnotation annotation = new LineAnnotation(entity, lineDisplayStrategy);
-
+
// Is document zero length, or is last char in document line delimiter?
int docLength = document.getLength();
boolean useDelimiter = false;
if (useDelimiter) {
document.replace(docLength, 0, document.getDefaultLineDelimiter());
}
-
+
String text;
if (lineDisplayStrategy.isEntityCacheEmpty(entity)) {
text = lineDisplayStrategy.getEmptyCacheMessage(entity);
text += lineDisplayStrategy.getSupplementalText(entity);
docLength = document.getLength();
document.replace(docLength, 0, text);
-
+
Position position = new Position(docLength, text.length());
-
+
IAnnotationModel model = getAnnotationModel(element);
if(model != null){
model.addAnnotation(annotation, position);
}
-
-// lineDisplayStrategy.addDisplayListener(entity,
+
+// lineDisplayStrategy.addDisplayListener(entity,
// new EntityListenerImpl((LineAnnotation) annotation, element));
-//
+//
return annotation;
}
-
-
+
+
/**
* <p>updateLineFromAnnotation</p>
*
* @param annotation a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
*/
public void updateLineFromAnnotation(LineAnnotation annotation) {
-
+
IAnnotationModel model = getAnnotationModel(input);
IDocument document = getDocument(input);
ILineDisplayStrategy lineDisplay = getLineDisplayStrategy(input);
-
+
Object entity = annotation.getEntity();
String text = "";
if (getLineDisplayStrategy(input).isEntityCacheEmpty(entity)) {
text = lineDisplay.getEmptyCacheMessage(entity);
} else {
text = lineDisplay.getText(entity);
- }
+ }
text += lineDisplay.getSupplementalText(entity);
-
+
try {
if (model.getPosition(annotation) == null) {
return;
}
- int offset = model.getPosition(annotation).getOffset();
+ int offset = model.getPosition(annotation).getOffset();
int line = document.getLineOfOffset(offset);
int lineLength = document.getLineLength(document.getLineOfOffset(offset));
if (document.getLineDelimiter(line) != null) {
}
document.replace(offset, lineLength, text);
} catch (BadLocationException e) {
- BulkEditorUtil.error(getClass(), "Problem updating annotated line: " ,e);
+ AbstractUtility.error(getClass(), "Problem updating annotated line: " ,e);
}
}
-
+
/**
- * @param element
+ * @param element
* @return
*/
private List<?> getEntityList(Object element) {
if (element instanceof AbstractBulkEditorInput) {
return ((AbstractBulkEditorInput)element).getModel();
}
+ else if(element instanceof SpecimenEditorInput){
+ return ((SpecimenEditorInput) element).getResults();
+ }
return null;
}
protected void doSaveDocument(IProgressMonitor monitor, Object element,
IDocument document, boolean overwrite) throws CoreException {
if (element instanceof AbstractBulkEditorInput) {
-
+
IEntityPersistenceService persistenceService = (AbstractBulkEditorInput) element;
-
+
// Get new containers from annotation model
LineAnnotationModel model = (LineAnnotationModel) getAnnotationModel(element);
Iterator iterator = model.getAnnotationIterator();
continue;
}
if (annotation.isMarkedAsMerged()) {
- persistenceService.merge(annotation.getEntity(), annotation.getMergeTarget()); // merge
+ persistenceService.merge(annotation.getEntity(), annotation.getMergeTarget()); // merge
} else {
// TODO clarify w AM whether this needs to be executed on merged objects
//persistenceService.delete(annotation.getEntity()); // delete
protected IRunnableContext getOperationRunner(IProgressMonitor monitor) {
return null;
}
-
+
/** {@inheritDoc} */
@Override
public boolean isModifiable(Object element) {
return true;
}
-
+
/** {@inheritDoc} */
@Override
public boolean isReadOnly(Object element) {
// enables copy & paste
return false;
}
-
+
/**
* <p>Getter for the field <code>entityCreator</code>.</p>
*
ILineDisplayStrategy lineDisplayStrategy, Object element) {
if (element instanceof IEditorInput) {
this.lineDisplayStrategy = lineDisplayStrategy;
- }
+ }
}
-
+
/**
* <p>Getter for the field <code>lineDisplayStrategy</code>.</p>
*
}
return null;
}
-
+
/**
* <p>removeAnnotatedLine</p>
*
LineAnnotation annotation = (LineAnnotation) annotationModel.getAnnotation(entity);
removeAnnotatedLine(annotation);
}
-
+
/**
* <p>removeAnnotatedLine</p>
*
LineAnnotation annotation = (LineAnnotation) annotationModel.getAnnotationAtLine(lineno, document);
removeAnnotatedLine(annotation);
}
-
+
/**
* <p>removeAnnotatedLine</p>
*
if (annotation != null) {
Document document = (Document) getDocument(input);
LineAnnotationModel model = (LineAnnotationModel) getAnnotationModel(input);
-
+
Position position = model.getPosition(annotation);
int offset = position.getOffset();
int length = position.getLength();
-
+
Object entity = annotation.getEntity();
annotation.markAsDeleted();
model.removeAnnotation(annotation);
-
+
// Immediately followed by a delimiter?
int annotationEnd = offset + length;
try {
length += 2;
}
} catch (BadLocationException e1) {
- BulkEditorUtil.error(getClass(), "Problems removing annotated line", e1);
+ AbstractUtility.error(getClass(), "Problems removing annotated line", e1);
}
-
+
try {
document.replace(offset, length, "");
} catch (BadLocationException e) {
- BulkEditorUtil.error(getClass(), "Problems removing annotated line", e);
+ AbstractUtility.error(getClass(), "Problems removing annotated line", e);
}
- }
+ }
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractDocumentProvider#changed(java.lang.Object)
*/
// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
package eu.etaxonomy.taxeditor.bulkeditor;
-import java.util.Iterator;
-
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationModel;
-import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.IVerticalRuler;
import org.eclipse.jface.util.IPropertyChangeListener;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
public static final String ID = "bulkeditor.editor";
private boolean isInitialFocus = true;
-
+
private BulkEditorSearch searchBar = null;
-
+
private IPropertyChangeListener markerPreferenceListener;
/**
@Override
protected void initializeEditor() {
super.initializeEditor();
-
+
/**
* see AbstractTextEditor javadoc for explanation of context menu ids
*/
setEditorContextMenuId("#BulkEditorContext");
// setEntityCreatorService(new BulkEditorEntityCreatorService());
-
+
setLineDisplayStrategy(new BulkEditorLineDisplay(this));
-
+
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} */
- protected ISourceViewer createSourceViewer(Composite parent,
+ @Override
+ protected ISourceViewer createSourceViewer(Composite parent,
IVerticalRuler ruler, int styles) {
ISourceViewer viewer = super.createSourceViewer(parent, ruler, styles);
- if (((AbstractBulkEditorInput) getEditorInput()).isMergingEnabled()) {
+ if (getEditorInput().isMergingEnabled()) {
addToggleMergeCandidateListener(ruler.getControl());
}
return viewer;
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.AnnotatedLineEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
*/
@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
-
+
if (!(input instanceof AbstractBulkEditorInput)) {
throw new PartInitException("Invalid Input: Must be BulkEditorInput");
}
-
+
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) {
-
+
parent.setLayout(new GridLayout());
-
+
Composite layoutComposite = new Composite(parent, SWT.NONE);
layoutComposite.setLayout(new GridLayout());
GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
layoutComposite.setLayoutData(gridData);
-
+
// layoutComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
-
-
+
+
searchBar = new BulkEditorSearch(this, layoutComposite, SWT.NONE);
// layoutComposite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
-
+
super.createPartControl(parent);
-
+
// Set viewer composite to fill grid. Unfortunately it is private and we have to do a little hack here.
for (Control control : parent.getChildren()) {
- if (control instanceof Composite &&
+ if (control instanceof Composite &&
!(control.equals(layoutComposite))) {
control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
}
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.editors.text.TextEditor#dispose()
*/
public void setFocus() {
searchBar.setFocus();
- // TODO find a better place to put this - this dialog should be shown after initial contents of
+ // TODO find a better place to put this - this dialog should be shown after initial contents of
// Editor are displayed
if (isInitialFocus) {
displayWarningDialog();
isInitialFocus = false;
}
}
-
+
/**
- *
+ *
*/
private void displayWarningDialog() {
IPreferenceStore prefs = PreferencesUtil.getPreferenceStore();
- if (!prefs.getBoolean(PreferencesUtil.HIDE_BULKEDITOR_INFO)) {
+ if (!prefs.getBoolean(IPreferenceKeys.HIDE_BULKEDITOR_INFO)) {
String msg = "The Bulk Editor allows you to edit objects used to reference other objects, such as names, references, and authors.\n\n" +
"Any changes you make to an object in the Bulk Editor will be displayed wherever the object is used.\n\n" +
"For instance, a reference may be displayed with both a name and a descriptive element. If the reference name is changed here, the display of both the name and the descriptive element will be affected.";
MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm
- (getSite().getShell(), "Bulk Editor", msg, "Do not show this message again",
- false, null, PreferencesUtil.HIDE_BULKEDITOR_INFO);
- if (dialog.getReturnCode() == Window.OK) {
- prefs.setValue(PreferencesUtil.HIDE_BULKEDITOR_INFO, dialog.getToggleState());
+ (getSite().getShell(), "Bulk Editor", msg, "Do not show this message again",
+ false, null, IPreferenceKeys.HIDE_BULKEDITOR_INFO);
+ if (dialog.getReturnCode() == Window.OK) {
+ prefs.setValue(IPreferenceKeys.HIDE_BULKEDITOR_INFO, dialog.getToggleState());
}
}
}
-
+
/**
* @param control
*/
* @param line a int.
*/
public void toggleMergeCandidateAnnotation(int line) {
-
+
IDocument document = getSourceViewer().getDocument();
- LineAnnotationModel model =
+ LineAnnotationModel model =
(LineAnnotationModel) getSourceViewer().getAnnotationModel();
-
+
if(model != null){
Annotation annotation = model.getAnnotationAtLine(line, document);
-
+
if (annotation != null) {
if (annotation.getType().equals(IBulkEditorConstants.TYPE_MERGE_CANDIDATE)) {
model.changeAnnotationType(
}
}
}
-
+
/** {@inheritDoc} */
- public void changed(Object object) {
+ @Override
+ public void changed(Object object) {
// this.dirty = dirty;
AnnotatedLineDocumentProvider p = (AnnotatedLineDocumentProvider) getDocumentProvider();
p.changed(object);
// firePropertyChange(PROP_DIRTY);
}
-
+
/* (non-Javadoc)
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
/** {@inheritDoc} */
public void performSearch(BulkEditorQuery query) {
if (query != null) {
-
+
// TODO check if dirty, prompt save
if (isDirty()) {
- boolean proceed = MessageDialog.openQuestion(getEditorSite().getShell(),
+ boolean proceed = MessageDialog.openQuestion(getEditorSite().getShell(),
"Save changes", "You have made changes that must be saved before this query can be executed. Would you like to proceed?");
if (proceed) {
doSave(null);
return;
}
}
-
+
getEditorInput().performSearch(query);
-
+
refresh();
-
+
selectFirstItem();
-
+
getSourceViewer().getTextWidget().setFocus();
}
}
-
+
private void selectFirstItem() {
- ITextSelection selection = new TextSelection(0, 0);
+ ITextSelection selection = new TextSelection(0, 0);
getSelectionProvider().setSelection(selection);
}
/**
- *
+ *
*/
public void refresh() {
if(getDocumentProvider().getAnnotationModel(getEditorInput()) != null){
((AnnotationModel) getDocumentProvider().getAnnotationModel(getEditorInput())).removeAllAnnotations();
}
-
+
setInput(getEditorInput());
}
-
+
/** {@inheritDoc} */
@Override
public AbstractBulkEditorInput getEditorInput() {
return (AbstractBulkEditorInput) super.getEditorInput();
}
-
- protected void editorContextMenuAboutToShow(IMenuManager menu) {
+
+ @Override
+ protected void editorContextMenuAboutToShow(IMenuManager menu) {
super.editorContextMenuAboutToShow(menu);
menu.remove(ITextEditorActionConstants.SHIFT_RIGHT);
menu.remove(ITextEditorActionConstants.SHIFT_LEFT);
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.dataimport;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor;
+
+/**
+ * @author pplitzner
+ * @date 20.09.2013
+ *
+ */
+public class DataImportEditor extends AnnotatedLineEditor {
+
+ /** Constant <code>ID="bulkeditor.input.nameRelationship"</code> */
+ public static final String ID = "eu.etaxonomy.taxeditor.dataimport.DataImportEditor";
+
+ /**
+ * Constructs a new DataImportEditor with a new {@link ConversationHolder}
+ */
+ public DataImportEditor() {
+ super(null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.editors.text.TextEditor#initializeEditor()
+ */
+ /** {@inheritDoc} */
+ @Override
+ protected void initializeEditor() {
+ super.initializeEditor();
+ String editorTitle = "Data Import Editor";
+ setPartName(editorTitle);
+ setTitleToolTip(editorTitle);
+ setLineDisplayStrategy(new DataImportEditorLineDisplayStrategy());
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.dataimport;
+
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.EntityListener;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy;
+
+/**
+ * @author pplitzner
+ * @date 20.09.2013
+ *
+ */
+public class DataImportEditorLineDisplayStrategy implements ILineDisplayStrategy {
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getIndent(java.lang.Object)
+ */
+ @Override
+ public int getIndent(Object entity) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getIcon(java.lang.Object)
+ */
+ @Override
+ public Image getIcon(Object entity) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getFont(java.lang.Object)
+ */
+ @Override
+ public Font getFont(Object entity) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object entity) {
+ return ((SpecimenOrObservationBase)entity).getTitleCache();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getSupplementalText(java.lang.Object)
+ */
+ @Override
+ public String getSupplementalText(Object entity) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getEmptyCacheMessage(java.lang.Object)
+ */
+ @Override
+ public String getEmptyCacheMessage(Object entity) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#setText(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setText(String text, Object entity) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getHoverText(java.lang.Object)
+ */
+ @Override
+ public String getHoverText(Object entity) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#setStatusMessage(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setStatusMessage(String text, Object entity) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#isEntityCacheEmpty(java.lang.Object)
+ */
+ @Override
+ public boolean isEntityCacheEmpty(Object entity) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#addDisplayListener(java.lang.Object, eu.etaxonomy.taxeditor.annotatedlineeditor.EntityListener)
+ */
+ @Override
+ public void addDisplayListener(Object entity, EntityListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.dataimport;
+
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+
+/**
+ * @author pplitzner
+ * @date 20.09.2013
+ *
+ */
+public class SpecimenEditorInput implements IEditorInput {
+
+ private List<SpecimenOrObservationBase> results;
+
+ /**
+ * @param results
+ */
+ public SpecimenEditorInput(List<SpecimenOrObservationBase> results) {
+ this.results = results;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Class adapter) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#exists()
+ */
+ @Override
+ public boolean exists() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getName()
+ */
+ @Override
+ public String getName() {
+ return "inputName";
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getPersistable()
+ */
+ @Override
+ public IPersistableElement getPersistable() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getToolTipText()
+ */
+ @Override
+ public String getToolTipText() {
+ return "tooltip";
+ }
+
+ /**
+ * @return the results
+ */
+ public List<SpecimenOrObservationBase> getResults() {
+ return results;
+ }
+
+}
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-package eu.etaxonomy.taxeditor.io.wizard.specimenSearch;
+package eu.etaxonomy.taxeditor.dataimport.wizard;
import java.io.IOException;
import java.net.URISyntaxException;
-import java.util.ArrayList;
import java.util.List;
import org.apache.http.client.ClientProtocolException;
+import org.apache.log4j.Logger;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IImportWizard;
import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import eu.etaxonomy.cdm.ext.biocase.BioCaseQuery;
import eu.etaxonomy.cdm.ext.biocase.BioCaseQueryServiceWrapper;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.taxeditor.dataimport.DataImportEditor;
+import eu.etaxonomy.taxeditor.dataimport.SpecimenEditorInput;
/**
* @author pplitzner
*
*/
public class SpecimenSearchWizard extends Wizard implements IImportWizard {
+ private static final Logger logger = Logger.getLogger(SpecimenSearchWizard.class);
private BioCaseQueryServiceWrapper bioCaseQueryServiceWrapper;
private BioCaseQuery query;
public SpecimenSearchWizard() {
query = new BioCaseQuery();
bioCaseQueryServiceWrapper = new BioCaseQueryServiceWrapper();
- this.results = new ArrayList<SpecimenOrObservationBase>();
+ this.results = getResults();
}
*/
@Override
public boolean performFinish() {
- return false;
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+ try {
+ SpecimenEditorInput input = new SpecimenEditorInput(results);
+ input.getToolTipText();
+ page.openEditor(input, DataImportEditor.ID, true);
+ } catch ( PartInitException e ) {
+ //Put your exception handler here if you wish to
+ }
+ return true;
}
/* (non-Javadoc)
@Override
public void addPages() {
addPage(new SpecimenSearchWizardPage("Specimen Search", results));
- addPage(new SpecimenSearchResultWizardPage("Search Results", results));
}
public List<SpecimenOrObservationBase> getResults(){
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-package eu.etaxonomy.taxeditor.io.wizard.specimenSearch;
+package eu.etaxonomy.taxeditor.dataimport.wizard;
import java.util.List;
eu.etaxonomy.taxeditor.handler,
eu.etaxonomy.taxeditor.io,
eu.etaxonomy.taxeditor.io.wizard,
- eu.etaxonomy.taxeditor.io.wizard.specimenSearch,
eu.etaxonomy.taxeditor.labels,
eu.etaxonomy.taxeditor.model;uses:="eu.etaxonomy.cdm.model.common,eu.etaxonomy.cdm.model.name,eu.etaxonomy.cdm.model.taxon",
eu.etaxonomy.taxeditor.newWizard,
eu.etaxonomy.taxeditor.store.internal,
eu.etaxonomy.taxeditor.store.operations,
eu.etaxonomy.taxeditor.ui.bar,
+ eu.etaxonomy.taxeditor.ui.campanula.specimenSearch,
eu.etaxonomy.taxeditor.ui.combo,
eu.etaxonomy.taxeditor.ui.dialog,
eu.etaxonomy.taxeditor.ui.dialog.selection,
id="eu.etaxonomy.taxeditor.io.import.specimenCdmExcel"
name="Specimen CDM Excel">
</wizard>
- <wizard
- category="eu.etaxonomy.taxeditor.import.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.specimenSearch.SpecimenSearchWizard"
- id="eu.etaxonomy.taxeditor.io.wizard.specimenSearch.SpecimenSearchWizard"
- name="Specimen Search">
- </wizard>
</extension>
<extension
point="org.eclipse.ui.exportWizards">
// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
private Abcd206ImportConfigurator configurator;
private ImportFromFileDataSourceWizardPage dataSourcePage;
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#getConfigurator()
*/
@Override
public boolean performFinish() {
URI source = dataSourcePage.getUri();
+// InputStream inputStream = new FileInputStream(new File(source));
configurator.setSource(source);
configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
-
+
CdmStore.getImportManager().run(configurator);
return true;
-
+
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
*/
/** {@inheritDoc} */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
super.init(workbench, selection);
configurator = CdmStore.getImportManager().AbcdConfigurator();
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.io.AbstractImportWizard#addPages()
*/
@Override
public void addPages() {
super.addPages();
-
+
dataSourcePage = ImportFromFileDataSourceWizardPage.XML();
addPage(dataSourcePage);
}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2013 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.io.wizard.specimenSearch;
-
-import java.util.List;
-
-import org.eclipse.jface.dialogs.IPageChangedListener;
-import org.eclipse.jface.dialogs.PageChangedEvent;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.widgets.Composite;
-
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.taxeditor.ui.campanula.specimenSearch.SpecimenSearchResultsController;
-
-/**
- * @author pplitzner
- * @date 12.09.2013
- *
- */
-public class SpecimenSearchResultWizardPage extends WizardPage implements IPageChangedListener {
-
- private SpecimenSearchResultsController specimenSearchResultsController;
- private List<SpecimenOrObservationBase> results;
-
- /**
- * @param pageName
- */
- protected SpecimenSearchResultWizardPage(String pageName, List<SpecimenOrObservationBase> results) {
- super(pageName);
- this.results = results;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createControl(Composite parent) {
- specimenSearchResultsController = new SpecimenSearchResultsController(parent);
- setControl(specimenSearchResultsController.getComposite());
- }
-
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IPageChangedListener#pageChanged(org.eclipse.jface.dialogs.PageChangedEvent)
- */
- @Override
- public void pageChanged(PageChangedEvent event) {
- if(isCurrentPage()){
- if(results!=null && !results.isEmpty()){
- specimenSearchResultsController.setText(results.get(0).getTitleCache());
- }
- }
- };
-}
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.ui.campanula.basicFields.ComboDefinedTermController;
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.EntitySelectionFieldController;
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.TextFieldController;
import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
private TextFieldController barCode;
private TextFieldController catalogNumber;
- private ComboDefinedTermController<PreservationMethod> preservationMethod;
+// private ComboDefinedTermController<PreservationMethod> preservationMethod;
private EntitySelectionFieldController<TaxonNameBase> storedUnder;
private TextFieldController exsiccatum;
AbstractUtility.info(e.getMessage());
entityPreservationMethod = null;
}
- preservationMethod = new ComboDefinedTermController<PreservationMethod>(derivedUnitDetailsElement.getComboPreservationMethod(), getFormFactory(), formElement, PreservationMethod.class, entityPreservationMethod, style);
+// preservationMethod = new ComboDefinedTermController<PreservationMethod>(derivedUnitDetailsElement.getComboPreservationMethod(), getFormFactory(), formElement, PreservationMethod.class, entityPreservationMethod, style);
storedUnder = new EntitySelectionFieldController<TaxonNameBase>(derivedUnitDetailsElement.getStoredUnderSelectionField(), getFormFactory(), getConversationHolder(), formElement, TaxonNameBase.class, entity.getStoredUnder(), EntitySelectionElement.ALL);
String entitiyExsiccatum;
try {
getEntity().setBarcode(barCode.getText());
} else if (eventSource == catalogNumber) {
getEntity().setCatalogNumber(catalogNumber.getText());
- } else if (eventSource == preservationMethod) {
- try {
- getEntity().setPreservationMethod(preservationMethod.getSelection());
- } catch (MethodNotSupportedByDerivedUnitTypeException e) {
- AbstractUtility.errorDialog("MethodNotSupportedByDerivedUnitTypeException", this, "MethodNotSupportedByDerivedUnitTypeException when trying to set preservation method for derive unit", e);
- }
+// } else if (eventSource == preservationMethod) {
+// try {
+// getEntity().setPreservationMethod(preservationMethod.getSelection());
+// } catch (MethodNotSupportedByDerivedUnitTypeException e) {
+// AbstractUtility.errorDialog("MethodNotSupportedByDerivedUnitTypeException", this, "MethodNotSupportedByDerivedUnitTypeException when trying to set preservation method for derive unit", e);
+// }
} else if (eventSource == storedUnder) {
getEntity().setStoredUnder(storedUnder.getEntity());
} else if (eventSource == exsiccatum) {