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$
}
//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$
}
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;
menuItem.setVisible(canExecute);
return canExecute;
}
-
-
-}
+}
\ No newline at end of file
*
* @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
*
* @return the shared instance
*/
- public static TaxeditorWebappPlugin getDefault() {
+ public static TaxeditorLocalPlugin getDefault() {
return plugin;
}
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";
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();
}
}
- /**
- * <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<>();
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()){
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) {
// default mode is to create a new datasource
Mode mode = Mode.CREATE;
- /**
- * <p>Constructor for CdmDataSourceWizard.</p>
- */
public CdmDataSourceWizard() {
super();
this.mode = Mode.CREATE;
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){
case CREATE:
dataSourceSelectionPage = new CdmDataSourceTypeSelectionWizardPage(dataSource);
this.addPage(dataSourceSelectionPage);
+ return;
default:
-
+ throw new RuntimeException("Unhandled handler mode: " + mode);
}
}
* 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;
*/
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
* 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;
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;
*/
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) {
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));
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);
* 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;
import eu.etaxonomy.taxeditor.local.view.datasource.e4.CdmDataSourceViewPartE4;
/**
- *
* @author pplitzner
* @date 22.08.2017
- *
*/
public class CreateDataSourceHandlerE4 {
* 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;
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();
}
return false;
}
-
-}
+}
\ No newline at end of file