Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2013-09-30 16:21:35 +0000
committerChristian W. Damus2013-09-30 16:21:35 +0000
commit32a32111736a8acc5ed17a458e7ea22d35d108f2 (patch)
tree3a11bf02b35973c9b5b1b8c2ef44968d61382fcf /extraplugins
parentf0f0cdd30fbd6134b766011d22a35313d44a7716 (diff)
downloadorg.eclipse.papyrus-32a32111736a8acc5ed17a458e7ea22d35d108f2.tar.gz
org.eclipse.papyrus-32a32111736a8acc5ed17a458e7ea22d35d108f2.tar.xz
org.eclipse.papyrus-32a32111736a8acc5ed17a458e7ea22d35d108f2.zip
418335: [CDO] Failure to connect to repository not reported to user
https://bugs.eclipse.org/bugs/show_bug.cgi?id=418335 Show error message dialog when CDO server not reachable or when repository not available in the server. Includes string externalization covering other previously unexternalized strings.
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF13
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepository.java3
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java2
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepository.java19
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/Messages.java5
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/messages.properties2
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/ConnectRepositoryAction.java32
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java6
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/messages.properties3
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java5
10 files changed, 65 insertions, 25 deletions
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF
index 955e6ebc178..62db9d97ad9 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF
@@ -22,16 +22,16 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.emf.ecore.xmi;visibility:=reexport,
- org.eclipse.emf.cdo;visibility:=reexport;bundle-version="[4.2.0,5.0.0)",
- org.eclipse.papyrus.infra.core;visibility:=reexport;bundle-version="0.10.1",
+ org.eclipse.emf.cdo;bundle-version="[4.2.0,5.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.1";visibility:=reexport,
org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.services.resourceloading;visibility:=reexport;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.emf.readonly;visibility:=reexport;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.services.resourceloading;bundle-version="0.10.1";visibility:=reexport,
+ org.eclipse.papyrus.infra.emf.readonly;bundle-version="0.10.1";visibility:=reexport,
org.eclipse.emf.workspace;bundle-version="[1.5.1,2.0.0)",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.1",
org.eclipse.emf.cdo.dawn;bundle-version="[2.0.0,3.0.0)",
org.eclipse.emf.cdo.dawn.gmf;bundle-version="[2.1.0,3.0.0)",
- org.eclipse.emf.transaction;visibility:=reexport;bundle-version="[1.4.0,2.0.0)",
+ org.eclipse.emf.transaction;bundle-version="[1.4.0,2.0.0)";visibility:=reexport,
org.eclipse.gmf.runtime.notation;bundle-version="[1.5.0,2.0.0)",
org.eclipse.equinox.security;bundle-version="[1.1.100,2.0.0)",
org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
@@ -39,7 +39,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.papyrus.infra.services.controlmode;bundle-version="0.10.1",
org.eclipse.gmf.runtime.emf.commands.core;bundle-version="[1.7.0,2.0.0)",
org.eclipse.gmf.runtime.emf.type.core;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.papyrus.infra.services.localizer;bundle-version="0.10.1"
+ org.eclipse.papyrus.infra.services.localizer;bundle-version="0.10.1",
+ org.eclipse.net4j;bundle-version="[4.2.0,5.0.0)"
Bundle-Vendor: %providerName
Bundle-Version: 0.10.1.qualifier
Bundle-ManifestVersion: 2
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepository.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepository.java
index 89ca40081da..01432064602 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepository.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepository.java
@@ -13,6 +13,7 @@ package org.eclipse.papyrus.cdo.core;
import java.util.Collection;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -39,7 +40,7 @@ public interface IPapyrusRepository {
boolean isConnected();
- void connect();
+ IStatus connect();
void disconnect() throws CommitException;
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java
index 8667edad5dd..8449027b64d 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java
@@ -382,7 +382,7 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet {
try {
transaction.commit(sub.newChild(1));
} catch (CommitException e) {
- Activator.log.error("Follow-up commit after save failed.", e);
+ Activator.log.error("Follow-up commit after save failed.", e); //$NON-NLS-1$
}
} else {
sub.done();
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepository.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepository.java
index 45fe9106943..23bc477a31a 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepository.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepository.java
@@ -19,7 +19,9 @@ import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.model.CDOPackageRegistryPopulator;
@@ -44,6 +46,7 @@ import org.eclipse.equinox.security.storage.EncodingUtils;
import org.eclipse.equinox.security.storage.ISecurePreferences;
import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
import org.eclipse.equinox.security.storage.StorageException;
+import org.eclipse.net4j.signal.RemoteException;
import org.eclipse.net4j.util.container.Container;
import org.eclipse.net4j.util.container.ContainerEvent;
import org.eclipse.net4j.util.container.IContainerDelta;
@@ -52,14 +55,17 @@ import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter;
+import org.eclipse.net4j.util.lifecycle.LifecycleException;
import org.eclipse.net4j.util.security.CredentialsProviderFactory;
import org.eclipse.net4j.util.security.ICredentialsProvider2;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.cdo.core.CommitException;
import org.eclipse.papyrus.cdo.core.IPapyrusRepositoryListener;
import org.eclipse.papyrus.cdo.core.IResourceSetDisposalApprover;
import org.eclipse.papyrus.cdo.core.PapyrusRepositoryEvent;
import org.eclipse.papyrus.cdo.core.resource.CDOAwareModelSet;
import org.eclipse.papyrus.cdo.core.resource.PapyrusCDOResourceFactory;
+import org.eclipse.papyrus.cdo.internal.core.l10n.Messages;
import org.eclipse.papyrus.cdo.internal.core.repositories.Repository;
import com.google.common.base.Objects;
@@ -208,7 +214,9 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn
}
@Override
- public void connect() {
+ public IStatus connect() {
+ IStatus result = Status.OK_STATUS;
+
if(!isConnected()) {
ICredentialsProvider2 creds = getCredentialsProvider();
Object oldCreds = null;
@@ -221,8 +229,15 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn
for(;;) {
try {
session = (CDOSession)container.getElement("org.eclipse.emf.cdo.sessions", "cdo", getURL()); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (LifecycleException e) {
+ // most probably we simply failed to connect to the repository
+ result = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.PapyrusRepository_connectFailed, e);
+ } catch (RemoteException e) {
+ // most probably we connected to the CDO server but the repository is not available
+ result = new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.PapyrusRepository_badRepo, getName()), e.getCause());
} catch (NotAuthenticatedException e) {
// user cancelled the credentials dialog. That's OK
+ result = Status.CANCEL_STATUS;
break;
} catch (SecurityException e) {
// wrong credentials. If the user stored them, purge and
@@ -263,6 +278,8 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn
}
}
}
+
+ return result;
}
protected final IInternalPapyrusRepositoryManager getManager() {
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/Messages.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/Messages.java
index 815ee8328cb..b144f8e676d 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/Messages.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/Messages.java
@@ -75,6 +75,11 @@ public class Messages extends NLS {
public static String ModelTransferConfiguration_7;
public static String ModelTransferNode_0;
+
+ public static String PapyrusRepository_connectFailed;
+
+ public static String PapyrusRepository_badRepo;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/messages.properties b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/messages.properties
index ef13e5af807..2c2ecde4b71 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/messages.properties
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/messages.properties
@@ -37,3 +37,5 @@ ModelTransferConfiguration_4=All controlled sub-units of {0} must be selected fo
ModelTransferConfiguration_6=import
ModelTransferConfiguration_7=export
ModelTransferNode_0=Calculating model dependencies ...
+PapyrusRepository_connectFailed=Could not connect to the repository server. Please ensure that the connection properties are correct.
+PapyrusRepository_badRepo=The repository "{0}" is not available on the server. Please ensure that the server is properly configured.
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/ConnectRepositoryAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/ConnectRepositoryAction.java
index 8a840a878e2..2fa5916ed54 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/ConnectRepositoryAction.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/ConnectRepositoryAction.java
@@ -14,22 +14,23 @@ package org.eclipse.papyrus.cdo.internal.ui.actions;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.papyrus.cdo.core.IPapyrusRepository;
import org.eclipse.papyrus.cdo.internal.ui.Activator;
import org.eclipse.papyrus.cdo.internal.ui.l10n.Messages;
import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.statushandlers.IStatusAdapterConstants;
+import org.eclipse.ui.statushandlers.StatusAdapter;
+import org.eclipse.ui.statushandlers.StatusManager;
/**
* This is the ConnectRepositoryAction type. Enjoy.
*/
-public class ConnectRepositoryAction
- extends AbstractRepositoryAction {
+public class ConnectRepositoryAction extends AbstractRepositoryAction {
public ConnectRepositoryAction(IWorkbenchPart part) {
- super(Messages.ConnectRepositoryAction_0, Activator
- .getIcon(Activator.ICON_CONNECT_REPOSITORY_ENABLED), Activator
- .getIcon(Activator.ICON_CONNECT_REPOSITORY_DISABLED), part);
+ super(Messages.ConnectRepositoryAction_0, Activator.getIcon(Activator.ICON_CONNECT_REPOSITORY_ENABLED), Activator.getIcon(Activator.ICON_CONNECT_REPOSITORY_DISABLED), part);
}
@Override
@@ -40,19 +41,22 @@ public class ConnectRepositoryAction
@Override
protected void run(final IPapyrusRepository repository) {
try {
- getPart().getSite().getWorkbenchWindow()
- .run(true, false, new IRunnableWithProgress() {
+ getPart().getSite().getWorkbenchWindow().run(true, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException,
- InterruptedException {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- repository.connect();
+ IStatus status = repository.connect();
+ if(status.matches(IStatus.WARNING | IStatus.ERROR)) {
+ StatusAdapter adapter = new StatusAdapter(status);
+ adapter.setProperty(IStatusAdapterConstants.TIMESTAMP_PROPERTY, System.currentTimeMillis());
+ adapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, Messages.ConnectRepositoryAction_errorTitle);
+ StatusManager.getManager().handle(adapter, StatusManager.SHOW);
}
- });
+ }
+ });
} catch (Exception e) {
- Activator.log.error(
- "Unexpected exception in async repository connection.", e); //$NON-NLS-1$
+ Activator.log.error("Unexpected exception in async repository connection.", e); //$NON-NLS-1$
}
}
}
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java
index f8adebacab9..8612c22257c 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java
@@ -80,6 +80,8 @@ public class Messages extends NLS {
public static String ConnectRepositoryAction_0;
+ public static String ConnectRepositoryAction_errorTitle;
+
public static String CreateCDOFragDlg_browseMessage;
public static String CreateCDOFragDlg_browseRepo;
@@ -182,6 +184,10 @@ public class Messages extends NLS {
public static String ModelReferencesPage_9;
+ public static String ModelRepositoriesView_commitSaveError;
+
+ public static String ModelRepositoriesView_commitSaveFailed;
+
public static String OpenPapyrusModelAction_0;
public static String PapyrusCDOEditorManager_1;
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/messages.properties b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/messages.properties
index 7d900a5a967..ca53107946b 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/messages.properties
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/messages.properties
@@ -39,6 +39,7 @@ CDOResLabels_txtKind=Text file
CDOResLabels_unknown=(unknown)
CDOStateLabelDecorator_1=Update CDO state label decorations
ConnectRepositoryAction_0=Connect
+ConnectRepositoryAction_errorTitle=Connect to Repository
CreateCDOFragDlg_browseMessage=Choose the location and name of the new model unit.
CreateCDOFragDlg_browseRepo=Browse Repository...
CreateCDOFragDlg_browseTitle=Create Model Unit
@@ -90,6 +91,8 @@ ModelReferencesPage_5=Path:
ModelReferencesPage_7=Please select at least one model to {0}.
ModelReferencesPage_8=import
ModelReferencesPage_9=export
+ModelRepositoriesView_commitSaveError=Save Problem
+ModelRepositoriesView_commitSaveFailed=Failed to commit saved changes.
OpenPapyrusModelAction_0=Open in Papyrus Editor
PapyrusCDOEditorManager_1=Unsaved Model Editors
PapyrusCDOEditorManager_2=There are unsaved model editors using this repository. Save them first?
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java
index b032c0e406d..e614e3ce962 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java
@@ -42,6 +42,7 @@ import org.eclipse.papyrus.cdo.internal.ui.actions.RemoveRepositoryAction;
import org.eclipse.papyrus.cdo.internal.ui.actions.RenameModelAction;
import org.eclipse.papyrus.cdo.internal.ui.dnd.ResourceDragAdapter;
import org.eclipse.papyrus.cdo.internal.ui.dnd.ResourceDropAdapter;
+import org.eclipse.papyrus.cdo.internal.ui.l10n.Messages;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IActionBars;
@@ -270,9 +271,9 @@ public class ModelRepositoriesView extends ContainerView {
try {
trans.commit();
} catch (CommitException e) {
- StatusAdapter adapter = new StatusAdapter(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to commit saved changes.", e));
+ StatusAdapter adapter = new StatusAdapter(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ModelRepositoriesView_commitSaveFailed, e));
adapter.setProperty(IStatusAdapterConstants.TIMESTAMP_PROPERTY, System.currentTimeMillis());
- adapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, "Save Problem");
+ adapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, Messages.ModelRepositoriesView_commitSaveError);
StatusManager.getManager().handle(adapter);
}
}

Back to the top