cleanup
authorAndreas Müller <a.mueller@bgbm.org>
Mon, 25 Jul 2022 16:23:00 +0000 (18:23 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Mon, 25 Jul 2022 16:23:00 +0000 (18:23 +0200)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/DeleteHandlerE4.java
eu.etaxonomy.taxeditor.local/src/main/java/eu/etaxonomy/taxeditor/local/TaxeditorLocalPlugin.java [moved from eu.etaxonomy.taxeditor.local/src/main/java/eu/etaxonomy/taxeditor/local/TaxeditorWebappPlugin.java with 87% similarity]
eu.etaxonomy.taxeditor.local/src/main/java/eu/etaxonomy/taxeditor/local/datasource/common/CdmDataSourceRepository.java
eu.etaxonomy.taxeditor.local/src/main/java/eu/etaxonomy/taxeditor/local/datasource/wizard/CdmDataSourceWizard.java
eu.etaxonomy.taxeditor.local/src/main/java/eu/etaxonomy/taxeditor/local/view/datasource/CdmDataSourceContentProvider.java
eu.etaxonomy.taxeditor.local/src/main/java/eu/etaxonomy/taxeditor/local/view/datasource/e4/CdmDataSourceViewPartE4.java
eu.etaxonomy.taxeditor.local/src/main/java/eu/etaxonomy/taxeditor/local/view/datasource/e4/handler/CreateDataSourceHandlerE4.java
eu.etaxonomy.taxeditor.local/src/main/java/eu/etaxonomy/taxeditor/local/view/datasource/e4/handler/EditDataSourceHandlerE4.java

index 653a085d2a6a37fd4a2fef0eaa2410983b9309eb..281530ce509b10fe69a73b92491cffa70ea504aa 100644 (file)
@@ -290,10 +290,8 @@ public class DeleteHandlerE4 {
 
                 result = controller.getMediaService().isDeletable(media.getUuid(), config);
                 errorMessage = MEDIA;
-
             }
 
-
         } catch (Exception e){
             MessagingUtils.errorDialog(AN_EXCEPTION_OCCURED+" "+DELETE_NOT_POSSIBLE, getClass(), e.getMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID, null, true); //$NON-NLS-1$
         }
@@ -301,13 +299,13 @@ public class DeleteHandlerE4 {
             //convert first letter to upper case
             errorMessage = errorMessage.substring(0, 1).toUpperCase()+errorMessage.substring(1);
             if (!result.getExceptions().isEmpty()) {
-                List<String> messages = new ArrayList<String>();
+                List<String> messages = new ArrayList<>();
                 for (Exception e:result.getExceptions()){
                     messages.add(e.getMessage());
                 }
                 errorMessage += " " +COULD_NOT_BE_DELETED; //$NON-NLS-1$
                 //MessagingUtils.errorDialog("test", getClass(), "message", TaxeditorBulkeditorPlugin.PLUGIN_ID, result.getExceptions().iterator().next(),true);
-                DeleteResultMessagingUtils.messageDialogWithDetails(result,errorMessage, TaxeditorBulkeditorPlugin.PLUGIN_ID);
+                DeleteResultMessagingUtils.messageDialogWithDetails(result, errorMessage, TaxeditorBulkeditorPlugin.PLUGIN_ID);
             }else{
                 MessagingUtils.messageDialog(DELETE_NOT_POSSIBLE, getClass(), errorMessage+" "+COULD_NOT_BE_DELETED+" "+AN_EXCEPTION_OCCURED, null); //$NON-NLS-1$ //$NON-NLS-2$
             }
@@ -338,7 +336,7 @@ public class DeleteHandlerE4 {
         boolean canExecute = false;
         IStructuredSelection selection = ((BulkEditor)activePart.getObject()).getSelection();
         canExecute = !selection.isEmpty();
-        Iterator iterator = selection.iterator();
+        Iterator<?> iterator = selection.iterator();
         for(selection.iterator();iterator.hasNext();){
             if(!(iterator.next() instanceof CdmBase)){
                 canExecute = false;
@@ -348,6 +346,4 @@ public class DeleteHandlerE4 {
         menuItem.setVisible(canExecute);
         return canExecute;
     }
-
-
-}
+}
\ No newline at end of file
similarity index 87%
rename from eu.etaxonomy.taxeditor.local/src/main/java/eu/etaxonomy/taxeditor/local/TaxeditorWebappPlugin.java
rename to eu.etaxonomy.taxeditor.local/src/main/java/eu/etaxonomy/taxeditor/local/TaxeditorLocalPlugin.java
index c77aebfc6aab8c33d66eb3ea1a4d195ef26c680b..5352580c2105e0d25a1b0702ac91439a43ddbfa1 100644 (file)
@@ -10,19 +10,19 @@ import org.osgi.framework.BundleContext;
  *
  * @author n.hoffmann
  */
-public class TaxeditorWebappPlugin extends AbstractUIPlugin {
+public class TaxeditorLocalPlugin extends AbstractUIPlugin {
 
        // The plug-in ID
        /** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.editor"</code> */
-       public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.editor";
+       public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.local";
 
        // The shared instance
-       private static TaxeditorWebappPlugin plugin;
+       private static TaxeditorLocalPlugin plugin;
 
        /**
         * The constructor
         */
-       public TaxeditorWebappPlugin() {
+       public TaxeditorLocalPlugin() {
        }
 
        @Override
@@ -42,7 +42,7 @@ public class TaxeditorWebappPlugin extends AbstractUIPlugin {
         *
         * @return the shared instance
         */
-       public static TaxeditorWebappPlugin getDefault() {
+       public static TaxeditorLocalPlugin getDefault() {
                return plugin;
        }
 
index b4a5c36a3a59bfd020ab53c9509706accd1912ce..ccb411db19c68d327505fafe6c83403e8da1b051 100644 (file)
@@ -37,7 +37,6 @@ import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
 
 public class CdmDataSourceRepository{
 
-       /** Constant <code>TAG_DATASOURCE="tagDataSource"</code> */
        public static final String TAG_DATASOURCE = "tagDataSource";
        private static final String CURRENT_DATASOURCE = "currentDataSource";
        private static final String CURRENT_DATASOURCE_POSTFIX = "currentDataSourcePostFix";
@@ -52,11 +51,6 @@ public class CdmDataSourceRepository{
        private static String lastUsedCdmSourceName;
        private static String lastUsedCdmSourcePostFix;
 
-       /**
-        * <p>Getter for the field <code>lastUsedDataSourceName</code>.</p>
-        *
-        * @return a {@link java.lang.String} object.
-        */
        public static void updateLastUsedDataSource(){
                if(lastUsedCdmSourceName == null){
                        memento = readMemento();
@@ -65,22 +59,11 @@ public class CdmDataSourceRepository{
                }
        }
 
-       /**
-        * <p>delete</p>
-        *
-        * @param dataSource a {@link eu.etaxonomy.cdm.database.CdmPersistentDataSource} object.
-        * @return a boolean.
-        */
        public static boolean delete(ICdmPersistentSource cdmPersistentSource) {
                CdmPersistentSourceUtils.delete(cdmPersistentSource);
                return true;
        }
 
-       /**
-        * <p>getAll</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
        public static List<ICdmSource> getAll() {
                List<ICdmSource> remoteSources = new ArrayList<>();
 
@@ -111,12 +94,6 @@ public class CdmDataSourceRepository{
                return remoteSources;
        }
 
-       /**
-        * <p>getDataSource</p>
-        *
-        * @param name a {@link java.lang.String} object.
-        * @return a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
-        */
        public static ICdmDataSource getDataSource(String name){
 
                for(ICdmDataSource dataSource : CdmPersistentDataSource.getAllDataSources()){
@@ -132,12 +109,6 @@ public class CdmDataSourceRepository{
                return null;
        }
 
-       /**
-        * <p>Getter for the field <code>currentDataSource</code>.</p>
-        *
-        * @return a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
-        * @throws CdmRemoteSourceException
-        */
        public static ICdmSource getCurrentCdmSource() throws CdmRemoteSourceException {
 
                if (currentCdmSource == null) {
index 54a2d1c683de3f90e562ddaa6fb48539a395dff8..dfbd6fc61f0389a17ec78ae99766a930528ccf57 100644 (file)
@@ -41,9 +41,6 @@ public class CdmDataSourceWizard extends Wizard {
        // default mode is to create a new datasource
        Mode mode = Mode.CREATE;
 
-       /**
-        * <p>Constructor for CdmDataSourceWizard.</p>
-        */
        public CdmDataSourceWizard() {
                super();
                this.mode = Mode.CREATE;
@@ -51,11 +48,6 @@ public class CdmDataSourceWizard extends Wizard {
                setWindowTitle("Datasource Dialog");
        }
 
-       /**
-        * <p>Constructor for CdmDataSourceWizard.</p>
-        *
-        * @param dataSource a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
-        */
        public CdmDataSourceWizard(ICdmDataSource dataSource, Mode mode) {
                super();
                if(dataSource != null){
@@ -88,8 +80,9 @@ public class CdmDataSourceWizard extends Wizard {
                case CREATE:
                        dataSourceSelectionPage = new CdmDataSourceTypeSelectionWizardPage(dataSource);
                        this.addPage(dataSourceSelectionPage);
+                       return;
                default:
-
+                   throw new RuntimeException("Unhandled handler mode: " + mode);
                }
        }
 
index bd74277f4dbb0e5980e0b8caae181cc629baba8b..230e0255084f3b904233786b301cd0d9eb1ae339 100644 (file)
@@ -6,7 +6,6 @@
 * 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.local.view.datasource;
 
 import java.util.List;
@@ -22,24 +21,19 @@ import org.eclipse.jface.viewers.Viewer;
  */
 public class CdmDataSourceContentProvider implements IStructuredContentProvider {
 
-       /**
-        * <p>dispose</p>
-        */
-       public void dispose() {
-
+       @Override
+    public void dispose() {
        }
 
-       /** {@inheritDoc} */
-       public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
+       @Override
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }
 
-
-       /** {@inheritDoc} */
-       public Object[] getElements(Object inputElement) {
+       @Override
+    public Object[] getElements(Object inputElement) {
                if(inputElement instanceof List){
                        return ((List) inputElement).toArray();
                }
                return new Object[]{};
        }
-}
+}
\ No newline at end of file
index ffff2c6f3d3e3afaa938f1a74cdee3d335654d78..322fdcafb5beaa3d5760aac452a32734adf1750e 100644 (file)
@@ -6,7 +6,6 @@
 * 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.local.view.datasource.e4;
 
 import java.util.ArrayList;
@@ -16,7 +15,8 @@ import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
@@ -58,11 +58,11 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  */
 public class CdmDataSourceViewPartE4 {
 
+    private static final Logger logger = LogManager.getLogger(CdmDataSourceViewPartE4.class);
+
     @Inject
     private UISynchronize sync;
 
-    private static final Logger logger = LogManager.getLogger(CdmDataSourceViewPartE4.class);
-
        private class ContextListener extends ContextListenerAdapter{
                @Override
                public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) {
@@ -98,7 +98,7 @@ public class CdmDataSourceViewPartE4 {
                                logger.debug("Begin of eclipse core runtime Job to Retrieve datasources"); //$NON-NLS-1$
                                monitor.beginTask("Retrieving datasources", cdmSources.size() + 1);                      //$NON-NLS-1$
 
-                               final List<CdmMetaDataAwareDataSourceContainer> containers = new ArrayList<CdmMetaDataAwareDataSourceContainer>();
+                               final List<CdmMetaDataAwareDataSourceContainer> containers = new ArrayList<>();
 
                                for(ICdmSource cdmSource : cdmSources){
                                        containers.add(new CdmMetaDataAwareDataSourceContainer(cdmSource));
@@ -113,27 +113,20 @@ public class CdmDataSourceViewPartE4 {
                         logger.debug("  #" + container.hashCode() + " : next DataSourceContainer");                                             //$NON-NLS-1$ //$NON-NLS-2$
                     }
                                        container.getMetaDataFromDataSource();
-                                       if(logger.isDebugEnabled())
-                     {
+                                       if(logger.isDebugEnabled()) {
                         logger.debug("  #" + container.hashCode() + " : metadata retrieved, creating new runnable ...");        //$NON-NLS-1$ //$NON-NLS-2$
                     }
-                                       sync.asyncExec(new Runnable() {
-
-                                               @Override
-                                               public void run() {
-                                                       if(logger.isDebugEnabled())
-                             {
+                                       sync.asyncExec(()-> {
+                                                       if(logger.isDebugEnabled()){
                                 logger.debug("  #" + container.hashCode() + " starting sub thread to update ...");      //$NON-NLS-1$ //$NON-NLS-2$
                             }
                                                        viewer.update(container, null);
-                                                       if(logger.isDebugEnabled())
-                             {
+                                                       if(logger.isDebugEnabled()){
                                 logger.debug("  #" + container.hashCode() + " end of sub thread to update ...");        //$NON-NLS-1$ //$NON-NLS-2$
                             }
                                                }
-                                       });
-                                       if(logger.isDebugEnabled())
-                     {
+                                       );
+                                       if(logger.isDebugEnabled()) {
                         logger.debug("  #" + container.hashCode() + " done");   //$NON-NLS-1$ //$NON-NLS-2$
                     }
                                        monitor.worked(1);
index 0a793d725aae80b8899cad0b705e568e9ce574fb..e773c37da8439e151b589d0e76fc1f108a6ef737 100644 (file)
@@ -6,7 +6,6 @@
 * 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.local.view.datasource.e4.handler;
 
 import javax.inject.Named;
@@ -24,10 +23,8 @@ import eu.etaxonomy.taxeditor.local.datasource.wizard.CdmDataSourceWizard;
 import eu.etaxonomy.taxeditor.local.view.datasource.e4.CdmDataSourceViewPartE4;
 
 /**
- *
  * @author pplitzner
  * @date 22.08.2017
- *
  */
 public class CreateDataSourceHandlerE4 {
 
index 3756b4a6edaa291a88b04d22b00da851fce1c562..3f134a7637c8c73dfc3ffb9a4e323964cd22c4ec 100644 (file)
@@ -6,7 +6,6 @@
 * 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.local.view.datasource.e4.handler;
 
 import org.eclipse.core.runtime.IStatus;
@@ -21,14 +20,11 @@ import eu.etaxonomy.taxeditor.local.view.datasource.CdmMetaDataAwareDataSourceCo
 import eu.etaxonomy.taxeditor.local.view.datasource.e4.CdmDataSourceViewPartE4;
 
 /**
- *
  * @author pplitzner
  * @date 22.08.2017
- *
  */
 public class EditDataSourceHandlerE4 extends AbstractDataSourceHandlerE4 {
 
-    /** {@inheritDoc} */
     @Override
     public boolean specificExecute(CdmDataSourceViewPartE4 dataSourceViewPart, CdmMetaDataAwareDataSourceContainer container, Shell shell) {
                ICdmSource cdmSource = container.getCdmSource();
@@ -48,5 +44,4 @@ public class EditDataSourceHandlerE4 extends AbstractDataSourceHandlerE4 {
                }
                return false;
        }
-
-}
+}
\ No newline at end of file