command.label.3 = Error Log\r
command.label.4 = Reporting\r
command.label.5 = Switch User\r
-command.label.6 = Connect\r
+command.label.6 = Create Data Model\r
command.label.7 = New\r
command.label.8 = Edit\r
command.label.9 = Delete\r
-command.label.10 = Close Active Connection\r
command.label.11 = Update Datamodel\r
menu.label.0 = New\r
command.label.12 = Vocabulary\r
command.name = Connect Datasource\r
command.name.0 = Edit Datasource\r
command.name.1 = Create Datasource\r
-command.name.2 = Close Active Connection\r
command.name.3 = Update Datasource\r
command.name.4 = Show Login Window\r
command.name.5 = Open Defined Term Editor\r
command.label.3 = Fehlermeldungen
command.label.4 = Berichte
command.label.5 = Benutzer wechseln
-command.label.6 = Verbinden
+command.label.6 = Datenmodell erstellen
command.label.7 = Neu
command.label.8 = Bearbeiten
command.label.9 = L\u00f6schen
-command.label.10 = Schlie\u00dfe aktive Verbindung
-command.label.11 = Aktualisiere Datenmodel
+command.label.11 = Aktualisiere Datenmodell
menu.label.0 = Neu
command.label.12 = Vokabular
command.label.13 = Definierter Begriff
command.name = Verbinde Datenquelle
command.name.0 = Bearbeite Datenquelle
command.name.1 = Erstelle Datenquelle
-command.name.2 = Schlie\u00dfe aktive Verbindungen
command.name.3 = Aktualisiere Datenquellen
command.name.4 = Zeige Login Window
command.name.5 = \u00d6ffne Editor f\u00fcr definierte Begriffe
label="%command.label.6"
style="push">
<visibleWhen>
- <with
- variable="selection">
- <not>
- <test
- property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
- </test>
- </not>
- </with>
+ <not>
+ <reference
+ definitionId="hasDataModel">
+ </reference>
+ </not>
</visibleWhen>
</command>
<command
name="eu.etaxonomy.taxeditor.store.datasource.separator2"
visible="true">
</separator>
- <command
- commandId="eu.etaxonomy.taxeditor.store.datasource.close"
- label="%command.label.10"
- style="push">
- <visibleWhen>
- <with
- variable="selection">
- <not>
- <test
- property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
- </test>
- </not>
- </with>
- </visibleWhen>
- </command>
<command
commandId="eu.etaxonomy.taxeditor.store.datasource.update"
label="%command.label.11"
id="eu.etaxonomy.taxeditor.store.datasource.create"
name="%command.name.1">
</command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.CloseConnectionHandler"
- id="eu.etaxonomy.taxeditor.store.datasource.close"
- name="%command.name.2">
- </command>
<command
defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.DeleteDataSourceHandler"
id="eu.etaxonomy.taxeditor.view.datasource.delete"
class="eu.etaxonomy.taxeditor.view.datasource.handler.DataSourceMenuPropertyTester"
id="eu.etaxonomy.taxeditor.datasource.propertyTester"
namespace="eu.etaxonomy.taxeditor.datasource.propertyTester"
- properties="test"
+ properties="test, hasDataModel"
type="org.eclipse.jface.viewers.IStructuredSelection">
</propertyTester>
<propertyTester
</test>
</with>
</definition>
+ <definition
+ id="hasDataModel">
+ <with
+ variable="selection">
+ <test
+ property="eu.etaxonomy.taxeditor.datasource.propertyTester.hasDataModel">
+ </test>
+ </with>
+ </definition>
<definition
id="isShowExperimentalFeatures">
<with
import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;
+import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
import eu.etaxonomy.taxeditor.ui.dialog.LoginDialog;
import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
-import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
/**
try {
Thread.currentThread().setPriority(10);
applicationController = getApplicationController(cdmSource,subprogressMonitor);
+ return Status.OK_STATUS;
} catch (Exception e) {
if(! causeIsCancelationExceptionRecursive(e)){
- return new Status(IStatus.ERROR, "Could not connect to CDM Store", "An error occurred while trying to connect to datasource: " + cdmSource.getName(), e);
+ MessagingUtils.errorDialog("Could not create data model", CdmStoreConnector.class, "An error occurred while trying to create "
+ + "data model for data source: " + cdmSource.getName()+"\n Please clear the data base and retry. ", TaxeditorStorePlugin.PLUGIN_ID, e, true);
+ return Status.CANCEL_STATUS;
}
} finally {
monitor.done();
}
}
-
-
- if (!monitor.isCanceled()) {
- CdmStore.setInstance(applicationController, cdmSource);
-
- display.asyncExec(new Runnable() {
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- authenticate();
-
- startContext();
- }
- });
-
- MessagingUtils.info("Application context initialized.");
- return Status.OK_STATUS;
- } else {
- // Show datasource view if not shown yet
- display.asyncExec(new Runnable() {
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- StoreUtil.showView(CdmDataSourceViewPart.ID);
- }
- });
return Status.CANCEL_STATUS;
- }
}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.datasource.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
-
-/**
- * <p>CloseConnectionHandler class.</p>
- *
- * @author n.hoffmann
- * @created Mar 22, 2010
- * @version 1.0
- */
-public class CloseConnectionHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Shell shell = HandlerUtil.getActiveShell(event);
-
- boolean confirmed = MessageDialog.openConfirm(shell, "Confirm Datasource Close", "Do you really want to close the datasource connection?\n\n");
-
- if(confirmed){
- CdmStore.close(StoreUtil.getMonitor());
- }
-
- CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.getView(CdmDataSourceViewPart.ID, true);
-
- view.refresh();
-
- return null;
- }
-}
// $Id$
/**
* 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.
*/
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.jface.viewers.IStructuredSelection;
+import eu.etaxonomy.cdm.model.metadata.CdmMetaData.MetaDataPropertyName;
import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
/**
- * <p>DataSourceMenuPropertyTester class.</p>
- *
* @author n.hoffmann
* @created Sep 23, 2010
* @version 1.0
private static final String COMPATIBLE = "isCompatible";
private static final String TEST = "test";
+ private static final String HAS_DATA_MODEL = "hasDataModel";
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object,
- * java.lang.String, java.lang.Object[], java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public boolean test(Object receiver, String property, Object[] args,
Object expectedValue) {
Object[] selectedElements = ((IStructuredSelection) receiver).toArray();
-
if (selectedElements.length == 0 && property.equals(TEST)) {
// nothing selected so all tests should fail
return true;
if (COMPATIBLE.equals(property)) {
return isCompatible(selectedElements);
}
-
-
-
-
+ if (HAS_DATA_MODEL.equals(property)) {
+ return hasDataModel(selectedElements);
+ }
return false;
}
+ private boolean hasDataModel(Object[] selectedElements) {
+
+ if (selectedElements.length == 0 ) {
+ // nothing selected so all tests should fail
+ return false;
+ }
+ for (Object object : selectedElements) {
+
+ if (object instanceof CdmMetaDataAwareDataSourceContainer) {
+ CdmMetaDataAwareDataSourceContainer container = (CdmMetaDataAwareDataSourceContainer) object;
+ String schemaVersion = container.getMetaData(MetaDataPropertyName.DB_SCHEMA_VERSION);
+ return !schemaVersion.equals(CdmMetaDataAwareDataSourceContainer.DEFAULT_ENTRY);
+ }
+ }
+ return false;
+
+ }
- /**
- * @param selectedElements
- * @return
- */
private boolean isCompatible(Object[] selectedElements) {
-
+
if (selectedElements.length == 0 ) {
// nothing selected so all tests should fail
return false;
}
}
return false;
-
+
}
}