From 8cd7ecefdfa14a3bc4ff8fed9b944e67d8461f15 Mon Sep 17 00:00:00 2001 From: "p.ciardelli" Date: Tue, 10 Jun 2008 16:13:15 +0000 Subject: [PATCH] --- .gitattributes | 1 - .../CustomSortPropertySheetEntry.java | 10 +- .../NameRelationsDialog.java | 180 ------------------ .../NameRelationsPropertyDescriptor.java | 8 +- .../NameRelationsPropertySource.java | 1 - .../NonViralNamePropertySource.java | 2 +- 6 files changed, 8 insertions(+), 194 deletions(-) delete mode 100644 eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsDialog.java diff --git a/.gitattributes b/.gitattributes index d342bbd5c..4384eebb4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -469,7 +469,6 @@ eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertys eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/CompletionProcessor.java -text eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/CustomSortPropertySheetEntry.java -text eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/MarkersPropertySource.java -text -eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsDialog.java -text eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsPropertyDescriptor.java -text eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsPropertySource.java -text eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NomStatusPropertySource.java -text diff --git a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/CustomSortPropertySheetEntry.java b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/CustomSortPropertySheetEntry.java index 047feaa2f..9a6b1d7c0 100644 --- a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/CustomSortPropertySheetEntry.java +++ b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/CustomSortPropertySheetEntry.java @@ -36,12 +36,14 @@ public class CustomSortPropertySheetEntry extends PropertySheetEntry { // currentThread.getStackTrace()[1] = getDisplayName // currentThread.getStackTrace()[2] = who is calling getDisplayName - if (stackRequestingName.toString().lastIndexOf("compare") != -1) + if (stackRequestingName.toString().lastIndexOf("compare") != -1) { return displayName; + } - int colon = displayName.lastIndexOf(':'); - if (colon != -1) - displayName = displayName.substring(colon + 1); + int colon = displayName.lastIndexOf(':'); + if (colon != -1) { + displayName = displayName.substring(colon + 1); + } return displayName; } diff --git a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsDialog.java b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsDialog.java deleted file mode 100644 index 9956dc690..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsDialog.java +++ /dev/null @@ -1,180 +0,0 @@ -package eu.etaxonomy.taxeditor.view.propertysheetsupport; - -import java.util.HashSet; -import java.util.Set; - -import org.apache.log4j.Logger; -import org.eclipse.core.databinding.beans.BeansObservables; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.map.IObservableMap; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.text.source.SourceViewer; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Dialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; - -import eu.etaxonomy.cdm.model.common.Annotation; -import eu.etaxonomy.cdm.model.name.NameRelationship; -import eu.etaxonomy.cdm.model.name.NameRelationshipType; -import eu.etaxonomy.cdm.model.taxon.Taxon; -import eu.etaxonomy.taxeditor.TaxEditorPlugin; - -public class NameRelationsDialog extends Dialog { - private List relationList; - private Table table; - private static final Logger logger = Logger - .getLogger(NameRelationsDialog.class); - protected Object result; - protected Shell shell; - - private WritableList list = new WritableList(); - - /** - * Create the dialog - * @param parent - * @param style - */ - public NameRelationsDialog(Shell parent, int style) { - super(parent, style); - } - - /** - * Create the dialog - * @param parent - */ - public NameRelationsDialog(Shell parent) { - this(parent, SWT.NONE); - } - - public NameRelationsDialog(Shell parent, Set nameRelationships) { - this(parent, SWT.NONE); - for (NameRelationship nameRelationship : nameRelationships) { - list.add(nameRelationship); - } - } - - /** - * Open the dialog - * @return the result - */ - public Object open() { - createContents(); - shell.open(); - shell.layout(); - Display display = getParent().getDisplay(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - return result; - } - - /** - * Create contents of the dialog - */ - protected void createContents() { - shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); - shell.setLayout(new FillLayout()); - shell.setSize(500, 375); - shell.setText("Name Relations"); - - final Composite composite = new Composite(shell, SWT.NONE); - final GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 2; - composite.setLayout(gridLayout); - for (NameRelationshipType relationType : TaxEditorPlugin.getDefault().getNameRelationshipTypeVocabulary()) { - combo.add(relationType.getLabel()); - } - new Label(composite, SWT.NONE); - -// sourceViewer = new Text(composite, SWT.BORDER); - - final Button btnAdd = new Button(composite, SWT.NONE); - final GridData gd_btnAdd = new GridData(SWT.RIGHT, SWT.CENTER, false, false); - btnAdd.setLayoutData(gd_btnAdd); - btnAdd.setText("Add ..."); - btnAdd.addMouseListener(new MouseAdapter() { - @Override - public void mouseDown(MouseEvent e) { -// NameRelationship annotation = NameRelationship.NewInstance(sourceViewer.getTextWidget().getText(), null); -// list.add(annotation); -// sourceViewer.getTextWidget().setText(""); - } - }); - - final TableViewer tableViewer = new TableViewer(composite, SWT.BORDER); - table = tableViewer.getTable(); - table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); - table.setLinesVisible(true); - table.setHeaderVisible(true); - - new TableColumn(table, SWT.NONE).setWidth(190); - new TableColumn(table, SWT.NONE).setWidth(100); - new TableColumn(table, SWT.NONE).setWidth(190); - - ObservableListContentProvider providerList = new ObservableListContentProvider(); - tableViewer.setContentProvider(providerList); - - IObservableMap[] providerMaps = BeansObservables.observeMaps( - providerList.getKnownElements(), NameRelationship.class, new String[]{"fromName", "toName", "type"}); - tableViewer.setLabelProvider(new ObservableMapLabelProvider(providerMaps) { - public String getColumnText(Object element, int columnIndex) { - NameRelationship nameRelationship = (NameRelationship) element; - String returnString = null; - switch (columnIndex) { - case 0 : - String fromName = nameRelationship.getFromName().getTitleCache(); - returnString = fromName; - break; - case 1 : - String relationshipType = nameRelationship.getType().getLabel(); - returnString = " is " + relationshipType + " of "; - break; - case 2 : - String toName = nameRelationship.getToName().getTitleCache(); - returnString = toName; - } - return returnString; - } - }); - tableViewer.setInput(list); - - final Button cancelButton = new Button(composite, SWT.NONE); - cancelButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); - cancelButton.setText("Cancel"); - cancelButton.addMouseListener(new MouseAdapter() { - @Override - public void mouseUp(MouseEvent e) { - shell.dispose(); - } - }); - - final Button okButton = new Button(composite, SWT.NONE); - final GridData gd_okButton = new GridData(); - okButton.setLayoutData(gd_okButton); - okButton.setText("OK"); - okButton.addMouseListener(new MouseAdapter() { - @Override - public void mouseUp(MouseEvent e) { - result = new HashSet(list); - shell.dispose(); - } - }); - } -} \ No newline at end of file diff --git a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsPropertyDescriptor.java b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsPropertyDescriptor.java index 149ca9fa2..2142629e6 100644 --- a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsPropertyDescriptor.java +++ b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsPropertyDescriptor.java @@ -49,13 +49,7 @@ abstract public class NameRelationsPropertyDescriptor extends PropertyDescriptor @Override protected Object openDialogBox( Control cellEditorWindow) { -// dialog = new NameRelationsDialog(cellEditorWindow.getShell(), name.getNameRelations()); -// Object value = ((NameRelationsDialog) dialog).open(); -// if (value instanceof Set) { -// logger.warn("Dialog returned set with " + ((Set) value).size() + " elements."); -// saveNameRelations((Set) value); -// } -// NameRelationWizard wizard = new NameRelationWizard(); + new OpenNameRelationsListWizardAction(name).run(); return null; } diff --git a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsPropertySource.java b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsPropertySource.java index e469da367..92931051d 100644 --- a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsPropertySource.java +++ b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NameRelationsPropertySource.java @@ -31,7 +31,6 @@ public class NameRelationsPropertySource extends CollectionPropertySource { } } return itemDisplayName; - // TODO sort out difference b/w to and from rels } @Override diff --git a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NonViralNamePropertySource.java b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NonViralNamePropertySource.java index d3c9d46dc..b18d0521a 100644 --- a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NonViralNamePropertySource.java +++ b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/propertysheetsupport/NonViralNamePropertySource.java @@ -145,7 +145,7 @@ public class NonViralNamePropertySource implements IPropertySource { List nomStatusTypesList = new ArrayList(); nomStatusTypesList.addAll(nomStatusVocabulary.getTerms()); -// // Populate nom status type menu labels + // Populate nom status type menu labels List nomStatusTypesMenuList = new ArrayList(); for (NomenclaturalStatusType nomStatusType : nomStatusTypesList) { nomStatusTypesMenuList.add(nomStatusType.getLabel()); -- 2.34.1