+++ /dev/null
-/**
- * Copyright (C) 2007 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.editor.key.polytomous;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.IFormPart;
-import org.eclipse.ui.forms.IManagedForm;
-
-import eu.etaxonomy.cdm.common.CdmUtils;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.description.KeyStatement;
-import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ISelectable;
-import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
-
-/**
- * @author n.hoffmann
- * @created Apr 13, 2011
- * @version 1.0
- */
-public class PolytomousKeyListItem extends AbstractCdmFormElement implements
- IFormPart, ISelectable {
-
- private boolean dirty;
- private final PolytomousKeyNode entity;
-
- private SelectionListener linkSelectionListener;
-
- /**
- * @param formFactory
- * @param layoutComposite
- */
- protected PolytomousKeyListItem(CdmFormFactory formFactory,
- Composite layoutComposite, PolytomousKeyNode entity) {
- super(formFactory, layoutComposite);
-
- // layoutComposite.setBackground(Display.getDefault().getSystemColor(
- // SWT.COLOR_CYAN));
-
- this.entity = HibernateProxyHelper.deproxy(entity);
-
- Label label_nodeNumber = new Label(getLayoutComposite(), SWT.NULL);
- label_nodeNumber.setText(getItemNumber());
-
- Label label_question = new Label(getLayoutComposite(), SWT.NULL);
- label_question.setText(getItemQuestion());
-
- Label label_statement = new Label(getLayoutComposite(), SWT.NULL);
- label_statement.setText(getItemStatement());
- label_statement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
-
- Link link = new Link(getLayoutComposite(), SWT.NONE);
- link.setText("<a>" + getItemLink() + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
- link.setData(getItemLinkData());
- link.addSelectionListener(getLinkSelectionListener());
-
- // Label label_link = new Label(getLayoutComposite(), SWT.NULL);
- // label_link.setText(link);
-
- }
-
- /**
- * @return
- */
- private SelectionListener getLinkSelectionListener() {
- if (linkSelectionListener == null) {
- linkSelectionListener = new SelectionAdapter() {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org
- * .eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- Object data = e.widget.getData();
-
- if (data instanceof Taxon) {
- EditorUtil.openTaxonBaseE4(((Taxon) data).getUuid());
- }
- }
- };
- }
- return linkSelectionListener;
- }
-
- private String getItemNumber() {
- if (isParentRoot()) {
- return "root"; //$NON-NLS-1$
- } else {
- PolytomousKeyNode parent = getParent();
- String itemNumber = parent.getNodeNumber() != null ? parent
- .getNodeNumber().toString() : "NaN"; //$NON-NLS-1$
-
- int index = parent.getChildren().indexOf(entity);
-
- for (int i = 0; i < index; i++) {
- itemNumber += "'"; //$NON-NLS-1$
- }
-
- return itemNumber;
- }
- }
-
- private String getItemQuestion() {
- if (isParentRoot()) {
- return ""; //$NON-NLS-1$
- } else {
- KeyStatement question = getParent().getQuestion();
- return question != null ? question.getLabelText(CdmStore
- .getDefaultLanguage()) : ""; //$NON-NLS-1$
- }
-
- }
-
- private String getItemStatement() {
- KeyStatement statement = entity.getStatement();
- return statement != null ? CdmUtils.Nz(statement.getLabelText(CdmStore
- .getDefaultLanguage())) : Messages.PolytomousKeyListItem_NO_STATEMENT;
- }
-
- private String getItemLink() {
- String taxonString = entity.getTaxon() != null ? entity.getTaxon()
- .getName().getTitleCache() : Messages.PolytomousKeyListItem_TAXON_EMPTY;
-
- return entity.getChildren().isEmpty() ? taxonString : entity
- .getNodeNumber().toString();
- }
-
- /**
- * @return
- */
- private Object getItemLinkData() {
- return entity.getChildren().isEmpty() ? entity.getTaxon() : entity
- .getChildAt(0);
- }
-
- private PolytomousKeyNode getParent() {
- return entity.getParent();
- }
-
- private boolean isParentRoot() {
- return getParent() == null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.forms.IFormPart#initialize(org.eclipse.ui.forms.IManagedForm
- * )
- */
- @Override
- public void initialize(IManagedForm form) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.IFormPart#isDirty()
- */
- @Override
- public boolean isDirty() {
- return dirty;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.IFormPart#commit(boolean)
- */
- @Override
- public void commit(boolean onSave) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.IFormPart#setFormInput(java.lang.Object)
- */
- @Override
- public boolean setFormInput(Object input) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.IFormPart#setFocus()
- */
- @Override
- public void setFocus() {
- // TODO Auto-generated method stub
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.IFormPart#isStale()
- */
- @Override
- public boolean isStale() {
- // TODO Auto-generated method stub
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.IFormPart#refresh()
- */
- @Override
- public void refresh() {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.IFormPart#dispose()
- */
- @Override
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * @return the entity
- */
- public PolytomousKeyNode getEntity() {
- return entity;
- }
-
- @Override
- public void setSelected(boolean selected) {
- setBackground(selected ? SELECTED : getPersistentBackground());
- }
-
-}
+++ /dev/null
-/**
- * Copyright (C) 2007 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.editor.name.container;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IUndoManager;
-import org.eclipse.jface.text.IUndoManagerExtension;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.TextViewerUndoManager;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.AnnotationModel;
-import org.eclipse.jface.text.source.AnnotationPainter;
-import org.eclipse.jface.text.source.IAnnotationAccess;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-import org.eclipse.ui.operations.OperationHistoryActionHandler;
-import org.eclipse.ui.operations.RedoActionHandler;
-import org.eclipse.ui.operations.UndoActionHandler;
-import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.ViewerConfiguration;
-import eu.etaxonomy.taxeditor.editor.name.container.EditorAnnotation.EditorAnnotationType;
-import eu.etaxonomy.taxeditor.preference.Resources;
-
-/**
- * SourceViewer implementation called by NameComposite.
- *
- * @author p.ciardelli
- * @created 27.05.2008
- * @version 1.0
- */
-public class NameViewer extends SourceViewer {
-
- /** Constant <code>RULER_WIDTH=16</code> */
- public static final int RULER_WIDTH = 16;
-
- private final IVerticalRuler ruler;
- private final AnnotationModel annotationModel;
-
- /**
- * <p>Constructor for NameViewer.</p>
- *
- * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
- */
- public NameViewer(Composite parent) {
- super(parent, new RulerWithIcon(RULER_WIDTH), SWT.WRAP | SWT.MULTI | SWT.RESIZE);
-
- this.ruler = getVerticalRuler();
-
- setBackground(EditorUtil.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
-
- Canvas canvas = (Canvas) getControl();
- TableWrapLayout layout = (TableWrapLayout) canvas.getLayout();
- layout.topMargin = 0;
- layout.rightMargin = 0;
- layout.bottomMargin = 0;
- layout.leftMargin = 0;
- layout.verticalSpacing = 10;
- layout.horizontalSpacing = 0;
-
- canvas.setLayout(layout);
-
- // Lay out the viewer's widgets
- TableWrapData twdata = new TableWrapData(TableWrapData.FILL_GRAB);
- getControl().setLayoutData(twdata);
-
- twdata = new TableWrapData(TableWrapData.FILL_GRAB);
- getTextWidget().setLayoutData(twdata);
- getTextWidget().setLineSpacing(5);
-
- // Default implementation adds ruler after the text widget, then
- // uses a custom layout to display it before the text widget
- ruler.getControl().moveAbove(getTextWidget());
-
- annotationModel = new AnnotationModel();
- this.setDocument(new Document(""), annotationModel); //$NON-NLS-1$
-
- createAnnotationPainter();
-
- this.configure(new ViewerConfiguration());
-
-// setDecorationSupport();
-// DocumentUndoManagerRegistry.connect(this.getDocument());
-// IDocumentUndoManager docUndoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(this.getDocument());
-
- /**
- getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.UNDO.getId(), new UndoActionHandler(getSite(), undoContext));
- getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.REDO.getId(), new RedoActionHandler(getSite(), undoContext));
- **/
- }
-
- /**
- * <p>setBackground</p>
- *
- * @param color a {@link org.eclipse.swt.graphics.Color} object.
- */
- public void setBackground(Color color) {
-
- // Set background color of ruler
- ruler.getControl().setBackground(color);
-
- // Set background color of text widget
- getTextWidget().setBackground(color);
-
- // Set background color of strip between ruler and textWidget
- getTextWidget().getParent().setBackground(color);
- }
-
- /**
- * <p>getRulerControl</p>
- *
- * @return a {@link org.eclipse.swt.widgets.Control} object.
- */
- public Control getRulerControl() {
- return ruler.getControl();
- }
-
- /**
- * <p>setIcon</p>
- *
- * @param icon a {@link org.eclipse.swt.graphics.Image} object.
- */
- public void setIcon(Image icon) {
- if (ruler instanceof RulerWithIcon) {
- ((RulerWithIcon) ruler).setIcon(icon);
- } else {
- throw new IllegalStateException("Viewer's IVerticalRuler is not an instance of RulerWithIcon."); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.source.SourceViewer#createLayout()
- */
- /**
- * <p>createLayout</p>
- *
- * @return a {@link org.eclipse.swt.widgets.Layout} object.
- */
- @Override
- protected Layout createLayout() {
- TableWrapLayout layout = new TableWrapLayout();
- layout.numColumns = 2;
- layout.verticalSpacing = 0;
- return layout;
- }
-
- private void createAnnotationPainter(){
- // Annotations section
- IAnnotationAccess fAnnotationAccess = new DefaultMarkerAnnotationAccess();
-
- // To paint the annotations
- AnnotationPainter annotationPainter = new AnnotationPainter(this, fAnnotationAccess);
-
- // Default SquigglesStrategy doesn't recognize line wraps
- annotationPainter.addDrawingStrategy(LineWrapSquigglesStrategy.ID, new LineWrapSquigglesStrategy());
-
- // Add ability to paint red squigglies
- annotationPainter.addAnnotationType(EditorAnnotationType.ERROR.name(), LineWrapSquigglesStrategy.ID);
- annotationPainter.setAnnotationTypeColor(EditorAnnotationType.ERROR.image,
- new Color(Display.getDefault(), EditorAnnotationType.ERROR.color));
-
- // Add ability to paint yellow squigglies
- annotationPainter.addAnnotationType(EditorAnnotationType.WARNING.name(), LineWrapSquigglesStrategy.ID);
- annotationPainter.setAnnotationTypeColor(EditorAnnotationType.WARNING.image,
- new Color(Display.getDefault(), EditorAnnotationType.WARNING.color));
-
- this.addPainter(annotationPainter);
- }
-
-
- /**
- * <p>clearAnnotations</p>
- */
- public void clearAnnotations() {
- Iterator<Annotation> annotations = this.getAnnotationModel().getAnnotationIterator();
- while (annotations.hasNext()) {
- Annotation annotation = annotations.next();
- this.getAnnotationModel().removeAnnotation(annotation);
- }
- }
-
- /**
- * If <code>name.hasProblem()</code> is <code>true</code>, underlines section
- * of text bounded by <code>name.getProblemStarts()</code> and
- * <code>name.getProblemEnds()</code>.
- *
- * @param name a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
- */
-// public void setShowParsingErrors(TaxonNameBase<?, ?> name) {
-//
-// String text = this.getTextWidget().getText();
-//
-// if (name.hasProblem() && text.length() > 0) {
-// int start = name.getProblemStarts();
-// int length = name.getProblemEnds() - start;
-//
-// if (start == -1 || name.getProblemEnds() == -1) {
-// return;
-// }
-//
-// // Don't let squigglies try to draw beyond the end of the text
-// if (text.length() < start + length) {
-// length = text.length() - start;
-// }
-//
-// for (ParserProblem problem : name.getParsingProblems()) {
-//
-// String type = null;
-// if (problem.isWarning()) {
-// type = EditorAnnotation.WARNING_TYPE;
-// }
-// if (problem.isError()) {
-// type = EditorAnnotation.ERROR_TYPE;
-// }
-// if (type == null) {
-// continue;
-// }
-// this.getAnnotationModel().addAnnotation(
-// new EditorAnnotation(type, 0, problem.getMessage()),
-// new Position(start, length));
-// }
-//
-// }
-// }
-
- public void addAnnotation(EditorAnnotation annotation){
- addAnnotation(annotation, null);
- }
-
- public void addAnnotation(EditorAnnotation annotation, Position position){
- if(position == null){
- position = new Position(0, 0);
- }
-
- this.getAnnotationModel().addAnnotation(annotation, position);
- }
-
- /**
- * <p>setText</p>
- *
- * @param text a {@link java.lang.String} object.
- */
- public void setText(String text) {
- if (text == null) {
- text = ""; //$NON-NLS-1$
- }
- try {
- Assert.isNotNull(text);
- // TODO figure out why getTextWidget() returns null!
- if (this.getTextWidget() == null) {
- return;
- }
- Assert.isNotNull(this.getTextWidget());
- this.getTextWidget().setText(text);
- } catch (RuntimeException e) {
- throw e;
- }
- }
-
- /**
- * <p>setMenu</p>
- *
- * @param menu a {@link org.eclipse.swt.widgets.Menu} object.
- */
- public void setMenu(Menu menu) {
- getRulerControl().setMenu(menu);
- getTextWidget().setMenu(menu);
- }
-
- /**
- * <p>setCursorToEOL</p>
- */
- public void setCursorToEOL() {
- getTextWidget().setCaretOffset(getTextWidget().getText().length());
- }
-
-
- /**
- * <p>getCursorPosition</p>
- *
- * @return a int.
- */
- public int getCursorPosition(){
- return getTextWidget().getCaretOffset();
- }
-
- /**
- * <p>setCursorPosition</p>
- *
- * @param offset a int.
- */
- public void setCursorPosition(int offset){
- try{
- getTextWidget().setCaretOffset(offset);
- }catch(IllegalArgumentException e){
- // do nothing
- }
- }
-
- /**
- * <p>createUndoSupport</p>
- *
- * @param editorSite a {@link org.eclipse.ui.IEditorSite} object.
- */
- public void createUndoSupport(IEditorSite editorSite) {
-
- IUndoManager undoManager = new TextViewerUndoManager(25);
- this.setUndoManager(undoManager);
- undoManager.connect(this);
-
-// IUndoContext workbenchUndoContext = UiUtil.getWorkbenchUndoContext();
-
- IUndoContext workbenchUndoContext = ((IUndoManagerExtension)undoManager).getUndoContext();
-
- OperationHistoryActionHandler undoAction = new UndoActionHandler(editorSite, workbenchUndoContext);
-// undoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.UNDO);
- undoAction.setActionDefinitionId(ActionFactory.UNDO.getId());
-
- // Create the redo action.
- OperationHistoryActionHandler redoAction = new RedoActionHandler(editorSite, workbenchUndoContext);
-// redoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.REDO);
- undoAction.setActionDefinitionId(ActionFactory.REDO.getId());
-
- IActionBars actionBars = editorSite.getActionBars();
- if (actionBars != null) {
-// actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.UNDO, undoAction);
-// actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.REDO, redoAction);
- actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
- actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);
-
- }
-
-// actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
-// actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);
- }
-
- /**
- * <p>createUndoSupport_</p>
- *
- * @param editorSite a {@link org.eclipse.ui.IEditorSite} object.
- */
- public void createUndoSupport_(IEditorSite editorSite) {
- IUndoManager undoManager = new TextViewerUndoManager(25);
- this.setUndoManager(undoManager);
- undoManager.connect(this);
- IUndoContext undoContext;
- if (undoManager instanceof IUndoManagerExtension) {
- undoContext = ((IUndoManagerExtension)undoManager).getUndoContext();
-
- OperationHistoryActionHandler undoAction = new UndoActionHandler(editorSite, undoContext);
-// PlatformUI.getWorkbench().getHelpSystem().setHelp(undoAction, IAbstractTextEditorHelpContextIds.UNDO_ACTION);
- undoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.UNDO);
-
- // Create the redo action.
- OperationHistoryActionHandler redoAction = new RedoActionHandler(editorSite, undoContext);
-// PlatformUI.getWorkbench().getHelpSystem().setHelp(redoAction, IAbstractTextEditorHelpContextIds.REDO_ACTION);
- redoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.REDO);
-
-
- IActionBars actionBars = editorSite.getActionBars();
- if (actionBars != null) {
- actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.UNDO, undoAction);
- actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.REDO, redoAction);
-
- }
- }
- }
-
-}
-
+++ /dev/null
-/**
- *
- */
-package eu.etaxonomy.taxeditor.editor.view.concept.handler;
-
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.handlers.IHandlerService;
-
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>Abstract AbstractDynamicConceptRelationMenu class.</p>
- *
- * @author n.hoffmann
- * @created 17.04.2009
- * @version 1.0
- */
-public abstract class AbstractDynamicConceptRelationMenu extends ContributionItem {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets.Menu, int)
- */
- /** {@inheritDoc} */
- @Override
- public void fill(Menu menu, int index){
- final IHandlerService handlerService = (IHandlerService) TaxeditorEditorPlugin.getDefault().getWorkbench().getService(IHandlerService.class);
- /*
- for(final TaxonRelationshipTypeInverseContainer container : CdmStore.getTermManager().getPreferredTerms(TaxonRelationshipTypeInverseContainer.class)){
- MenuItem menuItem = new MenuItem(menu, -1);
- menuItem.setText(container.getTitleCache());
- menuItem.setData(container);
- menuItem.addSelectionListener(new SelectionListener(){
-
- public void widgetDefaultSelected(SelectionEvent e) {}
-
- public void widgetSelected(SelectionEvent ev) {
- Event event = new Event();
- event.data = container;
- try {
- handlerService.executeCommand(getCommandName(), event);
- } catch (Exception e) {
- EditorUtil.error(getClass(), "Error executing command", e);
- }
- }
- });
- */
- for(final TaxonRelationshipType taxonRelationshipType: CdmStore.getTermManager().getPreferredTerms(TaxonRelationshipType.class)){
- if (!taxonRelationshipType.equals(TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN())){
- MenuItem menuItem = new MenuItem(menu, -1);
- menuItem.setText(taxonRelationshipType.getTitleCache());
- menuItem.setData(taxonRelationshipType);
- menuItem.addSelectionListener(new SelectionListener(){
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {}
-
- @Override
- public void widgetSelected(SelectionEvent ev) {
- Event event = new Event();
- event.data = taxonRelationshipType;
- try {
- handlerService.executeCommand(getCommandName(), event);
- } catch (Exception e) {
- MessagingUtils.error(getClass(), "Error executing command", e); //$NON-NLS-1$
- }
- }
- });
- }
- }
- }
-
- /**
- * <p>getCommandName</p>
- *
- * @return a {@link java.lang.String} object.
- */
- public abstract String getCommandName();
-
-}