From: jenkins Date: Mon, 13 Mar 2017 11:32:48 +0000 (+0100) Subject: Merge branch 'release/4.6.0' X-Git-Tag: 4.6.0^0 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/2cd2eb2b3ce1fa60598817257feaee54676ea2df?hp=8bbae35693ea75f2783d38abe2e694398390937f Merge branch 'release/4.6.0' --- diff --git a/.gitignore b/.gitignore index a8aaf71ff..8ba1a0ec2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,11 @@ .project +.classpath integration-test.log eu.etaxonomy.taxeditor.cdmlib/src/main/resources/etc/jetty/* .settings target .directory +bin eu.etaxonomy.taxeditor.cdmlib/cdmlib-*.jar eu.etaxonomy.taxeditor.cdmlib/cdmlib-*.zip eu.etaxonomy.taxeditor.cdmlib/dist diff --git a/eu.etaxonomy.taxeditor.application/.classpath b/eu.etaxonomy.taxeditor.application/.classpath index 6bca977be..a9750fff5 100644 --- a/eu.etaxonomy.taxeditor.application/.classpath +++ b/eu.etaxonomy.taxeditor.application/.classpath @@ -1,6 +1,6 @@ - + diff --git a/eu.etaxonomy.taxeditor.application/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.application/META-INF/MANIFEST.MF index d06acdf25..a4db3394c 100644 --- a/eu.etaxonomy.taxeditor.application/META-INF/MANIFEST.MF +++ b/eu.etaxonomy.taxeditor.application/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Application Bundle-SymbolicName: eu.etaxonomy.taxeditor.application;singleton:=true -Bundle-Version: 4.5.1 +Bundle-Version: 4.6.0 Bundle-Activator: eu.etaxonomy.taxeditor.TaxonomicEditorPlugin Bundle-Vendor: EDIT Bundle-Localization: OSGI-INF/l10n/plugin diff --git a/eu.etaxonomy.taxeditor.application/plugin.xml b/eu.etaxonomy.taxeditor.application/plugin.xml index d5ced8dd8..fdad8b284 100644 --- a/eu.etaxonomy.taxeditor.application/plugin.xml +++ b/eu.etaxonomy.taxeditor.application/plugin.xml @@ -244,6 +244,21 @@ + + + + + + + + + + diff --git a/eu.etaxonomy.taxeditor.application/pom.xml b/eu.etaxonomy.taxeditor.application/pom.xml index cc9c8a036..37f5f9de5 100644 --- a/eu.etaxonomy.taxeditor.application/pom.xml +++ b/eu.etaxonomy.taxeditor.application/pom.xml @@ -3,7 +3,7 @@ eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 4.0.0 diff --git a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchAdvisor.java b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchAdvisor.java index 02d13bd9f..d6baf5fef 100644 --- a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchAdvisor.java +++ b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchAdvisor.java @@ -168,8 +168,8 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { MessagingUtils.REMOTE_ACCESS_FAILURE_MESSAGE + System.getProperty("line.separator"), pluginId, t, - true, - false); + false, + true); return true; } return false; diff --git a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/admin/UserGroupContributionItem.java b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/admin/UserGroupContributionItem.java new file mode 100644 index 000000000..4b99ceb89 --- /dev/null +++ b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/admin/UserGroupContributionItem.java @@ -0,0 +1,35 @@ +// $Id$ +/** +* Copyright (C) 2017 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.admin; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.action.IContributionItem; + +import eu.etaxonomy.taxeditor.bulkeditor.command.OpenBulkEditorContributionItem; +import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType; + +/** + * @author pplitzner + * @date Mar 9, 2017 + * + */ +public class UserGroupContributionItem extends OpenBulkEditorContributionItem { + + /** {@inheritDoc} */ + @Override + protected IContributionItem[] getContributionItems() { + List contributionItems = new ArrayList(); + contributionItems.add(BulkEditorInputType.USER.createContributionItem()); + contributionItems.add(BulkEditorInputType.GROUP.createContributionItem()); + return contributionItems.toArray(new IContributionItem[contributionItems.size()]); + } +} diff --git a/eu.etaxonomy.taxeditor.bulkeditor/.classpath b/eu.etaxonomy.taxeditor.bulkeditor/.classpath index 264aebb56..a3ec70cfe 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/.classpath +++ b/eu.etaxonomy.taxeditor.bulkeditor/.classpath @@ -1,6 +1,6 @@ - + diff --git a/eu.etaxonomy.taxeditor.bulkeditor/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.bulkeditor/META-INF/MANIFEST.MF index 0c072823f..084a95da9 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/META-INF/MANIFEST.MF +++ b/eu.etaxonomy.taxeditor.bulkeditor/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Bulkeditor Bundle Bundle-SymbolicName: eu.etaxonomy.taxeditor.bulkeditor;singleton:=true -Bundle-Version: 4.5.1 +Bundle-Version: 4.6.0 Bundle-Activator: eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin Bundle-Vendor: EDIT Export-Package: eu.etaxonomy.taxeditor.annotatedlineeditor, diff --git a/eu.etaxonomy.taxeditor.bulkeditor/build.properties b/eu.etaxonomy.taxeditor.bulkeditor/build.properties index 03f8b95ae..bc338967a 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/build.properties +++ b/eu.etaxonomy.taxeditor.bulkeditor/build.properties @@ -7,6 +7,6 @@ bin.includes = META-INF/,\ p2.inf,\ OSGI-INF/l10n/bundle.properties,\ OSGI-INF/l10n/bundle_de.properties,\ - OSGI-INF/l10n/messages.properties,\ - OSGI-INF/l10n/messages_de.properties + src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties,\ + src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties \ No newline at end of file diff --git a/eu.etaxonomy.taxeditor.bulkeditor/plugin.xml b/eu.etaxonomy.taxeditor.bulkeditor/plugin.xml index abb836ab2..6983d4811 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/plugin.xml +++ b/eu.etaxonomy.taxeditor.bulkeditor/plugin.xml @@ -539,9 +539,19 @@ class="eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForIdentifiableEntity" commandId="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity"> - - + + + + + + + + + + diff --git a/eu.etaxonomy.taxeditor.bulkeditor/pom.xml b/eu.etaxonomy.taxeditor.bulkeditor/pom.xml index 0e68d4050..c1fc0b2b6 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/pom.xml +++ b/eu.etaxonomy.taxeditor.bulkeditor/pom.xml @@ -3,7 +3,7 @@ eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 4.0.0 diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/LineAnnotation.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/LineAnnotation.java index 5634b6297..1f4f7ee7f 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/LineAnnotation.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/LineAnnotation.java @@ -14,7 +14,6 @@ import org.apache.log4j.Logger; import org.eclipse.jface.text.source.Annotation; import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase; -import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator; /** * An Annotation which spans an entire line and holds an object associated @@ -40,6 +39,7 @@ public class LineAnnotation extends Annotation implements IEntityContainer private boolean markedAsNew; private T mergeTarget; private DeleteConfiguratorBase configurator= null; + private boolean markAsDelete; /** @@ -264,6 +264,6 @@ public class LineAnnotation extends Annotation implements IEntityContainer public void setDeleteConfigurator(DeleteConfiguratorBase config) { this.configurator = config; - + } } diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/handler/NewObjectHandler.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/handler/NewObjectHandler.java index 9fd646e5f..a83930d07 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/handler/NewObjectHandler.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/handler/NewObjectHandler.java @@ -1,17 +1,14 @@ /** * 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.annotatedlineeditor.handler; -import java.net.URI; -import java.net.URISyntaxException; - import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; @@ -25,6 +22,8 @@ import org.eclipse.ui.handlers.HandlerUtil; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; import eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor; +import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.GroupCreator; +import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.UserCreator; /** *

NewObjectHandler class.

@@ -39,49 +38,50 @@ public class NewObjectHandler extends AbstractHandler { * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) */ /** {@inheritDoc} */ - public Object execute(ExecutionEvent event) throws ExecutionException { - + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); IEditorInput input = editor.getEditorInput(); - + if (editor instanceof AnnotatedLineEditor) { - + Object key = ((Event)event.getTrigger()).data; if (key != null) { if(!(key instanceof SpecimenOrObservationType)) { - String text = ((Event)event.getTrigger()).text; - + String text = ((Event)event.getTrigger()).text; + //FIXME : This should probably go into some ValidatorFactory IInputValidator nonEmptyInputValidator = null; - //FIXME : This is a workaround to not allow empty strings in the - // input dialog for User and Group entities. + //FIXME : This is a workaround to not allow empty strings in the + // input dialog for User and Group entities. // Normally this should be default // behaviour, so we need to discuss whether this handler // should be used to handle the creating new entities of // type other than User and Group. // Once #4348 is fixed this check can be removed. - if(text.equals("User") || text.equals("Group")) { + if(text.equals(UserCreator.USER) || text.equals(GroupCreator.GROUP)) { nonEmptyInputValidator = new IInputValidator() { - public String isValid(String text) { + @Override + public String isValid(String text) { if(text == null || text.isEmpty()) { return "Input cannot be empty"; } return null; - } + } }; } - InputDialog dialog = new InputDialog(HandlerUtil.getActiveShell(event), - "Create " + text, - "Enter new " + text, "", - nonEmptyInputValidator); + InputDialog dialog = new InputDialog(HandlerUtil.getActiveShell(event), + String.format("Create %s", text), String.format("Enter new %s", text), "", + nonEmptyInputValidator); - if (dialog.open() != Window.CANCEL) { - ((AnnotatedLineEditor) editor).createAnnotatedLineNewObject(key, dialog.getValue()); + if (dialog.open() != Window.CANCEL) { + ((AnnotatedLineEditor) editor).createAnnotatedLineNewObject(key, dialog.getValue()); } } else { - ((AnnotatedLineEditor) editor).createAnnotatedLineNewObject(key, "Untitled"); + ((AnnotatedLineEditor) editor).createAnnotatedLineNewObject(key, "Untitled"); } - + } else { ((AnnotatedLineEditor) editor).createAnnotatedLineNewObject(); } diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorSelectionPropertyTester.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorSelectionPropertyTester.java index 1f5b7016e..4a2aee996 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorSelectionPropertyTester.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorSelectionPropertyTester.java @@ -2,6 +2,7 @@ package eu.etaxonomy.taxeditor.bulkeditor.command; import org.eclipse.core.expressions.PropertyTester; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TreeNode; import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache; import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType; @@ -20,6 +21,10 @@ public class BulkEditorSelectionPropertyTester extends PropertyTester { if(selectedElement!=null){ if(selectedElement instanceof UuidAndTitleCache){ return BulkEditorInputType.getByType(((UuidAndTitleCache) selectedElement).getType())!=null; + } + else if(selectedElement instanceof TreeNode){ + System.out.println(BulkEditorInputType.getByType(((TreeNode) selectedElement).getValue().getClass())!=null); + return BulkEditorInputType.getByType(((TreeNode) selectedElement).getValue().getClass())!=null; } return BulkEditorInputType.getByType(selectedElement.getClass())!=null; } diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/OpenBulkEditorContributionItem.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/OpenBulkEditorContributionItem.java index 9ce4ab952..c2b0cbe30 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/OpenBulkEditorContributionItem.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/OpenBulkEditorContributionItem.java @@ -10,25 +10,15 @@ package eu.etaxonomy.taxeditor.bulkeditor.command; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.Separator; -import org.eclipse.swt.SWT; -import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.CompoundContributionItem; -import org.eclipse.ui.menus.CommandContributionItem; -import org.eclipse.ui.menus.CommandContributionItemParameter; -import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants; import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType; /** - *

- * OpenBulkEditorContributionItem class. - *

* * @author p.ciardelli * @created 19.08.2009 @@ -36,32 +26,13 @@ import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType; */ public class OpenBulkEditorContributionItem extends CompoundContributionItem { - /** - *

- * Constructor for OpenBulkEditorContributionItem. - *

- */ public OpenBulkEditorContributionItem() { } - /** - *

- * Constructor for OpenBulkEditorContributionItem. - *

- * - * @param id - * a {@link java.lang.String} object. - */ public OpenBulkEditorContributionItem(String id) { super(id); } - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.actions.CompoundContributionItem#getContributionItems() - */ /** {@inheritDoc} */ @Override protected IContributionItem[] getContributionItems() { @@ -75,29 +46,10 @@ public class OpenBulkEditorContributionItem extends CompoundContributionItem { contributionItems.add(BulkEditorInputType.NAME.createContributionItem()); contributionItems.add(BulkEditorInputType.TAXON.createContributionItem()); contributionItems.add(new Separator(groupName)); - contributionItems.add(BulkEditorInputType.OCCURRENCE.createContributionItem()); - contributionItems.add(new Separator(groupName)); contributionItems.add(BulkEditorInputType.MEDIA.createContributionItem()); contributionItems.add(new Separator(groupName)); - contributionItems.add(BulkEditorInputType.USER.createContributionItem()); - contributionItems.add(BulkEditorInputType.GROUP.createContributionItem()); + contributionItems.add(BulkEditorInputType.OCCURRENCE.createContributionItem()); return contributionItems.toArray(new IContributionItem[contributionItems.size()]); } - /** - * @param key - * @param object - * @return - */ - private IContributionItem createContributionItem(String label, String inputType) { - CommandContributionItemParameter parameter = new CommandContributionItemParameter(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), null, IBulkEditorConstants.DYNAMIC_OPEN_MENU_ID, SWT.NONE); - - parameter.label = label; - - Map parameters = new HashMap(); - parameters.put(IBulkEditorConstants.INPUT_TYPE_PARAMETER_ID, inputType); - parameter.parameters = parameters; - - return new CommandContributionItem(parameter); - } } diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java index 3ced11984..cbc2768ac 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java @@ -25,7 +25,7 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.texteditor.IDocumentProvider; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.api.service.DeleteResult; import eu.etaxonomy.cdm.api.service.IOccurrenceService; import eu.etaxonomy.cdm.api.service.IReferenceService; @@ -54,7 +54,7 @@ import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin; import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.store.CdmStore; -import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog; +import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog; /** @@ -99,7 +99,7 @@ public class DeleteHandler extends AbstractHandler { try { - ICdmApplicationConfiguration controller; + ICdmRepository controller; controller = CdmStore.getCurrentApplicationConfiguration(); if (object instanceof SpecimenOrObservationBase){ IOccurrenceService service = controller.getOccurrenceService(); @@ -124,7 +124,7 @@ public class DeleteHandler extends AbstractHandler { if (object != null){ config = new NameDeletionConfigurator(); - DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the name?\nThis operation is irreversible!", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0); + DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the name?\nThis operation is irreversible!", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0, true); int result_dialog= dialog.open(); if (result_dialog != Status.OK){ return null; @@ -140,7 +140,7 @@ public class DeleteHandler extends AbstractHandler { Synonym synonym = HibernateProxyHelper.deproxy(object, Synonym.class); config = new SynonymDeletionConfigurator(); errorMessage = "The synonym "; - DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the synonym?", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0); + DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the synonym?", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0, true); int result_dialog= dialog.open(); if (result_dialog != Status.OK){ return null; @@ -159,7 +159,7 @@ public class DeleteHandler extends AbstractHandler { config = new TaxonDeletionConfigurator(); ((TaxonDeletionConfigurator) config).setDeleteInAllClassifications(true); DeleteConfiguratorDialog dialog; - dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the taxon?", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0); + dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the taxon?", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0, true); int result_dialog= dialog.open(); if (result_dialog != Status.OK){ return null; @@ -168,13 +168,13 @@ public class DeleteHandler extends AbstractHandler { } } else if (object instanceof TeamOrPersonBase){ - + result = controller.getAgentService().isDeletable(((CdmBase) object).getUuid(), null); errorMessage = "The team or person "; } else if (object instanceof Media){ config = new MediaDeletionConfigurator(); Media media = HibernateProxyHelper.deproxy(object, Media.class); DeleteConfiguratorDialog dialog; - dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the media?", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0); + dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the media?", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0, true); int result_dialog= dialog.open(); if (result_dialog != Status.OK){ return null; diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java index 9dcbd7fde..51806e3cb 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java @@ -151,13 +151,17 @@ public class AgentEditorInput extends AbstractBulkEditorInput @Override public TeamOrPersonBase save(TeamOrPersonBase entity) { return (TeamOrPersonBase) CdmStore.getService(IAgentService.class).merge(entity, true).getMergedEntity(); - + } @Override public boolean delete(TeamOrPersonBase entity, DeleteConfiguratorBase config) throws ReferencedObjectUndeletableException { - return CdmStore.getService(IAgentService.class).delete(entity.getUuid()) != null; + if (entity.getUuid() != null){ + return CdmStore.getService(IAgentService.class).delete(entity.getUuid()) != null; + }else{ + return false; + } } /* (non-Javadoc) diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/BulkEditorInputType.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/BulkEditorInputType.java index ddbbbe9da..25b52c666 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/BulkEditorInputType.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/BulkEditorInputType.java @@ -29,6 +29,7 @@ import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; import eu.etaxonomy.cdm.model.reference.Reference; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants; +import eu.etaxonomy.taxeditor.l10n.Messages; public enum BulkEditorInputType { AGENT(Messages.BulkEditorInputType_0, AgentEditorInput.ID), diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/OccurrenceEditorInput.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/OccurrenceEditorInput.java index e535191f1..9464f3387 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/OccurrenceEditorInput.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/OccurrenceEditorInput.java @@ -31,7 +31,6 @@ import eu.etaxonomy.taxeditor.store.CdmStore; * * @author n.hoffmann * @created Jun 16, 2010 - * @version 1.0 */ public class OccurrenceEditorInput extends AbstractBulkEditorInput { @@ -57,9 +56,6 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInput listEntities( @@ -67,9 +63,6 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInputgetName

* @@ -90,9 +80,6 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInputgetToolTipText

* @@ -103,9 +90,6 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInput save(SpecimenOrObservationBase entity) { + public SpecimenOrObservationBase save(SpecimenOrObservationBase entity) { return CdmStore.getService(IOccurrenceService.class).merge(entity, true).getMergedEntity(); } - - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator() - */ @Override protected IEntityCreator createEntityCreator() { return new OccurrenceCreator(); } - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getSortProviders() - */ @Override public List> getSortProviders() { List> sortProviders = super.getSortProviders(); @@ -164,9 +135,6 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInput propertyPaths = Arrays.asList(new String[]{}); return CdmStore.getService(IOccurrenceService.class).load(entityUuid, propertyPaths); } - } diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.java index f2b56eb37..a5c868749 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.java @@ -31,7 +31,6 @@ import eu.etaxonomy.taxeditor.store.CdmStore; * * @author p.ciardelli * @created 25.06.2009 - * @version 1.0 */ public class ReferenceEditorInput extends AbstractBulkEditorInput { @@ -133,7 +132,11 @@ public class ReferenceEditorInput extends AbstractBulkEditorInput { * @throws ReferencedObjectUndeletableException */ @Override public boolean delete(Reference entity, DeleteConfiguratorBase config) throws ReferencedObjectUndeletableException { - return CdmStore.getService(IReferenceService.class).delete(entity.getUuid()) != null; + if (entity.getUuid() != null){ + return CdmStore.getService(IReferenceService.class).delete(entity.getUuid()) != null; + }else{ + return false; + } } /** {@inheritDoc} */ diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/GroupCreator.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/GroupCreator.java index a2076ebb8..1f18560bd 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/GroupCreator.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/GroupCreator.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -22,7 +22,9 @@ import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator; */ public class GroupCreator implements IEntityCreator { - /* (non-Javadoc) + public static final String GROUP = "Group"; + + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.String) */ @Override @@ -44,7 +46,7 @@ public class GroupCreator implements IEntityCreator { @Override public Map getKeyLabelPairs() { Map result = new HashMap(); - result.put(Group.class, "Group"); + result.put(Group.class, GROUP); return result; } diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/UserCreator.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/UserCreator.java index 0abba8e90..0897eb329 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/UserCreator.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/UserCreator.java @@ -10,13 +10,16 @@ package eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.springframework.security.access.AccessDeniedException; import eu.etaxonomy.cdm.api.service.IUserService; import eu.etaxonomy.cdm.model.common.User; +import eu.etaxonomy.cdm.persistence.query.MatchMode; import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -27,7 +30,9 @@ import eu.etaxonomy.taxeditor.store.CdmStore; */ public class UserCreator implements IEntityCreator{ - /* (non-Javadoc) + public static final String USER = "User"; + + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.String) */ @Override @@ -42,9 +47,15 @@ public class UserCreator implements IEntityCreator{ public User createEntity(Object key, String text) { try{ User user = User.NewInstance(text, text); - CdmStore.getService(IUserService.class).createUser(user); - user = CdmStore.getService(IUserService.class).loadWithUpdate(user.getUuid()); - return user; + List userList =CdmStore.getService(IUserService.class).listByUsername(user.getUsername(), MatchMode.EXACT, null, 100, 0, null, null); + if (userList.isEmpty()){ + CdmStore.getService(IUserService.class).createUser(user); + user = CdmStore.getService(IUserService.class).loadWithUpdate(user.getUuid()); + return user; + } else{ + MessagingUtils.messageDialog(Messages.USER_CREATOR_user_exists_title, user, Messages.USER_CREATOR_user_exists); + return null; + } } catch (AccessDeniedException e){ MessagingUtils.messageDialog("Access denied", getClass(), e.getMessage(), e); return null; @@ -57,7 +68,7 @@ public class UserCreator implements IEntityCreator{ @Override public Map getKeyLabelPairs() { Map result = new HashMap(); - result.put(User.class, "User"); + result.put(User.class, USER); return result; } diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/AbstractDateComparator.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/AbstractDateComparator.java index 7536b882a..fd1219a69 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/AbstractDateComparator.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/AbstractDateComparator.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -21,10 +21,15 @@ import eu.etaxonomy.cdm.model.common.ICdmBase; * @version 1.0 */ public abstract class AbstractDateComparator implements Comparator{ - - public int compare(T o1, T o2) { + + @Override + public int compare(T o1, T o2) { + if (o1.equals(o2)){ + return 0; + } + return getDate(o1).compareTo(getDate(o2)); }; - + protected abstract DateTime getDate(T object); } diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/ReferenceSortProvider.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/ReferenceSortProvider.java index c61b504d4..ebdc23b07 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/ReferenceSortProvider.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/ReferenceSortProvider.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -22,7 +22,7 @@ import eu.etaxonomy.cdm.model.reference.Reference; public class ReferenceSortProvider extends AbstractSortProvider { /** - * + * */ public ReferenceSortProvider() { comparators.put("Type", new ReferenceTypeComparator()); @@ -30,20 +30,21 @@ public class ReferenceSortProvider extends AbstractSortProvider { } private class ReferenceYearComparator implements Comparator { - + /** * @param o1 * @return */ private String getYearString(Reference o) { - TimePeriod datePublished = o == null ? null : o.getDatePublished(); + TimePeriod datePublished = o == null ? null : o.getDatePublished(); return datePublished == null? null : datePublished.toString(); } - + /* (non-Javadoc) * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ - public int compare(Reference o1, Reference o2) { + @Override + public int compare(Reference o1, Reference o2) { String yearString1 = getYearString(o1); String yearString2 = getYearString(o2); if (yearString1 == null) { @@ -58,19 +59,21 @@ public class ReferenceSortProvider extends AbstractSortProvider { } int returnVal = yearString1.compareToIgnoreCase(yearString2); if (returnVal == 0) { - return new TitleCacheComparator().compare(o1, o2); - } else { - return returnVal; + returnVal = new TitleCacheComparator().compare(o1, o2); + } - } + return returnVal; + + } } - + private class ReferenceTypeComparator implements Comparator { - + /* (non-Javadoc) * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ - public int compare(Reference o1, Reference o2) { + @Override + public int compare(Reference o1, Reference o2) { String typeString1 = o1.getClass().toString(); String typeString2 = o2.getClass().toString(); if (typeString1 == null) { @@ -85,12 +88,13 @@ public class ReferenceSortProvider extends AbstractSortProvider { } int returnVal = typeString1.compareToIgnoreCase(typeString2); if (returnVal == 0) { + //the TitleCacheComparator already fulfills the comparator contract return new TitleCacheComparator().compare(o1, o2); } else { return returnVal; } - } + } } - + } diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/TitleCacheComparator.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/TitleCacheComparator.java index 842417ca8..4d5892d96 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/TitleCacheComparator.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/TitleCacheComparator.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -21,18 +21,19 @@ import eu.etaxonomy.cdm.model.common.IIdentifiableEntity; * @version 1.0 */ public class TitleCacheComparator implements Comparator { - + private boolean fIgnoreCase; private String getTitleCache(T o) { return o == null ? null : o.getTitleCache(); } - + /* (non-Javadoc) * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ /** {@inheritDoc} */ - public int compare(T o1, T o2) { + @Override + public int compare(T o1, T o2) { String titleCache1 = getTitleCache(o1); String titleCache2 = getTitleCache(o2); if (titleCache1 == null && titleCache2 == null) { @@ -43,8 +44,13 @@ public class TitleCacheComparator implements Comp } if (titleCache2 == null) { return 1; - } - return fIgnoreCase ? titleCache1.compareToIgnoreCase(titleCache2) : + } + int result = fIgnoreCase ? titleCache1.compareToIgnoreCase(titleCache2) : titleCache1.compareTo(titleCache2); + + if (result == 0){ + result = o1.getUuid().compareTo(o2.getUuid()); + } + return result; } } diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/l10n/Messages.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/l10n/Messages.java new file mode 100755 index 000000000..768046e0e --- /dev/null +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/l10n/Messages.java @@ -0,0 +1,28 @@ +/** +* Copyright (C) 2017 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.bulkeditor.l10n; + +import org.eclipse.osgi.util.NLS; + +/** + * @author k.luther + * @date 10.03.2017 + * + */ +public class Messages extends NLS { + private static final String BUNDLE_NAME = "src/main/java/eu.etaxonomy.taxeditor.bulkeditor.l10n.messages"; //$NON-NLS-1$ + public static String ReferencingObjectsLabelProvider_No_description_available; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/l10n/messages.properties b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/l10n/messages.properties new file mode 100755 index 000000000..5cb5303f6 --- /dev/null +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/l10n/messages.properties @@ -0,0 +1 @@ +ReferencingObjectsLabelProvider_No_description_available=No description available diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/l10n/messages_de.properties b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/l10n/messages_de.properties new file mode 100755 index 000000000..bfcb11a4e --- /dev/null +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/l10n/messages_de.properties @@ -0,0 +1 @@ +ReferencingObjectsLabelProvider_No_description_available=Keine Beschreibung verfügbar \ No newline at end of file diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsLabelProvider.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsLabelProvider.java index 21f7b52a3..84322e296 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsLabelProvider.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsLabelProvider.java @@ -9,6 +9,7 @@ package eu.etaxonomy.taxeditor.bulkeditor.referencingobjects; +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.LabelProvider; @@ -16,6 +17,7 @@ import org.eclipse.swt.graphics.Image; import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; import eu.etaxonomy.cdm.model.common.CdmBase; +import eu.etaxonomy.taxeditor.bulkeditor.l10n.Messages; import eu.etaxonomy.taxeditor.model.DescriptionHelper; /** @@ -60,11 +62,11 @@ public class ReferencingObjectsLabelProvider extends LabelProvider implements IT } }else if (columnIndex == 3) { if(element instanceof CdmBase){ - text = ((CdmBase) element).getId() + ""; + text = ((CdmBase) element).getId() + ""; //$NON-NLS-1$ } } - return text == null ? element.toString() : text; + return (StringUtils.isBlank(text)) ? Messages.ReferencingObjectsLabelProvider_No_description_available : text; } } diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java index 1eba7aca1..00bcc23f1 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java @@ -39,6 +39,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Table; import org.eclipse.ui.IWorkbenchPart; +import org.springframework.remoting.RemoteAccessException; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.api.service.IAgentService; @@ -73,6 +74,7 @@ import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; import eu.etaxonomy.cdm.model.reference.Reference; import eu.etaxonomy.cdm.model.taxon.TaxonBase; +import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.model.DescriptionHelper; import eu.etaxonomy.taxeditor.session.ICdmEntitySession; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -94,6 +96,11 @@ public class ReferencingObjectsView extends AbstractCdmViewPart { private String referencedObjectTitleCache; private ConversationHolder conversation; private final ICdmEntitySession cdmEntitySession; + private UUID actualUuid; + List referencingObjects = null; + Set referencingObjectsSet = null; + IProgressMonitor actualMonitor = null; + private Job currentJob = null; public ReferencingObjectsView() { cdmEntitySession = CdmStore.getCurrentSessionManager().bindNullSession(); @@ -178,46 +185,103 @@ public class ReferencingObjectsView extends AbstractCdmViewPart { } public void updateReferencingObjects(final UUID entityUUID, final Class objectClass) { - - final Display display = Display.getCurrent(); - - Job job = new Job("Update Referencing Objects") { + if (actualUuid == entityUUID){ + return ; + } + showEmptyPage(); + if(actualMonitor!=null && !actualMonitor.isCanceled()){ +// boolean success = false; +// //wait for cancel to be done +// while(!success){ +// success = currentJob.cancel(); +// } +// currentJob = null; + while(!actualMonitor.isCanceled()){ + actualMonitor.setCanceled(true); + } + + } + currentJob = new Job("Update Referencing Objects " + entityUUID) { @Override protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask("Calculating referencing objects", 10); - - monitor.worked(3); - - display.asyncExec(new Runnable() { - - @Override - public void run() { - if (entityUUID != null){ - ICdmEntitySession previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession(); - cdmEntitySession.bind(); - List referencingObjects = getReferencingObjects(entityUUID, objectClass); - if(previousCdmEntitySession != null) { - previousCdmEntitySession.bind(); - } - updateView(referencingObjects); - - } - } - }); + monitor.beginTask("Calculating referencing objects", 100); + actualUuid = entityUUID; + + monitor.worked(5); + referencingObjects = new ArrayList<>(); + if(monitor.isCanceled()) { + actualUuid = null; + return Status.CANCEL_STATUS; + } + if (actualMonitor != null){ + actualMonitor.setCanceled(true); + } + actualMonitor = monitor; + if (entityUUID != null){ + ICdmEntitySession previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession(); + cdmEntitySession.bind(); + referencingObjectsSet = getReferencingObjects(entityUUID, objectClass); + + if(monitor.isCanceled()) { + actualUuid = null; + + return Status.CANCEL_STATUS; + } + monitor.worked(30); + referencingObjects = sortReferencing(); + if (referencingObjects == null){ + if (monitor.isCanceled()){ + actualUuid = null; + + return Status.CANCEL_STATUS; + } + } + + if(monitor.isCanceled()) { + if(previousCdmEntitySession != null) { + previousCdmEntitySession.bind(); + } + + return Status.CANCEL_STATUS; + } + monitor.worked(80); + updateView(); + + if(previousCdmEntitySession != null) { + previousCdmEntitySession.bind(); + } + // actualUuid = entityUUID; + } monitor.done(); return Status.OK_STATUS; + + } }; + currentJob.setUser(true); + + currentJob.schedule(); +// final IJobChangeListener listener; +// listener = new JobChangeAdapter() { +// @Override +// public void done(IJobChangeEvent event) { +// System.err.println("Job is done" + entityUUID); +// //event.getJob().cancel(); +// } +// +// }; +// currentJob.addJobChangeListener(listener); + + + - job.setPriority(Job.DECORATE); - job.schedule(); } - private List getReferencingObjects(UUID entity, Class objectClass) { + private Set getReferencingObjects(UUID entity, Class objectClass) { CdmBase referencedObject = null; try { if (objectClass.getSuperclass().equals(TeamOrPersonBase.class) ){ @@ -268,71 +332,109 @@ public class ReferencingObjectsView extends AbstractCdmViewPart { else if(referencedObject.isInstanceOf(DescriptionElementBase.class)){ referencedObjectTitleCache = DescriptionHelper.getLabel(referencedObject); } - else{ + else if (referencedObject.isInstanceOf(User.class)){ + referencedObjectTitleCache = ((User)referencedObject).getUsername(); + }else{ referencedObjectTitleCache = null; } setOfReferencingObjects = CdmStore.getCommonService().getReferencingObjects(referencedObject); + return setOfReferencingObjects; } - if (setOfReferencingObjects != null){ - List referencingObjects = new ArrayList(setOfReferencingObjects); - Collections.sort(referencingObjects, new ReferencingClassComparator()); - - return referencingObjects; - - } } catch (Exception e) { - logger.error("Error retrieving referencing objects", e); - setContentDescription("The referencing objects view could not be loaded completely. Some Problems occured."); + logger.debug("Error retrieving referencing objects", e); + e.printStackTrace(); + updateDescription("The referencing objects view could not be loaded completely. Some Problems occured."); } return null; } + private List sortReferencing(){ + + if (referencingObjectsSet != null){ + List referencingObjects = new ArrayList(referencingObjectsSet); + try{ + Collections.sort(referencingObjects, new ReferencingClassComparator()); + }catch (RemoteAccessException e){ + logger.debug(e.getStackTrace()); + return null; + } + return referencingObjects; + + } + + return null; + } - class ReferencingClassComparator implements Comparator { + + class ReferencingClassComparator implements Comparator { @Override public int compare(CdmBase o1, CdmBase o2) { String string1 = o1.getClass().getSimpleName(); String string2 = o2.getClass().getSimpleName(); - int classCompare = string1.compareToIgnoreCase(string2); - if (classCompare == 0) { + int result = string1.compareToIgnoreCase(string2); + if (result == 0) { string1 = DescriptionHelper.getObjectDescription(o1); string2 = DescriptionHelper.getObjectDescription(o2); - return string1.compareToIgnoreCase(string2); - } else { - return classCompare; + + result = string1.compareToIgnoreCase(string2); + if (result == 0){ + return o1.getUuid().compareTo(o2.getUuid()); + } } + return result; } } - private void updateView(List referencingObjects) { - if (viewer != null && !viewer.getControl().isDisposed()){ - try{ - viewer.setInput(referencingObjects); - if (referencedObjectTitleCache != null){ - setContentDescription("'" + referencedObjectTitleCache + "' is referenced by:"); - } else { - setContentDescription(""); - } - showViewer(); - //enable/disable table - viewer.getControl().setEnabled(referencingObjects!=null); - }catch(Exception e){ - setContentDescription("The referencing objects view could not be loaded completely. Some Problems occured."); - } + private void updateView() { + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + if (viewer != null && !viewer.getControl().isDisposed()){ + try{ + viewer.setInput(referencingObjects); - } + showViewer(); + + //enable/disable table + viewer.getControl().setEnabled(referencingObjects!=null); + + }catch(Exception e){ + e.printStackTrace(); + logger.debug(e.getStackTrace()); + updateDescription("The referencing objects view could not be loaded completely. Some Problems occured."); + } + + } + } + }); } + + private void updateDescription(final String description){ + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + if (referencedObjectTitleCache != null){ + setContentDescription(description); + } else { + setContentDescription(description); + } + } + + }); + } + /** {@inheritDoc} */ @Override public void selectionChanged(IWorkbenchPart part, ISelection selection) { if(part == this){ return; } + if(selection instanceof IStructuredSelection){ - referencedObjectTitleCache = null; - showViewer(part, (IStructuredSelection) selection); + //referencedObjectTitleCache = null; + showViewer(part, (IStructuredSelection) selection); } } @@ -346,11 +448,35 @@ public class ReferencingObjectsView extends AbstractCdmViewPart { firstElement = ((TreeNode) firstElement).getValue(); } if(firstElement instanceof CdmBase){ - updateReferencingObjects(((CdmBase) firstElement).getUuid(),firstElement.getClass() ); + CdmBase referencedCdmObject = (CdmBase) firstElement; + if (referencedCdmObject.getUuid() == actualUuid){ + return; + } + if (referencedCdmObject != null){ + if(referencedCdmObject.isInstanceOf(IdentifiableEntity.class)){ + referencedObjectTitleCache = (HibernateProxyHelper.deproxy(referencedCdmObject, IdentifiableEntity.class)).getTitleCache(); + } + else if(referencedCdmObject.isInstanceOf(DescriptionElementBase.class)){ + referencedObjectTitleCache = DescriptionHelper.getLabel(referencedCdmObject); + } + else if (referencedCdmObject.isInstanceOf(User.class)){ + referencedObjectTitleCache = ((User)referencedCdmObject).getUsername(); + }else if (referencedCdmObject.isInstanceOf(TaxonNode.class)){ + referencedObjectTitleCache = "TaxonNode of "+(HibernateProxyHelper.deproxy(referencedCdmObject, TaxonNode.class)).getTaxon().getTitleCache(); + } + } + if (referencedObjectTitleCache != null){ + updateDescription("'" + referencedObjectTitleCache + "' is referenced by:"); + } else{ + updateDescription(""); + } + + updateReferencingObjects(referencedCdmObject.getUuid(),firstElement.getClass() ); + } - else{ - updateView(null); - setContentDescription(""); + else if (firstElement != null){ + updateView(); + updateDescription(""); } } diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/Messages.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java similarity index 70% rename from eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/Messages.java rename to eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java index 1f9f27273..66eb00b60 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/Messages.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java @@ -1,23 +1,25 @@ -package eu.etaxonomy.taxeditor.bulkeditor.input; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "OSGI-INF/l10n/messages"; //$NON-NLS-1$ - public static String BulkEditorInputType_0; - public static String BulkEditorInputType_1; - public static String BulkEditorInputType_2; - public static String BulkEditorInputType_3; - public static String BulkEditorInputType_4; - public static String BulkEditorInputType_5; - public static String BulkEditorInputType_6; - public static String BulkEditorInputType_7; - public static String BulkEditorInputType_8; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} +package eu.etaxonomy.taxeditor.l10n; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "src/main/java/eu.etaxonomy.taxeditor.l10n.messages"; //$NON-NLS-1$ + public static String USER_CREATOR_user_exists_title; + public static String USER_CREATOR_user_exists; + public static String BulkEditorInputType_0; + public static String BulkEditorInputType_1; + public static String BulkEditorInputType_2; + public static String BulkEditorInputType_3; + public static String BulkEditorInputType_4; + public static String BulkEditorInputType_5; + public static String BulkEditorInputType_6; + public static String BulkEditorInputType_7; + public static String BulkEditorInputType_8; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/messages.properties b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties similarity index 59% rename from eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/messages.properties rename to eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties index 2250072f6..ec3eba487 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/messages.properties +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties @@ -1,9 +1,12 @@ -BulkEditorInputType_0=Persons and Teams -BulkEditorInputType_1=References -BulkEditorInputType_2=Names -BulkEditorInputType_3=Name Relationships -BulkEditorInputType_4=Specimen and Observations -BulkEditorInputType_5=Users -BulkEditorInputType_6=Groups -BulkEditorInputType_7=Taxa -BulkEditorInputType_8=Media +BulkEditorInputType_0=Persons and Teams +BulkEditorInputType_1=References +BulkEditorInputType_2=Names +BulkEditorInputType_3=Name Relationships +BulkEditorInputType_4=Specimen and Observations (bulk) +BulkEditorInputType_5=Users +BulkEditorInputType_6=Groups +BulkEditorInputType_7=Taxa +BulkEditorInputType_8=Media + +USER_CREATOR_user_exists_title=The user already exists +USER_CREATOR_user_exists=The user already exists in database \ No newline at end of file diff --git a/eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/messages_de.properties b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties similarity index 51% rename from eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/messages_de.properties rename to eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties index 4bf7416ff..83a53ae51 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/messages_de.properties +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties @@ -1,9 +1,12 @@ -BulkEditorInputType_0=Personen und Teams -BulkEditorInputType_1=Referenzen -BulkEditorInputType_2=Namen -BulkEditorInputType_3=Namensbeziehungen -BulkEditorInputType_4=Belege und Beobachtungen -BulkEditorInputType_5=Nutzer -BulkEditorInputType_6=Nutzergruppen -BulkEditorInputType_7=Taxa -BulkEditorInputType_8=Medien \ No newline at end of file +BulkEditorInputType_0=Personen und Teams +BulkEditorInputType_1=Referenzen +BulkEditorInputType_2=Namen +BulkEditorInputType_3=Namensbeziehungen +BulkEditorInputType_4=Belege und Beobachtungen (bulk) +BulkEditorInputType_5=Nutzer +BulkEditorInputType_6=Nutzergruppen +BulkEditorInputType_7=Taxa +BulkEditorInputType_8=Medien + +USER_CREATOR_user_exists_title=Der Benutzer existiert bereits +USER_CREATOR_user_exists=Der Benutzer existiert bereits in der Datenbank. diff --git a/eu.etaxonomy.taxeditor.cdmlib/.classpath b/eu.etaxonomy.taxeditor.cdmlib/.classpath index 8ad395aea..64c2e14e3 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/.classpath +++ b/eu.etaxonomy.taxeditor.cdmlib/.classpath @@ -1,251 +1,251 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF index 2daba2448..d7092d249 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF +++ b/eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: CDM Library Dependencies Plugin Bundle-SymbolicName: eu.etaxonomy.taxeditor.cdmlib;singleton:=true -Bundle-Version: 4.5.1 +Bundle-Version: 4.6.0 Eclipse-BundleShape: dir Export-Package: com.google.api, com.google.api.detect, @@ -539,15 +539,15 @@ Bundle-ClassPath: ., lib/batik-util-1.7.jar, lib/batik-xml-1.7.jar, lib/c3p0-0.9.5.2.jar, - lib/cdmlib-commons-4.5.1.jar, - lib/cdmlib-ext-4.5.1.jar, - lib/cdmlib-io-4.5.1.jar, - lib/cdmlib-model-4.5.1.jar, - lib/cdmlib-persistence-4.5.1.jar, - lib/cdmlib-print-4.5.1.jar, - lib/cdmlib-remote-4.5.1.jar, - lib/cdmlib-services-4.5.1.jar, - lib/cdmlib-test-4.5.1.jar, + lib/cdmlib-commons-4.6.0.jar, + lib/cdmlib-ext-4.6.0.jar, + lib/cdmlib-io-4.6.0.jar, + lib/cdmlib-model-4.6.0.jar, + lib/cdmlib-persistence-4.6.0.jar, + lib/cdmlib-print-4.6.0.jar, + lib/cdmlib-remote-4.6.0.jar, + lib/cdmlib-services-4.6.0.jar, + lib/cdmlib-test-4.6.0.jar, lib/cglib-3.2.0.jar, lib/cglib-nodep-3.2.0.jar, lib/classmate-1.3.1.jar, diff --git a/eu.etaxonomy.taxeditor.cdmlib/build.properties b/eu.etaxonomy.taxeditor.cdmlib/build.properties index 5467e372f..4bdb6e202 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/build.properties +++ b/eu.etaxonomy.taxeditor.cdmlib/build.properties @@ -25,15 +25,15 @@ bin.includes = META-INF/,\ lib/batik-util-1.7.jar,\ lib/batik-xml-1.7.jar,\ lib/c3p0-0.9.5.2.jar,\ - lib/cdmlib-commons-4.5.1.jar,\ - lib/cdmlib-ext-4.5.1.jar,\ - lib/cdmlib-io-4.5.1.jar,\ - lib/cdmlib-model-4.5.1.jar,\ - lib/cdmlib-persistence-4.5.1.jar,\ - lib/cdmlib-print-4.5.1.jar,\ - lib/cdmlib-remote-4.5.1.jar,\ - lib/cdmlib-services-4.5.1.jar,\ - lib/cdmlib-test-4.5.1.jar,\ + lib/cdmlib-commons-4.6.0.jar,\ + lib/cdmlib-ext-4.6.0.jar,\ + lib/cdmlib-io-4.6.0.jar,\ + lib/cdmlib-model-4.6.0.jar,\ + lib/cdmlib-persistence-4.6.0.jar,\ + lib/cdmlib-print-4.6.0.jar,\ + lib/cdmlib-remote-4.6.0.jar,\ + lib/cdmlib-services-4.6.0.jar,\ + lib/cdmlib-test-4.6.0.jar,\ lib/cglib-3.2.0.jar,\ lib/cglib-nodep-3.2.0.jar,\ lib/classmate-1.3.1.jar,\ diff --git a/eu.etaxonomy.taxeditor.cdmlib/pom.xml b/eu.etaxonomy.taxeditor.cdmlib/pom.xml index 01f3d536c..8da8b8ecb 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/pom.xml +++ b/eu.etaxonomy.taxeditor.cdmlib/pom.xml @@ -4,7 +4,7 @@ eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 4.0.0 eu.etaxonomy.taxeditor.cdmlib diff --git a/eu.etaxonomy.taxeditor.cdmlib/resources/cdm.map.ser b/eu.etaxonomy.taxeditor.cdmlib/resources/cdm.map.ser index 257977326..23ff835ae 100644 Binary files a/eu.etaxonomy.taxeditor.cdmlib/resources/cdm.map.ser and b/eu.etaxonomy.taxeditor.cdmlib/resources/cdm.map.ser differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteConfiguration.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteConfiguration.java index 2cb31436b..32d451a4e 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteConfiguration.java +++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteConfiguration.java @@ -62,6 +62,7 @@ import eu.etaxonomy.cdm.api.service.IPolytomousKeyService; import eu.etaxonomy.cdm.api.service.IPreferenceService; import eu.etaxonomy.cdm.api.service.IProgressMonitorService; import eu.etaxonomy.cdm.api.service.IReferenceService; +import eu.etaxonomy.cdm.api.service.IRightsService; import eu.etaxonomy.cdm.api.service.IService; import eu.etaxonomy.cdm.api.service.ITaxonNodeService; import eu.etaxonomy.cdm.api.service.ITaxonService; @@ -100,7 +101,7 @@ import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager; * */ @Component -public class CdmApplicationRemoteConfiguration implements ICdmApplicationConfiguration, ApplicationContextAware { +public class CdmApplicationRemoteConfiguration implements ICdmRepository, ApplicationContextAware { @SuppressWarnings("unused") private static final Logger logger = Logger.getLogger(CdmApplicationRemoteConfiguration.class); @@ -295,6 +296,11 @@ public class CdmApplicationRemoteConfiguration implements ICdmApplicationConfigu return (ITermService) getService(ITermService.class, "/remoting/term.service", new TermServiceRequestExecutor()); } + @Override + public IRightsService getRightsService(){ + return (IRightsService) getService(IRightsService.class, "/remoting/rights.service", new CdmServiceRequestExecutor()); + } + @Override public ICommonService getCommonService(){ return (ICommonService) getService(ICommonService.class, "/remoting/common.service", new CdmServiceRequestExecutor()); @@ -414,7 +420,7 @@ public class CdmApplicationRemoteConfiguration implements ICdmApplicationConfigu public IGroupService getGroupService(){ return (IGroupService) getService(IGroupService.class, "/remoting/group.service", new CdmServiceRequestExecutor()); } - + @Override public IPreferenceService getPreferenceService(){ return (IPreferenceService) getService(IPreferenceService.class, "/remoting/preference.service", new CdmServiceRequestExecutor()); diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java index 716357a25..796727a2c 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java +++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java @@ -47,7 +47,7 @@ public class CdmApplicationState { private static CdmApplicationState cdmApplicationState; - private ICdmApplicationConfiguration appConfig; + private ICdmRepository appConfig; private ICdmDataChangeService dataChangeService; @@ -66,7 +66,7 @@ public class CdmApplicationState { return cdmApplicationState; } - public void setAppConfig(ICdmApplicationConfiguration appConfig) { + public void setAppConfig(ICdmRepository appConfig) { this.appConfig = appConfig; if(appConfig instanceof CdmApplicationRemoteController) { CdmBase.setNewEntityListener(new DefaultNewEntityListener()); @@ -75,15 +75,15 @@ public class CdmApplicationState { } } - public ICdmApplicationConfiguration getAppConfig() { + public ICdmRepository getAppConfig() { return appConfig; } - public static void setCurrentAppConfig(ICdmApplicationConfiguration appConfig) { + public static void setCurrentAppConfig(ICdmRepository appConfig) { getInstance().setAppConfig(appConfig); } - public static ICdmApplicationConfiguration getCurrentAppConfig() { + public static ICdmRepository getCurrentAppConfig() { return getInstance().getAppConfig(); } @@ -151,7 +151,7 @@ public class CdmApplicationState { /** - * Generic method that will scan the getters of {@link ICdmApplicationConfiguration} for the given service + * Generic method that will scan the getters of {@link ICdmRepository} for the given service * interface. If a matching getter is found the according service implementation is returned by * invoking the getter otherwise the method returns null. * @@ -161,9 +161,9 @@ public class CdmApplicationState { * @throws CdmApplicationException */ public static T getService(Class serviceClass) throws CdmApplicationException { - ICdmApplicationConfiguration configuration = getCurrentAppConfig(); + ICdmRepository configuration = getCurrentAppConfig(); - Method[] methods = ICdmApplicationConfiguration.class.getDeclaredMethods(); + Method[] methods = ICdmRepository.class.getDeclaredMethods(); T service = null; @@ -193,14 +193,14 @@ public class CdmApplicationState { * As ICommonService is not extending IService we need a specific request here */ public static ICommonService getCommonService() { - ICdmApplicationConfiguration configuration = getCurrentAppConfig(); + ICdmRepository configuration = getCurrentAppConfig(); return configuration.getCommonService(); } public static IIOService getIOService() { - ICdmApplicationConfiguration configuration = getCurrentAppConfig(); + ICdmRepository configuration = getCurrentAppConfig(); return ((CdmApplicationRemoteController)configuration).getIOService(); @@ -208,14 +208,14 @@ public class CdmApplicationState { public static ITestService getTestService() { - ICdmApplicationConfiguration configuration = getCurrentAppConfig(); + ICdmRepository configuration = getCurrentAppConfig(); return ((CdmApplicationRemoteController)configuration).getTestService(); } public static ICachedCommonService getCachedCommonService() { - ICdmApplicationConfiguration configuration = getCurrentAppConfig(); + ICdmRepository configuration = getCurrentAppConfig(); return ((CdmApplicationRemoteController)configuration).getCachedCommonService(); diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCacher.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCacher.java index dcfff9f24..88f0aab88 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCacher.java +++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCacher.java @@ -1,13 +1,13 @@ package eu.etaxonomy.cdm.api.cache; +import java.io.File; import java.util.UUID; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.SizeOfPolicyConfiguration; - import org.springframework.stereotype.Component; import eu.etaxonomy.cdm.api.application.CdmApplicationState; +import eu.etaxonomy.cdm.api.config.EhCacheConfiguration; +import eu.etaxonomy.cdm.common.CdmUtils; import eu.etaxonomy.cdm.model.common.CdmBase; import eu.etaxonomy.cdm.model.common.DefinedTermBase; import eu.etaxonomy.cdm.model.common.TermBase; @@ -19,6 +19,9 @@ import eu.etaxonomy.taxeditor.session.CdmEntitySession; import eu.etaxonomy.taxeditor.session.ICdmEntitySession; import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager; import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver; +import net.sf.ehcache.config.CacheConfiguration; +import net.sf.ehcache.config.DiskStoreConfiguration; +import net.sf.ehcache.config.SizeOfPolicyConfiguration; /** * Class which uses CDM services to cache cdm entities @@ -31,9 +34,8 @@ import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver; * * @param */ -@Component -public class CdmServiceCacher extends CdmCacher implements ICdmEntitySessionManagerObserver { - +@Component //FIXME This indicates that the CdmServiceCacher is initialized as Spring Component but it seems only to be instantiated directly +public class CdmServiceCacher extends CdmCacher implements ICdmEntitySessionManagerObserver { private ICdmEntitySessionManager cdmEntitySessionManager; @@ -44,11 +46,35 @@ public class CdmServiceCacher extends CdmCacher implements ICdmEntitySessionMan @Override protected void setup() { + + setUpCacheManager(); + DefinedTermBase.setCacher(this); CdmTransientEntityCacher.setDefaultCacher(this); TermServiceRequestExecutor.setDefaultCacher(this); cacheLoader = new CacheLoader(this); + + } + + + /** + * + */ + private void setUpCacheManager() { + + EhCacheConfiguration cacheConfig = new EhCacheConfiguration(); + + DiskStoreConfiguration diskStoreConfiguration = new DiskStoreConfiguration(); + File ehcacheFolder = CdmUtils.getCdmSubDir("taxeditor-ehcache"); + // FIXME use subfolder per taxeditor version to allow running multiple installations in parallel + // String taxEditorVersion = ..; + // File ehcacheFolder = new File(ehcacheFolder, taxEditorVersion); + diskStoreConfiguration.setPath(ehcacheFolder.getAbsolutePath()); + + cacheConfig.setDiskStoreConfiguration(diskStoreConfiguration); + addCacheManager(cacheConfig.cacheManager()); + } diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacher.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacher.java index 0ba73ba4e..af18a29a9 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacher.java +++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacher.java @@ -30,11 +30,18 @@ import org.hibernate.property.access.spi.Getter; import org.osgi.framework.Bundle; +/** + * This class serializing and deserializing the CDM model for performance purposes. + * To serialize it see the comments on {@link #main(String[])} and on + * https://dev.e-taxonomy.eu/redmine/projects/edit/wiki/TaxonomicEditorDevelopersGuide#Model-Change-Actions + * + * @author c.mathew + * @date 2015 + * + */ public class CdmModelCacher { - - public static String HB_CONFIG_FILE_PATH= "/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml"; public static final String CDM_MAP_SER_FILE_PATH = "resources/cdm.map.ser"; @@ -62,7 +69,8 @@ public class CdmModelCacher { FileInputStream fin = new FileInputStream(modelMapFilePath); ObjectInputStream ois = new ObjectInputStream(fin); - Map modelClassMap = (Map) ois.readObject(); + @SuppressWarnings("unchecked") + Map modelClassMap = (Map) ois.readObject(); ois.close(); return modelClassMap; } @@ -143,6 +151,8 @@ public class CdmModelCacher { // To re-create the serialised cdm map run, // mvn exec:java -Dexec.mainClass="eu.etaxonomy.taxeditor.remoting.cache.CdmModelCacher" // in the eu.etaxonomy.taxeditor.cdmlib project root dir + // See also https://dev.e-taxonomy.eu/redmine/projects/edit/wiki/TaxonomicEditorDevelopersGuide#Model-Change-Actions + //Note AM: does not fully work for me, but running the main from the IDE works. String CDM_MAP_SER_DIR = "resources/"; CdmModelCacher cdmModelCacher = new CdmModelCacher(); diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacherConnectionProvider.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacherConnectionProvider.java index 097c3b496..20aee0c4d 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacherConnectionProvider.java +++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacherConnectionProvider.java @@ -9,11 +9,16 @@ import eu.etaxonomy.cdm.database.CdmDataSource; /** * This is a very preliminary class to get the model cache running. Need to better understand how * the datasource works with hibernate service registry before implementing the correct way. + * Or use a running source. + * + * When changing this class please also adapt https://dev.e-taxonomy.eu/redmine/projects/edit/wiki/TaxonomicEditorDevelopersGuide#Model-Change-Actions + * * @author a.mueller * */ public class CdmModelCacherConnectionProvider extends DatasourceConnectionProviderImpl{ + private static final long serialVersionUID = 454393966637126346L; public CdmModelCacherConnectionProvider() { super(); diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmTransientEntityCacher.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmTransientEntityCacher.java index d1c9bf793..21c04da42 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmTransientEntityCacher.java +++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmTransientEntityCacher.java @@ -17,14 +17,6 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.Status; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.SizeOfPolicyConfiguration; -import net.sf.ehcache.statistics.LiveCacheStatistics; - import org.apache.log4j.Logger; import eu.etaxonomy.cdm.api.application.CdmApplicationState; @@ -35,6 +27,13 @@ import eu.etaxonomy.cdm.model.ICdmCacher; import eu.etaxonomy.cdm.model.common.CdmBase; import eu.etaxonomy.cdm.persistence.dto.MergeResult; import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager; +import net.sf.ehcache.Cache; +import net.sf.ehcache.CacheManager; +import net.sf.ehcache.Element; +import net.sf.ehcache.Status; +import net.sf.ehcache.config.CacheConfiguration; +import net.sf.ehcache.config.SizeOfPolicyConfiguration; +import net.sf.ehcache.statistics.LiveCacheStatistics; /** * diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceRequestExecutor.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceRequestExecutor.java index d8a07325c..783845df1 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceRequestExecutor.java +++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceRequestExecutor.java @@ -54,9 +54,16 @@ public class CdmServiceRequestExecutor extends CdmAuthenticatedHttpInvokerReques RemoteInvocationResult rir = fromCache(currentRemoteInvocation); if(rir == null) { - logger.info("Remote invoking : " + currentRemoteInvocation.getMethodName() + "@" + config.getServiceUrl()); - rir = super.doExecuteRequest(config, baos); + + if (!(currentRemoteInvocation.getMethodName() == null) && !(config.getServiceUrl() == null)){ + // logger.info("Remote invoking : " + currentRemoteInvocation.getMethodName() + "@" + config.getServiceUrl()); + } + rir = super.doExecuteRequest(config, baos); if(rir.getValue() != null && !rir.hasException()) { + if (currentRemoteInvocation == null){ + logger.debug("return RemoteInvocationResult without caching" ); + return rir; + } if(cachableMethods.contains(currentRemoteInvocation.getMethodName())) { rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), true)); } else if(rir.getValue() instanceof UpdateResult){ diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml b/eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml index 56a8e3509..0c2620e0a 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml +++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml @@ -1,215 +1,217 @@ - - - - - - - after_transaction - - org.hibernate.boot.model.naming.ImplicitNamingStrategyComponentPathImpl - - - - - - eu.etaxonomy.taxeditor.remoting.cache.CdmModelCacherConnectionProvider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + after_transaction + + org.hibernate.boot.model.naming.ImplicitNamingStrategyComponentPathImpl + + + + + + eu.etaxonomy.taxeditor.remoting.cache.CdmModelCacherConnectionProvider + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/remotingApplicationContext.xml b/eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/remotingApplicationContext.xml index 604b197fb..7dc046a2e 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/remotingApplicationContext.xml +++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/remotingApplicationContext.xml @@ -14,13 +14,11 @@ - - + class="eu.etaxonomy.taxeditor.service.CachedCommonServiceImpl" /> diff --git a/eu.etaxonomy.taxeditor.editor/.classpath b/eu.etaxonomy.taxeditor.editor/.classpath index 13a030a92..a8f5931fa 100644 --- a/eu.etaxonomy.taxeditor.editor/.classpath +++ b/eu.etaxonomy.taxeditor.editor/.classpath @@ -1,6 +1,6 @@ - + diff --git a/eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF index fe6879c11..ecfae0eb7 100644 --- a/eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF +++ b/eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Editor Bundle Bundle-SymbolicName: eu.etaxonomy.taxeditor.editor;singleton:=true -Bundle-Version: 4.5.1 +Bundle-Version: 4.6.0 Bundle-Activator: eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin Bundle-Vendor: %Bundle-Vendor.0 Bundle-Localization: OSGI-INF/l10n/plugin diff --git a/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/messages.properties b/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/messages.properties deleted file mode 100644 index 351919128..000000000 --- a/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/messages.properties +++ /dev/null @@ -1,56 +0,0 @@ -CreateDerivateContextMenu_ADD=Add... -CreateDerivateContextMenu_DNA_SAMPLE=DNA Sample -CreateDerivateContextMenu_MEDIA=Media... -CreateDerivateContextMenu_MEDIA_EXISTING=Use existing media item -CreateDerivateContextMenu_MEDIA_SPECIMEN=Media item -CreateDerivateContextMenu_NO_CHILD_DERIVATE=No child derivatives -CreateDerivateContextMenu_SEQUENCE=Consensus Sequence -CreateDerivateContextMenu_SINGLE_READ=Single Read -CreateDerivateContextMenu_SPECIMEN=Specimen -CreateDerivateContextMenu_TISSUE_SAMPLE=Tissue Sample - -CreateFieldUnitContextMenu_CREATE_FIELD_UNIT=Create new field unit -CreateFieldUnitContextMenu_CREATE_FIELD_UNIT_FOR=Create new field unit for %s - -SingleReadSequenceContextMenu_REMOVE_FROM_SEQUENCE=Remove from this Sequence -SingleReadSequenceContextMenu_REUSE_FOR_SEQUENCE=Reuse for other Sequence -SingleReadSequenceContextMenu_REUSE_SINGLE_READ_HERE=Reuse SingleRead here - -DerivateView_DERIVATIVE_EDITOR=Specimen Editor -DerivateView_SAVING_HIERARCHY=Saving hierarchy -DerivateView_UNSAVED_CHANGES=View has unsaved changes -DerivateView_YOU_NEED_TO_SAVE=You need to save before performing this action - -DeleteDerivateOperation_AND_CHILDREN= and its children -DeleteDerivateOperation_CONFIRM=Confirm Deletion -DeleteDerivateOperation_DELETE_FAILED=Deletion failed -DeleteDerivateOperation_REALLY_DELETE=Do you really want to delete the selected element - -DerivateDropListener_MOVE_TO=Moving "%s" to "%s" - -DerivateViewEditorInput_FAIL_INIT=Failed initializing editor -DerivateViewEditorInput_NO_ROOT=No root element found\! - -MoveDerivateOperation_MOVE_NOT_POSSIBLE=Moving derivatives not possible\! -MoveDerivateOperation_MOVE_TO_NOT_POSSIBLE=Moving "%s" to "%s" is not possible\! - -OpenDerivateEditorForTaxonHandler_COULD_NOT_OPEN_EDITOR=Could not open Specimen Editor -OpenDerivateEditorForTaxonHandler_FAILED_TO_OPEN=Failed to open Editor -OpenDerivateEditorForTaxonHandler_HIERARCHY_CORRUPTED=The derivative hierarchy is corrupted\! -OpenDerivateEditorForTaxonHandler_NO_DERIVATIVES_FOUND=No Derivatives found - -DeleteTaxonBaseHandler_CONFIRM_DELETION=Confirm Deletion -DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT=Element has to be Synonym, Misapplication or Concept -DeleteTaxonBaseHandler_REALLY_DELETE_TAXON=Are you sure you want to delete the selected taxon? -DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM=Are you sure you want to delete the selected synoym, this is irreversible? -DeleteTaxonBaseHandler_DELETE_SYNONYM_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS=The Synonym could be deleted, but related object(s) could not be deleted -DeleteTaxonBaseHandler_DELETE_MISAPPLIEDNAME_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS=The misapplied name could be deleted, but related object(s) could not be deleted - -DescriptiveViewPart_COLLAPSE_ALL=Collapse All -DescriptiveViewPart_EXPAND_ALL=Expand All -DescriptiveViewPart_FACTUAL_DATA=Factual Data -DescriptiveViewPart_SHOW_ALL_DATA=Show all factual data - -ConceptGraphView_VIEWER_NAME=Concept Graph -ConceptViewPart_VIEWER_NAME=Concept Relations -UsesViewPart_VIEWER_NAME=Uses diff --git a/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/messages_de.properties b/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/messages_de.properties deleted file mode 100644 index dd7738388..000000000 --- a/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/messages_de.properties +++ /dev/null @@ -1,57 +0,0 @@ -CreateDerivateContextMenu_ADD=Hinzufügen... -CreateDerivateContextMenu_DNA_SAMPLE=DNA Probe -CreateDerivateContextMenu_MEDIA=Media... -CreateDerivateContextMenu_MEDIA_EXISTING=Vorhandendes Medienobjekt verwenden -CreateDerivateContextMenu_MEDIA_SPECIMEN=Medienobjekt -CreateDerivateContextMenu_NO_CHILD_DERIVATE=Keine Kind-Derivate -CreateDerivateContextMenu_SEQUENCE=Konsensussequenz -CreateDerivateContextMenu_SINGLE_READ=Single Read -CreateDerivateContextMenu_SPECIMEN=Beleg -CreateDerivateContextMenu_TISSUE_SAMPLE=Gewebeprobe - -CreateFieldUnitContextMenu_CREATE_FIELD_UNIT=Erzeuge neue Field Unit -CreateFieldUnitContextMenu_CREATE_FIELD_UNIT_FOR=Erzeuge neue Field Unit für %s - -SingleReadSequenceContextMenu_REMOVE_FROM_SEQUENCE=Von Sequenz entfernen -SingleReadSequenceContextMenu_REUSE_FOR_SEQUENCE=Für andere Sequenz verwenden -SingleReadSequenceContextMenu_REUSE_SINGLE_READ_HERE=SingleRead hier verwenden - -DerivateView_DERIVATIVE_EDITOR=Specimen-Editor -DerivateView_SAVING_HIERARCHY=Speichere Hierarchie -DerivateView_UNSAVED_CHANGES=Ungepeicherte Änderungen -DerivateView_YOU_NEED_TO_SAVE=Sie müssen speichern, um diese Aktion auszuführen - -DeleteDerivateOperation_CONFIRM=Löschen bestätigen -DeleteDerivateOperation_DELETE_FAILED=Löschen fehlgeschlagen -DeleteDerivateOperation_REALLY_DELETE=Wollen Sie wirklich das ausgewählte Element löschen -DeleteDerivateOperation_AND_CHILDREN= (mit Kind-Elementen) - -DerivateDropListener_MOVE_TO=Verschiebe "%s" nach "%s" - -DerivateViewEditorInput_FAIL_INIT=Initialisierung des Editor fehlgeschlagen -DerivateViewEditorInput_NO_ROOT=Kein Root-Element gefunden\! - -MoveDerivateOperation_MOVE_NOT_POSSIBLE=Verschieben von Derivaten nicht möglich\! -MoveDerivateOperation_MOVE_TO_NOT_POSSIBLE=Verschieben von "%s" nach "%s" nicht möglich\! - -OpenDerivateEditorForTaxonHandler_COULD_NOT_OPEN_EDITOR=Konnte Specimen-Editor nicht öffnen -OpenDerivateEditorForTaxonHandler_FAILED_TO_OPEN=Öffnen des Editors fehlgeschlagen -OpenDerivateEditorForTaxonHandler_HIERARCHY_CORRUPTED=Die Derivathierarchie ist korrumpiert\! -OpenDerivateEditorForTaxonHandler_NO_DERIVATIVES_FOUND=Keine Derivate gefunden - -DeleteTaxonBaseHandler_CONFIRM_DELETION=Löschen bestätigen -DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT=Element muss Synonym, Misapplikation oder Konzept sein -DeleteTaxonBaseHandler_REALLY_DELETE_TAXON=Wollen Sie wirklich das ausgewählte Taxon löschen? -DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM=Wollen Sie das ausgewählte Synonym wirklich löschen, dieser Vorgang ist nicht reversibel. -DeleteTaxonBaseHandler_DELETE_SYNONYM_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS=Das Synonym konnte gelöscht werden, aber es gibt noch verknüpfte Objekte, die nicht gelöscht werden konnten. -DeleteTaxonBaseHandler_DELETE_MISAPPLIEDNAME_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS=Die Misapplikation konnte gelöscht werden, aber es gibt noch verknüpfte Objekte, die nicht gelöscht werden konnten. - - -DescriptiveViewPart_COLLAPSE_ALL=Alles einklappen -DescriptiveViewPart_EXPAND_ALL=Alles ausklappen -DescriptiveViewPart_FACTUAL_DATA=Faktendaten -DescriptiveViewPart_SHOW_ALL_DATA=Zeige alle Faktendaten - -ConceptGraphView_VIEWER_NAME=Konzeptgraph -ConceptViewPart_VIEWER_NAME=Konzeptrelationen -UsesViewPart_VIEWER_NAME=Nutzung diff --git a/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties b/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties index 55681cf70..cbecb3f1a 100644 --- a/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties +++ b/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties @@ -171,7 +171,7 @@ command.name.50 = delete command.name.51 = delete editor.name.DERIVATIVE_EDITOR = Specimen Editor -command.label.DERIVATIVE_EDITOR = Specimen Editor +command.label.DERIVATIVE_EDITOR = Specimen Editor (hierarchy) command.label.LINK_WITH_TAXON_SELECTION = Link with taxon selection command.label.UNLINK_FROM_TAXON_SELECTION = Unlink from taxon selection command.label.REUSE_SINGLE_READ_HERE = Reuse single read here @@ -188,4 +188,5 @@ command.name.TOGGLE_LINK_WITH_TAXON_SELECTION = Toggle link with taxon selection viewCommandMapping.viewerName.NAME_EDITOR = Name Editor viewCommandMapping.viewerName.SPECIMEN_EDITOR = Specimen Editor -viewCommandMapping.viewerName.CHECKLIST_EDITOR = Distribution Editor \ No newline at end of file +viewCommandMapping.viewerName.CHECKLIST_EDITOR = Distribution Editor +command.name.OPEN_EDITOR_FOR_TYPE_SPECIMEN = Open specimen editor for type specimen \ No newline at end of file diff --git a/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties b/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties index 6d1d7a8c7..e379ed148 100644 --- a/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties +++ b/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties @@ -168,7 +168,7 @@ command.name.51 = L\u00f6schen command.name.57 = Setze als Basionym der homotypischen Gruppe editor.name.DERIVATIVE_EDITOR = Specimen-Editor -command.label.DERIVATIVE_EDITOR = Specimen-Editor +command.label.DERIVATIVE_EDITOR = Specimen-Editor (Hierarchie) command.label.LINK_WITH_TAXON_SELECTION = Verknüpfe mit Taxonauswahl command.label.UNLINK_FROM_TAXON_SELECTION = Verknüpfung mit Taxonauswahl aufheben command.label.REUSE_SINGLE_READ_HERE = Single-Read hier wiederverwenden @@ -185,4 +185,5 @@ command.name.TOGGLE_LINK_WITH_TAXON_SELECTION = De-/Aktiviere Verkn viewCommandMapping.viewerName.NAME_EDITOR = Namenseditor viewCommandMapping.viewerName.SPECIMEN_EDITOR = Specimen-Editor -viewCommandMapping.viewerName.CHECKLIST_EDITOR = Verbreitungs-Editor \ No newline at end of file +viewCommandMapping.viewerName.CHECKLIST_EDITOR = Verbreitungs-Editor +command.name.OPEN_EDITOR_FOR_TYPE_SPECIMEN = Öffne Specimen-Editor für Typusbelege \ No newline at end of file diff --git a/eu.etaxonomy.taxeditor.editor/build.properties b/eu.etaxonomy.taxeditor.editor/build.properties index 24738e1df..4c503785d 100644 --- a/eu.etaxonomy.taxeditor.editor/build.properties +++ b/eu.etaxonomy.taxeditor.editor/build.properties @@ -5,4 +5,6 @@ bin.includes = META-INF/,\ plugin.xml,\ icons/,\ p2.inf,\ - OSGI-INF/ + OSGI-INF/,\ + src/main/java/eu/etaxonomy/taxeditor/editor/l10n/ +bin.excludes = src/main/java/eu/etaxonomy/taxeditor/editor/l10n/Messages.java diff --git a/eu.etaxonomy.taxeditor.editor/plugin.xml b/eu.etaxonomy.taxeditor.editor/plugin.xml index 0a893e8f0..838b9514a 100644 --- a/eu.etaxonomy.taxeditor.editor/plugin.xml +++ b/eu.etaxonomy.taxeditor.editor/plugin.xml @@ -367,25 +367,6 @@ - - - - - - - - - -
@@ -1099,11 +1080,10 @@ id="eu.etaxonomy.taxeditor.editor.view.concept.menus.new"> - - + + @@ -1160,6 +1140,20 @@ + + + + + + + + @@ -1342,6 +1336,18 @@ + + + + + + + + @@ -1772,7 +1778,12 @@ + name="%command.name.OPEN_EDITOR_FOR_TYPE_SPECIMEN"> + + @@ -2031,7 +2042,7 @@ @@ -2108,6 +2119,21 @@ + + + + + + diff --git a/eu.etaxonomy.taxeditor.editor/pom.xml b/eu.etaxonomy.taxeditor.editor/pom.xml index 9665708d4..015d34e47 100644 --- a/eu.etaxonomy.taxeditor.editor/pom.xml +++ b/eu.etaxonomy.taxeditor.editor/pom.xml @@ -4,7 +4,7 @@ eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 4.0.0 diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/CdmDataTransfer.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/CdmDataTransfer.java index 62038000a..41403b53a 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/CdmDataTransfer.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/CdmDataTransfer.java @@ -42,7 +42,7 @@ public class CdmDataTransfer extends ByteArrayTransfer { private static int SEPARATOR = -10; private static int EOF = -20; - private static final String TYPE_NAME = "cdmdata-transfer-format"; + private static final String TYPE_NAME = "cdmdata-transfer-format"; //$NON-NLS-1$ private static final int TYPE_ID = registerType (TYPE_NAME); private static final CdmDataTransfer instance = new CdmDataTransfer(); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/ChooseFromMultipleTaxonNodesDialog.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/ChooseFromMultipleTaxonNodesDialog.java index dd5a51271..3cef27580 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/ChooseFromMultipleTaxonNodesDialog.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/ChooseFromMultipleTaxonNodesDialog.java @@ -22,6 +22,7 @@ import org.eclipse.ui.dialogs.ListDialog; import eu.etaxonomy.cdm.model.taxon.Classification; import eu.etaxonomy.cdm.model.taxon.TaxonNode; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; /** *

ChooseClassificationWizard class.

@@ -51,8 +52,8 @@ public class ChooseFromMultipleTaxonNodesDialog extends ListDialog { public ChooseFromMultipleTaxonNodesDialog(Shell parent) { super(parent); - setTitle("Choose Classification"); - setMessage("The taxon is part of multiple classification. Please choose the one you want to open."); + setTitle(Messages.ChooseFromMultipleTaxonNodesDialog_CHOOSE_CLASSIFICATION); + setMessage(Messages.ChooseFromMultipleTaxonNodesDialog_CHOOSE_CLASSIFICATION_MESSAGE); setContentProvider(new ClassificationContentProvider()); setLabelProvider(new ClassificationLabelProvider()); } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorStateManager.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorStateManager.java index da4905cf1..1939f83ac 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorStateManager.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorStateManager.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -20,6 +20,7 @@ import org.eclipse.ui.IMemento; import org.eclipse.ui.IPersistable; import org.eclipse.ui.PartInitException; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.concept.ConceptViewPart; import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart; import eu.etaxonomy.taxeditor.editor.view.media.MediaViewPart; @@ -36,19 +37,19 @@ import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart; */ public class EditorStateManager extends ContextListenerAdapter { - private static final String EDITORS = "editors"; + private static final String EDITORS = "editors"; //$NON-NLS-1$ - private static final String EDITOR = "editor"; + private static final String EDITOR = "editor"; //$NON-NLS-1$ private TaxonEditorInputFactory inputFactory; - + /** *

Constructor for EditorStateManager.

*/ public EditorStateManager() { inputFactory = new TaxonEditorInputFactory(); } - + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.model.IContextListener#contextAboutToStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor) */ @@ -67,15 +68,15 @@ public class EditorStateManager extends ContextListenerAdapter { EditorUtil.closeAll(); resetConstantViews(); } - + /** - * + * */ private void resetConstantViews() { AbstractCdmEditorViewPart descriptiveView = (AbstractCdmEditorViewPart) EditorUtil.getView(DescriptiveViewPart.ID, false); AbstractCdmEditorViewPart mediaView = (AbstractCdmEditorViewPart) EditorUtil.getView(MediaViewPart.ID, false); AbstractCdmEditorViewPart conceptView = (AbstractCdmEditorViewPart) EditorUtil.getView(ConceptViewPart.ID, false); - + if(descriptiveView != null){ descriptiveView.showEmptyPage(); } @@ -95,7 +96,7 @@ public class EditorStateManager extends ContextListenerAdapter { public void contextStart(IMemento memento, IProgressMonitor monitor) { restoreEditors(memento, monitor); } - + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.model.ContextListenerAdapter#contextRefresh(org.eclipse.core.runtime.IProgressMonitor) */ @@ -112,27 +113,28 @@ public class EditorStateManager extends ContextListenerAdapter { public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) { saveEditorState(memento); } - + /** - * Reads taxon node UUIDs from the given memento and tries to open an editor + * Reads taxon node UUIDs from the given memento and tries to open an editor * for each of the found UUIDs. - * + * * @param memento */ private void restoreEditors(final IMemento memento, IProgressMonitor monitor){ if(memento == null){ return; } - + IProgressMonitor subProgressMonitor = EditorUtil.getSubProgressMonitor(monitor, 1); - + IMemento editorMementos = memento.getChild(EDITORS); IMemento[] editorInputs = editorMementos.getChildren(EDITOR); - - subProgressMonitor.beginTask("Restoring Editors", 1 + editorInputs.length * 2); - subProgressMonitor.subTask("Restoring Editors"); + + String taskName = Messages.EditorStateManager_RESTORE_EDITORS; + subProgressMonitor.beginTask(taskName, 1 + editorInputs.length * 2); + subProgressMonitor.subTask(taskName); subProgressMonitor.worked(1); - + for(IMemento editorInput : editorInputs){ TaxonEditorInput input = (TaxonEditorInput) inputFactory.createElement(editorInput); subProgressMonitor.worked(1); @@ -140,32 +142,32 @@ public class EditorStateManager extends ContextListenerAdapter { try { EditorUtil.open(input); } catch (PartInitException e) { - MessagingUtils.error(getClass(), "Error opening an editor window", e); + MessagingUtils.error(getClass(), Messages.EditorStateManager_ERROR_OPEN_WINDOW, e); } } subProgressMonitor.worked(1); } subProgressMonitor.done(); } - + /** * @param monitor */ private void refreshEditors(IProgressMonitor monitor) { IProgressMonitor subProgressMonitor = EditorUtil.getSubProgressMonitor(monitor, 1); - + Set openEditors = EditorUtil.getOpenEditors(); - - - subProgressMonitor.beginTask("Refreshing Editors", openEditors.size() * 2); - + + + subProgressMonitor.beginTask(Messages.EditorStateManager_REFRESH_EDITOR, openEditors.size() * 2); + Set uuids = new HashSet(); - + for(IEditorPart editor : openEditors){ if(editor instanceof MultiPageTaxonEditor){ try { uuids.add(((TaxonEditorInput) editor.getEditorInput()).getTaxonNode().getUuid()); - + // ((MultiPageTaxonEditor) editor).close(false); EditorUtil.close((MultiPageTaxonEditor)editor); subProgressMonitor.worked(1); @@ -175,7 +177,7 @@ public class EditorStateManager extends ContextListenerAdapter { } } } - + for(UUID uuid : uuids){ try { EditorUtil.openTaxonNode(uuid); @@ -185,24 +187,24 @@ public class EditorStateManager extends ContextListenerAdapter { } subProgressMonitor.worked(1); } - + subProgressMonitor.done(); } - + /** - * Saves the UUIDs - * + * Saves the UUIDs + * * @param memento */ private void saveEditorState(IMemento memento){ if(memento == null){ return; } - + Set editors = EditorUtil.getOpenEditors(); - + IMemento editorMementos = memento.createChild(EDITORS); - + for(IEditorPart editor : editors){ IEditorInput input = editor.getEditorInput(); if(input instanceof IPersistable){ diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java index 522bd59e3..b61dc0eda 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java @@ -41,6 +41,7 @@ import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditorInput; import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin; import eu.etaxonomy.taxeditor.editor.key.KeyEditor; import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor; import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput; //import eu.etaxonomy.taxeditor.store.view.dataimport.BioCaseEditorInput; @@ -175,16 +176,11 @@ public class EditorUtil extends AbstractUtility { TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid); if (taxonBase != null && taxonBase.isOrphaned()) { if(taxonBase.isInstanceOf(Synonym.class)){ - MessagingUtils.warningDialog("Orphaned accepted taxon", TaxonEditorInput.class, "The accepted " - + "taxon of this synonym is not part of any classification. Editing with the " - + "name editor is currently not implemented. Try to edit the taxon with the bulk editor."); + MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON, TaxonEditorInput.class, Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE); return; } else{ - MessagingUtils.warningDialog("Orphaned Taxon", TaxonEditorInput.class, "This is an orphaned taxon " - + "i.e. a taxon that is not connected to a classification and not having any taxonomic " - + "relationships. Editing of orphaned taxa in the name editor is currently not supported. " - + "Try editing with the bulk editor"); + MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_TAXON, TaxonEditorInput.class, Messages.EditorUtil_ORPHAN_TAXON_MESSAGE); return; } } @@ -361,9 +357,8 @@ public class EditorUtil extends AbstractUtility { if (editor.isDirty()) { boolean doSave = MessageDialog - .openConfirm(shell, "Confirm save", - "Warning - this operation will save the editor. This will also save all other unsaved changes " + - "in your working editor to the database. Please 'Cancel' if you are not ready to do this."); + .openConfirm(shell, Messages.EditorUtil_COMFIRM_SAVE, + Messages.EditorUtil_CONFIRM_SAVE_MESSAGE); if (!doSave) { return false; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/Messages.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/Messages.java deleted file mode 100644 index e2b86bed7..000000000 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/Messages.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright (C) 2015 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; - -import org.eclipse.osgi.util.NLS; - -/** - * @author pplitzner - * @date 09.09.2015 - * - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "OSGI-INF/l10n/messages"; //$NON-NLS-1$ - public static String ConceptGraphView_VIEWER_NAME; - public static String ConceptViewPart_VIEWER_NAME; - public static String CreateDerivateContextMenu_ADD; - public static String CreateDerivateContextMenu_DNA_SAMPLE; - public static String CreateDerivateContextMenu_MEDIA; - public static String CreateDerivateContextMenu_MEDIA_EXISTING; - public static String CreateDerivateContextMenu_MEDIA_SPECIMEN; - public static String CreateDerivateContextMenu_NO_CHILD_DERIVATE; - public static String CreateDerivateContextMenu_SEQUENCE; - public static String CreateDerivateContextMenu_SINGLE_READ; - public static String CreateDerivateContextMenu_SPECIMEN; - public static String CreateDerivateContextMenu_TISSUE_SAMPLE; - public static String CreateFieldUnitContextMenu_CREATE_FIELD_UNIT; - public static String CreateFieldUnitContextMenu_CREATE_FIELD_UNIT_FOR; - public static String DeleteDerivateOperation_AND_CHILDREN; - public static String DeleteDerivateOperation_CONFIRM; - public static String DeleteDerivateOperation_DELETE_FAILED; - public static String DeleteDerivateOperation_REALLY_DELETE; - public static String DeleteTaxonBaseHandler_CONFIRM_DELETION; - public static String DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT; - public static String DeleteTaxonBaseHandler_REALLY_DELETE_TAXON; - public static String DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM; - public static String DeleteTaxonBaseHandler_DELETE_SYNONYM_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS; - public static String DeleteTaxonBaseHandler_DELETE_MISAPPLIEDNAME_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS; - - - public static String DerivateDropListener_MOVE_TO; - public static String DerivateView_DERIVATIVE_EDITOR; - public static String DerivateView_SAVING_HIERARCHY; - public static String DerivateView_UNSAVED_CHANGES; - public static String DerivateView_YOU_NEED_TO_SAVE; - public static String DerivateViewEditorInput_FAIL_INIT; - public static String DerivateViewEditorInput_NO_ROOT; - public static String DescriptiveViewPart_COLLAPSE_ALL; - public static String DescriptiveViewPart_EXPAND_ALL; - public static String DescriptiveViewPart_FACTUAL_DATA; - public static String DescriptiveViewPart_SHOW_ALL_DATA; - public static String MoveDerivateOperation_MOVE_NOT_POSSIBLE; - public static String MoveDerivateOperation_MOVE_TO_NOT_POSSIBLE; - public static String OpenDerivateEditorForTaxonHandler_COULD_NOT_OPEN_EDITOR; - public static String OpenDerivateEditorForTaxonHandler_FAILED_TO_OPEN; - public static String OpenDerivateEditorForTaxonHandler_HIERARCHY_CORRUPTED; - public static String OpenDerivateEditorForTaxonHandler_NO_DERIVATIVES_FOUND; - public static String SingleReadSequenceContextMenu_REMOVE_FROM_SEQUENCE; - public static String SingleReadSequenceContextMenu_REUSE_FOR_SEQUENCE; - public static String SingleReadSequenceContextMenu_REUSE_SINGLE_READ_HERE; - public static String UsesViewPart_VIEWER_NAME; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java index 6887838dd..7241f84ff 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java @@ -34,6 +34,7 @@ import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer; import eu.etaxonomy.taxeditor.model.AbstractUtility; @@ -61,7 +62,7 @@ IPartContentHasFactualData, IConversationEnabled, IPostOperationEnabled, IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia { /** Constant ID="eu.etaxonomy.taxeditor.editor.taxon"{trunked} */ - public static final String ID = "eu.etaxonomy.taxeditor.editor.taxon"; + public static final String ID = "eu.etaxonomy.taxeditor.editor.taxon"; //$NON-NLS-1$ private boolean dirty; @@ -124,7 +125,7 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia { /** {@inheritDoc} */ @Override public void doSave(IProgressMonitor monitor) { - monitor.beginTask("Saving Editor", 4); + monitor.beginTask(Messages.MultiPageTaxonEditor_SAVING_EDITOR, 4); try { if (!conversation.isBound()) { conversation.bind(); @@ -134,9 +135,8 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia { for (IEditorPart editorPage : getPages()) { if (editorPage instanceof TaxonNameEditor) { if (((TaxonNameEditor) editorPage).checkForEmptyNames()) { - MessageDialog.openWarning(AbstractUtility.getShell(), "No Name Specified", - "An attempt was made to save a taxon or synonym with " - + "an empty name. Operation was cancelled."); + MessageDialog.openWarning(AbstractUtility.getShell(), Messages.MultiPageTaxonEditor_NO_NAME_SPECIFIED, + Messages.MultiPageTaxonEditor_NO_NAME_SPECIFIED_MESSAGE); return; } } @@ -148,7 +148,7 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia { // commit the conversation and start a new transaction immediately input.merge(); - + conversation.commit(true); CdmApplicationState.getCurrentDataChangeService() .fireChangeEvent(new CdmChangeEvent(Action.Update, input.getTaxonNode() , MultiPageTaxonEditor.class), true); @@ -158,7 +158,7 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia { monitor.worked(1); } catch (Exception e) { setFocus(); - MessagingUtils.operationDialog(this, e, TaxeditorEditorPlugin.PLUGIN_ID,"saving a taxon", " Please close and reopen the taxon again."); + MessagingUtils.operationDialog(this, e, TaxeditorEditorPlugin.PLUGIN_ID,Messages.MultiPageTaxonEditor_SAVING_TAXON, Messages.MultiPageTaxonEditor_SAVING_TAXON_MESSAGE); disableEditor(true); } finally { monitor.done(); @@ -252,7 +252,7 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia { if (!(input instanceof TaxonEditorInput)) { throw new PartInitException( - "Invalid Input: Must be TaxonEditorInput"); + Messages.MultiPageTaxonEditor_INVALID_INPUT); } this.input = (TaxonEditorInput) input; @@ -294,8 +294,8 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia { partName = name.getTitleCache(); } - if (partName == null || partName.equals("")) { - partName = ("New taxon"); + if (partName == null || partName.equals("")) { //$NON-NLS-1$ + partName = (Messages.MultiPageTaxonEditor_NEW_TAXON); } setPartName(partName); @@ -447,10 +447,10 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia { if (editor instanceof IPostOperationEnabled) { ((IPostOperationEnabled) editor).postOperation(objectAffectedByOperation); } else { - MessagingUtils.warn(getClass(), "postOperation not enabled for editor " + editor); + MessagingUtils.warn(getClass(), Messages.MultiPageTaxonEditor_POST_OP_NOT_ENABLED + editor); } } - MessagingUtils.warn(getClass(), "postOperation called on MultiPageTaxonEditor. Can you make it more specific?"); + MessagingUtils.warn(getClass(), Messages.MultiPageTaxonEditor_POST_OP_CALLED); return false; } @@ -530,10 +530,7 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia { */ public void reload() { if (isDirty()) { - MessagingUtils.warningDialog("Editor has unsaved data", getClass(), "This editor can not be " - + "refreshed because it contains unsaved data. Refreshing " - + "this editor would discard the changes. Please save this editor, " - + "close and reopen it manually in order to get the latest content"); + MessagingUtils.warningDialog(Messages.MultiPageTaxonEditor_UNSAVED_DATA, getClass(), Messages.MultiPageTaxonEditor_UNSAVED_DATA_MESSAGE); } else { TaxonEditorInput input = (TaxonEditorInput) getEditorInput(); @@ -548,14 +545,14 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia { editorPart.redraw(); } } catch (Exception e) { - MessagingUtils.messageDialog("Error refreshing editor", getClass(), "Could not refresh this editor", e); + MessagingUtils.messageDialog(Messages.MultiPageTaxonEditor_REFRESH_ERROR, getClass(), Messages.MultiPageTaxonEditor_REFRESH_ERROR_MESSAGE, e); } } } @Override public String toString() { - return String.format("%s[%s]", this.getClass().getSimpleName(), getEditorInput()); + return String.format("%s[%s]", this.getClass().getSimpleName(), getEditorInput()); //$NON-NLS-1$ } @Override diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorDataChangeBehaviour.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorDataChangeBehaviour.java index 2ff0bd9bb..621525258 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorDataChangeBehaviour.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorDataChangeBehaviour.java @@ -84,7 +84,7 @@ public class MultiPageTaxonEditorDataChangeBehaviour extends AbstractDataChangeB if((event.getEntity() instanceof TaxonNode) && input.getTaxonNode().equals(event.getEntity())){ //EditorUtil.close(source); - logger.debug("Closing open editor for deleted taxon."); + logger.debug("Closing open editor for deleted taxon."); //$NON-NLS-1$ } } } @@ -100,7 +100,7 @@ public class MultiPageTaxonEditorDataChangeBehaviour extends AbstractDataChangeB if(input.getTaxon().getName().equals(event.getEntity())){ // set the name of the editor window source.setPartName(); - logger.debug("Updating title of taxons editor."); + logger.debug("Updating title of taxons editor."); //$NON-NLS-1$ } } // TODO other stuff to happen diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/Page.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/Page.java index f1f0c78b1..ae645c436 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/Page.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/Page.java @@ -19,7 +19,7 @@ import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; * @version 1.0 */ public enum Page { - NAME ("Name", TaxonNameEditor.class, 0); + NAME ("Name", TaxonNameEditor.class, 0); //$NON-NLS-1$ private String title; private Class clazz; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/SimpleSelectionProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/SimpleSelectionProvider.java index a1c38a7db..355b5e453 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/SimpleSelectionProvider.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/SimpleSelectionProvider.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -24,6 +24,8 @@ import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.widgets.Display; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; + /** *

SimpleSelectionProvider class.

* @@ -34,16 +36,18 @@ import org.eclipse.swt.widgets.Display; */ public class SimpleSelectionProvider implements ISelectionProvider { - private Set selectionChangedListeners = new HashSet(); + private static final String SETTING_SELECTION = Messages.SimpleSelectionProvider_SETTING_SELECTION; + private Set selectionChangedListeners = new HashSet(); private ISelection selection; private Job job; - + /* * (non-Javadoc) * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) */ /** {@inheritDoc} */ - public void addSelectionChangedListener( + @Override + public void addSelectionChangedListener( ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } @@ -57,7 +61,8 @@ public class SimpleSelectionProvider implements ISelectionProvider { * * @return a {@link org.eclipse.jface.viewers.ISelection} object. */ - public ISelection getSelection() { + @Override + public ISelection getSelection() { if (selection != null){ return selection; } @@ -71,7 +76,8 @@ public class SimpleSelectionProvider implements ISelectionProvider { * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) */ /** {@inheritDoc} */ - public void removeSelectionChangedListener( + @Override + public void removeSelectionChangedListener( ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); } @@ -81,9 +87,10 @@ public class SimpleSelectionProvider implements ISelectionProvider { * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection) */ /** {@inheritDoc} */ - public void setSelection(ISelection selection) { + @Override + public void setSelection(ISelection selection) { this.selection = selection; - + // cancel previous selection setting if(job != null){ if(job.getState() != Job.NONE){ @@ -91,41 +98,43 @@ public class SimpleSelectionProvider implements ISelectionProvider { } job = null; } - + if(job == null){ final SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection); final Display display = Display.getCurrent(); - job = new Job("Setting Selection"){ - + job = new Job(SETTING_SELECTION){ + @Override protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask("Setting Selection", 10); - + monitor.beginTask(SETTING_SELECTION, 10); + if(!monitor.isCanceled()){ display.asyncExec(new Runnable() { - - public void run() { + + @Override + public void run() { SimpleSelectionProvider.this.fireSelectionChanged(selectionChangedEvent); } }); } - + return Status.OK_STATUS; } - + }; - + job.setPriority(Job.DECORATE); job.schedule(); } - + } private void fireSelectionChanged(final SelectionChangedEvent event) { - + for (final ISelectionChangedListener listener : selectionChangedListeners) { SafeRunnable.run(new SafeRunnable() { - public void run() { + @Override + public void run() { listener.selectionChanged(event); } }); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInput.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInput.java index 782cd3da5..6fbc03197 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInput.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInput.java @@ -37,6 +37,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.DataChangeBridge; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; @@ -52,6 +53,8 @@ import eu.etaxonomy.taxeditor.store.CdmStore; */ public class TaxonEditorInput extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled, IPersistableElement { + private static final String INCORRECT_STATE = Messages.TaxonEditorInput_INCORRECT_STATE; + private final ConversationHolder conversation; private TaxonNode taxonNode; @@ -100,7 +103,7 @@ public class TaxonEditorInput extends CdmEntitySessionInput implements IEditorI TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNodeUuid, getTaxonNodePropertyPaths()); if(taxonNode == null){ - MessagingUtils.warningDialog("Not yet implemented", TaxonEditorInput.class, "Selected element is not type TaxonBase."); + MessagingUtils.warningDialog(Messages.TaxonEditorInput_NOT_IMPLEMENTED, TaxonEditorInput.class, Messages.TaxonEditorInput_NOT_IMPLEMENTED_MESSAGE); } init(taxonNode); @@ -114,7 +117,7 @@ public class TaxonEditorInput extends CdmEntitySessionInput implements IEditorI if (taxon.getTaxonNodes().size() == 0 && taxon.isMisapplication()){ // TODO get accepted taxon - MessagingUtils.info("trying to open Mispplied Name "); + MessagingUtils.info(Messages.TaxonEditorInput_OPEN_MISSAPPLIED_NAME); Set acceptedTaxa = new HashSet(); Set relations = taxon.getRelationsFromThisTaxon(); @@ -177,9 +180,7 @@ public class TaxonEditorInput extends CdmEntitySessionInput implements IEditorI } } else if (taxonNodes.size() == 0) { // this is an undesired state - MessagingUtils.warningDialog("Incorrect state",TaxonEditorInput.class,"The accepted " - + "taxon is not part of any classification. Editing with the " - + "name editor is currently not implemented. Try to edit the taxon with the bulk editor."); + MessagingUtils.warningDialog(INCORRECT_STATE,TaxonEditorInput.class,Messages.TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION); } } @@ -196,8 +197,7 @@ public class TaxonEditorInput extends CdmEntitySessionInput implements IEditorI setInputForMultipleNodes(conversation, taxonNodes); }else if(taxa.size() == 0){ // this is an undesired state - MessagingUtils.warningDialog("Incorrect state", TaxonEditorInput.class, "Trying to open accepted taxon for a synonym or misapplication but" + - " no accepted taxa are present. This should not have happened."); + MessagingUtils.warningDialog(INCORRECT_STATE, TaxonEditorInput.class, Messages.TaxonEditorInput_NO_ACCEPTED_TAXON_PRESENT); } } @@ -275,7 +275,7 @@ public class TaxonEditorInput extends CdmEntitySessionInput implements IEditorI } TaxonNameBase name = getTaxon().getName(); if (name == null || name.getTitleCache() == null) { - return "New taxon"; + return Messages.TaxonEditorInput_NEW_TAXON; } else { return name.getTitleCache(); } @@ -470,44 +470,44 @@ public class TaxonEditorInput extends CdmEntitySessionInput implements IEditorI private List getTaxonNodePropertyPaths() { List taxonNodePropertyPaths = new ArrayList(); for(String propertyPath : getTaxonBasePropertyPaths()) { - taxonNodePropertyPaths.add("taxon." + propertyPath); + taxonNodePropertyPaths.add("taxon." + propertyPath); //$NON-NLS-1$ } return taxonNodePropertyPaths; } private List getTaxonBasePropertyPaths() { List taxonBasePropertyPaths = Arrays.asList(new String[] { - "sec", - "createdBy", - "updatedBy", - "annotations", - "markers", - "credits", - "extensions", - "rights", - "sources", - "descriptions", - "relationsToThisTaxon", - "relationsFromThisTaxon", - "taxonNodes", - "descriptions.descriptionElements.feature", - "descriptions.descriptionElements.area", - "descriptions.descriptionElements.status", - "descriptions.markers", - "name.descriptions", - "name.typeDesignations", - "name.status", - "name.nomenclaturalReference.inReference", - "name.taxonBases.taxonNodes", - "name.relationsFromThisName", - "name.relationsToThisName", - "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.synonym.name.status", - "name.homotypicalGroup.typifiedNames.relationsToThisName.fromName", - "synonymRelations.synonym.name.status.type", - "synonymRelations.synonym.name.relationsToThisName.fromName", - "synonymRelations.synonym.name.nomenclaturalReference.inReference.authorship", - "synonymRelations.synonym.name.nomenclaturalReference.authorship", - "synonymRelations.synonym.name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations" + "sec", //$NON-NLS-1$ + "createdBy", //$NON-NLS-1$ + "updatedBy", //$NON-NLS-1$ + "annotations", //$NON-NLS-1$ + "markers", //$NON-NLS-1$ + "credits", //$NON-NLS-1$ + "extensions", //$NON-NLS-1$ + "rights", //$NON-NLS-1$ + "sources", //$NON-NLS-1$ + "descriptions", //$NON-NLS-1$ + "relationsToThisTaxon", //$NON-NLS-1$ + "relationsFromThisTaxon", //$NON-NLS-1$ + "taxonNodes", //$NON-NLS-1$ + "descriptions.descriptionElements.feature", //$NON-NLS-1$ + "descriptions.descriptionElements.area", //$NON-NLS-1$ + "descriptions.descriptionElements.status", //$NON-NLS-1$ + "descriptions.markers", //$NON-NLS-1$ + "name.descriptions", //$NON-NLS-1$ + "name.typeDesignations", //$NON-NLS-1$ + "name.status", //$NON-NLS-1$ + "name.nomenclaturalReference.inReference", //$NON-NLS-1$ + "name.taxonBases.taxonNodes", //$NON-NLS-1$ + "name.relationsFromThisName", //$NON-NLS-1$ + "name.relationsToThisName", //$NON-NLS-1$ + "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.synonym.name.status", //$NON-NLS-1$ + "name.homotypicalGroup.typifiedNames.relationsToThisName.fromName", //$NON-NLS-1$ + "synonymRelations.synonym.name.status.type", //$NON-NLS-1$ + "synonymRelations.synonym.name.relationsToThisName.fromName", //$NON-NLS-1$ + "synonymRelations.synonym.name.nomenclaturalReference.inReference.authorship", //$NON-NLS-1$ + "synonymRelations.synonym.name.nomenclaturalReference.authorship", //$NON-NLS-1$ + "synonymRelations.synonym.name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations" //$NON-NLS-1$ }); return taxonBasePropertyPaths; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInputFactory.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInputFactory.java index 6f7c64f89..1e7abe005 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInputFactory.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInputFactory.java @@ -16,6 +16,7 @@ import org.eclipse.ui.IElementFactory; import org.eclipse.ui.IMemento; import eu.etaxonomy.cdm.api.service.IClassificationService; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -51,13 +52,13 @@ public class TaxonEditorInputFactory implements IElementFactory { return null; } if (taxonNodeUuid == null || CdmStore.getService(IClassificationService.class).getTaxonNodeByUuid(UUID.fromString(taxonNodeUuid)) == null) { - MessagingUtils.warn(this.getClass(), "Couldn't find taxon node with UUID " + taxonNodeUuid); + MessagingUtils.warn(this.getClass(), Messages.TaxonEditorInputFactory_NOT_FOUND_TAXON + taxonNodeUuid); return null; } try { return TaxonEditorInput.NewInstance(UUID.fromString(taxonNodeUuid)); } catch (Exception e) { - MessagingUtils.warningDialog("Could not create element", TaxonEditorInputFactory.class, e.getMessage()); + MessagingUtils.warningDialog(Messages.TaxonEditorInputFactory_COULD_NOT_CREATE, TaxonEditorInputFactory.class, e.getMessage()); } return null; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/UseObjectManager.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/UseObjectManager.java index 4755d34bc..747e0b69e 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/UseObjectManager.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/UseObjectManager.java @@ -11,6 +11,7 @@ package eu.etaxonomy.taxeditor.editor; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.ui.IMemento; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.ContextListenerAdapter; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -19,22 +20,25 @@ import eu.etaxonomy.taxeditor.store.UseObjectStore; /** * The context listener will call this class when a new context is started. * It will reset the UseObjectStore to guarantee the static - * content of the store will be refreshed each time we load a new context. + * content of the store will be refreshed each time we load a new context. * @author a.theys * @author a.mueller * @created mar 13, 2012 */ public class UseObjectManager extends ContextListenerAdapter{ - public UseObjectManager() { + private static final String RESET_USAGE_DATA = Messages.UseObjectManager_RESET_DATA; + + + public UseObjectManager() { CdmStore.getContextManager().addContextListener(this); } @Override public void contextRefresh(IProgressMonitor monitor) { - monitor.subTask("Reset usage data"); - MessagingUtils.warn(getClass(), "Reset usage data"); + monitor.subTask(RESET_USAGE_DATA); + MessagingUtils.warn(getClass(), RESET_USAGE_DATA); UseObjectStore.reset(); } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditor.java index 5c697e7f3..02fc68758 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditor.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditor.java @@ -22,6 +22,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.model.common.Group; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.IDirtyMarkable; import eu.etaxonomy.taxeditor.ui.group.grantedauthority.CdmAuthorityCompositeViewer; @@ -75,7 +76,7 @@ public class CdmAuthorityEditor extends EditorPart implements IConversationEnabl @Override public void doSave(IProgressMonitor monitor) { try { - monitor.beginTask("Saving CDM Authority Editor", 1); + monitor.beginTask(Messages.CdmAuthorityEditor_SAVING_AUTHORITY_EDITOR, 1); getConversationHolder().commit(true); ((CdmAuthorityEditorInput) getEditorInput()).merge(); dirty = false; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/handler/EditCdmAuthoritiesHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/handler/EditCdmAuthoritiesHandler.java index 71a9b0c77..a52db81ca 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/handler/EditCdmAuthoritiesHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/handler/EditCdmAuthoritiesHandler.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -22,13 +22,14 @@ import eu.etaxonomy.cdm.model.common.Group; import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditor; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.LineSelection; import eu.etaxonomy.taxeditor.model.MessagingUtils; /** * Handler which opens an instance of the {@link CdmAuthorityEditor} for a particluar group. - * + * * @author cmathew * @created Mar 28, 2013 * @@ -36,38 +37,40 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils; public class EditCdmAuthoritiesHandler extends AbstractHandler { - /* (non-Javadoc) + private static final String OPENING_CDM_AUTHORITIES = Messages.EditCdmAuthoritiesHandler_OPEN_AUTHORITIES; + + /* (non-Javadoc) * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { BulkEditor editor = (BulkEditor) EditorUtil.getActiveEditor(); - - ISelection selection = editor.getSite().getSelectionProvider().getSelection(); + + ISelection selection = editor.getSite().getSelectionProvider().getSelection(); if(selection instanceof LineSelection){ - + final LineSelection lineSelection = (LineSelection) selection; - - Job job = new Job("Opening Cdm Authorities"){ + + Job job = new Job(OPENING_CDM_AUTHORITIES){ @Override protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask("Opening Cdm Authorities", lineSelection.size()); - + monitor.beginTask(OPENING_CDM_AUTHORITIES, lineSelection.size()); + for(final Object selectedObject : lineSelection.toArray()){ if(selectedObject instanceof Group){ - + Display.getDefault().asyncExec(new Runnable(){ @Override - public void run() { + public void run() { try { EditorUtil.openCdmAuthorities(((Group)selectedObject).getUuid()); } catch (Exception e) { - MessagingUtils.warningDialog("Could not open CDM Authority Editor", EditorUtil.class, e.getMessage()); + MessagingUtils.warningDialog(Messages.EditCdmAuthoritiesHandler_COULD_NOT_OPEN_AUTHORITIES, EditorUtil.class, e.getMessage()); } } - + }); monitor.worked(1); } @@ -75,12 +78,12 @@ public class EditCdmAuthoritiesHandler extends AbstractHandler { monitor.done(); return Status.OK_STATUS; } - + }; - + job.setPriority(Job.SHORT); - job.schedule(); - + job.schedule(); + } return null; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/EditNewTaxonHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/EditNewTaxonHandler.java index f46fb3a62..181a00cb0 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/EditNewTaxonHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/EditNewTaxonHandler.java @@ -36,7 +36,7 @@ public class EditNewTaxonHandler extends AbstractHandler implements IHandler { /** {@inheritDoc} */ public Object execute(ExecutionEvent event) throws ExecutionException { - logger.debug("Handler called: " + this.getClass().getCanonicalName()); + logger.debug("Handler called: " + this.getClass().getCanonicalName()); //$NON-NLS-1$ try { EditorUtil.openEmpty(null); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java index 44dadd8e9..245f8fb6d 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java @@ -12,6 +12,7 @@ import eu.etaxonomy.cdm.model.taxon.Classification; import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.editor.EditorUtil; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput; import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase; import eu.etaxonomy.taxeditor.model.MessagingUtils; @@ -21,7 +22,11 @@ import eu.etaxonomy.taxeditor.store.CdmStore; public class OpenChecklistEditorHandler extends DefaultOpenHandlerBase { - @Override + private static final String FAILED_TO_OPEN_EDITOR = Messages.OpenChecklistEditorHandler_FAILED_TO_OPEN; + private static final String COULD_NOT_OPEN_DISTRIBUTION_EDITOR_THE_HIERARCHY_IS_CORRUPTED = Messages.OpenChecklistEditorHandler_COULD_NOT_OPEN_MESSAGE; + private static final String COULD_NOT_OPEN_DISTRIBUTION_EDITOR = Messages.OpenChecklistEditorHandler_COULD_NOT_OPEN_TITLE; + + @Override protected ITaxonTreeNode getEntity(UUID uuid) { ITaxonTreeNode taxonTreeNode = CdmStore.getService(ITaxonNodeService.class).load(uuid); if(taxonTreeNode==null){ @@ -34,8 +39,8 @@ public class OpenChecklistEditorHandler extends DefaultOpenHandlerBasePLUGIN_ID="eu.etaxonomy.taxeditor.editor" */ - public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.editor"; + public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.editor"; //$NON-NLS-1$ // The shared instance private static TaxeditorEditorPlugin plugin; @@ -47,7 +47,7 @@ public class TaxeditorEditorPlugin extends AbstractUIPlugin { // CdmStore.getContextManager().addContextListener(vcl); plugin = this; - logger.trace("Plugin started: " + this.getBundle().getSymbolicName()); + logger.trace("Plugin started: " + this.getBundle().getSymbolicName()); //$NON-NLS-1$ } @@ -55,7 +55,7 @@ public class TaxeditorEditorPlugin extends AbstractUIPlugin { public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context); - logger.trace("Plugin stopped"); + logger.trace("Plugin stopped"); //$NON-NLS-1$ } /** diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/KeyEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/KeyEditor.java index 90b0c3479..1cd36d711 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/KeyEditor.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/KeyEditor.java @@ -27,6 +27,7 @@ import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput; import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyGraphEditor; import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListEditor; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.DataChangeBridge; import eu.etaxonomy.taxeditor.model.IDirtyMarkable; import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; @@ -40,7 +41,7 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils; public class KeyEditor extends FormEditor implements IConversationEnabled, IDirtyMarkable, IPartContentHasDetails, ICdmChangeListener { - public static final String ID = "eu.etaxonomy.taxeditor.editor.key"; + public static final String ID = "eu.etaxonomy.taxeditor.editor.key"; //$NON-NLS-1$ private ConversationHolder conversation; @@ -73,7 +74,7 @@ public class KeyEditor extends FormEditor implements IConversationEnabled, @Override public void doSave(IProgressMonitor monitor) { try { - monitor.beginTask("Saving Editor", 1); + monitor.beginTask(Messages.KeyEditor_SAVING, 1); getConversationHolder().bind(); getConversationHolder().commit(true); polytomousKeyEditorInput.merge(); @@ -147,7 +148,9 @@ public class KeyEditor extends FormEditor implements IConversationEnabled, */ @Override public void changed(Object element) { - editorDirtyStateChanged(); + if (element != null){ + editorDirtyStateChanged(); + } IEditorPart activeEditor = getActiveEditor(); if (activeEditor instanceof IDirtyMarkable) { ((IDirtyMarkable) activeEditor).changed(element); @@ -222,9 +225,9 @@ public class KeyEditor extends FormEditor implements IConversationEnabled, try { addPage(0, new PolytomousKeyListEditor(this), polytomousKeyEditorInput); - setPageText(0, "List"); + setPageText(0, Messages.KeyEditor_LIST); addPage(1, new PolytomousKeyGraphEditor(this), polytomousKeyEditorInput); - setPageText(1, "Graph"); + setPageText(1, Messages.KeyEditor_GRAPH); } catch (PartInitException e) { MessagingUtils.error(getClass(), e); } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorInput.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorInput.java index e75a12622..c0c2d4778 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorInput.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorInput.java @@ -100,9 +100,9 @@ public class PolytomousKeyEditorInput extends AbstractIdentificationEditorInput< Map> propertyPathsMap = new HashMap>(); List polytomousKeyNodePropertyPaths = Arrays.asList(new String[] { - "statement" + "statement" //$NON-NLS-1$ }); - propertyPathsMap.put("children", polytomousKeyNodePropertyPaths); + propertyPathsMap.put("children", polytomousKeyNodePropertyPaths); //$NON-NLS-1$ return propertyPathsMap; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorLabels.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorLabels.java index 03843d512..94d7fd20d 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorLabels.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorLabels.java @@ -8,6 +8,8 @@ */ package eu.etaxonomy.taxeditor.editor.key.polytomous; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; + /** * @author cmathew * @date 21 Jul 2015 @@ -15,12 +17,11 @@ package eu.etaxonomy.taxeditor.editor.key.polytomous; */ public interface PolytomousKeyEditorLabels { - public static final String CREATE_CHILD_POLYTOMOUS_KEY_NODE_LABEL = "Create Child Polytomous Key Node"; - public static final String CREATE_SIBLING_POLYTOMOUS_KEY_NODE_LABEL = "Create Sibling Polytomous Key Node"; - public static final String INSERT_NODE_POLYTOMOUS_KEY_NODE_LABEL = "Insert Node Polytomous Key Node"; - public static final String DELETE_NODE_POLYTOMOUS_KEY_NODE_LABEL = "Insert Node Polytomous Key Node"; + public static final String CREATE_CHILD_POLYTOMOUS_KEY_NODE_LABEL = Messages.PolytomousKeyEditorLabels_CREATE_NODE; + public static final String CREATE_SIBLING_POLYTOMOUS_KEY_NODE_LABEL = Messages.PolytomousKeyEditorLabels_CREATE_SIBLING; + public static final String INSERT_NODE_POLYTOMOUS_KEY_NODE_LABEL = Messages.PolytomousKeyEditorLabels_INSERT_NODE; + public static final String DELETE_NODE_POLYTOMOUS_KEY_NODE_LABEL = Messages.PolytomousKeyEditorLabels_DELETE_NODE; - public static final String NO_KEY_NODE_FOR_CHILD_SELECTED_MESSAGE = "No Key Node Selected.Please right-click on a specific key node to create a new child key node."; - public static final String NO_KEY_NODE_FOR_SIBLING_SELECTED_MESSAGE = "No Key Node Selected.Please right-click on a specific key node to create a new sibling key node."; - public static final String NO_KEY_NODE_FOR_INSERT_NODE_SELECTED_MESSAGE = "No Key Node Selected.Please right-click on a specific key node to create a new key node."; + public static final String NO_KEY_NODE_FOR_INSERT_NODE_SELECTED_MESSAGE = Messages.PolytomousKeyEditorLabels_NO_NODE_SELECTED_MESSAGE; + public static final String NO_KEY_NODE_SELECTED = Messages.PolytomousKeyEditorLabels_NO_NODE_SELECTED_TITLE; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyGraphContentProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyGraphContentProvider.java index 9a0bf8eb9..f2ac1a9c3 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyGraphContentProvider.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyGraphContentProvider.java @@ -17,6 +17,7 @@ import org.eclipse.zest.core.viewers.IGraphContentProvider; import eu.etaxonomy.cdm.model.description.PolytomousKey; import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship; /** @@ -61,7 +62,7 @@ class PolytomousKeyGraphContentProvider implements IGraphContentProvider { children.add(((PolytomousKey) parent).getRoot()); } else { throw new RuntimeException( - "Parent element has to be PolytomousKeyNode or PolytomousKey, but was: " + Messages.PolytomousKeyGraphContentProvider_WRONG_PARENT + parent.getClass()); } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyGraphEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyGraphEditor.java index 61544abb7..469727c24 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyGraphEditor.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyGraphEditor.java @@ -19,7 +19,7 @@ public class PolytomousKeyGraphEditor extends AbstractGraphKeyEditor implements IPolytomousKeyEditorPage { - public static final String ID = "eu.etaxonomy.taxeditor.editor.key.polytomous.graph"; + public static final String ID = "eu.etaxonomy.taxeditor.editor.key.polytomous.graph"; //$NON-NLS-1$ private final KeyEditor editor; /** diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyLabelProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyLabelProvider.java index 52869b3bb..506d2cec6 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyLabelProvider.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyLabelProvider.java @@ -19,6 +19,7 @@ import eu.etaxonomy.cdm.model.common.Language; import eu.etaxonomy.cdm.model.description.KeyStatement; import eu.etaxonomy.cdm.model.description.PolytomousKey; import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -31,9 +32,9 @@ import eu.etaxonomy.taxeditor.store.CdmStore; class PolytomousKeyLabelProvider extends LabelProvider implements IEntityStyleProvider { - public static final String LEAF_BUT_NO_TAXON = "leaf but no taxon"; - public static final String NO_NODE_NUMBER = "No node number set"; - public static final String EMPTY = ""; + public static final String LEAF_BUT_NO_TAXON = Messages.PolytomousKeyLabelProvider_LEAF_BUT_NO_TAXON; + public static final String NO_NODE_NUMBER = Messages.PolytomousKeyLabelProvider_NO_NODE_NUMBER_SET; + public static final String EMPTY = ""; //$NON-NLS-1$ @Override public String getText(Object element) { @@ -50,18 +51,18 @@ class PolytomousKeyLabelProvider extends LabelProvider implements } if (keyNode.getNodeNumber() != null) { - String statementLabel = ""; + String statementLabel = ""; //$NON-NLS-1$ String nodeNumber = keyNode.getNodeNumber().toString(); KeyStatement question = keyNode.getQuestion(); if (question != null) { - statementLabel += " " + statementLabel += " " //$NON-NLS-1$ + question.getLabelText(CdmStore .getDefaultLanguage()); } - return String.format("%s. %s", nodeNumber, statementLabel); + return String.format("%s. %s", nodeNumber, statementLabel); //$NON-NLS-1$ } else { return NO_NODE_NUMBER; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListEditor.java index 330539ce1..61e859296 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListEditor.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListEditor.java @@ -45,6 +45,7 @@ import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.key.KeyEditor; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.IDirtyMarkable; import eu.etaxonomy.taxeditor.model.MessagingUtils; @@ -145,7 +146,7 @@ public class PolytomousKeyListEditor extends EditorPart implements } } - public static final String ID = "eu.etaxonomy.taxeditor.editor.key.polytomous.list"; + public static final String ID = "eu.etaxonomy.taxeditor.editor.key.polytomous.list"; //$NON-NLS-1$ private TableViewer viewer; @@ -295,7 +296,7 @@ public class PolytomousKeyListEditor extends EditorPart implements // This will create the columns for the table private void createColumns(TableViewer viewer) { Table table = viewer.getTable(); - String[] titles = { "Node", "Question", "Edge", "Statement", "Link", "Taxon" }; + String[] titles = { Messages.PolytomousKeyListEditor_NODE, Messages.PolytomousKeyListEditor_QUESTION, Messages.PolytomousKeyListEditor_EDGE, Messages.PolytomousKeyListEditor_STATEMENT, Messages.PolytomousKeyListEditor_LINK, Messages.PolytomousKeyListEditor_TAXON }; int[] bounds = { 50, 200, 50, 200, 100, 200 }; for (int i = 0; i < titles.length; i++) { diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListItem.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListItem.java index ee44f7fcf..187900a79 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListItem.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListItem.java @@ -27,6 +27,7 @@ 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; @@ -70,7 +71,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements label_statement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY()); Link link = new Link(getLayoutComposite(), SWT.NONE); - link.setText("" + getItemLink() + ""); + link.setText("" + getItemLink() + ""); //$NON-NLS-1$ //$NON-NLS-2$ link.setData(getItemLinkData()); link.addSelectionListener(getLinkSelectionListener()); @@ -112,16 +113,16 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements private String getItemNumber() { if (isParentRoot()) { - return "root"; + return "root"; //$NON-NLS-1$ } else { PolytomousKeyNode parent = getParent(); String itemNumber = parent.getNodeNumber() != null ? parent - .getNodeNumber().toString() : "NaN"; + .getNodeNumber().toString() : "NaN"; //$NON-NLS-1$ int index = parent.getChildren().indexOf(entity); for (int i = 0; i < index; i++) { - itemNumber += "'"; + itemNumber += "'"; //$NON-NLS-1$ } return itemNumber; @@ -130,11 +131,11 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements private String getItemQuestion() { if (isParentRoot()) { - return ""; + return ""; //$NON-NLS-1$ } else { KeyStatement question = getParent().getQuestion(); return question != null ? question.getLabelText(CdmStore - .getDefaultLanguage()) : ""; + .getDefaultLanguage()) : ""; //$NON-NLS-1$ } } @@ -142,12 +143,12 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements private String getItemStatement() { KeyStatement statement = entity.getStatement(); return statement != null ? CdmUtils.Nz(statement.getLabelText(CdmStore - .getDefaultLanguage())) : "No statement"; + .getDefaultLanguage())) : Messages.PolytomousKeyListItem_NO_STATEMENT; } private String getItemLink() { String taxonString = entity.getTaxon() != null ? entity.getTaxon() - .getName().getTitleCache() : "Taxon empty"; + .getName().getTitleCache() : Messages.PolytomousKeyListItem_TAXON_EMPTY; return entity.getChildren().isEmpty() ? taxonString : entity .getNodeNumber().toString(); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListLabelProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListLabelProvider.java index 76bf8b81a..9a4e1658d 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListLabelProvider.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListLabelProvider.java @@ -36,9 +36,9 @@ public class PolytomousKeyListLabelProvider extends StyledCellLabelProvider { SWT.COLOR_BLUE); private Styler styler; - private static final String EMPTY = ""; + private static final String EMPTY = ""; //$NON-NLS-1$ // TODO make this configurable via preferences - private static final String INCREMENTOR_CHARACTER = "'"; + private static final String INCREMENTOR_CHARACTER = "'"; //$NON-NLS-1$ /* * (non-Javadoc) @@ -109,7 +109,7 @@ public class PolytomousKeyListLabelProvider extends StyledCellLabelProvider { private String getItemNumber(PolytomousKeyNode node) { if (isParentRoot(node)) { - return "root"; + return "root"; //$NON-NLS-1$ } else { String itemNumber = (node.getParent().getNodeNumber() != null) ? node.getParent().getNodeNumber().toString() : EMPTY; @@ -137,7 +137,7 @@ public class PolytomousKeyListLabelProvider extends StyledCellLabelProvider { private String getItemQuestion(PolytomousKeyNode node) { if (isParentRoot(node)) { - return ""; + return ""; //$NON-NLS-1$ } else { KeyStatement question = getParent(node).getQuestion(); return question != null ? CdmUtils.Nz(question.getLabelText(CdmStore.getDefaultLanguage())) : EMPTY; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyPropertyTester.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyPropertyTester.java index 1964e04f5..181539db7 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyPropertyTester.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyPropertyTester.java @@ -19,7 +19,7 @@ import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; * */ public class PolytomousKeyPropertyTester extends PropertyTester { - private static final String KEYNODE = "isKeyNode"; + private static final String KEYNODE = "isKeyNode"; //$NON-NLS-1$ /** * {@inheritDoc} diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/CreateChildNodeHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/CreateChildNodeHandler.java index e9df7653e..7df790d0a 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/CreateChildNodeHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/CreateChildNodeHandler.java @@ -1,5 +1,5 @@ /** - * + * */ package eu.etaxonomy.taxeditor.editor.key.polytomous.handler; @@ -18,20 +18,22 @@ import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.key.KeyEditor; import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage; +import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorLabels; import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListEditor; import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.CreateNodeOperation; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; /** * @author n.hoffmann - * + * */ public class CreateChildNodeHandler extends AbstractHandler { /* * (non-Javadoc) - * + * * @see * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands. * ExecutionEvent) @@ -48,7 +50,7 @@ public class CreateChildNodeHandler extends AbstractHandler { if (editorPage instanceof PolytomousKeyListEditor) { PolytomousKeyListEditor klEditor = (PolytomousKeyListEditor) editorPage; if(klEditor.getTableItemCount() == 0) { - PolytomousKey pk = (PolytomousKey)klEditor.getViewerInputKey(); + PolytomousKey pk = klEditor.getViewerInputKey(); try { String label = event.getCommand().getName(); IUndoContext undoContext = EditorUtil.getUndoContext(); @@ -56,9 +58,9 @@ public class CreateChildNodeHandler extends AbstractHandler { AbstractPostOperation operation = new CreateNodeOperation( label, undoContext, pk.getRoot(), editorPage); - EditorUtil.executeOperation(operation); + AbstractUtility.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } else { @@ -75,15 +77,16 @@ public class CreateChildNodeHandler extends AbstractHandler { AbstractPostOperation operation = new CreateNodeOperation( label, undoContext, keyNode, editorPage); - EditorUtil.executeOperation(operation); + AbstractUtility.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } else { MessageDialog.openInformation( - EditorUtil.getShell(), - "No Key Node Selected", - "Please right-click on a specific key node to create a new child key node."); + AbstractUtility.getShell(), + PolytomousKeyEditorLabels.NO_KEY_NODE_SELECTED, + PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_INSERT_NODE_SELECTED_MESSAGE + ); } } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/CreateSiblingNodeHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/CreateSiblingNodeHandler.java index f0c00125a..f34fd782b 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/CreateSiblingNodeHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/CreateSiblingNodeHandler.java @@ -10,27 +10,28 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.handlers.HandlerUtil; -import eu.etaxonomy.cdm.model.description.PolytomousKey; import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.key.KeyEditor; import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage; +import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorLabels; import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListEditor; import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.CreateNodeOperation; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; /** * Handler responsible for creating sibling nodes of Polytomous Key Nodes - * @author c.mathew - * + * @author c.mathew + * */ public class CreateSiblingNodeHandler extends AbstractHandler { - /* + /* * (non-Javadoc) - * + * * @see * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands. * ExecutionEvent) @@ -44,7 +45,7 @@ public class CreateSiblingNodeHandler extends AbstractHandler { IPolytomousKeyEditorPage editorPage = (IPolytomousKeyEditorPage) ((KeyEditor) editor) .getActiveEditor(); - if (editorPage instanceof PolytomousKeyListEditor) { + if (editorPage instanceof PolytomousKeyListEditor) { IStructuredSelection selection = (IStructuredSelection) HandlerUtil .getCurrentSelection(event); @@ -59,18 +60,19 @@ public class CreateSiblingNodeHandler extends AbstractHandler { AbstractPostOperation operation = new CreateNodeOperation( label, undoContext, keyNode.getParent(), editorPage); - EditorUtil.executeOperation(operation); + AbstractUtility.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } else { MessageDialog.openInformation( - EditorUtil.getShell(), - "No Key Node Selected", - "Please right-click on a specific key node to create a new sibling key node."); + AbstractUtility.getShell(), + PolytomousKeyEditorLabels.NO_KEY_NODE_SELECTED, + PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_INSERT_NODE_SELECTED_MESSAGE + ); } } - } + } return null; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/DeleteNodeHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/DeleteNodeHandler.java index a3cc0b6e1..01a42bedc 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/DeleteNodeHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/DeleteNodeHandler.java @@ -10,7 +10,6 @@ package eu.etaxonomy.taxeditor.editor.key.polytomous.handler; import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.common.NotDefinedException; import org.eclipse.core.commands.operations.AbstractOperation; import org.eclipse.core.commands.operations.IUndoContext; @@ -21,14 +20,14 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.handlers.HandlerUtil; -import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.key.KeyEditor; import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage; import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorLabels; -import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListEditor; import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.DeleteNodeOperation; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; @@ -40,7 +39,13 @@ import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; public class DeleteNodeHandler extends AbstractPolytomousKeyNodeHandler { + private static final String DO_YOU_REALLY_WANT_TO_DELETE_THE_NODE_THIS_OPERATION_IS_NOT_REVERSABLE = Messages.DeleteNodeHandler_REALLY_DELETE; + private static final String CONFIRM_DELETION_OF_CHILDREN = Messages.DeleteNodeHandler_CONFIRM_DELETE; + private static final String NO = Messages.DeleteNodeHandler_NO; + private static final String CANCEL = Messages.DeleteNodeHandler_CANCEL; + private static final String YES = Messages.DeleteNodeHandler_YES; PolytomousKeyNode nodeToBeDeleted; + boolean deleteChildren; /** * @param label */ @@ -55,84 +60,70 @@ public class DeleteNodeHandler extends AbstractPolytomousKeyNodeHandler { super(PolytomousKeyEditorLabels.DELETE_NODE_POLYTOMOUS_KEY_NODE_LABEL); } - /* - * (non-Javadoc) - * - * @see - * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands. - * ExecutionEvent) - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - IEditorPart editor = HandlerUtil.getActiveEditor(event); - - if (editor.isDirty()){ - boolean proceed = MessageDialog.openQuestion(null, - "Save changes", "You have made changes that must be saved before you can delete the node. Would you like to proceed?"); - if (!proceed) { - return null; - }else{ - editor.doSave(EditorUtil.getMonitor()); - } - } - if (editor instanceof KeyEditor) { - IPolytomousKeyEditorPage editorPage = (IPolytomousKeyEditorPage) ((KeyEditor) editor) - .getActiveEditor(); - - IStructuredSelection selection = (IStructuredSelection) HandlerUtil - .getCurrentSelection(event); - - if (selection.getFirstElement() instanceof PolytomousKeyNode) { - try { - String label = event.getCommand().getName(); - IUndoContext undoContext = EditorUtil.getUndoContext(); - - for (Object element : selection.toArray()) { - PolytomousKeyNode keyNode = HibernateProxyHelper.deproxy(element, PolytomousKeyNode.class); - - AbstractPostOperation operation = new DeleteNodeOperation( - label, undoContext, keyNode, editorPage); - EditorUtil.executeOperation(operation); - } - - } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); - } - } else { - MessageDialog.openInformation( - EditorUtil.getShell(), - "No Key Node Selected", - "Please right-click on a specific key node to delete a key node."); - } - } - - return null; - } - /** * {@inheritDoc} */ @Override public IStatus allowOperations(ExecutionEvent event) { IEditorPart editor = HandlerUtil.getActiveEditor(event); - + IStructuredSelection selection = (IStructuredSelection) HandlerUtil + .getCurrentSelection(event); + AbstractPostOperation operation; if (editor instanceof KeyEditor) { editorPage = (IPolytomousKeyEditorPage) ((KeyEditor) editor) .getActiveEditor(); + } - if (editorPage instanceof PolytomousKeyListEditor) { - PolytomousKeyListEditor klEditor = (PolytomousKeyListEditor) editorPage; - IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); - if (selection.getFirstElement() instanceof PolytomousKeyNode) { - nodeToBeDeleted = (PolytomousKeyNode) selection.getFirstElement(); - } else { - return new Status(IStatus.ERROR, - "unknown", - PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_CHILD_SELECTED_MESSAGE); + + if (selection.getFirstElement() instanceof PolytomousKeyNode) { + try { + String label = event.getCommand().getName(); + IUndoContext undoContext = EditorUtil.getUndoContext(); + PolytomousKeyNode node = (PolytomousKeyNode)selection.getFirstElement(); + nodeToBeDeleted = node; + MessageDialog dialog; + if (node.getChildren().size()>0){ + String[] buttonLables = {YES, NO,CANCEL}; + dialog = new MessageDialog(null, CONFIRM_DELETION_OF_CHILDREN, null, DO_YOU_REALLY_WANT_TO_DELETE_THE_NODE_THIS_OPERATION_IS_NOT_REVERSABLE+Messages.DeleteNodeHandler_NODE_HAS_CHILDREN, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0); + int returnCode = dialog.open(); + + if (returnCode == 0){ + deleteChildren = false; + } else if (returnCode == 1){ + deleteChildren = true; + } else{ + return new Status(IStatus.CANCEL, "unknown", //$NON-NLS-1$ + null); + } + + + }else{ + String[] buttonLables = {YES, CANCEL}; + dialog = new MessageDialog(null, CONFIRM_DELETION_OF_CHILDREN, null, DO_YOU_REALLY_WANT_TO_DELETE_THE_NODE_THIS_OPERATION_IS_NOT_REVERSABLE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 1); + int returnCode = dialog.open(); + + if (returnCode == 0){ + deleteChildren = false; + } else if (returnCode == 1){ + return new Status(IStatus.CANCEL, "unknown", //$NON-NLS-1$ + null); } } + + + + } catch (NotDefinedException e) { + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ + } + } else { + MessageDialog.openInformation( + AbstractUtility.getShell(), + PolytomousKeyEditorLabels.NO_KEY_NODE_SELECTED, + PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_INSERT_NODE_SELECTED_MESSAGE + ); } + return Status.OK_STATUS; } @@ -142,13 +133,31 @@ public class DeleteNodeHandler extends AbstractPolytomousKeyNodeHandler { @Override public AbstractOperation prepareOperation(ExecutionEvent event) { IUndoContext undoContext = EditorUtil.getUndoContext(); - String label = ""; + String label = ""; //$NON-NLS-1$ + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor.isDirty()){ + boolean proceed = MessageDialog.openQuestion(null, + Messages.DeleteNodeHandler_SAVE_CHANGES_TITLE, Messages.DeleteNodeHandler_SAVE_CHANGES_MESSAGE); + if (!proceed) { + return null; + }else{ + editor.doSave(EditorUtil.getMonitor()); + } + } + try { label = event.getCommand().getName(); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } - return new DeleteNodeOperation(label, undoContext, nodeToBeDeleted, editorPage); + DeleteNodeOperation operation ; + if (deleteChildren){ + operation = new DeleteNodeOperation(label, undoContext, nodeToBeDeleted, editorPage, true); + }else{ + operation = new DeleteNodeOperation(label, undoContext, nodeToBeDeleted, editorPage, false); + } + + return operation; } /** diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/InsertNewNodeHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/InsertNewNodeHandler.java index 62fce56ba..4b14c7e20 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/InsertNewNodeHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/InsertNewNodeHandler.java @@ -62,8 +62,8 @@ public class InsertNewNodeHandler extends AbstractPolytomousKeyNodeHandler{ parentNode = ((PolytomousKeyNode) selection.getFirstElement()).getParent(); } else { return new Status(IStatus.ERROR, - "unknown", - PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_CHILD_SELECTED_MESSAGE); + "unknown", //$NON-NLS-1$ + PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_INSERT_NODE_SELECTED_MESSAGE); } } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RefreshNodeNumberingHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RefreshNodeNumberingHandler.java index e077a60ae..c34fef3a3 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RefreshNodeNumberingHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RefreshNodeNumberingHandler.java @@ -47,7 +47,7 @@ public class RefreshNodeNumberingHandler extends AbstractHandler { label, undoContext, keyNode, editorPage); EditorUtil.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RemotingCreateChildPolytomousKeyNodeHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RemotingCreateChildPolytomousKeyNodeHandler.java index c01933d6e..dcdba9838 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RemotingCreateChildPolytomousKeyNodeHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RemotingCreateChildPolytomousKeyNodeHandler.java @@ -61,8 +61,8 @@ public class RemotingCreateChildPolytomousKeyNodeHandler extends AbstractPolytom parentNode = (PolytomousKeyNode) selection.getFirstElement(); } else { return new Status(IStatus.ERROR, - "unknown", - PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_CHILD_SELECTED_MESSAGE); + "unknown", //$NON-NLS-1$ + PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_INSERT_NODE_SELECTED_MESSAGE); } } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RemotingCreateSiblingPolytomousKeyNodeHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RemotingCreateSiblingPolytomousKeyNodeHandler.java index 175a2dce5..98846a407 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RemotingCreateSiblingPolytomousKeyNodeHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RemotingCreateSiblingPolytomousKeyNodeHandler.java @@ -48,8 +48,8 @@ public class RemotingCreateSiblingPolytomousKeyNodeHandler extends AbstractPolyt parentNode = (PolytomousKeyNode) selection.getFirstElement(); } else { return new Status(IStatus.ERROR, - "unknown", - PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_SIBLING_SELECTED_MESSAGE); + "unknown", //$NON-NLS-1$ + PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_INSERT_NODE_SELECTED_MESSAGE); } return Status.OK_STATUS; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/DeleteNodeOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/DeleteNodeOperation.java index 92803c8d4..1f04dd1d4 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/DeleteNodeOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/DeleteNodeOperation.java @@ -8,14 +8,14 @@ import org.eclipse.core.commands.operations.IUndoContext; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.MessageDialog; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.api.service.DeleteResult; import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService; import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; @@ -29,14 +29,15 @@ public class DeleteNodeOperation extends AbstractPostOperation0){ - if(! MessageDialog.openQuestion(null, "Confirm deletion of children", "The selected node has children, do you want to delete them, too?")) { + if(deleteChildren) { result = service.delete(node.getUuid(), false); } else{ result = service.delete(node.getUuid(), true); @@ -77,7 +78,7 @@ public class DeleteNodeOperation extends AbstractPostOperationChecklist-Editor lassen sich die Gebiete mit dem Verbreitungs-Wizard auswählen. +ChecklistEditor_RANK=Rang +ChecklistEditor_RETRIEVE_NODES=Lade Taxonknoten +ChecklistEditor_SAVE_EDITOR=Speichere Editor +ChecklistEditor_SEARCH=Suche: +ChecklistEditor_TAXON=Taxon +ChecklistEditor_UNKNOWN=unbekannt +OpenRelatedConceptHandler_COULD_NOT_OPEN=Konnte Taxon nicht öffnen +OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE=Konnte Taxon nicht öffnen: %s +ListenToSelectionChangeContextMenu_LINK=Verknüpfe mit Taxonauswahl +ListenToSelectionChangeContextMenu_UNLINK=Verknüpfung mit Taxonauswahl aufheben +DeleteDerivateHandler_INVALID_SELECTION=Auswahl ungültig +OpenDerivativeEditorForDescriptionElement_NO_SPECIMENS=Keine Specimens gefunden +OpenDerivativeEditorForDescriptionElement_NO_SPECIMENS_MESSAGE=Keine Specimens für die Auswahl. (Gibt es vielleicht noch ungespeicherte Änderungen?) +OpenDerivativeEditorForTaxonNode_COULD_NOT_OPEN=Specimen-Editor konnte nicht geöffnet werden +DeleteDescriptionElementOperation_DESC_NOT_FOUND=Beschreibung konnte nicht gefunden werden! +DeleteHandler_CONFIRM_DELETION=Löschen bestätigen +DeleteHandler_CONFIRM_DELETION_MESSAGE=Wollen sie wirklich das Medienobjektlöschen? +DeleteHandler_DELETE=Löschen +DeleteHandler_INVALID_SELECTION=Auswahl ungültig für den DeleteHandler +DeleteHandler_SKIP=Überspringen +DeleteMediaHandler_CONFIRM=Löschen bestätigen +DeleteMediaHandler_CONFIRM_MESSAGE=Wollen sie wirklich das Medienobjektlöschen? +DeleteMediaHandler_DELETE=Löschen +DeleteMediaHandler_SKIP=Überspringen +DerivateSearchComposite_ALL=Alle +DerivateSearchComposite_DERIVATE_TYPE=Derivat-Typ +DerivateSearchComposite_NEW_TEXT=Neuer Text +DerivateSearchComposite_NO=Nein +DerivateSearchComposite_SEARCH=Suche +DerivateSearchComposite_TAXON=Taxon +DerivateSearchComposite_TAXON_ASSIGNMENT=Taxonbestimmung +DerivateSearchComposite_TITLE_CACHE=Titlecache +DerivateSearchComposite_YES=Ja +DerivateViewEditorInput_SPECIMEN_EDITOR=Specimen-Editor diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java index ce6ff028a..6154ad848 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java @@ -58,6 +58,7 @@ import eu.etaxonomy.taxeditor.editor.ISecuredEditor; import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; import eu.etaxonomy.taxeditor.editor.SimpleSelectionProvider; import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup; import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer; import eu.etaxonomy.taxeditor.editor.name.container.AcceptedGroup; @@ -91,7 +92,7 @@ public class TaxonNameEditor extends EditorPart implements ISelectionListener, IDropTargetable, ISecuredEditor { /** Constant ID="eu.etaxonomy.taxeditor.editor.taxon.name" */ - public static final String ID = "eu.etaxonomy.taxeditor.editor.taxon.name"; + public static final String ID = "eu.etaxonomy.taxeditor.editor.taxon.name"; //$NON-NLS-1$ private Taxon taxon; @@ -276,7 +277,7 @@ public class TaxonNameEditor extends EditorPart implements PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus(); if (getSelectedContainer() == null) { throw new IllegalStateException( - "There should always be a selected object."); + Messages.TaxonNameEditor_THERE_SHOULD_ALWAYS_BE); } getSelectedContainer().setSelected(); @@ -468,13 +469,13 @@ public class TaxonNameEditor extends EditorPart implements @Override public void doSave(IProgressMonitor monitor) { - monitor.beginTask("Saving names", getGroupedContainers().size()); + monitor.beginTask(Messages.TaxonNameEditor_SAVING_NAMES, getGroupedContainers().size()); try { // check for empty names for (AbstractGroupedContainer container : getGroupedContainers()) { - monitor.subTask("Saving composite: " + monitor.subTask(Messages.TaxonNameEditor_SAVING_COMPOSITES + container.getTaxonBase().getTitleCache()); container.persistName(); @@ -505,13 +506,13 @@ public class TaxonNameEditor extends EditorPart implements throws PartInitException { if (!(input != null)) { - throw new PartInitException("Invalid Input: Must be IEditorInput"); + throw new PartInitException(Messages.TaxonNameEditor_INVALID_INPUT); } if (input.getAdapter(Taxon.class) != null) { taxon = CdmBase.deproxy(input.getAdapter(Taxon.class), Taxon.class); } else { - throw new PartInitException("Invalid Input: Taxon cannot be null"); + throw new PartInitException(Messages.TaxonNameEditor_INVALID_INPUT_TAXON_NULL); } setSite(site); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroupedContainer.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroupedContainer.java index d9be7cb02..f77eb24e5 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroupedContainer.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroupedContainer.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -28,7 +28,6 @@ import org.eclipse.swt.events.ControlListener; import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.FocusListener; -import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.MouseAdapter; @@ -48,6 +47,7 @@ import org.eclipse.ui.forms.widgets.TableWrapLayout; import eu.etaxonomy.cdm.common.CdmUtils; import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; +import eu.etaxonomy.cdm.model.name.INonViralName; import eu.etaxonomy.cdm.model.name.NameRelationship; import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.cdm.model.name.TaxonNameBase; @@ -55,6 +55,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.strategy.parser.ParserProblem; import eu.etaxonomy.taxeditor.editor.CdmDataTransfer; import eu.etaxonomy.taxeditor.editor.EditorUtil; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; import eu.etaxonomy.taxeditor.editor.name.container.EditorAnnotation.EditorAnnotationType; import eu.etaxonomy.taxeditor.editor.name.dnd.NameEditorDragListener; @@ -86,7 +87,7 @@ import eu.etaxonomy.taxeditor.preference.Resources; * The IManagedForm can also used for drawing borders by calling * the method createBorderSupport(). *

- * + * * @author p.ciardelli * @author n.hoffmann * @created 02.06.2008 @@ -123,7 +124,7 @@ abstract public class AbstractGroupedContainer implements *

* Constructor for AbstractGroupedContainer. *

- * + * * @param editor * a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} * object. @@ -170,13 +171,14 @@ abstract public class AbstractGroupedContainer implements protected void createListener() { nameCompositeModifyListener = new ModifyListener() { - public void modifyText(ModifyEvent e) { + @Override + public void modifyText(ModifyEvent e) { // mark the composite dirty setDirty(true); // parse the text String text = nameViewer.getTextWidget().getText(); - NonViralName name = parseHandler.parse(text); + TaxonNameBase name = (TaxonNameBase)parseHandler.parse(text); getTaxonBase().setName(name); getTaxonBase().setTitleCache((getTaxonBase().generateTitle())); @@ -192,7 +194,7 @@ abstract public class AbstractGroupedContainer implements /* * (non-Javadoc) - * + * * @see * org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt * .events.FocusEvent) @@ -231,7 +233,7 @@ abstract public class AbstractGroupedContainer implements *

* getEmptyTextPrompt *

- * + * * @return a {@link java.lang.String} object. */ protected String getEmptyTextPrompt() { @@ -239,7 +241,7 @@ abstract public class AbstractGroupedContainer implements } /** - * + * */ private void showNameRelations() { TaxonNameBase name = getName(); @@ -309,7 +311,7 @@ abstract public class AbstractGroupedContainer implements } /** - * + * */ public void showAnnotations() { @@ -322,19 +324,19 @@ abstract public class AbstractGroupedContainer implements .addAnnotation( new EditorAnnotation(EditorAnnotationType.WARNING, 0, - "This name may only be edited in the details view.")); + Messages.AbstractGroupedContainer_EDIT_IN_DETAILS_VIEW)); } if (isNameUsedMultipleTimes()) { getNameViewer().addAnnotation( new EditorAnnotation(EditorAnnotationType.WARNING, 0, - "This taxons name is used multiple times.")); + Messages.AbstractGroupedContainer_MULTIPLE_USE)); } } /** - * + * */ private void showParsingProblems() { String text = getNameViewer().getTextWidget().getText(); @@ -374,7 +376,7 @@ abstract public class AbstractGroupedContainer implements *

* handleSplitText *

- * + * * @param text * a {@link java.lang.String} object. */ @@ -384,16 +386,17 @@ abstract public class AbstractGroupedContainer implements .parseReferencedName(text, null); EditorUtil.executeOperation(new CreateSynonymInNewGroupOperation( - "New Heterotypic Synonym", getEditor().getUndoContext(), + Messages.AbstractGroupedContainer_NEW_HETERO_SYNONYM, getEditor().getUndoContext(), getEditor().getTaxon(), synonymName, getEditor())); } /** * Refreshes the display with latest data from the model. - * + * * Note: Will not parse the text and not calculate errors! */ - public void refresh() { + @Override + public void refresh() { // showNameRelations(); String text = NameHelper.getDisplayNameWithRef(getTaxonBase()); @@ -421,7 +424,7 @@ abstract public class AbstractGroupedContainer implements } /** - * + * */ protected abstract void updateIcon(); @@ -435,7 +438,7 @@ abstract public class AbstractGroupedContainer implements protected abstract void updateNonEditableInfo(); /** - * + * */ private void enableFreeText() { setEnabled(isFreetextEditingAllowed()); @@ -444,7 +447,7 @@ abstract public class AbstractGroupedContainer implements /** * Checks whether the freetext should be editable based on specific empty * fields. - * + * * @return */ private boolean isFreetextEditingAllowed() { @@ -459,19 +462,19 @@ abstract public class AbstractGroupedContainer implements } /** - * Checks whether there are more than one, non-orphaned taxon bases + * Checks whether there are more than one, non-orphaned taxon bases * attached to the taxon name - * + * * @return */ private boolean isNameUsedMultipleTimes() { - + Set taxonBases = getName().getTaxonBases(); Iterator tbItr = taxonBases.iterator(); int nonOrphanedTaxonBaseCount = taxonBases.size(); - + while(tbItr.hasNext()) { - TaxonBase tb = tbItr.next(); + TaxonBase tb = tbItr.next(); if(tb.isOrphaned()) { nonOrphanedTaxonBaseCount--; } @@ -512,7 +515,7 @@ abstract public class AbstractGroupedContainer implements *

* getTaxonBase *

- * + * * @return the taxonBase */ public T getTaxonBase() { @@ -523,11 +526,11 @@ abstract public class AbstractGroupedContainer implements *

* getName *

- * + * * @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object. */ public TaxonNameBase getName() { - return (TaxonNameBase) HibernateProxyHelper.deproxy(getTaxonBase() + return HibernateProxyHelper.deproxy(getTaxonBase() .getName()); } @@ -546,7 +549,7 @@ abstract public class AbstractGroupedContainer implements // @Override // protected IStatus run(IProgressMonitor monitor) { // - final NonViralName name = parseHandler + final TaxonNameBase name = (TaxonNameBase)parseHandler .parseAndResolveDuplicates(unparsedNameString); // // Display.getDefault().asyncExec(new Runnable(){ @@ -573,14 +576,14 @@ abstract public class AbstractGroupedContainer implements *

* Getter for the field group. *

- * + * * @return a * {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup} * object. */ public AbstractGroup getGroup() { if (group == null) { - throw new IllegalStateException("Group shall not be null."); + throw new IllegalStateException("Group shall not be null."); //$NON-NLS-1$ } return group; } @@ -628,7 +631,7 @@ abstract public class AbstractGroupedContainer implements *

* Getter for the field control. *

- * + * * @return a {@link org.eclipse.swt.widgets.Composite} object. */ public Composite getControl() { @@ -686,7 +689,7 @@ abstract public class AbstractGroupedContainer implements *

* setIcon *

- * + * * @param icon * a {@link org.eclipse.swt.graphics.Image} object. */ @@ -698,7 +701,7 @@ abstract public class AbstractGroupedContainer implements *

* setIndent *

- * + * * @param indent * a int. */ @@ -711,7 +714,7 @@ abstract public class AbstractGroupedContainer implements control.layout(); } else { new RuntimeException( - "Couldn't indent - composite's layout must be TableWrapLayout."); + "Couldn't indent - composite's layout must be TableWrapLayout."); //$NON-NLS-1$ } } @@ -728,7 +731,7 @@ abstract public class AbstractGroupedContainer implements *

* isSelected *

- * + * * @return a boolean. */ public boolean isSelected() { @@ -739,7 +742,7 @@ abstract public class AbstractGroupedContainer implements *

* colorSelected *

- * + * * @param mode * a int. */ @@ -780,7 +783,8 @@ abstract public class AbstractGroupedContainer implements Display display = Display.getCurrent(); Runnable runnable = new Runnable() { - public void run() { + @Override + public void run() { getEditor().getManagedForm().setInput(selection); } }; @@ -792,7 +796,7 @@ abstract public class AbstractGroupedContainer implements *

* setBackground *

- * + * * @param color * a {@link org.eclipse.swt.graphics.Color} object. */ @@ -808,7 +812,7 @@ abstract public class AbstractGroupedContainer implements /* * (non-Javadoc) - * + * * @see * org.eclipse.swt.widgets.Control#setFont(org.eclipse.swt.graphics.Font) */ @@ -816,7 +820,7 @@ abstract public class AbstractGroupedContainer implements *

* setFont *

- * + * * @param font * a {@link org.eclipse.swt.graphics.Font} object. */ @@ -828,14 +832,14 @@ abstract public class AbstractGroupedContainer implements *

* Getter for the field nameViewer. *

- * + * * @return a {@link eu.etaxonomy.taxeditor.editor.name.container.NameViewer} * object. */ public NameViewer getNameViewer() { if (nameViewer == null) { throw new RuntimeException( - "The Name Viewer is corrupt for Name Container: " + "The Name Viewer is corrupt for Name Container: " //$NON-NLS-1$ + getTaxonBase().getName().getTitleCache()); } return nameViewer; @@ -845,7 +849,7 @@ abstract public class AbstractGroupedContainer implements * If textViewer has already been set, it will show a * prompt along the lines of * "Click here to start entering data" when empty. - * + * * @param prompt * a {@link java.lang.String} object. */ @@ -858,14 +862,16 @@ abstract public class AbstractGroupedContainer implements setFocusListener(new FocusListener() { - public void focusGained(FocusEvent e) { + @Override + public void focusGained(FocusEvent e) { if (document.get().equals(prompt)) { textControl.setFont(getViewerFont()); - document.set(""); + document.set(""); //$NON-NLS-1$ } } - public void focusLost(FocusEvent e) { + @Override + public void focusLost(FocusEvent e) { if (document.getLength() == 0) { initEmptyText(); } @@ -885,7 +891,7 @@ abstract public class AbstractGroupedContainer implements *

* getViewerFont *

- * + * * @return a {@link org.eclipse.swt.graphics.Font} object. */ abstract protected Font getViewerFont(); @@ -907,7 +913,7 @@ abstract public class AbstractGroupedContainer implements *

* Setter for the field focusListener. *

- * + * * @param focusListener * a {@link org.eclipse.swt.events.FocusListener} object. */ @@ -923,7 +929,7 @@ abstract public class AbstractGroupedContainer implements *

* setDirty *

- * + * * @param isDirty * a boolean. */ @@ -938,10 +944,11 @@ abstract public class AbstractGroupedContainer implements *

* isDirty *

- * + * * @return a boolean. */ - public boolean isDirty() { + @Override + public boolean isDirty() { return isDirty; } @@ -949,7 +956,7 @@ abstract public class AbstractGroupedContainer implements *

* setMenu *

- * + * * @param menu * a {@link org.eclipse.swt.widgets.Menu} object. */ @@ -965,7 +972,7 @@ abstract public class AbstractGroupedContainer implements *

* setDraggableControl *

- * + * * @param controls * an array of {@link org.eclipse.swt.widgets.Control} objects. */ @@ -977,7 +984,7 @@ abstract public class AbstractGroupedContainer implements *

* setIsDraggable *

- * + * * @param draggable * a boolean. */ @@ -987,7 +994,7 @@ abstract public class AbstractGroupedContainer implements if (draggableControls == null) { throw new NullPointerException( - "Draggable controls must be set to add draggability"); + "Draggable controls must be set to add draggability"); //$NON-NLS-1$ } Transfer[] types = new Transfer[] { CdmDataTransfer.getInstance() }; @@ -1036,7 +1043,7 @@ abstract public class AbstractGroupedContainer implements * nonEditableInfo is a label displayed underneath a GroupedComposite's * input field. For instance, NameComposites display things like name * relations, sec. references, etc. here. - * + * * @param info * the text to display in the label * @param append @@ -1049,8 +1056,8 @@ abstract public class AbstractGroupedContainer implements info = info.toUpperCase(); if (append) { - nonEditableText += ", " + info; - nonEditableHoverText += "\n" + info; + nonEditableText += ", " + info; //$NON-NLS-1$ + nonEditableHoverText += "\n" + info; //$NON-NLS-1$ } else { nonEditableText = info; nonEditableHoverText = info; @@ -1058,7 +1065,7 @@ abstract public class AbstractGroupedContainer implements if (nonEditableInfoLabel == null) { nonEditableInfoLabel = getEditor().getToolkit().createLabel( - control, ""); + control, ""); //$NON-NLS-1$ TableWrapData layoutData = new TableWrapData( TableWrapData.FILL_GRAB, TableWrapData.TOP); // Set indent to viewer ruler's width @@ -1092,10 +1099,11 @@ abstract public class AbstractGroupedContainer implements *

* Getter for the field data. *

- * + * * @return a T object. */ - public T getData() { + @Override + public T getData() { return data; } @@ -1103,12 +1111,12 @@ abstract public class AbstractGroupedContainer implements *

* Setter for the field data. *

- * + * * @param data * a T object. */ public void setData(T data) { - this.data = (T) HibernateProxyHelper.deproxy(data); + this.data = HibernateProxyHelper.deproxy(data); } /** @@ -1126,7 +1134,7 @@ abstract public class AbstractGroupedContainer implements }; getNameViewer().getTextWidget().addVerifyListener(lineBreakListener); - + } abstract class LabelEllipsisListener extends ControlAdapter { @@ -1177,7 +1185,7 @@ abstract public class AbstractGroupedContainer implements *

* Setter for the field group. *

- * + * * @param group * a * {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup} @@ -1198,7 +1206,7 @@ abstract public class AbstractGroupedContainer implements /* * (non-Javadoc) - * + * * @see * org.eclipse.ui.forms.IFormPart#initialize(org.eclipse.ui.forms.IManagedForm * ) @@ -1211,7 +1219,7 @@ abstract public class AbstractGroupedContainer implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.forms.IFormPart#dispose() */ @Override @@ -1224,7 +1232,7 @@ abstract public class AbstractGroupedContainer implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.forms.IFormPart#commit(boolean) */ @Override @@ -1236,7 +1244,7 @@ abstract public class AbstractGroupedContainer implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.forms.IFormPart#setFormInput(java.lang.Object) */ @Override @@ -1246,7 +1254,7 @@ abstract public class AbstractGroupedContainer implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.forms.IFormPart#setFocus() */ @Override @@ -1256,28 +1264,28 @@ abstract public class AbstractGroupedContainer implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.forms.IFormPart#isStale() */ @Override public boolean isStale() { return false; } - + public void setDisabled(boolean disabled) { this.enabled = !disabled; setEnabled(enabled); } - + public void setEnabled(boolean enabled) { this.enabled = enabled; Color color = enabled ? control.getForeground() : EditorUtil.getColor(Resources.COLOR_DISABLED_EDITOR); - + getNameViewer().getTextWidget().setEditable(enabled); getNameViewer().getTextWidget().setEnabled(enabled); getNameViewer().getTextWidget().setForeground(color); } - + public boolean isEnabled(){ return enabled; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ConceptContainer.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ConceptContainer.java index 1e10a4308..e1fccf3e7 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ConceptContainer.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ConceptContainer.java @@ -15,6 +15,7 @@ import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; import eu.etaxonomy.taxeditor.editor.EditorUtil; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; import eu.etaxonomy.taxeditor.preference.Resources; @@ -72,9 +73,9 @@ public class ConceptContainer extends AbstractGroupedContainer { } if (getTaxonBase().getSec() == null) { - setNonEditableInfo("sec. ???", false); + setNonEditableInfo("sec. ???", false); //$NON-NLS-1$ } else { - setNonEditableInfo("sec. " + getTaxonBase().getSec().getTitleCache(), false); + setNonEditableInfo("sec. " + getTaxonBase().getSec().getTitleCache(), false); //$NON-NLS-1$ } } @@ -124,7 +125,7 @@ public class ConceptContainer extends AbstractGroupedContainer { public void showAnnotations() { if(getData().getSec() == null){ getNameViewer().addAnnotation( - new EditorAnnotation(0, "This taxon requires a sec. reference.")); + new EditorAnnotation(0, Messages.ConceptContainer_SEC_REQUIRED)); } super.showAnnotations(); } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/EditorAnnotation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/EditorAnnotation.java index 362fa0b31..3cfad1f75 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/EditorAnnotation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/EditorAnnotation.java @@ -13,6 +13,7 @@ import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Canvas; import eu.etaxonomy.cdm.strategy.parser.ParserProblem; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.ImageResources; /** @@ -137,10 +138,10 @@ public class EditorAnnotation extends Annotation implements IAnnotationPresentat @Override public String getText() { if (EditorAnnotationType.ERROR.name().equals(getType())) { - return "Error: " + text; + return Messages.EditorAnnotation_ERROR + text; } if (EditorAnnotationType.WARNING.name().equals(getType())) { - return "Warning: " + text; + return Messages.EditorAnnotation_WARNING + text; } return super.getText(); } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/IContainerConstants.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/IContainerConstants.java index 603c964fb..567dfa71c 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/IContainerConstants.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/IContainerConstants.java @@ -11,6 +11,7 @@ package eu.etaxonomy.taxeditor.editor.name.container; import org.eclipse.swt.graphics.Image; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.ImageResources; /** @@ -32,15 +33,15 @@ public interface IContainerConstants { * ************ COMPOSITE TYPES ************ */ /** Constant ACCEPTED_TAXON="accepted_name_composite" */ - public static final String ACCEPTED_TAXON = "accepted_name_composite"; + public static final String ACCEPTED_TAXON = "accepted_name_composite"; //$NON-NLS-1$ /** Constant HOMOTYPIC_SYNONYM="homotypic_name_composite" */ - public static final String HOMOTYPIC_SYNONYM = "homotypic_name_composite"; + public static final String HOMOTYPIC_SYNONYM = "homotypic_name_composite"; //$NON-NLS-1$ /** Constant HETEROTYPIC_SYNONYM="heterotypic_name_composite" */ - public static final String HETEROTYPIC_SYNONYM = "heterotypic_name_composite"; + public static final String HETEROTYPIC_SYNONYM = "heterotypic_name_composite"; //$NON-NLS-1$ /** Constant MISAPPLIED_NAME="misappliedname_name_composite" */ - public static final String MISAPPLIED_NAME = "misappliedname_name_composite"; + public static final String MISAPPLIED_NAME = "misappliedname_name_composite"; //$NON-NLS-1$ /** Constant CONCEPTRELATION="concept_name_composite" */ - public static final String CONCEPTRELATION = "concept_name_composite"; + public static final String CONCEPTRELATION = "concept_name_composite"; //$NON-NLS-1$ /** * ************ INDENTATIONS ************ @@ -85,9 +86,9 @@ public interface IContainerConstants { /** * ************ TRANSFORMATIONS ************ */ - public static final String ADD_GROUP_BASIONYM = "add_group_basionym"; + public static final String ADD_GROUP_BASIONYM = "add_group_basionym"; //$NON-NLS-1$ /** Constant REMOVE_GROUP_BASIONYM="remove_group_basionym" */ - public static final String REMOVE_GROUP_BASIONYM = "remove_group_basionym"; + public static final String REMOVE_GROUP_BASIONYM = "remove_group_basionym"; //$NON-NLS-1$ - public static final String EMPTY_NAME_PROMPT = "Click to add name"; + public static final String EMPTY_NAME_PROMPT = Messages.IContainerConstants_CLICK_ADD_NAME; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineBreakListener.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineBreakListener.java index adf17288e..969e7ae7b 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineBreakListener.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineBreakListener.java @@ -48,7 +48,7 @@ import org.eclipse.swt.events.VerifyListener; public abstract class LineBreakListener implements VerifyListener{ - private static String LINE_BREAK = System.getProperty("line.separator"); + private static String LINE_BREAK = System.getProperty("line.separator"); //$NON-NLS-1$ /** @@ -80,7 +80,7 @@ public abstract class LineBreakListener implements VerifyListener{ // make a new, empty synonym if (widgetText.length() == cursorPosition && verifyText.equals(LINE_BREAK)) { - handleSplitText(""); + handleSplitText(""); //$NON-NLS-1$ return; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineWrapSquigglesStrategy.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineWrapSquigglesStrategy.java index a0a79ab13..f71bce16f 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineWrapSquigglesStrategy.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineWrapSquigglesStrategy.java @@ -28,7 +28,7 @@ import org.eclipse.swt.graphics.Point; public class LineWrapSquigglesStrategy extends SquigglesStrategy { /** Constant ID="linewrap_squigglesstrategy" */ - public static final String ID = "linewrap_squigglesstrategy"; + public static final String ID = "linewrap_squigglesstrategy"; //$NON-NLS-1$ private GC gc; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineWrapSupport.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineWrapSupport.java index 5dcd2f01e..ec83e5f59 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineWrapSupport.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineWrapSupport.java @@ -54,7 +54,7 @@ public class LineWrapSupport { if (viewer == null) { throw new IllegalArgumentException( - "The provided TextViewer object is null."); + "The provided TextViewer object is null."); //$NON-NLS-1$ } // this.viewer = viewer; @@ -65,7 +65,7 @@ public class LineWrapSupport { this.lineCount = textWidget.getLinePixel(textWidget.getLineCount()); this.scrolledForm = form.getForm(); - logger.trace(this.getClass().getSimpleName() + " created"); + logger.trace(this.getClass().getSimpleName() + " created"); //$NON-NLS-1$ } /** diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/MisapplicationContainer.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/MisapplicationContainer.java index d37adb99a..6c8e0d471 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/MisapplicationContainer.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/MisapplicationContainer.java @@ -13,6 +13,7 @@ import org.eclipse.swt.graphics.Font; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.taxeditor.editor.EditorUtil; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.preference.Resources; /** @@ -64,14 +65,14 @@ public class MisapplicationContainer extends AbstractGroupedContainer { if (getMisappliedName().getAppendedPhrase() != null ){ setNonEditableInfo(getMisappliedName().getAppendedPhrase(), false); }else{ - setNonEditableInfo("sec. ???", false); + setNonEditableInfo("sec. ???", false); //$NON-NLS-1$ } } else { String title = getMisappliedName().getSec().getTitleCache(); - title = title.replace("&", "&&"); - String sec = "sec. "; + title = title.replace("&", "&&"); //$NON-NLS-1$ //$NON-NLS-2$ + String sec = "sec. "; //$NON-NLS-1$ if (getMisappliedName().getAppendedPhrase() != null ){ - sec = getMisappliedName().getAppendedPhrase() + " "+sec; + sec = getMisappliedName().getAppendedPhrase() + " "+sec; //$NON-NLS-1$ } setNonEditableInfo(sec + title, false); } @@ -99,7 +100,7 @@ public class MisapplicationContainer extends AbstractGroupedContainer { public void showAnnotations() { if(getData().getSec() == null){ getNameViewer().addAnnotation( - new EditorAnnotation(0, "This misapplication requires a sec. reference.")); + new EditorAnnotation(0, Messages.MisapplicationContainer_SEC_REF_REQUIRED)); } super.showAnnotations(); } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/NameViewer.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/NameViewer.java index 2149e5d75..d02ab0313 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/NameViewer.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/NameViewer.java @@ -100,7 +100,7 @@ public class NameViewer extends SourceViewer { ruler.getControl().moveAbove(getTextWidget()); annotationModel = new AnnotationModel(); - this.setDocument(new Document(""), annotationModel); + this.setDocument(new Document(""), annotationModel); //$NON-NLS-1$ createAnnotationPainter(); @@ -151,7 +151,7 @@ public class NameViewer extends SourceViewer { if (ruler instanceof RulerWithIcon) { ((RulerWithIcon) ruler).setIcon(icon); } else { - throw new IllegalStateException("Viewer's IVerticalRuler is not an instance of RulerWithIcon."); + throw new IllegalStateException("Viewer's IVerticalRuler is not an instance of RulerWithIcon."); //$NON-NLS-1$ } } @@ -269,7 +269,7 @@ public class NameViewer extends SourceViewer { */ public void setText(String text) { if (text == null) { - text = ""; + text = ""; //$NON-NLS-1$ } try { Assert.isNotNull(text); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/RulerWithIcon.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/RulerWithIcon.java index db4416160..c7f27a422 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/RulerWithIcon.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/RulerWithIcon.java @@ -255,7 +255,7 @@ public class RulerWithIcon implements IVerticalRuler, IVerticalRulerExtension { Rectangle r = icon.getBounds(); if (r.width > size.x || r.height > size.y) { - logger.warn(r.width + "x" + r.height + " icon too big for " + size.x + "x" + size.y + " Canvas."); + logger.warn(r.width + "x" + r.height + " icon too big for " + size.x + "x" + size.y + " Canvas."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } else { // Set destination coordinates to center icon diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/SynonymContainer.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/SynonymContainer.java index a267b0cb0..6afab5410 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/SynonymContainer.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/SynonymContainer.java @@ -20,6 +20,7 @@ import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; import eu.etaxonomy.cdm.model.name.TaxonNameBase; import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.taxeditor.editor.EditorUtil; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.preference.Resources; @@ -62,7 +63,7 @@ public class SynonymContainer extends AbstractGroupedContainer { setFont(getViewerFont()); if(getName() == null){ - MessagingUtils.warn(getClass(), "Synonym with a null name detected. This should never happen."); + MessagingUtils.warn(getClass(), Messages.SynonymContainer_SYNONYM_NULL_NAME); } initTextViewer(); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/dnd/NameEditorDropTargetListener.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/dnd/NameEditorDropTargetListener.java index 661c0c7fb..926782adc 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/dnd/NameEditorDropTargetListener.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/dnd/NameEditorDropTargetListener.java @@ -1,5 +1,5 @@ /** - * + * */ package eu.etaxonomy.taxeditor.editor.name.dnd; @@ -16,6 +16,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.IDropTargetable; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; import eu.etaxonomy.taxeditor.editor.name.container.AbstractHomotypicalGroupContainer; import eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup; @@ -34,9 +35,9 @@ import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; * @version $Id: $ */ public class NameEditorDropTargetListener extends DropTargetAdapter { - + private IDropTargetable target; - + /** *

Constructor for NameEditorDropTargetListener.

@@ -46,41 +47,43 @@ public class NameEditorDropTargetListener extends DropTargetAdapter { public NameEditorDropTargetListener(IDropTargetable target){ this.target = target; } - + /** {@inheritDoc} */ - public void dragEnter(DropTargetEvent dropTargetEvent) { + @Override + public void dragEnter(DropTargetEvent dropTargetEvent) { target.dragEntered(); - + // if(! EditorUtil.getActiveMultiPageTaxonEditor().equals(editor.getMultiPageTaxonEditor())){ // editor.getMultiPageTaxonEditor().setFocus(); // } } - + /** {@inheritDoc} */ - public void dragLeave(DropTargetEvent dropTargetEvent) { + @Override + public void dragLeave(DropTargetEvent dropTargetEvent) { target.dragLeft(); } - + /** {@inheritDoc} */ - public void drop(DropTargetEvent dropTargetEvent) { - + @Override + public void drop(DropTargetEvent dropTargetEvent) { + TaxonBase taxonBase = getDroppedTaxonBase(dropTargetEvent); - + Assert.isNotNull(taxonBase); - + if(taxonBase.getHomotypicGroup().equals(getHomotypicalGroup())){ // do nothing when dragged to the same group dropTargetEvent.detail = DND.DROP_NONE; return; } - + // Execute operations at end of drag event AbstractPostOperation operation = createOperation(taxonBase); - + // Execute operation if it has been initiated if (operation == null) { - MessagingUtils.warn(getClass(), "User unsuccessfully tried to drop: " + taxonBase.getClass() + - ". Target: " + target); + MessagingUtils.warn(getClass(), String.format(Messages.NameEditorDropTargetListener_UNSUCCESSFULL_DROP, taxonBase.getClass(), target)); dropTargetEvent.detail = DND.DROP_NONE; } else { EditorUtil.executeOperation(operation); @@ -89,56 +92,56 @@ public class NameEditorDropTargetListener extends DropTargetAdapter { if (!target.equals(EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor())){ ((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).redraw(); ((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).getConversationHolder().commit(); - + } target.getEditor().redraw(); - + } - + private AbstractPostOperation createOperation(TaxonBase taxonBase) { - + if(taxonBase instanceof Synonym){ Synonym synonym = (Synonym) taxonBase; - + if(target instanceof AbstractHomotypicalGroupContainer){ HomotypicalGroup homotypicalGroup = ((AbstractHomotypicalGroupContainer) target).getGroup(); - - return new ChangeHomotypicGroupOperation("Change Homotypical Group", getEditor().getUndoContext(), + + return new ChangeHomotypicGroupOperation(Messages.NameEditorDropTargetListener_CHANGE_HOMOTYPICAL_GROUP, getEditor().getUndoContext(), getEditor().getTaxon(), synonym, homotypicalGroup, target); } else if(target instanceof MisappliedGroup){ - return new ChangeSynonymToMisapplicationOperation("Change Synonym to Misapplication", getEditor().getUndoContext(), + return new ChangeSynonymToMisapplicationOperation(Messages.NameEditorDropTargetListener_CHANGE_SYNONYM_TO_MISAPP, getEditor().getUndoContext(), getEditor().getTaxon(), synonym, target); } else if(target instanceof TaxonNameEditor){ if (target.equals(getEditor())){ - return new ChangeHomotypicGroupOperation("Change Homotypical Group", getEditor().getUndoContext(), + return new ChangeHomotypicGroupOperation(Messages.NameEditorDropTargetListener_CHANGE_HOMOTYPICAL_GROUP, getEditor().getUndoContext(), getEditor().getTaxon(), synonym, null, target); } else{ getEditor().getConversationHolder().commit(); ((TaxonNameEditor) target).getConversationHolder().commit(); - - return new MoveSynonymToAnotherAcceptedTaxonOperation("Change accepted Taxon", getEditor().getUndoContext(), getEditor().getTaxon().getUuid(), synonym.getUuid(), ((TaxonNameEditor) target).getTaxon(), null ); - + + return new MoveSynonymToAnotherAcceptedTaxonOperation(Messages.NameEditorDropTargetListener_CHANGE_ACC_TAXON, getEditor().getUndoContext(), getEditor().getTaxon().getUuid(), synonym.getUuid(), ((TaxonNameEditor) target).getTaxon(), null ); + } } - + }else if(taxonBase instanceof Taxon){ Taxon concept = (Taxon) taxonBase; - + if(target instanceof AbstractHomotypicalGroupContainer){ HomotypicalGroup homotypicalGroup = ((AbstractHomotypicalGroupContainer) target).getGroup(); - - return new ChangeConceptToSynonymOperation("Change to Synonym", getEditor().getUndoContext(), + + return new ChangeConceptToSynonymOperation(Messages.NameEditorDropTargetListener_CHANGE_SYNONYM, getEditor().getUndoContext(), getEditor().getTaxon(), concept, homotypicalGroup, target); } else if(target instanceof MisappliedGroup ){ - return new ChangeConceptRelationshipTypeOperation("Change", getEditor().getUndoContext(), + return new ChangeConceptRelationshipTypeOperation(Messages.NameEditorDropTargetListener_CHANGE, getEditor().getUndoContext(), getEditor().getTaxon(), concept, TaxonRelationshipType.MISAPPLIED_NAME_FOR(), target); } } - + return null; } @@ -148,29 +151,29 @@ public class NameEditorDropTargetListener extends DropTargetAdapter { // pass } - + private HomotypicalGroup getHomotypicalGroup() { if(target instanceof AbstractHomotypicalGroupContainer){ return ((AbstractHomotypicalGroupContainer) target).getGroup(); } return null; - } - + } + private TaxonBase getDroppedTaxonBase(DropTargetEvent dropTargetEvent){ if(dropTargetEvent.data instanceof ICdmBase[]){ - + ICdmBase[] cdmBaseObjects = (ICdmBase[]) dropTargetEvent.data; - + if(cdmBaseObjects[0] instanceof TaxonBase){ return (TaxonBase) cdmBaseObjects[0]; } } return null; } - + /** - * @return - * + * @return + * */ private TaxonNameEditor getEditor() { return (TaxonNameEditor) EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor(); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeSynonymToAcceptedTaxonHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeSynonymToAcceptedTaxonHandler.java index ec76aee68..aedd5f43a 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeSynonymToAcceptedTaxonHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeSynonymToAcceptedTaxonHandler.java @@ -34,6 +34,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToAcceptedTaxonOperation; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; @@ -61,14 +62,14 @@ public class ChangeSynonymToAcceptedTaxonHandler extends AbstractHandler impleme IEditorInput input = editor.getEditorInput(); if (!(input instanceof TaxonEditorInput)) { - logger.error("Editor input is not TaxonEditorInput"); + logger.error("Editor input is not TaxonEditorInput"); //$NON-NLS-1$ return null; } // Get synonym from selection StructuredSelection selection = (StructuredSelection) HandlerUtil.getCurrentSelection(event); if (!(selection.getFirstElement() instanceof Synonym)) { - logger.error("Selection does not contain a Synonym"); + logger.error("Selection does not contain a Synonym"); //$NON-NLS-1$ return null; } @@ -87,7 +88,7 @@ public class ChangeSynonymToAcceptedTaxonHandler extends AbstractHandler impleme List excludeTaxa = new ArrayList(); //excludeTaxa.add(taxon.getUuid());//there are some cases where the accepted taxon should be the parent of the new created accepted taxon - TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select parent", null, null, ((TaxonEditorInput) input).getTaxonNode().getClassification()); + TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), Messages.ChangeSynonymToAcceptedTaxonHandler_SELECT_PARENT, null, null, ((TaxonEditorInput) input).getTaxonNode().getClassification()); if(newParentNode != null){ @@ -97,7 +98,7 @@ public class ChangeSynonymToAcceptedTaxonHandler extends AbstractHandler impleme HomotypicalGroup group = synonym.getHomotypicGroup(); Set namesInGroup = group.getTypifiedNames(); // FIXME with this implementation we can not create a taxonNode that is a direct child of the classification node - AbstractPostOperation operation = new ChangeSynonymToAcceptedTaxonOperation("Change synonym to accepted taxon", EditorUtil.getUndoContext(), + AbstractPostOperation operation = new ChangeSynonymToAcceptedTaxonOperation(Messages.ChangeSynonymToAcceptedTaxonHandler_CHANGE_SYN_TO_ACC_TAXON, EditorUtil.getUndoContext(), taxon, newParentNode, synonym, namesInGroup, this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput()); //$NON-NLS-1$ EditorUtil.executeOperation(operation); @@ -137,7 +138,7 @@ public class ChangeSynonymToAcceptedTaxonHandler extends AbstractHandler impleme // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { - MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage()); + MessagingUtils.warningDialog(Messages.ChangeSynonymToAcceptedTaxonHandler_CREATE_FAILURE, this, e.getMessage()); } } return true; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToConceptRelationHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToConceptRelationHandler.java index 80c79828b..f6621a346 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToConceptRelationHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToConceptRelationHandler.java @@ -67,7 +67,7 @@ public class ChangeToConceptRelationHandler extends AbstractHandler implements EditorUtil.executeOperation(operation); } } catch (NotDefinedException e) { - logger.warn("Command name not set"); + logger.warn("Command name not set"); //$NON-NLS-1$ } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToMisapplicationHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToMisapplicationHandler.java index c56e66e19..f0d38a66d 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToMisapplicationHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToMisapplicationHandler.java @@ -71,7 +71,7 @@ public class ChangeToMisapplicationHandler extends AbstractHandler implements EditorUtil.executeOperation(operation); } catch (NotDefinedException e) { - logger.warn("Command name not set"); + logger.warn("Command name not set"); //$NON-NLS-1$ } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToSynonymHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToSynonymHandler.java index cbba94a28..c2ab8c996 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToSynonymHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToSynonymHandler.java @@ -52,7 +52,7 @@ public class ChangeToSynonymHandler extends AbstractHandler implements EditorUtil.executeOperation(operation); } catch (NotDefinedException e) { - logger.warn("Command name not set"); + logger.warn("Command name not set"); //$NON-NLS-1$ } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHeterotypicSynonymHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHeterotypicSynonymHandler.java index 992f83e1a..e43510e27 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHeterotypicSynonymHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHeterotypicSynonymHandler.java @@ -52,7 +52,7 @@ public class CreateHeterotypicSynonymHandler extends AbstractHandler implements editor.getUndoContext(), editor.getTaxon(), newSynonymName, editor); EditorUtil.executeOperation(operation); } catch (NotDefinedException e) { - logger.warn("Command name not set"); + logger.warn("Command name not set"); //$NON-NLS-1$ } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHomotypicSynonymHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHomotypicSynonymHandler.java index 9047c2a13..619c94e8d 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHomotypicSynonymHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHomotypicSynonymHandler.java @@ -16,7 +16,9 @@ import org.eclipse.core.commands.IHandler; import org.eclipse.core.commands.common.NotDefinedException; import eu.etaxonomy.cdm.model.name.HomotypicalGroup; +import eu.etaxonomy.cdm.model.name.INonViralName; import eu.etaxonomy.cdm.model.name.NonViralName; +import eu.etaxonomy.cdm.model.name.TaxonNameBase; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.Page; @@ -46,7 +48,7 @@ public class CreateHomotypicSynonymHandler extends AbstractHandler implements Page.NAME); Taxon taxon = editor.getTaxon(); HomotypicalGroup group = taxon.getHomotypicGroup(); - NonViralName newSynonymName = ParseHandler.createEmptyName(); + TaxonNameBase newSynonymName = ParseHandler.createEmptyName(); AbstractPostOperation operation; try { diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateMisapplicationHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateMisapplicationHandler.java index 145e9f324..c6a6a23fa 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateMisapplicationHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateMisapplicationHandler.java @@ -56,7 +56,7 @@ public class CreateMisapplicationHandler extends AbstractHandler { editor.getUndoContext(), editor.getTaxon(), concept, type, editor); EditorUtil.executeOperation(operation); } catch (NotDefinedException e) { - logger.warn("Command name not set"); + logger.warn("Command name not set"); //$NON-NLS-1$ } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateSynonymInHomotypicalGroupHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateSynonymInHomotypicalGroupHandler.java index 687df8cfb..9e86a7044 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateSynonymInHomotypicalGroupHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateSynonymInHomotypicalGroupHandler.java @@ -20,7 +20,9 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.handlers.HandlerUtil; import eu.etaxonomy.cdm.model.name.HomotypicalGroup; +import eu.etaxonomy.cdm.model.name.INonViralName; import eu.etaxonomy.cdm.model.name.NonViralName; +import eu.etaxonomy.cdm.model.name.TaxonNameBase; import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.Page; @@ -62,7 +64,7 @@ public class CreateSynonymInHomotypicalGroupHandler extends AbstractHandler HomotypicalGroup group = synonym.getHomotypicGroup(); - NonViralName newSynonymName = ParseHandler.createEmptyName(); + TaxonNameBase newSynonymName = ParseHandler.createEmptyName(); AbstractPostOperation operation; @@ -71,7 +73,7 @@ public class CreateSynonymInHomotypicalGroupHandler extends AbstractHandler editor.getTaxon(), group, newSynonymName, editor); EditorUtil.executeOperation(operation); } catch (NotDefinedException e) { - logger.warn("Command name not set"); + logger.warn("Command name not set"); //$NON-NLS-1$ } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteAllEmptyNamesHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteAllEmptyNamesHandler.java index 706b9deb8..2f487963b 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteAllEmptyNamesHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteAllEmptyNamesHandler.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -33,9 +33,10 @@ public class DeleteAllEmptyNamesHandler extends DeleteTaxonBaseHandler { TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME); for(AbstractGroupedContainer containerWithEmptyName : editor.getEmptyContainers()){ + editor.removeGroup(containerWithEmptyName.getGroup()); doExecute(event, editor, containerWithEmptyName.getData()); } - + return null; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteTaxonBaseHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteTaxonBaseHandler.java index 6aec9f937..9dda2a930 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteTaxonBaseHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteTaxonBaseHandler.java @@ -13,19 +13,21 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.IHandler; import org.eclipse.core.commands.common.NotDefinedException; -import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.handlers.HandlerUtil; import eu.etaxonomy.cdm.api.service.DeleteResult; import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator; +import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; import eu.etaxonomy.cdm.model.common.CdmBase; import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.Taxon; +import eu.etaxonomy.cdm.model.taxon.TaxonBase; +import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; import eu.etaxonomy.taxeditor.editor.EditorUtil; -import eu.etaxonomy.taxeditor.editor.Messages; import eu.etaxonomy.taxeditor.editor.Page; import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; import eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation; import eu.etaxonomy.taxeditor.editor.name.operation.DeleteSynonymOperation; @@ -36,6 +38,7 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; +import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog; /** * @author n.hoffmann @@ -67,20 +70,38 @@ public class DeleteTaxonBaseHandler extends AbstractHandler implements IHandler, MessagingUtils.error(getClass(), e); } IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); + if (selectedElement instanceof TaxonBase){ + if (((TaxonBase)selectedElement).getId() == 0){ + if (selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication()) { + editor.getTaxon().removeTaxon((Taxon)selectedElement, TaxonRelationshipType.MISAPPLIED_NAME_FOR()); + + } else if (selectedElement instanceof Synonym){ + editor.getTaxon().removeSynonym((Synonym)selectedElement); + } + editor.redraw(); + return; + + } + + } + // synonym if(selectedElement instanceof Synonym){ - if(! MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM)){ - return ; + SynonymDeletionConfigurator deleteConfig = new SynonymDeletionConfigurator(); + if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, HandlerUtil.getActiveShell(event), Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM)){ + return ; } - operation = new DeleteSynonymOperation(commandName, editor.getUndoContext(), new SynonymDeletionConfigurator(), activePage, editor.getTaxon(), (Synonym) selectedElement,this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput()); + operation = new DeleteSynonymOperation(commandName, editor.getUndoContext(), deleteConfig, activePage, editor.getTaxon(), (Synonym) selectedElement,this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput()); } // misapplication else if(selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication()){ - operation = new DeleteMisapplicationOperation(commandName, editor.getUndoContext(), editor - .getTaxon(), (Taxon) selectedElement, editor); - } - else { + TaxonDeletionConfigurator deleteConfig = new TaxonDeletionConfigurator(); + if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, HandlerUtil.getActiveShell(event), Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_MISAPPLICATION)){ + return ; + } + operation = new DeleteMisapplicationOperation(commandName, editor.getUndoContext(), deleteConfig, activePage, editor.getTaxon(), (Taxon) selectedElement,this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput()); + } else { throw new IllegalArgumentException(Messages.DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT); } @@ -88,16 +109,16 @@ public class DeleteTaxonBaseHandler extends AbstractHandler implements IHandler, DeleteResult result = ((DeleteTaxonBaseOperation)operation).getResult(); if (result.isError()){ DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteDerivateOperation_DELETE_FAILED, TaxeditorEditorPlugin.PLUGIN_ID); - } else if (selectedElement instanceof Synonym){ + } else { this.editor.redraw(); if (!result.getUpdatedObjects().isEmpty()){ DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteTaxonBaseHandler_DELETE_SYNONYM_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS, TaxeditorEditorPlugin.PLUGIN_ID); } - }else { + } if (!result.getUpdatedObjects().isEmpty()){ DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteTaxonBaseHandler_DELETE_MISAPPLIEDNAME_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS, TaxeditorEditorPlugin.PLUGIN_ID); } - } + } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/MoveSynonymToAnotherAcceptedTaxonHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/MoveSynonymToAnotherAcceptedTaxonHandler.java index bb5fb10ac..0a56c3cc8 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/MoveSynonymToAnotherAcceptedTaxonHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/MoveSynonymToAnotherAcceptedTaxonHandler.java @@ -20,6 +20,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.name.operation.MoveSynonymToAnotherAcceptedTaxonOperation; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.MessagingUtils; @@ -45,13 +46,13 @@ public class MoveSynonymToAnotherAcceptedTaxonHandler extends AbstractHandler im } if (!(input instanceof TaxonEditorInput)) { - logger.error("Editor input is not TaxonEditorInput"); + logger.error("Editor input is not TaxonEditorInput"); //$NON-NLS-1$ return null; } if (selection==null || !(selection.getFirstElement() instanceof Synonym)) { - MessagingUtils.warningDialog("No selection", this, "No synonym selected"); - logger.error("Selection does not contain a Synonym"); + MessagingUtils.warningDialog(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_NO_SELECTION, this, Messages.MoveSynonymToAnotherAcceptedTaxonHandler_NO_SELECTION_MESSAGE); + logger.error("Selection does not contain a Synonym"); //$NON-NLS-1$ return null; } @@ -61,10 +62,10 @@ public class MoveSynonymToAnotherAcceptedTaxonHandler extends AbstractHandler im excludeTaxa.add(oldParent.getUuid()); - TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select new accepted taxon", excludeTaxa, null, ((TaxonEditorInput)input).getTaxonNode().getClassification()); + TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), Messages.MoveSynonymToAnotherAcceptedTaxonHandler_SELECT_ACC_TAXON, excludeTaxa, null, ((TaxonEditorInput)input).getTaxonNode().getClassification()); if(newParentNode!=null){ - MoveSynonymToAnotherAcceptedTaxonOperation operation = new MoveSynonymToAnotherAcceptedTaxonOperation("Change accepted Taxon of Synonym", EditorUtil.getUndoContext(), + MoveSynonymToAnotherAcceptedTaxonOperation operation = new MoveSynonymToAnotherAcceptedTaxonOperation(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_CHANGE_ACC_TAXON, EditorUtil.getUndoContext(), oldParent.getUuid(), synonym.getUuid(), newParentNode.getTaxon(), editor); AbstractUtility.executeOperation(operation); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/NameEditorMenuPropertyTester.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/NameEditorMenuPropertyTester.java index ead46789c..3030a0db4 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/NameEditorMenuPropertyTester.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/NameEditorMenuPropertyTester.java @@ -31,16 +31,16 @@ import eu.etaxonomy.taxeditor.store.CdmStore; */ public class NameEditorMenuPropertyTester extends PropertyTester { - private static final String ACCEPTED = "isAcceptedTaxon"; - private static final String SYNONYM = "isSynonym"; - private static final String MISAPPLICATION = "isMisapplication"; - private static final String TAXONBASE = "isTaxonBase"; - private static final String CONCEPT = "isConceptRelation"; - private static final String EMPTY_NAMES = "hasEmptyNames"; - private static final String ACCEPTED_AND_NO_HOMOTYPIC_SYNONYMS = "isAcceptedAndHasNoHomotypicSynonyms"; - private static final String NOT_HOMOTYPIC_SYNONYM_OF_ACCEPTED = "isNotHomotypicSynonymOfAcceptedTaxon"; - private static final String SYNONYM_WITH_HOMOTYPIC_SYNONYMS = "isSynonymInHomotypicalGroupWithMoreSynonyms"; - private static final String IS_ORPHANED = "isOrphaned"; + private static final String ACCEPTED = "isAcceptedTaxon"; //$NON-NLS-1$ + private static final String SYNONYM = "isSynonym"; //$NON-NLS-1$ + private static final String MISAPPLICATION = "isMisapplication"; //$NON-NLS-1$ + private static final String TAXONBASE = "isTaxonBase"; //$NON-NLS-1$ + private static final String CONCEPT = "isConceptRelation"; //$NON-NLS-1$ + private static final String EMPTY_NAMES = "hasEmptyNames"; //$NON-NLS-1$ + private static final String ACCEPTED_AND_NO_HOMOTYPIC_SYNONYMS = "isAcceptedAndHasNoHomotypicSynonyms"; //$NON-NLS-1$ + private static final String NOT_HOMOTYPIC_SYNONYM_OF_ACCEPTED = "isNotHomotypicSynonymOfAcceptedTaxon"; //$NON-NLS-1$ + private static final String SYNONYM_WITH_HOMOTYPIC_SYNONYMS = "isSynonymInHomotypicalGroupWithMoreSynonyms"; //$NON-NLS-1$ + private static final String IS_ORPHANED = "isOrphaned"; //$NON-NLS-1$ /** *

Constructor for NameEditorMenuPropertyTester.

diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/RemoveBasionymHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/RemoveBasionymHandler.java index 5c62c6156..5820a1018 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/RemoveBasionymHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/RemoveBasionymHandler.java @@ -55,7 +55,7 @@ public class RemoveBasionymHandler extends AbstractHandler implements IHandler { editor.getTaxon(), selectedTaxonBase, editor); EditorUtil.executeOperation(operation); } catch (NotDefinedException e) { - logger.warn("Command name not set"); + logger.warn("Command name not set"); //$NON-NLS-1$ } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SetBasionymHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SetBasionymHandler.java index 745d2bd31..4d35fe907 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SetBasionymHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SetBasionymHandler.java @@ -55,7 +55,7 @@ public class SetBasionymHandler extends AbstractHandler implements IHandler { editor.getTaxon(), selectedTaxonBase, editor); EditorUtil.executeOperation(operation); } catch (NotDefinedException e) { - logger.warn("Command name not set"); + logger.warn("Command name not set"); //$NON-NLS-1$ } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SwapSynonymAndAcceptedHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SwapSynonymAndAcceptedHandler.java index 76d8113ad..17e412612 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SwapSynonymAndAcceptedHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SwapSynonymAndAcceptedHandler.java @@ -24,6 +24,7 @@ import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.name.operation.SwapSynonymAndAcceptedOperation; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; @@ -70,7 +71,7 @@ public class SwapSynonymAndAcceptedHandler extends AbstractHandler implements EditorUtil.executeOperation(operation); } catch (NotDefinedException e) { - logger.warn("Command name not set"); + logger.warn("Command name not set"); //$NON-NLS-1$ } return null; @@ -109,7 +110,7 @@ public class SwapSynonymAndAcceptedHandler extends AbstractHandler implements EditorUtil.openTaxonBase(taxon.getUuid()); } catch (Exception e) { - MessagingUtils.warningDialog("Could not open editor for taxon", this, e.getMessage()); + MessagingUtils.warningDialog(Messages.SwapSynonymAndAcceptedHandler_COULD_NOT_OPEN, this, e.getMessage()); } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptRelationshipTypeOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptRelationshipTypeOperation.java index 0b6fb5125..cf39304e5 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptRelationshipTypeOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptRelationshipTypeOperation.java @@ -20,6 +20,7 @@ import org.eclipse.core.runtime.IStatus; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; @@ -59,8 +60,7 @@ public class ChangeConceptRelationshipTypeOperation extends AbstractPostTaxonOpe Set taxonRelationships = taxon.getTaxonRelations(relatedTaxon); if(taxonRelationships.size() > 1){ - MessagingUtils.warningDialog("Multiple relations between taxa", this, "There are multiple relations between the " + - "accepted and the related taxon. This case is not handled by the software yet"); + MessagingUtils.warningDialog(ChangeConceptToSynonymOperation.CHANGE_CONCEPT_TO_SYNONYM_OPERATION_MULTI_REPS, this, ChangeConceptToSynonymOperation.CHANGE_CONCEPT_TO_SYNONYM_OPERATION_MULTI_REPS_MESSAGE); return; } @@ -108,7 +108,7 @@ public class ChangeConceptRelationshipTypeOperation extends AbstractPostTaxonOpe public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { // see FIXME in execute() - MessagingUtils.warn(this.getClass(), "Not implemented yet. See developer documentation for details"); + MessagingUtils.warn(this.getClass(), Messages.ChangeConceptRelationshipTypeOperation_NOT_IMPLEMENTED); return null; } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptToSynonymOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptToSynonymOperation.java index 0837e4b21..9f6cec437 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptToSynonymOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptToSynonymOperation.java @@ -25,6 +25,7 @@ import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; @@ -41,7 +42,10 @@ import eu.etaxonomy.taxeditor.store.CdmStore; public class ChangeConceptToSynonymOperation extends AbstractPostTaxonOperation { - private Taxon concept; + protected static final String CHANGE_CONCEPT_TO_SYNONYM_OPERATION_MULTI_REPS_MESSAGE = Messages.ChangeConceptToSynonymOperation_MULTI_REPS_MESSAGE; + protected static final String CHANGE_CONCEPT_TO_SYNONYM_OPERATION_MULTI_REPS = Messages.ChangeConceptToSynonymOperation_MULTI_REPS; + + private Taxon concept; private HomotypicalGroup homotypicalGroup; @@ -66,8 +70,7 @@ public class ChangeConceptToSynonymOperation extends Set taxonRelationships = taxon.getTaxonRelations(concept); if(taxonRelationships.size() > 1){ - MessagingUtils.warningDialog("Multiple relations between taxa", this, "There are multiple relations between the " + - "accepted and the related taxon. This case is not handled by the software yet"); + MessagingUtils.warningDialog(CHANGE_CONCEPT_TO_SYNONYM_OPERATION_MULTI_REPS, this, CHANGE_CONCEPT_TO_SYNONYM_OPERATION_MULTI_REPS_MESSAGE); return; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeHomotypicGroupOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeHomotypicGroupOperation.java index 3f9fd976a..3832b5c4b 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeHomotypicGroupOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeHomotypicGroupOperation.java @@ -62,7 +62,7 @@ public class ChangeHomotypicGroupOperation extends AbstractPostTaxonOperation { this.synonym = synonym; if(synonym == null){ throw new IllegalArgumentException( - "A null synonym was provided."); + "A null synonym was provided."); //$NON-NLS-1$ } this.oldHomotypicalGroup = synonym.getHomotypicGroup(); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToAcceptedTaxonOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToAcceptedTaxonOperation.java index 3253f2a7b..165c1ca54 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToAcceptedTaxonOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToAcceptedTaxonOperation.java @@ -25,6 +25,7 @@ import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonNode; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; @@ -89,7 +90,7 @@ public class ChangeSynonymToAcceptedTaxonOperation extends AbstractPersistentPos parentNode.getUuid(), true).getCdmEntity(); } catch (HomotypicalGroupChangeException e) { - MessagingUtils.warningDialog("Operation may lead to inconsistent data", getClass(), e.getMessage()); + MessagingUtils.warningDialog(Messages.ChangeSynonymToAcceptedTaxonOperation_INCONSISTENT_DATA, getClass(), e.getMessage()); return postExecute(null); } monitor.worked(20); @@ -124,7 +125,7 @@ public class ChangeSynonymToAcceptedTaxonOperation extends AbstractPersistentPos throws ExecutionException { // TODO implement - biggest problem is that any window open for new taxon must be closed first - MessagingUtils.warn(this.getClass(), "Not yet implemented"); + MessagingUtils.warn(this.getClass(), Messages.ChangeSynonymToAcceptedTaxonOperation_NOT_IMPLEMENTED); return postExecute(element); } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInExistingHomotypicalGroupOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInExistingHomotypicalGroupOperation.java index b247d8cfe..aef430fd5 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInExistingHomotypicalGroupOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInExistingHomotypicalGroupOperation.java @@ -16,7 +16,9 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import eu.etaxonomy.cdm.model.name.HomotypicalGroup; +import eu.etaxonomy.cdm.model.name.INonViralName; import eu.etaxonomy.cdm.model.name.NonViralName; +import eu.etaxonomy.cdm.model.name.TaxonNameBase; import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; @@ -32,7 +34,7 @@ public class CreateSynonymInExistingHomotypicalGroupOperation extends AbstractPostTaxonOperation { private final HomotypicalGroup group; - private final NonViralName newSynonymName; + private final TaxonNameBase newSynonymName; private Synonym synonym; @@ -47,7 +49,8 @@ public class CreateSynonymInExistingHomotypicalGroupOperation extends * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. */ public CreateSynonymInExistingHomotypicalGroupOperation(String label, - IUndoContext undoContext, Taxon taxon, HomotypicalGroup group, NonViralName newSynonymName, IPostOperationEnabled postOperationEnabled) { + IUndoContext undoContext, Taxon taxon, HomotypicalGroup group, + TaxonNameBase newSynonymName, IPostOperationEnabled postOperationEnabled) { super(label, undoContext, taxon, postOperationEnabled); this.group = group; this.newSynonymName = newSynonymName; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperation.java index caee71329..abf93ef2d 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperation.java @@ -14,16 +14,19 @@ import org.eclipse.core.commands.operations.IUndoContext; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.ui.IWorkbenchPage; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; +import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.api.service.ITaxonService; import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator; +import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator; import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; import eu.etaxonomy.cdm.model.reference.Reference; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; -import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; +import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; import eu.etaxonomy.taxeditor.store.CdmStore; /** @@ -32,7 +35,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore; * @author p.ciardelli * @created 16.01.2009 */ -public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation { +public class DeleteMisapplicationOperation extends DeleteTaxonBaseOperation { private final Taxon misapplication; @@ -49,11 +52,12 @@ public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation { * @param misapplication a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object. * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. */ - public DeleteMisapplicationOperation(String label, IUndoContext undoContext, - Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled) { - super(label, undoContext, taxon, postOperationEnabled); - + public DeleteMisapplicationOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator,IWorkbenchPage activePage, + Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled,ICdmEntitySessionEnabled cdmEntitySessionEnabled) { + //super(label, undoContext, taxon, postOperationEnabled); + super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled); this.misapplication = misapplication; + this.element = taxon; } /* (non-Javadoc) @@ -77,7 +81,7 @@ public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation { // Remove misapplied name relation from taxon element.removeTaxon(misapplication, TaxonRelationshipType.MISAPPLIED_NAME_FOR()); - ICdmApplicationConfiguration controller; + ICdmRepository controller; controller = CdmStore.getCurrentApplicationConfiguration(); @@ -86,7 +90,7 @@ public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation { NameDeletionConfigurator nameConfig = new NameDeletionConfigurator(); nameConfig.setRemoveAllNameRelationships(true); config.setNameDeletionConfig(nameConfig); - service.deleteTaxon(misapplication.getUuid(), config, null); + result = service.deleteTaxon(misapplication.getUuid(), config, null); monitor.worked(40); return postExecute(null); @@ -106,6 +110,7 @@ public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation { element.addMisappliedName(misapplication, citation, microcitation); + return postExecute(misapplication); } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.java index 2ae7758a3..13e5fc202 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.java @@ -16,10 +16,11 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.ui.IWorkbenchPage; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.api.service.DeleteResult; import eu.etaxonomy.cdm.api.service.ITaxonService; +import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator; import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator; import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.SynonymType; @@ -53,6 +54,7 @@ public class DeleteSynonymOperation extends DeleteTaxonBaseOperation { Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled,ICdmEntitySessionEnabled cdmEntitySessionEnabled) { super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled); this.synonym = synonym; + this.element = taxon; } /** {@inheritDoc} */ @@ -65,22 +67,16 @@ public class DeleteSynonymOperation extends DeleteTaxonBaseOperation { monitor.worked(20); // Remove synonym from taxon - ICdmApplicationConfiguration controller; + ICdmRepository controller; controller = CdmStore.getCurrentApplicationConfiguration(); ITaxonService service = controller.getTaxonService(); - if (synonym.getId() == 0){ - element.removeSynonym(synonym); - } else { - //TODO: this should be moved to the handler, the operations should not contain ui code - setResult(service.deleteSynonym(synonym.getUuid(), null)); - } - // taxon.removeSynonym(synonym); -// CdmStore.getTaxonService().deleteSynonymRelationships(synonym); -// CdmStore.getTaxonService().delete(synonym); + result = service.deleteSynonym(synonym.getUuid(), (SynonymDeletionConfigurator)configurator); + + monitor.worked(40); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java index 856844db3..434cc5756 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java @@ -10,7 +10,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.ui.IWorkbenchPage; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.api.service.ITaxonService; import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; @@ -63,7 +63,7 @@ public class DeleteTaxonOperation extends DeleteTaxonBaseOperation{ bind(); - ICdmApplicationConfiguration controller; + ICdmRepository controller; controller = CdmStore.getCurrentApplicationConfiguration(); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/MoveSynonymToAnotherAcceptedTaxonOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/MoveSynonymToAnotherAcceptedTaxonOperation.java index 19bee8a22..d5e92bac3 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/MoveSynonymToAnotherAcceptedTaxonOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/MoveSynonymToAnotherAcceptedTaxonOperation.java @@ -48,13 +48,13 @@ public class MoveSynonymToAnotherAcceptedTaxonOperation extends super(label, undoContext, taxon, postOperationEnabled); List propertyPaths = new ArrayList(); - propertyPaths.add("synonymRelations"); + propertyPaths.add("synonymRelations"); //$NON-NLS-1$ this.element = (Taxon) CdmStore.getService(ITaxonService.class).load(taxon.getUuid(),propertyPaths); this.oldTaxon = (Taxon) CdmStore.getService(ITaxonService.class).load(oldTaxonUUID); this.synonym = (Synonym) CdmStore.getService(ITaxonService.class).load(synonymUUID); if(synonym == null){ throw new IllegalArgumentException( - "A null synonym was provided."); + "A null synonym was provided."); //$NON-NLS-1$ } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/SwapSynonymAndAcceptedOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/SwapSynonymAndAcceptedOperation.java index 352d7bee1..e458e8110 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/SwapSynonymAndAcceptedOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/SwapSynonymAndAcceptedOperation.java @@ -20,6 +20,7 @@ import eu.etaxonomy.cdm.api.service.UpdateResult; import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.SynonymType; import eu.etaxonomy.cdm.model.taxon.Taxon; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; @@ -50,7 +51,7 @@ public class SwapSynonymAndAcceptedOperation extends AbstractPostTaxonOperation public SwapSynonymAndAcceptedOperation(String label, IUndoContext undoContext, Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled) { - super("Swap Synonym And Accepted Taxon Operation", undoContext, taxon, postOperationEnabled, cdmEntitySessionEnabled); + super(Messages.SwapSynonymAndAcceptedOperation_SWAP_SYN_ACC_TAXON, undoContext, taxon, postOperationEnabled, cdmEntitySessionEnabled); this.synonym = synonym; } @@ -81,7 +82,7 @@ public class SwapSynonymAndAcceptedOperation extends AbstractPostTaxonOperation @Override public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - MessagingUtils.error(this.getClass(), "Not yet implemented", null); + MessagingUtils.error(this.getClass(), Messages.SwapSynonymAndAcceptedOperation_NOT_IMPLEMENTED, null); return null; } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/validation/MarkerManager.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/validation/MarkerManager.java index 4a5f2cdf9..0eb220c49 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/validation/MarkerManager.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/validation/MarkerManager.java @@ -42,12 +42,12 @@ import eu.etaxonomy.cdm.model.validation.Severity; */ public class MarkerManager { - public static final String MARKER_TYPE_ID = "eu.etaxonomy.taxeditor.markers.validationerror"; + public static final String MARKER_TYPE_ID = "eu.etaxonomy.taxeditor.markers.validationerror"; //$NON-NLS-1$ /** * The primary key (id) of the EntityConstraintViolation record */ - public static final String ATTRIB_DATABASE_ID = "databaseId"; + public static final String ATTRIB_DATABASE_ID = "databaseId"; //$NON-NLS-1$ // The values of the following constants must correspond to the attributes // defined for the org.eclipse.core.resources.markers extension point in @@ -56,35 +56,35 @@ public class MarkerManager { /** * A user-friendly description of the type of the entity */ - public static final String ATTRIB_USER_FRIENDLY_TYPE_NAME = "userFriendlyTypeName"; + public static final String ATTRIB_USER_FRIENDLY_TYPE_NAME = "userFriendlyTypeName"; //$NON-NLS-1$ /** * A user-friendly description of the entity */ - public static final String ATTRIB_USER_FRIENDLY_DESCRIPTION = "userFriendlyDescription"; + public static final String ATTRIB_USER_FRIENDLY_DESCRIPTION = "userFriendlyDescription"; //$NON-NLS-1$ /** * The field whose value violated a constraint */ - public static final String ATTRIB_USER_FRIENDLY_FIELD_NAME = "userFriendlyFieldName"; + public static final String ATTRIB_USER_FRIENDLY_FIELD_NAME = "userFriendlyFieldName"; //$NON-NLS-1$ /** * The value violating a constraint */ - public static final String ATTRIB_INVALID_VALUE = "invalidValue"; + public static final String ATTRIB_INVALID_VALUE = "invalidValue"; //$NON-NLS-1$ /** * The message from the {@link Validator} about what was wrong. */ - public static final String ATTRIB_VALIDATOR_MESSAGE = "validatorMessage"; + public static final String ATTRIB_VALIDATOR_MESSAGE = "validatorMessage"; //$NON-NLS-1$ /** * The class of the {@link Validator} coding for the constraint */ - public static final String ATTRIB_VALIDATOR_CLASS = "validatorClass"; + public static final String ATTRIB_VALIDATOR_CLASS = "validatorClass"; //$NON-NLS-1$ /** * The class of the validated entity */ - public static final String ATTRIB_ENTITY_CLASS = "entityClass"; + public static final String ATTRIB_ENTITY_CLASS = "entityClass"; //$NON-NLS-1$ /** * The id of the validated entity */ - public static final String ATTRIB_ENTITY_ID = "entityId"; + public static final String ATTRIB_ENTITY_ID = "entityId"; //$NON-NLS-1$ private final List problems; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/validation/ValidationDaemon.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/validation/ValidationDaemon.java index 0d0a52a3d..2cf683edf 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/validation/ValidationDaemon.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/validation/ValidationDaemon.java @@ -10,6 +10,7 @@ import org.eclipse.core.runtime.jobs.Job; import eu.etaxonomy.cdm.api.service.IEntityValidationService; import eu.etaxonomy.cdm.model.validation.EntityValidation; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -34,7 +35,7 @@ public class ValidationDaemon extends Job { public ValidationDaemon(){ - super("Running validation daemon"); + super(Messages.ValidationDaemon_RUNNING_DAEMON); entityValidationService = CdmStore.getService(IEntityValidationService.class); } @@ -67,11 +68,11 @@ public class ValidationDaemon extends Job { markerManager.createMarkers(); Thread.sleep(SLEEP_TIME); } - MessagingUtils.info("Validation module stopped"); + MessagingUtils.info(Messages.ValidationDaemon_VALIDATION_STOPPED); return Status.OK_STATUS; } catch (Throwable t) { - MessagingUtils.info("Validation module terminated unexpectedly: " + t.getMessage()); + MessagingUtils.info(Messages.ValidationDaemon_VALIDATION_EXCEPTION + t.getMessage()); return Status.CANCEL_STATUS; } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java index 36becdcbd..aa6329c3e 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java @@ -63,6 +63,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.SimpleSelectionProvider; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.checklist.edit.DistributionEditingSupport; import eu.etaxonomy.taxeditor.editor.view.checklist.filter.ChecklistEditorFilter; import eu.etaxonomy.taxeditor.editor.view.checklist.listener.ChecklistDropdownSelectionListener; @@ -87,15 +88,14 @@ import eu.etaxonomy.taxeditor.store.CdmStore; * @version 1.0 */ public class ChecklistEditor extends EditorPart implements ISelectionListener, IPartContentHasFactualData, IConversationEnabled, - IContextListener, IPartContentHasDetails, IDirtyMarkable{//, ICdmEntitySessionEnabled { - - private static final Logger logger = Logger.getLogger(ChecklistEditor.class); - /** - * Key used for storing Checklist Editor View - */ - private static final String CHECKLIST_EDITOR_MEMENTO_KEY = "checklistEditor"; + IContextListener, IPartContentHasDetails, IDirtyMarkable{ + private static final String LOADING_TAXA = Messages.ChecklistEditor_LOAD_TAXA; + private static final String UNKNOWN = Messages.ChecklistEditor_UNKNOWN; + private static final String ELEMENT_COUNT = Messages.ChecklistEditor_ELEMENT_COUNT; + public static final String TYPE_FILTER_TEXT = "type filter text"; //$NON-NLS-1$ + private static final Logger logger = Logger.getLogger(ChecklistEditor.class); private class ChecklistJob extends Job { @@ -121,8 +121,8 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I @Override public IStatus run(final IProgressMonitor monitor) { try { - logger.debug("Begin of eclipse core runtime Job to Retrieve datasources"); - monitor.beginTask("Retrieving TaxonNodes", taxonNodes.size() + 1); + logger.debug("Begin of eclipse core runtime Job to Retrieve datasources"); //$NON-NLS-1$ + monitor.beginTask(Messages.ChecklistEditor_RETRIEVE_NODES, taxonNodes.size() + 1); final List taxonList = new ArrayList(); @@ -153,7 +153,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I * Constant * ID="eu.etaxonomy.taxeditor.store.datasource"{trunked} */ - public static String ID = "eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor"; + public static String ID = "eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor"; //$NON-NLS-1$ private TableViewer viewer; @@ -227,11 +227,10 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I selectionService.addSelectionListener(this); viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); labelProvider = new ChecklistLabelProvider(this.viewer); - + terms = labelProvider.getNamedAreas(); if (terms == null){ - MessagingUtils.informationDialog("No Areas to display", "Please choose the areas you want to display. " - + "Therefore go to the preferences, choose the Checklist Editor and choose the areas in the Distribution Selection Wizard."); + MessagingUtils.informationDialog(Messages.ChecklistEditor_NO_AREAS, Messages.ChecklistEditor_NO_AREAS_MESSAGE); this.dispose(); return; } @@ -287,11 +286,11 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I */ private Text createSearchBar(Composite parent) { Label searchLabel = new Label(parent, SWT.NONE); - searchLabel.setText("Search: "); + searchLabel.setText(Messages.ChecklistEditor_SEARCH); final Text searchText = new Text(parent, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH | SWT.CANCEL); searchText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); searchText.setForeground(EditorUtil.getColor(Resources.SEARCH_VIEW_FOREGROUND)); - searchText.setText("type filter text"); + searchText.setText(TYPE_FILTER_TEXT); return searchText; } @@ -301,8 +300,8 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I private void createToolbar(Composite parent) { ToolBar toolBar = new ToolBar(parent, SWT.NONE); toolItem = new ToolItem(toolBar, SWT.DROP_DOWN | SWT.BORDER); - toolItem.setText("Distribution Status"); - toolItem.setToolTipText("Show Distribution Status for selected Areas"); + toolItem.setText(Messages.ChecklistEditor_DIST_STATUS); + toolItem.setToolTipText(Messages.ChecklistEditor_DIST_STATUS_TOOLTIP); createToolbarItems(); toolItem.addSelectionListener(dropListener); toolBar.pack(); @@ -310,7 +309,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I private void createToolbarItems() { dropListener = new ChecklistDropdownSelectionListener(toolItem, this, terms); - + for (DefinedTermBase term : terms) { if(term!=null){ dropListener.add(term); @@ -325,7 +324,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I gridData.horizontalAlignment = GridData.FILL; statusLabel = new Label(composite, SWT.LEFT); - statusLabel.setText("Anzahl der Elemente: " + (countNodes != null ? countNodes : "uknown")); + statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN)); statusLabel.setLayoutData(gridData); } @@ -334,10 +333,10 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I List titles = new ArrayList(); List bounds = new ArrayList(); if (PreferencesUtil.isShowRankInChecklistEditor()){ - Collections.addAll(titles, "Taxon", "Rank"); + Collections.addAll(titles, Messages.ChecklistEditor_TAXON, Messages.ChecklistEditor_RANK); Collections.addAll(bounds, 300, 200); } else{ - Collections.addAll(titles, "Taxon"); + Collections.addAll(titles, Messages.ChecklistEditor_TAXON); Collections.addAll(bounds, 300); } @@ -457,7 +456,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I TaxonNode taxonNode = checklistEditorInput.getTaxonNode(); if (classification != null && taxonNode == null) { countNodes = taxonNodeService.countAllNodesForClassification(classification); - statusLabel.setText("Anzahl der Elemente: " + (countNodes != null ? countNodes : "unknown")); + statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN)); // This should not kill the view nor the editor if something goes // wrong // TODO: don't load the whole taxonNode Object but rather a small @@ -465,11 +464,11 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I // FIXME: May be don't open classification which are greater than // 3000 Taxa selectedTaxonNodes = taxonNodeService.listAllNodesForClassification(classification, 0, countNodes); - getService().schedule(new ChecklistJob("loading Taxa", selectedTaxonNodes), Job.LONG); + getService().schedule(new ChecklistJob(LOADING_TAXA, selectedTaxonNodes), Job.LONG); } if (taxonNode != null) { selectedTaxonNodes = taxonNodeService.loadChildNodesOfTaxonNode(taxonNode, NODE_INIT_STRATEGY, true, null); - getService().schedule(new ChecklistJob("loading Taxa", selectedTaxonNodes), Job.LONG); + getService().schedule(new ChecklistJob(LOADING_TAXA, selectedTaxonNodes), Job.LONG); } } @@ -478,10 +477,10 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I public void dispose() { this.checklistEditorInput.dispose(); super.dispose(); - + conversation.unregisterForDataStoreChanges(this); conversation.unbind(); - + //conversation.close(); conversation = null; } @@ -505,7 +504,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I // viewer.getTable().setEnabled(!busy); if (busy) { partNameCache = getPartName(); - setPartName("Loading " + countNodes + " Taxa..."); + setPartName(String.format(Messages.ChecklistEditor_LOAD_CNT_TAXA, countNodes)); } else { if (partNameCache != null) { setPartName(partNameCache); @@ -558,7 +557,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I acitivateNewColumnInDropDownMenu(term); } viewer.setLabelProvider(labelProvider); - getService().schedule(new ChecklistJob("loading Taxa", selectedTaxonNodes), Job.LONG); + getService().schedule(new ChecklistJob(LOADING_TAXA, selectedTaxonNodes), Job.LONG); table.setRedraw(true); viewer.refresh(); } @@ -624,7 +623,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I @Override public void doSave(IProgressMonitor monitor) { try { - monitor.beginTask("Saving Editor", 1); + monitor.beginTask(Messages.ChecklistEditor_SAVE_EDITOR, 1); if (!conversation.isBound()) { conversation.bind(); } @@ -649,7 +648,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I setInput(input); if (input instanceof ChecklistEditorInput) { checklistEditorInput = (ChecklistEditorInput) input; - setPartName(getPartName() + ": " + checklistEditorInput.getName()); + setPartName(getPartName() + ": " + checklistEditorInput.getName()); //$NON-NLS-1$ conversation = checklistEditorInput.getConversation(); conversation.registerForDataStoreChanges(this); } @@ -748,11 +747,11 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I conversation = null; } - private static final List NODE_INIT_STRATEGY = Arrays.asList(new String[] { "descriptions", - "descriptions.*", "description.state", "feature", "feature.*", "childNodes", "childNodes.taxon", - "childNodes.taxon.name", "taxonNodes", "taxonNodes.*", "taxonNodes.taxon.*", "taxon.*", - "taxon.descriptions", "taxon.sec", "taxon.name.*", "terms", "name.*", - "name.rank.representations", "name.status.type.representations", "stateData.$" }); + private static final List NODE_INIT_STRATEGY = Arrays.asList(new String[] { "descriptions", //$NON-NLS-1$ + "descriptions.*", "description.state", "feature", "feature.*", "childNodes", "childNodes.taxon", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + "childNodes.taxon.name", "taxonNodes", "taxonNodes.*", "taxonNodes.taxon.*", "taxon.*", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + "taxon.descriptions", "taxon.sec", "taxon.name.*", "terms", "name.*", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + "name.rank.representations", "name.status.type.representations", "stateData.$" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ /* * (non-Javadoc) @@ -840,6 +839,6 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I return conversation; } - - + + } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditorInput.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditorInput.java index b87787283..2a12b8699 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditorInput.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditorInput.java @@ -247,44 +247,44 @@ public class ChecklistEditorInput extends CdmEntitySessionInput implements IEdit private List getTaxonNodePropertyPaths() { List taxonNodePropertyPaths = new ArrayList(); for(String propertyPath : getTaxonBasePropertyPaths()) { - taxonNodePropertyPaths.add("taxon." + propertyPath); + taxonNodePropertyPaths.add("taxon." + propertyPath); //$NON-NLS-1$ } return taxonNodePropertyPaths; } private List getTaxonBasePropertyPaths() { List taxonBasePropertyPaths = Arrays.asList(new String[] { - "sec", - "createdBy", - "updatedBy", - "annotations", - "markers", - "credits", - "extensions", - "rights", - "sources", - "descriptions", - "relationsToThisTaxon", - "relationsFromThisTaxon", - "taxonNodes", - "descriptions.descriptionElements.feature", - "descriptions.descriptionElements.area", - "descriptions.descriptionElements.status", - "descriptions.markers", - "name.descriptions", - "name.typeDesignations", - "name.status", - "name.nomenclaturalReference.inReference", - "name.taxonBases.taxonNodes", - "name.relationsFromThisName", - "name.relationsToThisName", - "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.synonym.name.status", - "name.homotypicalGroup.typifiedNames.relationsToThisName.fromName", - "synonymRelations.synonym.name.status.type", - "synonymRelations.synonym.name.relationsToThisName.fromName", - "synonymRelations.synonym.name.nomenclaturalReference.inReference.authorship", - "synonymRelations.synonym.name.nomenclaturalReference.authorship", - "synonymRelations.synonym.name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations" + "sec", //$NON-NLS-1$ + "createdBy", //$NON-NLS-1$ + "updatedBy", //$NON-NLS-1$ + "annotations", //$NON-NLS-1$ + "markers", //$NON-NLS-1$ + "credits", //$NON-NLS-1$ + "extensions", //$NON-NLS-1$ + "rights", //$NON-NLS-1$ + "sources", //$NON-NLS-1$ + "descriptions", //$NON-NLS-1$ + "relationsToThisTaxon", //$NON-NLS-1$ + "relationsFromThisTaxon", //$NON-NLS-1$ + "taxonNodes", //$NON-NLS-1$ + "descriptions.descriptionElements.feature", //$NON-NLS-1$ + "descriptions.descriptionElements.area", //$NON-NLS-1$ + "descriptions.descriptionElements.status", //$NON-NLS-1$ + "descriptions.markers", //$NON-NLS-1$ + "name.descriptions", //$NON-NLS-1$ + "name.typeDesignations", //$NON-NLS-1$ + "name.status", //$NON-NLS-1$ + "name.nomenclaturalReference.inReference", //$NON-NLS-1$ + "name.taxonBases.taxonNodes", //$NON-NLS-1$ + "name.relationsFromThisName", //$NON-NLS-1$ + "name.relationsToThisName", //$NON-NLS-1$ + "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.synonym.name.status", //$NON-NLS-1$ + "name.homotypicalGroup.typifiedNames.relationsToThisName.fromName", //$NON-NLS-1$ + "synonymRelations.synonym.name.status.type", //$NON-NLS-1$ + "synonymRelations.synonym.name.relationsToThisName.fromName", //$NON-NLS-1$ + "synonymRelations.synonym.name.nomenclaturalReference.inReference.authorship", //$NON-NLS-1$ + "synonymRelations.synonym.name.nomenclaturalReference.authorship", //$NON-NLS-1$ + "synonymRelations.synonym.name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations" //$NON-NLS-1$ }); return taxonBasePropertyPaths; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistLabelProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistLabelProvider.java index 2bcd051ca..ac0801309 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistLabelProvider.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistLabelProvider.java @@ -50,7 +50,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore; */ public class ChecklistLabelProvider extends LabelProvider implements ITableLabelProvider { - public static final String DEFAULT_ENTRY = ""; + public static final String DEFAULT_ENTRY = ""; //$NON-NLS-1$ private IDescriptionService descriptionService; private final SortedSet namedAreas; TableViewer viewer = null; @@ -168,16 +168,16 @@ public class ChecklistLabelProvider extends LabelProvider implements ITableLabel } - private static final List DESC_INIT_STRATEGY = Arrays.asList(new String[] { "descriptions", - "descriptions.*", "description.state" }); + private static final List DESC_INIT_STRATEGY = Arrays.asList(new String[] { "descriptions", //$NON-NLS-1$ + "descriptions.*", "description.state" }); //$NON-NLS-1$ //$NON-NLS-2$ private SortedSet loadNamedAreas() { IPreferenceStore preferenceStore = PreferencesUtil.getPreferenceStore(); String values = preferenceStore.getString(PreferencesUtil.DISTRIBUTION_AREA_OCCURENCE_STATUS); - if (values != null && values != "") { - String[] split = values.split(","); + if (values != null && values != "") { //$NON-NLS-1$ + String[] split = values.split(","); //$NON-NLS-1$ List listValue = Arrays.asList(split); List termlist = new ArrayList(); Set uuidList = new HashSet(); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/edit/DistributionEditingSupport.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/edit/DistributionEditingSupport.java index 87e13f225..3e2643c2c 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/edit/DistributionEditingSupport.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/edit/DistributionEditingSupport.java @@ -107,8 +107,8 @@ public final class DistributionEditingSupport extends EditingSupport { } } - private static final List DESC_INIT_STRATEGY = Arrays.asList(new String[] { "descriptions", - "descriptions.*", "description.state" }); + private static final List DESC_INIT_STRATEGY = Arrays.asList(new String[] { "descriptions", //$NON-NLS-1$ + "descriptions.*", "description.state" }); //$NON-NLS-1$ //$NON-NLS-2$ /** * diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/filter/ChecklistEditorFilter.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/filter/ChecklistEditorFilter.java index 60a61384c..87d428f97 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/filter/ChecklistEditorFilter.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/filter/ChecklistEditorFilter.java @@ -14,10 +14,10 @@ public class ChecklistEditorFilter extends ViewerFilter { public void setSearchText(String s) { // Search must be a substring of the existing value - if(s.contains("*")){ - s=s.replace("*", ".*"); + if(s.contains("*")){ //$NON-NLS-1$ + s=s.replace("*", ".*"); //$NON-NLS-1$ //$NON-NLS-2$ } - this.searchString = ".*" + s + ".*"; + this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$ } @Override diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/CreateDescriptionElementHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/CreateDescriptionElementHandler.java index 3e8c2fff2..780f72cc1 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/CreateDescriptionElementHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/CreateDescriptionElementHandler.java @@ -76,10 +76,10 @@ public class CreateDescriptionElementHandler extends AbstractHandler { operation = operationCreationInstance(event.getCommand().getName(), event, description, postOperationEnabled); AbstractUtility.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set"); + MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$ } } else { - MessagingUtils.error(getClass(), new IllegalArgumentException("Could not determine the taxon description")); + MessagingUtils.error(getClass(), new IllegalArgumentException("Could not determine the taxon description")); //$NON-NLS-1$ return null; } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/CreateDescriptionHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/CreateDescriptionHandler.java index 1547ca1ac..a772e2b3e 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/CreateDescriptionHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/CreateDescriptionHandler.java @@ -62,7 +62,7 @@ public class CreateDescriptionHandler extends AbstractHandler { operation = createTaxonOperation(event.getCommand().getName(), taxon, postOperationEnabled); AbstractUtility.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } // specimen description @@ -73,7 +73,7 @@ public class CreateDescriptionHandler extends AbstractHandler { operation = new CreateSpecimenDescriptionOperation(event.getCommand().getName(), EditorUtil.getUndoContext(), (SpecimenOrObservationBase) viewerInput, postOperationEnabled); AbstractUtility.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/OpenDistributionHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/OpenDistributionHandler.java index 9e58f2d1d..e0576c34d 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/OpenDistributionHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/OpenDistributionHandler.java @@ -54,9 +54,9 @@ public class OpenDistributionHandler extends AbstractHandler { return null; } private static final List DESC_INIT_STRATEGY = Arrays.asList(new String[]{ - "descriptions", - "descriptions.*", - "description.state" + "descriptions", //$NON-NLS-1$ + "descriptions.*", //$NON-NLS-1$ + "description.state" //$NON-NLS-1$ }); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/listener/ChecklistDropdownSelectionListener.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/listener/ChecklistDropdownSelectionListener.java index 59d78fb61..bbf7b848c 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/listener/ChecklistDropdownSelectionListener.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/listener/ChecklistDropdownSelectionListener.java @@ -17,6 +17,7 @@ import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.ToolItem; import eu.etaxonomy.cdm.model.common.DefinedTermBase; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; import eu.etaxonomy.taxeditor.preference.wizard.AvailableDistributionWizard; @@ -69,7 +70,7 @@ public class ChecklistDropdownSelectionListener extends SelectionAdapter { for(int i=0; i term : termSet) { if(column.getText().equalsIgnoreCase(term.getTitleCache())){ selectedTerm = term; @@ -97,7 +98,7 @@ public class ChecklistDropdownSelectionListener extends SelectionAdapter { private void initialMenuItem(){ MenuItem menuItem = new MenuItem(menu, SWT.PUSH); - menuItem.setText("Add Distribution"); + menuItem.setText(Messages.ChecklistDropdownSelectionListener_ADD_DISTRIBUTION); menuItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/listener/ChecklistFocusListener.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/listener/ChecklistFocusListener.java index 6007fe575..b37de5a03 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/listener/ChecklistFocusListener.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/listener/ChecklistFocusListener.java @@ -6,16 +6,14 @@ import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.widgets.Text; import eu.etaxonomy.taxeditor.editor.EditorUtil; +import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor; import eu.etaxonomy.taxeditor.preference.Resources; public class ChecklistFocusListener implements FocusListener{ - private final Text searchText; - private final ModifyListener modifyListener; + private final Text searchText; + private final ModifyListener modifyListener; - /** - * - */ public ChecklistFocusListener(Text searchText, ModifyListener modifyListener) { this.searchText = searchText; this.modifyListener = modifyListener; @@ -24,20 +22,20 @@ public class ChecklistFocusListener implements FocusListener{ @Override public void focusGained(FocusEvent e) { - if ("type filter text".equals(searchText.getText())) { + if (ChecklistEditor.TYPE_FILTER_TEXT.equals(searchText.getText())) { searchText.setForeground(EditorUtil.getColor(Resources.SEARCH_VIEW_FOCUS)); - searchText.setText(""); + searchText.setText(""); //$NON-NLS-1$ } } @Override public void focusLost(FocusEvent e) { - if ("".equals(searchText.getText())) { + if ("".equals(searchText.getText())) { //$NON-NLS-1$ //TODO: set demo string searchText.removeModifyListener(modifyListener); searchText.setForeground(EditorUtil.getColor(Resources.SEARCH_VIEW_FOREGROUND)); - searchText.setText("type filter text"); + searchText.setText(ChecklistEditor.TYPE_FILTER_TEXT); searchText.addModifyListener(modifyListener); } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptLabelProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptLabelProvider.java index ebcde34e1..4bcecf9e3 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptLabelProvider.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptLabelProvider.java @@ -43,7 +43,7 @@ public class ConceptLabelProvider extends LabelProvider implements IStyledLabelP return formatRelationship((Entry) element); } - return ""; + return ""; //$NON-NLS-1$ } /** @@ -57,7 +57,7 @@ public class ConceptLabelProvider extends LabelProvider implements IStyledLabelP Taxon sourceTaxon = entry.getValue(); TaxonRelationshipTypeInverseContainer container = TaxonRelationshipTypeInverseContainer.CreateFromSource(sourceTaxon, entry.getKey()); Taxon relatedTaxon = TaxonRelationshipTypeInverseContainer.RelatedTaxon(sourceTaxon, entry.getKey()); - String string = String.format("%s %s", container.getAbbreviatedLabel(), relatedTaxon); + String string = String.format("%s %s", container.getAbbreviatedLabel(), relatedTaxon); //$NON-NLS-1$ return string; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java index 1e10712f4..79e9985d3 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java @@ -30,10 +30,10 @@ import org.eclipse.ui.IWorkbenchPart; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor; -import eu.etaxonomy.taxeditor.editor.Messages; import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphLabelProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphLabelProvider.java index 97188ca14..7512cc234 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphLabelProvider.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphLabelProvider.java @@ -30,7 +30,7 @@ public class ConceptGraphLabelProvider extends LabelProvider implements } else if( element instanceof TaxonRelationship) { return ((TaxonRelationship)element).getType().getRepresentation(Language.getLanguageFromUuid(Language.uuidEnglish)).getAbbreviatedLabel(); } - return "TODO"; + return "TODO"; //$NON-NLS-1$ } @Override diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphView.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphView.java index 2866751df..3ad4d3e84 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphView.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphView.java @@ -19,8 +19,8 @@ import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm; import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor; import eu.etaxonomy.taxeditor.editor.EditorUtil; -import eu.etaxonomy.taxeditor.editor.Messages; import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart; /** diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/AbstractDynamicConceptRelationMenu.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/AbstractDynamicConceptRelationMenu.java index 228705c86..0b1d80195 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/AbstractDynamicConceptRelationMenu.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/AbstractDynamicConceptRelationMenu.java @@ -70,7 +70,7 @@ public abstract class AbstractDynamicConceptRelationMenu extends ContributionIte try { handlerService.executeCommand(getCommandName(), event); } catch (Exception e) { - MessagingUtils.error(getClass(), "Error executing command", e); + MessagingUtils.error(getClass(), "Error executing command", e); //$NON-NLS-1$ } } }); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeHandler.java index ee8f919b0..d9d8d7661 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeHandler.java @@ -55,7 +55,7 @@ public class ChangeConceptRelationshipTypeHandler extends AbstractHandler editor.getUndoContext(), editor.getTaxon(), selectedElement, type, editor); EditorUtil.executeOperation(operation); } catch (NotDefinedException e) { - logger.warn("Command name not set"); + logger.warn("Command name not set"); //$NON-NLS-1$ } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeMenu.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeMenu.java index 5257fd3be..f1161d1e1 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeMenu.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeMenu.java @@ -21,7 +21,7 @@ package eu.etaxonomy.taxeditor.editor.view.concept.handler; public class ChangeConceptRelationshipTypeMenu extends AbstractDynamicConceptRelationMenu { - public String commandName = "eu.etaxonomy.taxeditor.editor.name.changeConceptRelationshipType"; + public String commandName = "eu.etaxonomy.taxeditor.editor.name.changeConceptRelationshipType"; //$NON-NLS-1$ /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.editor.handler.AbstractDynamicConceptRelationMenu#getCommandName() diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeToConceptRelationMenu.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeToConceptRelationMenu.java index 66b6d8ee4..96650239c 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeToConceptRelationMenu.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeToConceptRelationMenu.java @@ -21,7 +21,7 @@ package eu.etaxonomy.taxeditor.editor.view.concept.handler; public class ChangeToConceptRelationMenu extends AbstractDynamicConceptRelationMenu { - public String commandName = "eu.etaxonomy.taxeditor.editor.name.changeToConceptRelation"; + public String commandName = "eu.etaxonomy.taxeditor.editor.name.changeToConceptRelation"; //$NON-NLS-1$ /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.editor.handler.AbstractDynamicConceptRelationMenu#getCommandName() diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationHandler.java index ee93a777e..6e945a24f 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationHandler.java @@ -88,7 +88,7 @@ public class CreateConceptRelationHandler extends AbstractHandler { undoContext, taxon, relatedConcept, typeInverseContainer, postOperationEnabled); AbstractUtility.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set"); + MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$ } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationMenu.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationMenu.java index f0676db95..880d1a336 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationMenu.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationMenu.java @@ -21,7 +21,7 @@ package eu.etaxonomy.taxeditor.editor.view.concept.handler; public class CreateConceptRelationMenu extends AbstractDynamicConceptRelationMenu { - public String commandName = "eu.etaxonomy.taxeditor.editor.name.createConceptRelation"; + public String commandName = "eu.etaxonomy.taxeditor.editor.name.createConceptRelation"; //$NON-NLS-1$ /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.editor.handler.AbstractDynamicConceptRelationMenu#getCommandName() diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/DeleteConceptRelationHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/DeleteConceptRelationHandler.java index 534da8783..179db9fa1 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/DeleteConceptRelationHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/DeleteConceptRelationHandler.java @@ -70,7 +70,7 @@ public class DeleteConceptRelationHandler extends AbstractHandler { editor.getUndoContext(), editor.getTaxon(), relations, postOperationEnabled); EditorUtil.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set"); + MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$ } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptHandler.java index 40cc93307..186b25bf6 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptHandler.java @@ -1,28 +1,32 @@ /** * 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.editor.view.concept.handler; -import java.util.Iterator; - import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PartInitException; import org.eclipse.ui.handlers.HandlerUtil; import eu.etaxonomy.cdm.model.taxon.Taxon; +import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; +import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; +import eu.etaxonomy.taxeditor.model.AbstractUtility; +import eu.etaxonomy.taxeditor.model.LineSelection; import eu.etaxonomy.taxeditor.model.MessagingUtils; /** @@ -32,38 +36,55 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils; */ public class OpenRelatedConceptHandler extends AbstractHandler { - /* (non-Javadoc) - * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) - */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { - MultiPageTaxonEditor editor = EditorUtil.getActiveMultiPageTaxonEditor(); - ISelection selection = HandlerUtil.getCurrentSelection(event); - - if(selection instanceof IStructuredSelection){ - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - Iterator iterator = structuredSelection.iterator(); - - while (iterator.hasNext()){ - Object element = iterator.next(); - if(element instanceof TaxonRelationship){ - Taxon relatedTaxon = getRelatedTaxon((TaxonRelationship) element, editor.getTaxon()); - - try { - EditorUtil.openTaxonBase(relatedTaxon.getUuid()); - } catch (PartInitException e) { - MessagingUtils.messageDialog("Could not open taxon", getClass(), - String.format("Could not open the taxon: %s" ,relatedTaxon), e); - } - } - } + TaxonBase relatedTaxon = null; + + if(selection instanceof IStructuredSelection){ + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object selectedElement = structuredSelection.getFirstElement(); + + if(selectedElement instanceof TaxonRelationship){ + IEditorPart activeEditor = AbstractUtility.getActiveEditor(); + if(activeEditor instanceof MultiPageTaxonEditor){ + relatedTaxon = getRelatedTaxon((TaxonRelationship) selectedElement, ((MultiPageTaxonEditor) activeEditor).getTaxon()); + } + else if(activeEditor instanceof BulkEditor){ + ISelection bulkSelection = ((BulkEditor)activeEditor).getSelectionProvider().getSelection(); + if(bulkSelection instanceof LineSelection){ + Object firstElement = ((LineSelection)bulkSelection).getFirstElement(); + if(firstElement instanceof Taxon){ + relatedTaxon = getRelatedTaxon((TaxonRelationship) selectedElement, (Taxon) firstElement); + } + } + } + } + } + + if(relatedTaxon==null){ + MessagingUtils.messageDialog(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN, getClass(), + String.format(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE ,relatedTaxon), null); } - + else{ + openConcept(relatedTaxon); + } + return null; } - + /** + * @param relatedTaxon + */ + protected void openConcept(TaxonBase relatedTaxon) { + try { + EditorUtil.openTaxonBase(relatedTaxon.getUuid()); + } catch (PartInitException e) { + MessagingUtils.messageDialog(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN, getClass(), + String.format(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE ,relatedTaxon), e); + } + } + private Taxon getRelatedTaxon(TaxonRelationship relationship, Taxon taxon){ if (relationship.getFromTaxon().equals(taxon)){ return relationship.getToTaxon(); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptInBulkEditorHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptInBulkEditorHandler.java new file mode 100644 index 000000000..1b3e6c1e2 --- /dev/null +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptInBulkEditorHandler.java @@ -0,0 +1,21 @@ +package eu.etaxonomy.taxeditor.editor.view.concept.handler; + +import org.eclipse.ui.PartInitException; + +import eu.etaxonomy.cdm.model.taxon.TaxonBase; +import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil; +import eu.etaxonomy.taxeditor.model.MessagingUtils; + +public class OpenRelatedConceptInBulkEditorHandler extends OpenRelatedConceptHandler{ + /** + * {@inheritDoc} + */ + @Override + protected void openConcept(TaxonBase relatedTaxon) { + try { + BulkEditorUtil.openEditor(relatedTaxon); + } catch (PartInitException e) { + MessagingUtils.error(this.getClass(), "Bulk Editor could not be opened for "+relatedTaxon, e); + } + } +} diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateDropListener.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateDropListener.java index 7b8664bad..a38272e98 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateDropListener.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateDropListener.java @@ -17,7 +17,7 @@ import org.eclipse.swt.dnd.DropTargetEvent; import org.eclipse.swt.dnd.TransferData; import eu.etaxonomy.taxeditor.editor.EditorUtil; -import eu.etaxonomy.taxeditor.editor.Messages; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.derivate.operation.MoveDerivateOperation; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.MessagingUtils; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java index c5bcfb75a..605da7724 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java @@ -52,8 +52,8 @@ import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; import eu.etaxonomy.taxeditor.editor.EditorUtil; -import eu.etaxonomy.taxeditor.editor.Messages; import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.derivate.searchFilter.DerivateSearchCompositeController; import eu.etaxonomy.taxeditor.model.IContextListener; import eu.etaxonomy.taxeditor.model.IDirtyMarkable; @@ -76,25 +76,27 @@ import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider; public class DerivateView extends EditorPart implements IPartContentHasFactualData, IConversationEnabled, ICdmEntitySessionEnabled, IDirtyMarkable, IPostOperationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, IPartContentHasMedia, IContextListener, ISelectionListener { + private static final String SPECIMEN_EDITOR = Messages.DerivateView_SPECIMEN_EDITOR; + public static final String ID = "eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"; //$NON-NLS-1$ public static final String YOU_NEED_TO_SAVE_BEFORE_PERFORMING_THIS_ACTION = Messages.DerivateView_YOU_NEED_TO_SAVE; public static final String VIEW_HAS_UNSAVED_CHANGES = Messages.DerivateView_UNSAVED_CHANGES; private static final List SPECIMEN_INIT_STRATEGY = Arrays.asList(new String[] { - "descriptions", - "annotations", - "markers", - "credits", - "extensions", - "rights", - "sources", - "derivationEvents.derivatives.annotations", - "derivationEvents.derivatives.markers", - "derivationEvents.derivatives.credits", - "derivationEvents.derivatives.extensions", - "derivationEvents.derivatives.rights", - "derivationEvents.derivatives.sources" + "descriptions", //$NON-NLS-1$ + "annotations", //$NON-NLS-1$ + "markers", //$NON-NLS-1$ + "credits", //$NON-NLS-1$ + "extensions", //$NON-NLS-1$ + "rights", //$NON-NLS-1$ + "sources", //$NON-NLS-1$ + "derivationEvents.derivatives.annotations", //$NON-NLS-1$ + "derivationEvents.derivatives.markers", //$NON-NLS-1$ + "derivationEvents.derivatives.credits", //$NON-NLS-1$ + "derivationEvents.derivatives.extensions", //$NON-NLS-1$ + "derivationEvents.derivatives.rights", //$NON-NLS-1$ + "derivationEvents.derivatives.sources" //$NON-NLS-1$ }); private static final int WARN_THRESHOLD = 200; @@ -254,7 +256,7 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa //set taxon filter derivateSearchCompositeController.setTaxonFilter(((DerivateViewEditorInput) getEditorInput()).getTaxonUuid()); //reset status bar - getEditorSite().getActionBars().getStatusLineManager().setMessage(""); + getEditorSite().getActionBars().getStatusLineManager().setMessage(""); //$NON-NLS-1$ //add drag'n'drop support Transfer[] transfers = new Transfer[] {LocalSelectionTransfer.getTransfer(),}; @@ -323,7 +325,7 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa labelProvider.updateLabelCache(rootElements); viewer.setInput(rootElements); - getEditorSite().getActionBars().getStatusLineManager().setMessage(rootElements.size() +" derivative hierarchies found"); + getEditorSite().getActionBars().getStatusLineManager().setMessage(String.format(Messages.DerivateView_CNT_DERIVATIVES_FOUND, rootElements.size())); //set selection to derivatives if the filter criteria //taxon assignment or derivative type are set @@ -357,7 +359,7 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa conversation.commit(true); CdmStore.getService(IOccurrenceService.class).merge(new ArrayList(rootElements), true); - + monitor.worked(1); this.setDirty(false); @@ -429,14 +431,14 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa @Override public Map> getPropertyPathsMap() { List specimenPropertyPaths = Arrays.asList(new String[] { - "descriptions", - "derivationEvents.derivates", - "annotations", - "markers", - "credits", - "extensions", - "rights", - "sources" + "descriptions", //$NON-NLS-1$ + "derivationEvents.derivates", //$NON-NLS-1$ + "annotations", //$NON-NLS-1$ + "markers", //$NON-NLS-1$ + "credits", //$NON-NLS-1$ + "extensions", //$NON-NLS-1$ + "rights", //$NON-NLS-1$ + "sources" //$NON-NLS-1$ }); Map> specimenPropertyPathMap = new HashMap>(); @@ -558,7 +560,7 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa } checkWarnThreshold(uuids); updateRootEntities(uuids); - setPartName("Derivative Editor: " + selectedTaxon.getName()); + setPartName(SPECIMEN_EDITOR+": " + selectedTaxon.getName()); //$NON-NLS-1$ } } } @@ -579,10 +581,7 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa private void checkWarnThreshold(Collection uuids) { if(uuids!=null && uuids.size()>WARN_THRESHOLD){ - MessagingUtils.warningDialog("Performance warning", this.getClass(), String.format("Specimens will not be loaded!\n" - + "There are %d specimens associated with the current " - + "selection. If you really want to show all of them in the specimen editor please " - + "use the taxon filter in the search bar.", uuids.size())); + MessagingUtils.warningDialog(Messages.DerivateView_PERF_WARNING, this.getClass(), String.format(Messages.DerivateView_PERF_WARNING_MESSAGE, uuids.size())); uuids.clear(); } } @@ -604,10 +603,10 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa derivateSearchCompositeController.setEnabled(!listenToSelectionChange); if(!listenToSelectionChange){ selectedTaxon = null; - setPartName("Derivative Editor"); + setPartName(SPECIMEN_EDITOR); } else if(selectedTaxon==null){ - setPartName("Derivative Editor [no taxon selected]"); + setPartName(SPECIMEN_EDITOR+Messages.DerivateView_NO_TAXON_SELECTED); } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java index 5ee63a983..3a1510c80 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java @@ -16,6 +16,8 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IPersistableElement; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; + /** * Editor input for the {@link DerivateView} * @@ -87,7 +89,7 @@ public class DerivateViewEditorInput implements IEditorInput { } private String getEditorName() { - return "Derivative Editor"; + return Messages.DerivateViewEditorInput_SPECIMEN_EDITOR; } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivativeEditorPropertyTester.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivativeEditorPropertyTester.java index 74229d410..77e0069cb 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivativeEditorPropertyTester.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivativeEditorPropertyTester.java @@ -11,7 +11,7 @@ public class DerivativeEditorPropertyTester extends PropertyTester { @Override public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { DerivateView derivateView = (DerivateView)receiver; - if(property.equals("isLinkedWithTaxonSelection")){ + if(property.equals("isLinkedWithTaxonSelection")){ //$NON-NLS-1$ return derivateView.isListenToSelectionChange(); } return false; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/CreateDerivateContextMenu.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/CreateDerivateContextMenu.java index cbdd50c78..0d9d17e82 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/CreateDerivateContextMenu.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/CreateDerivateContextMenu.java @@ -28,7 +28,7 @@ import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; import eu.etaxonomy.taxeditor.editor.EditorUtil; -import eu.etaxonomy.taxeditor.editor.Messages; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.MessagingUtils; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/CreateFieldUnitContextMenu.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/CreateFieldUnitContextMenu.java index 09a52a288..922450ac3 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/CreateFieldUnitContextMenu.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/CreateFieldUnitContextMenu.java @@ -20,7 +20,7 @@ import eu.etaxonomy.cdm.model.description.IndividualsAssociation; import eu.etaxonomy.cdm.model.description.TaxonDescription; import eu.etaxonomy.cdm.model.occurrence.FieldUnit; import eu.etaxonomy.cdm.model.taxon.Taxon; -import eu.etaxonomy.taxeditor.editor.Messages; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.store.CdmStore; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/ListenToSelectionChangeContextMenu.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/ListenToSelectionChangeContextMenu.java index 15fa005f1..068f249d2 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/ListenToSelectionChangeContextMenu.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/ListenToSelectionChangeContextMenu.java @@ -12,6 +12,7 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.CompoundContributionItem; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView; import eu.etaxonomy.taxeditor.model.ImageResources; @@ -33,10 +34,10 @@ public class ListenToSelectionChangeContextMenu extends CompoundContributionItem final DerivateView derivateView = (DerivateView) activePart; MenuItem item = new MenuItem(menu, SWT.NONE); if(derivateView.isListenToSelectionChange()){ - item.setText("Unlink from taxon selection"); + item.setText(Messages.ListenToSelectionChangeContextMenu_UNLINK); } else{ - item.setText("Link with taxon selection"); + item.setText(Messages.ListenToSelectionChangeContextMenu_LINK); } item.setImage(ImageResources.getImage(ImageResources.SYNCED)); item.addSelectionListener(new SelectionAdapterExtension(derivateView)); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java index 055cac132..e7a0de1a2 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java @@ -27,6 +27,7 @@ import eu.etaxonomy.cdm.model.molecular.Sequence; import eu.etaxonomy.cdm.model.molecular.SingleRead; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; import eu.etaxonomy.taxeditor.editor.EditorUtil; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.derivate.operation.DeleteDerivateOperation; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.MessagingUtils; @@ -73,12 +74,12 @@ public class DeleteDerivateHandler extends AbstractHandler { } } else{ - MessagingUtils.error(getClass(), "Selection is not valid for this delete handler", null); + MessagingUtils.error(getClass(), Messages.DeleteDerivateHandler_INVALID_SELECTION, null); } } } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set"); + MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$ } return null; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForDescriptionElement.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForDescriptionElement.java index 1d1dbde7b..d5f71eea9 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForDescriptionElement.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForDescriptionElement.java @@ -12,6 +12,7 @@ import eu.etaxonomy.cdm.model.description.IndividualsAssociation; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput; import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase; import eu.etaxonomy.taxeditor.model.MessagingUtils; @@ -31,7 +32,7 @@ public class OpenDerivativeEditorForDescriptionElement extends DefaultOpenHandle @Override protected void open(ExecutionEvent event, IndividualsAssociation entity) { if(entity==null || entity.getAssociatedSpecimenOrObservation()==null){ - MessagingUtils.messageDialog("No specimens found", this, "No specimens found for the selected object. (Maybe there are unsaved changes)"); + MessagingUtils.messageDialog(Messages.OpenDerivativeEditorForDescriptionElement_NO_SPECIMENS, this, Messages.OpenDerivativeEditorForDescriptionElement_NO_SPECIMENS_MESSAGE); return; } SpecimenOrObservationBase associatedSpecimenOrObservation = entity.getAssociatedSpecimenOrObservation(); @@ -40,7 +41,7 @@ public class OpenDerivativeEditorForDescriptionElement extends DefaultOpenHandle try { EditorUtil.open(new DerivateViewEditorInput(Collections.singletonList(specimenUuid))); } catch (PartInitException e) { - MessagingUtils.error(OpenDerivateViewHandler.class, "Derivative Editor could not be opened", e); + MessagingUtils.error(OpenDerivateViewHandler.class, OpenDerivativeEditorForTaxonNode.OPEN_DERIVATIVE_EDITOR_FOR_TAXON_NODE_COULD_NOT_OPEN, e); } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForSpecimenOrOBservationBase.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForSpecimenOrOBservationBase.java new file mode 100644 index 000000000..627fc9a09 --- /dev/null +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForSpecimenOrOBservationBase.java @@ -0,0 +1,42 @@ +package eu.etaxonomy.taxeditor.editor.view.derivate.handler; + +import java.util.UUID; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.ui.PartInitException; + +import eu.etaxonomy.cdm.api.service.IOccurrenceService; +import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; +import eu.etaxonomy.taxeditor.editor.EditorUtil; +import eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; +import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput; +import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase; +import eu.etaxonomy.taxeditor.model.MessagingUtils; +import eu.etaxonomy.taxeditor.store.CdmStore; + +public class OpenDerivativeEditorForSpecimenOrOBservationBase extends DefaultOpenHandlerBase>{ + + protected static final String OPEN_DERIVATIVE_EDITOR_FOR_TAXON_NODE_COULD_NOT_OPEN = Messages.OpenDerivativeEditorForTaxonNode_COULD_NOT_OPEN; + + /** + * {@inheritDoc} + */ + @Override + protected SpecimenOrObservationBase getEntity(UUID uuid) { + return CdmStore.getService(IOccurrenceService.class).load(uuid); + } + + @Override + protected void open(ExecutionEvent event, SpecimenOrObservationBase entity) { + try { + EditorUtil.open(new DerivateViewEditorInput(entity.getUuid())); + } catch (PartInitException e) { + MessagingUtils.error(OpenDerivateViewHandler.class, OPEN_DERIVATIVE_EDITOR_FOR_TAXON_NODE_COULD_NOT_OPEN, e); + } + + } + + + +} diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForTaxonNode.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForTaxonNode.java index fbaa4e877..bfbe2333d 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForTaxonNode.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForTaxonNode.java @@ -15,6 +15,7 @@ import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput; import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase; import eu.etaxonomy.taxeditor.model.MessagingUtils; @@ -22,6 +23,8 @@ import eu.etaxonomy.taxeditor.store.CdmStore; public class OpenDerivativeEditorForTaxonNode extends DefaultOpenHandlerBase { + protected static final String OPEN_DERIVATIVE_EDITOR_FOR_TAXON_NODE_COULD_NOT_OPEN = Messages.OpenDerivativeEditorForTaxonNode_COULD_NOT_OPEN; + @Override protected TaxonNode getEntity(UUID uuid) { return CdmStore.getService(ITaxonNodeService.class).load(uuid); @@ -40,7 +43,7 @@ public class OpenDerivativeEditorForTaxonNode extends DefaultOpenHandlerBase * @@ -54,28 +56,28 @@ public class DerivateSearchComposite extends Composite { setLayout(new GridLayout(7, false)); lblTaxon = new Label(this, SWT.NONE); - lblTaxon.setText("Taxon"); + lblTaxon.setText(Messages.DerivateSearchComposite_TAXON); - textTaxonName = formToolkit.createText(this, "New Text", SWT.BORDER); + textTaxonName = formToolkit.createText(this, Messages.DerivateSearchComposite_NEW_TEXT, SWT.BORDER); textTaxonName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textTaxonName.setEnabled(false); - textTaxonName.setText(""); + textTaxonName.setText(""); //$NON-NLS-1$ - btnBrowseTaxa = formToolkit.createButton(this, "", SWT.NONE); + btnBrowseTaxa = formToolkit.createButton(this, "", SWT.NONE); //$NON-NLS-1$ btnBrowseTaxa.setAlignment(SWT.RIGHT); - btnBrowseTaxa.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/prj_obj.gif")); + btnBrowseTaxa.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/prj_obj.gif")); //$NON-NLS-1$ //$NON-NLS-2$ - btnClearTaxon = formToolkit.createButton(this, "", SWT.NONE); + btnClearTaxon = formToolkit.createButton(this, "", SWT.NONE); //$NON-NLS-1$ btnClearTaxon.setAlignment(SWT.RIGHT); btnClearTaxon.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1)); - btnClearTaxon.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif")); + btnClearTaxon.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif")); //$NON-NLS-1$ //$NON-NLS-2$ lbltaxonAssignment = new Label(this, SWT.NONE); lbltaxonAssignment.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); - lbltaxonAssignment.setText("Taxon assignment"); + lbltaxonAssignment.setText(Messages.DerivateSearchComposite_TAXON_ASSIGNMENT); comboTaxonAssignment = new Combo(this, SWT.NONE); - comboTaxonAssignment.setItems(new String[] { "All", "Yes", "No" }); + comboTaxonAssignment.setItems(new String[] { Messages.DerivateSearchComposite_ALL, Messages.DerivateSearchComposite_YES, Messages.DerivateSearchComposite_NO }); comboTaxonAssignment.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); formToolkit.adapt(comboTaxonAssignment); formToolkit.paintBordersFor(comboTaxonAssignment); @@ -84,15 +86,15 @@ public class DerivateSearchComposite extends Composite { lblTitleCache = new Label(this, SWT.NONE); lblTitleCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); - lblTitleCache.setText("Title Cache"); + lblTitleCache.setText(Messages.DerivateSearchComposite_TITLE_CACHE); - searchField = formToolkit.createText(this, "New Text", SWT.BORDER); + searchField = formToolkit.createText(this, "New Text", SWT.BORDER); //$NON-NLS-1$ searchField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1)); - searchField.setText(""); + searchField.setText(""); //$NON-NLS-1$ lblDerivateType = new Label(this, SWT.NULL); lblDerivateType.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); - lblDerivateType.setText("Derivative Type"); + lblDerivateType.setText(Messages.DerivateSearchComposite_DERIVATE_TYPE); comboDerivateType = new Combo(this, SWT.READ_ONLY); comboDerivateType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); @@ -100,7 +102,7 @@ public class DerivateSearchComposite extends Composite { buttonSearch = new Button(this, SWT.NONE); formToolkit.adapt(buttonSearch, true, true); - buttonSearch.setText("Search"); + buttonSearch.setText(Messages.DerivateSearchComposite_SEARCH); } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/searchFilter/DerivateSearchCompositeController.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/searchFilter/DerivateSearchCompositeController.java index 3bf8a8f74..bf84e9529 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/searchFilter/DerivateSearchCompositeController.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/searchFilter/DerivateSearchCompositeController.java @@ -115,7 +115,7 @@ public class DerivateSearchCompositeController implements Listener{ } else if(eventSource==derivateSearchComposite.getBtnClearTaxon()){ selectedTaxon = null; - derivateSearchComposite.getTextTaxonName().setText(""); + derivateSearchComposite.getTextTaxonName().setText(""); //$NON-NLS-1$ derivateSearchComposite.getComboTaxonAssignment().select(DerivateSearchComposite.ALL_SPECIMENS); derivateSearchComposite.getComboTaxonAssignment().setEnabled(true); derivateSearchComposite.getLbltaxonAssignment().setEnabled(true); @@ -156,7 +156,7 @@ public class DerivateSearchCompositeController implements Listener{ */ public void reset(){ if(!derivateSearchComposite.isDisposed()){ - derivateSearchComposite.getSearchField().setText(""); + derivateSearchComposite.getSearchField().setText(""); //$NON-NLS-1$ derivateSearchComposite.getComboDerivateType().deselectAll(); comboSpecimenTypeController.setSelection(SpecimenOrObservationType.Unknown); } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDropAdapter.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDropAdapter.java index 7ab4c9b8f..50072f040 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDropAdapter.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDropAdapter.java @@ -20,6 +20,7 @@ import org.eclipse.swt.dnd.TransferData; import eu.etaxonomy.cdm.model.description.DescriptionElementBase; import eu.etaxonomy.cdm.model.description.TaxonDescription; import eu.etaxonomy.taxeditor.editor.EditorUtil; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionElementsOperation; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; @@ -31,7 +32,9 @@ import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; */ public class DescriptionElementDropAdapter extends ViewerDropAdapter { - /** + private static final String OPERATION_NOT_SUPPORTED_YET = Messages.DescriptionElementDropAdapter_NOT_SUPPORTED; + + /** * @param viewer */ public DescriptionElementDropAdapter(Viewer viewer) { @@ -54,7 +57,7 @@ public class DescriptionElementDropAdapter extends ViewerDropAdapter { if (droppedElements != null){ for (Object droppedElement : droppedElements) { if (droppedElement == null){ - MessagingUtils.warningDialog("Operation not supported yet", this, "We are currently unable to drag and drop a newly created element. Please save the editor to make this work."); + MessagingUtils.warningDialog(OPERATION_NOT_SUPPORTED_YET, this, Messages.DescriptionElementDropAdapter_NOT_SUPPORTED_NEW_ELEMENT); return false; } if(! (droppedElement instanceof DescriptionElementBase)){ @@ -70,12 +73,12 @@ public class DescriptionElementDropAdapter extends ViewerDropAdapter { } } - AbstractPostOperation operation = new MoveDescriptionElementsOperation("Move Descriptions", EditorUtil.getUndoContext(), target, descriptionElements, isCopy, null); + AbstractPostOperation operation = new MoveDescriptionElementsOperation(Messages.DescriptionElementDropAdapter_MOVE_DESC, EditorUtil.getUndoContext(), target, descriptionElements, isCopy, null); EditorUtil.executeOperation(operation); return true; } - MessagingUtils.warningDialog("Operation not supported yet", this, "We are unable to drag and drop empty descriptions"); + MessagingUtils.warningDialog(OPERATION_NOT_SUPPORTED_YET, this, Messages.DescriptionElementDropAdapter_NOT_SUPPORTED_EMPTY_ELEMENT); return false; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementTransfer.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementTransfer.java index 9f125ce68..005f1199f 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementTransfer.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementTransfer.java @@ -24,7 +24,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore; public class DescriptionElementTransfer extends CdmObjectTransfer { private static DescriptionElementTransfer instance = new DescriptionElementTransfer(); - private static final String TYPE_NAME = "descriptionElement-transfer-format"; + private static final String TYPE_NAME = "descriptionElement-transfer-format"; //$NON-NLS-1$ private static final int TYPEID = registerType(TYPE_NAME); public static synchronized DescriptionElementTransfer getInstance(){ diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveContentProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveContentProvider.java index b0aeb0f4d..86657ea7d 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveContentProvider.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveContentProvider.java @@ -16,7 +16,6 @@ import org.eclipse.jface.viewers.Viewer; import eu.etaxonomy.cdm.model.common.Marker; import eu.etaxonomy.cdm.model.description.DescriptionBase; import eu.etaxonomy.cdm.model.description.DescriptionElementBase; -import eu.etaxonomy.cdm.model.description.Feature; import eu.etaxonomy.cdm.model.description.FeatureTree; import eu.etaxonomy.cdm.model.description.IDescribable; import eu.etaxonomy.cdm.model.description.IndividualsAssociation; @@ -24,7 +23,6 @@ import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput; import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; -import eu.etaxonomy.taxeditor.store.TermStore; import eu.etaxonomy.taxeditor.store.UsageTermCollection; /** @@ -94,13 +92,46 @@ public class DescriptiveContentProvider implements ITreeContentProvider { @Override public int compare(IndividualsAssociation o1, IndividualsAssociation o2) { - if(o1==null || o1.getAssociatedSpecimenOrObservation()==null){ - return -1; + if(o1==null){ + if(o2==null){ + return 0; + } + else{ + return -1; + } } - if(o2==null || o2.getAssociatedSpecimenOrObservation()==null){ + else if(o2==null){ return 1; } - return o1.getAssociatedSpecimenOrObservation().compareTo(o2.getAssociatedSpecimenOrObservation()); + + if(o1.getAssociatedSpecimenOrObservation()==null){ + if(o2.getAssociatedSpecimenOrObservation()==null){ + return 0; + } + else{ + return -1; + } + } + else if(o2.getAssociatedSpecimenOrObservation()==null){ + return 1; + } + + String titleCache1 = o1.getAssociatedSpecimenOrObservation().getTitleCache(); + String titleCache2 = o2.getAssociatedSpecimenOrObservation().getTitleCache(); + + if(titleCache1==null){ + if(titleCache2==null){ + return 0; + } + else{ + return -1; + } + } + if(titleCache2==null){ + return 1; + } + + return titleCache1.compareTo(titleCache2); } }); if(showOnlyIndividualAssociations){ diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java index c5fd8e15c..6e180d34b 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java @@ -44,7 +44,7 @@ import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor; import eu.etaxonomy.taxeditor.editor.EditorUtil; -import eu.etaxonomy.taxeditor.editor.Messages; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor; import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView; import eu.etaxonomy.taxeditor.editor.view.media.MediaViewPart; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/CreateDescriptionElementHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/CreateDescriptionElementHandler.java index 87a8c470a..28a23aac8 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/CreateDescriptionElementHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/CreateDescriptionElementHandler.java @@ -76,10 +76,10 @@ public class CreateDescriptionElementHandler extends AbstractHandler { operation = operationCreationInstance(event.getCommand().getName(), event, description, postOperationEnabled); AbstractUtility.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set"); + MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$ } } else { - MessagingUtils.error(getClass(), new IllegalArgumentException("Could not determine the taxon description")); + MessagingUtils.error(getClass(), new IllegalArgumentException("Could not determine the taxon description")); //$NON-NLS-1$ return null; } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/CreateDescriptionHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/CreateDescriptionHandler.java index 46bd2d8e5..fa5ff0f90 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/CreateDescriptionHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/CreateDescriptionHandler.java @@ -64,7 +64,7 @@ public class CreateDescriptionHandler extends AbstractHandler { operation = createTaxonOperation(event.getCommand().getName(), taxon, postOperationEnabled); AbstractUtility.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } // specimen description @@ -75,7 +75,7 @@ public class CreateDescriptionHandler extends AbstractHandler { operation = new CreateSpecimenDescriptionOperation(event.getCommand().getName(), EditorUtil.getUndoContext(), (SpecimenOrObservationBase) viewerInput, postOperationEnabled); AbstractUtility.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } if(viewerInput instanceof TaxonBase){ @@ -83,7 +83,7 @@ public class CreateDescriptionHandler extends AbstractHandler { operation = createTaxonOperation(event.getCommand().getName(), (Taxon) viewerInput, postOperationEnabled); AbstractUtility.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DeleteHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DeleteHandler.java index 49ce24e91..19fc669d1 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DeleteHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DeleteHandler.java @@ -32,6 +32,7 @@ import eu.etaxonomy.cdm.model.description.SpecimenDescription; import eu.etaxonomy.cdm.model.description.TaxonDescription; import eu.etaxonomy.cdm.model.media.Media; import eu.etaxonomy.taxeditor.editor.EditorUtil; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteDescriptionElementOperation; import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteSpecimenDescriptionOperation; import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteTaxonDescriptionOperation; @@ -43,7 +44,7 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; -import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog; +import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog; /** *

DeleteDescriptionHandler class.

@@ -105,7 +106,7 @@ public class DeleteHandler extends AbstractHandler { MediaDeletionConfigurator config = new MediaDeletionConfigurator(); DeleteConfiguratorDialog dialog; - dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the media?", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0); + dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), Messages.DeleteHandler_CONFIRM_DELETION, null, Messages.DeleteHandler_CONFIRM_DELETION_MESSAGE, MessageDialog.WARNING, new String[] { Messages.DeleteHandler_DELETE, Messages.DeleteHandler_SKIP }, 0); int result_dialog= dialog.open(); if (result_dialog != Status.OK){ return null; @@ -123,7 +124,7 @@ public class DeleteHandler extends AbstractHandler { } else{ - MessagingUtils.error(getClass(), "Selection is not valid for this delete handler", null); + MessagingUtils.error(getClass(), Messages.DeleteHandler_INVALID_SELECTION, null); } } @@ -133,7 +134,7 @@ public class DeleteHandler extends AbstractHandler { } } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java index 3030ef4a3..d47ff9006 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java @@ -25,16 +25,16 @@ import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; */ public class DescriptionsMenuPropertyTester extends PropertyTester { - private static final String MEDIA = "isMedia"; - private static final String FEATURE_NODE_CONTAINER = "isFeatureNodeContainer"; - private static final String DESCRIPTION = "isDescription"; - private static final String INDIVIDUALS_ASSOCIATION = "isIndividualsAssociation"; - private static final String DESCRIPTION_ELEMENT = "isDescriptionElement"; - private static final String DELETABLE = "isDeletable"; - private static final String IMAGE_GALLERY = "isImageGallery"; - private static final String TAXON_EDITOR = "isTaxonEditor"; - private static final String BULK_EDITOR = "isBulkEditor"; - private static final String DERIVATE_EDITOR = "isDerivateEditor"; + private static final String MEDIA = "isMedia"; //$NON-NLS-1$ + private static final String FEATURE_NODE_CONTAINER = "isFeatureNodeContainer"; //$NON-NLS-1$ + private static final String DESCRIPTION = "isDescription"; //$NON-NLS-1$ + private static final String INDIVIDUALS_ASSOCIATION = "isIndividualsAssociation"; //$NON-NLS-1$ + private static final String DESCRIPTION_ELEMENT = "isDescriptionElement"; //$NON-NLS-1$ + private static final String DELETABLE = "isDeletable"; //$NON-NLS-1$ + private static final String IMAGE_GALLERY = "isImageGallery"; //$NON-NLS-1$ + private static final String TAXON_EDITOR = "isTaxonEditor"; //$NON-NLS-1$ + private static final String BULK_EDITOR = "isBulkEditor"; //$NON-NLS-1$ + private static final String DERIVATE_EDITOR = "isDerivateEditor"; //$NON-NLS-1$ /* (non-Javadoc) * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionElementsHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionElementsHandler.java index e89037389..d601247ed 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionElementsHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionElementsHandler.java @@ -35,6 +35,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; import eu.etaxonomy.taxeditor.editor.Page; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionElementsOperation; import eu.etaxonomy.taxeditor.model.AbstractUtility; @@ -103,7 +104,7 @@ public class MoveDescriptionElementsHandler extends AbstractHandler implements I } TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), - "Choose the accepted taxon", + Messages.MoveDescriptionElementsHandler_CHOOSE_ACC_TAXON, excludeTaxa, null, classification ); @@ -116,7 +117,7 @@ public class MoveDescriptionElementsHandler extends AbstractHandler implements I } newAcceptedTaxonNodeUuid = newAcceptedTaxonNode.getUuid(); - String moveMessage = String.format("Elements moved from %s", EditorUtil.getActiveMultiPageTaxonEditor().getTaxon()); + String moveMessage = String.format(Messages.MoveDescriptionElementsHandler_ELEMENTS_MOVED, EditorUtil.getActiveMultiPageTaxonEditor().getTaxon()); try { AbstractPostOperation operation = new MoveDescriptionElementsOperation( @@ -158,7 +159,7 @@ public class MoveDescriptionElementsHandler extends AbstractHandler implements I MessagingUtils.error(this.getClass(), e); throw new RuntimeException(e); } catch (Exception e) { - MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage()); + MessagingUtils.warningDialog(Messages.MoveDescriptionElementsHandler_CREATE_FAILURE, this, e.getMessage()); } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionToOtherTaxonHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionToOtherTaxonHandler.java index c51d0ee05..f67ef5112 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionToOtherTaxonHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionToOtherTaxonHandler.java @@ -28,6 +28,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionToOtherTaxonOperation; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; @@ -65,7 +66,7 @@ public class MoveDescriptionToOtherTaxonHandler extends AbstractHandler editor = EditorUtil.getActiveMultiPageTaxonEditor(); if (this.editor.isDirty()){ boolean proceed = MessageDialog.openQuestion(null, - "Save changes", "You have made changes that must be saved before this query can be executed. Would you like to proceed?"); + Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES, Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES_MESSAGE); if (proceed) { editor.doSave(EditorUtil.getMonitor()); } else { @@ -113,7 +114,7 @@ public class MoveDescriptionToOtherTaxonHandler extends AbstractHandler } TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), - "Choose the accepted taxon", + Messages.MoveDescriptionToOtherTaxonHandler_CHOOSE_ACC_TAXON, excludeTaxa, node, classification); @@ -137,7 +138,7 @@ public class MoveDescriptionToOtherTaxonHandler extends AbstractHandler } } catch (NotDefinedException e) { - logger.warn("Command name not set"); + logger.warn("Command name not set"); //$NON-NLS-1$ } } @@ -167,7 +168,7 @@ public class MoveDescriptionToOtherTaxonHandler extends AbstractHandler MessagingUtils.error(this.getClass(), e); throw new RuntimeException(e); } catch (Exception e) { - MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage()); + MessagingUtils.warningDialog(Messages.MoveDescriptionToOtherTaxonHandler_CREATE_FAILED, this, e.getMessage()); } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/AddDerivedUnitFacadeMediaOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/AddDerivedUnitFacadeMediaOperation.java index 40312990c..ef29bffed 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/AddDerivedUnitFacadeMediaOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/AddDerivedUnitFacadeMediaOperation.java @@ -22,6 +22,7 @@ import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; import eu.etaxonomy.cdm.model.occurrence.FieldUnit; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; @@ -33,7 +34,9 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; */ public class AddDerivedUnitFacadeMediaOperation extends AbstractPostTaxonOperation { - private final SpecimenOrObservationBase specimen; + private static final String ONLY_ONE_IMAGE_GALLERY_IS_POSSIBLE = Messages.AddDerivedUnitFacadeMediaOperation_CREATE_FAILED_MESSAGE; + private static final String IMAGE_GALLERY_CREATION_FAILED = Messages.AddDerivedUnitFacadeMediaOperation_CREATE_FAILED; + private final SpecimenOrObservationBase specimen; /** * @param label @@ -57,7 +60,7 @@ public class AddDerivedUnitFacadeMediaOperation extends AbstractPostTaxonOperati if(specimen instanceof FieldUnit){ facade = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) specimen); if(facade.hasFieldObjectImageGallery()){ - MessagingUtils.informationDialog("Image gallery creation failed", "Only one image gallery is possible."); + MessagingUtils.informationDialog(IMAGE_GALLERY_CREATION_FAILED, ONLY_ONE_IMAGE_GALLERY_IS_POSSIBLE); return Status.CANCEL_STATUS; } else{ @@ -67,7 +70,7 @@ public class AddDerivedUnitFacadeMediaOperation extends AbstractPostTaxonOperati else if(specimen instanceof DerivedUnit){ facade = DerivedUnitFacade.NewInstance((DerivedUnit)specimen); if(facade.hasDerivedUnitImageGallery()){ - MessagingUtils.informationDialog("Image gallery creation failed", "Only one image gallery is possible."); + MessagingUtils.informationDialog(IMAGE_GALLERY_CREATION_FAILED, ONLY_ONE_IMAGE_GALLERY_IS_POSSIBLE); return Status.CANCEL_STATUS; } else{ diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateDescriptionElementOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateDescriptionElementOperation.java index a16125b36..0f4ca8b20 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateDescriptionElementOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateDescriptionElementOperation.java @@ -40,7 +40,7 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; public class CreateDescriptionElementOperation extends AbstractPostTaxonOperation { /** Constant ID="eu.etaxonomy.taxeditor.editor.descripti"{trunked} */ - public static final String ID = "eu.etaxonomy.taxeditor.editor.view.descriptive.command.createDescriptionElement"; + public static final String ID = "eu.etaxonomy.taxeditor.editor.view.descriptive.command.createDescriptionElement"; //$NON-NLS-1$ private final DescriptionBase description; private final Feature feature; @@ -94,7 +94,7 @@ public class CreateDescriptionElementOperation extends AbstractPostTaxonOperatio monitor.worked(20); if (element == null) { if (feature.isSupportsCommonTaxonName()) { - element = CommonTaxonName.NewInstance("", null); + element = CommonTaxonName.NewInstance("", null); //$NON-NLS-1$ } else if (feature.isSupportsDistribution()) { element = Distribution.NewInstance(); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateSpecimenDescriptionOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateSpecimenDescriptionOperation.java index e68834fb0..cf8e10e20 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateSpecimenDescriptionOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateSpecimenDescriptionOperation.java @@ -21,7 +21,7 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; * @date 04.12.2013 * */ -public class CreateSpecimenDescriptionOperation extends AbstractDescriptionPostOperation, DescriptionBase> { +public class CreateSpecimenDescriptionOperation extends AbstractDescriptionPostOperation { /** * @param label diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/DeleteDescriptionElementOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/DeleteDescriptionElementOperation.java index 54834bac6..9ee81413a 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/DeleteDescriptionElementOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/DeleteDescriptionElementOperation.java @@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IStatus; import eu.etaxonomy.cdm.model.description.DescriptionBase; import eu.etaxonomy.cdm.model.description.DescriptionElementBase; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; @@ -64,7 +65,7 @@ public class DeleteDescriptionElementOperation extends AbstractPostTaxonOperatio // Remove element from description if (description == null) { - MessagingUtils.error(this.getClass(), "Couldn't find element's description!", null); + MessagingUtils.error(this.getClass(), Messages.DeleteDescriptionElementOperation_DESC_NOT_FOUND, null); } else { description.removeElement(element); } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/EditInXper2Handler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/EditInXper2Handler.java index 5e2239599..9e998fd1e 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/EditInXper2Handler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/EditInXper2Handler.java @@ -20,7 +20,7 @@ public class EditInXper2Handler extends AbstractHandler { */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { - MessagingUtils.warningDialog("Operation not supported yet", getClass(), "This operation is not supported yet."); + MessagingUtils.warningDialog("Operation not supported yet", getClass(), "This operation is not supported yet."); //$NON-NLS-1$ //$NON-NLS-2$ return null; } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/MoveDescriptionToOtherTaxonOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/MoveDescriptionToOtherTaxonOperation.java index 2b430931c..d92ab454e 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/MoveDescriptionToOtherTaxonOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/MoveDescriptionToOtherTaxonOperation.java @@ -26,6 +26,7 @@ import eu.etaxonomy.cdm.model.common.Language; import eu.etaxonomy.cdm.model.description.TaxonDescription; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.editor.EditorUtil; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; @@ -78,11 +79,11 @@ public class MoveDescriptionToOtherTaxonOperation extends monitor.worked(20); bind(); - String moveMessage = String.format("Description moved from %s", EditorUtil.getActiveMultiPageTaxonEditor().getTaxon()); + String moveMessage = String.format(Messages.MoveDescriptionToOtherTaxonOperation_MOVED_FROM, EditorUtil.getActiveMultiPageTaxonEditor().getTaxon()); if(description.isProtectedTitleCache()){ - String separator = ""; + String separator = ""; //$NON-NLS-1$ if(!StringUtils.isBlank(description.getTitleCache())){ - separator = " - "; + separator = " - "; //$NON-NLS-1$ } description.setTitleCache(description.getTitleCache() + separator + moveMessage, true); } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaContentProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaContentProvider.java index cac33da66..4863ef254 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaContentProvider.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaContentProvider.java @@ -58,7 +58,7 @@ public class MediaContentProvider implements ITreeContentProvider{ } if(taxon == null){ - MessagingUtils.error(getClass(), "Taxon is null", null); + MessagingUtils.error(getClass(), "Taxon is null", null); //$NON-NLS-1$ return NO_CHILDREN; } HashSet imageGalleries = new HashSet(); @@ -90,7 +90,7 @@ public class MediaContentProvider implements ITreeContentProvider{ } } catch (DerivedUnitFacadeNotSupportedException e) { - MessagingUtils.error(this.getClass(), "DerivedUnitFacadeNotSupportedException when trying to instantiate DerivedUnitFacade", e); + MessagingUtils.error(this.getClass(), "DerivedUnitFacadeNotSupportedException when trying to instantiate DerivedUnitFacade", e); //$NON-NLS-1$ } } else if (parentElement instanceof FieldUnit){ @@ -138,13 +138,13 @@ public class MediaContentProvider implements ITreeContentProvider{ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} private List getImages(DescriptionBase description){ - Assert.isTrue(description.isImageGallery(), "Description should have the imageGallery flag set."); + Assert.isTrue(description.isImageGallery(), "Description should have the imageGallery flag set."); //$NON-NLS-1$ Set elements = description.getElements(); if (elements != null) { // by definition, image galleries have only one description element if(elements.size() > 1){ - MessagingUtils.error(this.getClass(), "There should be one and only one description element to hold the images. Found: " + elements.size() + " InDescription ID: " + description.getUuid(), null); + MessagingUtils.error(this.getClass(), "There should be one and only one description element to hold the images. Found: " + elements.size() + " InDescription ID: " + description.getUuid(), null); //$NON-NLS-1$ //$NON-NLS-2$ } if (!elements.isEmpty()){ DescriptionElementBase element = elements.iterator().next(); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java index 2cd347b2b..ae339497d 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java @@ -28,6 +28,7 @@ import org.eclipse.ui.IWorkbenchPart; import eu.etaxonomy.cdm.model.description.IDescribable; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; @@ -44,7 +45,7 @@ import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart; */ public class MediaViewPart extends AbstractCdmEditorViewPart implements IPartContentHasDetails, IPartContentHasSupplementalData { - public static final String ID = "eu.etaxonomy.taxeditor.editor.view.media"; + public static final String ID = "eu.etaxonomy.taxeditor.editor.view.media"; //$NON-NLS-1$ private TreeViewer viewer; @@ -153,6 +154,6 @@ public class MediaViewPart extends AbstractCdmEditorViewPart implements IPartCon @Override protected String getViewName() { - return "Media"; + return Messages.MediaViewPart_MEDIA; } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddExistingMediaHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddExistingMediaHandler.java index 097849cf0..4367e2577 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddExistingMediaHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddExistingMediaHandler.java @@ -34,7 +34,7 @@ public class AddExistingMediaHandler extends CreateMediaHandler { AbstractUtility.executeOperation(operation); } } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddImageGalleryHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddImageGalleryHandler.java index 4a2696a50..5f7a22a13 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddImageGalleryHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddImageGalleryHandler.java @@ -59,7 +59,7 @@ public class AddImageGalleryHandler extends AbstractHandler { } } } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/CreateMediaHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/CreateMediaHandler.java index 0bd72b3f1..5acff5c53 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/CreateMediaHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/CreateMediaHandler.java @@ -83,7 +83,7 @@ public class CreateMediaHandler extends AbstractHandler { EditorUtil.getUndoContext(), description, postOperationEnabled); AbstractUtility.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/DeleteMediaHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/DeleteMediaHandler.java index cfb1c3afc..004301665 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/DeleteMediaHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/DeleteMediaHandler.java @@ -23,9 +23,10 @@ import eu.etaxonomy.cdm.model.media.ImageFile; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; -import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog; +import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog; /** *

DeleteMediaHandler class.

@@ -71,7 +72,7 @@ public class DeleteMediaHandler extends AbstractHandler { MediaDeletionConfigurator config = new MediaDeletionConfigurator(); DeleteConfiguratorDialog dialog; - dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the media?", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0); + dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), Messages.DeleteMediaHandler_CONFIRM, null, Messages.DeleteMediaHandler_CONFIRM_MESSAGE, MessageDialog.WARNING, new String[] { Messages.DeleteMediaHandler_DELETE, Messages.DeleteMediaHandler_SKIP }, 0); int result_dialog= dialog.open(); if (result_dialog != Status.OK){ return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageDownInListHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageDownInListHandler.java index d822f9a94..a473d8deb 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageDownInListHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageDownInListHandler.java @@ -75,7 +75,7 @@ public class MoveImageDownInListHandler extends AbstractHandler { EditorUtil.getUndoContext(), taxon, description, media, MoveMediaInListOperation.DOWN, postOperationEnabled); EditorUtil.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageUpInListHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageUpInListHandler.java index 6fbd6be1d..ea525d205 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageUpInListHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageUpInListHandler.java @@ -74,7 +74,7 @@ public class MoveImageUpInListHandler extends AbstractHandler { EditorUtil.getUndoContext(), taxon, element, media, MoveMediaInListOperation.UP, postOperationEnabled); EditorUtil.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set."); + MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$ } } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/MoveMediaInListOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/MoveMediaInListOperation.java index 1b02b432c..d2dffa56d 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/MoveMediaInListOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/MoveMediaInListOperation.java @@ -23,6 +23,7 @@ import eu.etaxonomy.cdm.model.description.DescriptionBase; import eu.etaxonomy.cdm.model.description.DescriptionElementBase; import eu.etaxonomy.cdm.model.media.Media; import eu.etaxonomy.cdm.model.taxon.Taxon; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; @@ -107,7 +108,7 @@ public class MoveMediaInListOperation extends AbstractPostTaxonOperation { Set elements = description.getElements(); if(elements.size() != 1){ - MessagingUtils.error(this.getClass(), "More than one description element in this image gallery", null); + MessagingUtils.error(this.getClass(), Messages.MoveMediaInListOperation_MORE_DESC, null); } DescriptionElementBase element = elements.iterator().next(); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesLabelProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesLabelProvider.java index 795faa16e..d0d1ccb85 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesLabelProvider.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesLabelProvider.java @@ -1,8 +1,8 @@ /** * Copyright (C) 2011 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. */ @@ -22,30 +22,36 @@ import eu.etaxonomy.cdm.model.description.CategoricalData; import eu.etaxonomy.cdm.model.description.DescriptionBase; import eu.etaxonomy.cdm.model.description.StateData; import eu.etaxonomy.cdm.model.description.TextData; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.store.UsageTermCollection; /** * UsesLabelProvider Class - * @author a.theys + * @author a.theys * @created mar 13, 2012 * @version 1.0 */ public class UsesLabelProvider extends ColumnLabelProvider implements IStyledLabelProvider { - - /** {@inheritDoc} */ - public String getText(Object element) { - String text = ""; + + private static final String USE = Messages.UsesLabelProvider_USE; + private static final String NO_DATA_PROVIDED = Messages.UsesLabelProvider_NO_DATA; + private static final String SEMICOLON = ";"; //$NON-NLS-1$ + + /** {@inheritDoc} */ + @Override + public String getText(Object element) { + String text = ""; //$NON-NLS-1$ if (element instanceof DescriptionBase) { text = ((DescriptionBase) element).getTitleCache(); if (text == null || text.length() == 0) { - text = "Use: No label provided"; + text = USE+Messages.UsesLabelProvider_NO_LABEL; } else { - text = "Use: " + text; + text = USE + text; } } else if (element instanceof CategoricalData) { @@ -53,104 +59,104 @@ public class UsesLabelProvider extends ColumnLabelProvider implements boolean isUseCategoryAbsent = true; for (StateData statedata : ((CategoricalData) element).getStateData()) { if(statedata.getState() != null && statedata.getModifyingText().get(CdmStore.getDefaultLanguage()) !=null && statedata.getModifyingText().get(CdmStore.getDefaultLanguage()).getText().equals(UsageTermCollection.useCategoryVocabularyLabel)) { - text = text + statedata.getState().getTitleCache() + ";"; + text = text + statedata.getState().getTitleCache() + SEMICOLON; isUseCategoryAbsent = false; } } if(isUseCategoryAbsent) { - text = text + UsageTermCollection.notAvailableLabel + ";"; + text = text + UsageTermCollection.notAvailableLabel + SEMICOLON; } - + boolean isUseSubCategoryAbsent = true; for (StateData statedata : ((CategoricalData) element).getStateData()) { if(statedata.getState() != null && statedata.getModifyingText().get(CdmStore.getDefaultLanguage()) !=null && statedata.getModifyingText().get(CdmStore.getDefaultLanguage()).getText().equals(UsageTermCollection.useSubCategoryVocabularyLabel)) { - text = text + statedata.getState().getTitleCache() + ";"; + text = text + statedata.getState().getTitleCache() + SEMICOLON; isUseSubCategoryAbsent = false; } } if(isUseSubCategoryAbsent) { - text = text + UsageTermCollection.notAvailableLabel + ";"; + text = text + UsageTermCollection.notAvailableLabel + SEMICOLON; } } else { - text = text + UsageTermCollection.notAvailableLabel + ";" + UsageTermCollection.notAvailableLabel + ";"; + text = text + UsageTermCollection.notAvailableLabel + SEMICOLON + UsageTermCollection.notAvailableLabel + SEMICOLON; } if (!((CategoricalData) element).getModifiers().isEmpty()) { for (DefinedTerm modifier: ((CategoricalData) element).getModifiers()){ modifier.getPartOf(); modifier.getVocabulary(); } - + boolean isPlantPartAbsent = true; for (DefinedTerm modifier: ((CategoricalData) element).getModifiers()){ if(GetVocabularyType(modifier, UsageTermCollection.plantPartLabel)) { - text = text + modifier.getTitleCache()+ ";"; + text = text + modifier.getTitleCache()+ SEMICOLON; isPlantPartAbsent = false; } - + } if (isPlantPartAbsent) { - text = text + UsageTermCollection.notAvailableLabel + ";"; + text = text + UsageTermCollection.notAvailableLabel + SEMICOLON; } - + boolean isHumanGroupAbsent = true; for (DefinedTerm modifier: ((CategoricalData) element).getModifiers()){ if(GetVocabularyType(modifier, UsageTermCollection.humanGroupLabel)) { - text = text + modifier.getTitleCache()+ ";"; + text = text + modifier.getTitleCache()+ SEMICOLON; isHumanGroupAbsent = false; } } if (isHumanGroupAbsent) { - text = text + UsageTermCollection.notAvailableLabel + ";"; + text = text + UsageTermCollection.notAvailableLabel + SEMICOLON; } - + boolean isEthnicGroupAbsent = true; for (DefinedTerm modifier: ((CategoricalData) element).getModifiers()){ if(GetVocabularyType(modifier, UsageTermCollection.ethnicGroupLabel)) { - text = text + modifier.getTitleCache()+ ";"; + text = text + modifier.getTitleCache()+ SEMICOLON; isEthnicGroupAbsent = false; } } if (isEthnicGroupAbsent) { - text = text + UsageTermCollection.notAvailableLabel + ";"; + text = text + UsageTermCollection.notAvailableLabel + SEMICOLON; } - + boolean isCountryAbsent = true; for (DefinedTerm modifier: ((CategoricalData) element).getModifiers()){ if(GetVocabularyType(modifier, UsageTermCollection.countryLabel)) { - text = text + modifier.getTitleCache()+ ";"; + text = text + modifier.getTitleCache()+ SEMICOLON; isCountryAbsent = false; } } if (isCountryAbsent) { - text = text + UsageTermCollection.notAvailableLabel + ";"; + text = text + UsageTermCollection.notAvailableLabel + SEMICOLON; } } else { - text = text + UsageTermCollection.notAvailableLabel + ";" + UsageTermCollection.notAvailableLabel + ";" + UsageTermCollection.notAvailableLabel + ";" + UsageTermCollection.notAvailableLabel + ";"; + text = text + UsageTermCollection.notAvailableLabel + SEMICOLON + UsageTermCollection.notAvailableLabel + SEMICOLON + UsageTermCollection.notAvailableLabel + SEMICOLON + UsageTermCollection.notAvailableLabel + SEMICOLON; } - + if (text == null || text.length() == 0) { - text = "No data provided"; + text = NO_DATA_PROVIDED; } else { - String[] textElements = text.split(";"); - String dataportalString = textElements[0] + ";" + textElements[1] + ";" + textElements[5] + ";" + textElements[2] + ";" + textElements[3] + ";" + textElements[4] + ";" ; - + String[] textElements = text.split(SEMICOLON); + String dataportalString = textElements[0] + SEMICOLON + textElements[1] + SEMICOLON + textElements[5] + SEMICOLON + textElements[2] + SEMICOLON + textElements[3] + SEMICOLON + textElements[4] + SEMICOLON ; + ((CategoricalData)element).putModifyingText(CdmStore.getDefaultLanguage(), dataportalString); } return text; } - + else if (element instanceof TextData) { List languages = Arrays.asList(new Language[]{CdmStore.getDefaultLanguage()}); LanguageString languageString = ((TextData) element).getPreferredLanguageString(languages); text = languageString != null ? languageString.getText() : null; if (text == null || text.length() == 0) { - text = "No data provided"; + text = NO_DATA_PROVIDED; } } - + else if (element instanceof FeatureNodeContainer){ text = ((FeatureNodeContainer)element).getFeature().getTitleCache(); } @@ -158,8 +164,8 @@ public class UsesLabelProvider extends ColumnLabelProvider implements return text; } - /** Function dertmining which vocabulary is the term part of - * + /** Function dertmining which vocabulary is the term part of + * * @param term * @param vocabularyExpected * @return @@ -176,14 +182,14 @@ public class UsesLabelProvider extends ColumnLabelProvider implements } return false; } - + /** {@inheritDoc} */ @Override public StyledString getStyledText(Object element) { return new StyledString(this.getText(element), StyledString.QUALIFIER_STYLER); } - - + + } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesViewPart.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesViewPart.java index 481a39e8b..2e816f3de 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesViewPart.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesViewPart.java @@ -15,7 +15,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Tree; import eu.etaxonomy.cdm.model.common.CdmBase; -import eu.etaxonomy.taxeditor.editor.Messages; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDragListener; import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDropAdapter; import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementTransfer; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateTaxonUseOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateTaxonUseOperation.java index b32d73f22..2fd449954 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateTaxonUseOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateTaxonUseOperation.java @@ -26,7 +26,6 @@ import eu.etaxonomy.taxeditor.store.UseObjectStore; * CreateTaxonUseOperation Class * @author a.theys * @created mar 13, 2012 - * @version 1.0 */ public class CreateTaxonUseOperation extends CreateTaxonDescriptionOperation { private TaxonDescription description; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateUseRecordOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateUseRecordOperation.java index 28b7b2011..270eec97c 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateUseRecordOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateUseRecordOperation.java @@ -34,7 +34,7 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; public class CreateUseRecordOperation extends AbstractPostOperation { /** Constant ID="eu.etaxonomy.taxeditor.editor.view.use."{trunked} */ - public static final String ID = "eu.etaxonomy.taxeditor.editor.use.createUseRecord"; + public static final String ID = "eu.etaxonomy.taxeditor.editor.use.createUseRecord"; //$NON-NLS-1$ private final DescriptionBase description; private final Feature feature; private DescriptionElementBase element; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateUseSummaryOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateUseSummaryOperation.java index 80c85db61..ac2d6e9d9 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateUseSummaryOperation.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateUseSummaryOperation.java @@ -32,7 +32,7 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; */ public class CreateUseSummaryOperation extends AbstractPostOperation { - public static final String ID = "eu.etaxonomy.taxeditor.editor.use.createUseRecord"; + public static final String ID = "eu.etaxonomy.taxeditor.editor.use.createUseRecord"; //$NON-NLS-1$ private final DescriptionBase description; private final Feature feature; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/EntityClassMarkerField.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/EntityClassMarkerField.java index 6a13ceb77..07449a2e8 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/EntityClassMarkerField.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/EntityClassMarkerField.java @@ -13,10 +13,10 @@ public class EntityClassMarkerField extends MarkerField { { try { Object value = item.getMarker().getAttribute(MarkerManager.ATTRIB_ENTITY_CLASS); - return value == null ? "" : value.toString(); + return value == null ? "" : value.toString(); //$NON-NLS-1$ } catch (CoreException e) { - throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_ENTITY_CLASS); + throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_ENTITY_CLASS); //$NON-NLS-1$ } } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/EntityIdMarkerField.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/EntityIdMarkerField.java index 40ec33c62..397b3948d 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/EntityIdMarkerField.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/EntityIdMarkerField.java @@ -13,10 +13,10 @@ public class EntityIdMarkerField extends MarkerField { { try { Object value = item.getMarker().getAttribute(MarkerManager.ATTRIB_ENTITY_ID); - return value == null ? "" : value.toString(); + return value == null ? "" : value.toString(); //$NON-NLS-1$ } catch (CoreException e) { - throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_ENTITY_ID); + throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_ENTITY_ID); //$NON-NLS-1$ } } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/InvalidValueMarkerField.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/InvalidValueMarkerField.java index b82324fe6..1d4f591c1 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/InvalidValueMarkerField.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/InvalidValueMarkerField.java @@ -13,10 +13,10 @@ public class InvalidValueMarkerField extends MarkerField { { try { Object value = item.getMarker().getAttribute(MarkerManager.ATTRIB_INVALID_VALUE); - return value == null ? "" : value.toString(); + return value == null ? "" : value.toString(); //$NON-NLS-1$ } catch (CoreException e) { - throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_INVALID_VALUE); + throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_INVALID_VALUE); //$NON-NLS-1$ } } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/UserFriendlyDescriptionMarkerField.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/UserFriendlyDescriptionMarkerField.java index 0744a0665..649c66040 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/UserFriendlyDescriptionMarkerField.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/UserFriendlyDescriptionMarkerField.java @@ -13,10 +13,10 @@ public class UserFriendlyDescriptionMarkerField extends MarkerField { { try { Object value = item.getMarker().getAttribute(MarkerManager.ATTRIB_USER_FRIENDLY_DESCRIPTION); - return value == null ? "" : value.toString(); + return value == null ? "" : value.toString(); //$NON-NLS-1$ } catch (CoreException e) { - throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_USER_FRIENDLY_DESCRIPTION); + throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_USER_FRIENDLY_DESCRIPTION); //$NON-NLS-1$ } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/UserFriendlyFieldNameMarkerField.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/UserFriendlyFieldNameMarkerField.java index 97d3db524..7d25c861b 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/UserFriendlyFieldNameMarkerField.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/UserFriendlyFieldNameMarkerField.java @@ -13,10 +13,10 @@ public class UserFriendlyFieldNameMarkerField extends MarkerField { { try { Object value = item.getMarker().getAttribute(MarkerManager.ATTRIB_USER_FRIENDLY_FIELD_NAME); - return value == null ? "" : value.toString(); + return value == null ? "" : value.toString(); //$NON-NLS-1$ } catch (CoreException e) { - throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_USER_FRIENDLY_FIELD_NAME); + throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_USER_FRIENDLY_FIELD_NAME); //$NON-NLS-1$ } } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/UserFriendlyTypeNameMarkerField.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/UserFriendlyTypeNameMarkerField.java index 38419dccb..66b664d91 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/UserFriendlyTypeNameMarkerField.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/UserFriendlyTypeNameMarkerField.java @@ -13,10 +13,10 @@ public class UserFriendlyTypeNameMarkerField extends MarkerField { { try { Object value = item.getMarker().getAttribute(MarkerManager.ATTRIB_USER_FRIENDLY_TYPE_NAME); - return value == null ? "" : value.toString(); + return value == null ? "" : value.toString(); //$NON-NLS-1$ } catch (CoreException e) { - throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_USER_FRIENDLY_TYPE_NAME); + throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_USER_FRIENDLY_TYPE_NAME); //$NON-NLS-1$ } } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/ValidationProblemsView.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/ValidationProblemsView.java index d81f97bc5..2ef42daf0 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/ValidationProblemsView.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/ValidationProblemsView.java @@ -6,7 +6,7 @@ public class ValidationProblemsView extends MarkerSupportView { public ValidationProblemsView() { - super("eu.etaxonomy.taxeditor.editor.validation.ValidationProblemsMarkerGenerator"); + super("eu.etaxonomy.taxeditor.editor.validation.ValidationProblemsMarkerGenerator"); //$NON-NLS-1$ } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/ValidatorClassMarkerField.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/ValidatorClassMarkerField.java index 9b8aa1249..fbcf2f169 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/ValidatorClassMarkerField.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/ValidatorClassMarkerField.java @@ -13,10 +13,10 @@ public class ValidatorClassMarkerField extends MarkerField { { try { Object value = item.getMarker().getAttribute(MarkerManager.ATTRIB_VALIDATOR_CLASS); - return value == null ? "" : value.toString(); + return value == null ? "" : value.toString(); //$NON-NLS-1$ } catch (CoreException e) { - throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_VALIDATOR_CLASS); + throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_VALIDATOR_CLASS); //$NON-NLS-1$ } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/ValidatorMessageMarkerField.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/ValidatorMessageMarkerField.java index 970f337c6..da28eb0ed 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/ValidatorMessageMarkerField.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/validation/ValidatorMessageMarkerField.java @@ -13,10 +13,10 @@ public class ValidatorMessageMarkerField extends MarkerField { { try { Object value = item.getMarker().getAttribute(MarkerManager.ATTRIB_VALIDATOR_MESSAGE); - return value == null ? "" : value.toString(); + return value == null ? "" : value.toString(); //$NON-NLS-1$ } catch (CoreException e) { - throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_VALIDATOR_MESSAGE); + throw new RuntimeException("Error while retrieving value for " + MarkerManager.ATTRIB_VALIDATOR_MESSAGE); //$NON-NLS-1$ } } diff --git a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptToSynonymOperationTest.java b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptToSynonymOperationTest.java index 845801570..54edfc2f5 100644 --- a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptToSynonymOperationTest.java +++ b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptToSynonymOperationTest.java @@ -19,6 +19,8 @@ import org.junit.Test; import eu.etaxonomy.cdm.model.common.ICdmBase; import eu.etaxonomy.cdm.model.name.HomotypicalGroup; import eu.etaxonomy.cdm.model.name.NonViralName; +import eu.etaxonomy.cdm.model.name.TaxonNameBase; +import eu.etaxonomy.cdm.model.name.TaxonNameFactory; import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; @@ -52,7 +54,7 @@ public class ChangeConceptToSynonymOperationTest extends AbstractTaxeditorOperat @BeforeClass public static void setUpBeforeClass() throws Exception { taxon = Taxon.NewInstance(null, null); - concept = Taxon.NewInstance(NonViralName.NewInstance(null), null); + concept = Taxon.NewInstance(TaxonNameFactory.NewNonViralInstance(null), null); homotypicalGroup = HomotypicalGroup.NewInstance(); concept.addTaxonRelation(taxon, TaxonRelationshipType.MISAPPLIED_NAME_FOR(), null, null); diff --git a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeHomotypicGroupOperationTest.java b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeHomotypicGroupOperationTest.java index 60ea9941e..4581d2db3 100644 --- a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeHomotypicGroupOperationTest.java +++ b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeHomotypicGroupOperationTest.java @@ -19,6 +19,8 @@ import org.junit.Test; import eu.etaxonomy.cdm.model.common.ICdmBase; import eu.etaxonomy.cdm.model.name.HomotypicalGroup; import eu.etaxonomy.cdm.model.name.NonViralName; +import eu.etaxonomy.cdm.model.name.TaxonNameBase; +import eu.etaxonomy.cdm.model.name.TaxonNameFactory; import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.taxeditor.editor.name.operation.ChangeHomotypicGroupOperation; @@ -56,7 +58,7 @@ public class ChangeHomotypicGroupOperationTest extends AbstractTaxeditorOperatio public static void setUpBeforeClass() throws Exception { taxon = Taxon.NewInstance(null, null); - synonym = Synonym.NewInstance(NonViralName.NewInstance(null), null); + synonym = Synonym.NewInstance(TaxonNameFactory.NewNonViralInstance(null), null); oldHomotypicalGroup = HomotypicalGroup.NewInstance(); oldHomotypicalGroup.addTypifiedName(synonym.getName()); diff --git a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToConceptOperationTest.java b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToConceptOperationTest.java index f8b44e7a9..73bfe8bbe 100644 --- a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToConceptOperationTest.java +++ b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToConceptOperationTest.java @@ -17,6 +17,8 @@ import org.junit.Test; import eu.etaxonomy.cdm.model.common.ICdmBase; import eu.etaxonomy.cdm.model.name.NonViralName; +import eu.etaxonomy.cdm.model.name.TaxonNameBase; +import eu.etaxonomy.cdm.model.name.TaxonNameFactory; import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.SynonymType; import eu.etaxonomy.cdm.model.taxon.Taxon; @@ -46,7 +48,7 @@ public class ChangeSynonymToConceptOperationTest extends AbstractTaxeditorOperat public static void setUpBeforeClass() throws Exception { taxon = Taxon.NewInstance(null, null); - synonym = Synonym.NewInstance(NonViralName.NewInstance(null), null); + synonym = Synonym.NewInstance(TaxonNameFactory.NewNonViralInstance(null), null); taxonRelationshipType = TaxonRelationshipType.CONTRADICTION(); taxon.addSynonym(synonym, SynonymType.SYNONYM_OF()); diff --git a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToMisapplicationOperationTest.java b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToMisapplicationOperationTest.java index bfa101d00..915307daa 100644 --- a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToMisapplicationOperationTest.java +++ b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToMisapplicationOperationTest.java @@ -17,6 +17,8 @@ import org.junit.Test; import eu.etaxonomy.cdm.model.common.ICdmBase; import eu.etaxonomy.cdm.model.name.NonViralName; +import eu.etaxonomy.cdm.model.name.TaxonNameBase; +import eu.etaxonomy.cdm.model.name.TaxonNameFactory; import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.SynonymType; import eu.etaxonomy.cdm.model.taxon.Taxon; @@ -46,7 +48,7 @@ public class ChangeSynonymToMisapplicationOperationTest extends AbstractTaxedito @BeforeClass public static void setUpBeforeClass() throws Exception { taxon = Taxon.NewInstance(null, null); - synonym = Synonym.NewInstance(NonViralName.NewInstance(null), null); + synonym = Synonym.NewInstance(TaxonNameFactory.NewNonViralInstance(null), null); synonymType = SynonymType.SYNONYM_OF(); taxon.addSynonym(synonym, synonymType); diff --git a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInExisitingHomotypicalGroupOperationTest.java b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInExisitingHomotypicalGroupOperationTest.java index 1af244e85..1ee35a3af 100644 --- a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInExisitingHomotypicalGroupOperationTest.java +++ b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInExisitingHomotypicalGroupOperationTest.java @@ -16,6 +16,8 @@ import org.junit.Test; import eu.etaxonomy.cdm.model.name.HomotypicalGroup; import eu.etaxonomy.cdm.model.name.NonViralName; +import eu.etaxonomy.cdm.model.name.TaxonNameBase; +import eu.etaxonomy.cdm.model.name.TaxonNameFactory; import eu.etaxonomy.cdm.model.taxon.SynonymType; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase; @@ -39,11 +41,11 @@ public class CreateSynonymInExisitingHomotypicalGroupOperationTest extends Abstr @Before public void setUp() throws Exception { - taxonName = NonViralName.NewInstance(null); + taxonName = TaxonNameFactory.NewNonViralInstance(null); taxon = Taxon.NewInstance(taxonName, null); homotypicalGroup = HomotypicalGroup.NewInstance(); - newSynonymName = NonViralName.NewInstance(null); + newSynonymName = TaxonNameFactory.NewNonViralInstance(null); operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group", undoContext, taxon, homotypicalGroup, newSynonymName, postOperation); diff --git a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInNewGroupOperationTest.java b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInNewGroupOperationTest.java index 023fe9dbc..f08f60535 100644 --- a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInNewGroupOperationTest.java +++ b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInNewGroupOperationTest.java @@ -16,6 +16,7 @@ import org.junit.Test; import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.cdm.model.name.TaxonNameBase; +import eu.etaxonomy.cdm.model.name.TaxonNameFactory; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInNewGroupOperation; import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase; @@ -36,7 +37,7 @@ public class CreateSynonymInNewGroupOperationTest extends AbstractTaxeditorOpera public static void setUpBeforeClass() throws Exception { taxon = Taxon.NewInstance(null, null); - newSynonymName = NonViralName.NewInstance(null); + newSynonymName = TaxonNameFactory.NewNonViralInstance(null); operation = new CreateSynonymInNewGroupOperation("Create Synonyma In New Group", undoContext, taxon, newSynonymName, postOperation); } diff --git a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperationTest.java b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperationTest.java index 1a39274dc..4f57c79b5 100644 --- a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperationTest.java +++ b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperationTest.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -17,7 +17,6 @@ import org.junit.Test; import eu.etaxonomy.cdm.model.common.ICdmBase; import eu.etaxonomy.cdm.model.taxon.Taxon; -import eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation; import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase; /** @@ -32,51 +31,52 @@ public class DeleteMisapplicationOperationTest extends AbstractTaxeditorOperatio private static Taxon taxon; private static Taxon misapplication; - + /** * @throws java.lang.Exception */ @BeforeClass public static void setUpBeforeClass() throws Exception { - + taxon = Taxon.NewInstance(null, null); misapplication = Taxon.NewInstance(null, null); - + taxon.addMisappliedName(misapplication, null, null); - - operation = new DeleteMisapplicationOperation("", undoContext, taxon, misapplication, postOperation); + + operation = new DeleteMisapplicationOperation("", undoContext, null, null, taxon, misapplication, postOperation, null, null); + } /** * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}. - * @throws ExecutionException + * @throws ExecutionException */ @Test public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException { operation.execute(monitor, info); - + Assert.assertTrue(taxon.getMisappliedNames().size() == 0); } /** * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}. - * @throws ExecutionException + * @throws ExecutionException */ @Test public void testUndoIProgressMonitorIAdaptable() throws ExecutionException { operation.undo(monitor, info); - + Assert.assertEquals(misapplication, taxon.getMisappliedNames().toArray(new Taxon[0])[0]); } /** * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}. - * @throws ExecutionException + * @throws ExecutionException */ @Test public void testRedoIProgressMonitorIAdaptable() throws ExecutionException { operation.redo(monitor, info); - + Assert.assertTrue(taxon.getMisappliedNames().size() == 0); } diff --git a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/SwapSynonymAndAcceptedOperationTest.java b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/SwapSynonymAndAcceptedOperationTest.java index 36a858115..848fcf555 100644 --- a/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/SwapSynonymAndAcceptedOperationTest.java +++ b/eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/SwapSynonymAndAcceptedOperationTest.java @@ -20,6 +20,8 @@ import eu.etaxonomy.cdm.model.common.ICdmBase; import eu.etaxonomy.cdm.model.description.TaxonDescription; import eu.etaxonomy.cdm.model.name.HomotypicalGroup; import eu.etaxonomy.cdm.model.name.NonViralName; +import eu.etaxonomy.cdm.model.name.TaxonNameBase; +import eu.etaxonomy.cdm.model.name.TaxonNameFactory; import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.SynonymType; import eu.etaxonomy.cdm.model.taxon.Taxon; @@ -71,26 +73,26 @@ public class SwapSynonymAndAcceptedOperationTest extends AbstractTaxeditorOperat (new DefaultTermInitializer()).initialize(); // Create the original accepted taxon - oldTaxonName = NonViralName.NewInstance(null); + oldTaxonName = TaxonNameFactory.NewNonViralInstance(null); taxon = Taxon.NewInstance(oldTaxonName, null); // // Create its parent taxon -// parentTaxon = Taxon.NewInstance(NonViralName.NewInstance(null), null); +// parentTaxon = Taxon.NewInstance(TaxonNameBase.NewNonViralInstance(null), null); // parentTaxon.addTaxonomicChild(taxon, null, null); // // // Give it a child taxon -// childTaxon = Taxon.NewInstance(NonViralName.NewInstance(null), null); +// childTaxon = Taxon.NewInstance(TaxonNameBase.NewNonViralInstance(null), null); // childTaxon.setTaxonomicParent(taxon, null, null); // Create a homotypic synonym for the accepted taxon - taxon.addHomotypicSynonymName(NonViralName.NewInstance(null)); -// homotypicSynonym = Synonym.NewInstance(NonViralName.NewInstance(null), null); + taxon.addHomotypicSynonymName(TaxonNameFactory.NewNonViralInstance(null)); +// homotypicSynonym = Synonym.NewInstance(TaxonNameBase.NewNonViralInstance(null), null); // HomotypicalGroup acceptedHomotypicalGroup = HomotypicalGroup.NewInstance(); // acceptedHomotypicalGroup.addTypifiedName(oldTaxon.getName()); // acceptedHomotypicalGroup.addTypifiedName(homotypicSynonym.getName()); // Create a heterotypic synonym that will be used to create the new accepted taxon - oldSynonymName = NonViralName.NewInstance(null); + oldSynonymName = TaxonNameFactory.NewNonViralInstance(null); oldHeterotypicSynonym = Synonym.NewInstance(oldSynonymName, null); // oldTaxon.addS .addHeterotypicSynonym(oldHeterotypicSynonym, null, null); heteroypicalGroup = HomotypicalGroup.NewInstance(); @@ -98,11 +100,11 @@ public class SwapSynonymAndAcceptedOperationTest extends AbstractTaxeditorOperat taxon.addSynonym(oldHeterotypicSynonym, SynonymType.HETEROTYPIC_SYNONYM_OF()); // Create a misapplication - misapplication = Taxon.NewInstance(NonViralName.NewInstance(null), null); + misapplication = Taxon.NewInstance(TaxonNameFactory.NewNonViralInstance(null), null); taxon.addMisappliedName(misapplication, null, null); // Create a concept relation - concept = Taxon.NewInstance(NonViralName.NewInstance(null), null); + concept = Taxon.NewInstance(TaxonNameFactory.NewNonViralInstance(null), null); conceptRelationshipType = TaxonRelationshipType.CONGRUENT_TO(); concept.addTaxonRelation(taxon, conceptRelationshipType, null, null); diff --git a/eu.etaxonomy.taxeditor.feature.jre.linux64/feature.xml b/eu.etaxonomy.taxeditor.feature.jre.linux64/feature.xml index b48681dec..8059f630d 100644 --- a/eu.etaxonomy.taxeditor.feature.jre.linux64/feature.xml +++ b/eu.etaxonomy.taxeditor.feature.jre.linux64/feature.xml @@ -2,7 +2,7 @@ eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 4.0.0 eu.etaxonomy.taxeditor.feature.jre.linux64 diff --git a/eu.etaxonomy.taxeditor.feature.platform/feature.xml b/eu.etaxonomy.taxeditor.feature.platform/feature.xml index 1b9421d4e..d5d7dce92 100644 --- a/eu.etaxonomy.taxeditor.feature.platform/feature.xml +++ b/eu.etaxonomy.taxeditor.feature.platform/feature.xml @@ -2,7 +2,7 @@ @@ -1031,4 +1031,53 @@ version="0.0.0" unpack="false"/> + + + + + + + + + + + + + + diff --git a/eu.etaxonomy.taxeditor.feature.platform/pom.xml b/eu.etaxonomy.taxeditor.feature.platform/pom.xml index 3fffe0c28..d9f812cab 100644 --- a/eu.etaxonomy.taxeditor.feature.platform/pom.xml +++ b/eu.etaxonomy.taxeditor.feature.platform/pom.xml @@ -3,7 +3,7 @@ eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 4.0.0 eu.etaxonomy.taxeditor.feature.platform diff --git a/eu.etaxonomy.taxeditor.feature/feature.xml b/eu.etaxonomy.taxeditor.feature/feature.xml index df074a58d..869a2b658 100644 --- a/eu.etaxonomy.taxeditor.feature/feature.xml +++ b/eu.etaxonomy.taxeditor.feature/feature.xml @@ -2,7 +2,7 @@ eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 4.0.0 eu.etaxonomy.taxeditor.feature diff --git a/eu.etaxonomy.taxeditor.help/.classpath b/eu.etaxonomy.taxeditor.help/.classpath index bcb633e0f..4e8976338 100644 --- a/eu.etaxonomy.taxeditor.help/.classpath +++ b/eu.etaxonomy.taxeditor.help/.classpath @@ -1,6 +1,6 @@ - + diff --git a/eu.etaxonomy.taxeditor.help/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.help/META-INF/MANIFEST.MF index a6c3addba..8b7ba11ab 100644 --- a/eu.etaxonomy.taxeditor.help/META-INF/MANIFEST.MF +++ b/eu.etaxonomy.taxeditor.help/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Help Bundle-SymbolicName: eu.etaxonomy.taxeditor.help; singleton:=true -Bundle-Version: 4.5.1 +Bundle-Version: 4.6.0 Bundle-Activator: eu.etaxonomy.taxeditor.help.Activator Bundle-Vendor: EDIT Require-Bundle: org.eclipse.ui, diff --git a/eu.etaxonomy.taxeditor.help/pom.xml b/eu.etaxonomy.taxeditor.help/pom.xml index ead08fddf..41625f5b9 100644 --- a/eu.etaxonomy.taxeditor.help/pom.xml +++ b/eu.etaxonomy.taxeditor.help/pom.xml @@ -3,7 +3,7 @@ eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 4.0.0 diff --git a/eu.etaxonomy.taxeditor.molecular.lib/.classpath b/eu.etaxonomy.taxeditor.molecular.lib/.classpath index 3e296041c..537699369 100644 --- a/eu.etaxonomy.taxeditor.molecular.lib/.classpath +++ b/eu.etaxonomy.taxeditor.molecular.lib/.classpath @@ -1,6 +1,6 @@ - + diff --git a/eu.etaxonomy.taxeditor.molecular.lib/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.molecular.lib/META-INF/MANIFEST.MF index 57bab9195..301288fcd 100644 --- a/eu.etaxonomy.taxeditor.molecular.lib/META-INF/MANIFEST.MF +++ b/eu.etaxonomy.taxeditor.molecular.lib/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: eu.etaxonomy.taxeditor.molecular.lib Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular.lib;singleton:=true -Bundle-Version: 4.5.1 +Bundle-Version: 4.6.0 Bundle-ClassPath: ., lib/owlapi-xmlutils-4.1.4.jar, lib/commons-collections4-4.1.jar, diff --git a/eu.etaxonomy.taxeditor.molecular.lib/pom.xml b/eu.etaxonomy.taxeditor.molecular.lib/pom.xml index 55d10338a..6760040a0 100644 --- a/eu.etaxonomy.taxeditor.molecular.lib/pom.xml +++ b/eu.etaxonomy.taxeditor.molecular.lib/pom.xml @@ -7,7 +7,7 @@ eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 diff --git a/eu.etaxonomy.taxeditor.molecular/.classpath b/eu.etaxonomy.taxeditor.molecular/.classpath index 6bca977be..a9750fff5 100644 --- a/eu.etaxonomy.taxeditor.molecular/.classpath +++ b/eu.etaxonomy.taxeditor.molecular/.classpath @@ -1,6 +1,6 @@ - + diff --git a/eu.etaxonomy.taxeditor.molecular/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.molecular/META-INF/MANIFEST.MF index d9123c23d..e1ba5e737 100644 --- a/eu.etaxonomy.taxeditor.molecular/META-INF/MANIFEST.MF +++ b/eu.etaxonomy.taxeditor.molecular/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Molecular Bundle Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular;singleton:=true -Bundle-Version: 4.5.1 +Bundle-Version: 4.6.0 Bundle-Activator: eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, diff --git a/eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/messages.properties b/eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/messages.properties deleted file mode 100644 index 607567da1..000000000 --- a/eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/messages.properties +++ /dev/null @@ -1,28 +0,0 @@ -exportSequenceToFileHandlerIOErrorMessage=An error occurred when trying to export a consensus sequence alignment to the file "%s". -exportSequenceToFileHandlerIOErrorTitle=I/O error -exportSequenceToFileHandlerOverwriteTitle=Overwrite file -exportSequenceToFileHandlerOverwriteText=The file \"%s\" already exists.\n\nDo you want to overwrite it? -wizardExportAlignmentAppendExtensionButton=Append default extension -wizardExportAlignmentBrowseButton=Browse... -wizardExportAlignmentDataLabel=Select the data to export: -wizardExportAlignmentDescription=Define the output file and format. -wizardExportAlignmentDestinationLabel=Select the export destination: -wizardExportAlignmentErrorMissingFileName=The file name must not be empty. -wizardExportAlignmentErrorMissingSeqLabel=The consensus sequence label must not be empty. -wizardExportAlignmentErrorNothingToExport=Either single reads or the consensus sequence have to be selected for export. -wizardExportAlignmentExportConsensusSeqLabel=Export consensus sequence -wizardExportAlignmentExportFormatLabel=Select the export format: -wizardExportAlignmentExportSingleReads=Export single reads -wizardExportAlignmentFileDialogTitle=Export to -wizardExportAlignmentFileLabel=Alignment file: -wizardExportAlignmentTitle=Sequence export -wizardExportAlignmentWarningFileNameStartsDot=File starting with '.' are not supported on all operating systems. -wizardExportAlignmentwarningMissingExtension=The file name does have a valid extension for the selected format. -wizardExportAlignmentWarningFileExists=The file already exists and will be overwritten. -wizardExportAlignmentOptionsDescription=Specify additional export parameters. -wizardExportAlignmentOptionsTitle=Export options -wizardExportAlignmentExportedSeqHeading=Specify the sequences to be exported: -wizardExportAlignmentAdditionalOptionsHeading=Specify additional export options: -wizardExportAlignmentElongateSeqHeading=Elongate sequences to have equal length with: -wizardExportAlignmentElongateSeqMissingData=Missing data ('?')" -wizardExportAlignmentElongateSeqGap=Gap ('-') diff --git a/eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/messages_de.properties b/eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/messages_de.properties deleted file mode 100644 index 5eab68603..000000000 --- a/eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/messages_de.properties +++ /dev/null @@ -1,28 +0,0 @@ -exportSequenceToFileHandlerIOErrorMessage=Beim Schreiben der Datei "%s" ist ein Fehler aufgetreten. -exportSequenceToFileHandlerIOErrorTitle=E/A Fehler -exportSequenceToFileHandlerOverwriteTitle=Datei überschreiben -exportSequenceToFileHandlerOverwriteText=Die Datei \"%s\" existiert bereits.\n\nSoll sie überschrieben werden? -wizardExportAlignmentAppendExtensionButton=Standarddateiendung anhängen -wizardExportAlignmentBrowseButton=Durchsuchen... -wizardExportAlignmentDataLabel=Zu exportierende Daten: -wizardExportAlignmentDescription=Wählen Sie den Zielort und das Zielformat aus! -wizardExportAlignmentDestinationLabel=Zieldatei: -wizardExportAlignmentErrorMissingFileName=Der Dateiname darf nicht leer sein. -wizardExportAlignmentErrorMissingSeqLabel=Der Name der Konsensussequenz darf nicht leer sein. -wizardExportAlignmentErrorNothingToExport=Es müssen entweder die einzelnen Reads oder die Konsensussequenz zum Export ausgewählt werden. -wizardExportAlignmentExportConsensusSeqLabel=Konsensussequenz exportieren -wizardExportAlignmentExportFormatLabel=Zielformat: -wizardExportAlignmentExportSingleReads=Einzelne Reads exportieren -wizardExportAlignmentFileDialogTitle=Exportieren nach -wizardExportAlignmentFileLabel=Alignment Datei: -wizardExportAlignmentTitle=Sequenzexport -wizardExportAlignmentWarningFileNameStartsDot=Dateinamen, die mit einem '.' beginnen, werden nicht auf allen Betriebssystemen unterstützt. -wizardExportAlignmentwarningMissingExtension=Der momentane Dateiname hat keine zum aktuellen Format passende Endung. -wizardExportAlignmentWarningFileExists=The existiert bereits und würde überschrieben. -wizardExportAlignmentOptionsDescription=Geben Sie weitere Exportparameter an! -wizardExportAlignmentOptionsTitle=Exportoptionen -wizardExportAlignmentExportedSeqHeading=Zu exportierende Sequenzen: -wizardExportAlignmentAdditionalOptionsHeading=Erweiterte Exportoptionen: -wizardExportAlignmentElongateSeqHeading=Sequenzen auf einheitliche Länge bringen mit: -wizardExportAlignmentElongateSeqMissingData=Fehlende Daten ('?')" -wizardExportAlignmentElongateSeqGap=Lücke ('-') diff --git a/eu.etaxonomy.taxeditor.molecular/pom.xml b/eu.etaxonomy.taxeditor.molecular/pom.xml index 24c56950e..b659618ff 100644 --- a/eu.etaxonomy.taxeditor.molecular/pom.xml +++ b/eu.etaxonomy.taxeditor.molecular/pom.xml @@ -3,7 +3,7 @@ eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 4.0.0 diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/Messages.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/Messages.java deleted file mode 100644 index 390748340..000000000 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/Messages.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (C) 2016 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.molecular; - - -import org.eclipse.osgi.util.NLS; - - - -/** - * Provides messages and texts for classes of the molecular plugin. - * - * @author Ben Stöver - * @date 17.11.2016 - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "OSGI-INF/l10n/messages"; //$NON-NLS-1$ - - - public static String exportSequenceToFileHandlerIOErrorMessage; - public static String exportSequenceToFileHandlerIOErrorTitle; - public static String exportSequenceToFileHandlerOverwriteTitle; - public static String exportSequenceToFileHandlerOverwriteText; - - public static String wizardExportAlignmentAppendExtensionButton; - public static String wizardExportAlignmentBrowseButton; - public static String wizardExportAlignmentDataLabel; - public static String wizardExportAlignmentDescription; - public static String wizardExportAlignmentDestinationLabel; - public static String wizardExportAlignmentErrorMissingFileName; - public static String wizardExportAlignmentErrorMissingSeqLabel; - public static String wizardExportAlignmentErrorNothingToExport; - public static String wizardExportAlignmentExportConsensusSeqLabel; - public static String wizardExportAlignmentExportFormatLabel; - public static String wizardExportAlignmentExportSingleReads; - public static String wizardExportAlignmentFileDialogTitle; - public static String wizardExportAlignmentFileLabel; - public static String wizardExportAlignmentOptionsDescription; - public static String wizardExportAlignmentOptionsTitle; - public static String wizardExportAlignmentTitle; - public static String wizardExportAlignmentWarningFileNameStartsDot; - public static String wizardExportAlignmentwarningMissingExtension; - public static String wizardExportAlignmentWarningFileExists; - public static String wizardExportAlignmentExportedSeqHeading; - public static String wizardExportAlignmentAdditionalOptionsHeading; - public static String wizardExportAlignmentElongateSeqHeading; - public static String wizardExportAlignmentElongateSeqMissingData; - public static String wizardExportAlignmentElongateSeqGap; - - - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() {} -} diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java index 41a6b82e1..20c1ae1b2 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java @@ -9,34 +9,6 @@ package eu.etaxonomy.taxeditor.molecular.editor; -import info.bioinfweb.commons.swt.SWTUtils; -import info.bioinfweb.libralign.alignmentarea.AlignmentArea; -import info.bioinfweb.libralign.alignmentarea.selection.SelectionModel; -import info.bioinfweb.libralign.alignmentarea.tokenpainter.NucleotideTokenPainter; -import info.bioinfweb.libralign.dataarea.implementations.ConsensusSequenceArea; -import info.bioinfweb.libralign.dataarea.implementations.pherogram.PherogramArea; -import info.bioinfweb.libralign.dataarea.implementations.sequenceindex.SequenceIndexArea; -import info.bioinfweb.libralign.editsettings.EditSettingsChangeEvent; -import info.bioinfweb.libralign.editsettings.EditSettingsListener; -import info.bioinfweb.libralign.model.AlignmentModel; -import info.bioinfweb.libralign.model.AlignmentModelChangeListener; -import info.bioinfweb.libralign.model.adapters.StringAdapter; -import info.bioinfweb.libralign.model.events.SequenceChangeEvent; -import info.bioinfweb.libralign.model.events.SequenceRenamedEvent; -import info.bioinfweb.libralign.model.events.TokenChangeEvent; -import info.bioinfweb.libralign.model.implementations.PackedAlignmentModel; -import info.bioinfweb.libralign.model.tokenset.CharacterTokenSet; -import info.bioinfweb.libralign.model.tokenset.TokenSet; -import info.bioinfweb.libralign.model.utils.AlignmentModelUtils; -import info.bioinfweb.libralign.multiplealignments.AlignmentAreaList; -import info.bioinfweb.libralign.multiplealignments.MultipleAlignmentsContainer; -import info.bioinfweb.libralign.pherogram.model.PherogramAreaModel; -import info.bioinfweb.libralign.pherogram.model.ShiftChange; -import info.bioinfweb.libralign.pherogram.provider.BioJavaPherogramProvider; -import info.bioinfweb.libralign.pherogram.provider.PherogramProvider; -import info.bioinfweb.libralign.pherogram.provider.ReverseComplementPherogramProvider; -import info.bioinfweb.tic.SWTComponentFactory; - import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -76,8 +48,36 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin; import eu.etaxonomy.taxeditor.molecular.handler.ToggleInsertOverwriteHandler; import eu.etaxonomy.taxeditor.molecular.handler.ToggleLeftRightInsertionHandler; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider; +import info.bioinfweb.commons.swt.SWTUtils; +import info.bioinfweb.libralign.alignmentarea.AlignmentArea; +import info.bioinfweb.libralign.alignmentarea.selection.SelectionModel; +import info.bioinfweb.libralign.alignmentarea.tokenpainter.NucleotideTokenPainter; +import info.bioinfweb.libralign.dataarea.implementations.ConsensusSequenceArea; +import info.bioinfweb.libralign.dataarea.implementations.pherogram.PherogramArea; +import info.bioinfweb.libralign.dataarea.implementations.sequenceindex.SequenceIndexArea; +import info.bioinfweb.libralign.editsettings.EditSettingsChangeEvent; +import info.bioinfweb.libralign.editsettings.EditSettingsListener; +import info.bioinfweb.libralign.model.AlignmentModel; +import info.bioinfweb.libralign.model.AlignmentModelChangeListener; +import info.bioinfweb.libralign.model.adapters.StringAdapter; +import info.bioinfweb.libralign.model.events.SequenceChangeEvent; +import info.bioinfweb.libralign.model.events.SequenceRenamedEvent; +import info.bioinfweb.libralign.model.events.TokenChangeEvent; +import info.bioinfweb.libralign.model.implementations.PackedAlignmentModel; +import info.bioinfweb.libralign.model.tokenset.CharacterTokenSet; +import info.bioinfweb.libralign.model.tokenset.TokenSet; +import info.bioinfweb.libralign.model.utils.AlignmentModelUtils; +import info.bioinfweb.libralign.multiplealignments.AlignmentAreaList; +import info.bioinfweb.libralign.multiplealignments.MultipleAlignmentsContainer; +import info.bioinfweb.libralign.pherogram.model.PherogramAreaModel; +import info.bioinfweb.libralign.pherogram.model.ShiftChange; +import info.bioinfweb.libralign.pherogram.provider.BioJavaPherogramProvider; +import info.bioinfweb.libralign.pherogram.provider.PherogramProvider; +import info.bioinfweb.libralign.pherogram.provider.ReverseComplementPherogramProvider; +import info.bioinfweb.tic.SWTComponentFactory; @@ -92,15 +92,15 @@ import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider; * @date 04.08.2014 */ public class AlignmentEditor extends EditorPart { - public static final String ID = "eu.etaxonomy.taxeditor.molecular.AlignmentEditor"; + public static final String ID = "eu.etaxonomy.taxeditor.molecular.AlignmentEditor"; //$NON-NLS-1$ public static final int READS_AREA_INDEX = 1; public static final int EDITABLE_CONSENSUS_AREA_INDEX = READS_AREA_INDEX + 1; public static final int CONSENSUS_HINT_AREA_INDEX = EDITABLE_CONSENSUS_AREA_INDEX + 1; public static final int PHEROGRAM_AREA_INDEX = 0; public static final int CONSENSUS_DATA_AREA_INDEX = 0; - public static final String DEFAULT_READ_NAME_PREFIX = "Read "; - public static final String CONSENSUS_NAME = "Consensus"; + public static final String DEFAULT_READ_NAME_PREFIX = "Read "; //$NON-NLS-1$ + public static final String CONSENSUS_NAME = "Consensus"; //$NON-NLS-1$ private final ConversationHolder conversationHolder; @@ -299,18 +299,18 @@ public class AlignmentEditor extends EditorPart { private void createTestContents() { // Just for testing: try { - addRead(new File("D:/Users/BenStoever/ownCloud/Dokumente/Projekte/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/JR430_JR-P01.ab1").toURI(), false); + addRead(new File("D:/Users/BenStoever/ownCloud/Dokumente/Projekte/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/JR430_JR-P01.ab1").toURI(), false); //$NON-NLS-1$ //addRead(new File("D:/Users/BenStoever/ownCloud/Dokumente/Projekte/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/JR444_JR-P05.ab1").toURI(), false); - addRead(new File("D:/Users/BenStoever/ownCloud/Dokumente/Projekte/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/Test_qualityScore.scf").toURI(), false); + addRead(new File("D:/Users/BenStoever/ownCloud/Dokumente/Projekte/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/Test_qualityScore.scf").toURI(), false); //$NON-NLS-1$ // Add test consensus sequence: AlignmentModel consensusModel = getEditableConsensusArea().getAlignmentModel(); String id = consensusModel.addSequence(CONSENSUS_NAME); Collection tokens = new ArrayList(); // First save tokens in a collection to avoid GUI updated for each token. - tokens.add(consensusModel.getTokenSet().tokenByRepresentation("A")); - tokens.add(consensusModel.getTokenSet().tokenByRepresentation("C")); - tokens.add(consensusModel.getTokenSet().tokenByRepresentation("G")); - tokens.add(consensusModel.getTokenSet().tokenByRepresentation("T")); + tokens.add(consensusModel.getTokenSet().tokenByRepresentation("A")); //$NON-NLS-1$ + tokens.add(consensusModel.getTokenSet().tokenByRepresentation("C")); //$NON-NLS-1$ + tokens.add(consensusModel.getTokenSet().tokenByRepresentation("G")); //$NON-NLS-1$ + tokens.add(consensusModel.getTokenSet().tokenByRepresentation("T")); //$NON-NLS-1$ consensusModel.insertTokensAt(id, 0, tokens); } catch (Exception e) { @@ -337,7 +337,7 @@ public class AlignmentEditor extends EditorPart { cdmMap.put(id, singleReadAlignment); } catch (Exception e) { // Usually due to an error while trying to read the pherogram (e.g. due to an unsupported format or an invalid URI). - MessagingUtils.errorDialog("Error", null, "A single read was skipped because of the following error:\n\n" + + MessagingUtils.errorDialog(Messages.AlignmentEditor_ERROR_SINGLE_READ, null, Messages.AlignmentEditor_ERROR_SINGLE_READ_MESSAGE + e.getLocalizedMessage(), TaxeditorMolecularPlugin.PLUGIN_ID, e, false); } } @@ -372,8 +372,8 @@ public class AlignmentEditor extends EditorPart { } } else { - throw new IllegalArgumentException("The editor input must have the type " + - AlignmentEditorInput.class.getCanonicalName()); //TODO What should be done here? + throw new IllegalArgumentException(String.format(Messages.AlignmentEditor_MUST_HAVE_TYPE, + AlignmentEditorInput.class.getCanonicalName())); //TODO What should be done here? } } @@ -390,10 +390,10 @@ public class AlignmentEditor extends EditorPart { private void updateStatusBar() { IActionBars bars = getEditorSite().getActionBars(); - bars.getStatusLineManager().setMessage("Edit mode: " + - (getReadsArea().getEditSettings().isInsert() ? "Insert" : "Overwrite") + " " + - "Insertion in pherogram: " + - (getReadsArea().getEditSettings().isInsertLeftInDataArea() ? "Left" : "Right")); //TODO multi language + bars.getStatusLineManager().setMessage( + Messages.AlignmentEditor_EDIT_MODE + (getReadsArea().getEditSettings().isInsert() ? Messages.AlignmentEditor_INSERT : Messages.AlignmentEditor_OVERWRITE) + " " + //$NON-NLS-1$ + Messages.AlignmentEditor_INSERTION_PHEROGRAM + + (getReadsArea().getEditSettings().isInsertLeftInDataArea() ? Messages.AlignmentEditor_LEFT : Messages.AlignmentEditor_RIGHT)); //TODO multi language } @@ -411,7 +411,7 @@ public class AlignmentEditor extends EditorPart { @Override public void doSave(IProgressMonitor monitor) { if (getEditorInput() instanceof AlignmentEditorInput) { - String taskName = "Saving alignment"; //TODO multi language + String taskName = Messages.AlignmentEditor_SAVING_ALIGNMENT; //TODO multi language monitor.beginTask(taskName, 3); //re-loading sequence to avoid session conflicts @@ -438,7 +438,7 @@ public class AlignmentEditor extends EditorPart { String id = iterator.next(); SingleReadAlignment singleRead = cdmMap.get(id); if (singleRead == null) { - throw new InternalError("Creating new reads from AlignmentEditor not implemented."); //TODO multi language + throw new InternalError(Messages.AlignmentEditor_NEW_READ_FAILURE); //TODO multi language //TODO Create new read object. => Shall it be allowed to add reads in the alignment editor which are not represented in the CDM tree before the alignment editor is saved? //singleRead = SingleReadAlignment.NewInstance(consensusSequence, singleRead, shifts, editedSequence); } @@ -537,13 +537,13 @@ public class AlignmentEditor extends EditorPart { private String cutPherogram(boolean left) { SelectionModel selection = getReadsArea().getSelection(); if (selection.getCursorHeight() != 1) { - return "Cutting pherograms is only possible if exactly one row is selected."; //TODO multi language + return Messages.AlignmentEditor_CUTTING_FAILURE; //TODO multi language } else { PherogramArea pherogramArea = getPherogramArea(getReadsArea().getSequenceOrder().idByIndex(selection.getCursorRow())); if (pherogramArea == null) { - return "There is no pherogram attached to the current sequence."; //TODO multi language + return Messages.AlignmentEditor_NO_ATTACHED_PHEROGRAM; //TODO multi language } else { if (left) { @@ -551,7 +551,7 @@ public class AlignmentEditor extends EditorPart { return null; } else { - return "The left end of the selection lies outside the pherogram attached to this sequence."; //TODO multi language + return Messages.AlignmentEditor_LEFT_END_OUTSIDE; //TODO multi language } } else { @@ -559,7 +559,7 @@ public class AlignmentEditor extends EditorPart { return null; } else { - return "The right end of the selection lies outside the pherogram attached to this sequence."; //TODO multi language + return Messages.AlignmentEditor_RIGHT_END_OUTSIDE; //TODO multi language } } } diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditorInput.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditorInput.java index 308e8d658..94095996f 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditorInput.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditorInput.java @@ -20,6 +20,7 @@ import org.eclipse.ui.IPersistableElement; import eu.etaxonomy.cdm.api.service.molecular.ISequenceService; import eu.etaxonomy.cdm.model.molecular.Sequence; import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -30,7 +31,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore; * @date 04.08.2014 */ public class AlignmentEditorInput extends CdmEntitySessionInput implements IEditorInput { - private static final String name = "AlignmentEditor"; + private static final String name = Messages.AlignmentEditorInput_EDITOR_NAME; private final UUID sequenceNodeUuid; diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramMouseListener.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramMouseListener.java index 71e2c9acd..592b92238 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramMouseListener.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramMouseListener.java @@ -18,6 +18,7 @@ import org.eclipse.ui.PartInitException; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin; import eu.etaxonomy.taxeditor.molecular.handler.ShowPherogramHandler; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; @@ -44,7 +45,7 @@ public class PherogramMouseListener extends TICMouseAdapter { ShowPherogramHandler.showPherogram(area.getModel()); } catch (PartInitException e) { - MessagingUtils.errorDialog("Unable to create pherogram view", null, e.getLocalizedMessage(), + MessagingUtils.errorDialog(Messages.PherogramMouseListener_UNABLE_TO_CREATE_VIEW, null, e.getLocalizedMessage(), TaxeditorMolecularPlugin.PLUGIN_ID, e, false); //TODO set pluginID } return true; diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramViewPart.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramViewPart.java index 40c04705f..3a00a1109 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramViewPart.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramViewPart.java @@ -30,7 +30,7 @@ import org.eclipse.ui.part.ViewPart; * @date Nov 20, 2014 */ public class PherogramViewPart extends ViewPart { - public static final String ID = "eu.etaxonomy.taxeditor.molecular.PherogramView"; + public static final String ID = "eu.etaxonomy.taxeditor.molecular.PherogramView"; //$NON-NLS-1$ private PherogramView pherogramView = null; diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AlignmentEditorPasteHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AlignmentEditorPasteHandler.java index 982058030..53d3d7fc8 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AlignmentEditorPasteHandler.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AlignmentEditorPasteHandler.java @@ -1,12 +1,6 @@ package eu.etaxonomy.taxeditor.molecular.handler; -import info.bioinfweb.libralign.alignmentarea.AlignmentArea; -import info.bioinfweb.libralign.alignmentarea.order.SequenceOrder; -import info.bioinfweb.libralign.alignmentarea.selection.SelectionModel; -import info.bioinfweb.libralign.model.AlignmentModel; -import info.bioinfweb.libralign.model.utils.AlignmentModelUtils; - import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -20,6 +14,12 @@ import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.menus.UIElement; import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; +import info.bioinfweb.libralign.alignmentarea.AlignmentArea; +import info.bioinfweb.libralign.alignmentarea.order.SequenceOrder; +import info.bioinfweb.libralign.alignmentarea.selection.SelectionModel; +import info.bioinfweb.libralign.model.AlignmentModel; +import info.bioinfweb.libralign.model.utils.AlignmentModelUtils; @@ -53,7 +53,7 @@ public class AlignmentEditorPasteHandler extends AbstractFocusedAlignmentAreaHan while (scanner.hasNext()) { lines.add(scanner.nextLine()); } - if (lines.get(lines.size() - 1).equals("")) { + if (lines.get(lines.size() - 1).equals("")) { //$NON-NLS-1$ lines.remove(lines.size() - 1); } } @@ -69,12 +69,11 @@ public class AlignmentEditorPasteHandler extends AbstractFocusedAlignmentAreaHan } else { MessageDialog dialog = new MessageDialog(HandlerUtil.getActiveWorkbenchWindow(event).getShell(), //TODO Can the window be null? - "Pasting multiple lines", null, - "The text to be pasted contains mutlitple lines (" + lines.size() + - ") although the current cursor height is one. What do you want to do?", + Messages.AlignmentEditorPasteHandler_PASTING_LINES, null, + String.format(Messages.AlignmentEditorPasteHandler_PASTING_LINES_QUESTION, lines.size()), MessageDialog.QUESTION, - new String[]{"Ingnore line breaks and paste as one sequence", - "Only paste the first line from the clipboard", "Cancel"}, + new String[]{Messages.AlignmentEditorPasteHandler_PASTING_LINES_IGNORE, + Messages.AlignmentEditorPasteHandler_PASTING_LINES_FIRST_LINE, Messages.AlignmentEditorPasteHandler_CANCEL}, 0); //TODO Does the dialog have to be disposed in some way? @@ -97,12 +96,8 @@ public class AlignmentEditorPasteHandler extends AbstractFocusedAlignmentAreaHan } else { MessageDialog.openError(HandlerUtil.getActiveWorkbenchWindow(event).getShell(), //TODO Can the window be null? - "Unable to paste multiple lines", - "The current cursor height (" + selection.getCursorHeight() + - ") does not match the number of lines to be pasted (" + lines.size() + ")." + - System.getProperty("line.separator") + System.getProperty("line.separator") + - "You can either change the cursor height accordingly or set the cursor height to one " - + "allowing you to paste all lines from the clipboad into one sequence."); + Messages.AlignmentEditorPasteHandler_PASTE_FAILURE, + String.format(Messages.AlignmentEditorPasteHandler_PASTE_FAILURE_MESSAGE, selection.getCursorHeight(), lines.size(), System.getProperty("line.separator"))); //$NON-NLS-1$ } } } diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramLeftHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramLeftHandler.java index 76364366f..34ee74833 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramLeftHandler.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramLeftHandler.java @@ -15,6 +15,7 @@ import org.eclipse.core.commands.ExecutionException; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin; import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; @@ -30,7 +31,7 @@ public class CutPherogramLeftHandler extends AbstractAlignmentEditorHandler { public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException { String errorMessage = editor.cutPherogramLeft(); if (errorMessage != null) { - MessagingUtils.errorDialog("Unable to cut base call sequence", this, errorMessage, TaxeditorMolecularPlugin.PLUGIN_ID, null, false); + MessagingUtils.errorDialog(Messages.CutPherogramLeftHandler_CUT_FAILURE, this, errorMessage, TaxeditorMolecularPlugin.PLUGIN_ID, null, false); } } } diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramRightHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramRightHandler.java index 1713af132..2c7896d96 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramRightHandler.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramRightHandler.java @@ -15,6 +15,7 @@ import org.eclipse.core.commands.ExecutionException; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin; import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; @@ -30,7 +31,7 @@ public class CutPherogramRightHandler extends AbstractAlignmentEditorHandler { public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException { String errorMessage = editor.cutPherogramRight(); if (errorMessage != null) { - MessagingUtils.errorDialog("Unable to cut base call sequence", this, errorMessage, TaxeditorMolecularPlugin.PLUGIN_ID, null, false); + MessagingUtils.errorDialog(Messages.CutPherogramRightHandler_CUT_FAILURE, this, errorMessage, TaxeditorMolecularPlugin.PLUGIN_ID, null, false); } } } diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/EditSequenceHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/EditSequenceHandler.java index 5c26e4a22..c0d646d40 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/EditSequenceHandler.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/EditSequenceHandler.java @@ -14,6 +14,7 @@ import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin; import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditorInput; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; @@ -38,7 +39,7 @@ public class EditSequenceHandler extends AbstractHandler { .getActiveWorkbenchWindow().getActivePage().openEditor(input, AlignmentEditor.ID); } catch (PartInitException e) { - logger.error("Could not open AlignmentEditor", e); + logger.error(Messages.EditSequenceHandler_COULD_NOT_OPEN, e); } } return null; diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSequenceToFileHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSequenceToFileHandler.java index 928cf8e43..59d466b0b 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSequenceToFileHandler.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSequenceToFileHandler.java @@ -32,12 +32,12 @@ import org.eclipse.ui.handlers.HandlerUtil; import eu.etaxonomy.cdm.model.molecular.Sequence; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.model.MessagingUtils; -import eu.etaxonomy.taxeditor.molecular.Messages; import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin; import eu.etaxonomy.taxeditor.molecular.io.CDMPherogramAlignmentObjectTranslator; import eu.etaxonomy.taxeditor.molecular.io.CDMSequenceMatrixAdapter; import eu.etaxonomy.taxeditor.molecular.io.SingleReadAlignmentRDFXMLConstants; import eu.etaxonomy.taxeditor.molecular.io.wizard.ExportSingleReadAlignmentWizard; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; import eu.etaxonomy.taxeditor.util.ApplicationUtil; @@ -67,7 +67,7 @@ public class ExportSequenceToFileHandler extends AbstractHandler { ReadWriteParameterMap parameters = new ReadWriteParameterMap(); parameters.put(ReadWriteParameterNames.KEY_APPLICATION_NAME, ApplicationUtil.getTitle()); //parameters.put(ReadWriteParameterNames.KEY_APPLICATION_VERSION, ApplicationUtil.getVersion()); // Setting the version unnecessary, since its already contained in the title. - parameters.put(ReadWriteParameterNames.KEY_APPLICATION_URL, "http://cybertaxonomy.eu/taxeditor/"); //TODO Specify URL obtained from a central class? + parameters.put(ReadWriteParameterNames.KEY_APPLICATION_URL, "http://cybertaxonomy.eu/taxeditor/"); //TODO Specify URL obtained from a central class? //$NON-NLS-1$ parameters.put(ReadWriteParameterNames.KEY_SEQUENCE_EXTENSION_TOKEN, wizard.getModel().getElongationToken()); // Create and register object translator for writing pherogram alignment shifts: diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/HandlerTools.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/HandlerTools.java index b5de48ce3..77792d62f 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/HandlerTools.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/HandlerTools.java @@ -16,6 +16,7 @@ import org.eclipse.core.runtime.Path; import org.eclipse.jface.resource.ImageDescriptor; import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; @@ -28,12 +29,12 @@ import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin; public class HandlerTools { //TODO Move this class or method somewhere else? public static ImageDescriptor createImageDescriptor(String iconName) { URL url = FileLocator.find(TaxeditorMolecularPlugin.getDefault().getBundle(), - new Path("icons/" + iconName), null); + new Path("icons/" + iconName), null); //$NON-NLS-1$ if (url != null) { return ImageDescriptor.createFromURL(url); } else { - throw new InternalError("Icon \"" + iconName + "\" could not be loaded."); //TODO Throw other type of exception? + throw new InternalError(String.format(Messages.HandlerTools_COULD_NOT_LOAD_ICON, iconName)); //TODO Throw other type of exception? } } } diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/LoadPherogramHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/LoadPherogramHandler.java index 97e1b972e..f89d68c3c 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/LoadPherogramHandler.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/LoadPherogramHandler.java @@ -23,6 +23,7 @@ import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin; import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; @@ -45,9 +46,9 @@ public class LoadPherogramHandler extends AbstractHandler { AlignmentEditor alignmentEditor = (AlignmentEditor)activeEditor; FileDialog fileDialog = new FileDialog(alignmentEditor.getSite().getShell()); - fileDialog.setText("Import pherogram into contig alignment"); - fileDialog.setFilterNames(new String[]{"All supported formats", "AB1 pherogram files", "SCF pherogram files", "All files"}); - fileDialog.setFilterExtensions(new String[]{"*.ab1;*.scf", "*.ab1", "*.scf", "*.*"}); + fileDialog.setText(Messages.LoadPherogramHandler_IMPORT_PHEROGRAM); + fileDialog.setFilterNames(new String[]{Messages.LoadPherogramHandler_ALL_FORMATS, Messages.LoadPherogramHandler_AB1, Messages.LoadPherogramHandler_SCF, Messages.LoadPherogramHandler_ALL}); + fileDialog.setFilterExtensions(new String[]{"*.ab1;*.scf", "*.ab1", "*.scf", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ String path = fileDialog.open(); if (path != null) { @@ -55,12 +56,12 @@ public class LoadPherogramHandler extends AbstractHandler { alignmentEditor.addRead(new File(path).toURI(), false); } catch (UnsupportedChromatogramFormatException e) { - MessagingUtils.errorDialog("Unsupported format", this, "The format of the pherogram file \"" + path + - "\" is not supported. (Only AB1 and SCF are supported.)", TaxeditorMolecularPlugin.PLUGIN_ID, e, false); //TODO set pluginID + MessagingUtils.errorDialog(Messages.LoadPherogramHandler_UNSUPPORTED_FORMAT, this, + String.format(Messages.LoadPherogramHandler_UNSUPPORTED_FORMAT_MESSAGE, path), TaxeditorMolecularPlugin.PLUGIN_ID, e, false); //TODO set pluginID } catch (IOException e) { - MessagingUtils.errorDialog("Unsupported format", this, - "An IO error occurred while trying to read the file \"" + path + "\".", + MessagingUtils.errorDialog(Messages.LoadPherogramHandler_UNSUPPORTED_FORMAT_FILE, this, + Messages.LoadPherogramHandler_UNSUPPORTED_FORMAT_FILE_MESSAGE + path, TaxeditorMolecularPlugin.PLUGIN_ID, e, false); //TODO set pluginID } } diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ShowPherogramHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ShowPherogramHandler.java index c4eb1c33c..1d468b441 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ShowPherogramHandler.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ShowPherogramHandler.java @@ -20,6 +20,7 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin; import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; import eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; @@ -48,15 +49,15 @@ public class ShowPherogramHandler extends AbstractHandler { } if (uri == null) { - MessagingUtils.messageDialog("No pherogram available", this, - "The selected read does not have an associated pherogram."); + MessagingUtils.messageDialog(Messages.ShowPherogramHandler_NO_PHEROGRAM, this, + Messages.ShowPherogramHandler_NO_PHEROGRAM_MESSAGE); } else { showPherogram(new PherogramComponentModel(AlignmentEditor.readPherogram(uri))); } } catch (Exception e) { - MessagingUtils.errorDialog("Error", null, e.getLocalizedMessage(), TaxeditorMolecularPlugin.PLUGIN_ID, + MessagingUtils.errorDialog(Messages.ShowPherogramHandler_ERROR, null, e.getLocalizedMessage(), TaxeditorMolecularPlugin.PLUGIN_ID, e, false); } } diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleInsertOverwriteHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleInsertOverwriteHandler.java index e94a290c2..cff86d734 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleInsertOverwriteHandler.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleInsertOverwriteHandler.java @@ -23,6 +23,7 @@ import org.eclipse.ui.menus.UIElement; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; @@ -34,11 +35,11 @@ import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; */ public class ToggleInsertOverwriteHandler extends AbstractAlignmentEditorHandler implements IElementUpdater { public static final String COMMAND_ID = - "eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite"; + "eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite"; //$NON-NLS-1$ - private final ImageDescriptor INSERT_DESCRIPTOR = HandlerTools.createImageDescriptor("insert-16x16.png"); - private final ImageDescriptor OVERWRITE_DESCRIPTOR = HandlerTools.createImageDescriptor("overwrite-16x16.png"); + private final ImageDescriptor INSERT_DESCRIPTOR = HandlerTools.createImageDescriptor("insert-16x16.png"); //$NON-NLS-1$ + private final ImageDescriptor OVERWRITE_DESCRIPTOR = HandlerTools.createImageDescriptor("overwrite-16x16.png"); //$NON-NLS-1$ @Override @@ -53,13 +54,13 @@ public class ToggleInsertOverwriteHandler extends AbstractAlignmentEditorHandler if (activeEditor instanceof AlignmentEditor) { if (((AlignmentEditor)activeEditor).isInsertMode()) { element.setIcon(INSERT_DESCRIPTOR); - element.setText("INS"); - element.setTooltip("Click to switch to overwrite mode"); + element.setText("INS"); //$NON-NLS-1$ + element.setTooltip(Messages.ToggleInsertOverwriteHandler_SWITCH_OVERWRITE); } else { element.setIcon(OVERWRITE_DESCRIPTOR); - element.setText("OVR"); - element.setTooltip("Click to switch to insertion mode"); + element.setText("OVR"); //$NON-NLS-1$ + element.setTooltip(Messages.ToggleInsertOverwriteHandler_SWITCH_INSERTION); } ((ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements( ToggleLeftRightInsertionHandler.COMMAND_ID, null); diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleLeftRightInsertionHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleLeftRightInsertionHandler.java index 291e72c7e..9dbf660e5 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleLeftRightInsertionHandler.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleLeftRightInsertionHandler.java @@ -20,6 +20,7 @@ import org.eclipse.ui.menus.UIElement; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; @@ -31,17 +32,17 @@ import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; * @date 04.12.2014 */ public class ToggleLeftRightInsertionHandler extends AbstractAlignmentEditorHandler implements IElementUpdater { - public static final String COMMAND_ID = "eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion"; + public static final String COMMAND_ID = "eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion"; //$NON-NLS-1$ private final ImageDescriptor INSERT_LEFT_DESCRIPTOR = - HandlerTools.createImageDescriptor("pherogram-insert-left-16x16.png"); + HandlerTools.createImageDescriptor("pherogram-insert-left-16x16.png"); //$NON-NLS-1$ private final ImageDescriptor INSERT_RIGHT_DESCRIPTOR = - HandlerTools.createImageDescriptor("pherogram-insert-right-16x16.png"); + HandlerTools.createImageDescriptor("pherogram-insert-right-16x16.png"); //$NON-NLS-1$ private final ImageDescriptor INSERT_LEFT_DISABLED_DESCRIPTOR = - HandlerTools.createImageDescriptor("pherogram-insert-left-disabled-16x16.png"); + HandlerTools.createImageDescriptor("pherogram-insert-left-disabled-16x16.png"); //$NON-NLS-1$ private final ImageDescriptor INSERT_RIGHT_DISABLED_DESCRIPTOR = - HandlerTools.createImageDescriptor("pherogram-insert-right-disabled-16x16.png"); + HandlerTools.createImageDescriptor("pherogram-insert-right-disabled-16x16.png"); //$NON-NLS-1$ @Override @@ -58,14 +59,14 @@ public class ToggleLeftRightInsertionHandler extends AbstractAlignmentEditorHand if (((AlignmentEditor)activeEditor).isInsertLeftInPherogram()) { element.setIcon(INSERT_LEFT_DESCRIPTOR); element.setDisabledIcon(INSERT_LEFT_DISABLED_DESCRIPTOR); - element.setText("Left"); - element.setTooltip("Switch to insert pherogram distorsions right of future edits."); + element.setText(Messages.ToggleLeftRightInsertionHandler_LEFT); + element.setTooltip(Messages.ToggleLeftRightInsertionHandler_SWITCH_RIGHT); } else { element.setIcon(INSERT_RIGHT_DESCRIPTOR); element.setDisabledIcon(INSERT_RIGHT_DISABLED_DESCRIPTOR); - element.setText("Right"); - element.setTooltip("Switch to insert pherogram distorsions left of future edits."); + element.setText(Messages.ToggleLeftRightInsertionHandler_RIGHT); + element.setTooltip(Messages.ToggleLeftRightInsertionHandler_SWITCH_LEFT); } } } diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/CDMPherogramAlignmentObjectTranslator.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/CDMPherogramAlignmentObjectTranslator.java index 31457fc29..e3ea35a75 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/CDMPherogramAlignmentObjectTranslator.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/CDMPherogramAlignmentObjectTranslator.java @@ -23,6 +23,7 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import eu.etaxonomy.cdm.model.molecular.SingleReadAlignment; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; @@ -47,7 +48,7 @@ public class CDMPherogramAlignmentObjectTranslator extends AbstractXMLObjectTran throws IOException, XMLStreamException, InvalidObjectSourceDataException { // TODO implement - throw new InternalError("Not implemented."); + throw new InternalError(Messages.CDMPherogramAlignmentObjectTranslator_NOT_IMPLEMENTED); } diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/CDMSequenceMatrixAdapter.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/CDMSequenceMatrixAdapter.java index 68d6ac13e..8f40acaad 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/CDMSequenceMatrixAdapter.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/CDMSequenceMatrixAdapter.java @@ -10,6 +10,19 @@ package eu.etaxonomy.taxeditor.molecular.io; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import javax.xml.namespace.QName; + +import eu.etaxonomy.cdm.model.molecular.Sequence; +import eu.etaxonomy.cdm.model.molecular.SingleReadAlignment; +import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; import info.bioinfweb.commons.bio.CharacterStateSetType; import info.bioinfweb.commons.io.W3CXSConstants; import info.bioinfweb.commons.text.StringUtils; @@ -27,19 +40,6 @@ import info.bioinfweb.jphyloio.events.TokenSetDefinitionEvent; import info.bioinfweb.jphyloio.events.type.EventContentType; import info.bioinfweb.jphyloio.utils.JPhyloIOWritingUtils; -import java.io.IOException; -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; - -import eu.etaxonomy.cdm.model.molecular.Sequence; -import eu.etaxonomy.cdm.model.molecular.SingleReadAlignment; -import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; - /** @@ -52,9 +52,11 @@ import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; * @date 29.04.2016 */ public class CDMSequenceMatrixAdapter extends NoCharDefsNoSetsMatrixDataAdapter implements ReadWriteConstants, SingleReadAlignmentRDFXMLConstants { - public static final String MATRIX_ID = DEFAULT_MATRIX_ID_PREFIX + "ContigAlignment"; - public static final String SINGLE_READ_SEQUENCE_ID_PREFIX = DEFAULT_SEQUENCE_ID_PREFIX + "SingleRead"; - public static final String CONSENSUS_SEQUENCE_ID= DEFAULT_SEQUENCE_ID_PREFIX + "Consensus"; + + private static final String NO_SEQUENCE_WITH_THE_ID_D_COULD_BE_FOUND = Messages.CDMSequenceMatrixAdapter_NO_SEQUENCE_FOUND; + public static final String MATRIX_ID = DEFAULT_MATRIX_ID_PREFIX + "ContigAlignment"; //$NON-NLS-1$ + public static final String SINGLE_READ_SEQUENCE_ID_PREFIX = DEFAULT_SEQUENCE_ID_PREFIX + "SingleRead"; //$NON-NLS-1$ + public static final String CONSENSUS_SEQUENCE_ID= DEFAULT_SEQUENCE_ID_PREFIX + "Consensus"; //$NON-NLS-1$ private Sequence sequence; @@ -79,8 +81,7 @@ public class CDMSequenceMatrixAdapter extends NoCharDefsNoSetsMatrixDataAdapter public CDMSequenceMatrixAdapter(Sequence sequence, String consensusSequenceLabel, boolean exportConsensus, boolean exportSingleReads) { super(); if (!exportConsensus && !exportSingleReads) { - throw new IllegalArgumentException("Either exportConsensus or exportSingleReads must be true. " - + "Otherwise no sequences would be contained in this matrix."); + throw new IllegalArgumentException(Messages.CDMSequenceMatrixAdapter_EITHER_MUST_BE_TRUE); } else { this.sequence = sequence; @@ -131,7 +132,7 @@ public class CDMSequenceMatrixAdapter extends NoCharDefsNoSetsMatrixDataAdapter @Override public LinkedLabeledIDEvent getStartEvent(ReadWriteParameterMap parameters) { - return new LinkedLabeledIDEvent(EventContentType.ALIGNMENT, MATRIX_ID, "Contig alignment", null); + return new LinkedLabeledIDEvent(EventContentType.ALIGNMENT, MATRIX_ID, "Contig alignment", null); //$NON-NLS-1$ //TODO Use label according to derivate and markers. } @@ -180,7 +181,7 @@ public class CDMSequenceMatrixAdapter extends NoCharDefsNoSetsMatrixDataAdapter return getCDMSequence().getSequenceString().length(); } else { - throw new IllegalArgumentException("No sequence with the ID \"" + sequenceID + "\" could be found."); + throw new IllegalArgumentException(String.format(NO_SEQUENCE_WITH_THE_ID_D_COULD_BE_FOUND, sequenceID)); } } @@ -189,14 +190,14 @@ public class CDMSequenceMatrixAdapter extends NoCharDefsNoSetsMatrixDataAdapter public LinkedLabeledIDEvent getSequenceStartEvent(ReadWriteParameterMap parameters, String sequenceID) { int singleReadIndex = extractSingleReadIndexFromID(sequenceID); if (singleReadIndex >= 0) { - return new LinkedLabeledIDEvent(EventContentType.SEQUENCE, sequenceID, "Single read " + singleReadIndex, null); + return new LinkedLabeledIDEvent(EventContentType.SEQUENCE, sequenceID, "Single read " + singleReadIndex, null); //$NON-NLS-1$ //TODO Use name displayed in derivate hierarchy or specified name as label instead? } else if (exportConsensus && CONSENSUS_SEQUENCE_ID.equals(sequenceID)) { return new LinkedLabeledIDEvent(EventContentType.SEQUENCE, sequenceID, consensusSequenceLabel, null); } else { - throw new IllegalArgumentException("No sequence with the ID \"" + sequenceID + "\" could be found."); + throw new IllegalArgumentException(String.format(NO_SEQUENCE_WITH_THE_ID_D_COULD_BE_FOUND, sequenceID)); } } @@ -210,7 +211,7 @@ public class CDMSequenceMatrixAdapter extends NoCharDefsNoSetsMatrixDataAdapter private String createMetadataID(String sequenceID, QName predicate) { - return sequenceID + "META" + predicate.getLocalPart(); + return sequenceID + "META" + predicate.getLocalPart(); //$NON-NLS-1$ } @@ -256,7 +257,7 @@ public class CDMSequenceMatrixAdapter extends NoCharDefsNoSetsMatrixDataAdapter writeStringPart(receiver, getCDMSequence().getSequenceString(), startColumn, endColumn); } else { - throw new IllegalArgumentException("No sequence with the ID \"" + sequenceID + "\" could be found."); + throw new IllegalArgumentException(String.format(NO_SEQUENCE_WITH_THE_ID_D_COULD_BE_FOUND, sequenceID)); } } diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/SequenceIDIterator.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/SequenceIDIterator.java index 4f573f486..82ceebf7d 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/SequenceIDIterator.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/SequenceIDIterator.java @@ -12,6 +12,8 @@ package eu.etaxonomy.taxeditor.molecular.io; import java.util.Iterator; import java.util.NoSuchElementException; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; + /** @@ -55,13 +57,13 @@ class SequenceIDIterator implements Iterator { return CDMSequenceMatrixAdapter.CONSENSUS_SEQUENCE_ID; } else { - throw new NoSuchElementException("There are no more sequence IDs availble from this iterator."); + throw new NoSuchElementException(Messages.SequenceIDIterator_NO_MORE_SEQUENCES); } } @Override public void remove() { - throw new UnsupportedOperationException("This iterator does not support removing elements."); + throw new UnsupportedOperationException(Messages.SequenceIDIterator_REMOVE_NOT_SUPPORTED); } } diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/SingleReadAlignmentRDFXMLConstants.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/SingleReadAlignmentRDFXMLConstants.java index 2eaa3de41..01a555ee3 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/SingleReadAlignmentRDFXMLConstants.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/SingleReadAlignmentRDFXMLConstants.java @@ -21,26 +21,26 @@ import javax.xml.namespace.QName; * @date 27.10.2016 */ public interface SingleReadAlignmentRDFXMLConstants { - public static final String NAMESPACE_URI_PREFIX = "http://bioinfweb.info/xmlns/PhyDE/ReadAlignment/"; //TODO Possibly change this namespace, when according decision is made. - public static final String PREDICATE_NAMESPACE_URI = NAMESPACE_URI_PREFIX + "Predicates/"; - public static final String PREDICATE_NAMESPACE_PREFIX = "ra"; - public static final String DATA_TYPE_NAMESPACE_URI = NAMESPACE_URI_PREFIX + "DataTypes/"; - public static final String DATA_TYPE_NAMESPACE_PREFIX = "radt"; - public static final String PHEROGRAM_ALIGNMENT_NAMESPACE_URI = NAMESPACE_URI_PREFIX + "PherogramAlignment/"; - public static final String PHEROGRAM_ALIGNMENT_NAMESPACE_PREFIX = "pha"; - - public static final QName PREDICATE_IS_SINGLE_READ = new QName(PREDICATE_NAMESPACE_URI, "isSingleRead", PREDICATE_NAMESPACE_PREFIX); - public static final QName PREDICATE_IS_CONSENSUS_SEQUENCE = new QName(PREDICATE_NAMESPACE_URI, "isConsensus", PREDICATE_NAMESPACE_PREFIX); - public static final QName PREDICATE_IS_REVERSE_COMPLEMENTED = new QName(PREDICATE_NAMESPACE_URI, "isRCed", PREDICATE_NAMESPACE_PREFIX); - public static final QName PREDICATE_HAS_PHEROGRAM = new QName(PREDICATE_NAMESPACE_URI, "hasPherogram", PREDICATE_NAMESPACE_PREFIX); - public static final QName PREDICATE_HAS_PHEROGRAM_ALIGNMENT = new QName(PREDICATE_NAMESPACE_URI, "hasPherogramAlignment", PREDICATE_NAMESPACE_PREFIX); - public static final QName PREDICATE_HAS_LEFT_CUT_POSITION = new QName(PREDICATE_NAMESPACE_URI, "hasLeftCutPosition", PREDICATE_NAMESPACE_PREFIX); - public static final QName PREDICATE_HAS_RIGHT_CUT_POSITION = new QName(PREDICATE_NAMESPACE_URI, "hasRightCutPosition", PREDICATE_NAMESPACE_PREFIX); - - public static final QName DATA_TYPE_PHERORAGM_ALIGNMENT = new QName(DATA_TYPE_NAMESPACE_URI, "pherogramAlignment", DATA_TYPE_NAMESPACE_PREFIX); - - public static final QName TAG_SHIFTS = new QName(PHEROGRAM_ALIGNMENT_NAMESPACE_URI, "shifts", PHEROGRAM_ALIGNMENT_NAMESPACE_PREFIX); - public static final QName TAG_SHIFT = new QName(PHEROGRAM_ALIGNMENT_NAMESPACE_URI, "shift", PHEROGRAM_ALIGNMENT_NAMESPACE_PREFIX); - public static final QName ATTR_POSITION = new QName(PHEROGRAM_ALIGNMENT_NAMESPACE_URI, "pos", PHEROGRAM_ALIGNMENT_NAMESPACE_PREFIX); - public static final QName ATTR_SHIFT = new QName(PHEROGRAM_ALIGNMENT_NAMESPACE_URI, "shift", PHEROGRAM_ALIGNMENT_NAMESPACE_PREFIX); + public static final String NAMESPACE_URI_PREFIX = "http://bioinfweb.info/xmlns/PhyDE/ReadAlignment/"; //TODO Possibly change this namespace, when according decision is made. //$NON-NLS-1$ + public static final String PREDICATE_NAMESPACE_URI = NAMESPACE_URI_PREFIX + "Predicates/"; //$NON-NLS-1$ + public static final String PREDICATE_NAMESPACE_PREFIX = "ra"; //$NON-NLS-1$ + public static final String DATA_TYPE_NAMESPACE_URI = NAMESPACE_URI_PREFIX + "DataTypes/"; //$NON-NLS-1$ + public static final String DATA_TYPE_NAMESPACE_PREFIX = "radt"; //$NON-NLS-1$ + public static final String PHEROGRAM_ALIGNMENT_NAMESPACE_URI = NAMESPACE_URI_PREFIX + "PherogramAlignment/"; //$NON-NLS-1$ + public static final String PHEROGRAM_ALIGNMENT_NAMESPACE_PREFIX = "pha"; //$NON-NLS-1$ + + public static final QName PREDICATE_IS_SINGLE_READ = new QName(PREDICATE_NAMESPACE_URI, "isSingleRead", PREDICATE_NAMESPACE_PREFIX); //$NON-NLS-1$ + public static final QName PREDICATE_IS_CONSENSUS_SEQUENCE = new QName(PREDICATE_NAMESPACE_URI, "isConsensus", PREDICATE_NAMESPACE_PREFIX); //$NON-NLS-1$ + public static final QName PREDICATE_IS_REVERSE_COMPLEMENTED = new QName(PREDICATE_NAMESPACE_URI, "isRCed", PREDICATE_NAMESPACE_PREFIX); //$NON-NLS-1$ + public static final QName PREDICATE_HAS_PHEROGRAM = new QName(PREDICATE_NAMESPACE_URI, "hasPherogram", PREDICATE_NAMESPACE_PREFIX); //$NON-NLS-1$ + public static final QName PREDICATE_HAS_PHEROGRAM_ALIGNMENT = new QName(PREDICATE_NAMESPACE_URI, "hasPherogramAlignment", PREDICATE_NAMESPACE_PREFIX); //$NON-NLS-1$ + public static final QName PREDICATE_HAS_LEFT_CUT_POSITION = new QName(PREDICATE_NAMESPACE_URI, "hasLeftCutPosition", PREDICATE_NAMESPACE_PREFIX); //$NON-NLS-1$ + public static final QName PREDICATE_HAS_RIGHT_CUT_POSITION = new QName(PREDICATE_NAMESPACE_URI, "hasRightCutPosition", PREDICATE_NAMESPACE_PREFIX); //$NON-NLS-1$ + + public static final QName DATA_TYPE_PHERORAGM_ALIGNMENT = new QName(DATA_TYPE_NAMESPACE_URI, "pherogramAlignment", DATA_TYPE_NAMESPACE_PREFIX); //$NON-NLS-1$ + + public static final QName TAG_SHIFTS = new QName(PHEROGRAM_ALIGNMENT_NAMESPACE_URI, "shifts", PHEROGRAM_ALIGNMENT_NAMESPACE_PREFIX); //$NON-NLS-1$ + public static final QName TAG_SHIFT = new QName(PHEROGRAM_ALIGNMENT_NAMESPACE_URI, "shift", PHEROGRAM_ALIGNMENT_NAMESPACE_PREFIX); //$NON-NLS-1$ + public static final QName ATTR_POSITION = new QName(PHEROGRAM_ALIGNMENT_NAMESPACE_URI, "pos", PHEROGRAM_ALIGNMENT_NAMESPACE_PREFIX); //$NON-NLS-1$ + public static final QName ATTR_SHIFT = new QName(PHEROGRAM_ALIGNMENT_NAMESPACE_URI, "shift", PHEROGRAM_ALIGNMENT_NAMESPACE_PREFIX); //$NON-NLS-1$ } diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentFileFormatPage.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentFileFormatPage.java index 357e31e9b..0c1a4d62f 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentFileFormatPage.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentFileFormatPage.java @@ -37,7 +37,7 @@ import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; -import eu.etaxonomy.taxeditor.molecular.Messages; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentOptionsPage.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentOptionsPage.java index 704ac9ce7..d93b9521c 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentOptionsPage.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentOptionsPage.java @@ -28,7 +28,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; -import eu.etaxonomy.taxeditor.molecular.Messages; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentWizard.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentWizard.java index 4c8667aa3..9aebe4dd9 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentWizard.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentWizard.java @@ -12,6 +12,8 @@ package eu.etaxonomy.taxeditor.molecular.io.wizard; import org.eclipse.jface.wizard.Wizard; +import eu.etaxonomy.taxeditor.molecular.l10n.Messages; + /** @@ -28,7 +30,7 @@ public class ExportSingleReadAlignmentWizard extends Wizard { public ExportSingleReadAlignmentWizard() { - setWindowTitle("Export single read alignment"); //TODO Use multi language message + setWindowTitle(Messages.ExportSingleReadAlignmentWizard_EXPORT_SINGLE_READ); //TODO Use multi language message } diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentWizardModel.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentWizardModel.java index 21f5b48bd..e1534d3eb 100644 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentWizardModel.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentWizardModel.java @@ -38,7 +38,7 @@ public class ExportSingleReadAlignmentWizardModel { private IObservableValue fileName = new WritableValue(null, String.class); private IObservableValue exportSingleReads = new WritableValue(true, Boolean.class); private IObservableValue exportConsensusSequence = new WritableValue(true, Boolean.class); - private IObservableValue consensusSequenceLabel = new WritableValue("Consensus", String.class); + private IObservableValue consensusSequenceLabel = new WritableValue("Consensus", String.class); //$NON-NLS-1$ private IObservableValue elongateSequences = new WritableValue(false, Boolean.class); private IObservableValue useGapToken = new WritableValue(true, Boolean.class); diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/l10n/Messages.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/l10n/Messages.java new file mode 100644 index 000000000..626c2374e --- /dev/null +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/l10n/Messages.java @@ -0,0 +1,219 @@ +/** + * Copyright (C) 2016 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.molecular.l10n; + + +import org.eclipse.osgi.util.NLS; + + + +/** + * Provides messages and texts for classes of the molecular plugin. + * + * @author Ben Stöver + * @date 17.11.2016 + */ +public class Messages extends NLS { + private static final String BUNDLE_NAME = "src/main/java/eu.etaxonomy.taxeditor.molecular.l10n.messages"; //$NON-NLS-1$ + + + public static String AlignmentEditor_CUTTING_FAILURE; + + + public static String AlignmentEditor_EDIT_MODE; + + + public static String AlignmentEditor_ERROR_SINGLE_READ; + + + public static String AlignmentEditor_ERROR_SINGLE_READ_MESSAGE; + + + public static String AlignmentEditor_INSERT; + + + public static String AlignmentEditor_INSERTION_PHEROGRAM; + + + public static String AlignmentEditor_LEFT; + + + public static String AlignmentEditor_LEFT_END_OUTSIDE; + + + public static String AlignmentEditor_MUST_HAVE_TYPE; + + + public static String AlignmentEditor_NEW_READ_FAILURE; + + + public static String AlignmentEditor_NO_ATTACHED_PHEROGRAM; + + + public static String AlignmentEditor_OVERWRITE; + + + public static String AlignmentEditor_RIGHT; + + + public static String AlignmentEditor_RIGHT_END_OUTSIDE; + + + public static String AlignmentEditor_SAVING_ALIGNMENT; + + + public static String AlignmentEditorInput_EDITOR_NAME; + + + public static String AlignmentEditorPasteHandler_CANCEL; + + + public static String AlignmentEditorPasteHandler_PASTE_FAILURE; + + + public static String AlignmentEditorPasteHandler_PASTE_FAILURE_MESSAGE; + + + public static String AlignmentEditorPasteHandler_PASTING_LINES; + + + public static String AlignmentEditorPasteHandler_PASTING_LINES_FIRST_LINE; + + + public static String AlignmentEditorPasteHandler_PASTING_LINES_IGNORE; + + + public static String AlignmentEditorPasteHandler_PASTING_LINES_QUESTION; + + + public static String CDMPherogramAlignmentObjectTranslator_NOT_IMPLEMENTED; + + + public static String CDMSequenceMatrixAdapter_EITHER_MUST_BE_TRUE; + + + public static String CDMSequenceMatrixAdapter_NO_SEQUENCE_FOUND; + + + public static String CutPherogramLeftHandler_CUT_FAILURE; + + + public static String CutPherogramRightHandler_CUT_FAILURE; + + + public static String EditSequenceHandler_COULD_NOT_OPEN; + + + public static String ExportSingleReadAlignmentWizard_EXPORT_SINGLE_READ; + + + public static String exportSequenceToFileHandlerIOErrorMessage; + public static String exportSequenceToFileHandlerIOErrorTitle; + public static String exportSequenceToFileHandlerOverwriteTitle; + public static String exportSequenceToFileHandlerOverwriteText; + + + public static String HandlerTools_COULD_NOT_LOAD_ICON; + + + public static String LoadPherogramHandler_AB1; + + + public static String LoadPherogramHandler_ALL; + + + public static String LoadPherogramHandler_ALL_FORMATS; + + + public static String LoadPherogramHandler_IMPORT_PHEROGRAM; + + + public static String LoadPherogramHandler_SCF; + + + public static String LoadPherogramHandler_UNSUPPORTED_FORMAT; + + + public static String LoadPherogramHandler_UNSUPPORTED_FORMAT_FILE; + + + public static String LoadPherogramHandler_UNSUPPORTED_FORMAT_FILE_MESSAGE; + + + public static String LoadPherogramHandler_UNSUPPORTED_FORMAT_MESSAGE; + + + public static String PherogramMouseListener_UNABLE_TO_CREATE_VIEW; + + public static String SequenceIDIterator_NO_MORE_SEQUENCES; + + + public static String SequenceIDIterator_REMOVE_NOT_SUPPORTED; + + + public static String ShowPherogramHandler_ERROR; + + + public static String ShowPherogramHandler_NO_PHEROGRAM; + + + public static String ShowPherogramHandler_NO_PHEROGRAM_MESSAGE; + + + public static String ToggleInsertOverwriteHandler_SWITCH_INSERTION; + + + public static String ToggleInsertOverwriteHandler_SWITCH_OVERWRITE; + + + public static String ToggleLeftRightInsertionHandler_LEFT; + + + public static String ToggleLeftRightInsertionHandler_RIGHT; + + + public static String ToggleLeftRightInsertionHandler_SWITCH_LEFT; + + + public static String ToggleLeftRightInsertionHandler_SWITCH_RIGHT; + + + public static String wizardExportAlignmentAppendExtensionButton; + public static String wizardExportAlignmentBrowseButton; + public static String wizardExportAlignmentDataLabel; + public static String wizardExportAlignmentDescription; + public static String wizardExportAlignmentDestinationLabel; + public static String wizardExportAlignmentErrorMissingFileName; + public static String wizardExportAlignmentErrorMissingSeqLabel; + public static String wizardExportAlignmentErrorNothingToExport; + public static String wizardExportAlignmentExportConsensusSeqLabel; + public static String wizardExportAlignmentExportFormatLabel; + public static String wizardExportAlignmentExportSingleReads; + public static String wizardExportAlignmentFileDialogTitle; + public static String wizardExportAlignmentFileLabel; + public static String wizardExportAlignmentOptionsDescription; + public static String wizardExportAlignmentOptionsTitle; + public static String wizardExportAlignmentTitle; + public static String wizardExportAlignmentWarningFileNameStartsDot; + public static String wizardExportAlignmentwarningMissingExtension; + public static String wizardExportAlignmentWarningFileExists; + public static String wizardExportAlignmentExportedSeqHeading; + public static String wizardExportAlignmentAdditionalOptionsHeading; + public static String wizardExportAlignmentElongateSeqHeading; + public static String wizardExportAlignmentElongateSeqMissingData; + public static String wizardExportAlignmentElongateSeqGap; + + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() {} +} diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/l10n/messages.properties b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/l10n/messages.properties new file mode 100644 index 000000000..0bd463a65 --- /dev/null +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/l10n/messages.properties @@ -0,0 +1,85 @@ +exportSequenceToFileHandlerIOErrorMessage=An error occurred when trying to export a consensus sequence alignment to the file "%s". +exportSequenceToFileHandlerIOErrorTitle=I/O error +exportSequenceToFileHandlerOverwriteTitle=Overwrite file +exportSequenceToFileHandlerOverwriteText=The file \"%s\" already exists.\n\nDo you want to overwrite it? +wizardExportAlignmentAppendExtensionButton=Append default extension +wizardExportAlignmentBrowseButton=Browse... +wizardExportAlignmentDataLabel=Select the data to export: +wizardExportAlignmentDescription=Define the output file and format. +wizardExportAlignmentDestinationLabel=Select the export destination: +wizardExportAlignmentErrorMissingFileName=The file name must not be empty. +wizardExportAlignmentErrorMissingSeqLabel=The consensus sequence label must not be empty. +wizardExportAlignmentErrorNothingToExport=Either single reads or the consensus sequence have to be selected for export. +wizardExportAlignmentExportConsensusSeqLabel=Export consensus sequence +wizardExportAlignmentExportFormatLabel=Select the export format: +wizardExportAlignmentExportSingleReads=Export single reads +wizardExportAlignmentFileDialogTitle=Export to +wizardExportAlignmentFileLabel=Alignment file: +wizardExportAlignmentTitle=Sequence export +wizardExportAlignmentWarningFileNameStartsDot=File starting with '.' are not supported on all operating systems. +wizardExportAlignmentwarningMissingExtension=The file name does have a valid extension for the selected format. +wizardExportAlignmentWarningFileExists=The file already exists and will be overwritten. +wizardExportAlignmentOptionsDescription=Specify additional export parameters. +wizardExportAlignmentOptionsTitle=Export options +wizardExportAlignmentExportedSeqHeading=Specify the sequences to be exported: +wizardExportAlignmentAdditionalOptionsHeading=Specify additional export options: +wizardExportAlignmentElongateSeqHeading=Elongate sequences to have equal length with: +wizardExportAlignmentElongateSeqMissingData=Missing data ('?')" +wizardExportAlignmentElongateSeqGap=Gap ('-') + +AlignmentEditor_CUTTING_FAILURE=Cutting pherograms is only possible if exactly one row is selected. +AlignmentEditor_EDIT_MODE=Edit mode: +AlignmentEditor_ERROR_SINGLE_READ=Error +AlignmentEditor_ERROR_SINGLE_READ_MESSAGE=A single read was skipped because of the following error:\n\n +AlignmentEditor_INSERT=Insert +AlignmentEditor_INSERTION_PHEROGRAM=Insertion in pherogram: +AlignmentEditor_LEFT=Left +AlignmentEditor_LEFT_END_OUTSIDE=The left end of the selection lies outside the pherogram attached to this sequence. +AlignmentEditor_MUST_HAVE_TYPE=The editor input must have the type %s +AlignmentEditor_NEW_READ_FAILURE=Creating new reads from AlignmentEditor not implemented. +AlignmentEditor_NO_ATTACHED_PHEROGRAM=There is no pherogram attached to the current sequence. +AlignmentEditor_OVERWRITE=Overwrite +AlignmentEditor_RIGHT=Right +AlignmentEditor_RIGHT_END_OUTSIDE=The right end of the selection lies outside the pherogram attached to this sequence. +AlignmentEditor_SAVING_ALIGNMENT=Saving alignment +AlignmentEditorInput_EDITOR_NAME=AlignmentEditor +PherogramMouseListener_UNABLE_TO_CREATE_VIEW=Unable to create pherogram view + +CutPherogramLeftHandler_CUT_FAILURE=Unable to cut base call sequence +CutPherogramRightHandler_CUT_FAILURE=Unable to cut base call sequence +EditSequenceHandler_COULD_NOT_OPEN=Could not open AlignmentEditor +HandlerTools_COULD_NOT_LOAD_ICON=Icon "%s" could not be loaded. +LoadPherogramHandler_AB1=AB1 pherogram files +LoadPherogramHandler_ALL=All files +LoadPherogramHandler_ALL_FORMATS=All supported formats +LoadPherogramHandler_IMPORT_PHEROGRAM=Import pherogram into contig alignment +LoadPherogramHandler_SCF=SCF pherogram files +LoadPherogramHandler_UNSUPPORTED_FORMAT=Unsupported format +LoadPherogramHandler_UNSUPPORTED_FORMAT_FILE=Unsupported format +LoadPherogramHandler_UNSUPPORTED_FORMAT_FILE_MESSAGE=An IO error occurred while trying to read the file +LoadPherogramHandler_UNSUPPORTED_FORMAT_MESSAGE=The format of the pherogram file "%s" is not supported. (Only AB1 and SCF are supported.) +ShowPherogramHandler_ERROR=Error +ShowPherogramHandler_NO_PHEROGRAM=No pherogram available +ShowPherogramHandler_NO_PHEROGRAM_MESSAGE=The selected read does not have an associated pherogram. +ToggleInsertOverwriteHandler_SWITCH_INSERTION=Click to switch to insertion mode +ToggleInsertOverwriteHandler_SWITCH_OVERWRITE=Click to switch to overwrite mode +ToggleLeftRightInsertionHandler_LEFT=Left +ToggleLeftRightInsertionHandler_RIGHT=Right +ToggleLeftRightInsertionHandler_SWITCH_LEFT=Switch to insert pherogram distorsions left of future edits. +ToggleLeftRightInsertionHandler_SWITCH_RIGHT=Switch to insert pherogram distorsions right of future edits. + +AlignmentEditorPasteHandler_CANCEL=Cancel +AlignmentEditorPasteHandler_PASTE_FAILURE=Unable to paste multiple lines +AlignmentEditorPasteHandler_PASTE_FAILURE_MESSAGE=The current cursor height (%1$d) does not match the number of lines to be pasted (%2$d).%3$s%3$sYou can either change the cursor height accordingly or set the cursor height to one allowing you to paste all lines from the clipboard into one sequence. +AlignmentEditorPasteHandler_PASTING_LINES=Pasting multiple lines +AlignmentEditorPasteHandler_PASTING_LINES_FIRST_LINE=Only paste the first line from the clipboard +AlignmentEditorPasteHandler_PASTING_LINES_IGNORE=Ignore line breaks and paste as one sequence +AlignmentEditorPasteHandler_PASTING_LINES_QUESTION=The text to be pasted contains mutlitple lines (%d) although the current cursor height is 1. What do you want to do? + +CDMPherogramAlignmentObjectTranslator_NOT_IMPLEMENTED=Not implemented. +CDMSequenceMatrixAdapter_EITHER_MUST_BE_TRUE=Either exportConsensus or exportSingleReads must be true. Otherwise no sequences would be contained in this matrix. +CDMSequenceMatrixAdapter_NO_SEQUENCE_FOUND=No sequence with the ID "%d" could be found. +SequenceIDIterator_NO_MORE_SEQUENCES=There are no more sequence IDs availble from this iterator. +SequenceIDIterator_REMOVE_NOT_SUPPORTED=This iterator does not support removing elements. + +ExportSingleReadAlignmentWizard_EXPORT_SINGLE_READ=Export single read alignment diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/l10n/messages_de.properties b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/l10n/messages_de.properties new file mode 100644 index 000000000..3b22e99ca --- /dev/null +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/l10n/messages_de.properties @@ -0,0 +1,85 @@ +exportSequenceToFileHandlerIOErrorMessage=Beim Schreiben der Datei "%s" ist ein Fehler aufgetreten. +exportSequenceToFileHandlerIOErrorTitle=E/A Fehler +exportSequenceToFileHandlerOverwriteTitle=Datei überschreiben +exportSequenceToFileHandlerOverwriteText=Die Datei \"%s\" existiert bereits.\n\nSoll sie überschrieben werden? +wizardExportAlignmentAppendExtensionButton=Standarddateiendung anhängen +wizardExportAlignmentBrowseButton=Durchsuchen... +wizardExportAlignmentDataLabel=Zu exportierende Daten: +wizardExportAlignmentDescription=Wählen Sie den Zielort und das Zielformat aus! +wizardExportAlignmentDestinationLabel=Zieldatei: +wizardExportAlignmentErrorMissingFileName=Der Dateiname darf nicht leer sein. +wizardExportAlignmentErrorMissingSeqLabel=Der Name der Konsensussequenz darf nicht leer sein. +wizardExportAlignmentErrorNothingToExport=Es müssen entweder die einzelnen Reads oder die Konsensussequenz zum Export ausgewählt werden. +wizardExportAlignmentExportConsensusSeqLabel=Konsensussequenz exportieren +wizardExportAlignmentExportFormatLabel=Zielformat: +wizardExportAlignmentExportSingleReads=Einzelne Reads exportieren +wizardExportAlignmentFileDialogTitle=Exportieren nach +wizardExportAlignmentFileLabel=Alignment Datei: +wizardExportAlignmentTitle=Sequenzexport +wizardExportAlignmentWarningFileNameStartsDot=Dateinamen, die mit einem '.' beginnen, werden nicht auf allen Betriebssystemen unterstützt. +wizardExportAlignmentwarningMissingExtension=Der momentane Dateiname hat keine zum aktuellen Format passende Endung. +wizardExportAlignmentWarningFileExists=The existiert bereits und würde überschrieben. +wizardExportAlignmentOptionsDescription=Geben Sie weitere Exportparameter an! +wizardExportAlignmentOptionsTitle=Exportoptionen +wizardExportAlignmentExportedSeqHeading=Zu exportierende Sequenzen: +wizardExportAlignmentAdditionalOptionsHeading=Erweiterte Exportoptionen: +wizardExportAlignmentElongateSeqHeading=Sequenzen auf einheitliche Länge bringen mit: +wizardExportAlignmentElongateSeqMissingData=Fehlende Daten ('?')" +wizardExportAlignmentElongateSeqGap=Lücke ('-') + +AlignmentEditor_CUTTING_FAILURE=Beschneiden des Pherogramms ist nur möglich, wenn exakt eine Reihe ausgewählt ist. +AlignmentEditor_EDIT_MODE=Editier-Modus: +AlignmentEditor_ERROR_SINGLE_READ=Error +AlignmentEditor_ERROR_SINGLE_READ_MESSAGE=Ein Single-Read wurde übersprungen wegen folgendem Fehler:\n\n +AlignmentEditor_INSERT=Einfügen +AlignmentEditor_INSERTION_PHEROGRAM=Einfügen in Pherogrammm: +AlignmentEditor_LEFT=Links +AlignmentEditor_LEFT_END_OUTSIDE=Das linke Ende der Auswahl liegt außerhalb des Pherogramms dieser Sequenz. +AlignmentEditor_MUST_HAVE_TYPE=Der Editor-Input muss vom Typ %s sein +AlignmentEditor_NEW_READ_FAILURE=Das Erzeugen neuer Reads im Alignment-Editor ist nicht implementiert. +AlignmentEditor_NO_ATTACHED_PHEROGRAM=Die ausgewählte Sequenz hat kein angehangenes Pherogramm. +AlignmentEditor_OVERWRITE=Überschreiben +AlignmentEditor_RIGHT=REchts +AlignmentEditor_RIGHT_END_OUTSIDE=Das rechte Ende der Auswahl liegt außerhalb des Pherogramms dieser Sequenz. +AlignmentEditor_SAVING_ALIGNMENT=Alignment speichern +AlignmentEditorInput_EDITOR_NAME=Alignment-Editor +PherogramMouseListener_UNABLE_TO_CREATE_VIEW=Pherogram-View konnte nicht erstellt werden + +CutPherogramLeftHandler_CUT_FAILURE=Base-Call-Sequenz konnte nicht beschnitten werden +CutPherogramRightHandler_CUT_FAILURE=Base-Call-Sequenz konnte nicht beschnitten werden +EditSequenceHandler_COULD_NOT_OPEN=Alignment-Editor konnte nicht geöffnet werden +HandlerTools_COULD_NOT_LOAD_ICON=Icon "%s" konnte nicht geladen werden. +LoadPherogramHandler_AB1=AB1 Pherogramm-Dateien +LoadPherogramHandler_ALL=Alle Dateien +LoadPherogramHandler_ALL_FORMATS=Alle unterstützten Formate +LoadPherogramHandler_IMPORT_PHEROGRAM=Pherogramm in Contig-Alignment importieren +LoadPherogramHandler_SCF=SCF Pherogramm-Dateien +LoadPherogramHandler_UNSUPPORTED_FORMAT=Nicht unterstütztes Format +LoadPherogramHandler_UNSUPPORTED_FORMAT_FILE=Nicht unterstütztes Format +LoadPherogramHandler_UNSUPPORTED_FORMAT_FILE_MESSAGE=IO-Fehler beim Lesen der Datei +LoadPherogramHandler_UNSUPPORTED_FORMAT_MESSAGE=Das Format der Pherogramm-Datei "%s" wird nicht unterstützt. (Nur AB1 und SCF werden unterstützt.) +ShowPherogramHandler_ERROR=Error +ShowPherogramHandler_NO_PHEROGRAM=Kein Pherogramm verfügbar +ShowPherogramHandler_NO_PHEROGRAM_MESSAGE=Der ausgewählte Read hat kein Pherogramm +ToggleInsertOverwriteHandler_SWITCH_INSERTION=Klicken, um zum Einfügen-Modus zu wechseln +ToggleInsertOverwriteHandler_SWITCH_OVERWRITE=Klicken, um zum Überschreiben-Modus zu wechseln +ToggleLeftRightInsertionHandler_LEFT=Links +ToggleLeftRightInsertionHandler_RIGHT=Rechts +ToggleLeftRightInsertionHandler_SWITCH_LEFT=Wechseln, um Pherogramm-Verzerrungen linksseitig einzufügen. +ToggleLeftRightInsertionHandler_SWITCH_RIGHT=Wechseln, um Pherogramm-Verzerrungen rechtsseitig einzufügen. + +AlignmentEditorPasteHandler_CANCEL=Abbrechen +AlignmentEditorPasteHandler_PASTE_FAILURE=Konnte mehrere Zeilen nicht einfügen +AlignmentEditorPasteHandler_PASTE_FAILURE_MESSAGE=Die aktuelle Cursor-Auswahl (%1$d) stimmt nicht mit der Anzahl der einzufügenden Zeilen (%2$d) überein.%3$s%3$sSie können die Cursor-Auswahl entsprechend anpassen oder die Auswahl auf eine Zeile einschränken, um alle Zeilen aus dem Clipboard in die Sequenz einzufügen. +AlignmentEditorPasteHandler_PASTING_LINES=Füge mehrere Zeilen ein +AlignmentEditorPasteHandler_PASTING_LINES_FIRST_LINE=Füge nur die erste Zeile aus dem Clipboard ein +AlignmentEditorPasteHandler_PASTING_LINES_IGNORE=Zeilenumbrüche ignorieren und als eine Sequenz einfügen +AlignmentEditorPasteHandler_PASTING_LINES_QUESTION=Der einzufügende Text enthält mehrere Zeilen (%d), obwohl die aktuelle Cursor-Auswahl 1 ist. Was wollen Sie tun? + +CDMPherogramAlignmentObjectTranslator_NOT_IMPLEMENTED=Nicht implementiert. +CDMSequenceMatrixAdapter_EITHER_MUST_BE_TRUE=Entweder exportConsensus oder exportSingleReads muss angewählt sein. Ansonsten sind keine Sequenzen in der Matrix enthalten. +CDMSequenceMatrixAdapter_NO_SEQUENCE_FOUND=Sequenz mit der ID "%d" konnte nicht gefunden werden. +SequenceIDIterator_NO_MORE_SEQUENCES=Dieser Iterator hat keine weiteren Sequenz-IDs. +SequenceIDIterator_REMOVE_NOT_SUPPORTED=Dieser Iterator unterstützt das Entfernen von Elementen nicht. + +ExportSingleReadAlignmentWizard_EXPORT_SINGLE_READ=Exportiere Single-Read-Alignment diff --git a/eu.etaxonomy.taxeditor.navigation/.classpath b/eu.etaxonomy.taxeditor.navigation/.classpath index 3a227f058..9f6b85558 100644 --- a/eu.etaxonomy.taxeditor.navigation/.classpath +++ b/eu.etaxonomy.taxeditor.navigation/.classpath @@ -1,6 +1,6 @@ - + diff --git a/eu.etaxonomy.taxeditor.navigation/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.navigation/META-INF/MANIFEST.MF index 03b6c6c06..2a5308b14 100644 --- a/eu.etaxonomy.taxeditor.navigation/META-INF/MANIFEST.MF +++ b/eu.etaxonomy.taxeditor.navigation/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Navigation Bundle Bundle-SymbolicName: eu.etaxonomy.taxeditor.navigation;singleton:=true -Bundle-Version: 4.5.1 +Bundle-Version: 4.6.0 Bundle-Vendor: EDIT Export-Package: eu.etaxonomy.cdm, eu.etaxonomy.taxeditor.navigation, diff --git a/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties b/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties index 1bb4af14f..f305d3233 100644 --- a/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties +++ b/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties @@ -43,4 +43,6 @@ navigatorContent.name = Classification navigatorContent.name.0 = TaxonNode navigatorContent.name.1 = Synonyms (experimental) command.label.moveFactualData = Move factual data to another taxon -command.name.moveFactualData = Move factual data \ No newline at end of file +command.name.moveFactualData = Move factual data +command.label.setSecForSubtree = Set secundum for subtree +command.name.setSecForSubtree = set secundum for subtree diff --git a/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties b/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties index f78b7e12d..4f1b16ca9 100644 --- a/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties +++ b/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties @@ -44,4 +44,6 @@ navigatorContent.name = Klassifikation navigatorContent.name.0 = Taxonknoten navigatorContent.name.1 = Synonyme (experimentell) command.label.moveFactualData = Verschiebe Faktendaten zu Taxon -command.name.moveFactualData = Verschiebe Faktendaten \ No newline at end of file +command.name.moveFactualData = Verschiebe Faktendaten +command.label.setSecForSubtree = Setze Secundum für Teilbaum +command.name.setSecForSubtree = Setze Secundum für Teilbaum \ No newline at end of file diff --git a/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/messages.properties b/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/messages.properties deleted file mode 100644 index 2fb82b9b4..000000000 --- a/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/messages.properties +++ /dev/null @@ -1,9 +0,0 @@ -SearchBar_0=Use "*" for wildcard searching -SearchBar_1=Search -SearchBar_2=Could not execute search -SearchBar_3=Please type at least one character -SearchBar_4=Error opening search result. -SearchBar_6=Taxa -SearchBar_7=Synonyms -SearchBar_8=Names (without taxa) -SearchBar_9=Common Names diff --git a/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/messages_de.properties b/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/messages_de.properties deleted file mode 100644 index 0546737ff..000000000 --- a/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/messages_de.properties +++ /dev/null @@ -1,9 +0,0 @@ -SearchBar_0=Benutze "*" f\u00FCr Platzhalter-Suche -SearchBar_1=Suche -SearchBar_2=Suche konnte nicht ausgef\u00FChrt werden -SearchBar_3=Bitte geben Sie mindestens einen Buchstaben ein -SearchBar_4=Fehler beim f\u00fcffnen des Suchergebnisses -SearchBar_6=Taxa -SearchBar_7=Synonyme -SearchBar_8=Namen (ohne Taxa) -SearchBar_9=Umgangsprachliche Namen diff --git a/eu.etaxonomy.taxeditor.navigation/build.properties b/eu.etaxonomy.taxeditor.navigation/build.properties index 5a3a94bb3..69ef8f507 100644 --- a/eu.etaxonomy.taxeditor.navigation/build.properties +++ b/eu.etaxonomy.taxeditor.navigation/build.properties @@ -9,8 +9,8 @@ bin.includes = META-INF/,\ p2.inf,\ OSGI-INF/l10n/bundle.properties,\ OSGI-INF/l10n/bundle_de.properties,\ - OSGI-INF/l10n/messages.properties,\ - OSGI-INF/l10n/messages_de.properties + src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages.properties,\ + src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages_de.properties diff --git a/eu.etaxonomy.taxeditor.navigation/plugin.xml b/eu.etaxonomy.taxeditor.navigation/plugin.xml index 4b6e4e621..57af053ac 100644 --- a/eu.etaxonomy.taxeditor.navigation/plugin.xml +++ b/eu.etaxonomy.taxeditor.navigation/plugin.xml @@ -192,6 +192,22 @@ + + + + + + + + + + + + + + + + + + eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 4.0.0 diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java index c4d361d0f..626af92f5 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java @@ -52,6 +52,7 @@ import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator; import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -65,7 +66,10 @@ import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; * @version 1.0 */ public class NavigationUtil extends AbstractUtility{ - private static IUndoContext defaultUndoContext; + + private static final String NOT_IMPLEMENTED_YET = Messages.NavigationUtil_NOT_IMPLEMENTED; + private static final String ERROR_OPENING_THE_EDITOR = Messages.NavigationUtil_OPEN_ERROR; + private static IUndoContext defaultUndoContext; /** *

openEditor

@@ -88,13 +92,13 @@ public class NavigationUtil extends AbstractUtility{ cdmBase = CdmStore.getService(INameService.class).load(uuidAndTitleCache.getUuid()); } else{ - MessagingUtils.warningDialog("Unknown type", NavigationUtil.class, "There is no editor available to open this object."); + MessagingUtils.warningDialog(Messages.NavigationUtil_UNKNOWN_TYPE, NavigationUtil.class, Messages.NavigationUtil_UNKNOWN_TYPE_MESSAGE); } if(cdmBase!=null){ openEditor(cdmBase); } else{ - MessagingUtils.warningDialog("Cdm entity not found", NavigationUtil.class, "CDM entity could not be found in the database."); + MessagingUtils.warningDialog(Messages.NavigationUtil_NOT_FOUND, NavigationUtil.class, Messages.NavigationUtil_NOT_FOUND_MESSAGE); } } @@ -123,12 +127,12 @@ public class NavigationUtil extends AbstractUtility{ }else if(selectedObject instanceof PolytomousKey){ EditorUtil.openPolytomousKey(entityUuid); }else{ - MessagingUtils.warningDialog("Unsupported Type", NavigationUtil.class, "No editor exists for the current selection: " + selectedObject); + MessagingUtils.warningDialog(Messages.NavigationUtil_UNSUPPORTED_TYPE, NavigationUtil.class, Messages.NavigationUtil_UNSUPPORTED_TYPE_MESSAGE + selectedObject); } } catch (PartInitException e) { - MessagingUtils.error(NavigationUtil.class, "Error opening the editor", e); + MessagingUtils.error(NavigationUtil.class, ERROR_OPENING_THE_EDITOR, e); } catch (Exception e) { - MessagingUtils.errorDialog("Could not create Taxon", + MessagingUtils.errorDialog(Messages.NavigationUtil_CREATE_FAILED, NavigationUtil.class, e.getMessage(), TaxeditorStorePlugin.PLUGIN_ID, e, @@ -140,11 +144,11 @@ public class NavigationUtil extends AbstractUtility{ private static void openInBulkEditor(ICdmBase selectedObject) { ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class); IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class); - String openInBulkEditorCommand = "eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity"; + String openInBulkEditorCommand = "eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity"; //$NON-NLS-1$ Command command = commandService.getCommand(openInBulkEditorCommand); if(command.isDefined()){ Map params = new HashMap(); - params.put(openInBulkEditorCommand+".uuid", ((ICdmBase) selectedObject).getUuid()); //$NON-NLS-1$ + params.put(openInBulkEditorCommand+".uuid", selectedObject.getUuid()); //$NON-NLS-1$ ParameterizedCommand parameterizedCommand = ParameterizedCommand.generateCommand(command, params); try { if(parameterizedCommand!=null){ @@ -172,7 +176,7 @@ public class NavigationUtil extends AbstractUtility{ try { EditorUtil.openEmpty(parentNodeUuid); } catch (PartInitException e) { - MessagingUtils.error(NavigationUtil.class, "Error opening the editor", e); + MessagingUtils.error(NavigationUtil.class, ERROR_OPENING_THE_EDITOR, e); } } @@ -297,7 +301,7 @@ public class NavigationUtil extends AbstractUtility{ handleOpeningOfMultipleTaxa(accTaxa); }else{ - MessagingUtils.warningDialog("Not implemented yet", NavigationUtil.class, "You chose to open a name that has no connection to a taxon. The Editor does not support editing of such a content type at the moment."); + MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_ORPHAN_NAME_MESSAGE); } } @@ -307,11 +311,10 @@ public class NavigationUtil extends AbstractUtility{ openEditor(acceptedTaxa.iterator().next()); }else if(acceptedTaxa.size() > 1){ // FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open. - MessagingUtils.warningDialog("Not implemented yet", NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open." + - " This case is not handled yet by the software."); + MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_MULTI_TREE); }else if(acceptedTaxa.size() == 0){ // this is an undesired state - MessagingUtils.warningDialog("Not implemented yet", NavigationUtil.class, "This taxon is not connected to a classification. Currently editing of such taxa is not supported yet."); + MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_ORPHAN_TAXON); } } @@ -325,11 +328,10 @@ public class NavigationUtil extends AbstractUtility{ openEditor(taxonNodes.iterator().next()); }else if(taxonNodes.size() > 1){ // FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open. - MessagingUtils.warningDialog("Not implemented yet", NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open." + - " This case is not handled yet by the software."); + MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open. This case is not handled yet by the software."); }else if(taxonNodes.size() == 0){ // this is an undesired state - MessagingUtils.warningDialog("Incorrect state", NavigationUtil.class, "The accepted taxon is not in a taxonomic view. This should not have happened."); + MessagingUtils.warningDialog(Messages.NavigationUtil_INCORRECT_STATE, NavigationUtil.class, Messages.NavigationUtil_INCORRECT_STATE_MESSAGE); } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/internal/TaxeditorNavigationPlugin.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/internal/TaxeditorNavigationPlugin.java index 68383d04a..faed12997 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/internal/TaxeditorNavigationPlugin.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/internal/TaxeditorNavigationPlugin.java @@ -17,7 +17,7 @@ public class TaxeditorNavigationPlugin extends AbstractUIPlugin { // The plug-in ID /** Constant PLUGIN_ID="eu.etaxonomy.taxeditor.navigator" */ - public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.navigator"; + public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.navigator"; //$NON-NLS-1$ // The shared instance private static TaxeditorNavigationPlugin plugin; diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewLabels.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewLabels.java index db0a628dc..e4c71b443 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewLabels.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewLabels.java @@ -8,6 +8,8 @@ */ package eu.etaxonomy.taxeditor.navigation.key.polytomous; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; + /** * @author cmathew * @date 25 Jun 2015 @@ -15,10 +17,10 @@ package eu.etaxonomy.taxeditor.navigation.key.polytomous; */ public interface PolytomousKeyViewLabels { - public static final String DELETE_POLYTOMOUS_KEY_LABEL = "Delete Polytomous Key"; - public static final String UPDATE_ALL_POLYTOMOUS_KEY_NODES_LABEL = "Update All Polytomous Key Nodes"; + public static final String DELETE_POLYTOMOUS_KEY_LABEL = Messages.PolytomousKeyViewLabels_DELETE; + public static final String UPDATE_ALL_POLYTOMOUS_KEY_NODES_LABEL = Messages.PolytomousKeyViewLabels_UPDATE; - public static final String ERROR_OPENING_KEY_EDITOR_MESSAGE = "Error opening Polytomous Key Editor"; + public static final String ERROR_OPENING_KEY_EDITOR_MESSAGE = Messages.PolytomousKeyViewLabels_OPEN_ERROR; } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewPart.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewPart.java index 9e5cacf4a..c0a0ff645 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewPart.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewPart.java @@ -50,6 +50,7 @@ import eu.etaxonomy.taxeditor.model.ContextListenerAdapter; import eu.etaxonomy.taxeditor.model.DataChangeBridge; import eu.etaxonomy.taxeditor.model.IContextListener; import eu.etaxonomy.taxeditor.model.MessagingUtils; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; import eu.etaxonomy.taxeditor.session.ICdmEntitySession; import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; @@ -90,9 +91,9 @@ public class PolytomousKeyViewPart extends ViewPart implements } - public static final String ID = "eu.etaxonomy.taxeditor.navigation.key.polytomous.polytomousKeyViewPart"; + public static final String ID = "eu.etaxonomy.taxeditor.navigation.key.polytomous.polytomousKeyViewPart"; //$NON-NLS-1$ - public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.navigation.key.polytomous.editNodes"; + public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.navigation.key.polytomous.editNodes"; //$NON-NLS-1$ private class ContextListener extends ContextListenerAdapter{ /* (non-Javadoc) @@ -100,7 +101,7 @@ public class PolytomousKeyViewPart extends ViewPart implements */ @Override public void contextStop(IMemento memento, IProgressMonitor monitor) { - monitor.subTask("Shutting down Polytomous Key Viewer"); + monitor.subTask(Messages.PolytomousKeyViewPart_SHUTDOWN); if(!viewer.getControl().isDisposed()){ viewer.setInput(null); } @@ -111,7 +112,7 @@ public class PolytomousKeyViewPart extends ViewPart implements */ @Override public void contextStart(IMemento memento, IProgressMonitor monitor) { - monitor.subTask("Initiating Polytomous Key Viewer"); + monitor.subTask(Messages.PolytomousKeyViewPart_INIT); setInput(); } } @@ -141,7 +142,7 @@ public class PolytomousKeyViewPart extends ViewPart implements contextListener = new ContextListener(); CdmStore.getContextManager().addContextListener(contextListener); - text_filter = formFactory.createText(container, ""); + text_filter = formFactory.createText(container, ""); //$NON-NLS-1$ text_filter.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); text_filter.addModifyListener(new FilterModifyListener()); @@ -178,9 +179,9 @@ public class PolytomousKeyViewPart extends ViewPart implements try { handlerService.executeCommand(OPEN_COMMAND_ID, null); } catch (NotDefinedException e) { - throw new RuntimeException("Could not find open command: " + OPEN_COMMAND_ID); + throw new RuntimeException("Could not find open command: " + OPEN_COMMAND_ID); //$NON-NLS-1$ } catch (Exception e) { - MessagingUtils.error(getClass(), "An exception occured while trying to open a selection", e); + MessagingUtils.error(getClass(), Messages.PolytomousKeyViewPart_EXCEPTION, e); } } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewPartDataChangeBehavior.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewPartDataChangeBehavior.java index 3edf00c03..b668ac209 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewPartDataChangeBehavior.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewPartDataChangeBehavior.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -21,6 +21,7 @@ import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; /** * @author n.hoffmann @@ -30,7 +31,8 @@ import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour; public class PolytomousKeyViewPartDataChangeBehavior extends AbstractDataChangeBehaviour { - private final PolytomousKeyViewPart source; + private static final String UPDATING_POLYTOMOUS_KEY_VIEWER = Messages.PolytomousKeyViewPartDataChangeBehavior_UPDATE; + private final PolytomousKeyViewPart source; /** * @param polytomousKeyViewPart @@ -47,21 +49,22 @@ public class PolytomousKeyViewPartDataChangeBehavior extends public void reactOnDataChange(CdmDataChangeMap changeEvents) { if(isRelevant(changeEvents)){ final Display display = Display.getCurrent(); - Job job = new Job("Updating Polytomous Key Viewer") { - + Job job = new Job(UPDATING_POLYTOMOUS_KEY_VIEWER) { + @Override protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask("Updating Polytomous Key Viewer", 3); + monitor.beginTask(UPDATING_POLYTOMOUS_KEY_VIEWER, 3); monitor.worked(1); - + // clear the session completely - monitor.subTask("Clearing Polytomous Key Viewer session"); + monitor.subTask(Messages.PolytomousKeyViewPartDataChangeBehavior_CLEAR); display.asyncExec(new Runnable() { - public void run() { + @Override + public void run() { source.getConversationHolder().clear(); } - }); - // FIXME completely clearing the session is a brute force approach. + }); + // FIXME completely clearing the session is a brute force approach. // It would be much more elegant to clear only those elements that have been changed. // I could not get that to work but we should consider workin on this because we might // run into serious performance issues, especially when it comes to large trees @@ -69,29 +72,30 @@ public class PolytomousKeyViewPartDataChangeBehavior extends // at least, we moved this to a job so it can run in a background thred // seems to improve the situation but not sure if final solution monitor.worked(1); - - monitor.subTask("Refreshing viewer"); - + + monitor.subTask(Messages.PolytomousKeyViewPartDataChangeBehavior_REFRESH); + display.asyncExec(new Runnable() { - public void run() { + @Override + public void run() { source.refresh(); } }); - - - + + + monitor.worked(1); monitor.done(); return Status.OK_STATUS; } }; - + job.setPriority(Job.SHORT); job.schedule(); - + } } - + /** * @return */ @@ -99,9 +103,9 @@ public class PolytomousKeyViewPartDataChangeBehavior extends for(CdmDataChangeEvent event : changeEvents.getAllEvents()){ EventType eventType = event.getEventType(); CdmBase eventEntity = event.getEntity(); - + // all poyltomous key changes are relevant - if((eventType == EventType.INSERT || eventType == EventType.DELETE || eventType == EventType.UPDATE) + if((eventType == EventType.INSERT || eventType == EventType.DELETE || eventType == EventType.UPDATE) && eventEntity instanceof PolytomousKey){ return true; } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/DeleteHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/DeleteHandler.java index 74c808451..ad614b249 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/DeleteHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/DeleteHandler.java @@ -23,6 +23,7 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart; import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.DeleteOperation; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; /** @@ -32,7 +33,10 @@ import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; */ public class DeleteHandler extends AbstractHandler { - /* (non-Javadoc) + protected static final String CONFIRM_MESSAGE = Messages.DeleteHandler_CONFIRM_MESSAGE; + protected static final String CONFIRM = Messages.DeleteHandler_CONFIRM; + + /* (non-Javadoc) * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) */ @Override @@ -45,7 +49,7 @@ public class DeleteHandler extends AbstractHandler { return null; } - boolean confirmation = MessagingUtils.confirmDialog("Confirm deletion", "Do you want to delete the selected key" + (keys.size() == 1 ? "" : "s") + "?"); + boolean confirmation = MessagingUtils.confirmDialog(CONFIRM, CONFIRM_MESSAGE); if(confirmation){ diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/EditPolytomousKeyNodesHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/EditPolytomousKeyNodesHandler.java index 5a4831fd7..b539552d1 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/EditPolytomousKeyNodesHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/EditPolytomousKeyNodesHandler.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -23,6 +23,7 @@ import org.eclipse.swt.widgets.Display; import eu.etaxonomy.cdm.model.description.PolytomousKey; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; /** * @author n.hoffmann @@ -31,34 +32,36 @@ import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart; */ public class EditPolytomousKeyNodesHandler extends AbstractHandler { - /* (non-Javadoc) + protected static final String OPENING_POLYTOMOUS_KEYS = Messages.EditPolytomousKeyNodesHandler_OPEN_KEYS; + + /* (non-Javadoc) * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false); - - ISelection selection = view.getSite().getSelectionProvider().getSelection(); + + ISelection selection = view.getSite().getSelectionProvider().getSelection(); if(selection instanceof StructuredSelection){ - + final StructuredSelection structuredSelection = (StructuredSelection) selection; - - Job job = new Job("Opening Polytomous Keys"){ + + Job job = new Job(OPENING_POLYTOMOUS_KEYS){ @Override protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask("Opening Polytomous Keys", structuredSelection.size()); - + monitor.beginTask(OPENING_POLYTOMOUS_KEYS, structuredSelection.size()); + for(final Object selectedObject : structuredSelection.toArray()){ if(selectedObject instanceof PolytomousKey){ - + Display.getDefault().asyncExec(new Runnable(){ @Override - public void run() { + public void run() { NavigationUtil.openEditor((PolytomousKey) selectedObject); } - + }); monitor.worked(1); } @@ -66,12 +69,12 @@ public class EditPolytomousKeyNodesHandler extends AbstractHandler { monitor.done(); return Status.OK_STATUS; } - + }; - + job.setPriority(Job.SHORT); - job.schedule(); - + job.schedule(); + } return null; } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RefreshPolytomousKeyNodesHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RefreshPolytomousKeyNodesHandler.java index 5591e5433..cb1a2d05c 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RefreshPolytomousKeyNodesHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RefreshPolytomousKeyNodesHandler.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -20,14 +20,13 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; - import org.eclipse.swt.widgets.Display; - import eu.etaxonomy.cdm.model.description.PolytomousKey; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart; import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RefreshNodesOperation; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; @@ -40,29 +39,31 @@ import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; */ public class RefreshPolytomousKeyNodesHandler extends AbstractHandler implements IHandler { - @Override + private static final String REFRESHING_POLYTOMOUS_KEY_NODES = Messages.RefreshPolytomousKeyNodesHandler_REFRESHING; + + @Override public Object execute(ExecutionEvent event) throws ExecutionException { final PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false); final List keys = view.getKeys(); - - final String label = "Refresh Polytomous Key Nodes"; - + + final String label = Messages.RefreshPolytomousKeyNodesHandler_REFRESH; + final IUndoContext undoContext = NavigationUtil.getUndoContext(); if (keys.size() > 0) { - Job job = new Job("Refreshing Polytomous Key Nodes"){ - + Job job = new Job(REFRESHING_POLYTOMOUS_KEY_NODES){ + @Override protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask("Refreshing Polytomous Key Nodes", keys.size()); - - - for (final PolytomousKey key : keys) { + monitor.beginTask(REFRESHING_POLYTOMOUS_KEY_NODES, keys.size()); + + + for (final PolytomousKey key : keys) { if(key.getRoot() != null) { Display.getDefault().asyncExec(new Runnable(){ @Override - public void run() { + public void run() { AbstractPostOperation operation = new RefreshNodesOperation(label, undoContext, key, view); NavigationUtil.executeOperation(operation); } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingDeletePolytomousKeyHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingDeletePolytomousKeyHandler.java index 30313aa47..9adb3879f 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingDeletePolytomousKeyHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingDeletePolytomousKeyHandler.java @@ -57,7 +57,7 @@ public class RemotingDeletePolytomousKeyHandler extends RemotingCdmHandler { return Status.CANCEL_STATUS; } - boolean confirmation = MessagingUtils.confirmDialog("Confirm deletaion", "Do you want to delete the selected key" + (keysToDelete.size() == 1 ? "" : "s") + "?"); + boolean confirmation = MessagingUtils.confirmDialog(DeleteHandler.CONFIRM, DeleteHandler.CONFIRM_MESSAGE); if(!confirmation) { return Status.CANCEL_STATUS; diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingEditPolytomousKeyNodesHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingEditPolytomousKeyNodesHandler.java index 5c0f38a0c..2e5d3487b 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingEditPolytomousKeyNodesHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingEditPolytomousKeyNodesHandler.java @@ -45,11 +45,11 @@ public class RemotingEditPolytomousKeyNodesHandler extends AbstractHandler { final StructuredSelection structuredSelection = (StructuredSelection) selection; - Job job = new Job("Opening Polytomous Keys"){ + Job job = new Job(EditPolytomousKeyNodesHandler.OPENING_POLYTOMOUS_KEYS){ @Override protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask("Opening Polytomous Keys", structuredSelection.size()); + monitor.beginTask(EditPolytomousKeyNodesHandler.OPENING_POLYTOMOUS_KEYS, structuredSelection.size()); for(final Object selectedObject : structuredSelection.toArray()){ if(selectedObject instanceof PolytomousKey){ diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/DeleteOperation.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/DeleteOperation.java index 7223166e0..7df83b764 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/DeleteOperation.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/DeleteOperation.java @@ -20,6 +20,7 @@ import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.api.service.DeleteResult; import eu.etaxonomy.cdm.api.service.IPolytomousKeyService; import eu.etaxonomy.cdm.model.description.PolytomousKey; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; @@ -59,10 +60,10 @@ public class DeleteOperation extends AbstractPersistentPostOperation { DeleteResult result = CdmStore.getService(IPolytomousKeyService.class).delete(key); if (result.isError() && !result.getExceptions().isEmpty()){ - MessageDialog.openError(null, "Delete failed", result.getExceptions().iterator().next().getMessage()); + MessageDialog.openError(null, Messages.DeleteOperation_FAILED, result.getExceptions().iterator().next().getMessage()); }else if(result.isAbort()){ - MessageDialog.openWarning(null, "Delete abort", "The object could not be deleted, maybe there was no object selected."); + MessageDialog.openWarning(null, Messages.DeleteOperation_ABORT, Messages.DeleteOperation_ABORT_MESSAGE); } return postExecute(null); diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/RemotingDeletePolytomousKeyOperation.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/RemotingDeletePolytomousKeyOperation.java index 0493ca05e..5e38d5247 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/RemotingDeletePolytomousKeyOperation.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/RemotingDeletePolytomousKeyOperation.java @@ -18,6 +18,7 @@ import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action; import eu.etaxonomy.cdm.api.service.IPolytomousKeyService; import eu.etaxonomy.cdm.api.service.UpdateResult; import eu.etaxonomy.cdm.model.description.PolytomousKey; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -28,7 +29,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore; */ public class RemotingDeletePolytomousKeyOperation extends RemotingCdmUpdateOperation { - private final static String LABEL = "Delete Polytomous Key operation"; + private final static String LABEL = Messages.RemotingDeletePolytomousKeyOperation_DELETE_OP; private final List keysToDelete; /** diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/RemotingUpdatePolytomousKeyAllNodesOperation.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/RemotingUpdatePolytomousKeyAllNodesOperation.java index 240fa0370..30c01f1f3 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/RemotingUpdatePolytomousKeyAllNodesOperation.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/RemotingUpdatePolytomousKeyAllNodesOperation.java @@ -16,6 +16,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action; import eu.etaxonomy.cdm.api.service.IPolytomousKeyService; import eu.etaxonomy.cdm.api.service.UpdateResult; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -48,7 +49,7 @@ public class RemotingUpdatePolytomousKeyAllNodesOperation extends RemotingCdmUpd this.polytomousKeyUuid = null; } - private final static String LABEL = "Update All Polytomous Key Nodes operation"; + private final static String LABEL = Messages.RemotingUpdatePolytomousKeyAllNodesOperation_UPDATE_OP; /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/Messages.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/Messages.java new file mode 100644 index 000000000..a1db9fe52 --- /dev/null +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/Messages.java @@ -0,0 +1,185 @@ +/** + * Copyright (C) 2014 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.navigation.l10n; + +import org.eclipse.osgi.util.NLS; + +/** + * @author d.schild + * @date 18.06.2014 + * + */ +public class Messages extends NLS { + private static final String BUNDLE_NAME = "src/main/java/eu.etaxonomy.taxeditor.navigation.l10n.messages"; //$NON-NLS-1$ + public static String ChangeAcceptedTaxonToSynonymHandler_CHOOSE_TAXON; + public static String ChangeAcceptedTaxonToSynonymHandler_CREATE_FAILED; + public static String ChangeAcceptedTaxonToSynonymHandler_MOVE_SYNONYMY; + public static String ChangeAcceptedTaxonToSynonymHandler_MOVE_SYNONYMY_MESSAGE; + public static String ChangeAcceptedTaxonToSynonymHandler_PREREQUISITE; + public static String ChangeAcceptedTaxonToSynonymHandler_PREREQUISITE_MESSAGE; + public static String ChangeAcceptedTaxonToSynonymOperation_CREATE_FAIL; + public static String ChangeAcceptedTaxonToSynonymOperation_CREATE_SUCCESS; + public static String ChangeAcceptedTaxonToSynonymOperation_OP_FAIL; + public static String ClassificationLabelProvider_UNNAMED_TREE; + public static String CloneClassificationHandler_CLONE_CLASSIFICATION; + public static String CreateClassificationHierarchyHandler_CREATE_HIERARCHY; + public static String CreateClassificationHierarchyHandler_FAILED; + public static String CreateClassificationHierarchyHandler_FAILED_MESSAGE; + public static String CreateNewTaxonHierarchyOperation_ADD_HIERARCHY; + public static String CreateNewTaxonHierarchyOperation_ADD_HIERARCHY_MESSAGE; + public static String CreateTaxonNode_CREATE_FAILED; + public static String DeleteHandler_9; + public static String DeleteHandler_CONFIRM; + public static String DeleteHandler_CONFIRM_DELETE; + public static String DeleteHandler_CONFIRM_MESSAGE; + public static String DeleteHandler_DELETE_ALL; + public static String DeleteHandler_DELETE_CLASSIFICATION; + public static String DeleteHandler_DELETE_NODE; + public static String DeleteHandler_MOVE_TO_PARENT; + public static String DeleteHandler_SKIP; + public static String DeleteHandler_THERE_ARE_CHILDNODES; + public static String DeleteHandler_THERE_ARE_CHILDREN; + public static String DeleteOperation_ABORT; + public static String DeleteOperation_ABORT_MESSAGE; + public static String DeleteOperation_DELETE_FAIL; + public static String DeleteOperation_DELETE_SUCCESS; + public static String DeleteOperation_FAILED; + public static String EditPolytomousKeyNodesHandler_OPEN_KEYS; + public static String MoveFactualDataHandler_CHOOSE_TAXON; + public static String MoveFactualDataHandler_CREATE_FAILED; + public static String MoveFactualDataHandler_UNSAVED_SOURCE; + public static String MoveFactualDataHandler_UNSAVED_SOURCE_MESSAGE; + public static String MoveFactualDataHandler_UNSAVED_TARGET; + public static String MoveFactualDataHandler_UNSAVED_TARGET_MESSAGE; + public static String MoveTaxonHandler_CHOOSE_ABOVE; + public static String MoveTaxonHandler_CHOOSE_PARENT; + public static String MoveTaxonHandler_MOVE_TO_PARENT; + public static String MoveTaxonHandler_TARGET_NODE; + public static String MoveTaxonHandler_TARGET_NODE_MESSAGE; + public static String MoveTaxonHandler_UNSAVED_PARENT; + public static String MoveTaxonHandler_UNSAVED_PARENT_MESSAGE; + public static String MoveTaxonOperation_NOT_IMPLEMENTED; + public static String NavigationUtil_CREATE_FAILED; + public static String NavigationUtil_INCORRECT_STATE; + public static String NavigationUtil_INCORRECT_STATE_MESSAGE; + public static String NavigationUtil_MULTI_TREE; + public static String NavigationUtil_NOT_FOUND; + public static String NavigationUtil_NOT_FOUND_MESSAGE; + public static String NavigationUtil_NOT_IMPLEMENTED; + public static String NavigationUtil_OPEN_ERROR; + public static String NavigationUtil_ORPHAN_NAME_MESSAGE; + public static String NavigationUtil_ORPHAN_TAXON; + public static String NavigationUtil_UNKNOWN_TYPE; + public static String NavigationUtil_UNKNOWN_TYPE_MESSAGE; + public static String NavigationUtil_UNSUPPORTED_TYPE; + public static String NavigationUtil_UNSUPPORTED_TYPE_MESSAGE; + public static String PolytomousKeyViewLabels_DELETE; + public static String PolytomousKeyViewLabels_OPEN_ERROR; + public static String PolytomousKeyViewLabels_UPDATE; + public static String PolytomousKeyViewPart_EXCEPTION; + public static String PolytomousKeyViewPart_INIT; + public static String PolytomousKeyViewPart_SHUTDOWN; + public static String PolytomousKeyViewPartDataChangeBehavior_CLEAR; + public static String PolytomousKeyViewPartDataChangeBehavior_REFRESH; + public static String PolytomousKeyViewPartDataChangeBehavior_UPDATE; + public static String RefreshPolytomousKeyNodesHandler_REFRESH; + public static String RefreshPolytomousKeyNodesHandler_REFRESHING; + public static String RemotingChangeAcceptedTaxonToSynonymHandler_CHOOSE_TAXON; + public static String RemotingChangeAcceptedTaxonToSynonymOperation_CHANGE_OP; + public static String RemotingDeletePolytomousKeyOperation_DELETE_OP; + public static String RemotingDeleteTaxonNodeHandler_NODE_DELETED; + public static String RemotingDeleteTaxonNodeHandler_NODE_DELETED_MESSAGE; + public static String RemotingDeleteTaxonNodeOperation_DELETE_OP; + public static String RemotingMoveFactualDataHandler_CHOOSE_TAXA; + public static String RemotingMoveFactualDataHandler_CREATE_FAILED; + public static String RemotingMoveFactualDataOperation_MOVE_OP; + public static String RemotingMoveTaxonNodeHandler_BEHIND; + public static String RemotingMoveTaxonNodeHandler_CANCEL; + public static String RemotingMoveTaxonNodeHandler_CHILD; + public static String RemotingMoveTaxonNodeHandler_CHOOSE_PARENT; + public static String RemotingMoveTaxonNodeHandler_CHOOSE_TAXON; + public static String RemotingMoveTaxonNodeHandler_TARGET_NODE; + public static String RemotingMoveTaxonNodeHandler_TARGET_NODE_MESSAGE; + public static String RemotingMoveTaxonNodeHandler_UNSAVED_PARENT; + public static String RemotingMoveTaxonNodeHandler_UNSAVED_PARENT_MESSAGE; + public static String RemotingMoveTaxonOperation_MOVE_OP; + public static String RemotingUpdatePolytomousKeyAllNodesOperation_UPDATE_OP; + public static String Root_CREATE_CLASSIFICATION; + public static String Root_MY_CLASSIFICATION; + public static String SearchBar_0; + public static String SearchBar_1; + public static String SearchBar_2; + public static String SearchBar_3; + public static String SearchBar_4; + public static String SearchBar_6; + public static String SearchBar_7; + public static String SearchBar_8; + public static String SearchBar_9; + public static String SearchResultLabelProvider_NAME; + public static String SearchResultLabelProvider_SYNONYM; + public static String SearchResultLabelProvider_TAXON; + public static String SearchResultView_CANCELLED; + public static String SearchResultView_CNT_ENTITIES_FOUND; + public static String SearchResultView_NO_RESULTS; + public static String SearchResultView_PERFORMING_SEARCH; + public static String SearchResultView_REMOVE_SEARCH_RESULTS; + public static String SearchResultView_SEARCH; + public static String SearchResultView_SEARCH_FOR; + public static String SearchResultView_SEARCH_STRING; + public static String SearchResultView_SEARCHING; + public static String SearchResultView_STATUS; + public static String SetSecundumForSubtreeOperation_CHANGE_SEC_OP; + public static String SetSecundumForSubtreeOperation_SET_SEC_TASK; + public static String TaxonLinkHelper_CREATE_FAIL; + + public static String TaxonNavigator_LOAD_DATASOURCE; + public static String TaxonNavigator_RESTORE; + public static String TaxonNavigator_SAVE_TASK; + public static String TaxonNavigator_TAXON_TREE; + + public static String TaxonNavigatorDataChangeBehavior_CLEAR_SESSION; + public static String TaxonNavigatorDataChangeBehavior_REFRESH_VIEWER; + public static String TaxonNavigatorDataChangeBehavior_UPDATE_NAVIGATOR; + public static String TaxonNavigatorLabels_CHANGE_ACC_TAXON; + public static String TaxonNavigatorLabels_CLOSE_IMPOSSIBLE; + public static String TaxonNavigatorLabels_DELETE_TAXON; + + public static String TaxonNavigatorLabels_MOVE_FACTUAL_DATA; + public static String TaxonNavigatorLabels_MOVE_TAXON; + public static String TaxonNavigatorLabels_NO_CHILDREN_ALLOWED; + public static String TaxonNavigatorLabels_NOT_A_NODE; + public static String TaxonNavigatorLabels_NOT_TAXON_SELECTED; + public static String TaxonNavigatorLabels_ONLY_SINGLE_TAXON; + public static String TaxonNavigatorLabels_SET_SEC_FOR_CHILDREN; + public static String TaxonNavigatorLabels_UNSAVED_CHANGES; + + public static String TaxonNodeLabelProvider_NO_TAXON; + public static String TaxonNodeLabelProvider_NODE_WITH_NO_TAXON; + public static String TaxonNodeLabelProvider_TAXON; + + public static String TreeNodeDropAdapter_10; + public static String TreeNodeDropAdapter_BEHIND; + public static String TreeNodeDropAdapter_CANCEL; + public static String TreeNodeDropAdapter_CHILD; + public static String TreeNodeDropAdapter_MOVE_BEHIND; + public static String TreeNodeDropAdapter_MOVE_TAXON; + public static String TreeNodeDropAdapter_MOVING; + public static String TreeNodeDropAdapter_MOVING_MESSAGE; + public static String TreeNodeDropAdapter_TARGET_NODE; + public static String TreeNodeDropAdapter_UNSAVED_PARENT; + public static String TreeNodeDropAdapter_UNSAVED_PARENT_MESSAGE; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages.properties b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages.properties new file mode 100644 index 000000000..8fe81b987 --- /dev/null +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages.properties @@ -0,0 +1,152 @@ +ChangeAcceptedTaxonToSynonymHandler_CHOOSE_TAXON=Choose the accepted taxon +ChangeAcceptedTaxonToSynonymHandler_CREATE_FAILED=Could not create Taxon +ChangeAcceptedTaxonToSynonymHandler_MOVE_SYNONYMY=Moving to synonymy +ChangeAcceptedTaxonToSynonymHandler_MOVE_SYNONYMY_MESSAGE=The operation move accepted taxon to synonymy is available only for a single taxon. +ChangeAcceptedTaxonToSynonymHandler_PREREQUISITE=Prerequisite not met +ChangeAcceptedTaxonToSynonymHandler_PREREQUISITE_MESSAGE=The accepted taxon must not have any childen. You need to move all childen to another taxon node in the TaxonNavigator before attempting to turn the accepted taxon into a synonym. +ChangeAcceptedTaxonToSynonymOperation_CREATE_FAIL=Synonym creation not possible +ChangeAcceptedTaxonToSynonymOperation_CREATE_SUCCESS=Synonym created but taxon deletion not possible. +ChangeAcceptedTaxonToSynonymOperation_OP_FAIL=Operation failed +ClassificationLabelProvider_UNNAMED_TREE=Unnamed Taxonomic Tree +CloneClassificationHandler_CLONE_CLASSIFICATION=Clone classification +CreateClassificationHierarchyHandler_CREATE_HIERARCHY=Create Taxon Hierarchy +CreateClassificationHierarchyHandler_FAILED=Failed to open Editor +CreateClassificationHierarchyHandler_FAILED_MESSAGE=Could not open distribution view. The hierarchy is corrupted\! +CreateNewTaxonHierarchyOperation_ADD_HIERARCHY=Add Hierarchy successful +CreateNewTaxonHierarchyOperation_ADD_HIERARCHY_MESSAGE=New classification is %s\nCreated Genus: %d\nCreated Subspecies: %d +CreateTaxonNode_CREATE_FAILED=Could not create taxon node +DeleteHandler_9=Command name not set +DeleteHandler_CONFIRM=Confirm deletion +DeleteHandler_CONFIRM_DELETE=Confirm Deletion +DeleteHandler_CONFIRM_MESSAGE=Do you want to delete the selected key(s)? +DeleteHandler_DELETE_ALL=Delete all children +DeleteHandler_DELETE_CLASSIFICATION=Do you really want to delete the classification? +DeleteHandler_DELETE_NODE=Do you really want to delete the selected node(s)? +DeleteHandler_MOVE_TO_PARENT=Move children to parent node +DeleteHandler_SKIP=Skip +DeleteHandler_THERE_ARE_CHILDNODES=\ There are childnodes, which will be deleted, too. +DeleteHandler_THERE_ARE_CHILDREN=\ The tree has children, they will be deleted, too. +DeleteOperation_ABORT=Delete abort +DeleteOperation_ABORT_MESSAGE=The object could not be deleted, maybe there was no object selected. +DeleteOperation_DELETE_FAIL=TaxonNode could not be deleted. +DeleteOperation_DELETE_SUCCESS=TaxonNode was successfully deleted, but related object(s) could not be deleted +DeleteOperation_FAILED=Delete failed +EditPolytomousKeyNodesHandler_OPEN_KEYS=Opening Polytomous Keys +MoveFactualDataHandler_CHOOSE_TAXON=Choose the accepted taxon +MoveFactualDataHandler_CREATE_FAILED=Could not create Taxon +MoveFactualDataHandler_UNSAVED_SOURCE=Unsaved Source Taxon +MoveFactualDataHandler_UNSAVED_SOURCE_MESSAGE=There are unsaved changes in the source taxon. Please save first. +MoveFactualDataHandler_UNSAVED_TARGET=Unsaved Target Taxon +MoveFactualDataHandler_UNSAVED_TARGET_MESSAGE=There are unsaved changes in the target taxon. Please save first. +MoveTaxonHandler_CHOOSE_ABOVE=Choose the taxon above the moved taxon. +MoveTaxonHandler_CHOOSE_PARENT=Choose new parent +MoveTaxonHandler_MOVE_TO_PARENT=Move taxon to new parent +MoveTaxonHandler_TARGET_NODE=Target node +MoveTaxonHandler_TARGET_NODE_MESSAGE=The choosen target node should be the parent? +MoveTaxonHandler_UNSAVED_PARENT=Unsaved Parent Taxon +MoveTaxonHandler_UNSAVED_PARENT_MESSAGE=There are unsaved changes in the parent taxon. Please save first. +MoveTaxonOperation_NOT_IMPLEMENTED=Not implemented yet. +NavigationUtil_CREATE_FAILED=Could not create Taxon +NavigationUtil_INCORRECT_STATE=Incorrect state +NavigationUtil_INCORRECT_STATE_MESSAGE=The accepted taxon is not in a taxonomic view. This should not have happened. +NavigationUtil_MULTI_TREE=The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open. This case is not handled yet by the software. +NavigationUtil_NOT_FOUND=Cdm entity not found +NavigationUtil_NOT_FOUND_MESSAGE=CDM entity could not be found in the database. +NavigationUtil_NOT_IMPLEMENTED=Not implemented yet +NavigationUtil_OPEN_ERROR=Error opening the editor +NavigationUtil_ORPHAN_NAME_MESSAGE=You chose to open a name that has no connection to a taxon. The Editor does not support editing of such a content type at the moment. +NavigationUtil_ORPHAN_TAXON=This taxon is not connected to a classification. Currently editing of such taxa is not supported yet. +NavigationUtil_UNKNOWN_TYPE=Unknown type +NavigationUtil_UNKNOWN_TYPE_MESSAGE=There is no editor available to open this object. +NavigationUtil_UNSUPPORTED_TYPE=Unsupported Type +NavigationUtil_UNSUPPORTED_TYPE_MESSAGE=No editor exists for the current selection: +PolytomousKeyViewLabels_DELETE=Delete Polytomous Key +PolytomousKeyViewLabels_OPEN_ERROR=Error opening Polytomous Key Editor +PolytomousKeyViewLabels_UPDATE=Update All Polytomous Key Nodes +PolytomousKeyViewPart_EXCEPTION=An exception occured while trying to open a selection +PolytomousKeyViewPart_INIT=Initiating Polytomous Key Viewer +PolytomousKeyViewPart_SHUTDOWN=Shutting down Polytomous Key Viewer +PolytomousKeyViewPartDataChangeBehavior_CLEAR=Clearing Polytomous Key Viewer session +PolytomousKeyViewPartDataChangeBehavior_REFRESH=Refreshing viewer +PolytomousKeyViewPartDataChangeBehavior_UPDATE=Updating Polytomous Key Viewer +RefreshPolytomousKeyNodesHandler_REFRESH=Refresh Polytomous Key Nodes +RefreshPolytomousKeyNodesHandler_REFRESHING=Refreshing Polytomous Key Nodes +RemotingChangeAcceptedTaxonToSynonymHandler_CHOOSE_TAXON=Choose the accepted taxon +RemotingChangeAcceptedTaxonToSynonymOperation_CHANGE_OP=Change Accepted Taxon to Synonym operation +RemotingDeletePolytomousKeyOperation_DELETE_OP=Delete Polytomous Key operation +RemotingDeleteTaxonNodeHandler_NODE_DELETED=Node already deleted +RemotingDeleteTaxonNodeHandler_NODE_DELETED_MESSAGE=The taxon node was already deleted. Please reopen the taxon navigator to refresh the view. +RemotingDeleteTaxonNodeOperation_DELETE_OP=Delete Taxon Node operation +RemotingMoveFactualDataHandler_CHOOSE_TAXA=Choose the accepted taxon +RemotingMoveFactualDataHandler_CREATE_FAILED=Could not create Taxon +RemotingMoveFactualDataOperation_MOVE_OP=Move Factual Data operation +RemotingMoveTaxonNodeHandler_BEHIND=Behind +RemotingMoveTaxonNodeHandler_CANCEL=Cancel +RemotingMoveTaxonNodeHandler_CHILD=Child +RemotingMoveTaxonNodeHandler_CHOOSE_PARENT=Choose new parent +RemotingMoveTaxonNodeHandler_CHOOSE_TAXON=Choose the taxon above the moved taxon. +RemotingMoveTaxonNodeHandler_TARGET_NODE=Target node +RemotingMoveTaxonNodeHandler_TARGET_NODE_MESSAGE=Do you want to move the Taxonnode as child or behind the target node. +RemotingMoveTaxonNodeHandler_UNSAVED_PARENT=Unsaved Parent Taxon +RemotingMoveTaxonNodeHandler_UNSAVED_PARENT_MESSAGE=There are unsaved changes in the parent taxon. Please save first. +RemotingMoveTaxonOperation_MOVE_OP=Move Taxon operation +RemotingUpdatePolytomousKeyAllNodesOperation_UPDATE_OP=Update All Polytomous Key Nodes operation +Root_CREATE_CLASSIFICATION=Creating initial classification +Root_MY_CLASSIFICATION=My Classification +SearchBar_0=Use "*" for wildcard searching +SearchBar_1=Search +SearchBar_2=Could not execute search +SearchBar_3=Please type at least one character +SearchBar_4=Error opening search result. +SearchBar_6=Taxa +SearchBar_7=Synonyms +SearchBar_8=Names (without taxa) +SearchBar_9=Common Names +SearchResultLabelProvider_NAME=Name: +SearchResultLabelProvider_SYNONYM=Synonym: +SearchResultLabelProvider_TAXON=Taxon: +SearchResultView_CANCELLED=Cancelled +SearchResultView_CNT_ENTITIES_FOUND=%d entities found +SearchResultView_NO_RESULTS=Search returned no results +SearchResultView_PERFORMING_SEARCH=Performing Search +SearchResultView_REMOVE_SEARCH_RESULTS=Getting rid of search results +SearchResultView_SEARCH=Search: '%s' +SearchResultView_SEARCH_FOR=Search for: +SearchResultView_SEARCH_STRING=Search String: +SearchResultView_SEARCHING=Searching... +SearchResultView_STATUS=Status: +SetSecundumForSubtreeOperation_CHANGE_SEC_OP=Change secundum reference for all children +SetSecundumForSubtreeOperation_SET_SEC_TASK=Set secundum reference for subtree +TaxonLinkHelper_CREATE_FAIL=Could not create Taxon +TaxonNavigator_LOAD_DATASOURCE=Loading datasources +TaxonNavigator_RESTORE=Restoring Taxon Navigator +TaxonNavigator_SAVE_TASK=Saving Taxon Navigator State +TaxonNavigator_TAXON_TREE=Taxonomic Tree +TaxonNavigatorDataChangeBehavior_CLEAR_SESSION=Clearing Taxon Navigators session +TaxonNavigatorDataChangeBehavior_REFRESH_VIEWER=Refreshing viewer +TaxonNavigatorDataChangeBehavior_UPDATE_NAVIGATOR=Updating Taxon Navigator +TaxonNavigatorLabels_CHANGE_ACC_TAXON=Change Accepted Taxon to Synonym +TaxonNavigatorLabels_CLOSE_IMPOSSIBLE=Could not close related taxon name editor. Please close it manually and try again. +TaxonNavigatorLabels_DELETE_TAXON=Delete Taxon Node +TaxonNavigatorLabels_MOVE_FACTUAL_DATA=Move Factual Data +TaxonNavigatorLabels_MOVE_TAXON=Move Taxon +TaxonNavigatorLabels_NO_CHILDREN_ALLOWED=The chosen taxon must not have any childen. You need to move all childen to another taxon node in the TaxonNavigator before attempting to turn the accepted taxon into a synonym. +TaxonNavigatorLabels_NOT_A_NODE=Selected object is not a taxon tree node +TaxonNavigatorLabels_NOT_TAXON_SELECTED=No taxon tree node selected for operation. +TaxonNavigatorLabels_ONLY_SINGLE_TAXON=The chosen operation is available only for a single taxon. +TaxonNavigatorLabels_SET_SEC_FOR_CHILDREN=Set new Secundum Reference for all children. +TaxonNavigatorLabels_UNSAVED_CHANGES=There are unsaved changes in the source taxon. Please save first. +TaxonNodeLabelProvider_NO_TAXON=>NO TAXON< +TaxonNodeLabelProvider_NODE_WITH_NO_TAXON=The taxon node does not have a taxon attached to it. Please check your import. TaxonNode: %s +TaxonNodeLabelProvider_TAXON=Taxon: +TreeNodeDropAdapter_10=\ +TreeNodeDropAdapter_BEHIND=Behind +TreeNodeDropAdapter_CANCEL=Cancel +TreeNodeDropAdapter_CHILD=Child +TreeNodeDropAdapter_MOVE_BEHIND=Do you want to move the Taxonnode as child or behind the target node. +TreeNodeDropAdapter_MOVE_TAXON=Move Taxon +TreeNodeDropAdapter_MOVING=Moving taxon +TreeNodeDropAdapter_MOVING_MESSAGE=The operation move accepted taxon to other parent is available only for a single taxon. +TreeNodeDropAdapter_TARGET_NODE=Target node +TreeNodeDropAdapter_UNSAVED_PARENT=Unsaved Parent Taxon +TreeNodeDropAdapter_UNSAVED_PARENT_MESSAGE=There are unsaved changes in the parent taxon. Pleas save first. diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages_de.properties b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages_de.properties new file mode 100644 index 000000000..b94050fe6 --- /dev/null +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages_de.properties @@ -0,0 +1,153 @@ +ChangeAcceptedTaxonToSynonymHandler_CHOOSE_TAXON=Choose the accepted taxon +ChangeAcceptedTaxonToSynonymHandler_CREATE_FAILED=Could not create Taxon +ChangeAcceptedTaxonToSynonymHandler_MOVE_SYNONYMY=Moving to synonymy +ChangeAcceptedTaxonToSynonymHandler_MOVE_SYNONYMY_MESSAGE=The operation move accepted taxon to synonymy is available only for a single taxon. +ChangeAcceptedTaxonToSynonymHandler_PREREQUISITE=Prerequisite not met +ChangeAcceptedTaxonToSynonymHandler_PREREQUISITE_MESSAGE=The accepted taxon must not have any childen. You need to move all childen to another taxon node in the TaxonNavigator before attempting to turn the accepted taxon into a synonym. +ChangeAcceptedTaxonToSynonymOperation_CREATE_FAIL=Synonym creation not possible +ChangeAcceptedTaxonToSynonymOperation_CREATE_SUCCESS=Synonym created but taxon deletion not possible. +ChangeAcceptedTaxonToSynonymOperation_OP_FAIL=Operation failed +ClassificationLabelProvider_UNNAMED_TREE=Unnamed Taxonomic Tree +CloneClassificationHandler_CLONE_CLASSIFICATION=Clone classification +CreateClassificationHierarchyHandler_CREATE_HIERARCHY=Create Taxon Hierarchy +CreateClassificationHierarchyHandler_FAILED=Failed to open Editor +CreateClassificationHierarchyHandler_FAILED_MESSAGE=Could not open distribution view. The hierarchy is corrupted\! +CreateNewTaxonHierarchyOperation_ADD_HIERARCHY=Add Hierarchy successful +CreateNewTaxonHierarchyOperation_ADD_HIERARCHY_MESSAGE=New classification is %s\nCreated Genus: %d\nCreated Subspecies: %d +CreateTaxonNode_CREATE_FAILED=Could not create taxon node +DeleteHandler_9=Command name not set +DeleteHandler_CONFIRM=Confirm deletion +DeleteHandler_CONFIRM_DELETE=Confirm Deletion +DeleteHandler_CONFIRM_MESSAGE=Do you want to delete the selected key(s)? +DeleteHandler_DELETE_ALL=Delete all children +DeleteHandler_DELETE_CLASSIFICATION=Do you really want to delete the classification? +DeleteHandler_DELETE_NODE=Do you really want to delete the selected node(s)? +DeleteHandler_MOVE_TO_PARENT=Move children to parent node +DeleteHandler_SKIP=Skip +DeleteHandler_THERE_ARE_CHILDNODES=\ There are childnodes, which will be deleted, too. +DeleteHandler_THERE_ARE_CHILDREN=\ The tree has children, they will be deleted, too. +DeleteOperation_ABORT=Delete abort +DeleteOperation_ABORT_MESSAGE=The object could not be deleted, maybe there was no object selected. +DeleteOperation_DELETE_FAIL=TaxonNode could not be deleted. +DeleteOperation_DELETE_SUCCESS=TaxonNode was successfully deleted, but related object(s) could not be deleted +DeleteOperation_FAILED=Delete failed +EditPolytomousKeyNodesHandler_OPEN_KEYS=Opening Polytomous Keys +MoveFactualDataHandler_CHOOSE_TAXON=Choose the accepted taxon +MoveFactualDataHandler_CREATE_FAILED=Could not create Taxon +MoveFactualDataHandler_UNSAVED_SOURCE=Unsaved Source Taxon +MoveFactualDataHandler_UNSAVED_SOURCE_MESSAGE=There are unsaved changes in the source taxon. Please save first. +MoveFactualDataHandler_UNSAVED_TARGET=Unsaved Target Taxon +MoveFactualDataHandler_UNSAVED_TARGET_MESSAGE=There are unsaved changes in the target taxon. Please save first. +MoveTaxonHandler_CHOOSE_ABOVE=Choose the taxon above the moved taxon. +MoveTaxonHandler_CHOOSE_PARENT=Choose new parent +MoveTaxonHandler_MOVE_TO_PARENT=Move taxon to new parent +MoveTaxonHandler_TARGET_NODE=Target node +MoveTaxonHandler_TARGET_NODE_MESSAGE=The choosen target node should be the parent? +MoveTaxonHandler_UNSAVED_PARENT=Unsaved Parent Taxon +MoveTaxonHandler_UNSAVED_PARENT_MESSAGE=There are unsaved changes in the parent taxon. Please save first. +MoveTaxonOperation_NOT_IMPLEMENTED=Not implemented yet. +NavigationUtil_CREATE_FAILED=Could not create Taxon +NavigationUtil_INCORRECT_STATE=Incorrect state +NavigationUtil_INCORRECT_STATE_MESSAGE=The accepted taxon is not in a taxonomic view. This should not have happened. +NavigationUtil_MULTI_TREE=The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open. This case is not handled yet by the software. +NavigationUtil_NOT_FOUND=Cdm entity not found +NavigationUtil_NOT_FOUND_MESSAGE=CDM entity could not be found in the database. +NavigationUtil_NOT_IMPLEMENTED=Not implemented yet +NavigationUtil_OPEN_ERROR=Error opening the editor +NavigationUtil_ORPHAN_NAME_MESSAGE=You chose to open a name that has no connection to a taxon. The Editor does not support editing of such a content type at the moment. +NavigationUtil_ORPHAN_TAXON=This taxon is not connected to a classification. Currently editing of such taxa is not supported yet. +NavigationUtil_UNKNOWN_TYPE=Unknown type +NavigationUtil_UNKNOWN_TYPE_MESSAGE=There is no editor available to open this object. +NavigationUtil_UNSUPPORTED_TYPE=Unsupported Type +NavigationUtil_UNSUPPORTED_TYPE_MESSAGE=No editor exists for the current selection: +PolytomousKeyViewLabels_DELETE=Delete Polytomous Key +PolytomousKeyViewLabels_OPEN_ERROR=Error opening Polytomous Key Editor +PolytomousKeyViewLabels_UPDATE=Update All Polytomous Key Nodes +PolytomousKeyViewPart_EXCEPTION=An exception occured while trying to open a selection +PolytomousKeyViewPart_INIT=Initiating Polytomous Key Viewer +PolytomousKeyViewPart_SHUTDOWN=Shutting down Polytomous Key Viewer +PolytomousKeyViewPartDataChangeBehavior_CLEAR=Clearing Polytomous Key Viewer session +PolytomousKeyViewPartDataChangeBehavior_REFRESH=Refreshing viewer +PolytomousKeyViewPartDataChangeBehavior_UPDATE=Updating Polytomous Key Viewer +RefreshPolytomousKeyNodesHandler_REFRESH=Refresh Polytomous Key Nodes +RefreshPolytomousKeyNodesHandler_REFRESHING=Refreshing Polytomous Key Nodes +RemotingChangeAcceptedTaxonToSynonymHandler_CHOOSE_TAXON=Choose the accepted taxon +RemotingChangeAcceptedTaxonToSynonymOperation_CHANGE_OP=Change Accepted Taxon to Synonym operation +RemotingDeletePolytomousKeyOperation_DELETE_OP=Delete Polytomous Key operation +RemotingDeleteTaxonNodeHandler_NODE_DELETED=Node already deleted +RemotingDeleteTaxonNodeHandler_NODE_DELETED_MESSAGE=The taxon node was already deleted. Please reopen the taxon navigator to refresh the view. +RemotingDeleteTaxonNodeOperation_DELETE_OP=Delete Taxon Node operation +RemotingMoveFactualDataHandler_CHOOSE_TAXA=Choose the accepted taxon +RemotingMoveFactualDataHandler_CREATE_FAILED=Could not create Taxon +RemotingMoveFactualDataOperation_MOVE_OP=Move Factual Data operation +RemotingMoveTaxonNodeHandler_BEHIND=Behind +RemotingMoveTaxonNodeHandler_CANCEL=Cancel +RemotingMoveTaxonNodeHandler_CHILD=Child +RemotingMoveTaxonNodeHandler_CHOOSE_PARENT=Choose new parent +RemotingMoveTaxonNodeHandler_CHOOSE_TAXON=Choose the taxon above the moved taxon. +RemotingMoveTaxonNodeHandler_TARGET_NODE=Target node +RemotingMoveTaxonNodeHandler_TARGET_NODE_MESSAGE=Do you want to move the Taxonnode as child or behind the target node. +RemotingMoveTaxonNodeHandler_UNSAVED_PARENT=Unsaved Parent Taxon +RemotingMoveTaxonNodeHandler_UNSAVED_PARENT_MESSAGE=There are unsaved changes in the parent taxon. Please save first. +RemotingMoveTaxonOperation_MOVE_OP=Move Taxon operation +RemotingUpdatePolytomousKeyAllNodesOperation_UPDATE_OP=Update All Polytomous Key Nodes operation +Root_CREATE_CLASSIFICATION=Creating initial classification +Root_MY_CLASSIFICATION=My Classification +SearchBar_0=Benutze "*" f\u00FCr Platzhalter-Suche +SearchBar_1=Suche +SearchBar_2=Suche konnte nicht ausgef\u00FChrt werden +SearchBar_3=Bitte geben Sie mindestens einen Buchstaben ein +SearchBar_4=Fehler beim f\u00fcffnen des Suchergebnisses +SearchBar_6=Taxa +SearchBar_7=Synonyme +SearchBar_8=Namen (ohne Taxa) +SearchBar_9=Umgangsprachliche Namen +SearchResultLabelProvider_NAME=Name: +SearchResultLabelProvider_SYNONYM=Synonym: +SearchResultLabelProvider_TAXON=Taxon: +SearchResultView_CANCELLED=Cancelled +SearchResultView_CNT_ENTITIES_FOUND=%d entities found +SearchResultView_NO_RESULTS=Search returned no results +SearchResultView_PERFORMING_SEARCH=Performing Search +SearchResultView_REMOVE_SEARCH_RESULTS=Getting rid of search results +SearchResultView_SEARCH=Search: '%s' +SearchResultView_SEARCH_FOR=Search for: +SearchResultView_SEARCH_STRING=Search String: +SearchResultView_SEARCHING=Searching... +SearchResultView_STATUS=Status: +SetSecundumForSubtreeOperation_CHANGE_SEC_OP=Change secundum reference for all children +SetSecundumForSubtreeOperation_SET_SEC_TASK=Set secundum reference for subtree +TaxonLinkHelper_CREATE_FAIL=Could not create Taxon +TaxonNavigator_LOAD_DATASOURCE=Loading datasources +TaxonNavigator_RESTORE=Restoring Taxon Navigator +TaxonNavigator_SAVE_TASK=Saving Taxon Navigator State +TaxonNavigator_TAXON_TREE=Taxonomic Tree +TaxonNavigatorDataChangeBehavior_CLEAR_SESSION=Clearing Taxon Navigators session +TaxonNavigatorDataChangeBehavior_REFRESH_VIEWER=Refreshing viewer +TaxonNavigatorDataChangeBehavior_UPDATE_NAVIGATOR=Updating Taxon Navigator +TaxonNavigatorLabels_CHANGE_ACC_TAXON=Change Accepted Taxon to Synonym +TaxonNavigatorLabels_CLOSE_IMPOSSIBLE=Could not close related taxon name editor. Please close it manually and try again. +TaxonNavigatorLabels_DELETE_TAXON=Delete Taxon Node +TaxonNavigatorLabels_MOVE_FACTUAL_DATA=Move Factual Data +TaxonNavigatorLabels_MOVE_TAXON=Move Taxon +TaxonNavigatorLabels_NO_CHILDREN_ALLOWED=The chosen taxon must not have any childen. You need to move all childen to another taxon node in the TaxonNavigator before attempting to turn the accepted taxon into a synonym. +TaxonNavigatorLabels_NOT_A_NODE=Selected object is not a taxon tree node +TaxonNavigatorLabels_NOT_TAXON_SELECTED=No taxon tree node selected for operation. +TaxonNavigatorLabels_ONLY_SINGLE_TAXON=The chosen operation is available only for a single taxon. +TaxonNavigatorLabels_SET_SEC_FOR_CHILDREN=Set new Secundum Reference for all children. +TaxonNavigatorLabels_UNSAVED_CHANGES=There are unsaved changes in the source taxon. Please save first. +TaxonNodeLabelProvider_NO_TAXON=>NO TAXON< +TaxonNodeLabelProvider_NODE_WITH_NO_TAXON=The taxon node does not have a taxon attached to it. Please check your import. TaxonNode: %s +TaxonNodeLabelProvider_TAXON=Taxon: +TreeNodeDropAdapter_10=\ +TreeNodeDropAdapter_BEHIND=Behind +TreeNodeDropAdapter_CANCEL=Cancel +TreeNodeDropAdapter_CHILD=Child +TreeNodeDropAdapter_MOVE_BEHIND=Do you want to move the Taxonnode as child or behind the target node. +TreeNodeDropAdapter_MOVE_TAXON=Move Taxon +TreeNodeDropAdapter_MOVING=Moving taxon +TreeNodeDropAdapter_MOVING_MESSAGE=The operation move accepted taxon to other parent is available only for a single taxon. +TreeNodeDropAdapter_TARGET_NODE=Target node +TreeNodeDropAdapter_UNSAVED_PARENT=Unsaved Parent Taxon +TreeNodeDropAdapter_UNSAVED_PARENT_MESSAGE=There are unsaved changes in the parent taxon. Pleas save first. + diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/ClassificationLabelProvider.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/ClassificationLabelProvider.java index 69d60b347..81f007d34 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/ClassificationLabelProvider.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/ClassificationLabelProvider.java @@ -18,6 +18,7 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.ui.navigator.IDescriptionProvider; import eu.etaxonomy.cdm.model.taxon.Classification; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; /** *

ClassificationLabelProvider class.

@@ -48,7 +49,7 @@ implements ILabelProvider, IDescriptionProvider, IStyledLabelProvider { public String getText(Object element) { if(element instanceof Classification){ String text = ((Classification) element).getName().getText(); - return text != null ? text : "Unnamed Taxonomic Tree"; + return text != null ? text : Messages.ClassificationLabelProvider_UNNAMED_TREE; } return new String(); } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/Root.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/Root.java index 89f77b530..e0befd28b 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/Root.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/Root.java @@ -24,6 +24,7 @@ import eu.etaxonomy.cdm.api.service.IClassificationService; import eu.etaxonomy.cdm.model.taxon.Classification; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.operation.CreateClassification; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -55,14 +56,14 @@ public class Root extends PlatformObject implements IAdaptable, IPersistableElem */ public List getParentBeans() { List propertyPaths = Arrays.asList(new String[]{ - "name", - "rootNode.childNodes"}); + "name", //$NON-NLS-1$ + "rootNode.childNodes"}); //$NON-NLS-1$ List classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, propertyPaths); if(classifications.size() == 0){ - Classification classification = Classification.NewInstance("My Classification"); - AbstractPostOperation operation = new CreateClassification("Creating initial classification", NavigationUtil.getUndoContext(), classification, NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false)); + Classification classification = Classification.NewInstance(Messages.Root_MY_CLASSIFICATION); + AbstractPostOperation operation = new CreateClassification(Messages.Root_CREATE_CLASSIFICATION, NavigationUtil.getUndoContext(), classification, NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false)); NavigationUtil.executeOperation(operation); classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, propertyPaths); diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/SynonymLabelProvider.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/SynonymLabelProvider.java index ae6bc1a06..95de96f28 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/SynonymLabelProvider.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/SynonymLabelProvider.java @@ -46,7 +46,7 @@ public class SynonymLabelProvider extends ColumnLabelProvider if (element instanceof Synonym && ((Synonym) element).getName() != null) { - return "= " + ((Synonym) element).getName().getTitleCache(); + return "= " + ((Synonym) element).getName().getTitleCache(); //$NON-NLS-1$ } return new String(); } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonLinkHelper.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonLinkHelper.java index a57b25197..e3b95583f 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonLinkHelper.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonLinkHelper.java @@ -18,6 +18,7 @@ import org.eclipse.ui.navigator.ILinkHelper; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; import eu.etaxonomy.taxeditor.model.MessagingUtils; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; /** * When a taxon is open in an editor and this editor has focus, its entry in the @@ -55,7 +56,7 @@ public class TaxonLinkHelper implements ILinkHelper { // } // } } catch (Exception e) { - MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage()); + MessagingUtils.warningDialog(Messages.TaxonLinkHelper_CREATE_FAIL, this, e.getMessage()); } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java index bd3bc0375..e9d9e4ff0 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java @@ -51,6 +51,7 @@ import eu.etaxonomy.taxeditor.model.DataChangeBridge; import eu.etaxonomy.taxeditor.model.IDataChangeBehavior; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; import eu.etaxonomy.taxeditor.session.ICdmEntitySession; @@ -64,21 +65,23 @@ import eu.etaxonomy.taxeditor.store.LoginManager; * @author p.ciardelli * @author n.hoffmann * @created 02.06.2009 - * @version 1.0 + * @version 1.0+- */ public class TaxonNavigator extends CommonNavigator implements IPostOperationEnabled, IConversationEnabled, Observer, ICdmEntitySessionEnabled, ICdmChangeListener { - /** + private static final String RESTORING_TAXON_NAVIGATOR = Messages.TaxonNavigator_RESTORE; + + /** * Constant * ID="eu.etaxonomy.taxeditor.navigation.navig"{trunked} */ public static final String ID = "eu.etaxonomy.taxeditor.navigation.navigator"; //$NON-NLS-1$ - private static final String TREE_PATH = "treepath"; + private static final String TREE_PATH = "treepath"; //$NON-NLS-1$ - private static final String TREE_PATHS = "treepaths"; + private static final String TREE_PATHS = "treepaths"; //$NON-NLS-1$ private ConversationHolder conversation; @@ -226,9 +229,9 @@ public class TaxonNavigator extends CommonNavigator implements IProgressMonitor subProgressMonitor = NavigationUtil .getSubProgressMonitor(monitor, 1); - subProgressMonitor.beginTask("Restoring Taxon Navigator", + subProgressMonitor.beginTask(RESTORING_TAXON_NAVIGATOR, 1 + mementoWork + 5); - subProgressMonitor.subTask("Restoring Taxon Navigator"); + subProgressMonitor.subTask(RESTORING_TAXON_NAVIGATOR); subProgressMonitor.worked(1); conversation = CdmStore.createConversation(); @@ -270,7 +273,7 @@ public class TaxonNavigator extends CommonNavigator implements return null; } - for (String uuid : string.split(" ")) { + for (String uuid : string.split(" ")) { //$NON-NLS-1$ CdmBase cdmBaseObject = CdmStore.getService( IClassificationService.class).getTaxonNodeByUuid( UUID.fromString(uuid)); @@ -317,19 +320,19 @@ public class TaxonNavigator extends CommonNavigator implements memento = memento.createChild(TREE_PATHS); TreePath[] treePaths = this.getCommonViewer().getExpandedTreePaths(); - monitor.beginTask("Saving Taxon Navigator State", treePaths.length); + monitor.beginTask(Messages.TaxonNavigator_SAVE_TASK, treePaths.length); for (TreePath treePath : treePaths) { int pathLength = treePath.getSegmentCount(); - String path = ""; + String path = ""; //$NON-NLS-1$ for (int i = 0; i < pathLength; i++) { Object segment = treePath.getSegment(i); if (segment instanceof CdmBase) { - path += ((CdmBase) segment).getUuid().toString() + " "; + path += ((CdmBase) segment).getUuid().toString() + " "; //$NON-NLS-1$ monitor.worked(1); } else { MessagingUtils.warn(getClass(), - "Non-taxon tree path segment " + segment); + "Non-taxon tree path segment " + segment); //$NON-NLS-1$ } } memento.createChild(TREE_PATH, path.trim()); @@ -378,7 +381,7 @@ public class TaxonNavigator extends CommonNavigator implements @Override public String getFrameToolTipText(Object element) { if (element instanceof Root) { - return "Taxonomic Tree"; + return Messages.TaxonNavigator_TAXON_TREE; } return super.getFrameToolTipText(element); } @@ -494,7 +497,7 @@ public class TaxonNavigator extends CommonNavigator implements getCommonViewer().getControl().setEnabled(!busy); if (busy) { partNameCache = getPartName(); - setPartName("Loading datasources"); + setPartName(Messages.TaxonNavigator_LOAD_DATASOURCE); } else { if (partNameCache != null) { setPartName(partNameCache); @@ -564,9 +567,9 @@ public class TaxonNavigator extends CommonNavigator implements public Map> getPropertyPathsMap() { Map> propertyPathsMap = new HashMap>(); List taxonNodePropertyPaths = Arrays.asList(new String[] { - "taxon.name" + "taxon.name" //$NON-NLS-1$ }); - propertyPathsMap.put("childNodes", taxonNodePropertyPaths); + propertyPathsMap.put("childNodes", taxonNodePropertyPaths); //$NON-NLS-1$ return propertyPathsMap; } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorDataChangeBehavior.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorDataChangeBehavior.java index b1a636182..48409c764 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorDataChangeBehavior.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorDataChangeBehavior.java @@ -30,6 +30,7 @@ import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour; import eu.etaxonomy.taxeditor.model.IDataChangeBehavior; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; /** *

TaxonNavigatorDataChangeBehavior class.

@@ -41,7 +42,9 @@ import eu.etaxonomy.taxeditor.navigation.NavigationUtil; public class TaxonNavigatorDataChangeBehavior extends AbstractDataChangeBehaviour implements IDataChangeBehavior { - private final TaxonNavigator source; + private static final String UPDATING_TAXON_NAVIGATOR = Messages.TaxonNavigatorDataChangeBehavior_UPDATE_NAVIGATOR; + + private final TaxonNavigator source; private Set staleObjects; @@ -77,7 +80,7 @@ public class TaxonNavigatorDataChangeBehavior extends AbstractDataChangeBehaviou Set affectedObjects = event.getAffectedObjects(); if(affectedObjects != null) { for(CdmBase cb : affectedObjects) { - staleObjects.add((CdmBase)HibernateProxyHelper.deproxy(cb)); + staleObjects.add(HibernateProxyHelper.deproxy(cb)); } } @@ -164,15 +167,15 @@ public class TaxonNavigatorDataChangeBehavior extends AbstractDataChangeBehaviou if(isRelevant(events)){ final Display display = Display.getCurrent(); - Job job = new Job("Updating Taxon Navigator") { + Job job = new Job(UPDATING_TAXON_NAVIGATOR) { @Override protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask("Updating Taxon Navigator", 3); + monitor.beginTask(UPDATING_TAXON_NAVIGATOR, 3); monitor.worked(1); // clear the session completely - monitor.subTask("Clearing Taxon Navigators session"); + monitor.subTask(Messages.TaxonNavigatorDataChangeBehavior_CLEAR_SESSION); display.asyncExec(new Runnable() { @Override public void run() { @@ -188,7 +191,7 @@ public class TaxonNavigatorDataChangeBehavior extends AbstractDataChangeBehaviou // seems to improve the situation but not sure if final solution monitor.worked(1); - monitor.subTask("Refreshing viewer"); + monitor.subTask(Messages.TaxonNavigatorDataChangeBehavior_REFRESH_VIEWER); display.asyncExec(new Runnable() { @Override diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorLabels.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorLabels.java index dc5398c41..f1ea7696a 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorLabels.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorLabels.java @@ -8,6 +8,8 @@ */ package eu.etaxonomy.taxeditor.navigation.navigator; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; + /** * @author cmathew * @date 19 Jun 2015 @@ -15,20 +17,18 @@ package eu.etaxonomy.taxeditor.navigation.navigator; */ public interface TaxonNavigatorLabels { - public static final String CHANGE_ACCEPTED_TAXON_TO_SYNONYM_LABEL = "Change Accepted Taxon to Synonym"; - public static final String MOVE_TAXON_LABEL = "Move Taxon"; - public static final String MOVE_FACTUAL_DATA_LABEL = "Move Factual Data"; - public static final String DELETE_TAXON_NODE_LABEL = "Delete Taxon Node"; + public static final String CHANGE_ACCEPTED_TAXON_TO_SYNONYM_LABEL = Messages.TaxonNavigatorLabels_CHANGE_ACC_TAXON; + public static final String MOVE_TAXON_LABEL = Messages.TaxonNavigatorLabels_MOVE_TAXON; + public static final String MOVE_FACTUAL_DATA_LABEL = Messages.TaxonNavigatorLabels_MOVE_FACTUAL_DATA; + public static final String DELETE_TAXON_NODE_LABEL = Messages.TaxonNavigatorLabels_DELETE_TAXON; - public static final String NO_TAXON_SELECTION_MESSAGE = "No taxon tree node selected for operation."; - public static final String SINGLE_TAXON_SELECTION_MESSAGE = "The chosen operation is available only for a single taxon."; - public static final String SOURCE_TAXON_HAS_CHILDREN_MESSAGE = "The chosen taxon must not have any childen. You need to move all childen to " + - "another taxon node in the TaxonNavigator before attempting to turn the accepted " + - "taxon into a synonym."; - public static final String RELATED_EDITOR_NOT_CLOSED_MESSAGE = "Could not close related taxon name editor. " + - "Please close it manually and try again."; - public static final String SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE = "Selected object is not a taxon tree node"; - public static final String UNSAVED_CHANGES_MESSAGE = "There are unsaved changes in the source taxon. Please save first."; + public static final String NO_TAXON_SELECTION_MESSAGE = Messages.TaxonNavigatorLabels_NOT_TAXON_SELECTED; + public static final String SINGLE_TAXON_SELECTION_MESSAGE = Messages.TaxonNavigatorLabels_ONLY_SINGLE_TAXON; + public static final String SOURCE_TAXON_HAS_CHILDREN_MESSAGE = Messages.TaxonNavigatorLabels_NO_CHILDREN_ALLOWED; + public static final String RELATED_EDITOR_NOT_CLOSED_MESSAGE = Messages.TaxonNavigatorLabels_CLOSE_IMPOSSIBLE; + public static final String SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE = Messages.TaxonNavigatorLabels_NOT_A_NODE; + public static final String UNSAVED_CHANGES_MESSAGE = Messages.TaxonNavigatorLabels_UNSAVED_CHANGES; + public static final String CHANGE_SECUNDUM_FOR_SUBTREE = Messages.TaxonNavigatorLabels_SET_SEC_FOR_CHILDREN; diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeLabelProvider.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeLabelProvider.java index 3d35b7e23..492f0e45f 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeLabelProvider.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeLabelProvider.java @@ -25,6 +25,7 @@ import eu.etaxonomy.cdm.model.common.IIdentifiableEntity; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.model.MessagingUtils; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.preference.Resources; import eu.etaxonomy.taxeditor.security.RequiredPermissions; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -55,9 +56,9 @@ public class TaxonNodeLabelProvider extends ColumnLabelProvider TaxonNode taxonNode = (TaxonNode) HibernateProxyHelper.deproxy(element); try{ - Taxon taxon = (Taxon) HibernateProxyHelper.deproxy(taxonNode.getTaxon()); + Taxon taxon = HibernateProxyHelper.deproxy(taxonNode.getTaxon()); if(taxon == null){ - MessagingUtils.error(getClass(), "The taxon node does not have a taxon attached to it. Please check your import. TaxonNode: " + element, null); + MessagingUtils.error(getClass(), String.format(Messages.TaxonNodeLabelProvider_NODE_WITH_NO_TAXON, element), null); // throw new RuntimeException("The data your are trying to view is corrupt. Please check your import."); }else{ try{ @@ -79,7 +80,7 @@ public class TaxonNodeLabelProvider extends ColumnLabelProvider public String getDescription(Object anElement) { if (anElement instanceof TaxonNode) { Taxon data = ((TaxonNode) anElement).getTaxon(); - return "Taxon: " + (data != null ? data.getTitleCache() : ">NO TAXON<"); + return Messages.TaxonNodeLabelProvider_TAXON + (data != null ? data.getTitleCache() : Messages.TaxonNodeLabelProvider_NO_TAXON); } return null; } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeNavigatorComparator.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeNavigatorComparator.java index ee6ecbc03..5e6ef66ba 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeNavigatorComparator.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeNavigatorComparator.java @@ -11,9 +11,11 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode; public class TaxonNodeNavigatorComparator extends ViewerComparator{ + Comparator comparator; public TaxonNodeNavigatorComparator(Comparator comparator){ - super(comparator); + super(); + this.comparator = comparator; } @@ -23,11 +25,8 @@ public class TaxonNodeNavigatorComparator extends ViewerComparator{ if (e1 instanceof Classification && e2 instanceof Classification){ return ((Classification)e1).getTitleCache().compareTo(((Classification)e2).getTitleCache()); } else{ - if (this.getComparator() instanceof TaxonNaturalComparator){ - return this.getComparator().compare((TaxonNode)e1, (TaxonNode)e2); - }else{ - return this.getComparator().compare(e1,e2); - } + return comparator.compare((TaxonNode)e1, (TaxonNode)e2); + } } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodePropertyTester.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodePropertyTester.java index a2199b417..d479315cc 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodePropertyTester.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodePropertyTester.java @@ -14,8 +14,8 @@ import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonNode; public class TaxonNodePropertyTester extends PropertyTester { - private static final Object HAS_SYNONYMS = "hasSynonyms"; - private static final Object HAS_TAXA = "hasTaxa"; + private static final Object HAS_SYNONYMS = "hasSynonyms"; //$NON-NLS-1$ + private static final Object HAS_TAXA = "hasTaxa"; //$NON-NLS-1$ /** {@inheritDoc} */ public boolean test(Object receiver, String property, Object[] args, diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapter.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapter.java index 864963816..1ac31924b 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapter.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapter.java @@ -33,6 +33,7 @@ import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.operation.MoveTaxonOperation; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; @@ -47,10 +48,19 @@ import eu.etaxonomy.taxeditor.store.CdmStore; */ public class TreeNodeDropAdapter extends ViewerDropAdapter implements IPostOperationEnabled { - private static final Logger logger = Logger.getLogger(TreeNodeDropAdapter.class); + protected static final String TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE = Messages.TreeNodeDropAdapter_UNSAVED_PARENT_MESSAGE; + protected static final String TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT = Messages.TreeNodeDropAdapter_UNSAVED_PARENT; + protected static final String TREE_NODE_DROP_ADAPTER_MOVE_TAXON = Messages.TreeNodeDropAdapter_MOVE_TAXON; + protected static final String TREE_NODE_DROP_ADAPTER_CANCEL = Messages.TreeNodeDropAdapter_CANCEL; + protected static final String TREE_NODE_DROP_ADAPTER_BEHIND = Messages.TreeNodeDropAdapter_BEHIND; + protected static final String TREE_NODE_DROP_ADAPTER_CHILD = Messages.TreeNodeDropAdapter_CHILD; + protected static final String DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE = Messages.TreeNodeDropAdapter_MOVE_BEHIND; + protected static final String TARGET_NODE = Messages.TreeNodeDropAdapter_TARGET_NODE; + + private static final Logger logger = Logger.getLogger(TreeNodeDropAdapter.class); private final TaxonNavigatorViewer navigatorViewer; - + /** * @param viewer */ @@ -86,7 +96,7 @@ public class TreeNodeDropAdapter extends ViewerDropAdapter implements IPostOpera if (taxonNodes.size() == 1){ return moveTaxon(taxonNodes, targetTreeNode); } else{ - if( MessageDialog.openConfirm(null, "Moving taxon", "The operation move accepted taxon to other parent is available only for a single taxon.")){ + if( MessageDialog.openConfirm(null, Messages.TreeNodeDropAdapter_MOVING, Messages.TreeNodeDropAdapter_MOVING_MESSAGE)){ return true; } } @@ -129,12 +139,12 @@ public class TreeNodeDropAdapter extends ViewerDropAdapter implements IPostOpera Boolean hasTargetTaxonPermission = CdmStore.currentAuthentiationHasPermission(targetNode.getTaxon(), UPDATE); if(logger.isDebugEnabled()){ - logger.debug("target: " + targetNode.getTaxon().getTitleCache()); + logger.debug("target: " + targetNode.getTaxon().getTitleCache()); //$NON-NLS-1$ } if(!hasTargetNodePermission || ! hasTargetNodePermission){ if(logger.isDebugEnabled()){ - logger.debug("CANCEL_STATUS for target node: " + hasTargetNodePermission.toString() + " " + hasTargetTaxonPermission.toString() + " "); + logger.debug("CANCEL_STATUS for target node: " + hasTargetNodePermission.toString() + " " + hasTargetTaxonPermission.toString() + " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return false; } @@ -143,7 +153,7 @@ public class TreeNodeDropAdapter extends ViewerDropAdapter implements IPostOpera // do not allow to drop onto itself and // check users permissions with all selected taxon nodes and taxa for(TaxonNode taxonNode : getSelectedTaxa()){ - logger.debug("selectedTaxa: " + taxonNode.getTaxon().getTitleCache()); + logger.debug("selectedTaxa: " + taxonNode.getTaxon().getTitleCache()); //$NON-NLS-1$ Boolean isSameTaxonNode = taxonNode.equals(target); Boolean hasTaxonNodePermission = CdmStore.currentAuthentiationHasPermission(taxonNode, UPDATE); Boolean hasTaxonPermission = CdmStore.currentAuthentiationHasPermission(taxonNode.getTaxon(), UPDATE); @@ -153,15 +163,15 @@ public class TreeNodeDropAdapter extends ViewerDropAdapter implements IPostOpera || !hasTaxonPermission ) { if(logger.isDebugEnabled()){ - logger.debug("CANCEL_STATUS for selected " + isSameTaxonNode.toString() + " " + hasTaxonNodePermission.toString() + " " + hasTaxonPermission.toString() + " "); + logger.debug("CANCEL_STATUS for selected " + isSameTaxonNode.toString() + Messages.TreeNodeDropAdapter_10 + hasTaxonNodePermission.toString() + " " + hasTaxonPermission.toString() + " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return false; } } - logger.debug("OK_STATUS"); + logger.debug("OK_STATUS"); //$NON-NLS-1$ return true; } - logger.debug("CANCEL_STATUS"); + logger.debug("CANCEL_STATUS"); //$NON-NLS-1$ return false; } @@ -181,8 +191,7 @@ public class TreeNodeDropAdapter extends ViewerDropAdapter implements IPostOpera TaxonNode targetTaxonNode = (TaxonNode) targetITaxonTreeNode; // Make sure parent taxon does not have unsaved changes if (NavigationUtil.isDirty(targetTaxonNode)){ - MessageDialog.openWarning(NavigationUtil.getShell(), "Unsaved Parent Taxon", "There are unsaved " + - "changes in the parent taxon. Pleas save first."); + MessageDialog.openWarning(NavigationUtil.getShell(), TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT, TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE); return false; } @@ -197,47 +206,47 @@ public class TreeNodeDropAdapter extends ViewerDropAdapter implements IPostOpera if (!PreferencesUtil.getSortNodesNaturally()){ IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); if (workspaceUndoContext == null) { - logger.error("Workspace undo context is null. DND operation cancelled"); + logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ return false; } AbstractPostOperation operation = new MoveTaxonOperation - ("Move Taxon", workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD); + (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD); NavigationUtil.executeOperation(operation); - logger.info("Moved taxa to new parent " + targetITaxonTreeNode); + logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ return true; }else{ - String[] buttonLables = {"Child", "Behind","Cancel"}; - MessageDialog dialog = new MessageDialog(null, "Target node", null, "Do you want to move the Taxonnode as child or behind the target node.", MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0); + String[] buttonLables = {TREE_NODE_DROP_ADAPTER_CHILD, TREE_NODE_DROP_ADAPTER_BEHIND,TREE_NODE_DROP_ADAPTER_CANCEL}; + MessageDialog dialog = new MessageDialog(null, TARGET_NODE, null, DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0); dialog.open(); int returnCode = dialog.getReturnCode(); if (returnCode == 0){ IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); if (workspaceUndoContext == null) { - logger.error("Workspace undo context is null. DND operation cancelled"); + logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ return false; } AbstractPostOperation operation = new MoveTaxonOperation - ("Move Taxon", workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD); + (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD); NavigationUtil.executeOperation(operation); - logger.info("Moved taxa to new parent " + targetITaxonTreeNode); + logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ return true; }else if (returnCode == 1){ IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); if (workspaceUndoContext == null) { - logger.error("Workspace undo context is null. DND operation cancelled"); + logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ return false; } TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode; AbstractPostOperation operation = new MoveTaxonOperation - ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.PREVIOUS); + (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.PREVIOUS); NavigationUtil.executeOperation(operation); - logger.info("Moved taxa to new parent " + targetITaxonTreeNode); + logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ return true; } // } else if (returnCode == 2){ diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapterAssistant.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapterAssistant.java index 0ba48c50d..375c9ad82 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapterAssistant.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapterAssistant.java @@ -37,9 +37,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; import eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapter.MovingType; -import eu.etaxonomy.taxeditor.navigation.navigator.operation.MoveTaxonOperation; import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingMoveTaxonOperation; -import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -125,12 +123,12 @@ public class TreeNodeDropAdapterAssistant extends CommonDropAdapterAssistant imp Boolean hasTargetTaxonPermission = CdmStore.currentAuthentiationHasPermission(targetNode.getTaxon(), UPDATE); if(logger.isDebugEnabled()){ - logger.debug("target: " + targetNode.getTaxon().getTitleCache()); + logger.debug("target: " + targetNode.getTaxon().getTitleCache()); //$NON-NLS-1$ } if(!hasTargetNodePermission || ! hasTargetNodePermission){ if(logger.isDebugEnabled()){ - logger.debug("CANCEL_STATUS for target node: " + hasTargetNodePermission.toString() + " " + hasTargetTaxonPermission.toString() + " "); + logger.debug("CANCEL_STATUS for target node: " + hasTargetNodePermission.toString() + " " + hasTargetTaxonPermission.toString() + " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return Status.CANCEL_STATUS; } @@ -139,7 +137,7 @@ public class TreeNodeDropAdapterAssistant extends CommonDropAdapterAssistant imp // do not allow to drop onto itself and // check users permissions with all selected taxon nodes and taxa for(TaxonNode taxonNode : getSelectedTaxa()){ - logger.debug("selectedTaxa: " + taxonNode.getTaxon().getTitleCache()); + logger.debug("selectedTaxa: " + taxonNode.getTaxon().getTitleCache()); //$NON-NLS-1$ Boolean isSameTaxonNode = taxonNode.equals(target); Boolean hasTaxonNodePermission = CdmStore.currentAuthentiationHasPermission(taxonNode, UPDATE); Boolean hasTaxonPermission = CdmStore.currentAuthentiationHasPermission(taxonNode.getTaxon(), UPDATE); @@ -149,15 +147,15 @@ public class TreeNodeDropAdapterAssistant extends CommonDropAdapterAssistant imp || !hasTaxonPermission ) { if(logger.isDebugEnabled()){ - logger.debug("CANCEL_STATUS for selected " + isSameTaxonNode.toString() + " " + hasTaxonNodePermission.toString() + " " + hasTaxonPermission.toString() + " "); + logger.debug("CANCEL_STATUS for selected " + isSameTaxonNode.toString() + " " + hasTaxonNodePermission.toString() + " " + hasTaxonPermission.toString() + " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } return Status.CANCEL_STATUS; } } - logger.debug("OK_STATUS"); + logger.debug("OK_STATUS"); //$NON-NLS-1$ return Status.OK_STATUS; } - logger.debug("CANCEL_STATUS"); + logger.debug("CANCEL_STATUS"); //$NON-NLS-1$ return Status.CANCEL_STATUS; } @@ -177,8 +175,7 @@ public class TreeNodeDropAdapterAssistant extends CommonDropAdapterAssistant imp TaxonNode targetTaxonNode = (TaxonNode) targetITaxonTreeNode; // Make sure parent taxon does not have unsaved changes if (NavigationUtil.isDirty(targetTaxonNode)){ - MessageDialog.openWarning(NavigationUtil.getShell(), "Unsaved Parent Taxon", "There are unsaved " + - "changes in the parent taxon. Pleas save first."); + MessageDialog.openWarning(NavigationUtil.getShell(), TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE); return Status.CANCEL_STATUS; } @@ -193,46 +190,46 @@ public class TreeNodeDropAdapterAssistant extends CommonDropAdapterAssistant imp if (!PreferencesUtil.getSortNodesNaturally()){ IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); if (workspaceUndoContext == null) { - logger.error("Workspace undo context is null. DND operation cancelled"); + logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ return Status.CANCEL_STATUS; } AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD); NavigationUtil.executeOperation(operation, null); - - logger.info("Moved taxa to new parent " + targetITaxonTreeNode); + + logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ return Status.OK_STATUS; }else{ - String[] buttonLables = {"Child", "Behind", "Cancel"}; - MessageDialog dialog = new MessageDialog(null, "Target node", null, "Do you want to move the taxon as child, before or behind the target.", MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0); + String[] buttonLables = {TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_CHILD, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_BEHIND, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_CANCEL}; + MessageDialog dialog = new MessageDialog(null, TreeNodeDropAdapter.TARGET_NODE, null, TreeNodeDropAdapter.DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0); dialog.open(); int returnCode = dialog.getReturnCode(); if (returnCode == 0){ IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); if (workspaceUndoContext == null) { - logger.error("Workspace undo context is null. DND operation cancelled"); + logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ return Status.CANCEL_STATUS; } AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD); NavigationUtil.executeOperation(operation, null); - - logger.info("Moved taxa to new parent " + targetITaxonTreeNode); + + logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ return Status.OK_STATUS; }else if (returnCode == 1){ IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); if (workspaceUndoContext == null) { - logger.error("Workspace undo context is null. DND operation cancelled"); + logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ return Status.CANCEL_STATUS; } TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode; AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, targetNode, MovingType.BEHIND); NavigationUtil.executeOperation(operation, null); - - logger.info("Moved taxa to new parent " + targetITaxonTreeNode); + + logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ return Status.OK_STATUS; // }else if (returnCode == 2){ // IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/ChangeAcceptedTaxonToSynonymHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/ChangeAcceptedTaxonToSynonymHandler.java index a60bd2e32..3cff9d8fc 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/ChangeAcceptedTaxonToSynonymHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/ChangeAcceptedTaxonToSynonymHandler.java @@ -29,6 +29,7 @@ import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.operation.ChangeAcceptedTaxonToSynonymOperation; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; @@ -64,7 +65,6 @@ public class ChangeAcceptedTaxonToSynonymHandler extends DeleteHandler TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event); - String plural = selection.size() > 1 ? "s" : ""; // Prompt user for confirmation @@ -93,10 +93,8 @@ public class ChangeAcceptedTaxonToSynonymHandler extends DeleteHandler // check if taxon has no children if(((TaxonNode)oldAcceptedTaxonNode).getCountChildren() > 0) { - MessagingUtils.warningDialog("Prerequisite not met", this, - "The accepted taxon must not have any childen. You need to move all childen to " + - "another taxon node in the TaxonNavigator before attempting to turn the accepted " + - "taxon into a synonym."); + MessagingUtils.warningDialog(Messages.ChangeAcceptedTaxonToSynonymHandler_PREREQUISITE, this, + Messages.ChangeAcceptedTaxonToSynonymHandler_PREREQUISITE_MESSAGE); return null; } /*if(((TaxonNode)oldAcceptedTaxonNode).getTaxon().hasSynonyms()) { @@ -111,7 +109,7 @@ public class ChangeAcceptedTaxonToSynonymHandler extends DeleteHandler excludeTaxa.add(((TaxonNode)oldAcceptedTaxonNode).getTaxon().getUuid()); TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), taxonNavigator.getConversationHolder(), - "Choose the accepted taxon", + Messages.ChangeAcceptedTaxonToSynonymHandler_CHOOSE_TAXON, excludeTaxa, null, ((TaxonNode)oldAcceptedTaxonNode).getClassification()); @@ -137,10 +135,10 @@ public class ChangeAcceptedTaxonToSynonymHandler extends DeleteHandler } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set"); + MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$ } } else{ - if( MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Moving to synonymy", "The operation move accepted taxon to synonymy is available only for a single taxon.")){ + if( MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), Messages.ChangeAcceptedTaxonToSynonymHandler_MOVE_SYNONYMY, Messages.ChangeAcceptedTaxonToSynonymHandler_MOVE_SYNONYMY_MESSAGE)){ return null; } } @@ -172,7 +170,7 @@ public class ChangeAcceptedTaxonToSynonymHandler extends DeleteHandler MessagingUtils.error(this.getClass(), e); throw new RuntimeException(e); } catch (Exception e) { - MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage()); + MessagingUtils.warningDialog(Messages.ChangeAcceptedTaxonToSynonymHandler_CREATE_FAILED, this, e.getMessage()); } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CloneClassificationHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CloneClassificationHandler.java index 8152bae9e..825db1af3 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CloneClassificationHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CloneClassificationHandler.java @@ -15,6 +15,7 @@ import eu.etaxonomy.cdm.model.taxon.Classification; import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator; import eu.etaxonomy.taxeditor.navigation.operation.CloneClassificationOperation; import eu.etaxonomy.taxeditor.store.StoreUtil; @@ -41,7 +42,7 @@ public class CloneClassificationHandler extends AbstractHandler { TaxonRelationshipType relationType = wizard.getRelationType(); Reference reference = wizard.getReference(); - CloneClassificationOperation operation = new CloneClassificationOperation("Clone classification", + CloneClassificationOperation operation = new CloneClassificationOperation(Messages.CloneClassificationHandler_CLONE_CLASSIFICATION, StoreUtil.getUndoContext(), classification, classificationName, reference, relationType, NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false)); diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CopyHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CopyHandler.java index 354b6864b..9faca1242 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CopyHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CopyHandler.java @@ -59,7 +59,7 @@ public class CopyHandler extends AbstractHandler implements IHandler { IStatus status = NavigationUtil.executeOperation(operation); } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set"); + MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$ } } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CreateClassificationHierarchyHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CreateClassificationHierarchyHandler.java index aebb25af9..a890daf17 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CreateClassificationHierarchyHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CreateClassificationHierarchyHandler.java @@ -12,6 +12,7 @@ import eu.etaxonomy.cdm.model.taxon.Classification; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator; import eu.etaxonomy.taxeditor.navigation.operation.CreateNewTaxonHierarchyOperation; import eu.etaxonomy.taxeditor.store.StoreUtil; @@ -44,7 +45,7 @@ public class CreateClassificationHierarchyHandler extends AbstractHandler { // service.getSortedGenusList(classification.getAllNodes()); - CreateNewTaxonHierarchyOperation operation = new CreateNewTaxonHierarchyOperation("Create Taxon Hierarchy", StoreUtil.getUndoContext(),classification,NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false) ); + CreateNewTaxonHierarchyOperation operation = new CreateNewTaxonHierarchyOperation(Messages.CreateClassificationHierarchyHandler_CREATE_HIERARCHY, StoreUtil.getUndoContext(),classification,NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false) ); AbstractUtility.executeOperation(operation); // UpdateResult result = service.createHierarchyInClassification(classification, null); @@ -61,8 +62,8 @@ public class CreateClassificationHierarchyHandler extends AbstractHandler { //Success taxonNavigator.refresh(); } catch (Exception e) { - MessagingUtils.messageDialog("Failed to open Editor", CreateClassificationHierarchyHandler.class, - "Could not open distribution view. The hierarchy is corrupted!", e); + MessagingUtils.messageDialog(Messages.CreateClassificationHierarchyHandler_FAILED, CreateClassificationHierarchyHandler.class, + Messages.CreateClassificationHierarchyHandler_FAILED_MESSAGE, e); } } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java index 65c381d39..bafa4430c 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java @@ -25,9 +25,9 @@ import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; import org.eclipse.ui.handlers.HandlerUtil; +import eu.etaxonomy.cdm.api.service.config.NodeDeletionConfigurator.ChildHandling; import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator; -import eu.etaxonomy.cdm.api.service.config.NodeDeletionConfigurator.ChildHandling; import eu.etaxonomy.cdm.model.common.ITreeNode; import eu.etaxonomy.cdm.model.taxon.Classification; import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; @@ -35,10 +35,11 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator; import eu.etaxonomy.taxeditor.navigation.navigator.operation.DeleteOperation; import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; -import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog; +import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog; /** *

DeleteTreeNodeHandler class.

@@ -49,7 +50,16 @@ import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDia */ public class DeleteHandler extends AbstractHandler{ - protected IWorkbenchPage activePage; + protected static final String SKIP = Messages.DeleteHandler_SKIP; + protected static final String MOVE_CHILDREN_TO_PARENT_NODE = Messages.DeleteHandler_MOVE_TO_PARENT; + protected static final String DELETE_ALL_CHILDREN = Messages.DeleteHandler_DELETE_ALL; + protected static final String THERE_ARE_CHILDNODES_WHICH_WILL_BE_DELETED_TOO = Messages.DeleteHandler_THERE_ARE_CHILDNODES; + protected static final String THE_TREE_HAS_CHILDREN_THEY_WILL_BE_DELETED_TOO = Messages.DeleteHandler_THERE_ARE_CHILDREN; + protected static final String DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S = Messages.DeleteHandler_DELETE_NODE; + protected static final String DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION = Messages.DeleteHandler_DELETE_CLASSIFICATION; + protected static final String CONFIRM_DELETION = Messages.DeleteHandler_CONFIRM_DELETE; + + protected IWorkbenchPage activePage; protected TaxonNavigator taxonNavigator; /** {@inheritDoc} */ @@ -63,7 +73,6 @@ public class DeleteHandler extends AbstractHandler{ TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event); - String plural = selection.size() > 1 ? "s" : ""; // Prompt user for confirmation @@ -96,11 +105,11 @@ public class DeleteHandler extends AbstractHandler{ //configNodes.setDeleteTaxon(false); if (taxonNode instanceof Classification && taxonNode.hasChildNodes()){ - if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the classification? The tree has children, they will be deleted, too.")){ + if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION+THE_TREE_HAS_CHILDREN_THEY_WILL_BE_DELETED_TOO)){ return null; } } else if (taxonNode instanceof Classification && !taxonNode.hasChildNodes()){ - if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the classification?")){ + if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION)){ return null; } } else { @@ -109,11 +118,11 @@ public class DeleteHandler extends AbstractHandler{ DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog( config, HandlerUtil.getActiveShell(event), - "Confirm Deletion", + CONFIRM_DELETION, null, - "Do you really want to delete the selected node? It has childnodes, they will be deleted, too.", - MessageDialog.WARNING, new String[] { "Delete all children", - "Move children to parent node", "Skip" }, 0); + DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S+THERE_ARE_CHILDNODES_WHICH_WILL_BE_DELETED_TOO, + MessageDialog.WARNING, new String[] { DELETE_ALL_CHILDREN, + MOVE_CHILDREN_TO_PARENT_NODE, SKIP }, 0); int dialog_result = dialog.open(); if (dialog_result == 0){ @@ -130,7 +139,7 @@ public class DeleteHandler extends AbstractHandler{ } }else{ - if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the selected node?")){ + if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, HandlerUtil.getActiveShell(event), CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S)){ return null; } config.setTaxonNodeConfig(configNodes); @@ -158,13 +167,13 @@ public class DeleteHandler extends AbstractHandler{ } catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set"); + MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$ } catch (Exception e){ MessagingUtils.error(getClass(), e); } } else{ try{ - if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the selected nodes?")){ + if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S)){ return null; } if (allEditorsClosed){ @@ -181,7 +190,7 @@ public class DeleteHandler extends AbstractHandler{ } }catch (NotDefinedException e) { - MessagingUtils.warn(getClass(), "Command name not set"); + MessagingUtils.warn(getClass(), Messages.DeleteHandler_9); } catch (Exception e){ MessagingUtils.error(getClass(), e); } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveFactualDataHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveFactualDataHandler.java index 9810418ca..9f2283c98 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveFactualDataHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveFactualDataHandler.java @@ -27,6 +27,7 @@ import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog; @@ -50,8 +51,7 @@ public class MoveFactualDataHandler extends AbstractHandler { TaxonNode taxonNode = HibernateProxyHelper.deproxy(object, TaxonNode.class); final TaxonNode sourceTaxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNode.getUuid()); if(NavigationUtil.isDirty(sourceTaxonNode)){ - MessageDialog.openWarning(HandlerUtil.getActiveShell(event), "Unsaved Source Taxon", "There are unsaved " + - "changes in the source taxon. Please save first."); + MessageDialog.openWarning(HandlerUtil.getActiveShell(event), Messages.MoveFactualDataHandler_UNSAVED_SOURCE, Messages.MoveFactualDataHandler_UNSAVED_SOURCE_MESSAGE); return null; } //reload to avoid session conflicts @@ -62,7 +62,7 @@ public class MoveFactualDataHandler extends AbstractHandler { excludeTaxa.add(taxon.getUuid()); TaxonNode dialogTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), navigator.getConversationHolder(), - "Choose the accepted taxon", + Messages.MoveFactualDataHandler_CHOOSE_TAXON, excludeTaxa, sourceTaxonNode, sourceTaxonNode.getClassification()); @@ -72,8 +72,7 @@ public class MoveFactualDataHandler extends AbstractHandler { //reload to avoid session conflicts final TaxonNode targetTaxonNode = CdmStore.getService(ITaxonNodeService.class).load(dialogTaxonNode.getUuid()); if(NavigationUtil.isDirty(targetTaxonNode)){ - MessageDialog.openWarning(HandlerUtil.getActiveShell(event), "Unsaved Target Taxon", "There are unsaved " + - "changes in the target taxon. Please save first."); + MessageDialog.openWarning(HandlerUtil.getActiveShell(event), Messages.MoveFactualDataHandler_UNSAVED_TARGET, Messages.MoveFactualDataHandler_UNSAVED_TARGET_MESSAGE); return null; } CdmStore.getService(IDescriptionService.class).moveTaxonDescriptions(taxon.getUuid(),targetTaxonNode.getTaxon().getUuid()); @@ -99,7 +98,7 @@ public class MoveFactualDataHandler extends AbstractHandler { MessagingUtils.error(this.getClass(), e); throw new RuntimeException(e); } catch (Exception e) { - MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage()); + MessagingUtils.warningDialog(Messages.MoveFactualDataHandler_CREATE_FAILED, this, e.getMessage()); } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveTaxonHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveTaxonHandler.java index 09557cccd..d1309bf7e 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveTaxonHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveTaxonHandler.java @@ -29,6 +29,7 @@ import eu.etaxonomy.cdm.model.common.CdmBase; import eu.etaxonomy.cdm.model.taxon.Classification; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator; import eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapter.MovingType; import eu.etaxonomy.taxeditor.navigation.navigator.operation.MoveTaxonOperation; @@ -87,23 +88,22 @@ public class MoveTaxonHandler extends AbstractHandler implements IPostOperationE Classification classification = taxonNodes.iterator().next().getClassification(); MovingType moveToNewParent = MovingType.CHILD; if (PreferencesUtil.getSortNodesNaturally()){ - if(!MessageDialog.openQuestion(null, "Target node", "The choosen target node should be the parent?")){ + if(!MessageDialog.openQuestion(null, Messages.MoveTaxonHandler_TARGET_NODE, Messages.MoveTaxonHandler_TARGET_NODE_MESSAGE)){ moveToNewParent = MovingType.BEHIND; } - parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), taxonNavigator.getConversationHolder(), "Choose the taxon above the moved taxon.", excludeTaxa, null, classification); + parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), taxonNavigator.getConversationHolder(), Messages.MoveTaxonHandler_CHOOSE_ABOVE, excludeTaxa, null, classification); }else{ - parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), taxonNavigator.getConversationHolder(), "Choose new parent", excludeTaxa, null, classification); + parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), taxonNavigator.getConversationHolder(), Messages.MoveTaxonHandler_CHOOSE_PARENT, excludeTaxa, null, classification); } if(parentTaxonNode != null){ if(NavigationUtil.isDirty(parentTaxonNode)){ - MessageDialog.openWarning(HandlerUtil.getActiveShell(event), "Unsaved Parent Taxon", "There are unsaved " + - "changes in the parent taxon. Please save first."); + MessageDialog.openWarning(HandlerUtil.getActiveShell(event), Messages.MoveTaxonHandler_UNSAVED_PARENT, Messages.MoveTaxonHandler_UNSAVED_PARENT_MESSAGE); return null; } AbstractPostOperation operation = new MoveTaxonOperation - ("Move taxon to new parent", NavigationUtil.getUndoContext(), + (Messages.MoveTaxonHandler_MOVE_TO_PARENT, NavigationUtil.getUndoContext(), taxonNodeUUIDs, parentTaxonNode, taxonNavigator, taxonNavigator, moveToNewParent); //$NON-NLS-1$ NavigationUtil.executeOperation(operation); taxonNavigator.refresh(); diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingChangeAcceptedTaxonToSynonymHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingChangeAcceptedTaxonToSynonymHandler.java index c4f6df32c..b480b103f 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingChangeAcceptedTaxonToSynonymHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingChangeAcceptedTaxonToSynonymHandler.java @@ -18,6 +18,7 @@ import org.eclipse.ui.handlers.HandlerUtil; import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock; import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; import eu.etaxonomy.cdm.model.taxon.TaxonNode; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels; import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingChangeAcceptedTaxonToSynonymOperation; import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler; @@ -53,14 +54,14 @@ public class RemotingChangeAcceptedTaxonToSynonymHandler extends RemotingCdmHand // check that only a single taxon tree node has been selected if(selection.size() > 1) { return new Status(IStatus.ERROR, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.SINGLE_TAXON_SELECTION_MESSAGE); } // check for no taxon tree node selected if(selection.size() == 0) { return new Status(IStatus.ERROR, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE); } @@ -70,13 +71,13 @@ public class RemotingChangeAcceptedTaxonToSynonymHandler extends RemotingCdmHand oldTaxonNode = (ITaxonTreeNode)obj; } else { return new Status(IStatus.ERROR, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE); } // check that the source taxon node does not have children if(((TaxonNode)oldTaxonNode).getCountChildren() > 0) { return new Status(IStatus.ERROR, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.SOURCE_TAXON_HAS_CHILDREN_MESSAGE); } @@ -85,7 +86,7 @@ public class RemotingChangeAcceptedTaxonToSynonymHandler extends RemotingCdmHand boolean editorClosed = NavigatorHandlerUtils.closeObsoleteEditor(event, (TaxonNode) oldTaxonNode); if(editorClosed != true) { return new Status(IStatus.ERROR, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE); } @@ -100,7 +101,7 @@ public class RemotingChangeAcceptedTaxonToSynonymHandler extends RemotingCdmHand excludeTaxa.add(((TaxonNode)oldTaxonNode).getTaxon().getUuid()); TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), new ConversationHolderMock(), - "Choose the accepted taxon", + Messages.RemotingChangeAcceptedTaxonToSynonymHandler_CHOOSE_TAXON, excludeTaxa, null, ((TaxonNode)oldTaxonNode).getClassification()); diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingDeleteTaxonNodeHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingDeleteTaxonNodeHandler.java index 892739e3c..95b5bc5f6 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingDeleteTaxonNodeHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingDeleteTaxonNodeHandler.java @@ -30,10 +30,11 @@ import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.model.MessagingUtils; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels; import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingDeleteTaxonNodeOperation; import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler; -import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog; +import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog; /** * @author cmathew @@ -71,7 +72,7 @@ public class RemotingDeleteTaxonNodeHandler extends RemotingCdmHandler { } if(!allEditorsClosed) { return new Status(IStatus.WARNING, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE); } @@ -86,7 +87,7 @@ public class RemotingDeleteTaxonNodeHandler extends RemotingCdmHandler { taxonNode = CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().load(taxonNode.getUuid()); } if (taxonNode == null){ - MessagingUtils.informationDialog("Node already deleted", "The taxon node was already deleted. Please reopen the taxon navigator to refresh the view."); + MessagingUtils.informationDialog(Messages.RemotingDeleteTaxonNodeHandler_NODE_DELETED, Messages.RemotingDeleteTaxonNodeHandler_NODE_DELETED_MESSAGE); return Status.CANCEL_STATUS; } @@ -94,12 +95,12 @@ public class RemotingDeleteTaxonNodeHandler extends RemotingCdmHandler { if (taxonNode instanceof Classification) { String message; if (taxonNode.hasChildNodes()) { - message = "Do you really want to delete the classification? The tree has children, they will be deleted, too."; + message = DeleteHandler.DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION+DeleteHandler.THE_TREE_HAS_CHILDREN_THEY_WILL_BE_DELETED_TOO; } else { - message = "Do you really want to delete the classification?"; + message = DeleteHandler.DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION; } if (!DeleteConfiguratorDialog.openConfirm( - HandlerUtil.getActiveShell(event), "Confirm Deletion", + HandlerUtil.getActiveShell(event), DeleteHandler.CONFIRM_DELETION, message)) { return Status.CANCEL_STATUS; } @@ -110,11 +111,11 @@ public class RemotingDeleteTaxonNodeHandler extends RemotingCdmHandler { DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog( config, HandlerUtil.getActiveShell(event), - "Confirm Deletion", + DeleteHandler.CONFIRM_DELETION, null, - "Do you really want to delete the selected node? It has childnodes, they will be deleted, too.", - MessageDialog.WARNING, new String[] { "Delete all children", - "Move children to parent node", "Skip" }, 0); + DeleteHandler.DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S+DeleteHandler.THERE_ARE_CHILDNODES_WHICH_WILL_BE_DELETED_TOO, + MessageDialog.WARNING, new String[] { DeleteHandler.DELETE_ALL_CHILDREN, + DeleteHandler.MOVE_CHILDREN_TO_PARENT_NODE, DeleteHandler.SKIP }, 0); int result = dialog.open(); if (result == 0){ @@ -129,7 +130,7 @@ public class RemotingDeleteTaxonNodeHandler extends RemotingCdmHandler { return Status.CANCEL_STATUS; } } else{ - if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the selected node?")){ + if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, HandlerUtil.getActiveShell(event), DeleteHandler.CONFIRM_DELETION, DeleteHandler.DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S)){ return Status.CANCEL_STATUS; } config.setTaxonNodeConfig(configNodes); diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingMoveFactualDataHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingMoveFactualDataHandler.java index 882293bf2..c77c20dc1 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingMoveFactualDataHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingMoveFactualDataHandler.java @@ -29,6 +29,7 @@ import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels; import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingMoveFactualDataOperation; import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler; @@ -60,14 +61,14 @@ public class RemotingMoveFactualDataHandler extends RemotingCdmHandler { // check that only a single taxon tree node has been selected if(selection.size() > 1) { return new Status(IStatus.ERROR, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.SINGLE_TAXON_SELECTION_MESSAGE); } // check for no taxon tree node selected if(selection.size() == 0) { return new Status(IStatus.ERROR, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE); } @@ -77,13 +78,13 @@ public class RemotingMoveFactualDataHandler extends RemotingCdmHandler { sourceTaxonNode = (TaxonNode)obj; } else { return new Status(IStatus.ERROR, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE); } if(NavigationUtil.isDirty(sourceTaxonNode)) { return new Status(IStatus.ERROR, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.UNSAVED_CHANGES_MESSAGE); } @@ -92,19 +93,19 @@ public class RemotingMoveFactualDataHandler extends RemotingCdmHandler { targetTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), new ConversationHolderMock(), - "Choose the accepted taxon", + Messages.RemotingMoveFactualDataHandler_CHOOSE_TAXA, excludeTaxa, null, sourceTaxonNode.getClassification()); if(targetTaxonNode == null) { return new Status(IStatus.CANCEL, - "unknown", - ""); + "unknown", //$NON-NLS-1$ + ""); //$NON-NLS-1$ } if(NavigationUtil.isDirty(targetTaxonNode)){ return new Status(IStatus.ERROR, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.UNSAVED_CHANGES_MESSAGE); } return Status.OK_STATUS; @@ -143,7 +144,7 @@ public class RemotingMoveFactualDataHandler extends RemotingCdmHandler { MessagingUtils.error(this.getClass(), e); throw new RuntimeException(e); } catch (Exception e) { - MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage()); + MessagingUtils.warningDialog(Messages.RemotingMoveFactualDataHandler_CREATE_FAILED, this, e.getMessage()); } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingMoveTaxonNodeHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingMoveTaxonNodeHandler.java index 5d8855141..bbedbc124 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingMoveTaxonNodeHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingMoveTaxonNodeHandler.java @@ -24,6 +24,7 @@ import org.eclipse.ui.handlers.HandlerUtil; import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels; import eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapter.MovingType; import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingMoveTaxonOperation; @@ -53,14 +54,14 @@ public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler { // check that only a single taxon tree node has been selected if(selection.size() > 1) { return new Status(IStatus.ERROR, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.SINGLE_TAXON_SELECTION_MESSAGE); } // check for no taxon tree node selected if(selection.size() == 0) { return new Status(IStatus.ERROR, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE); } // check that selected object is a taxon node @@ -69,7 +70,7 @@ public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler { oldTaxonNode = (TaxonNode)obj; } else { return new Status(IStatus.ERROR, - "unknown", + "unknown", //$NON-NLS-1$ TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE); } return Status.OK_STATUS; @@ -94,12 +95,12 @@ public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler { parentTaxonNode = TaxonNodeSelectionDialog.select(activeShell, new ConversationHolderMock(), - "Choose the taxon above the moved taxon.", + Messages.RemotingMoveTaxonNodeHandler_CHOOSE_TAXON, excludeTaxa, null, oldTaxonNode.getClassification()); - String[] buttonLables = {"Child", "Behind","Cancel"}; - MessageDialog dialog = new MessageDialog(null, "Target node", null, "Do you want to move the Taxonnode as child or behind the target node.", MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0); + String[] buttonLables = {Messages.RemotingMoveTaxonNodeHandler_CHILD, Messages.RemotingMoveTaxonNodeHandler_BEHIND,Messages.RemotingMoveTaxonNodeHandler_CANCEL}; + MessageDialog dialog = new MessageDialog(null, Messages.RemotingMoveTaxonNodeHandler_TARGET_NODE, null, Messages.RemotingMoveTaxonNodeHandler_TARGET_NODE_MESSAGE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0); dialog.open(); int returnCode = dialog.getReturnCode(); if (returnCode == 0){ @@ -110,7 +111,7 @@ public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler { } else { parentTaxonNode = TaxonNodeSelectionDialog.select(activeShell, new ConversationHolderMock(), - "Choose new parent", + Messages.RemotingMoveTaxonNodeHandler_CHOOSE_PARENT, excludeTaxa, null, oldTaxonNode.getClassification()); @@ -120,8 +121,8 @@ public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler { if(parentTaxonNode != null){ if(NavigationUtil.isDirty(parentTaxonNode)){ MessageDialog.openWarning(activeShell, - "Unsaved Parent Taxon", - "There are unsaved changes in the parent taxon. Please save first."); + Messages.RemotingMoveTaxonNodeHandler_UNSAVED_PARENT, + Messages.RemotingMoveTaxonNodeHandler_UNSAVED_PARENT_MESSAGE); return null; } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/SetSecReferenceForSubtreeHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/SetSecReferenceForSubtreeHandler.java new file mode 100755 index 000000000..6627094d5 --- /dev/null +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/SetSecReferenceForSubtreeHandler.java @@ -0,0 +1,142 @@ +/** +* Copyright (C) 2017 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.navigation.navigator.handler; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.apache.log4j.Logger; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.operations.AbstractOperation; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.jface.window.Window; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.ui.handlers.HandlerUtil; + +import eu.etaxonomy.cdm.api.service.config.SetSecundumForSubtreeConfigurator; +import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; +import eu.etaxonomy.cdm.model.taxon.TaxonNode; +import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels; +import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetSecundumForSubtreeOperation; +import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler; +import eu.etaxonomy.taxeditor.store.StoreUtil; +import eu.etaxonomy.taxeditor.ui.dialog.configurator.SetSecundumForSubtreeConfigurationWizard; + +/** + * @author k.luther + * @date 10.02.2017 + * + */ +public class SetSecReferenceForSubtreeHandler extends RemotingCdmHandler { + + private static final Logger logger = Logger + .getLogger(SetSecReferenceForSubtreeHandler.class); + + + private ITaxonTreeNode taxonNode; + private SetSecundumForSubtreeConfigurator configurator; + + /** + * @param label + */ + public SetSecReferenceForSubtreeHandler() { + super(TaxonNavigatorLabels.CHANGE_SECUNDUM_FOR_SUBTREE); + } + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public IStatus allowOperations(ExecutionEvent event) { + TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event); + // check that only a single taxon tree node has been selected + if(selection.size() > 1) { } + + // check for no taxon tree node selected + if(selection.size() == 0) { + return new Status(IStatus.ERROR, + "unknown", //$NON-NLS-1$ + TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE); + } + + // check that selected object is a taxon node + Object obj = selection.iterator().next(); + if(obj instanceof ITaxonTreeNode) { + taxonNode = (ITaxonTreeNode)obj; + } else { + return new Status(IStatus.ERROR, + "unknown", //$NON-NLS-1$ + TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE); + } + + + // check if corresponding name editor is closed + boolean editorClosed = NavigatorHandlerUtils.closeObsoleteEditor(event, (TaxonNode) taxonNode); + if(editorClosed != true) { + return new Status(IStatus.ERROR, + "unknown", //$NON-NLS-1$ + TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE); + } + + configurator = new SetSecundumForSubtreeConfigurator(taxonNode.getUuid()); + SetSecundumForSubtreeConfigurationWizard wizard = new SetSecundumForSubtreeConfigurationWizard(configurator); + + WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard); + + if (dialog.open() == Window.OK) { + return Status.OK_STATUS; + }else{ + return Status.CANCEL_STATUS; + } + +// if(!SetSecundumForSubtreeConfigurationWizard.openConfirmWithConfigurator(configurator)){ +// +// return Status.CANCEL_STATUS; +// } +// +// +// return Status.OK_STATUS; + } + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#doOperations(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public AbstractOperation prepareOperation(ExecutionEvent event) { + List excludeTaxa = new ArrayList(); + excludeTaxa.add(((TaxonNode)taxonNode).getTaxon().getUuid()); + + + + + SetSecundumForSubtreeOperation operation = + new SetSecundumForSubtreeOperation(event.getTrigger(), + false, + taxonNode.getUuid(), + configurator); + + return operation; + } + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public void onComplete() { + // TODO Auto-generated method stub + + } + + + + + + +} diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/ChangeAcceptedTaxonToSynonymOperation.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/ChangeAcceptedTaxonToSynonymOperation.java index 96141de43..adc2d45ac 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/ChangeAcceptedTaxonToSynonymOperation.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/ChangeAcceptedTaxonToSynonymOperation.java @@ -26,6 +26,7 @@ import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -88,8 +89,8 @@ public class ChangeAcceptedTaxonToSynonymOperation extends if (!result.getExceptions().isEmpty() && result.isOk()){ - String separator = ", "; - String exceptionString = ""; + String separator = ", "; //$NON-NLS-1$ + String exceptionString = ""; //$NON-NLS-1$ int count = result.getExceptions().size(); int n = 0; for (Exception exception : result.getExceptions()) { @@ -100,12 +101,12 @@ public class ChangeAcceptedTaxonToSynonymOperation extends } } - MessagingUtils.informationDialog("Synonym created but taxon deletion not possible.", exceptionString); + MessagingUtils.informationDialog(Messages.ChangeAcceptedTaxonToSynonymOperation_CREATE_SUCCESS, exceptionString); } else if (result.isAbort() || result.isError()){ - MessagingUtils.errorDialog("Synonym creation not possible", null, result.toString(), TaxeditorNavigationPlugin.PLUGIN_ID, null, true); + MessagingUtils.errorDialog(Messages.ChangeAcceptedTaxonToSynonymOperation_CREATE_FAIL, null, result.toString(), TaxeditorNavigationPlugin.PLUGIN_ID, null, true); } } catch (IllegalArgumentException e) { - MessagingUtils.errorDialog("Operation failed", this, e.getMessage(), TaxeditorNavigationPlugin.PLUGIN_ID, e, false); + MessagingUtils.errorDialog(Messages.ChangeAcceptedTaxonToSynonymOperation_OP_FAIL, this, e.getMessage(), TaxeditorNavigationPlugin.PLUGIN_ID, e, false); return Status.CANCEL_STATUS; } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java index 08f323a8e..cfe9d1534 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java @@ -19,7 +19,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.api.service.DeleteResult; import eu.etaxonomy.cdm.api.service.IClassificationService; @@ -31,6 +31,7 @@ import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils; import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; @@ -45,6 +46,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore; */ public class DeleteOperation extends AbstractPersistentPostOperation{ + private static final String TAXON_NODE_COULD_NOT_BE_DELETED = Messages.DeleteOperation_DELETE_FAIL; private Set treeNodes; protected final TaxonDeletionConfigurator config; private final ICdmEntitySessionEnabled cdmEntitySessionEnabled; @@ -102,7 +104,7 @@ public class DeleteOperation extends AbstractPersistentPostOperation{ bind(); monitor.worked(20); - ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration(); + ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration(); ITaxonNodeService service = controller.getTaxonNodeService(); if(taxonNode != null && taxonNode instanceof TaxonNode){ //((TaxonNode) treeNode).delete(); @@ -112,14 +114,14 @@ public class DeleteOperation extends AbstractPersistentPostOperation{ DeleteResult result = service.deleteTaxonNode((TaxonNode)taxonNode, config); if (result.isError() && !result.getExceptions().isEmpty()){ - DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID); + DeleteResultMessagingUtils.messageDialogWithDetails(result, TAXON_NODE_COULD_NOT_BE_DELETED, TaxeditorNavigationPlugin.PLUGIN_ID); } else if (!result.getExceptions().isEmpty()){ - String separator = ", "; - String exceptionString = ""; + String separator = ", "; //$NON-NLS-1$ + String exceptionString = ""; //$NON-NLS-1$ for (Exception exception : result.getExceptions()) { exceptionString += exception.getLocalizedMessage()+separator; } - DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode was successfully deleted, but related object(s) could not be deleted", TaxeditorNavigationPlugin.PLUGIN_ID); + DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteOperation_DELETE_SUCCESS, TaxeditorNavigationPlugin.PLUGIN_ID); } @@ -129,7 +131,7 @@ public class DeleteOperation extends AbstractPersistentPostOperation{ DeleteResult result = CdmStore.getService(IClassificationService.class).delete(taxonomicTree.getUuid()); if (result.isError() && !result.getExceptions().isEmpty()){ //TODO:Error message! - DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID); + DeleteResultMessagingUtils.messageDialogWithDetails(result, TAXON_NODE_COULD_NOT_BE_DELETED, TaxeditorNavigationPlugin.PLUGIN_ID); } } else { Set treeNodeUuids = new HashSet(); @@ -144,7 +146,7 @@ public class DeleteOperation extends AbstractPersistentPostOperation{ DeleteResult result = service.deleteTaxonNodes(treeNodeUuids, config); if (result.isError() && !result.getExceptions().isEmpty()){ //TODO:Error message! - DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID); + DeleteResultMessagingUtils.messageDialogWithDetails(result, TAXON_NODE_COULD_NOT_BE_DELETED, TaxeditorNavigationPlugin.PLUGIN_ID); } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/MoveTaxonOperation.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/MoveTaxonOperation.java index 1513977f3..eca7b851c 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/MoveTaxonOperation.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/MoveTaxonOperation.java @@ -24,6 +24,7 @@ import eu.etaxonomy.cdm.api.service.ITaxonNodeService; import eu.etaxonomy.cdm.api.service.UpdateResult; import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; import eu.etaxonomy.taxeditor.model.MessagingUtils; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapter.MovingType; import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; @@ -120,7 +121,7 @@ public class MoveTaxonOperation extends AbstractPersistentPostOperation { @Override public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - MessagingUtils.warn(this.getClass(), "Not implemented yet."); + MessagingUtils.warn(this.getClass(), Messages.MoveTaxonOperation_NOT_IMPLEMENTED); // iterate over oldParentTreeNodes, delete each TaxonNode from its actual parent and add to its former parent diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingChangeAcceptedTaxonToSynonymOperation.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingChangeAcceptedTaxonToSynonymOperation.java index 1b6096a8d..2020b2952 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingChangeAcceptedTaxonToSynonymOperation.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingChangeAcceptedTaxonToSynonymOperation.java @@ -17,6 +17,7 @@ import eu.etaxonomy.cdm.api.application.CdmApplicationState; import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action; import eu.etaxonomy.cdm.api.service.ITaxonNodeService; import eu.etaxonomy.cdm.api.service.UpdateResult; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; @@ -31,7 +32,7 @@ public class RemotingChangeAcceptedTaxonToSynonymOperation extends RemotingCdmUp private final UUID newAcceptedTaxonNodeUuid; - private final static String LABEL = "Change Accepted Taxon to Synonym operation"; + private final static String LABEL = Messages.RemotingChangeAcceptedTaxonToSynonymOperation_CHANGE_OP; /** * @param label diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingDeleteTaxonNodeOperation.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingDeleteTaxonNodeOperation.java index 8cd883626..7e3562b5b 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingDeleteTaxonNodeOperation.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingDeleteTaxonNodeOperation.java @@ -22,6 +22,7 @@ import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; import eu.etaxonomy.cdm.model.taxon.Classification; import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; import eu.etaxonomy.cdm.model.taxon.TaxonNode; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; /** @@ -31,7 +32,7 @@ import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; */ public class RemotingDeleteTaxonNodeOperation extends RemotingCdmUpdateOperation { - private final static String LABEL = "Delete Taxon Node operation"; + private final static String LABEL = Messages.RemotingDeleteTaxonNodeOperation_DELETE_OP; private final Set treeNodes; private final TaxonDeletionConfigurator config; diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingMoveFactualDataOperation.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingMoveFactualDataOperation.java index f27d2bc46..f863bdd15 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingMoveFactualDataOperation.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingMoveFactualDataOperation.java @@ -17,6 +17,7 @@ import eu.etaxonomy.cdm.api.application.CdmApplicationState; import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action; import eu.etaxonomy.cdm.api.service.IDescriptionService; import eu.etaxonomy.cdm.api.service.UpdateResult; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; /** @@ -26,7 +27,7 @@ import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; */ public class RemotingMoveFactualDataOperation extends RemotingCdmUpdateOperation { - private final static String LABEL = "Move Factual Data operation"; + private final static String LABEL = Messages.RemotingMoveFactualDataOperation_MOVE_OP; private final UUID sourceTaxonUuid; private final UUID targetParentTaxonUuid; diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingMoveTaxonOperation.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingMoveTaxonOperation.java index 9c4c646d9..cbaf288db 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingMoveTaxonOperation.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingMoveTaxonOperation.java @@ -20,6 +20,7 @@ import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action; import eu.etaxonomy.cdm.api.service.ITaxonNodeService; import eu.etaxonomy.cdm.api.service.UpdateResult; import eu.etaxonomy.cdm.model.taxon.TaxonNode; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapter.MovingType; import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; @@ -30,7 +31,7 @@ import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; */ public class RemotingMoveTaxonOperation extends RemotingCdmUpdateOperation { - private final static String LABEL = "Move Taxon operation"; + private final static String LABEL = Messages.RemotingMoveTaxonOperation_MOVE_OP; private final Set taxonNodesToMoveUuid; private final UUID newParentTreeNodeUuid; @@ -86,7 +87,7 @@ public class RemotingMoveTaxonOperation extends RemotingCdmUpdateOperation { default: UpdateResult result = new UpdateResult(); result.setAbort(); - result.addException(new Exception("The moving type is invalid.")); + result.addException(new Exception("The moving type is invalid.")); //$NON-NLS-1$ return result; } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/SetSecundumForSubtreeOperation.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/SetSecundumForSubtreeOperation.java new file mode 100755 index 000000000..77bcde715 --- /dev/null +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/SetSecundumForSubtreeOperation.java @@ -0,0 +1,62 @@ +/** +* Copyright (C) 2017 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.navigation.navigator.operation; + +import java.util.UUID; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; + +import eu.etaxonomy.cdm.api.application.CdmApplicationState; +import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action; +import eu.etaxonomy.cdm.api.service.ITaxonNodeService; +import eu.etaxonomy.cdm.api.service.UpdateResult; +import eu.etaxonomy.cdm.api.service.config.SetSecundumForSubtreeConfigurator; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; +import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; + +/** + * @author k.luther + * @date 10.02.2017 + * + */ +public class SetSecundumForSubtreeOperation extends RemotingCdmUpdateOperation{ + + private final static String LABEL = Messages.SetSecundumForSubtreeOperation_CHANGE_SEC_OP; + + UUID parentUuid; + SetSecundumForSubtreeConfigurator config; + + /** + * @param label + * @param action + * @param source + * @param async + */ + public SetSecundumForSubtreeOperation(Object source, + boolean async, + UUID taxonNodeUuid, + SetSecundumForSubtreeConfigurator config) { + super(LABEL, Action.Update, source, async); + parentUuid = taxonNodeUuid; + this.config = config; + } + + /** + * {@inheritDoc} + */ + @Override + protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception { + monitor.beginTask(Messages.SetSecundumForSubtreeOperation_SET_SEC_TASK, 10); + UpdateResult result = CdmApplicationState.getService(ITaxonNodeService.class).setSecundumForSubtree(config, null); + monitor.done(); + return result; + } + +} diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/operation/CreateNewTaxonHierarchyOperation.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/operation/CreateNewTaxonHierarchyOperation.java index ee5763353..5d7366903 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/operation/CreateNewTaxonHierarchyOperation.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/operation/CreateNewTaxonHierarchyOperation.java @@ -22,6 +22,7 @@ import eu.etaxonomy.cdm.api.service.UpdateResult; import eu.etaxonomy.cdm.model.common.CdmBase; import eu.etaxonomy.cdm.model.taxon.Classification; import eu.etaxonomy.taxeditor.model.MessagingUtils; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -61,9 +62,9 @@ public class CreateNewTaxonHierarchyOperation extends AbstractPersistentPostOper Set unchangedObjects = result.getUnchangedObjects(); Classification classification2 = CdmBase.deproxy(result.getCdmEntity(), Classification.class); - MessagingUtils.informationDialog("Add Hierarchy successful", "New classification is " - + classification2.getTitleCache() + "\nCreated Genus: " + updatedObjects.size() - +"\nCreated Subspecies: " + unchangedObjects.size()); + MessagingUtils.informationDialog(Messages.CreateNewTaxonHierarchyOperation_ADD_HIERARCHY, + String.format(Messages.CreateNewTaxonHierarchyOperation_ADD_HIERARCHY_MESSAGE, + classification2.getTitleCache(), updatedObjects.size(), unchangedObjects.size())); return postExecute(result.getCdmEntity()); } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/operation/CreateTaxonNode.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/operation/CreateTaxonNode.java index 7d213a104..3fb4b2871 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/operation/CreateTaxonNode.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/operation/CreateTaxonNode.java @@ -23,6 +23,7 @@ import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.model.MessagingUtils; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; @@ -106,7 +107,7 @@ public class CreateTaxonNode extends AbstractPersistentPostOperation { return postExecute(childTaxonNode); }catch(Exception e){ - MessagingUtils.messageDialog("Could not create taxon node", getClass(), e.getLocalizedMessage(), e); + MessagingUtils.messageDialog(Messages.CreateTaxonNode_CREATE_FAILED, getClass(), e.getLocalizedMessage(), e); return Status.CANCEL_STATUS; } } @@ -129,7 +130,7 @@ public class CreateTaxonNode extends AbstractPersistentPostOperation { public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - MessagingUtils.warn(this.getClass(), "Not yet implemented."); + MessagingUtils.warn(this.getClass(), "Not yet implemented."); //$NON-NLS-1$ return null; } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/Messages.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/Messages.java deleted file mode 100644 index cabc544aa..000000000 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/Messages.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (C) 2014 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.navigation.search; - -import org.eclipse.osgi.util.NLS; - -/** - * @author d.schild - * @date 18.06.2014 - * - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "OSGI-INF/l10n/messages"; //$NON-NLS-1$ - public static String SearchBar_0; - public static String SearchBar_1; - public static String SearchBar_2; - public static String SearchBar_3; - public static String SearchBar_4; - public static String SearchBar_6; - public static String SearchBar_7; - public static String SearchBar_8; - public static String SearchBar_9; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java index 0b984e132..9d4c93f61 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java @@ -40,6 +40,7 @@ import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.IContextListener; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; import eu.etaxonomy.taxeditor.preference.Resources; diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultLabelProvider.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultLabelProvider.java index ade78cbb7..fc619781a 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultLabelProvider.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultLabelProvider.java @@ -22,6 +22,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache; import eu.etaxonomy.taxeditor.model.ImageResources; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.preference.Resources; /** @@ -74,12 +75,12 @@ public class SearchResultLabelProvider extends ColumnLabelProvider implements IL if(element instanceof UuidAndTitleCache){ Class type = ((UuidAndTitleCache) element).getType(); if(type == Taxon.class){ - return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorAccepted"); + return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorAccepted"); //$NON-NLS-1$ }else if(type == Synonym.class){ - return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorSynonym"); + return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorSynonym"); //$NON-NLS-1$ } } - return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorDefault"); + return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorDefault"); //$NON-NLS-1$ } /* (non-Javadoc) @@ -116,12 +117,12 @@ public class SearchResultLabelProvider extends ColumnLabelProvider implements IL public String getToolTipText(Object element) { if(element instanceof TaxonBase){ if(element instanceof Synonym){ - return "Synonym: " + ((TaxonBase) element).getName().getTitleCache(); + return Messages.SearchResultLabelProvider_SYNONYM + ((TaxonBase) element).getName().getTitleCache(); }else{ - return "Taxon: " + ((TaxonBase) element).getName().getTitleCache(); + return Messages.SearchResultLabelProvider_TAXON + ((TaxonBase) element).getName().getTitleCache(); } } - return "Name: " + element.toString(); + return Messages.SearchResultLabelProvider_NAME + element.toString(); } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java index 18760f5c0..f440f6edc 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java @@ -48,6 +48,7 @@ import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.ContextListenerAdapter; import eu.etaxonomy.taxeditor.model.IContextListener; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; +import eu.etaxonomy.taxeditor.navigation.l10n.Messages; import eu.etaxonomy.taxeditor.navigation.search.SearchBar.SearchOption; import eu.etaxonomy.taxeditor.store.CdmStore; @@ -69,7 +70,7 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ */ @Override public void contextStop(IMemento memento, IProgressMonitor monitor) { - monitor.subTask("Getting rid of search results"); + monitor.subTask(Messages.SearchResultView_REMOVE_SEARCH_RESULTS); AbstractUtility.hideView(SearchResultView.this); } } @@ -148,7 +149,7 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ composite.setLayout(new GridLayout(2, false)); Label searchStringLabel = new Label(composite, SWT.NULL); - searchStringLabel.setText("Search String:"); + searchStringLabel.setText(Messages.SearchResultView_SEARCH_STRING); searchString = new Text(composite, SWT.NULL); searchString.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); @@ -156,14 +157,14 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ // searchString.setText(" "); Label configurationDescriptionLabel = new Label(composite, SWT.NULL); - configurationDescriptionLabel.setText("Search for:"); + configurationDescriptionLabel.setText(Messages.SearchResultView_SEARCH_FOR); configurationLabel = new Text(composite, SWT.WRAP); configurationLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); configurationLabel.setEditable(false); Label statusLabel = new Label(composite, SWT.NULL); - statusLabel.setText("Status:"); + statusLabel.setText(Messages.SearchResultView_STATUS); status = new Text(composite, SWT.NULL); status.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); @@ -178,7 +179,7 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ * @param configurator a {@link eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator} object. */ public void performSearch(IFindTaxaAndNamesConfigurator configurator){ - setPartName("Search: '" + configurator.getTitleSearchString() + "'"); + setPartName(String.format(Messages.SearchResultView_SEARCH, configurator.getTitleSearchString())); searchString.setText(configurator.getTitleSearchString()); @@ -197,17 +198,17 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ } configurator.setMatchMode(MatchMode.LIKE); - String includedEntitiesString = ""; + String includedEntitiesString = ""; //$NON-NLS-1$ for (int i = 0; i < includedEntities.size(); i++){ includedEntitiesString += includedEntities.get(i); if(i < includedEntities.size() -1){ - includedEntitiesString += ", "; + includedEntitiesString += ", "; //$NON-NLS-1$ } } configurationLabel.setText(includedEntitiesString); - status.setText("Searching..."); + status.setText(Messages.SearchResultView_SEARCHING); searchJob = new SearchJob(Display.getCurrent(), configurator); searchJob.schedule(); @@ -222,10 +223,10 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ protected void displaySearchResult(List> result) { if(result.size() > 0){ resultViewer.setInput(result); - status.setText(result.size() + " entities found"); + status.setText(String.format(Messages.SearchResultView_CNT_ENTITIES_FOUND, result.size())); }else{ resultViewer.setInput(EMPTY); - status.setText("Search returned no results"); + status.setText(Messages.SearchResultView_NO_RESULTS); } } @@ -294,7 +295,7 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ * @param name */ public SearchJob(Display display, IFindTaxaAndNamesConfigurator configurator) { - super("Performing Search"); + super(Messages.SearchResultView_PERFORMING_SEARCH); this.display = display; this.configurator = configurator; } @@ -304,7 +305,7 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ */ @Override protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask("", 100); + monitor.beginTask("", 100); //$NON-NLS-1$ monitor.worked(20); final List> searchResult = CdmStore.getSearchManager().findTaxaAndNames(configurator); @@ -321,7 +322,7 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ display.asyncExec(new Runnable() { @Override public void run() { - status.setText("Cancelled"); + status.setText(Messages.SearchResultView_CANCELLED); } }); } diff --git a/eu.etaxonomy.taxeditor.printpublisher/.classpath b/eu.etaxonomy.taxeditor.printpublisher/.classpath index 60dea2f68..73bc41dc2 100644 --- a/eu.etaxonomy.taxeditor.printpublisher/.classpath +++ b/eu.etaxonomy.taxeditor.printpublisher/.classpath @@ -1,6 +1,6 @@ - + diff --git a/eu.etaxonomy.taxeditor.printpublisher/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.printpublisher/META-INF/MANIFEST.MF index 0a3001567..f7744fbe9 100644 --- a/eu.etaxonomy.taxeditor.printpublisher/META-INF/MANIFEST.MF +++ b/eu.etaxonomy.taxeditor.printpublisher/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Printpublisher Bundle Bundle-SymbolicName: eu.etaxonomy.taxeditor.printpublisher;singleton:=true -Bundle-Version: 4.5.1 +Bundle-Version: 4.6.0 Require-Bundle: org.eclipse.osgi, org.eclipse.ui, eu.etaxonomy.taxeditor.cdmlib, diff --git a/eu.etaxonomy.taxeditor.printpublisher/pom.xml b/eu.etaxonomy.taxeditor.printpublisher/pom.xml index e4b725bce..e2c98274c 100644 --- a/eu.etaxonomy.taxeditor.printpublisher/pom.xml +++ b/eu.etaxonomy.taxeditor.printpublisher/pom.xml @@ -3,7 +3,7 @@ taxeditor-parent eu.etaxonomy - 4.5.1 + 4.6.0 4.0.0 diff --git a/eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/handler/GeneratePdfHandler.java b/eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/handler/GeneratePdfHandler.java index a9750e13a..8cde7d596 100644 --- a/eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/handler/GeneratePdfHandler.java +++ b/eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/handler/GeneratePdfHandler.java @@ -20,7 +20,7 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.ui.handlers.HandlerUtil; import org.jdom.Element; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.print.IXMLEntityFactory; import eu.etaxonomy.cdm.print.PublishConfigurator; import eu.etaxonomy.cdm.print.out.pdf.PdfOutputModule; @@ -55,7 +55,7 @@ public class GeneratePdfHandler extends AbstractHandler { return null; } - configurator = PublishConfigurator.NewLocalInstance((ICdmApplicationConfiguration) CdmStore.getCurrentApplicationConfiguration()); + configurator = PublishConfigurator.NewLocalInstance((ICdmRepository) CdmStore.getCurrentApplicationConfiguration()); Element taxonNodeElement = getTaxonNodeElement((TaxonEditorInput) input); configurator.addSelectedTaxonNodeElements(taxonNodeElement); diff --git a/eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/wizard/SelectServiceWizardPage.java b/eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/wizard/SelectServiceWizardPage.java index 62da29cc6..043f7eb2c 100644 --- a/eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/wizard/SelectServiceWizardPage.java +++ b/eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/wizard/SelectServiceWizardPage.java @@ -38,7 +38,7 @@ import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Text; import org.jdom.Element; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.print.IXMLEntityFactory; import eu.etaxonomy.cdm.print.PublishConfigurator; import eu.etaxonomy.cdm.print.XMLHelper; @@ -179,7 +179,7 @@ public class SelectServiceWizardPage extends AbstractPublishWizardPage { text_serviceUrl.setEnabled(false); - setConfigurator(PublishConfigurator.NewLocalInstance((ICdmApplicationConfiguration) CdmStore.getCurrentApplicationConfiguration())); + setConfigurator(PublishConfigurator.NewLocalInstance((ICdmRepository) CdmStore.getCurrentApplicationConfiguration())); getConfigurator().addOutputModule(getOutputModule()); refresh(); } diff --git a/eu.etaxonomy.taxeditor.store/.classpath b/eu.etaxonomy.taxeditor.store/.classpath index db46751e9..6d865ded7 100644 --- a/eu.etaxonomy.taxeditor.store/.classpath +++ b/eu.etaxonomy.taxeditor.store/.classpath @@ -1,6 +1,6 @@ - + diff --git a/eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF index 3c018f391..12115ea9c 100644 --- a/eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF +++ b/eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: DataStore Bundle Bundle-SymbolicName: eu.etaxonomy.taxeditor.store;singleton:=true -Bundle-Version: 4.5.1 +Bundle-Version: 4.6.0 Bundle-Activator: eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin Bundle-Vendor: EDIT Export-Package: eu.etaxonomy.cdm, @@ -34,7 +34,8 @@ Export-Package: eu.etaxonomy.cdm, eu.etaxonomy.taxeditor.ui.bar, eu.etaxonomy.taxeditor.ui.combo, eu.etaxonomy.taxeditor.ui.dialog, - eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator, + eu.etaxonomy.taxeditor.ui.dialog.configurator, + eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator, eu.etaxonomy.taxeditor.ui.dialog.selection, eu.etaxonomy.taxeditor.ui.element, eu.etaxonomy.taxeditor.ui.group.grantedauthority, diff --git a/eu.etaxonomy.taxeditor.store/build.properties b/eu.etaxonomy.taxeditor.store/build.properties index d805fefc5..d3038a6fe 100644 --- a/eu.etaxonomy.taxeditor.store/build.properties +++ b/eu.etaxonomy.taxeditor.store/build.properties @@ -10,6 +10,6 @@ bin.includes = META-INF/,\ OSGI-INF/,\ OSGI-INF/l10n/bundle.properties,\ OSGI-INF/l10n/bundle_de.properties,\ - OSGI-INF/l10n/messages.properties,\ - OSGI-INF/l10n/messages_de.properties,\ + src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties,\ + src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties diff --git a/eu.etaxonomy.taxeditor.store/plugin.xml b/eu.etaxonomy.taxeditor.store/plugin.xml index 78c18fd13..dba3174e3 100755 --- a/eu.etaxonomy.taxeditor.store/plugin.xml +++ b/eu.etaxonomy.taxeditor.store/plugin.xml @@ -195,12 +195,12 @@ id="eu.etaxonomy.taxeditor.preferences.typeDesignation" name="%page.name.25"> - - + --> - - + --> eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 4.0.0 diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesPage.java index 677d5f8c3..e6b52b30e 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesPage.java @@ -28,6 +28,7 @@ import org.eclipse.swt.widgets.TabItem; import eu.etaxonomy.cdm.model.metadata.CdmPreference; import eu.etaxonomy.cdm.model.name.NomenclaturalCode; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper; import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator; @@ -40,21 +41,27 @@ import eu.etaxonomy.taxeditor.preference.PreferencesUtil; */ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ - - CdmPreference preferedNomenclaturalCode; NameDetailsConfigurator config ; + CdmPreference isRedListPreference; + CdmPreference determinationOnlyForFieldUnitsPreference; + CdmPreference showCollectingAreaInGeneralSectionPreference; + CdmPreference showTaxonAssociationsPreference; + + TabFolder tabFolder; - // private int maxNumOfColumns; + IPreferenceStore preferenceStore; Composite composite; boolean isSimpleDetailsViewActivated; Composite child ; private Combo nomenclaturalCodeCombo; - private Label nomenclaturalCodeLabel; +// private UriWithLabelElement nomenclaturalCodeCombo; +// private Label nomenclaturalCodeLabel; + String[][] labelAndValues; /* @@ -72,56 +79,8 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ this.preferenceStore = store; } -// @Override -// protected void createFieldEditors() { -// setMessage("Choose the preferences for the whole cdm store."); -// tabFolder = new TabFolder(getFieldEditorParent(), SWT.NONE); -// -// createNomenclaturalCodeTab(); -// createNameDetailsConfiguration(); -// -// -// } - - - -// -// /*** -// * Adjust the layout of the field editors so that they are properly aligned. -// */ -// @Override -// protected void adjustGridLayout() { -// if (tabFolder != null){ -// TabItem[] items = tabFolder.getItems(); -// for (int j = 0; j < items.length; j++){ -// GridLayout layout = ((GridLayout) ((Composite) items[j].getControl()).getLayout()); -// layout.numColumns = this.maxNumOfColumns; -// layout.marginHeight = 5; -// layout.marginWidth = 5; -// } -// } -// // need to call super.adjustGridLayout() since fieldEditor.adjustForNumColumns() is protected -// super.adjustGridLayout(); -// -// // reset the main container to a single column -// ((GridLayout) super.getFieldEditorParent().getLayout()).numColumns = 1; -// } - -// /*** -// * Returns a parent composite for a field editor. -// *

-// * This value must not be cached since a new parent may be created each time this method called. Thus this method -// * must be called each time a field editor is constructed. -// *

-// * @return a parent -// */ -// @Override -// protected Composite getEditorParent(){ -// if (tabFolder == null || tabFolder.getItemCount() == 0){ -// return super.getWizard(); -// } -// return (Composite) tabFolder.getItem(tabFolder.getItemCount() - 1).getControl(); -// } + + /*** * Adds a tab to the page. @@ -157,7 +116,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ if (composite == null){ composite = parent; } - composite = addTab("Name Details View Configuration"); + composite = addTab(Messages.DatabasePreferencesPage_details_view_configuration); // TabItem tbtmNameDetailsConfiguration = new TabItem(tabFolder, SWT.NONE); // Composite c2 = new Composite(tabFolder, SWT.BORDER); // c2.setLayout(new GridLayout(1, true)); @@ -170,7 +129,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ isSimpleDetailsViewActivated= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION); final Button activateCheckButton = new Button(composite, SWT.CHECK); - activateCheckButton.setText("Show only a simple name details view"); + activateCheckButton.setText(Messages.DatabasePreferencesPage_show_only_simple_details_view); activateCheckButton.setSelection(isSimpleDetailsViewActivated); activateCheckButton.addSelectionListener(new SelectionAdapter(){ @Override @@ -193,7 +152,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ final Button showTaxon = new Button(child, SWT.CHECK); boolean isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON); - showTaxon.setText("Show taxon of the name"); + showTaxon.setText(Messages.DatabasePreferencesPage_show_taxon); showTaxon.setSelection(isShowTaxon); showTaxon.addSelectionListener(new SelectionAdapter(){ @Override @@ -205,7 +164,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ final Button showLsid = new Button(child, SWT.CHECK); boolean isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID); - showLsid.setText("Show Lsid of the name"); + showLsid.setText(Messages.DatabasePreferencesPage_show_lsid); showLsid.setSelection(isShowLSID); showLsid.addSelectionListener(new SelectionAdapter(){ @Override @@ -217,7 +176,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ final Button showNomenclaturalCode = new Button(child, SWT.CHECK); boolean isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE); - showNomenclaturalCode.setText("Show the nomenclatural code"); + showNomenclaturalCode.setText(Messages.DatabasePreferencesPage_show_nomenclatural_code); showNomenclaturalCode.setSelection(isShowNomenclaturalCode); showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){ @Override @@ -229,7 +188,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ final Button showNameCache = new Button(child, SWT.CHECK); boolean isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE); - showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)"); + showNameCache.setText(Messages.DatabasePreferencesPage_show_namecache); showNameCache.setSelection(isShowNomenclaturalCode); showNameCache.addSelectionListener(new SelectionAdapter(){ @Override @@ -240,7 +199,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ }); final Button showAppendedPhrase = new Button(child, SWT.CHECK); boolean isShowAppendedPhrase = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE); - showAppendedPhrase.setText("Show appended phrase"); + showAppendedPhrase.setText(Messages.DatabasePreferencesPage_show_appended_phrase); showAppendedPhrase.setSelection(isShowAppendedPhrase); showAppendedPhrase.addSelectionListener(new SelectionAdapter(){ @Override @@ -252,7 +211,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ final Button showRank = new Button(child, SWT.CHECK); boolean isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK); - showRank.setText("Show rank of the name"); + showRank.setText(Messages.DatabasePreferencesPage_show_rank); showRank.setSelection(isShowRank); showRank.addSelectionListener(new SelectionAdapter(){ @Override @@ -263,7 +222,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ }); final Button showEpithets = new Button(child, SWT.CHECK); boolean isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS); - showEpithets.setText("Show atomised epithets"); + showEpithets.setText(Messages.DatabasePreferencesPage_show_atomised_epithets); showEpithets.setSelection(isShowEpithets); showEpithets.addSelectionListener(new SelectionAdapter(){ @Override @@ -272,9 +231,21 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, isShowEpithets); } }); + final Button showAuthorshipCache = new Button(child, SWT.CHECK); + boolean isShowAuthorshipCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE); + showAuthorshipCache.setText(Messages.DatabasePreferencesPage_show_authorship_cache); + showAuthorshipCache.setSelection(isShowAuthorshipCache); + showAuthorshipCache.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowAuthorshipCache = showAuthorshipCache.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE, isShowAuthorshipCache); + } + }); + final Button showAuthorship = new Button(child, SWT.CHECK); boolean isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP); - showAuthorship.setText("Show authorship section"); + showAuthorship.setText(Messages.DatabasePreferencesPage_show_author_section); showAuthorship.setSelection(isShowAuthorship); showAuthorship.addSelectionListener(new SelectionAdapter(){ @Override @@ -286,7 +257,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ final Button showNomenclaturalRef = new Button(child, SWT.CHECK); boolean isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE); - showNomenclaturalRef.setText("Show nomenclatural reference section"); + showNomenclaturalRef.setText(Messages.DatabasePreferencesPage_Show_nomenclatural_Ref); showNomenclaturalRef.setSelection(isShowNomenclaturalRef); showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){ @Override @@ -298,7 +269,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ final Button showNomenclaturalStatus = new Button(child, SWT.CHECK); boolean isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS); - showNomenclaturalStatus.setText("Show nomenclatural status section"); + showNomenclaturalStatus.setText(Messages.DatabasePreferencesPage_Show_nomenclaturalStatus); showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus); showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){ @Override @@ -310,7 +281,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ final Button showProtologue = new Button(child, SWT.CHECK); boolean isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE); - showProtologue.setText("Show protologue section"); + showProtologue.setText(Messages.DatabasePreferencesPage_Show_Protologue); showProtologue.setSelection(isShowProtologue); showProtologue.addSelectionListener(new SelectionAdapter(){ @Override @@ -322,7 +293,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ final Button showTypeDesignation = new Button(child, SWT.CHECK); boolean isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION); - showTypeDesignation.setText("Show name type designation section"); + showTypeDesignation.setText(Messages.DatabasePreferencesPage_Show_Type_designation); showTypeDesignation.setSelection(isShowTypeDesignation); showTypeDesignation.addSelectionListener(new SelectionAdapter(){ @Override @@ -335,7 +306,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ final Button showNameRelationship = new Button(child, SWT.CHECK); boolean isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP); - showNameRelationship.setText("Show name relationship section"); + showNameRelationship.setText(Messages.DatabasePreferencesPage_Show_NameRelations); showNameRelationship.setSelection(isShowNameRelationship); showNameRelationship.addSelectionListener(new SelectionAdapter(){ @Override @@ -355,77 +326,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ // Label emptyLabel = new Label(getFieldEditorParent(), 0); -// addField(new BooleanFieldEditor( -// IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, "show simple (configurable) details", getFieldEditorParent())); -// addField(new SpacerFieldEditor(getFieldEditorParent())); -// -// addField(new BooleanFieldEditor( -// IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, -// "show taxon section", -// getFieldEditorParent())); -// -// addField(new BooleanFieldEditor( -// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE, -// "show name cache", -// getFieldEditorParent())); -// -// addField(new BooleanFieldEditor( -// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, -// "show LSID of the name", -// getFieldEditorParent())); -// -// -// addField(new BooleanFieldEditor( -// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, -// "show nomenclatural code of the name", -// getFieldEditorParent())); -// -// -// addField(new BooleanFieldEditor( -// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE, -// "show appended phrase", -// getFieldEditorParent())); -// -// -// addField(new BooleanFieldEditor( -// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, -// "show rank of the name", -// getFieldEditorParent())); -// -// -// addField(new BooleanFieldEditor( -// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, -// "show atomised epithets of the name", -// getFieldEditorParent())); -// -// addField(new BooleanFieldEditor( -// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, -// "show authorship section", -// getFieldEditorParent())); -// -// -// addField(new BooleanFieldEditor( -// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, -// "show nomenclatural reference section", -// getFieldEditorParent())); -// -// -// addField( new BooleanFieldEditor( -// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, -// "show nomenclatural status section", -// getFieldEditorParent())); -// -// -// addField(new BooleanFieldEditor( -// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, -// "show protologue section", -// getFieldEditorParent())); -// -// -// addField(new BooleanFieldEditor( -// IPreferenceKeys.ALLOW_OVERRIDE_NAMEDETAILS, -// "allow to use local preference", -// getFieldEditorParent())); + } @@ -451,32 +352,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ } return labelAndValues; } -// @Override -// public boolean performOk() { -// if (doGetPreferenceStore()== null){ -// setPreferenceStore(PreferencesUtil.getPreferenceStore()); -// } -// -// -// String value =doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY); -// boolean allowOverride = doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY); -// CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value); -// pref.setAllowOverride(allowOverride); -// ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration(); -// if (controller == null){ -// return false; -// } -// IPreferenceService service = controller.getPreferenceService(); -// service.set(pref); -// createNameDetailsViewConfig(); -// value =config.toString(); -// allowOverride = doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAMEDETAILS); -// pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NameDetailsView, value); -// pref.setAllowOverride(allowOverride); -// service.set(pref); -// -// return true; -// } + /** * @@ -500,7 +376,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ } public void createNomenclaturalCodeTab(Composite parent){ - composite = addTab("Nomenclatural Code"); + composite = addTab(Messages.DatabasePreferencesPage_Define_Default_NomenclaturalCode); nomenclaturalCodeCombo = new Combo(composite, SWT.READ_ONLY); List supportedCodes = NomenclaturalCodeHelper .getSupportedCodes(); @@ -510,6 +386,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ } getLabelAndValues(); + //get the actual nomenclatural code and set it as selection: doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY); nomenclaturalCodeCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent evt) { @@ -532,7 +409,7 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ final Button useLocalPreference = new Button(composite, SWT.CHECK); boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY); - useLocalPreference.setText("allow to use local preference"); + useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences); useLocalPreference.setSelection(isUseLocalPreference); useLocalPreference.addSelectionListener(new SelectionAdapter(){ @Override @@ -543,23 +420,102 @@ public class DatabasePreferencesPage extends WizardPage implements IWizardPage{ }); - // Label emptyLabel = new Label(getFieldEditorParent(), 0); - // addField(new ComboFieldEditor( -// IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY, -// "Choose which nomenclatural code you would like to use for scientific names unless otherwise specified.", getLabelAndValues(), -// getFieldEditorParent())); -// -// -// addField(new BooleanFieldEditor( -// IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY, -// "allow to use local preference", -// getFieldEditorParent())); -// adjustGridLayout(); } + public void createBiocaseProviderTab(Composite parent){ + composite = addTab(Messages.DatabasePreferencesPage_Biocase_Provider); + nomenclaturalCodeCombo = new Combo(composite, SWT.READ_ONLY); + List supportedCodes = NomenclaturalCodeHelper + .getSupportedCodes(); + for (NomenclaturalCode code: supportedCodes) { + nomenclaturalCodeCombo.add(NomenclaturalCodeHelper + .getDescription(code)); + + } + getLabelAndValues(); + //get the actual nomenclatural code and set it as selection: doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY); + nomenclaturalCodeCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent evt) { + + String name = nomenclaturalCodeCombo.getText(); + String selectedPreferenceKey = null; + for (String[] labelAndValue: labelAndValues){ + if (labelAndValue[0].equals(name)){ + selectedPreferenceKey = labelAndValue[1]; + } + } + + + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY, selectedPreferenceKey); + + } + }); + nomenclaturalCodeLabel = new Label(composite, SWT.READ_ONLY); + + + final Button useLocalPreference = new Button(composite, SWT.CHECK); + boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY); + useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences); + useLocalPreference.setSelection(isUseLocalPreference); + useLocalPreference.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isUseLocalPreference = useLocalPreference.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY, isUseLocalPreference); + } + }); + + + + } + + + public void createSpecimenOrObservationTab(Composite parent){ + composite = addTab(Messages.DatabasePreferencesPage_Specimen_Or_Observation); + + final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK); + boolean isShowCollectingAreaInGeneralSection = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION); + showCollectingAreaInGeneralSectionButton.setText(Messages.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section); + showCollectingAreaInGeneralSectionButton.setSelection(isShowCollectingAreaInGeneralSection); + showCollectingAreaInGeneralSectionButton.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowCollectingAreaInGeneralSection = showCollectingAreaInGeneralSectionButton.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION, isShowCollectingAreaInGeneralSection); + } + }); + + final Button determinationOnlyForFieldUnitsButton = new Button(composite, SWT.CHECK); + boolean isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS); + determinationOnlyForFieldUnitsButton.setText(Messages.DatabasePreferncesPage_Determination_only_for_field_unnits); + determinationOnlyForFieldUnitsButton.setSelection(isDeterminationOnlyForFieldUnits); + determinationOnlyForFieldUnitsButton.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isDeterminationOnlyForFieldUnits = determinationOnlyForFieldUnitsButton.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS, isDeterminationOnlyForFieldUnits); + } + }); + + final Button showTaxonAssociationButton = new Button(composite, SWT.CHECK); + boolean isShowTaxonAssociation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS); + showTaxonAssociationButton.setText(Messages.DatabasePreferncesPage_Taxon_Associations); + showTaxonAssociationButton.setSelection(isShowTaxonAssociation); + showTaxonAssociationButton.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowTaxonAssociation = showTaxonAssociationButton.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS, isShowTaxonAssociation); + } + }); + + + + } /** * {@inheritDoc} @@ -654,6 +610,8 @@ public void setWizard(IWizard newWizard) { public void createControl(Composite parent) { createNameDetailsConfiguration(parent); createNomenclaturalCodeTab(parent); + + createSpecimenOrObservationTab(parent); setControl(parent); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesWizard.java index e7b27038c..54544acf4 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesWizard.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesWizard.java @@ -10,7 +10,7 @@ package eu.etaxonomy.taxeditor.databaseAdmin.wizard; import org.eclipse.jface.wizard.Wizard; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.api.service.IPreferenceService; import eu.etaxonomy.cdm.model.metadata.CdmPreference; import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; @@ -25,19 +25,25 @@ import eu.etaxonomy.taxeditor.store.CdmStore; public class DatabasePreferencesWizard extends Wizard { - private final DatabasePreferencesPage preferencePage; + public DatabasePreferencesPage preferencePage; public DatabasePreferencesWizard() { setWindowTitle("Database Preferences Wizard"); - preferencePage = new DatabasePreferencesPage("Nomenclatural Code"); + preferencePage = new DatabasePreferencesPage("Database Preferences"); // preferencePage.setDescription("Choose which nomenclatural code you would like to use for scientific names unless otherwise specified."); // preferencePage.init(PlatformUI.getWorkbench()); } + /** + * @return the preferencePage + */ + public DatabasePreferencesPage getPreferencePage() { + return preferencePage; + } /** * {@inheritDoc} */ @@ -51,7 +57,7 @@ public class DatabasePreferencesWizard extends Wizard { CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value); pref.setAllowOverride(allowOverride); - ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration(); + ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration(); if (controller == null){ return false; } @@ -65,15 +71,26 @@ public class DatabasePreferencesWizard extends Wizard { pref.setAllowOverride(allowOverride); service.set(pref); + + boolean isDeterminationOnlyForFieldUnit= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS ); + pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.DeterminationOnlyForFieldUnits, String.valueOf(isDeterminationOnlyForFieldUnit)); + pref.setAllowOverride(false); + service.set(pref); + + boolean isShowCollectingAreasInGeneralsecion= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION ); + pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowCollectingAreasInGeneralSection, String.valueOf(isShowCollectingAreasInGeneralsecion)); + pref.setAllowOverride(false); + service.set(pref); + + boolean isShowTaxonAssociations= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS); + pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowTaxonAssociations, String.valueOf(isShowTaxonAssociations)); + pref.setAllowOverride(false); + service.set(pref); + return true; } - /** - * @return the preferencePage - */ - public DatabasePreferencesPage getPreferencePage() { - return preferencePage; - } + @Override public void addPages() { diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabaseRepairSortIndexPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabaseRepairSortIndexPage.java index 95fcf0682..fe49f84ba 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabaseRepairSortIndexPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabaseRepairSortIndexPage.java @@ -17,7 +17,7 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import eu.etaxonomy.cdm.io.common.SortIndexUpdaterConfigurator; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; /** * @author k.luther diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabaseRepairTitleCacheUpdatePage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabaseRepairTitleCacheUpdatePage.java index c98df8f7e..0f20d61e9 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabaseRepairTitleCacheUpdatePage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabaseRepairTitleCacheUpdatePage.java @@ -22,7 +22,7 @@ import eu.etaxonomy.cdm.io.common.CacheUpdaterConfigurator; import eu.etaxonomy.cdm.model.common.IdentifiableEntity; import eu.etaxonomy.cdm.model.name.TaxonNameBase; import eu.etaxonomy.cdm.model.taxon.TaxonBase; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; /** * @author k.luther diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/Test.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/Test.java index db196d64f..06682b269 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/Test.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/Test.java @@ -27,7 +27,7 @@ import eu.etaxonomy.cdm.model.common.IdentifiableEntity; import eu.etaxonomy.cdm.model.name.TaxonNameBase; import eu.etaxonomy.cdm.model.reference.Reference; import eu.etaxonomy.cdm.model.taxon.TaxonBase; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; /** * @author k.luther diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java index 9197d55aa..11220ce09 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java @@ -88,8 +88,14 @@ public class CdmDataSourceRepository{ * @return a {@link java.util.List} object. */ public static List getAll() { - List remoteSources = new ArrayList(); + List remoteSources = new ArrayList<>(); + if (CdmPersistentDataSource.getAllDataSources() == null){ + MessagingUtils.errorDialog("Could not read root element", CdmPersistentDataSource.class, + "Could not read element in datasources.xml in .cdmLibrary folder. Maybe your datasources.xml file is broken.", + TaxeditorStorePlugin.PLUGIN_ID, null, true); + return remoteSources; + } for(ICdmDataSource dataSource : CdmPersistentDataSource.getAllDataSources()){ try { remoteSources.add(CdmPersistentDataSource.NewInstance(dataSource.getName())); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermMenu.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermMenu.java index cbf4bb085..da41ff5e2 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermMenu.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermMenu.java @@ -29,6 +29,7 @@ import org.eclipse.ui.menus.CommandContributionItem; import org.eclipse.ui.menus.CommandContributionItemParameter; import eu.etaxonomy.cdm.model.common.TermType; +import eu.etaxonomy.taxeditor.preference.PreferencesUtil; /** * Menu used in the store plugin xml to dynamically generate menu (sub-menu) contribution items @@ -54,6 +55,7 @@ public class DefinedTermMenu extends CompoundContributionItem { //add Feature and NamedArea to top level dtMenuManager.add(addChildTermsToMenuManager(TermType.Feature)); dtMenuManager.add(addChildTermsToMenuManager(TermType.NamedArea)); + dtMenuManager.add(new Separator()); MenuManager otherMenuManager = new MenuManager("Others","eu.etaxonomy.taxeditor.store.term.other.menu"); @@ -91,7 +93,7 @@ public class DefinedTermMenu extends CompoundContributionItem { } // term type has children, so create sub menu MenuManager dtMenuManager = - new MenuManager(termType.getMessage(),"eu.etaxonomy.taxeditor.store." + termType.getKey() + "Menu"); + new MenuManager(termType.getMessage(PreferencesUtil.getGlobalLanguage()),"eu.etaxonomy.taxeditor.store." + termType.getKey() + "Menu"); dtMenuManager.setVisible(true); dtMenuManager.add(createDefaultMenuItem(termType)); @@ -168,7 +170,14 @@ public class DefinedTermMenu extends CompoundContributionItem { private class SortByTermTypeMessage implements Comparator { @Override public int compare(TermType t1, TermType t2) { - return t1.getMessage().compareTo(t2.getMessage()); + if (t1.equals(t2)){ + return 0; + } + int result = t1.getMessage().compareTo(t2.getMessage()); + if (result == 0){ + return t1.compareTo(t2); + } + return result; } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/AbstractIOManager.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/AbstractIOManager.java index eaf383e22..4be9f81b5 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/AbstractIOManager.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/AbstractIOManager.java @@ -12,7 +12,7 @@ package eu.etaxonomy.taxeditor.io; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.ui.progress.IProgressConstants; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.io.common.IIoConfigurator; /** @@ -26,7 +26,7 @@ import eu.etaxonomy.cdm.io.common.IIoConfigurator; */ public abstract class AbstractIOManager { - protected ICdmApplicationConfiguration applicationConfiguration; + protected ICdmRepository applicationConfiguration; public static enum TYPE { Jaxb, Tcs, Excel_Taxa, Endnote, Sdd, Abcd, SpecimenCdmExcel, Excel_Name, SpecimenSearch, Gbif @@ -45,7 +45,7 @@ public abstract class AbstractIOManager { * a CONFIGURATOR object. */ protected AbstractIOManager( - ICdmApplicationConfiguration applicationConfiguration) { + ICdmRepository applicationConfiguration) { this.applicationConfiguration = applicationConfiguration; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java index 904943a5e..0aa3ed173 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java @@ -22,7 +22,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IWorkbenchPart; import eu.etaxonomy.cdm.api.application.CdmApplicationState; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.io.common.CdmDefaultExport; import eu.etaxonomy.cdm.io.common.ExportResult; @@ -51,7 +51,7 @@ public class ExportManager extends AbstractIOManager { * * @param applicationConfiguration */ - private ExportManager(ICdmApplicationConfiguration applicationConfiguration) { + private ExportManager(ICdmRepository applicationConfiguration) { super(applicationConfiguration); } @@ -67,7 +67,7 @@ public class ExportManager extends AbstractIOManager { * @return a {@link eu.etaxonomy.taxeditor.io.ExportManager} object. */ public static ExportManager NewInstance( - ICdmApplicationConfiguration applicationConfiguration) { + ICdmRepository applicationConfiguration) { return new ExportManager(applicationConfiguration); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ImportManager.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ImportManager.java index 21558db91..76e956eb3 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ImportManager.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ImportManager.java @@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.ui.PlatformUI; import eu.etaxonomy.cdm.api.application.CdmApplicationState; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor; import eu.etaxonomy.cdm.io.common.CacheUpdaterConfigurator; import eu.etaxonomy.cdm.io.common.CdmDefaultImport; @@ -70,7 +70,7 @@ public class ImportManager extends AbstractIOManager implem /** * @param applicationConfiguration */ - private ImportManager(ICdmApplicationConfiguration applicationConfiguration) { + private ImportManager(ICdmRepository applicationConfiguration) { super(applicationConfiguration); } @@ -86,7 +86,7 @@ public class ImportManager extends AbstractIOManager implem * @return a {@link eu.etaxonomy.taxeditor.io.ImportManager} object. */ public static ImportManager NewInstance( - ICdmApplicationConfiguration applicationConfiguration) { + ICdmRepository applicationConfiguration) { return new ImportManager(applicationConfiguration); } @@ -428,13 +428,13 @@ public class ImportManager extends AbstractIOManager implem ImportResult result = ioService.importDataFromStream(configurator); monitor.done(); - display.asyncExec(new Runnable() { - - @Override - public void run() { - CdmStore.getContextManager().notifyContextRefresh(); - } - }); +// display.asyncExec(new Runnable() { +// +// @Override +// public void run() { +// CdmStore.getContextManager().notifyContextRefresh(); +// } +// }); return Status.OK_STATUS; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExcelNormalExplicitTaxaImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExcelNormalExplicitTaxaImportWizard.java index cb463a512..a0eab6142 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExcelNormalExplicitTaxaImportWizard.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExcelNormalExplicitTaxaImportWizard.java @@ -12,9 +12,11 @@ package eu.etaxonomy.taxeditor.io.wizard; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.io.IOException; import java.net.URI; -import org.apache.log4j.Logger; +import org.apache.commons.io.IOUtils; +import org.apache.log4j.Logger; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TreeSelection; @@ -24,7 +26,6 @@ import eu.etaxonomy.cdm.database.DbSchemaValidation; import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE; import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator; import eu.etaxonomy.cdm.model.taxon.TaxonNode; - import eu.etaxonomy.taxeditor.store.CdmStore; @@ -68,10 +69,15 @@ public class ExcelNormalExplicitTaxaImportWizard extends AbstractImportWizard classifications; - + private Classification selectedClassification; /** @@ -190,7 +190,7 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel "Export the contents of the currently selected database into Comma Separated Value format.", CSV); } - + /** * @return */ @@ -203,7 +203,7 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel "Export the names of the currently selected database into Semicolon Separated Value format.", CSV); } - + /** * @return */ @@ -240,10 +240,17 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel @Override public int compare(Classification o1, Classification o2) { - return o1.getTitleCache().compareTo(o2.getTitleCache()); + if (o1.equals(o2)){ + return 0; + } + int result = o1.getTitleCache().compareTo(o2.getTitleCache()); + if (result == 0){ + return o1.getUuid().compareTo(o2.getUuid()); + } + return result; } }); - + selectedClassification = classifications.iterator().next(); } @@ -251,13 +258,13 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel if(csvExport || csvPrintExport){ Label comboBoxLabel = new Label(composite, SWT.NONE); comboBoxLabel.setText("Classification"); - + createClassificationSelectionCombo(composite); classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); } - - + + Label fileLabel = new Label(composite, SWT.NONE); @@ -385,17 +392,17 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel @Override public void widgetSelected(SelectionEvent e) { selectedClassification = classifications.get(classificationSelectionCombo.getSelectionIndex()); - + } @Override public void widgetDefaultSelected(SelectionEvent e) { //not needed here - + } public UUID getSelectedClassificationUUID() { - + return selectedClassification.getUuid(); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/GenericConfiguratorWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/GenericConfiguratorWizardPage.java index eb1447459..f70d34148 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/GenericConfiguratorWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/GenericConfiguratorWizardPage.java @@ -137,6 +137,9 @@ public class GenericConfiguratorWizardPage extends WizardPage { */ @Override public int compare(Method o1, Method o2) { + if (o1.equals(o2)){ + return 0; + } if(o1.getName()==null && o2.getName()!=null){ return -1; } @@ -144,9 +147,13 @@ public class GenericConfiguratorWizardPage extends WizardPage { return 1; } if(o1.getName()==null && o2.getName()==null){ - return 0; + return o1.toString().compareTo(o1.toString()); + } + int result = o1.getName().compareTo(o2.getName()); + if (result == 0){ + return o1.toString().compareTo(o1.toString()); } - return o1.getName().compareTo(o2.getName()); + return result; } }); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/Messages.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java similarity index 77% rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/Messages.java rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java index d92c1d2bc..d98368fe5 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/Messages.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java @@ -6,7 +6,7 @@ * 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; +package eu.etaxonomy.taxeditor.l10n; import org.eclipse.osgi.util.NLS; @@ -16,7 +16,7 @@ import org.eclipse.osgi.util.NLS; * */ public class Messages extends NLS { - private static final String BUNDLE_NAME = "OSGI-INF/l10n/messages"; //$NON-NLS-1$ + private static final String BUNDLE_NAME = "src/main/java/eu.etaxonomy.taxeditor.l10n.messages"; //$NON-NLS-1$ public static String AuthenticatedUserBar_LOGGED_IN_AS; @@ -149,7 +149,44 @@ public class Messages extends NLS { public static String DeleteConfiguration_media_deleteIfUsedInTaxonDescription; public static String DeleteConfiguration_media_deleteIfUsedInSpecimenDescription; public static String DeleteConfiguration_media_delete; - static { + public static String NewGrantedAuthority_AlreadyInDb; + + public static String SetSecundumConfiguration_IncludeAcceptedTaxa; + public static String SetSecundumConfiguration_IncludeSynonyms; + public static String SetSecundumConfiguration_OverwriteExistingAccepted; + public static String SetSecundumConfiguration_OverwriteExistingSynonyms; + public static String SetSecundumConfiguration_EmptySecundumDetail; + public static String SetSecundumConfiguration_IncludeSharedtaxa; + public static String SetSecundumConfiguration_NewSecundum_Label; + public static String SetSecundumConfiguration_Description; + + public static String DatabasePreferncesPage_Is_redList; + public static String DatabasePreferncesPage_Determination_only_for_field_unnits; + public static String DatabasePreferncesPage_Show_Collecting_Areas_in_general_section; + public static String DatabasePreferncesPage_Taxon_Associations; + + public static String DatabasePreferencesPage_Biocase_Provider; + public static String DatabasePreferencesPage_details_view_configuration; + public static String DatabasePreferencesPage_show_only_simple_details_view; + public static String DatabasePreferencesPage_show_taxon; + public static String DatabasePreferencesPage_show_lsid; + public static String DatabasePreferencesPage_show_nomenclatural_code; + public static String DatabasePreferencesPage_show_namecache; + public static String DatabasePreferencesPage_show_appended_phrase; + public static String DatabasePreferencesPage_show_rank; + public static String DatabasePreferencesPage_show_atomised_epithets; + public static String DatabasePreferencesPage_show_authorship_cache; + public static String DatabasePreferencesPage_show_author_section; + public static String DatabasePreferencesPage_Show_nomenclatural_Ref; + public static String DatabasePreferencesPage_Show_nomenclaturalStatus; + public static String DatabasePreferencesPage_Show_Protologue; + public static String DatabasePreferencesPage_Show_Type_designation; + public static String DatabasePreferencesPage_Show_NameRelations; + public static String DatabasePreferencesPage_Define_Default_NomenclaturalCode; + public static String DatabasePreferencesPage_UseLocalPreferences; + public static String DatabasePreferencesPage_Specimen_Or_Observation; + + static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); } diff --git a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages.properties b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties similarity index 79% rename from eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages.properties rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties index fadec7c1d..eae60e91d 100644 --- a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages.properties +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties @@ -140,4 +140,43 @@ PresenceAbsenceTermDetailElement_LABEL_COLOR=Color DeleteConfiguration_media_removeFromGallery=Remove the media from the image gallery but leave it in database DeleteConfiguration_media_deleteIfUsedInTaxonDescription=Delete also if media is used in taxon description DeleteConfiguration_media_deleteIfUsedInSpecimenDescription=Delete also if media is used in specimen description -DeleteConfiguration_media_delete=Delete the media completely \ No newline at end of file +DeleteConfiguration_media_delete=Delete the media completely + +NewGrantedAuthority_AlreadyInDb=The granted authority already exists. + +SetSecundumConfiguration_IncludeAcceptedTaxa=include accepted taxa +SetSecundumConfiguration_IncludeSynonyms=include synonyms +SetSecundumConfiguration_OverwriteExistingAccepted=overwrite existing references for accepted taxa +SetSecundumConfiguration_OverwriteExistingSynonyms=overwrite existing references for synonyms +SetSecundumConfiguration_EmptySecundumDetail=empty existing details +SetSecundumConfiguration_IncludeSharedtaxa=include shared taxa +SetSecundumConfiguration_NewSecundum_Label=new secundum reference +SetSecundumConfiguration_Description=If no reference is chosen existing secundum references are deleted + +DatabasePreferncesPage_Is_redList=Red List 2020 +DatabasePreferncesPage_Determination_only_for_field_unnits=Determinations only for field units +DatabasePreferncesPage_Show_Collecting_Areas_in_general_section=Show collecting areas in general section +DatabasePreferncesPage_Taxon_Associations=Show taxon associations of a specimen in details view + +DatabasePreferencesPage_Biocase_Provider=Biocase provider selection +DatabasePreferencesPage_details_view_configuration=Details view configuration +DatabasePreferencesPage_show_only_simple_details_view=Show only simple details view +DatabasePreferencesPage_show_taxon=Show taxon +DatabasePreferencesPage_show_lsid=Show LSID +DatabasePreferencesPage_show_nomenclatural_code=Show nomenclatural code +DatabasePreferencesPage_show_namecache=Show name cache +DatabasePreferencesPage_show_appended_phrase=Show appended phrase +DatabasePreferencesPage_show_rank=Show rank +DatabasePreferencesPage_show_atomised_epithets=Show atomised epithets +DatabasePreferencesPage_show_authorship_cache=Show authorship cache +DatabasePreferencesPage_show_author_section=Show author section +DatabasePreferencesPage_Show_nomenclatural_Ref=Show nomenclatural reference +DatabasePreferencesPage_Show_nomenclaturalStatus=Show nomenclatural status +DatabasePreferencesPage_Show_Protologue=Show protologue +DatabasePreferencesPage_Show_Type_designation=Show type designation +DatabasePreferencesPage_Show_NameRelations=Show name relations +DatabasePreferencesPage_Define_Default_NomenclaturalCode=Define default nomenclatural code +DatabasePreferencesPage_UseLocalPreferences=Allow to use local preference +DatabasePreferencesPage_Specimen_Or_Observation=Specimen or observation configuration + + diff --git a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages_de.properties b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties similarity index 79% rename from eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages_de.properties rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties index 3000cd5dd..5362e37eb 100644 --- a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages_de.properties +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties @@ -139,3 +139,40 @@ DeleteConfiguration_media_removeFromGallery=Entferne Medienobjekt aus der Galler DeleteConfiguration_media_deleteIfUsedInTaxonDescription=Lösche das Medienobjekt, auch wenn es von einem Taxon verwendet wird DeleteConfiguration_media_deleteIfUsedInSpecimenDescription=Lösche das Medienobjekt, auch wenn es von einem Specimen verwendet wird DeleteConfiguration_media_delete=Lösche das Medienobjekt + +NewGrantedAuthority_AlreadyInDb=Die GrantedAuthority ist bereits in der DB enthalten. + +SetSecundumConfiguration_IncludeAcceptedTaxa=anwenden auf akzeptierte Taxa +SetSecundumConfiguration_IncludeSynonyms=anwenden auf Synonyme +SetSecundumConfiguration_OverwriteExistingAccepted=bestehende Secundum Referenzen bei akzeptierten Taxa überschreiben +SetSecundumConfiguration_OverwriteExistingSynonyms=bestehende Secundum Referenzen bei Synonymen überschreiben +SetSecundumConfiguration_EmptySecundumDetail=bestehende Details von Secundum Referenzen löschen +SetSecundumConfiguration_IncludeSharedtaxa=auch mehrfach verwendete Taxa mit einbeziehen +SetSecundumConfiguration_NewSecundum_Label=neue Secundum Referenz +SetSecundumConfiguration_Description=Wenn keine Referenz ausgewählt wird, werden die bestehenden Secundum Referenzen gelöscht + +DatabasePreferncesPage_Is_redList=Rote Liste 2020 +DatabasePreferncesPage_Determination_only_for_field_unnits=Determinations nur für Field Units +DatabasePreferncesPage_Show_Collecting_Areas_in_general_section=Zeige Sammelgebiete im allgemeinen Teil +DatabasePreferncesPage_Taxon_Associations=Zeige Taxon Assoziationen eines Specimen im Details View + +DatabasePreferencesPage_Biocase_Provider=Biocase Provider Auswahl +DatabasePreferencesPage_details_view_configuration=Details view Konfiguration +DatabasePreferencesPage_show_only_simple_details_view=Zeige nur einen einfachen (konfigurierbaren) Details View +DatabasePreferencesPage_show_taxon=Zeige Taxon +DatabasePreferencesPage_show_lsid=Zeige LSID +DatabasePreferencesPage_show_nomenclatural_code=Zeige Nomenklatorischen Code +DatabasePreferencesPage_show_namecache=Zeige Namecache +DatabasePreferencesPage_show_appended_phrase=Zeige appended phrase +DatabasePreferencesPage_show_rank=Zeige Rang +DatabasePreferencesPage_show_atomised_epithets=Zeige atomisierte Epithete +DatabasePreferencesPage_show_authorship_cache=Zeige Autoren Cache +DatabasePreferencesPage_show_author_section=Zeige den Autoren Bereich +DatabasePreferencesPage_Show_nomenclatural_Ref=Zeige nomenklatorische Referenz +DatabasePreferencesPage_Show_nomenclaturalStatus=Zeige nomenklatorischen Status +DatabasePreferencesPage_Show_Protologue=Zeige den Protologue +DatabasePreferencesPage_Show_Type_designation=Zeige Type Designations +DatabasePreferencesPage_Show_NameRelations=Zeige Namensrelationen +DatabasePreferencesPage_Define_Default_NomenclaturalCode=Festlegen des default Nomenklatorischen Codes +DatabasePreferencesPage_UseLocalPreferences=Erlaube das lokale Überschreiben +DatabasePreferencesPage_Specimen_Or_Observation=Konfiguration von Specimen und Observationen diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DefaultTermComparator.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DefaultTermComparator.java index ef08badd6..9abcbb67d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DefaultTermComparator.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DefaultTermComparator.java @@ -1,8 +1,8 @@ /** * Copyright (C) 2009 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. */ @@ -17,7 +17,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore; * Implements a {@link Comparator} for {@link DefinedTermBase} objects based on the term's label. * The compare algorithm compares a term's label. Example: If used on an unsorted list of terms, the * list will be alphabetically sorted by label afterwards. - * + * * @author n.hoffmann * @date Jan 18, 2012 * @@ -36,6 +36,10 @@ public class DefaultTermComparator implements Compara } String label1 = o1.getLabel(CdmStore.getDefaultLanguage()) != null ? o1.getLabel(CdmStore.getDefaultLanguage()) : o1.getTitleCache(); String label2 = o2.getLabel(CdmStore.getDefaultLanguage()) != null ? o2.getLabel(CdmStore.getDefaultLanguage()) : o2.getTitleCache(); - return label1.compareTo(label2); + int result = label1.compareTo(label2); + if (result == 0){ + return o1.getUuid().compareTo(o2.getUuid()); + } + return result; } }; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java index 4a7133574..b1f806cb4 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java @@ -43,6 +43,7 @@ import eu.etaxonomy.cdm.model.description.DescriptionElementSource; import eu.etaxonomy.cdm.model.description.Distribution; import eu.etaxonomy.cdm.model.description.Feature; import eu.etaxonomy.cdm.model.description.IndividualsAssociation; +import eu.etaxonomy.cdm.model.description.KeyStatement; import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm; import eu.etaxonomy.cdm.model.description.QuantitativeData; import eu.etaxonomy.cdm.model.description.SpecimenDescription; @@ -88,9 +89,11 @@ public class DescriptionHelper { */ public static String getCache(DescriptionElementBase element, Language language) { - + String mainElementLabel= null; DescriptionBase descr = element.getInDescription(); + descr = CdmBase.deproxy(descr, DescriptionBase.class); + if (descr != null){ if (descr.isInstanceOf(TaxonDescription.class)){ Taxon taxon = CdmBase.deproxy(descr, TaxonDescription.class).getTaxon(); @@ -109,10 +112,12 @@ public class DescriptionHelper { } } } - + + String cache = null; if (element instanceof TextData) { - cache = ((TextData) element).getText(language); + //cache = ((TextData) element).getText(language); + cache = "Text Data"; } if (element instanceof CommonTaxonName) { cache = ((CommonTaxonName) element).getName(); @@ -205,19 +210,20 @@ public class DescriptionHelper { * @return a {@link java.lang.String} object. */ public static String getObjectDescription(Object element) { + String resultString = null; if (element instanceof IdentifiableEntity) { try{ - return ((IdentifiableEntity) element).getTitleCache(); + resultString = ((IdentifiableEntity) element).getTitleCache(); }catch(LazyInitializationException e){ String result = "No Session to initialize title cache for IdentifiableEntity"; MessagingUtils.error(DescriptionHelper.class, result, e); - return "TODO: " + result; + resultString = "TODO: " + result; } }else if (element instanceof OriginalSourceBase) { try{ OriginalSourceBase originalSource = (OriginalSourceBase) element; // ISourceable sourcedObject = originalSource.getSourcedObj(); - //due to #5743 the bidirectionality for sourced object had to be removed + //due to #5743 the bidirectionality for sourced object had to be removed String sourceObjectTitle = "sourced object data not available (#5743)"; // if(sourcedObject instanceof IIdentifiableEntity){ // sourceObjectTitle = ((IdentifiableEntity) sourcedObject).getTitleCache(); @@ -227,40 +233,48 @@ public class DescriptionHelper { // throw new IllegalStateException("Unknown ISourceable object for given OriginalSourceBase"); // } - return CdmUtils.concat("; ", new String[]{originalSource.getIdNamespace(), originalSource.getIdInSource(), sourceObjectTitle}); + resultString = CdmUtils.concat("; ", new String[]{originalSource.getIdNamespace(), originalSource.getIdInSource(), sourceObjectTitle}); }catch(LazyInitializationException e){ String result = "Error initializing title cache for ISourceable of an OriginalSourceBase"; MessagingUtils.error(DescriptionHelper.class, result, e); - return "TODO: " + result; + resultString = "TODO: " + result; } }else if (element instanceof LanguageStringBase) { - return ((LanguageStringBase) element).getText(); + resultString = ((LanguageStringBase) element).getText(); }else if (element instanceof DescriptionElementBase) { - return getCache((DescriptionElementBase) element); + resultString = getCache((DescriptionElementBase) element); }else if (element instanceof RelationshipBase) { - return getCache((RelationshipBase) element); + resultString = getCache((RelationshipBase) element); }else if (element instanceof TypeDesignationBase) { - return getCache((TypeDesignationBase) element); + resultString = getCache((TypeDesignationBase) element); }else if (element instanceof HomotypicalGroup) { - return getCache((HomotypicalGroup) element); + resultString = getCache((HomotypicalGroup) element); }else if (element instanceof TaxonNode) { - return getCache((TaxonNode) element); + resultString = getCache((TaxonNode) element); }else if (element instanceof DeterminationEvent) { - return getCache((DeterminationEvent) element); + resultString = getCache((DeterminationEvent) element); }else if (element instanceof Marker) { Marker marker = (Marker) element; MarkerType type = marker.getMarkerType(); - return (type == null ? "- no marker type -" : marker.getMarkerType().getLabel()) + " (" + marker.getFlag() + ")"; + resultString = (type == null ? "- no marker type -" : marker.getMarkerType().getLabel()) + " (" + marker.getFlag() + ")"; }else if (element instanceof User) { User user = (User) element; - return user.getUsername(); + resultString = user.getUsername(); }else if (element instanceof Group) { Group group = (Group) element; - return group.getName(); - }else{ + resultString = group.getName(); + }else if (element instanceof KeyStatement) { + KeyStatement keyStatement = (KeyStatement) element; + resultString = getCache(keyStatement); + }else{ // TODO write return texts for HomotypicalGroup, etc. - return element.toString(); + resultString = element.toString(); + } + + if (resultString == null){ + resultString = element.toString(); } + return resultString; } @@ -278,8 +292,8 @@ public class DescriptionHelper { if (StringUtils.isBlank(taxonStr)){ taxonStr = "no or unlabled taxon"; } - - + + //unit SpecimenOrObservationBase unit = detEvent.getIdentifiedUnit(); String unitStr; @@ -291,7 +305,7 @@ public class DescriptionHelper { }else{ unitStr = "no unit"; } - + String result = CdmUtils.concat(" determined as ", unitStr, taxonStr); return result; @@ -325,7 +339,7 @@ public class DescriptionHelper { } } result = CdmUtils.concat(": ", result, parentStr); - + return result; } @@ -338,7 +352,7 @@ public class DescriptionHelper { if (designation.isInstanceOf(SpecimenTypeDesignation.class)){ to = ((SpecimenTypeDesignation)designation).getTypeSpecimen(); }else if (designation.isInstanceOf(NameTypeDesignation.class)){ - to = ((NameTypeDesignation)designation).getTypeName(); + to = ((NameTypeDesignation)designation).getTypeName(); }else{ throw new RuntimeException("Type Designation class not supported: " + designation.getClass().getName()); } @@ -365,7 +379,7 @@ public class DescriptionHelper { for (TaxonNameBase name : from){ CdmUtils.concat(",", fromString, name.getTitleCache()); } - String result = CdmUtils.concat(" ", new String[]{from == null ? null : fromString, + String result = CdmUtils.concat(" ", new String[]{from == null ? null : fromString, typeLabel, to == null? null : to.getTitleCache()}); return result; } @@ -416,11 +430,11 @@ public class DescriptionHelper { if (StringUtils.isBlank(typeLabel)){ typeLabel = "->"; } - String result = CdmUtils.concat(" ", new String[]{from == null ? null : from.getTitleCache(), + String result = CdmUtils.concat(" ", new String[]{from == null ? null : from.getTitleCache(), typeLabel, to == null? null : to.getTitleCache()}); return result; } - + private static String getCache(HomotypicalGroup hg) { String result = ""; @@ -433,6 +447,14 @@ public class DescriptionHelper { return result; } + private static String getCache(KeyStatement ks) { + String result = ""; + + result = "KeyStatement"; + + return result; + } + /** *

getObjectClassname

* diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/FeatureNodeContainerTree.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/FeatureNodeContainerTree.java index 55bf93082..c337da240 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/FeatureNodeContainerTree.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/FeatureNodeContainerTree.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -37,25 +37,32 @@ public class FeatureNodeContainerTree { @Override public int compare(DescriptionElementBase o1, DescriptionElementBase o2) { - return DescriptionHelper.getLabel(o1).compareTo(DescriptionHelper.getLabel(o2)); + if (o1.equals(o2)){ + return 0; + } + int result = DescriptionHelper.getLabel(o1).compareTo(DescriptionHelper.getLabel(o2)); + if (result == 0){ + return o1.getUuid().compareTo(o2.getUuid()); + } + return result; } }; - + private Set featureNodeContainers = new HashSet(); - + private FeatureNodeContainer root; private DescriptionBase description; private FeatureTree featureTree; - + public FeatureNodeContainerTree(DescriptionBase description, FeatureTree featureTree){ this.description = description; this.featureTree = featureTree; - + root = new FeatureNodeContainer(this); - + buildTree(); } - + /** * Traverses the given {@link FeatureNode} and computes a FeatureNodeContainer branch if the * given {@link TaxonDescription} has elements for the given feature node or any of its children @@ -63,16 +70,16 @@ public class FeatureNodeContainerTree { */ public void buildTree(){ List children = featureTree.getRootChildren(); - + // if(description.getElements().isEmpty()){ // return; // } - + for(FeatureNode featureNode : children){ root.findLeaves(featureNode); } } - + /** *

getFeatureNodeContainerForDescriptionElement

* @@ -81,7 +88,7 @@ public class FeatureNodeContainerTree { */ public FeatureNodeContainer getFeatureNodeContainerForDescriptionElement (DescriptionElementBase descriptionElement) { List leafs = root.getLeafs(); - + for(FeatureNodeContainer container : leafs){ if(container.getDescriptionElements().contains(descriptionElement)){ return container; @@ -89,40 +96,40 @@ public class FeatureNodeContainerTree { } return null; } - + /** * Returns all elements contained in the given {@link DescriptionBase description} that have the given {@link Feature feature}. - * + * * @param description * @param feature * @return a list of description elements with the given feature alphabetically sorted by {@link DescriptionHelper#getLabel(Object)} */ public List getDescriptionsElementsForFeature(Feature feature) { List featureElements = new ArrayList(); - + Set elements = description.getElements(); - + if (elements != null) { for (DescriptionElementBase element : elements) { - Feature elementFeature = (Feature) HibernateProxyHelper.deproxy(element.getFeature()); - + Feature elementFeature = HibernateProxyHelper.deproxy(element.getFeature()); + if (feature.equals(elementFeature)) { featureElements.add(element); } } } - + if(featureElements.size() != 0){ Collections.sort(featureElements, comparator); } - + return featureElements; } - - - public FeatureNodeContainer getFeatureNodeContainer(Feature feature) { + + + public FeatureNodeContainer getFeatureNodeContainer(Feature feature) { List leafs = root.getLeafs(); - + for(FeatureNodeContainer container : leafs){ if(container.getFeature().equals(feature)){ return container; @@ -130,10 +137,10 @@ public class FeatureNodeContainerTree { } return null; } - + public FeatureNodeContainer getFeatureNodeContainer(FeatureNode featureNode){ List leafs = root.getLeafs(); - + for(FeatureNodeContainer container : leafs){ if(container.getFeatureNode().equals(featureNode)){ return container; @@ -141,18 +148,18 @@ public class FeatureNodeContainerTree { } return null; } - + public void addContainer(FeatureNodeContainer container){ featureNodeContainers.add(container); } /** - * + * */ public void removeContainer(FeatureNodeContainer container) { featureNodeContainers.remove(container); } - + public FeatureNodeContainer getRoot() { return root; } @@ -164,5 +171,5 @@ public class FeatureNodeContainerTree { public FeatureTree getFeatureTree() { return featureTree; } - + } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/ExternalReferenceServiceWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/ExternalReferenceServiceWizardPage.java index d11e3c6b4..0718bb4de 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/ExternalReferenceServiceWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/ExternalReferenceServiceWizardPage.java @@ -26,8 +26,7 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Text; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.ext.ipni.IIpniService; import eu.etaxonomy.cdm.ext.ipni.IpniService; @@ -72,9 +71,6 @@ public class ExternalReferenceServiceWizardPage extends WizardPage implements Se setDescription("Query IPNI service for references"); } - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ /** {@inheritDoc} */ @Override public void createControl(Composite parent) { @@ -131,7 +127,7 @@ public class ExternalReferenceServiceWizardPage extends WizardPage implements Se @Override public void widgetSelected(SelectionEvent e) { String query = text_query.getText(); - List publications = ipniService.getPublications(query, null, (ICdmApplicationConfiguration) CdmStore.getCurrentApplicationConfiguration(), null); + List publications = ipniService.getPublications(query, null, (ICdmRepository) CdmStore.getCurrentApplicationConfiguration(), null); viewer.setInput(publications); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewDerivedUnitBaseWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewDerivedUnitBaseWizard.java index 1629b4999..513f38bd0 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewDerivedUnitBaseWizard.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewDerivedUnitBaseWizard.java @@ -37,7 +37,6 @@ public class NewDerivedUnitBaseWizard extends AbstractNewEntityWizard protected NonViralName createNewEntity() { NomenclaturalCode code = PreferencesUtil.getPreferredNomenclaturalCode(); if(code.equals(NomenclaturalCode.ICNAFP )){ - return BotanicalName.NewInstance(null); + return TaxonNameFactory.NewBotanicalInstance(null); }else if(code.equals(NomenclaturalCode.ICZN)){ - return ZoologicalName.NewInstance(null); + return TaxonNameFactory.NewZoologicalInstance(null); } return null; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonWizard.java index acefcf137..a558f0c40 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonWizard.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonWizard.java @@ -11,6 +11,8 @@ package eu.etaxonomy.taxeditor.newWizard; import eu.etaxonomy.cdm.api.service.ITaxonService; import eu.etaxonomy.cdm.model.name.NonViralName; +import eu.etaxonomy.cdm.model.name.TaxonNameBase; +import eu.etaxonomy.cdm.model.name.TaxonNameFactory; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameWizardPage; @@ -34,7 +36,7 @@ public class NewTaxonWizard extends AbstractNewEntityWizard { /** {@inheritDoc} */ @Override protected Taxon createNewEntity() { - return Taxon.NewInstance(NonViralName.NewInstance(null), null); + return Taxon.NewInstance(TaxonNameFactory.NewNonViralInstance(null), null); } /** {@inheritDoc} */ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractDescriptionPostOperation.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractDescriptionPostOperation.java index dc1329a56..e156a433e 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractDescriptionPostOperation.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractDescriptionPostOperation.java @@ -25,7 +25,7 @@ import eu.etaxonomy.cdm.model.media.Media; * @date 04.12.2013 * */ -public abstract class AbstractDescriptionPostOperation, D extends DescriptionBase> extends AbstractPostOperation { +public abstract class AbstractDescriptionPostOperation extends AbstractPostOperation { protected D description; @@ -48,9 +48,6 @@ public abstract class AbstractDescriptionPostOperation this.isImageGallery = isImageGallery; } - /* (non-Javadoc) - * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) - */ /** {@inheritDoc} */ @Override public IStatus execute(IProgressMonitor monitor, IAdaptable info) diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java index 31eda3f37..5292aef1d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java @@ -8,6 +8,8 @@ import java.util.List; import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; +import eu.etaxonomy.cdm.model.name.INonViralName; +import eu.etaxonomy.cdm.model.name.ITaxonNameBase; import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.cdm.model.name.Rank; import eu.etaxonomy.cdm.model.name.TaxonNameBase; @@ -47,7 +49,7 @@ public class ParseHandler{ /** * The name that should get parsed */ - private NonViralName name; + private INonViralName name; private boolean doResolveInReferences; @@ -99,11 +101,11 @@ public class ParseHandler{ return name; } - public static NonViralName parseName(String unparsedNameString, Rank rank){ - NonViralName name = nonViralNameParser.parseFullName(unparsedNameString, + public static TaxonNameBase parseName(String unparsedNameString, Rank rank){ + INonViralName name = nonViralNameParser.parseFullName(unparsedNameString, PreferencesUtil.getPreferredNomenclaturalCode(), rank); - - return name; + + return (TaxonNameBase)name; } /** @@ -112,8 +114,8 @@ public class ParseHandler{ * * @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object. */ - public static NonViralName createEmptyName(){ - return nonViralNameParser.getNonViralNameInstance("", PreferencesUtil.getPreferredNomenclaturalCode()); + public static TaxonNameBase createEmptyName(){ + return (TaxonNameBase)nonViralNameParser.getNonViralNameInstance("", PreferencesUtil.getPreferredNomenclaturalCode()); } /** @@ -122,7 +124,7 @@ public class ParseHandler{ * * @return The parsed NonViralName object */ - public NonViralName parse(String unparsedNameString){ + public INonViralName parse(String unparsedNameString){ // String unparsedNameString = ""; // try { @@ -156,9 +158,9 @@ public class ParseHandler{ * * @return The parsed NonViralName object */ - public NonViralName parseAndResolveDuplicates(String unparsedNameString){ + public INonViralName parseAndResolveDuplicates(String unparsedNameString){ - NonViralName parsedName = parse(unparsedNameString); + INonViralName parsedName = parse(unparsedNameString); MatchMatrix matchMatrix = findMatches(parsedName); @@ -173,7 +175,7 @@ public class ParseHandler{ /** * @param name The name to resolve duplicates for. */ - private void resolveDuplicates(NonViralName name, MatchMatrix matchMatrix) { + private void resolveDuplicates(INonViralName name, MatchMatrix matchMatrix) { resolveDuplicateNames(name, matchMatrix); resolveAllDuplicateAuthors(name, matchMatrix); @@ -189,20 +191,20 @@ public class ParseHandler{ /** * @param name The name to resolve duplicates for. */ - private void resolveDuplicateNames(NonViralName name, MatchMatrix matchMatrix) { + private void resolveDuplicateNames(INonViralName name, MatchMatrix matchMatrix) { if (matchMatrix.duplicateNames.size() == 1){ - name = (NonViralName) matchMatrix.duplicateNames.iterator().next(); + name = matchMatrix.duplicateNames.iterator().next(); }else if(matchMatrix.duplicateNames.size() > 1){ // FIXME TODO resolve multiple duplications. Use first match for a start - name = (NonViralName) matchMatrix.duplicateNames.iterator().next(); + name = matchMatrix.duplicateNames.iterator().next(); } } /** * @param name The name to resolve duplicates for. */ - private void resolveDuplicateReferences(NonViralName name, MatchMatrix matchMatrix) { + private void resolveDuplicateReferences(INonViralName name, MatchMatrix matchMatrix) { if(matchMatrix.duplicateReferences.size() == 1){ // exactly one match. We assume that the user wants this reference INomenclaturalReference duplicate = matchMatrix.duplicateReferences.iterator().next(); @@ -217,7 +219,7 @@ public class ParseHandler{ /** * @param name The name to resolve duplicates for. */ - private void resolveDuplicateInReferences(NonViralName name, MatchMatrix matchMatrix) { + private void resolveDuplicateInReferences(INonViralName name, MatchMatrix matchMatrix) { Reference reference = (Reference) HibernateProxyHelper.deproxy(name.getNomenclaturalReference()); if(matchMatrix.duplicateInReferences.size() > 0){ @@ -233,7 +235,7 @@ public class ParseHandler{ /** * @param name The name to resolve duplicates for. */ - private void resolveAllDuplicateAuthors(NonViralName name, MatchMatrix matchMatrix) { + private void resolveAllDuplicateAuthors(INonViralName name, MatchMatrix matchMatrix) { if(matchMatrix.duplicateCombinationAuthorships.size() > 0){ name.setCombinationAuthorship(matchMatrix.duplicateCombinationAuthorships.iterator().next()); @@ -266,7 +268,7 @@ public class ParseHandler{ * * @param name The NonViralName to find matches for. */ - private MatchMatrix findMatches(NonViralName name){ + private MatchMatrix findMatches(INonViralName name){ MatchMatrix matchMatrix = new MatchMatrix(); @@ -335,11 +337,11 @@ public class ParseHandler{ * @param taxonNameBase The TaxonNameBase to find matches for. * @return A List of possibly matching TaxonNameBase's. */ - private List findMatchingLatinNames(TaxonNameBase taxonNameBase) { + private List findMatchingLatinNames(ITaxonNameBase taxonNameBase) { try { - return CdmStore.getCommonService().findMatching(taxonNameBase, MatchStrategy.NonViralName); + return CdmStore.getCommonService().findMatching(TaxonNameBase.castAndDeproxy(taxonNameBase), MatchStrategy.NonViralName); } catch (MatchException e) { diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java index 4da42b217..05c886aaa 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java @@ -176,7 +176,7 @@ public interface IPreferenceKeys { public static final String PROMPT_FOR_OPEN_SPECIMEN_IN_EDITOR = "eu.etaxonomy.taxeditor.specimen.promptForOpenSpecimenInEditor"; // TODO RL - public static final String IS_RL = "eu.etaxonomy.taxeditor.isRL"; + public static final String DEFAULT_LANGUAGE_EDITOR = "eu.etaxonomy.taxeditor.default.language"; @@ -187,6 +187,7 @@ public interface IPreferenceKeys { */ public static final String P2_REPOSITORY_LIST = "eu.etaxonomy.taxeditor.p2.repositories"; public static final String ALLOW_OVERRIDE_NAMEDETAILS = "eu.etaxonomy.taxeditor.details.allow_override"; + public static final String ALLOW_OVERRIDE_RL = "eu.etaxonomy.taxeditor.isRL.allow_override"; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/LanguageEditorPreferencePage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/LanguageEditorPreferencePage.java index 059c1698b..aae9b342a 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/LanguageEditorPreferencePage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/LanguageEditorPreferencePage.java @@ -28,7 +28,7 @@ import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.PlatformUI; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; /** diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsConfigurator.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsConfigurator.java index 854a7aab8..f10078301 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsConfigurator.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsConfigurator.java @@ -25,6 +25,7 @@ public class NameDetailsConfigurator { private boolean isRankActivated = true; private boolean isAtomisedEpithetsActivated = true; private boolean isAuthorshipSectionActivated = true; + private boolean isAuthorCacheActivated = true; private boolean isNomenclaturalReferenceSectionActivated = true; private boolean isNomenclaturalStatusSectionActivated = true; private boolean isTypeDesignationSectionActivated = true; @@ -158,6 +159,11 @@ public class NameDetailsConfigurator { StringBuffer result = new StringBuffer(); //the preference value is build like this: //:true;:false.... + result.append("simpleViewActivated"); + result.append(":"); + result.append(this.isSimpleDetailsViewActivated); + result.append(";"); + result.append("taxon"); result.append(":"); result.append(this.isTaxonSectionActivated); @@ -210,5 +216,19 @@ public class NameDetailsConfigurator { return result.toString(); } + /** + * @return the isAuthorCacheActivated + */ + public boolean isAuthorCacheActivated() { + return isAuthorCacheActivated; + } + + /** + * @param isAuthorCacheActivated the isAuthorCacheActivated to set + */ + public void setAuthorCacheActivated(boolean isAuthorCacheActivated) { + this.isAuthorCacheActivated = isAuthorCacheActivated; + } + } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java index a24eac024..1646d4558 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java @@ -1,6 +1,7 @@ package eu.etaxonomy.taxeditor.preference; +import org.eclipse.jface.preference.PreferencePage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -8,10 +9,8 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; - import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.jface.preference.PreferencePage; public class NameDetailsViewConfiguration extends PreferencePage implements IWorkbenchPreferencePage { @@ -19,7 +18,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor Composite child ; @Override public void init(IWorkbench workbench) { - + } /* @@ -31,9 +30,11 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor */ @Override protected Control createContents(Composite parent) { - + Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(new GridLayout()); + + //boolean isAllowOverride = PreferencesUtil isSimpleDetailsViewActivated = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION); final Button activateCheckButton = new Button(composite, SWT.CHECK); activateCheckButton.setText("Show only a simple name details view"); @@ -52,11 +53,11 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor } } }); - + child = new Composite(composite, SWT.NULL); child.setLayout(new GridLayout()); child.setVisible(isSimpleDetailsViewActivated); - + final Button showTaxon = new Button(child, SWT.CHECK); boolean isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON); showTaxon.setText("Show taxon of the name"); @@ -68,7 +69,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon); } }); - + final Button showLsid = new Button(child, SWT.CHECK); boolean isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID); showLsid.setText("Show Lsid of the name"); @@ -80,7 +81,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID); } }); - + final Button showNomenclaturalCode = new Button(child, SWT.CHECK); boolean isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE); showNomenclaturalCode.setText("Show the nomenclatural code"); @@ -92,7 +93,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, isShowNomenclaturalCode); } }); - + final Button showNameCache = new Button(child, SWT.CHECK); boolean isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE); showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)"); @@ -112,10 +113,10 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor @Override public void widgetSelected(SelectionEvent e) { boolean isShowAppendedPhrase = showAppendedPhrase.getSelection(); - PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowAppendedPhrase); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE, isShowAppendedPhrase); } }); - + final Button showRank = new Button(child, SWT.CHECK); boolean isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK); showRank.setText("Show rank of the name"); @@ -149,7 +150,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, isShowAuthorship); } }); - + final Button showNomenclaturalRef = new Button(child, SWT.CHECK); boolean isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE); showNomenclaturalRef.setText("Show nomenclatural reference section"); @@ -161,7 +162,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, isShowNomenclaturalRef); } }); - + final Button showNomenclaturalStatus = new Button(child, SWT.CHECK); boolean isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS); showNomenclaturalStatus.setText("Show nomenclatural status section"); @@ -173,7 +174,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, isShowNomenclaturalStatus); } }); - + final Button showProtologue = new Button(child, SWT.CHECK); boolean isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE); showProtologue.setText("Show protologue section"); @@ -185,7 +186,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, isShowProtologue); } }); - + final Button showTypeDesignation = new Button(child, SWT.CHECK); boolean isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION); showTypeDesignation.setText("Show name type designation section"); @@ -197,8 +198,8 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowTypeDesignation); } }); - - + + final Button showNameRelationship = new Button(child, SWT.CHECK); boolean isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP); showNameRelationship.setText("Show name relationship section"); @@ -207,10 +208,10 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor @Override public void widgetSelected(SelectionEvent e) { boolean isShowNameRelationship = showNameRelationship.getSelection(); - PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowNameRelationship); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, isShowNameRelationship); } }); - + if(isSimpleDetailsViewActivated){ child.setEnabled(true); }else{ @@ -219,7 +220,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor return composite; - + } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/OrderPreferences.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/OrderPreferences.java index 756cfbc7f..b1060046e 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/OrderPreferences.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/OrderPreferences.java @@ -13,7 +13,7 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; public class OrderPreferences extends PreferencePage implements IWorkbenchPreferencePage { @@ -57,6 +57,10 @@ public class OrderPreferences extends PreferencePage implements IWorkbenchPrefer Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(new GridLayout()); + Label label = new Label(composite, SWT.NONE); + label.setText("Sorting"); + + isNaturalOrderActivated = PreferencesUtil.getSortNodesNaturally(); final Button activateNaturalOrderCheckButton = new Button(composite, SWT.RADIO); activateNaturalOrderCheckButton.setText("Enable Natural Order"); @@ -64,7 +68,7 @@ public class OrderPreferences extends PreferencePage implements IWorkbenchPrefer isRankAndNameOrderActivated = !PreferencesUtil.getSortNodesStrictlyAlphabetically() && !PreferencesUtil.getSortNodesNaturally(); final Button activateRankAndNameOrderActivatedCheckButton = new Button(composite, SWT.RADIO); - activateRankAndNameOrderActivatedCheckButton.setText("Enable Rank and Aplhabetical Order"); + activateRankAndNameOrderActivatedCheckButton.setText("Enable Rank and Alphabetical Order"); activateRankAndNameOrderActivatedCheckButton.setSelection(isRankAndNameOrderActivated); isAlphabeticalOrderActivated = PreferencesUtil.getSortNodesStrictlyAlphabetically(); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java index 0bffd58a4..3ef53365a 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java @@ -34,7 +34,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeConfigurator; import eu.etaxonomy.cdm.api.service.IFeatureTreeService; import eu.etaxonomy.cdm.api.service.ITermService; @@ -114,7 +114,7 @@ public class PreferencesUtil implements IPreferenceKeys { getPreferenceKey(preferredCode)); } else{ - ICdmApplicationConfiguration controller; + ICdmRepository controller; controller = CdmStore.getCurrentApplicationConfiguration(); PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode); CdmPreference preference = null; @@ -163,16 +163,10 @@ public class PreferencesUtil implements IPreferenceKeys { * @return a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object. */ public static NomenclaturalCode getPreferredNomenclaturalCode(boolean useLocal) { - ICdmApplicationConfiguration controller; + CdmPreference pref = null; if (!useLocal){ - try{ - controller = CdmStore.getCurrentApplicationConfiguration(); - PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode); - pref = controller.getPreferenceService().find(key); - }catch(Exception e){ - e.printStackTrace(); - } + pref = getPreferenceFromDB(PreferencePredicate.NomenclaturalCode); } String preferredCode; @@ -192,6 +186,24 @@ public class PreferencesUtil implements IPreferenceKeys { return null; } + + private static CdmPreference getPreferenceFromDB(PreferencePredicate predicate){ + ICdmRepository controller; + CdmPreference pref = null; + + try{ + controller = CdmStore.getCurrentApplicationConfiguration(); + PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), predicate); + pref = controller.getPreferenceService().find(key); + }catch(Exception e){ + e.printStackTrace(); + } + + return pref; + + } + + public static String getPreferredDefaultLangugae(){ String preferredLanguage = getPreferenceStore().getString(DEFAULT_LANGUAGE_EDITOR); if(StringUtils.isNotEmpty(preferredLanguage) && StringUtils.isNotBlank(preferredLanguage)){ @@ -466,6 +478,7 @@ public class PreferencesUtil implements IPreferenceKeys { getPreferenceStore().setDefault(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE, false); getPreferenceStore().setDefault(CHECKLIST_ID_IN_VOCABULARY, true); getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, true); + getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE, true); getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, true); getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_HYBRID, true); getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_LSID, true); @@ -477,6 +490,9 @@ public class PreferencesUtil implements IPreferenceKeys { getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, true); getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_RANK, true); getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, true); + getPreferenceStore().setDefault(SORT_NODES_NATURALLY, false); + getPreferenceStore().setDefault(SORT_NODES_ALPHABETICALLY, false); + } /** @@ -496,7 +512,7 @@ public class PreferencesUtil implements IPreferenceKeys { } public static void setNomenclaturalCodePreferences(){ - ICdmApplicationConfiguration controller; + ICdmRepository controller; controller = CdmStore.getCurrentApplicationConfiguration(); PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode); CdmPreference preference = null; @@ -845,8 +861,8 @@ public class PreferencesUtil implements IPreferenceKeys { *

* getSortRanksNaturally *

- * - * @return a boolean. + * + * @return a boolean. */ public static boolean getSortNodesNaturally() { return getPreferenceStore().getBoolean(SORT_NODES_NATURALLY); @@ -951,17 +967,16 @@ public class PreferencesUtil implements IPreferenceKeys { */ public static NameDetailsConfigurator setPreferredNameDetailsConfiguration( boolean local) { NameDetailsConfigurator config = new NameDetailsConfigurator(true); - ICdmApplicationConfiguration controller; - controller = CdmStore.getCurrentApplicationConfiguration(); - PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NameDetailsView); + CdmPreference preference = null; - if (controller == null){ - return null; + + if (!local) { + preference = getPreferenceFromDB(PreferencePredicate.NameDetailsView); } - preference = controller.getPreferenceService().find(key); if (preference == null){ return null; } + getPreferenceStore().setValue(ALLOW_OVERRIDE_NAMEDETAILS, preference.isAllowOverride()); //the preference value is build like this: @@ -1031,4 +1046,43 @@ public class PreferencesUtil implements IPreferenceKeys { return config; } + public static boolean getIsDeterminiationOnlyForFieldUnit(boolean local){ + CdmPreference preference = null; + + if (!local) { + preference = getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits); + } + if (preference == null){ + return getPreferenceStore().getBoolean(DETERMINATION_ONLY_FOR_FIELD_UNITS); + } + return Boolean.valueOf(preference.getValue()); + } + + public static boolean getIsShowCollectingAreasInGeneralSection(boolean local){ + CdmPreference preference = null; + + if (!local) { + preference = getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection); + } + if (preference == null){ + return getPreferenceStore().getBoolean(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION); + } + return Boolean.valueOf(preference.getValue()); + } + + public static boolean getIsShowTaxonAssociations(boolean local){ + CdmPreference preference = null; + + if (!local) { + preference = getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations); + } + if (preference == null){ + return getPreferenceStore().getBoolean(SHOW_TAXON_ASSOCIATIONS); + } + return Boolean.valueOf(preference.getValue()); + } + + + + } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TemplatePreferencePage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TemplatePreferencePage.java deleted file mode 100644 index e807894d5..000000000 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TemplatePreferencePage.java +++ /dev/null @@ -1,36 +0,0 @@ -/** -* Copyright (C) 2014 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.preference; - -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -/** - * @author a.oppermann - * @date 13.08.2014 - * - */ -public class TemplatePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { - - @Override - public void init(IWorkbench workbench) { - setPreferenceStore(PreferencesUtil.getPreferenceStore()); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() - */ - @Override - protected void createFieldEditors() { - addField(new BooleanFieldEditor(IPreferenceKeys.IS_RL, "Rote Liste 2020", getFieldEditorParent())); - } - -} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/NomenclaturalCodePreferences.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/NomenclaturalCodePreferences.java index 1bb99604f..23ded94e2 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/NomenclaturalCodePreferences.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/NomenclaturalCodePreferences.java @@ -16,7 +16,7 @@ import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.api.service.IPreferenceService; import eu.etaxonomy.cdm.model.metadata.CdmPreference; import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey; @@ -86,7 +86,7 @@ public class NomenclaturalCodePreferences extends FieldEditorPreferencePage setPreferenceStore(TaxeditorStorePlugin.getDefault() .getPreferenceStore()); - ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration(); + ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration(); if (controller != null){ IPreferenceService service = controller.getPreferenceService(); PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode); @@ -109,7 +109,7 @@ public class NomenclaturalCodePreferences extends FieldEditorPreferencePage // if (result){ // String value = getPreferenceStore().getString(IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY); // CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value); -// ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration(); +// ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration(); // if (controller == null){ // return false; // } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java index f8a87dea5..b84f9c915 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java @@ -25,7 +25,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import eu.etaxonomy.cdm.api.application.CdmApplicationException; import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController; import eu.etaxonomy.cdm.api.application.CdmApplicationState; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.api.cache.CdmServiceCacher; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.api.service.IAgentService; @@ -89,7 +89,7 @@ public class CdmStore { private static CdmStore instance; - //private final ICdmApplicationConfiguration applicationConfiguration; + //private final ICdmRepository applicationConfiguration; private static ContextManager contextManager = new ContextManager(); @@ -273,14 +273,14 @@ public class CdmStore { CdmApplicationState.dispose(); } - static void setInstance(ICdmApplicationConfiguration applicationController, + static void setInstance(ICdmRepository applicationController, ICdmSource cdmSource) { instance = new CdmStore(applicationController, cdmSource); CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher()); } - private CdmStore(ICdmApplicationConfiguration applicationController, + private CdmStore(ICdmRepository applicationController, ICdmSource cdmSource) { CdmApplicationState.setCurrentAppConfig(applicationController); CdmApplicationState.setCurrentDataChangeService(new CdmUIDataChangeService()); @@ -293,7 +293,7 @@ public class CdmStore { * * @return */ - private ICdmApplicationConfiguration getApplicationConfiguration() { + private ICdmRepository getApplicationConfiguration() { try { return CdmApplicationState.getCurrentAppConfig(); } catch (Exception e) { @@ -311,7 +311,7 @@ public class CdmStore { * {@link eu.etaxonomy.cdm.remote.api.application.CdmApplicationController} * object. */ - public static ICdmApplicationConfiguration getCurrentApplicationConfiguration() { + public static ICdmRepository getCurrentApplicationConfiguration() { if (getDefault() != null) { return getDefault().getApplicationConfiguration(); } @@ -369,7 +369,7 @@ public class CdmStore { } /** - * Generic method that will scan the getters of {@link ICdmApplicationConfiguration} for the given service + * Generic method that will scan the getters of {@link ICdmRepository} for the given service * interface. If a matching getter is found the according service implementation is returned by * invoking the getter otherwise the method returns null. * diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStoreConnector.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStoreConnector.java index 88f204955..cf0066f3c 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStoreConnector.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStoreConnector.java @@ -25,7 +25,7 @@ import org.springframework.core.io.Resource; import eu.etaxonomy.cdm.api.application.CdmApplicationController; import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController; -import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; +import eu.etaxonomy.cdm.api.application.ICdmRepository; import eu.etaxonomy.cdm.config.CdmSourceException; import eu.etaxonomy.cdm.config.ICdmSource; import eu.etaxonomy.cdm.database.DbSchemaValidation; @@ -34,7 +34,7 @@ import eu.etaxonomy.cdm.model.common.DefinedTermBase; import eu.etaxonomy.cdm.model.metadata.CdmMetaData; import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; import eu.etaxonomy.cdm.model.name.Rank; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter; import eu.etaxonomy.taxeditor.model.MessagingUtils; @@ -102,7 +102,7 @@ class CdmStoreConnector extends Job { CdmStore.close(monitor); } - ICdmApplicationConfiguration applicationController = null; + ICdmRepository applicationController = null; if (!monitor.isCanceled()) { CdmProgressMonitorAdapter subprogressMonitor = CdmProgressMonitorAdapter @@ -176,7 +176,7 @@ class CdmStoreConnector extends Job { } }); - ICdmApplicationConfiguration applicationController = null; + ICdmRepository applicationController = null; if (!monitor.isCanceled()) { CdmProgressMonitorAdapter subprogressMonitor = CdmProgressMonitorAdapter @@ -249,7 +249,7 @@ class CdmStoreConnector extends Job { } - private ICdmApplicationConfiguration getApplicationController(ICdmSource cdmSource, CdmProgressMonitorAdapter subprogressMonitor) { + private ICdmRepository getApplicationController(ICdmSource cdmSource, CdmProgressMonitorAdapter subprogressMonitor) { if(cdmSource instanceof ICdmDataSource) { return CdmApplicationController.NewInstance(applicationContextBean, (ICdmDataSource)cdmSource, diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/SearchManager.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/SearchManager.java index fe313ec8d..6fc530d1c 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/SearchManager.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/SearchManager.java @@ -43,7 +43,7 @@ import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; import eu.etaxonomy.cdm.model.reference.Reference; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/bar/AuthenticatedUserBar.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/bar/AuthenticatedUserBar.java index 6ffc3ef38..a8addd126 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/bar/AuthenticatedUserBar.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/bar/AuthenticatedUserBar.java @@ -20,7 +20,7 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.menus.WorkbenchWindowControlContribution; import eu.etaxonomy.cdm.model.common.User; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.util.ApplicationUtil; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/AbstractComboElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/AbstractComboElement.java index 1701ffc31..130a0994e 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/AbstractComboElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/AbstractComboElement.java @@ -80,6 +80,14 @@ DisposeListener { Color color = AbstractUtility.getColor(colorId); combo.setBackground(color); + if (label != null) { + label.setBackground(color); + } + colorId = !irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT + : Resources.COLOR_COMPOSITE_BACKGROUND; + color = AbstractUtility.getColor(colorId); + combo.setForeground(color); + } public void setVisibleItemCount(int count){ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java index 6553cc99d..7841fb7c9 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java @@ -135,6 +135,8 @@ public class EnumComboElement> extends combo.addSelectionListener(this); } + + private String getDefaultLabelString() { if(enumType.equals(ReferenceType.class)){ return "Reference Type"; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/LoginDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/LoginDialog.java index 2f9d9e079..fd2edd9db 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/LoginDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/LoginDialog.java @@ -19,7 +19,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.store.CdmStore; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java index ae7c71cde..41692b1b1 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java @@ -58,7 +58,7 @@ import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration; import eu.etaxonomy.cdm.api.application.CdmApplicationState; import eu.etaxonomy.cdm.api.service.IUserService; import eu.etaxonomy.cdm.model.metadata.CdmMetaData; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteConfiguratorComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/ConfiguratorComposite.java old mode 100644 new mode 100755 similarity index 90% rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteConfiguratorComposite.java rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/ConfiguratorComposite.java index 59e8f44a4..39a38d226 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteConfiguratorComposite.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/ConfiguratorComposite.java @@ -6,7 +6,7 @@ * 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.ui.dialog.deleteConfigurator; +package eu.etaxonomy.taxeditor.ui.dialog.configurator; import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; @@ -24,7 +24,7 @@ import org.eclipse.ui.forms.widgets.Section; * @date Feb 16, 2015 * */ -public class DeleteConfiguratorComposite extends Composite implements IExpansionListener{ +public class ConfiguratorComposite extends Composite implements IExpansionListener{ private final FormToolkit toolkit = new FormToolkit(Display.getCurrent()); private final Section sctnConfigure; @@ -33,7 +33,7 @@ public class DeleteConfiguratorComposite extends Composite implements IExpansion * @param parent * @param style */ - public DeleteConfiguratorComposite(final Composite parent, int style) { + public ConfiguratorComposite(final Composite parent, int style) { super(parent, SWT.NONE); addDisposeListener(new DisposeListener() { diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetSecundumConfiguratorWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetSecundumConfiguratorWizardPage.java new file mode 100755 index 000000000..5dcbed3c5 --- /dev/null +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetSecundumConfiguratorWizardPage.java @@ -0,0 +1,254 @@ +/** +* Copyright (C) 2017 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.ui.dialog.configurator; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.PojoProperties; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +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.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Text; +import org.eclipse.wb.swt.ResourceManager; + +import eu.etaxonomy.cdm.api.service.config.SetSecundumForSubtreeConfigurator; +import eu.etaxonomy.cdm.model.reference.Reference; +import eu.etaxonomy.taxeditor.l10n.Messages; +import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory; +import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; +import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; + +/** + * @author k.luther + * @date 10.02.2017 + * + */ +public class SetSecundumConfiguratorWizardPage extends WizardPage implements Listener { + private DataBindingContext m_bindingContext; + + private final static CdmFormFactory toolkit = new CdmFormFactory(Display.getCurrent()); + private final SetSecundumForSubtreeConfigurator configurator; + + private Button btnBrowseReference = null; + private Text textReference = null; + private Button btnClear = null; + private EntitySelectionElement selectReference; + private Button btnIncludeAcceptedTaxa; + private Button btnIncludeSynonyms; + private Button btnOverwriteExistingAccepted; + private Button btnOverwriteExistingSynonyms; + private Button btnEmptySecundumDetail; + private Button btnIncludeSharedTaxa; + + + /** + * Create the composite. + * @param parent + * @param style + */ + public SetSecundumConfiguratorWizardPage(SetSecundumForSubtreeConfigurator configurator, Wizard parent, int style ) { + super("Set Secundum Reference Configuration"); + this.configurator = configurator; + this.setDescription(Messages.SetSecundumConfiguration_Description); + +// addDisposeListener(new DisposeListener() { +// @Override +// public void widgetDisposed(DisposeEvent e) { +// toolkit.dispose(); +// } +// }); + // toolkit.paintBordersFor(this); +// setLayout(new GridLayout()); +// setBackground(getBackground()); + + + + + } + + /** + * @return + */ + private DataBindingContext initDataBindings() { + DataBindingContext bindingContext = new DataBindingContext(); + + IObservableValue observeSelectionBtnIncludeAcceptedTaxa = WidgetProperties.selection().observe(btnIncludeAcceptedTaxa); + IObservableValue includeAcceptedTaxaConfiguratorObserveValue = PojoProperties.value("includeAcceptedTaxa").observe(configurator); + bindingContext.bindValue(observeSelectionBtnIncludeAcceptedTaxa, includeAcceptedTaxaConfiguratorObserveValue, null, null); + + IObservableValue observeSelectionBtnIncludeSynonyms = WidgetProperties.selection().observe(btnIncludeSynonyms); + IObservableValue includeSynonymsConfiguratorObserveValue = PojoProperties.value("includeSynonyms").observe(configurator); + bindingContext.bindValue(observeSelectionBtnIncludeSynonyms, includeSynonymsConfiguratorObserveValue, null, null); + + IObservableValue observeSelectionBtnOverwriteExistingAccepted = WidgetProperties.selection().observe(btnOverwriteExistingAccepted); + IObservableValue overwriteExistingAcceptedConfiguratorObserveValue = PojoProperties.value("overwriteExistingAccepted").observe(configurator); + bindingContext.bindValue(observeSelectionBtnOverwriteExistingAccepted, overwriteExistingAcceptedConfiguratorObserveValue, null, null); + + IObservableValue observeSelectionBtnOverwriteExistingSynonyms = WidgetProperties.selection().observe(btnOverwriteExistingSynonyms); + IObservableValue overwriteExistingSynonymsConfiguratorObserveValue = PojoProperties.value("overwriteExistingSynonyms").observe(configurator); + bindingContext.bindValue(observeSelectionBtnOverwriteExistingSynonyms, overwriteExistingSynonymsConfiguratorObserveValue, null, null); + + IObservableValue observeSelectionBtnEmptySecundumDetail = WidgetProperties.selection().observe(btnEmptySecundumDetail); + IObservableValue emptySecundumDetailConfiguratorObserveValue = PojoProperties.value("emptySecundumDetail").observe(configurator); + bindingContext.bindValue(observeSelectionBtnEmptySecundumDetail, emptySecundumDetailConfiguratorObserveValue, null, null); + + IObservableValue observeSelectionBtnIncludeSharedTaxal = WidgetProperties.selection().observe(btnIncludeSharedTaxa); + IObservableValue includeSharedTaxaConfiguratorObserveValue = PojoProperties.value("includeSharedTaxa").observe(configurator); + bindingContext.bindValue(observeSelectionBtnIncludeSharedTaxal, includeSharedTaxaConfiguratorObserveValue, null, null); + return bindingContext; + } + + @Override + public void createControl(Composite parent) { + + final Composite composite = new Composite(parent, SWT.NULL); + + GridLayout gridLayout = new GridLayout(); + gridLayout.numColumns = 1; + + composite.setLayout(gridLayout); + final Composite compositeRef = new Composite(composite, SWT.NULL); + + GridLayout gridLayoutRef = new GridLayout(); + gridLayoutRef.numColumns = 4; + + compositeRef.setLayout(gridLayoutRef); + compositeRef.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true)); + Label label = new Label(compositeRef, SWT.NONE); + label.setText(Messages.SetSecundumConfiguration_NewSecundum_Label); + label.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); + + textReference = new Text(compositeRef, SWT.BORDER); + textReference.setEditable(false); + textReference.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + textReference.setTextLimit(Text.LIMIT); + + btnBrowseReference = new Button(compositeRef, SWT.NONE); + btnBrowseReference.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif")); + btnBrowseReference.addListener(SWT.Selection, this); + btnClear = new Button(compositeRef, SWT.NONE); + btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif")); + btnClear.addListener(SWT.Selection, this); + + // selectReference = toolkit.createSelectionElement(Rights.class, getConversationHolder(), composite, "Rights", null, EntitySelectionElement.SELECTABLE); + final Composite control = new Composite(composite, SWT.NULL); + GridLayout gridLayoutControl = new GridLayout(); + gridLayoutControl.numColumns = 1; + + control.setLayout(gridLayoutControl); + control.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true)); + // Composite control = toolkit.createComposite(composite); + btnIncludeAcceptedTaxa = new Button(control, SWT.CHECK); + btnIncludeAcceptedTaxa.setText(Messages.SetSecundumConfiguration_IncludeAcceptedTaxa); + btnIncludeAcceptedTaxa.setSelection(configurator.isIncludeAcceptedTaxa()); + btnIncludeAcceptedTaxa.addListener(SWT.Selection, new Listener() { + @Override + public void handleEvent(Event e) { + Button b = (Button) e.widget; + GridData data = (GridData) btnIncludeAcceptedTaxa.getLayoutData(); + data.exclude = b.getSelection(); + btnOverwriteExistingAccepted.setVisible(data.exclude); + btnIncludeSharedTaxa.setVisible(data.exclude); + if (!btnIncludeSynonyms.getSelection() && !data.exclude){ + btnEmptySecundumDetail.setVisible(false); + setPageComplete(false); + }else{ + btnEmptySecundumDetail.setVisible(true); + setPageComplete(true); + } + } + }); + + btnOverwriteExistingAccepted = new Button(control, SWT.CHECK); + btnOverwriteExistingAccepted.setText(Messages.SetSecundumConfiguration_OverwriteExistingAccepted); + + btnIncludeSynonyms = new Button(control, SWT.CHECK); + btnIncludeSynonyms.setText(Messages.SetSecundumConfiguration_IncludeSynonyms); + btnIncludeSynonyms.setSelection(configurator.isIncludeSynonyms()); + btnIncludeSynonyms.addListener(SWT.Selection, new Listener() { + @Override + public void handleEvent(Event e) { + Button b = (Button) e.widget; + GridData data = (GridData) btnIncludeSynonyms.getLayoutData(); + data.exclude = b.getSelection(); + btnOverwriteExistingSynonyms.setVisible(data.exclude); + if (!btnIncludeAcceptedTaxa.getSelection() && !data.exclude){ + btnEmptySecundumDetail.setVisible(false); + setPageComplete(false); + }else{ + btnEmptySecundumDetail.setVisible(true); + setPageComplete(true); + } + + } + }); + + btnOverwriteExistingAccepted.setSelection(configurator.isOverwriteExistingAccepted()); + btnOverwriteExistingSynonyms = new Button(control, SWT.CHECK); + btnOverwriteExistingSynonyms.setText(Messages.SetSecundumConfiguration_OverwriteExistingSynonyms); + btnOverwriteExistingSynonyms.setSelection(configurator.isOverwriteExistingSynonyms()); + btnEmptySecundumDetail = new Button(control, SWT.CHECK); + btnEmptySecundumDetail.setText(Messages.SetSecundumConfiguration_EmptySecundumDetail); + btnEmptySecundumDetail.setSelection(configurator.isEmptySecundumDetail()); + + btnIncludeSharedTaxa = new Button(control, SWT.CHECK); + btnIncludeSharedTaxa.setText(Messages.SetSecundumConfiguration_IncludeSharedtaxa); + btnIncludeSharedTaxa.setSelection(configurator.isIncludeSharedTaxa()); + + m_bindingContext = initDataBindings(); + setControl(composite); + } + + + + @Override + public void handleEvent(Event event) { + Reference reference; + if(event.widget==btnBrowseReference){ + reference = SelectionDialogFactory.getSelectionFromDialog(Reference.class, this.getShell(), null, null); + if(reference!=null){ + this.configurator.setNewSecundum(reference); + textReference.setText(reference.getTitleCache()); + + } + + } else if(event.widget==btnClear){ + reference = null; + textReference.setText(""); + this.configurator.setNewSecundum(null); + } else{ + reference = null; + textReference.setText(""); + this.configurator.setNewSecundum(null); + } + + } + +// /** +// * {@inheritDoc} +// */ +// @Override +// public AbstractCdmDetailElement createElement(ICdmFormElement rootElement) { +// // TODO Auto-generated method stub +// return null; +// } + + + + +} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetSecundumForSubtreeConfigurationWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetSecundumForSubtreeConfigurationWizard.java new file mode 100755 index 000000000..a8186ca2a --- /dev/null +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetSecundumForSubtreeConfigurationWizard.java @@ -0,0 +1,96 @@ +/** +* Copyright (C) 2017 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.ui.dialog.configurator; + +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Shell; + +import eu.etaxonomy.cdm.api.service.config.SetSecundumForSubtreeConfigurator; +import eu.etaxonomy.cdm.model.reference.Reference; + +/** + * @author k.luther + * @date 10.02.2017 + * + */ +public class SetSecundumForSubtreeConfigurationWizard extends Wizard { + + Reference newSecRef; + private final SetSecundumForSubtreeConfigurator configurator; + + + private SetSecundumConfiguratorWizardPage page; + + + + /** + * @param parentShell + * @param dialogTitle + * @param dialogTitleImage + * @param dialogMessage + * @param dialogImageType + * @param dialogButtonLabels + * @param defaultIndex + * @param config + */ + public SetSecundumForSubtreeConfigurationWizard(SetSecundumForSubtreeConfigurator config) { + super(); + // super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex); + this.configurator = config; + setNeedsProgressMonitor(true); + + + + } + + + + /** + * @param configurator + * @param activeShell + * @param setSecundumHandler_confirm + * @param setSecundumHandler_configureSettings + * @return + */ + public static void openConfirmWithConfigurator(SetSecundumForSubtreeConfigurator configurator, Shell parent, String title, String message) { + + SetSecundumForSubtreeConfigurationWizard wizard = new SetSecundumForSubtreeConfigurationWizard(configurator); + + + } + + + + + + /** + * {@inheritDoc} + */ + @Override + public boolean performFinish() { + if (!(configurator.isIncludeAcceptedTaxa() || configurator.isIncludeSynonyms())){ + return false; + }else{ + return true; + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.wizard.Wizard#addPages() + */ + /** {@inheritDoc} */ + @Override + public void addPages() { + page = new SetSecundumConfiguratorWizardPage(configurator, this, SWT.NONE); + addPage(page); + } + + +} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteConfiguratorDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteConfiguratorDialog.java similarity index 96% rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteConfiguratorDialog.java rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteConfiguratorDialog.java index e9d932db9..53426590b 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteConfiguratorDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteConfiguratorDialog.java @@ -6,7 +6,7 @@ * 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.ui.dialog.deleteConfigurator; +package eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialog; @@ -23,6 +23,7 @@ import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator; import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator; import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator; +import eu.etaxonomy.taxeditor.ui.dialog.configurator.ConfiguratorComposite; /** * Abstract subclass of MessageDialog providing the functionality to configure @@ -52,7 +53,7 @@ public class DeleteConfiguratorDialog extends MessageDialog{ @Override protected Control createCustomArea(Composite parent) { - DeleteConfiguratorComposite composite = new DeleteConfiguratorComposite(parent, NONE); + ConfiguratorComposite composite = new ConfiguratorComposite(parent, NONE); if(configurator instanceof TaxonDeletionConfigurator){ composite.addConfiguratorComposite(new DeleteTaxonConfiguratorComposite((TaxonDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE)); }else if (configurator instanceof SynonymDeletionConfigurator){ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteMediaConfiguratorComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteMediaConfiguratorComposite.java similarity index 98% rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteMediaConfiguratorComposite.java rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteMediaConfiguratorComposite.java index d3de660c0..6b5c3cd1d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteMediaConfiguratorComposite.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteMediaConfiguratorComposite.java @@ -6,7 +6,7 @@ * 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.ui.dialog.deleteConfigurator; +package eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator; import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.beans.PojoProperties; @@ -26,7 +26,7 @@ import org.eclipse.swt.widgets.Listener; import org.eclipse.ui.forms.widgets.FormToolkit; import eu.etaxonomy.cdm.api.service.config.MediaDeletionConfigurator; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; /** * @author k.luther diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteNameConfiguratorComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteNameConfiguratorComposite.java similarity index 98% rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteNameConfiguratorComposite.java rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteNameConfiguratorComposite.java index ed1fd4da6..cc1b077a0 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteNameConfiguratorComposite.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteNameConfiguratorComposite.java @@ -1,4 +1,4 @@ -package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator; +package eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator; import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.beans.PojoProperties; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteNodeConfiguratorComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteNodeConfiguratorComposite.java similarity index 97% rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteNodeConfiguratorComposite.java rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteNodeConfiguratorComposite.java index 93d214aab..e5694b22c 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteNodeConfiguratorComposite.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteNodeConfiguratorComposite.java @@ -7,7 +7,7 @@ * See LICENSE.TXT at the top of this package for the full license terms. */ -package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator; +package eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator; import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.beans.PojoProperties; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteSpecimenConfiguratorComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteSpecimenConfiguratorComposite.java similarity index 98% rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteSpecimenConfiguratorComposite.java rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteSpecimenConfiguratorComposite.java index d8cc6f3b7..77f6de3af 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteSpecimenConfiguratorComposite.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteSpecimenConfiguratorComposite.java @@ -6,7 +6,7 @@ * 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.ui.dialog.deleteConfigurator; +package eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator; import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.beans.PojoProperties; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteTaxonBaseConfiguratorComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteTaxonBaseConfiguratorComposite.java similarity index 99% rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteTaxonBaseConfiguratorComposite.java rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteTaxonBaseConfiguratorComposite.java index 094dca92e..c4a996426 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteTaxonBaseConfiguratorComposite.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteTaxonBaseConfiguratorComposite.java @@ -6,7 +6,7 @@ * 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.ui.dialog.deleteConfigurator; +package eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator; import java.util.List; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteTaxonConfiguratorComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteTaxonConfiguratorComposite.java similarity index 96% rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteTaxonConfiguratorComposite.java rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteTaxonConfiguratorComposite.java index 4f52d0a94..43ae5ba2c 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteTaxonConfiguratorComposite.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteTaxonConfiguratorComposite.java @@ -1,76 +1,76 @@ -/** -* Copyright (C) 2016 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.ui.dialog.deleteConfigurator; - -import org.eclipse.core.databinding.beans.PojoProperties; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator; - -/** - * @author k.luther - * @date 19.04.2016 - * - */ -public class DeleteTaxonConfiguratorComposite extends DeleteTaxonBaseConfiguratorComposite { - - private final Button btnDeleteSynonyms; - private final Button btnDeleteMisappliedNamesAndInvalidDesignations; - private final Button btnTaxonRelationships; - private final Button btnConceptRelationships; - /** - * @param configurator - * @param parent - * @param style - */ - public DeleteTaxonConfiguratorComposite(TaxonBaseDeletionConfigurator configurator, Composite parent, int style) { - super(configurator, parent, style); - btnDeleteSynonyms = new Button(this, SWT.CHECK); - btnDeleteSynonyms.setText("Delete synonyms if possible"); - btnDeleteSynonyms.setSelection(true); - - btnDeleteMisappliedNamesAndInvalidDesignations = new Button(this, SWT.CHECK); - btnDeleteMisappliedNamesAndInvalidDesignations.setText("Delete misapplied names and invalid designations if possible"); - btnDeleteMisappliedNamesAndInvalidDesignations.setSelection(true); - - - btnTaxonRelationships = new Button(this, SWT.CHECK); - btnTaxonRelationships.setText("Delete taxon relations if possible"); - btnTaxonRelationships.setSelection(true); - - btnConceptRelationships = new Button(this, SWT.CHECK); - btnConceptRelationships.setText("Delete concept relations if possible"); - btnConceptRelationships.setSelection(true); - initDataBindingsTaxon(); - } - - protected void initDataBindingsTaxon() { - - IObservableValue observeSelectionBtnDeleteSynonymsObserveWidget = WidgetProperties.selection().observe(btnDeleteSynonyms); - IObservableValue deleteSynonymsConfiguratorObserveValue = PojoProperties.value("deleteSynonymsIfPossible").observe(configurator); - m_bindingContext.bindValue(observeSelectionBtnDeleteSynonymsObserveWidget, deleteSynonymsConfiguratorObserveValue, null, null); - - IObservableValue observeSelectionbtnDeleteMisappliedNamesAndInvalidDesignationsObserveWidget = WidgetProperties.selection().observe(btnDeleteMisappliedNamesAndInvalidDesignations); - IObservableValue deleteMisappliedNamesAndInvalidDesignationsConfiguratorObserveValue = PojoProperties.value("deleteMisappliedNamesAndInvalidDesignationsIfPossible").observe(configurator); - m_bindingContext.bindValue(observeSelectionbtnDeleteMisappliedNamesAndInvalidDesignationsObserveWidget, deleteMisappliedNamesAndInvalidDesignationsConfiguratorObserveValue, null, null); - - IObservableValue observeSelectionbtnTaxonRelationshipsObserveWidget = WidgetProperties.selection().observe(btnTaxonRelationships); - IObservableValue deleteTaxonRelationshipsConfiguratorObserveValue = PojoProperties.value("deleteTaxonRelationships").observe(configurator); - m_bindingContext.bindValue(observeSelectionbtnTaxonRelationshipsObserveWidget, deleteTaxonRelationshipsConfiguratorObserveValue, null, null); - - IObservableValue observeSelectionbtnConceptRelationshipsObserveWidget = WidgetProperties.selection().observe(btnConceptRelationships); - IObservableValue deleteConceptRelationshipsConfiguratorObserveValue = PojoProperties.value("deleteConceptRelationships").observe(configurator); - m_bindingContext.bindValue(observeSelectionbtnConceptRelationshipsObserveWidget, deleteConceptRelationshipsConfiguratorObserveValue, null, null); - - } -} +/** +* Copyright (C) 2016 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.ui.dialog.configurator.deleteConfigurator; + +import org.eclipse.core.databinding.beans.PojoProperties; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; + +import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator; + +/** + * @author k.luther + * @date 19.04.2016 + * + */ +public class DeleteTaxonConfiguratorComposite extends DeleteTaxonBaseConfiguratorComposite { + + private final Button btnDeleteSynonyms; + private final Button btnDeleteMisappliedNamesAndInvalidDesignations; + private final Button btnTaxonRelationships; + private final Button btnConceptRelationships; + /** + * @param configurator + * @param parent + * @param style + */ + public DeleteTaxonConfiguratorComposite(TaxonBaseDeletionConfigurator configurator, Composite parent, int style) { + super(configurator, parent, style); + btnDeleteSynonyms = new Button(this, SWT.CHECK); + btnDeleteSynonyms.setText("Delete synonyms if possible"); + btnDeleteSynonyms.setSelection(true); + + btnDeleteMisappliedNamesAndInvalidDesignations = new Button(this, SWT.CHECK); + btnDeleteMisappliedNamesAndInvalidDesignations.setText("Delete misapplied names and invalid designations if possible"); + btnDeleteMisappliedNamesAndInvalidDesignations.setSelection(true); + + + btnTaxonRelationships = new Button(this, SWT.CHECK); + btnTaxonRelationships.setText("Delete taxon relations if possible"); + btnTaxonRelationships.setSelection(true); + + btnConceptRelationships = new Button(this, SWT.CHECK); + btnConceptRelationships.setText("Delete concept relations if possible"); + btnConceptRelationships.setSelection(true); + initDataBindingsTaxon(); + } + + protected void initDataBindingsTaxon() { + + IObservableValue observeSelectionBtnDeleteSynonymsObserveWidget = WidgetProperties.selection().observe(btnDeleteSynonyms); + IObservableValue deleteSynonymsConfiguratorObserveValue = PojoProperties.value("deleteSynonymsIfPossible").observe(configurator); + m_bindingContext.bindValue(observeSelectionBtnDeleteSynonymsObserveWidget, deleteSynonymsConfiguratorObserveValue, null, null); + + IObservableValue observeSelectionbtnDeleteMisappliedNamesAndInvalidDesignationsObserveWidget = WidgetProperties.selection().observe(btnDeleteMisappliedNamesAndInvalidDesignations); + IObservableValue deleteMisappliedNamesAndInvalidDesignationsConfiguratorObserveValue = PojoProperties.value("deleteMisappliedNamesAndInvalidDesignationsIfPossible").observe(configurator); + m_bindingContext.bindValue(observeSelectionbtnDeleteMisappliedNamesAndInvalidDesignationsObserveWidget, deleteMisappliedNamesAndInvalidDesignationsConfiguratorObserveValue, null, null); + + IObservableValue observeSelectionbtnTaxonRelationshipsObserveWidget = WidgetProperties.selection().observe(btnTaxonRelationships); + IObservableValue deleteTaxonRelationshipsConfiguratorObserveValue = PojoProperties.value("deleteTaxonRelationships").observe(configurator); + m_bindingContext.bindValue(observeSelectionbtnTaxonRelationshipsObserveWidget, deleteTaxonRelationshipsConfiguratorObserveValue, null, null); + + IObservableValue observeSelectionbtnConceptRelationshipsObserveWidget = WidgetProperties.selection().observe(btnConceptRelationships); + IObservableValue deleteConceptRelationshipsConfiguratorObserveValue = PojoProperties.value("deleteConceptRelationships").observe(configurator); + m_bindingContext.bindValue(observeSelectionbtnConceptRelationshipsObserveWidget, deleteConceptRelationshipsConfiguratorObserveValue, null, null); + + } +} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmEnumSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmEnumSelectionDialog.java index e02afa3c9..792a10026 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmEnumSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmEnumSelectionDialog.java @@ -49,55 +49,55 @@ public abstract class AbstractFilteredCdmEnumSelectionDialog model; - private String settings; - - - + protected List model; + private String settings; + + + /** *

Constructor for AbstractFilteredCdmResourceSelectionDialog.

* * @param shell a {@link org.eclipse.swt.widgets.Shell} object. - * @param conversation + * @param conversation * @param title a {@link java.lang.String} object. * @param multi a boolean. * @param settings a {@link java.lang.String} object. * @param cdmEnum a T object. * @param a T object. */ - protected AbstractFilteredCdmEnumSelectionDialog(Shell shell, - ConversationHolder conversation, - String title, - boolean multi, + protected AbstractFilteredCdmEnumSelectionDialog(Shell shell, + ConversationHolder conversation, + String title, + boolean multi, String settings, T cdmEnum) { super(shell, multi); setTitle(title); setMessage("Use * for wildcard, or ? to see all entries"); this.settings = settings; - + this.conversation = conversation; - + init(); - + initModel(); - + String objectTitle = getTitle(cdmEnum); if (objectTitle != null) { setInitialPattern(objectTitle); } - + setListLabelProvider(createListLabelProvider()); setDetailsLabelProvider(createDetailsLabelProvider()); - + setSelectionHistory(new ResourceSelectionHistory()); } - + /** * By default, we are returning the standard list label provider - * - * Override in subclasses if you want different behavior - * + * + * Override in subclasses if you want different behavior + * * @return */ protected ILabelProvider createDetailsLabelProvider() { @@ -105,7 +105,7 @@ public abstract class AbstractFilteredCdmEnumSelectionDialoggetSelectionFromDialog

* @@ -128,13 +128,13 @@ public abstract class AbstractFilteredCdmEnumSelectionDialog TYPE getSelectionFromDialog(AbstractFilteredCdmEnumSelectionDialog dialog) { - + int result = dialog.open(); - + if (result == Window.CANCEL) { return null; } - + return dialog.getSelectedEnumTerm(); } @@ -148,15 +148,15 @@ public abstract class AbstractFilteredCdmEnumSelectionDialoginitModel

*/ @@ -177,7 +177,7 @@ public abstract class AbstractFilteredCdmEnumSelectionDialog() { - public int compare(IEnumTerm entity1, + @Override + public int compare(IEnumTerm entity1, IEnumTerm entity2) { - Collator collator = Collator.getInstance(); - return collator.compare(entity1.getMessage(), entity2.getMessage()); + if (entity1.equals(entity2)){ + return 0; + } + Collator collator = Collator.getInstance(); + + int result = collator.compare(entity1.getMessage(), entity2.getMessage()); + if (result == 0){ + return entity1.getUuid().compareTo(entity2.getUuid()); + } + return result; } }; } @@ -304,7 +313,7 @@ public abstract class AbstractFilteredCdmEnumSelectionDialoggetSelectedUuidAndTitleCache

* @@ -314,7 +323,7 @@ public abstract class AbstractFilteredCdmEnumSelectionDialogGetter for the field settings.

* @@ -326,9 +335,9 @@ public abstract class AbstractFilteredCdmEnumSelectionDialoggetNewWizardLinkText

* * @return a {@link java.lang.String} object. */ protected abstract String getNewWizardLinkText(); - + /** *

getNewEntityWizard

- * @param parameter + * @param parameter * @return a {@link eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard} object. */ protected abstract AbstractNewEntityWizard getNewEntityWizard(String parameter); - + public class FilteredCdmResourceLabelProvider extends LabelProvider { - public String getText(Object element) { + @Override + public String getText(Object element) { if (element == null) { return null; } return ((IEnumTerm) element).getMessage(); - } + } }; /* (non-Javadoc) @@ -386,23 +398,23 @@ public abstract class AbstractFilteredCdmEnumSelectionDialoggetConversationHolder

* * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. */ - public ConversationHolder getConversationHolder() { + @Override + public ConversationHolder getConversationHolder() { return conversation; } - + /** {@inheritDoc} */ - public void update(CdmDataChangeMap changeEvents) {} + @Override + public void update(CdmDataChangeMap changeEvents) {} } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java index 61e4b9b34..a6ec94c17 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java @@ -365,7 +365,14 @@ public abstract class AbstractFilteredCdmResourceSelectionDialog(entity.getUuid(), entity.getId(), getTitle(entity))); refresh(); setPattern(entity); - getConversationHolder().bind(); + if (getConversationHolder() != null){ + getConversationHolder().bind(); + } } //FIXME : Need to make sure this is a stable fix (ticket 3822) - getConversationHolder().commit(); + if (getConversationHolder() != null){ + getConversationHolder().commit(); + } } } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java index 88cffafd3..cb666348e 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java @@ -193,6 +193,10 @@ public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog { @Override public int compare(UuidAndTitleCache entity1, UuidAndTitleCache entity2) { + + if (entity1.getUuid().equals(entity2.getUuid())){ + return 0; + } Collator collator = Collator.getInstance(); String compareString1 = ""; if (entity1.getAbbrevTitleCache() != null){ @@ -212,7 +216,11 @@ public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog { } - return collator.compare(compareString1, compareString2); + int result =collator.compare(compareString1, compareString2); + if (result == 0){ + result = entity1.getUuid().compareTo(entity2.getUuid()); + } + return result; } }; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalReferenceSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalReferenceSelectionDialog.java index 6309647e2..9442d18b4 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalReferenceSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalReferenceSelectionDialog.java @@ -22,7 +22,7 @@ public class NomenclaturalReferenceSelectionDialog extends protected NomenclaturalReferenceSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, - Reference reference) { + Reference reference, boolean inReference) { super(shell, conversation, title, multi, reference); // TODO Auto-generated constructor stub } @@ -66,7 +66,7 @@ public class NomenclaturalReferenceSelectionDialog extends public static Reference select(Shell shell, ConversationHolder conversation, Reference reference) { NomenclaturalReferenceSelectionDialog dialog = new NomenclaturalReferenceSelectionDialog(shell, conversation, - "Choose a reference", false, reference); + "Choose a reference", isInReference, reference, false); return getSelectionFromDialog(dialog); } @@ -132,31 +132,42 @@ public class NomenclaturalReferenceSelectionDialog extends }; @Override - protected Comparator getItemsComparator() { - return new Comparator() { - @Override - public int compare(UuidAndTitleCache entity1, - UuidAndTitleCache entity2) { - Collator collator = Collator.getInstance(); - String compareString1 = ""; - if (entity1.getAbbrevTitleCache() != null){ - compareString1 = entity1.getAbbrevTitleCache(); - } - if (entity1.getTitleCache() != null){ - compareString1 += entity1.getTitleCache(); - } - String compareString2 = ""; - if (entity2.getAbbrevTitleCache() != null){ - compareString2 = entity2.getAbbrevTitleCache(); - } - if (entity2.getTitleCache() != null){ - compareString2 += entity2.getTitleCache(); - } - return collator.compare(compareString1, compareString2); - } - }; - } - + protected Comparator getItemsComparator() { + return new Comparator() { + @Override + public int compare(UuidAndTitleCache entity1, + UuidAndTitleCache entity2) { + + if (entity1.getUuid().equals(entity2.getUuid())){ + return 0; + } + Collator collator = Collator.getInstance(); + String compareString1 = ""; + if (entity1.getAbbrevTitleCache() != null){ + compareString1 = entity1.getAbbrevTitleCache(); + } + if (entity1.getTitleCache() != null){ + compareString1 += entity1.getTitleCache(); + } + + + String compareString2 = ""; + if (entity2.getAbbrevTitleCache() != null){ + compareString2 = entity2.getAbbrevTitleCache(); + } + if (entity2.getTitleCache() != null){ + compareString2 += entity2.getTitleCache(); + } + + + int result =collator.compare(compareString1, compareString2); + if (result == 0){ + result = entity1.getUuid().compareTo(entity2.getUuid()); + } + return result; + } + }; + } @Override protected String getTitle(Reference cdmObject) { if(cdmObject == null){ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ReferenceSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ReferenceSelectionDialog.java index cc4d682c0..afaab4762 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ReferenceSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ReferenceSelectionDialog.java @@ -31,6 +31,8 @@ import eu.etaxonomy.taxeditor.store.CdmStore; */ public class ReferenceSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog { + protected static boolean isInReference = false; + private Reference currentReference; /** *

select

* @@ -39,12 +41,27 @@ public class ReferenceSelectionDialog extends AbstractFilteredCdmResourceSelecti * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. * @return a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object. */ - public static Reference select(Shell shell, ConversationHolder conversation, Reference reference) { + public static Reference select(Shell shell, ConversationHolder conversation, Reference reference, boolean isInReference) { ReferenceSelectionDialog dialog = new ReferenceSelectionDialog(shell, conversation, - "Choose a reference", false, reference); + "Choose a reference", false, reference, isInReference); return getSelectionFromDialog(dialog); } + /** + *

select

+ * + * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object. + * @param shell a {@link org.eclipse.swt.widgets.Shell} object. + * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. + * @return a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object. + */ + public static Reference select(Shell shell, ConversationHolder conversation, Reference reference) { + ReferenceSelectionDialog dialog = new ReferenceSelectionDialog(shell, conversation, + "Choose a reference", false, reference); + return getSelectionFromDialog(dialog); + } + + /** *

Constructor for FilteredReferenceSelectionDialog.

@@ -57,9 +74,28 @@ public class ReferenceSelectionDialog extends AbstractFilteredCdmResourceSelecti */ protected ReferenceSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, Reference reference) { super(shell, conversation, title, multi, ReferenceSelectionDialog.class.getCanonicalName(), null); + this.currentReference = reference; } + + + /** + *

Constructor for FilteredReferenceSelectionDialog.

+ * + * @param shell a {@link org.eclipse.swt.widgets.Shell} object. + * @param title a {@link java.lang.String} object. + * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object. + * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. + * @param multi a boolean. + */ + protected ReferenceSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, Reference reference, boolean isInReference) { + super(shell, conversation, title, multi, ReferenceSelectionDialog.class.getCanonicalName(), null); + this.isInReference = isInReference; + this.currentReference = reference; + } + + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID) */ @@ -82,9 +118,17 @@ public class ReferenceSelectionDialog extends AbstractFilteredCdmResourceSelecti } if (pattern == null || pattern.equals("?")){ - model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCache(null,null); + if (isInReference && currentReference != null){ + model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCache(null,null,currentReference.getType()); + }else{ + model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCache(null,null); + } }else{ - model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCache(limitOfInitialElements,pattern); + if (isInReference && currentReference != null){ + model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCache(limitOfInitialElements,pattern, currentReference.getType()); + }else{ + model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCache(limitOfInitialElements,pattern); + } } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/RightsSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/RightsSelectionDialog.java new file mode 100755 index 000000000..86e8fc6e6 --- /dev/null +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/RightsSelectionDialog.java @@ -0,0 +1,103 @@ +/** +* Copyright (C) 2017 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.ui.dialog.selection; + +import java.util.UUID; + +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +import eu.etaxonomy.cdm.api.conversation.ConversationHolder; +import eu.etaxonomy.cdm.api.service.IRightsService; +import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; +import eu.etaxonomy.cdm.model.media.Rights; +import eu.etaxonomy.taxeditor.model.MessagingUtils; +import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard; +import eu.etaxonomy.taxeditor.store.CdmStore; + +/** + * @author k.luther + * @date 15.02.2017 + * + */ +public class RightsSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog { + + + public static Rights select(Shell shell, ConversationHolder conversation, Rights rights){ + RightsSelectionDialog dialog = new RightsSelectionDialog(shell, conversation, + "Choose Rights", false, RightsSelectionDialog.class.getCanonicalName(), rights); + return getSelectionFromDialog(dialog); + } + + /** + *

Constructor for FilteredDerivedUnitSelectionDialog.

+ */ + protected RightsSelectionDialog(Shell shell, ConversationHolder conversation, String title, + boolean multi, String settings, Rights rights) { + super(shell, conversation, title, multi, settings, rights); + } + + /** + * {@inheritDoc} + */ + @Override + protected Rights getPersistentObject(UUID uuid) { + Object object = CdmStore.getService(IRightsService.class).load(uuid); + + Rights rights= (Rights) HibernateProxyHelper.deproxy(object); + + if(rights != null){ + return rights; + } + MessagingUtils.error(this.getClass(), "Selected element is not rights", null); + return null; + } + + /** + * {@inheritDoc} + */ + @Override + protected String getNewWizardLinkText() { + // TODO Auto-generated method stub + return null; + } + + /** + * {@inheritDoc} + */ + @Override + protected AbstractNewEntityWizard getNewEntityWizard(String parameter) { + // TODO Auto-generated method stub + return null; + } + + /** + * {@inheritDoc} + */ + @Override + protected void initModel() { + Control control = getPatternControl(); + String pattern = null; + if (control != null){ + pattern = ((Text)control).getText(); + } + + if (pattern == null || pattern.equals("?")){ + model = CdmStore.getService(IRightsService.class).getUuidAndLabelText(null,null); + + }else{ + + model = CdmStore.getService(IRightsService.class).getUuidAndLabelText(limitOfInitialElements,pattern); + + } + + } + +} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java index dbb9ef191..9c1c812bf 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java @@ -28,6 +28,7 @@ import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; import eu.etaxonomy.cdm.model.location.Country; import eu.etaxonomy.cdm.model.location.NamedArea; import eu.etaxonomy.cdm.model.media.Media; +import eu.etaxonomy.cdm.model.media.Rights; import eu.etaxonomy.cdm.model.molecular.Amplification; import eu.etaxonomy.cdm.model.molecular.Primer; import eu.etaxonomy.cdm.model.name.TaxonNameBase; @@ -47,6 +48,7 @@ import eu.etaxonomy.taxeditor.ui.element.IEntityElement; import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberElement; import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailElement; import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement; +import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement; /** * @author n.hoffmann @@ -80,6 +82,9 @@ public class SelectionDialogFactory { return (T) NomenclaturalReferenceSelectionDialog.select(shell, conversation, (Reference) currentSelection); } if(clazz.equals(Reference.class)){ + if (parentElement instanceof ReferenceDetailElement){ + return (T) ReferenceSelectionDialog.select(shell, conversation, ((ReferenceDetailElement) parentElement).getEntity(), true); + } return (T) ReferenceSelectionDialog.select(shell, conversation, (Reference) currentSelection); } @@ -159,6 +164,9 @@ public class SelectionDialogFactory { if(clazz.equals(Media.class)){ return (T) MediaSelectionDialog.select(shell, conversation, (Media) currentSelection); } + if(clazz.equals(Rights.class)){ + return (T) RightsSelectionDialog.select(shell, conversation, (Rights) currentSelection); + } return null; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonNodeSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonNodeSelectionDialog.java index f727331f7..09e106b5f 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonNodeSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonNodeSelectionDialog.java @@ -140,7 +140,14 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti @Override public int compare(Classification o1, Classification o2) { - return o1.getTitleCache().compareTo(o2.getTitleCache()); + if (o1.equals(o2)){ + return 0; + } + int result = o1.getTitleCache().compareTo(o2.getTitleCache()); + if (result == 0){ + return o1.getUuid().compareTo(o2.getUuid()); + } + return result; } }); if (this.cdmBaseToBeFiltered == null){ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractUriWithExceptionLabelElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractUriWithExceptionLabelElement.java index 3f8978a82..9ee420237 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractUriWithExceptionLabelElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractUriWithExceptionLabelElement.java @@ -16,7 +16,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.forms.widgets.TableWrapLayout; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; /** * diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java index 137e36afd..be66a75fa 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java @@ -2680,7 +2680,7 @@ public class CdmFormFactory extends FormToolkit { } else if (entity instanceof User) { element = new MemberDetailElement(this, parentElement, (User) entity, removeListener, style); } else if (entity instanceof GrantedAuthority) { - element = new GrantedAuthorityCollectionElement(this, parentElement, (GrantedAuthorityImpl) entity, + element = new GrantedAuthorityCollectionElement(this, parentElement, (GrantedAuthorityImpl) entity, ((Group)parentElement.getEntity()), removeListener, style); } else if (entity instanceof Group) { element = new GroupsByUserDetailElement(this, parentElement, (Group) entity, removeListener, style); @@ -2718,6 +2718,25 @@ public class CdmFormFactory extends FormToolkit { element = new StatisticalMeasureCollectionElement(this, parentElement, (StatisticalMeasure) entity, removeListener, backgroundColor, style); } + //check for parent section when entity is null + //this happens when AbstractUnboundEntityCollectionSection is used + if(entity==null){ + if(parentElement instanceof ScopeSection || parentElement instanceof ScopeRestrictionSection){ + element = new ScopeElement(this, + parentElement, + (DefinedTerm) entity, + removeListener, + style); + } + else if(parentElement instanceof ModifierSection){ + element = new ModifierElement(this, + parentElement, + (DefinedTerm) entity, + removeListener, + style); + } + } + if (element == null) { MessagingUtils.messageDialog("No element for entity", this, diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/MinMaxTextSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/MinMaxTextSection.java index c34c2d288..6e6f073ce 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/MinMaxTextSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/MinMaxTextSection.java @@ -202,7 +202,7 @@ public class MinMaxTextSection extends AbstractFormSection { private void updateMinimum() { switch(unitType) { case ELEVATION: - getEntity().setAbsoluteElevation(text_minVal.getDouble()!=null?text_minVal.getDouble().intValue():null); + getEntity().setAbsoluteElevation(text_minVal.getDouble()!=null ? text_minVal.getDouble().intValue(): null); break; case DIST_TO_GROUND: getEntity().setDistanceToGround(text_minVal.getDouble()); @@ -231,7 +231,7 @@ public class MinMaxTextSection extends AbstractFormSection { private void updateMaximum() { switch(unitType) { case ELEVATION: - getEntity().setAbsoluteElevationMax(text_maxVal.getDouble()!=null?text_maxVal.getDouble().intValue():null); + getEntity().setAbsoluteElevationMax(text_maxVal.getDouble() != null ? text_maxVal.getDouble().intValue() : null); break; case DIST_TO_GROUND: getEntity().setDistanceToGroundMax(text_maxVal.getDouble()); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/NumberWithLabelElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/NumberWithLabelElement.java index 8f1c40a60..59a6fd090 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/NumberWithLabelElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/NumberWithLabelElement.java @@ -20,7 +20,6 @@ import org.eclipse.swt.widgets.Display; * * @author n.hoffmann * @created Mar 22, 2010 - * @version 1.0 */ public class NumberWithLabelElement extends TextWithLabelElement { @@ -63,7 +62,7 @@ public class NumberWithLabelElement extends TextWithLabelElement { if(super.getText()!=null){ String text = super.getText().trim(); try { - return StringUtils.isBlank(text) ? 0 : new Integer(text); + return StringUtils.isBlank(text) ? null : new Integer(text); } catch (NumberFormatException e) { exception = e; } @@ -78,7 +77,7 @@ public class NumberWithLabelElement extends TextWithLabelElement { public Float getFloat(){ String text = super.getText(); try { - return StringUtils.isBlank(text) ? 0 : new Float(text); + return StringUtils.isBlank(text) ? null : new Float(text); } catch (NumberFormatException e) { exception = e; } @@ -92,7 +91,7 @@ public class NumberWithLabelElement extends TextWithLabelElement { public Double getDouble(){ String text = super.getText(); try { - return new Double(text); + return StringUtils.isBlank(text) ? null : new Double(text); } catch (NumberFormatException e) { exception = e; } @@ -106,9 +105,6 @@ public class NumberWithLabelElement extends TextWithLabelElement { return null; } - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ /** {@inheritDoc} */ @Override public void modifyText(ModifyEvent event) { @@ -120,14 +116,11 @@ public class NumberWithLabelElement extends TextWithLabelElement { } try{ - - Float number = Float.parseFloat(value); - + Float number = Float.parseFloat(value); if((start != null && number < start) || (end != null && number > end)){ exception = new NumberFormatException("You entered a number that is not within the allowed bounds."); throw exception; } - }catch(NumberFormatException e){ text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); firePropertyChangeEvent(new CdmPropertyChangeEvent(this, event)); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PartialElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PartialElement.java index 063819a7d..c50229826 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PartialElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PartialElement.java @@ -10,9 +10,12 @@ package eu.etaxonomy.taxeditor.ui.element; import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.forms.widgets.TableWrapLayout; +import org.joda.time.IllegalFieldValueException; import org.joda.time.Partial; import eu.etaxonomy.cdm.model.common.TimePeriod; @@ -22,7 +25,6 @@ import eu.etaxonomy.cdm.model.common.TimePeriod; * * @author n.hoffmann * @created Mar 31, 2010 - * @version 1.0 */ public class PartialElement extends AbstractCdmFormElement implements ISelectable { @@ -52,7 +54,7 @@ public class PartialElement extends AbstractCdmFormElement implements ISelectabl addControl(label); number_year = formFactory.createNumberTextWithLabelElement(this, "Year", null, style); - number_year.setLimits(4, -9999, 9999); + number_year.setLimits(4, 0, 9999); number_month = formFactory.createNumberTextWithLabelElement(this, "Month", null, style); number_month.setLimits(2, 1, 12); @@ -88,9 +90,6 @@ public class PartialElement extends AbstractCdmFormElement implements ISelectabl return partial; } - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ /** {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent event) { @@ -119,30 +118,20 @@ public class PartialElement extends AbstractCdmFormElement implements ISelectabl } private void handleEvent(Object eventSource){ - if(eventSource == number_month){ - if (number_month.getInteger() == 0){ - partial = TimePeriod.setPartialField(partial, null, TimePeriod.MONTH_TYPE); - } else{ - partial = TimePeriod.setPartialField(partial, number_month.getInteger(), TimePeriod.MONTH_TYPE); - } - - }else if(eventSource == number_day){ - if (number_day.getInteger() == 0){ - partial = TimePeriod.setPartialField(partial, null, TimePeriod.DAY_TYPE); - } else{ - partial = TimePeriod.setPartialField(partial, number_day.getInteger(), TimePeriod.DAY_TYPE); - } - - - }else if(eventSource == number_year){ - if (number_year.getInteger() == 0){ - partial = TimePeriod.setPartialField(partial, null, TimePeriod.YEAR_TYPE); - } else{ - partial = TimePeriod.setPartialField(partial, number_year.getInteger(), TimePeriod.YEAR_TYPE); + if (eventSource instanceof NumberWithLabelElement){ + try{ + if(eventSource == number_month && number_month.getException()==null){ + partial = TimePeriod.setPartialField(partial, number_month.getInteger(), TimePeriod.MONTH_TYPE); + }else if(eventSource == number_day && number_day.getException()==null){ + partial = TimePeriod.setPartialField(partial, number_day.getInteger(), TimePeriod.DAY_TYPE); + }else if(eventSource == number_year && number_year.getException()==null){ + partial = TimePeriod.setPartialField(partial, number_year.getInteger(), TimePeriod.YEAR_TYPE); + } + } catch (IndexOutOfBoundsException | IllegalFieldValueException e) { + ((NumberWithLabelElement)eventSource).text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); } - - } - firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null)); + } + firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null)); } /** {@inheritDoc} */ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PointElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PointElement.java index b1cff1ad3..a2c97edb1 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PointElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PointElement.java @@ -27,7 +27,6 @@ import eu.etaxonomy.taxeditor.ui.combo.TermComboElement; * * @author n.hoffmann * @created Oct 15, 2010 - * @version 1.0 */ public class PointElement extends AbstractCdmFormElement implements IEntityElement, ISelectable { @@ -151,11 +150,6 @@ public class PointElement extends AbstractCdmFormElement implements } } - /* - * (non-Javadoc) - * - * @see eu.etaxonomy.taxeditor.forms.IEntityElement#getEntity() - */ /** {@inheritDoc} */ @Override public Point getEntity() { diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/UriWithLabelElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/UriWithLabelElement.java index 01deec47f..284539b3a 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/UriWithLabelElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/UriWithLabelElement.java @@ -22,7 +22,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.model.ImageResources; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/EditPasswordElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/EditPasswordElement.java index 8234ee283..c26c70959 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/EditPasswordElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/EditPasswordElement.java @@ -21,7 +21,7 @@ import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.api.service.IUserService; import eu.etaxonomy.cdm.model.common.User; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizard.java index 975aff4c8..09289d8c6 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizard.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizard.java @@ -19,7 +19,7 @@ import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.api.service.IUserService; import eu.etaxonomy.cdm.model.common.User; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; @@ -71,6 +71,7 @@ public class PasswordWizard extends Wizard implements IConversationEnabled{ CdmStore.getService(IUserService.class).changePasswordForUser(user.getUsername(), passwordPage.getNewPassword()); } CdmStore.getService(IUserService.class).loadWithUpdate(user.getUuid()); + CdmStore.getLoginManager().authenticate(user.getUsername(), passwordPage.getNewPassword()); internalConversation.commit(false); internalConversation.unbind(); internalConversation.close(); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizardPage.java index 7c1e44fe5..c2daa7f40 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizardPage.java @@ -19,7 +19,7 @@ import org.eclipse.swt.widgets.Text; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.common.User; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java index c700e7d26..b59358293 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java @@ -126,6 +126,7 @@ public abstract class AbstractCdmDetailSection extends AbstractFormSecti super.setEntity(entity); setSectionTitle(); layout(); + } protected void setSectionTitle() { @@ -137,7 +138,7 @@ public abstract class AbstractCdmDetailSection extends AbstractFormSecti if (label == null){ label = ((DefinedTermBase)getEntity()).getLabel(); } - + } else if (getEntity() instanceof TextData){ label = ((TextData)getEntity()).getLanguageText(PreferencesUtil.getGlobalLanguage()).getText(); if (label == null){ @@ -147,7 +148,7 @@ public abstract class AbstractCdmDetailSection extends AbstractFormSecti label =((IdentifiableEntity) getEntity()).getTitleCache(); } title = ": " + label; - + // we have to duplicate ampersands otherwise they are treated as // mnenomic (see Label.setText() documentation) // see also #4302 @@ -173,6 +174,7 @@ public abstract class AbstractCdmDetailSection extends AbstractFormSecti @Override public void setIrrelevant(boolean irrelevant) { if (detailElement != null) { + detailElement.setIrrelevant(irrelevant); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ModifierElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ModifierElement.java index be5f37828..cc6b3f4aa 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ModifierElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ModifierElement.java @@ -74,7 +74,7 @@ public class ModifierElement extends AbstractEntityCollectionElement0){ + if(entity!=null && entity.getId()>0){ combo_modifier.setSelection(entity); combo_modifier.removeEmptyElement(); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ModifierSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ModifierSection.java index b4ad1c9bb..ec09e802c 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ModifierSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ModifierSection.java @@ -13,7 +13,6 @@ import java.util.Collection; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.common.DefinedTerm; -import eu.etaxonomy.cdm.model.common.TermType; import eu.etaxonomy.cdm.model.description.IModifiable; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; @@ -45,7 +44,7 @@ public class ModifierSection extends AbstractUnboundEntityCollectionSection { @Override public void setEntity(DefinedTerm entity) { this.entity = entity; - if(entity.getId()!=0){ + if(entity!=null && entity.getId()!=0){ combo_scope.setSelection(entity); combo_scope.removeEmptyElement(); } @@ -74,6 +75,13 @@ public class ScopeElement extends AbstractEntityCollectionElement { key.addScopeRestriction(scopeTerm); entity = scopeTerm; } + else if(getParentElement() instanceof ScopeSection){ + TaxonDescription description = ((ScopeSection)getParentElement()).getEntity(); + description.removeScope(entity); + description.addScope(scopeTerm); + entity = scopeTerm; + + } } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ScopeSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ScopeSection.java index 566f76a2d..6aae3f43b 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ScopeSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ScopeSection.java @@ -13,7 +13,6 @@ import java.util.Collection; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.common.DefinedTerm; -import eu.etaxonomy.cdm.model.common.TermType; import eu.etaxonomy.cdm.model.description.TaxonDescription; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; @@ -49,7 +48,7 @@ public class ScopeSection extends AbstractUnboundEntityCollectionSection { Reference citation1 = o1.getCitation(); Reference citation2 = o2.getCitation(); + int result = 0; + // the newly created should always be on top - if (id1 == 0 && id2!=0) { - return -1; - } - else if (id2==0) { - return 1; + if (id1 == 0){ + if(id2!=0) { + result = -1; + } + else{ + result = 0; + } + } else if(id2==0){ + result = 1; } // sort by type (Primary taxonomic > Primary Media > others // alphabetically by reference title cache) - if (type1 != null && type1.equals(OriginalSourceType.PrimaryTaxonomicSource) - && (type2 == null || !type2.equals(OriginalSourceType.PrimaryTaxonomicSource))) { - return -1; - } - if ((type1 == null || !type1.equals(OriginalSourceType.PrimaryTaxonomicSource)) - && type2 != null && type2.equals(OriginalSourceType.PrimaryTaxonomicSource)) { - return 1; + else if (type1 == null){ + if(type2==null){ + result = 0; + } + else{ + result = 1; + } + } else if (type2 == null){ + result = -1; + } else if(type1.equals(type2)){ + result = 0; + } else if (type1.equals(OriginalSourceType.PrimaryTaxonomicSource)){ + result = -1; + } else if (type2.equals(OriginalSourceType.PrimaryTaxonomicSource)){ + result = 1; + } else if (type1.equals(OriginalSourceType.PrimaryMediaSource)){ + result = -1; + } else if (type2.equals(OriginalSourceType.PrimaryMediaSource)){ + result = 1; } - if ((type1 == null || type1.equals(OriginalSourceType.PrimaryMediaSource)) - && (type2==null || !type2.equals(OriginalSourceType.PrimaryMediaSource))) { - return -1; - } - if (type2 != null && type2.equals(OriginalSourceType.PrimaryMediaSource) - && type1!=null && !type1.equals(OriginalSourceType.PrimaryMediaSource)) { - return 1; - } - - //sort by citation title cache - if(citation1!=null && citation2!=null){ - return citation1.getTitleCache().compareTo(citation2.getTitleCache()); - } + //sort by citation title cache if types are equal + if (result == 0){ + if(citation1!=null && citation2!=null){ + result = citation1.getTitleCache().compareTo(citation2.getTitleCache()); + } - if(o2.getCreated()!=null && o1.getCreated()!=null){ - return o2.getCreated().compareTo(o1.getCreated()); + if(o2.getCreated()!=null && o1.getCreated()!=null){ + result = o2.getCreated().compareTo(o1.getCreated()); + } + if (result == 0){ + //default fallback + return o1.getId() - o2.getId(); + } } + return result; - //default fallback - return o1.getId() - o2.getId(); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/grantedAuthority/GrantedAuthorityCollectionElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/grantedAuthority/GrantedAuthorityCollectionElement.java index fb250dba3..f40a6403d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/grantedAuthority/GrantedAuthorityCollectionElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/grantedAuthority/GrantedAuthorityCollectionElement.java @@ -1,8 +1,8 @@ /** * Copyright (C) 2012 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. */ @@ -12,6 +12,7 @@ package eu.etaxonomy.taxeditor.ui.section.grantedAuthority; import org.eclipse.swt.events.SelectionListener; import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl; +import eu.etaxonomy.cdm.model.common.Group; import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; @@ -24,14 +25,16 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; * */ public class GrantedAuthorityCollectionElement extends AbstractEntityCollectionElement { - + private EntitySelectionElement selection_authority; + private Group grantedAuthorityUser; public GrantedAuthorityCollectionElement(CdmFormFactory formFactory, - AbstractFormSection section, GrantedAuthorityImpl entity, + AbstractFormSection section, GrantedAuthorityImpl entity, Group group, SelectionListener removeListener, int style) { - super(formFactory, section, entity, removeListener, null, style); + super(formFactory, section, entity, removeListener, null, style); + this.grantedAuthorityUser = group; // TODO Auto-generated constructor stub } @@ -40,8 +43,8 @@ public class GrantedAuthorityCollectionElement extends AbstractEntityCollectionE */ @Override public void setEntity(GrantedAuthorityImpl entity) { - selection_authority.setEntity(entity); - + this.entity = entity; + } /* (non-Javadoc) @@ -59,7 +62,12 @@ public class GrantedAuthorityCollectionElement extends AbstractEntityCollectionE @Override public void handleEvent(Object eventSource) { if (eventSource == selection_authority) { + GrantedAuthorityImpl oldGrantedAuthority = entity; + grantedAuthorityUser.removeGrantedAuthority(entity); + setEntity(selection_authority.getEntity()); + grantedAuthorityUser.addGrantedAuthority(entity); + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/grantedAuthority/GrantedAuthorityDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/grantedAuthority/GrantedAuthorityDetailElement.java index 75a70728e..ab5a27897 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/grantedAuthority/GrantedAuthorityDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/grantedAuthority/GrantedAuthorityDetailElement.java @@ -1,8 +1,8 @@ /** * 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. */ @@ -10,7 +10,6 @@ package eu.etaxonomy.taxeditor.ui.section.grantedAuthority; import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl; -import eu.etaxonomy.cdm.persistence.hibernate.permission.CdmAuthority; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement; @@ -25,7 +24,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; public class GrantedAuthorityDetailElement extends AbstractCdmDetailElement { private TextWithLabelElement text_authority; - + /** * @param formFactory * @param formElement @@ -38,10 +37,13 @@ public class GrantedAuthorityDetailElement extends AbstractCdmDetailElement except){ + if (toggleable_cache != null){ + if (toggleable_cache.getState() == irrelevant){ + super.setIrrelevant(irrelevant, except); + } + if (except == null || except.isEmpty()){ + toggleable_cache.setIrrelevant(irrelevant); + } + } + + } + diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NomenclaturalStatusElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NomenclaturalStatusElement.java index 67b59f9cf..788f37ddf 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NomenclaturalStatusElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NomenclaturalStatusElement.java @@ -50,7 +50,7 @@ public class NomenclaturalStatusElement extends AbstractReferencedEntityElement< @Override public void createControls(ICdmFormElement element, int style) { TermVocabulary vocabulary = CdmStore.getService(IVocabularyService.class).find(VocabularyEnum.NomenclaturalStatusType.getUuid()); - nomenclaturalStatusTypeCombo = formFactory.createDefinedTermComboElement(vocabulary, this, "Nomenclatural Status Type", null,style); + nomenclaturalStatusTypeCombo = formFactory.createDefinedTermComboElement(vocabulary, this, "Nomenclatural Status Type", null,false, style, true); ruleConsideredText = formFactory.createTextWithLabelElement(this, "Rule Considered", "", style); super.createControls(element, style); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java index f9e00aa1f..500f683c5 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java @@ -58,24 +58,15 @@ public class NonViralNameDetailElement extends combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style); combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode()); textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style); - //TODO RL - if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){ - toggleable_cache.setVisible(false); - combo_nomenclaturalCode.setVisible(false); - } + }else{ if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE)){ toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style); - if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){ - toggleable_cache.setVisible(false); - } - } + + } if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE)){ combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style); combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode()); - if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){ - combo_nomenclaturalCode.setVisible(false); - } } if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID)){ textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style); @@ -98,12 +89,11 @@ public class NonViralNameDetailElement extends } //TODO RL if (isAdvancedView || PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID)){ - if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){ - section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE); - section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); - addControl(section_hybrid); - addElement(section_hybrid); - } + section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE); + section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); + addControl(section_hybrid); + addElement(section_hybrid); + } @@ -113,16 +103,15 @@ public class NonViralNameDetailElement extends @Override protected void updateContent() { super.updateContent(); - // disable nomenclatural code, because changing of nom.code is not // implemented on library side if(combo_nomenclaturalCode!=null){ combo_nomenclaturalCode.setEnabled(false); } - + toggleable_cache.setEnabled(getEntity().isProtectedTitleCache() || getEntity().isProtectedFullTitleCache()); if(toggleable_cache!=null){ setIrrelevant(toggleable_cache.getState(), - Arrays.asList(new Object[] { toggleable_cache })); + Arrays.asList(new Object[] { toggleable_cache, textLsid })); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailSection.java index 250b4b608..ece23c212 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailSection.java @@ -23,8 +23,6 @@ import eu.etaxonomy.cdm.model.name.TaxonNameBase; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.taxeditor.model.ImageResources; import eu.etaxonomy.taxeditor.model.MessagingUtils; -import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; -import eu.etaxonomy.taxeditor.preference.PreferencesUtil; import eu.etaxonomy.taxeditor.ui.dialog.selection.NameSelectionDialog; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent; @@ -64,7 +62,7 @@ public class NonViralNameDetailSection extends AbstractCdmDetailSectionexcept for PrimaryTaxonomicSource resp. - * PrimaryMediaSource which are alway on top depending on the IdentifiableSource; + * PrimaryMediaSource which are always on top depending on the IdentifiableSource; + *
+ * The last two are always "Other" followed by "Unknown" * @author pplitzner * @date Jan 6, 2017 * @@ -82,49 +84,63 @@ public abstract class AbstractOriginalSourceElement comparator; /* (non-Javadoc) @@ -63,7 +53,7 @@ public class SaveImportedSpecimenAction extends Action { Set unitIdsGbif = new HashSet(); Set unitIdsBioCase = new HashSet(); List biocaseResponses = new ArrayList(); - + for(TableItem item:table.getItems()){ if(item.getChecked()){ //Save Specimen @@ -77,21 +67,21 @@ public class SaveImportedSpecimenAction extends Action { for (GbifResponse response:checkedResults){ if (response != null){ tripleId = response.getTripleID(); - + if (response.getDataSetProtocol().equals(GbifDataSetProtocol.BIOCASE)){ biocaseResponses.add(response); - + }else{ unitIdsGbif.add(tripleId); } - - + + } } - Collections.sort(biocaseResponses, getComparator()); + Collections.sort(biocaseResponses, getComparator()); URI dataSetUri = null; Abcd206ImportConfigurator configuratorAbcd; - + List abcdConfigurators = new ArrayList(); DataSetResponse dataSetResponse; OccurenceQuery bioCaseOccurrenceQuery = null; @@ -109,6 +99,8 @@ public class SaveImportedSpecimenAction extends Action { if (!response.getDataSetUri().equals(dataSetUri)){ configuratorAbcd = Abcd206ImportConfigurator.NewInstance(dataSetUri, null, false); configuratorAbcd.addMediaAsMediaSpecimen(true); + configuratorAbcd.setIgnoreAuthorship(true); + configuratorAbcd.setMoveNewTaxaToDefaultClassification(false); if (configuratorAbcd != null){ abcdConfigurators.add(configuratorAbcd); } @@ -118,32 +110,32 @@ public class SaveImportedSpecimenAction extends Action { if (dataImportView.getClassification() != null){ configuratorAbcd.setClassificationUuid(dataImportView.getClassification().getUuid()); } - + } tripleId = response.getTripleID(); unitIdsBioCase.add(tripleId); } - + OccurenceQuery query = new OccurenceQuery(unitIdsGbif); GbifImportConfigurator configurator = GbifImportConfigurator.newInstance(query); configurator.setSourceReferenceTitle("Import Gbif data"); - - - + + + // configurator.setQuery(query); - + Job bioCaseJob = CdmStore.getImportManager().createIOServiceJob(abcdConfigurators); CdmStore.getImportManager().run(bioCaseJob); - + Job gbifJob = CdmStore.getImportManager().createIOServiceJob(configurator); CdmStore.getImportManager().run(gbifJob); - - - + + + } } - - + + private void persistTerm(DefinedTermBase term, ITermService termService, ConversationHolder conversation){ if(term!=null){ //if the term does not exist in the DB save it @@ -152,7 +144,7 @@ public class SaveImportedSpecimenAction extends Action { } } } - + /* (non-Javadoc) * @see org.eclipse.jface.action.Action#getText() */ @@ -160,13 +152,13 @@ public class SaveImportedSpecimenAction extends Action { public String getText() { return "Import"; } - + private Comparator getComparator(){ if (comparator == null){ comparator = new GbifResponseComparator(); } return comparator; } - - + + } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenImportView.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenImportView.java index dfdb2d294..d5de5208c 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenImportView.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenImportView.java @@ -15,21 +15,24 @@ import java.util.ArrayList; import java.util.Collection; import org.apache.http.client.ClientProtocolException; -import org.eclipse.core.runtime.jobs.Job; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; import eu.etaxonomy.cdm.ext.occurrence.bioCase.BioCaseQueryServiceWrapper; -import eu.etaxonomy.cdm.io.common.CdmDefaultImport; -import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE; +import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206DataHolder; import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator; -import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; -import eu.etaxonomy.taxeditor.store.CdmStore; +import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportParser; +import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportState; +import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206XMLFieldGetter; +import eu.etaxonomy.cdm.io.specimen.abcd206.in.AbcdParseUtility; +import eu.etaxonomy.cdm.io.specimen.abcd206.in.UnitAssociationWrapper; /** * @author pplitzner * @date Sep 3, 2014 * */ -public class SpecimenImportView extends DataImportView> { +public class SpecimenImportView extends DataImportView { public static final String ID = "eu.etaxonomy.taxeditor.view.dataimport.SpecimenImportView"; //$NON-NLS-1$ @@ -49,8 +52,9 @@ public class SpecimenImportView extends DataImportView item) { - return item.getTitleCache(); + protected String getTextForTableItem(Abcd206DataHolder item) { + //TODO: define a suitable toString method + return item.toString(); } /* (non-Javadoc) @@ -60,21 +64,38 @@ public class SpecimenImportView extends DataImportView> results = new ArrayList>(); + Collection results = new ArrayList(); try { //FIXME move ABCD import to cdmlib -> this will also get rid of the transient services InputStream resultStream; resultStream = new BioCaseQueryServiceWrapper().query(query, endPoint); Abcd206ImportConfigurator configurator = Abcd206ImportConfigurator.NewInstance(null, null); -// TransientCdmRepository repo = + configurator.setSourceUri(endPoint); + + // TransientCdmRepository repo = // new TransientCdmRepository(CdmStore.getCurrentApplicationConfiguration()); //configurator.setCdmAppController(repo); + + //TODO: do not query all data but with the selected triple IDs -> see GbifResponseImportView configurator.setAddMediaAsMediaSpecimen(true); configurator.setAllowReuseOtherClassifications(true); - - Job job = CdmStore.getImportManager().createIOServiceJob(configurator, resultStream, SOURCE_TYPE.INPUTSTREAM); - CdmStore.getImportManager().run(job); - + configurator.setMoveNewTaxaToDefaultClassification(false); + UnitAssociationWrapper unitAssociationWrapper = AbcdParseUtility.parseUnitsNodeList(resultStream, null); + NodeList unitsList = unitAssociationWrapper.getAssociatedUnits(); + Abcd206DataHolder dataHolder = new Abcd206DataHolder(); + Abcd206XMLFieldGetter abcdFieldGetter = new Abcd206XMLFieldGetter(dataHolder, unitAssociationWrapper.getPrefix()); + Abcd206ImportState state = new Abcd206ImportState(configurator); + state.setDataHolder(dataHolder); + for (int i = 0; i use collection name then + FormatKey collectionKey = FormatKey.COLLECTION_CODE; + text = CdmFormatterFactory.format(element,new FormatKey[]{FormatKey.COLLECTION_CODE}); + if(CdmUtils.isBlank(text)){ + collectionKey = FormatKey.COLLECTION_NAME; + } + + //Use titlecache for FieldUnits + if(element instanceof FieldUnit){ + return ((FieldUnit) element).getTitleCache(); + } + else if(element instanceof MediaSpecimen){ + text = CdmFormatterFactory.format(element, + new FormatKey[]{ + FormatKey.MEDIA_TITLE_CACHE, FormatKey.SPACE, + collectionKey, FormatKey.SPACE, + FormatKey.MOST_SIGNIFICANT_IDENTIFIER, FormatKey.SPACE, + FormatKey.MEDIA_TITLE, FormatKey.SPACE, + FormatKey.MEDIA_ARTIST, FormatKey.SPACE, + }); + } + else if (element instanceof DnaSample) { + text = CdmFormatterFactory.format(element, + new FormatKey[] { + collectionKey, FormatKey.SPACE, + FormatKey.MOST_SIGNIFICANT_IDENTIFIER, FormatKey.SPACE, + FormatKey.SAMPLE_DESIGNATION, FormatKey.SPACE + }); + } + else if (element instanceof DerivedUnit) { + text = CdmFormatterFactory.format(element, + new FormatKey[] { + collectionKey, FormatKey.SPACE, + FormatKey.MOST_SIGNIFICANT_IDENTIFIER, FormatKey.SPACE + }); + } + else if (element instanceof Sequence) { + text = CdmFormatterFactory.format(element, + new FormatKey[] { + FormatKey.SEQUENCE_DNA_MARKER, FormatKey.SPACE + }); + } + else if (element instanceof SingleRead) { + text = CdmFormatterFactory.format(element, + new FormatKey[] { + FormatKey.SINGLE_READ_PHEROGRAM_TITLE_CACHE, FormatKey.SPACE, + FormatKey.AMPLIFICATION_LABEL, FormatKey.SPACE, + }); + } + else if(element instanceof IdentifiableEntity){ IdentifiableEntity identifiableEntity = (IdentifiableEntity) element; if(identifiableEntity.isProtectedTitleCache()){ text = identifiableEntity.getTitleCache(); } } - if(CdmUtils.isBlank(text)){ - return "[-]"; + if(CdmUtils.isBlank(text) || text.equals(IdentifiableEntityDefaultCacheStrategy.TITLE_CACHE_GENERATION_NOT_IMPLEMENTED)){ + if(element instanceof CdmBase){ + text = ((CdmBase) element).getUuid().toString(); + } + else{ + text = element.toString(); + } } return text; } @@ -262,7 +302,7 @@ public class DerivateLabelProvider extends ColumnLabelProvider { if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){ //check for type designation if(typeDesignations.get(derivedUnit)==null){ - for (SpecimenTypeDesignation specimenTypeDesignation : CdmStore.getService(IOccurrenceService.class).listTypeDesignations(derivedUnit, null, null, null, null)) { + for (SpecimenTypeDesignation specimenTypeDesignation : derivedUnit.getSpecimenTypeDesignations()) { addTypeDesignation(derivedUnit, specimenTypeDesignation); } } @@ -460,7 +500,11 @@ public class DerivateLabelProvider extends ColumnLabelProvider { derivedUnits.add(HibernateProxyHelper.deproxy(specimenOrObservationBase, DerivedUnit.class)); } } - typeDesignations = CdmStore.getService(IOccurrenceService.class).listTypeDesignations(derivedUnits, null, null, null, null); + for (DerivedUnit derivedUnit : derivedUnits) { + if(!derivedUnit.getSpecimenTypeDesignations().isEmpty()){ + typeDesignations.put(derivedUnit, derivedUnit.getSpecimenTypeDesignations()); + } + } } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java index 7cc6f3156..0af479c61 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java @@ -24,7 +24,7 @@ import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; import eu.etaxonomy.cdm.model.common.CdmBase; import eu.etaxonomy.cdm.model.description.Feature; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; import eu.etaxonomy.taxeditor.model.IContextListener; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java index 7d778492d..05e4199ba 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java @@ -128,7 +128,7 @@ import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart; public class DetailsViewer extends AbstractCdmDataViewer { private ISelection selection; - + public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) { super(parent, viewPart); } @@ -372,7 +372,7 @@ public class DetailsViewer extends AbstractCdmDataViewer { TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - + addPart(taxonBaseDetailSection); } } @@ -380,12 +380,12 @@ public class DetailsViewer extends AbstractCdmDataViewer { .createNonViralNameDetailSection(getConversationHolder(), parent, this, true, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE))){ + if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE))){ NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(referenceDetailSection); - + } if ( !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS))){ NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, @@ -393,25 +393,25 @@ public class DetailsViewer extends AbstractCdmDataViewer { formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(nomenclaturalStatusSection); } - if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL) ){ - if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE))){ - ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - addPart(protologSection); - } - - if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION))){ - TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - addPart(typeDesignationSection); - } - - if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP))){ - NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - addPart(nameRelationshipSection); - } - } + + if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE))){ + ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + addPart(protologSection); + } + + if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION))){ + TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + addPart(typeDesignationSection); + } + + if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP))){ + NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + addPart(nameRelationshipSection); + } + addPart(parsingMessagesSection); @@ -437,20 +437,19 @@ public class DetailsViewer extends AbstractCdmDataViewer { addPart(nonViralNameSection); addPart(nomenclaturalStatusSection); addPart(referenceDetailSection); -//TODO RL - if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){ - ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); - formFactory.createHorizontalSeparator(parent, SWT.BORDER); + ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + + TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + + NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + addPart(protologSection); + addPart(typeDesignationSection); + addPart(nameRelationshipSection); - NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - addPart(protologSection); - addPart(typeDesignationSection); - addPart(nameRelationshipSection); - } } private void createReferenceSections(RootElement parent) { @@ -793,7 +792,7 @@ public class DetailsViewer extends AbstractCdmDataViewer { @Override public void update(CdmDataChangeMap arg0) { - + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java index dfd2e4fde..8b9af2d3c 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java @@ -21,7 +21,7 @@ import org.eclipse.ui.part.EditorPart; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse; import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; -import eu.etaxonomy.taxeditor.Messages; +import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; diff --git a/eu.etaxonomy.taxeditor.store/src/test/java/eu/etaxonomy/taxeditor/store/NameProtectTitleCacheTest.java b/eu.etaxonomy.taxeditor.store/src/test/java/eu/etaxonomy/taxeditor/store/NameProtectTitleCacheTest.java index a2a71bc3d..02483eb92 100644 --- a/eu.etaxonomy.taxeditor.store/src/test/java/eu/etaxonomy/taxeditor/store/NameProtectTitleCacheTest.java +++ b/eu.etaxonomy.taxeditor.store/src/test/java/eu/etaxonomy/taxeditor/store/NameProtectTitleCacheTest.java @@ -18,6 +18,8 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.common.DefaultTermInitializer; import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.cdm.model.name.Rank; +import eu.etaxonomy.cdm.model.name.TaxonNameBase; +import eu.etaxonomy.cdm.model.name.TaxonNameFactory; /** * @author n.hoffmann @@ -45,7 +47,7 @@ public class NameProtectTitleCacheTest /*extends CdmIntegrationTest */{ (new DefaultTermInitializer()).initialize(); - name = NonViralName.NewInstance(Rank.SPECIES()); + name = TaxonNameFactory.NewNonViralInstance(Rank.SPECIES()); name.setGenusOrUninomial("Joe"); name.setSpecificEpithet("mama"); diff --git a/eu.etaxonomy.taxeditor.test/.classpath b/eu.etaxonomy.taxeditor.test/.classpath index cc0f994d1..caf33c4f7 100644 --- a/eu.etaxonomy.taxeditor.test/.classpath +++ b/eu.etaxonomy.taxeditor.test/.classpath @@ -1,6 +1,6 @@ - + diff --git a/eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF index b9753f4dc..237d43f79 100644 --- a/eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF +++ b/eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: eu.etaxonomy.taxeditor.test Bundle-SymbolicName: eu.etaxonomy.taxeditor.test;singleton:=true -Bundle-Version: 4.4.0.qualifier +Bundle-Version: 4.6.0 Bundle-ActivationPolicy: lazy Bundle-Vendor: EDIT Bundle-RequiredExecutionEnvironment: JavaSE-1.7 @@ -21,8 +21,7 @@ Require-Bundle: org.eclipse.ui, org.apache.log4j, org.hamcrest, org.eclipse.swtbot.eclipse.core, - org.eclipse.swtbot.eclipse.finder, - eu.etaxonomy.taxeditor.webapp;bundle-version="3.13.0" + org.eclipse.swtbot.eclipse.finder Eclipse-RegisterBuddy: org.apache.log4j, org.eclipse.swtbot.swt.finder Bundle-ClassPath: ., lib/byte-buddy-0.5.1.jar, diff --git a/eu.etaxonomy.taxeditor.test/pom.xml b/eu.etaxonomy.taxeditor.test/pom.xml index 19f896ffd..5119078fc 100644 --- a/eu.etaxonomy.taxeditor.test/pom.xml +++ b/eu.etaxonomy.taxeditor.test/pom.xml @@ -3,7 +3,7 @@ eu.etaxonomy taxeditor-parent - 4.4.0-SNAPSHOT + 4.6.0 eu.etaxonomy.taxeditor.test eclipse-test-plugin @@ -48,37 +48,27 @@ + + + + eclipse-feature + eu.etaxonomy.taxeditor.feature + 1.0.0 + + + org.eclipse.tycho tycho-surefire-plugin ${tycho.version} - - - - - - - eclipse-feature - eu.etaxonomy.taxeditor.feature - - 1.0.0 - - - + org.eclipse.jetty jetty-maven-plugin - 9.1.3.v20140225 - + 9.4.1.v20170120 true diff --git a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.java b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.java index 2d9918026..5ccc11410 100644 --- a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.java +++ b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.java @@ -30,6 +30,7 @@ import eu.etaxonomy.cdm.model.common.CdmBase; import eu.etaxonomy.cdm.model.name.BotanicalName; import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.cdm.model.name.TaxonNameBase; +import eu.etaxonomy.cdm.model.name.TaxonNameFactory; import eu.etaxonomy.cdm.model.taxon.Classification; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonNode; @@ -140,7 +141,7 @@ public class AbstractLazyInitializerTest extends BaseRemotingTest { public void testCDMEntitySaveLazyNew() { Team combAuthor = Team.NewInstance(); combAuthor.addTeamMember(Person.NewTitledInstance("test member")); - BotanicalName name = BotanicalName.NewInstance(null, "Test1", null, null, null, null, null, null, null); + BotanicalName name = TaxonNameFactory.NewBotanicalInstance(null, "Test1", null, null, null, null, null, null, null); name.setCombinationAuthorship(combAuthor); Taxon tax1 = Taxon.NewInstance(name, null); UUID taxonUuid1 = taxonService.save(tax1).getUuid(); diff --git a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemoteLazyLoadingTest.java b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemoteLazyLoadingTest.java index 92cb68c50..9e3693d15 100644 --- a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemoteLazyLoadingTest.java +++ b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemoteLazyLoadingTest.java @@ -30,6 +30,7 @@ import eu.etaxonomy.cdm.model.common.CdmBase; import eu.etaxonomy.cdm.model.name.BotanicalName; import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.cdm.model.name.TaxonNameBase; +import eu.etaxonomy.cdm.model.name.TaxonNameFactory; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; @@ -140,7 +141,7 @@ public class RemoteLazyLoadingTest extends BaseRemotingTest { Team combAuthor = Team.NewInstance(); combAuthor.addTeamMember(Person.NewTitledInstance("test member")); - BotanicalName name = BotanicalName.NewInstance(null, "Test1", null, null, null, null, null, null, null); + BotanicalName name = TaxonNameFactory.NewBotanicalInstance(null, "Test1", null, null, null, null, null, null, null); name.setCombinationAuthorship(combAuthor); Taxon taxon = Taxon.NewInstance(name, null); UUID taxonUuid = taxonService.save(taxon).getUuid(); @@ -202,7 +203,7 @@ public class RemoteLazyLoadingTest extends BaseRemotingTest { public void testCDMEntitySaveLazyNew() { Team combAuthor = Team.NewInstance(); combAuthor.addTeamMember(Person.NewTitledInstance("test member")); - BotanicalName name = BotanicalName.NewInstance(null, "Test1", null, null, null, null, null, null, null); + BotanicalName name = TaxonNameFactory.NewBotanicalInstance(null, "Test1", null, null, null, null, null, null, null); name.setCombinationAuthorship(combAuthor); Taxon tax1 = Taxon.NewInstance(name, null); UUID taxonUuid1 = taxonService.save(tax1).getUuid(); diff --git a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operation/TaxonNameEditorTest.java b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operation/TaxonNameEditorTest.java index cee619830..6d857439c 100644 --- a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operation/TaxonNameEditorTest.java +++ b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operation/TaxonNameEditorTest.java @@ -34,6 +34,7 @@ import eu.etaxonomy.cdm.model.name.BotanicalName; import eu.etaxonomy.cdm.model.name.HomotypicalGroup; import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.cdm.model.name.TaxonNameBase; +import eu.etaxonomy.cdm.model.name.TaxonNameFactory; import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonNode; @@ -65,7 +66,7 @@ public class TaxonNameEditorTest extends BaseOperationTest { TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid); Taxon taxon = taxonNode.getTaxon(); HomotypicalGroup group = taxon.getHomotypicGroup(); - BotanicalName newSynonymName = BotanicalName.NewInstance(null); + BotanicalName newSynonymName = TaxonNameFactory.NewBotanicalInstance(null); newSynonymName.setTitleCache("New Synonym", true); operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group", undoContext, taxon, group, newSynonymName, postOperation); @@ -86,7 +87,7 @@ public class TaxonNameEditorTest extends BaseOperationTest { TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid); Taxon taxon = taxonNode.getTaxon(); HomotypicalGroup group = taxon.getHomotypicGroup(); - BotanicalName newSynonymName = BotanicalName.NewInstance(null); + BotanicalName newSynonymName = TaxonNameFactory.NewBotanicalInstance(null); newSynonymName.setTitleCache("New Synonym", true); operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group", undoContext, taxon, group, newSynonymName, postOperation); @@ -104,7 +105,7 @@ public class TaxonNameEditorTest extends BaseOperationTest { TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid); Taxon taxon = taxonNode.getTaxon(); HomotypicalGroup group = taxon.getHomotypicGroup(); - BotanicalName newSynonymName = BotanicalName.NewInstance(null); + BotanicalName newSynonymName = TaxonNameFactory.NewBotanicalInstance(null); newSynonymName.setTitleCache("New Synonym", true); operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group", undoContext, taxon, group, newSynonymName, postOperation); @@ -120,7 +121,7 @@ public class TaxonNameEditorTest extends BaseOperationTest { taxonNodeService.merge(taxonNode); - newSynonymName = BotanicalName.NewInstance(null); + newSynonymName = TaxonNameFactory.NewBotanicalInstance(null); newSynonymName.setTitleCache("Another New Synonym", true); operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group", undoContext, taxon, group, newSynonymName, postOperation); @@ -152,7 +153,7 @@ public class TaxonNameEditorTest extends BaseOperationTest { @Test public void addTaxon() { - NonViralName taxonName = NonViralName.NewInstance(null); + NonViralName taxonName = TaxonNameFactory.NewNonViralInstance(null); Taxon taxon = Taxon.NewInstance(taxonName, null); taxonService.merge(taxon); } diff --git a/eu.etaxonomy.taxeditor.test/src/test/resources/eu/etaxonomy/cdm/testRemotingApplicationContext.xml b/eu.etaxonomy.taxeditor.test/src/test/resources/eu/etaxonomy/cdm/testRemotingApplicationContext.xml index dda9952c1..11b95b238 100644 --- a/eu.etaxonomy.taxeditor.test/src/test/resources/eu/etaxonomy/cdm/testRemotingApplicationContext.xml +++ b/eu.etaxonomy.taxeditor.test/src/test/resources/eu/etaxonomy/cdm/testRemotingApplicationContext.xml @@ -10,6 +10,6 @@ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> - + diff --git a/eu.etaxonomy.taxeditor.webapp/.classpath b/eu.etaxonomy.taxeditor.webapp/.classpath index 03d1c3ee4..45b677bee 100644 --- a/eu.etaxonomy.taxeditor.webapp/.classpath +++ b/eu.etaxonomy.taxeditor.webapp/.classpath @@ -9,7 +9,7 @@ - + diff --git a/eu.etaxonomy.taxeditor.webapp/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.webapp/META-INF/MANIFEST.MF index 17ef63265..64b93bcf7 100644 --- a/eu.etaxonomy.taxeditor.webapp/META-INF/MANIFEST.MF +++ b/eu.etaxonomy.taxeditor.webapp/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Webapp Bundle-SymbolicName: eu.etaxonomy.taxeditor.webapp;singleton:=true -Bundle-Version: 4.5.1 +Bundle-Version: 4.6.0 Require-Bundle: org.eclipse.core.runtime Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-ActivationPolicy: lazy diff --git a/eu.etaxonomy.taxeditor.webapp/pom.xml b/eu.etaxonomy.taxeditor.webapp/pom.xml index f886609a8..c4b33e133 100644 --- a/eu.etaxonomy.taxeditor.webapp/pom.xml +++ b/eu.etaxonomy.taxeditor.webapp/pom.xml @@ -4,7 +4,7 @@ eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 4.0.0 eu.etaxonomy.taxeditor.webapp diff --git a/eu.etaxonomy.taxeditor/.classpath b/eu.etaxonomy.taxeditor/.classpath index 412e52cde..1bedc4b76 100644 --- a/eu.etaxonomy.taxeditor/.classpath +++ b/eu.etaxonomy.taxeditor/.classpath @@ -1,6 +1,5 @@ - @@ -8,5 +7,6 @@ + diff --git a/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product b/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product index 8c9af5b72..b29156309 100644 --- a/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product +++ b/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ -data @user.home/.cdmLibrary -Dserver_port=58080 - -Xmx512M -XX:MaxPermSize=256M -Dorg.eclipse.update.reconcile=false -Declipse.p2.unsignedPolicy=allow + -Xmx512M -Dorg.eclipse.update.reconcile=false -Declipse.p2.unsignedPolicy=allow -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts diff --git a/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product.with.jre b/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product.with.jre index 26ab1847e..857b82ad4 100644 --- a/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product.with.jre +++ b/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product.with.jre @@ -1,7 +1,7 @@ - + diff --git a/eu.etaxonomy.taxeditor/pom.xml b/eu.etaxonomy.taxeditor/pom.xml index fc2f6738a..7ddcf330f 100644 --- a/eu.etaxonomy.taxeditor/pom.xml +++ b/eu.etaxonomy.taxeditor/pom.xml @@ -2,7 +2,7 @@ eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 4.0.0 diff --git a/lifecycle-mapping-metadata.xml b/lifecycle-mapping-metadata.xml new file mode 100644 index 000000000..257db8c89 --- /dev/null +++ b/lifecycle-mapping-metadata.xml @@ -0,0 +1,326 @@ + + + + + maven-plugin + org.eclipse.m2e.jdt.JarLifecycleMapping + + + + org.apache.maven.plugins + maven-plugin-plugin + [2.3,) + + descriptor + helpmojo + + + + + false + + + + + + + + nexus-plugin + org.eclipse.m2e.jdt.JarLifecycleMapping + + + + war + org.eclipse.m2e.jdt.JarLifecycleMapping + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + + resources + testResources + copy-resources + + [2.4,) + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + + resources + testResources + copy-resources + + [0.0.1,2.4) + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + copy-dependencies + unpack + + [2.0,) + + + + maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e. + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + enforce + + [1.0-alpha-1,) + + + + maven-enforcer-plugin (goal "enforce") is ignored by m2e. + + + + + + org.apache.maven.plugins + maven-invoker-plugin + + install + + [1.6-SONATYPE-r940877,) + + + + maven-invoker-plugin (goal "install") is ignored by m2e. + + + + + + org.apache.maven.plugins + maven-remote-resources-plugin + [1.0,) + + process + + + + + maven-remote-resources-plugin (goal "process") is ignored by m2e. + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + [0,) + + configure-workspace + eclipse + clean + + to-maven + install-plugins + make-artifacts + + myeclipse + myeclipse-clean + + rad + rad-clean + + + + + maven-eclipse-plugin is not compatible with m2e + + + + + + org.apache.maven.plugins + maven-source-plugin + [2.0,) + + jar-no-fork + test-jar-no-fork + + jar + aggregate + test-jar + + + + + + + + + + + org.codehaus.enunciate + maven-enunciate-plugin + + docs + + [1.20-SONATYPE-r919,) + + + + + + + + org.codehaus.mojo + animal-sniffer-maven-plugin + [1.0,) + + check + + + + + + + + + org.codehaus.mojo + buildnumber-maven-plugin + [1.0-beta-1,) + + create + + + + + + + + + + + + org.sonatype.plugins + provided-dependencies-maven-plugin + + generate + + [1.4,) + + + + + + + + org.sonatype.plugins + app-lifecycle-maven-plugin + + check-dependencies + + [1.1,) + + + + + + + + org.sonatype.plugins + app-lifecycle-maven-plugin + + generate-metadata + inject-artifact-handler + + [1.1,) + + + + + + + + org.sonatype.plugins + nexus-test-environment-maven-plugin + + setup-environment + + [1.6-SNAPSHOT,) + + + + + + + + net.sf.alchim + yuicompressor-maven-plugin + + compress + + [0.7.1,) + + + + + + + + org.sonatype.plugins + yuicompressor-maven-plugin + + aggregate + + [0.0.1,) + + + + + + + + org.sonatype.plugins + maven-properties-plugin + [0.0.3-SNAPSHOT,) + + filter-file + + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + run + + [1.7,) + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index fdc870dcd..ea7cc8ec6 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ eu.etaxonomy taxeditor-parent - 4.5.1 + 4.6.0 EDIT Taxonomic Editor The Taxonomic Editor for EDIT's platform for cybertaxonomy @@ -16,12 +16,15 @@ 2007 pom - 1.7 + 1.8 UTF-8 - 4.5.1 + 4.6.0 + 0.22.0 - 4.5.1 + 4.6.0 snapshot 3.4.2 1.2.17 @@ -42,13 +45,14 @@ eu.etaxonomy.taxeditor.feature eu.etaxonomy.taxeditor.feature.jre.linux64 eu.etaxonomy.taxeditor + eu.etaxonomy.taxeditor.test - scm:svn:http://dev.e-taxonomy.eu/svn/trunk/taxeditor/ + scm:git:https://dev.e-taxonomy.eu/git/taxeditor.git - scm:svn:https://dev.e-taxonomy.eu/svn/trunk/taxeditor/ + scm:git:ssh://git@dev.e-taxonomy.eu/var/git/taxeditor.git - https://dev.e-taxonomy.eu/trac/browser/trunk/taxeditor/ + https://dev.e-taxonomy.eu/gitweb/taxeditor.git/tree @@ -111,7 +115,7 @@ Trac - http://dev.e-taxonomy.eu/trac/ + https://dev.e-taxonomy.eu/redmine/projects/edit/ Jenkins @@ -230,10 +234,10 @@ org.apache.maven.plugins maven-compiler-plugin - 2.3.2 + 3.6.1 - 1.7 - 1.7 + ${java.codelevel} + ${java.codelevel} @@ -267,7 +271,7 @@ org.apache.maven.plugins maven-site-plugin - 3.0 + 3.3 en @@ -275,7 +279,7 @@ org.apache.maven.plugins maven-source-plugin - 2.1.2 + 3.0.1 attach-sources @@ -344,10 +348,9 @@ true - + com.jcraft jsch diff --git a/setup-project.sh b/setup-project.sh new file mode 100755 index 000000000..40b2d1d8e --- /dev/null +++ b/setup-project.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +echo -n "Use the local repo? [y,n]" +read choice + +if [ "$choice" == "y" ]; then + mvn_profile='-P local-repository' +fi + +mvn clean install -DskipTests +mvn $mvn_profile -Dlocalrepo=~/.m2/repository validate -pl eu.etaxonomy.taxeditor.cdmlib,eu.etaxonomy.taxeditor.molecular.lib diff --git a/src/site/fml/troubleshooting.fml b/src/site/fml/troubleshooting.fml index a27c259c6..d018ce54b 100644 --- a/src/site/fml/troubleshooting.fml +++ b/src/site/fml/troubleshooting.fml @@ -78,5 +78,26 @@ class "GtkWidget" style "eclipse"

+ + Note for using the EDITor in a Windows Domain/Active directory + +

Using the EDITor from a user account in an active directory is possible but in the case user profile folders are located on network folders, one of the following problems may occurr, when working with CDM databases: +

+

+ 1) Problems are known, if the user profile path is an UNC path (e.g. "\\server\share"). + 2) CDM Information may be written to the local machine's profile copy (if the %USERPROFILE% evironment variable is set respectively) and get lost during synchronization. +

+

+ If one of the described problems occurs, the following workaround can solve the problem: +

+

+ - Connect a network drive with the UNC path of your network profile root folder (if that is not already done within your group policies). (Make sure to check the option to reconnect the drive on the next login.) + - Start the EDITor with the additional command line option "-Duser.home=I:\", where "I" should be replaced by the letter used for the network drive. +

+

+ Now all CDM Information will directly be accessed on the network resource. (Note that with such a configuration, it is not recommended to run multiple instances of the EDITor in different machines of the domain using the same user profile in parallel.) +

+
+
diff --git a/src/site/site.xml b/src/site/site.xml index 1cb522bab..40ad3fe38 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -12,19 +12,19 @@ - + - + - +