diff options
| author | Laurent Redor | 2020-08-27 09:24:43 +0000 |
|---|---|---|
| committer | Philippe DUL | 2020-10-19 14:26:20 +0000 |
| commit | 849bca3217db10bc7a38422e85db20d56848a784 (patch) | |
| tree | 0c573f3e0279581aee462086c64a6979db2ad4a8 | |
| parent | 9d9d3b271301130922f6842bd0b3deeb906e8da6 (diff) | |
| download | org.eclipse.amalgam-849bca3217db10bc7a38422e85db20d56848a784.tar.gz org.eclipse.amalgam-849bca3217db10bc7a38422e85db20d56848a784.tar.xz org.eclipse.amalgam-849bca3217db10bc7a38422e85db20d56848a784.zip | |
[566440] Silently catch the exception corresponding to a connection lost
This avoids to display a useless "technical" message to the end-user.
Bug: 566440
Change-Id: I81d062359903a2c392b47798d6edea888db2c63a
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
2 files changed, 23 insertions, 14 deletions
diff --git a/plugins/org.eclipse.amalgam.explorer.activity.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.amalgam.explorer.activity.ui/META-INF/MANIFEST.MF index d8a76520..5896e340 100644 --- a/plugins/org.eclipse.amalgam.explorer.activity.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.amalgam.explorer.activity.ui/META-INF/MANIFEST.MF @@ -16,7 +16,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.sirius.ui, org.eclipse.sirius.table.ui, org.eclipse.sirius.tree.ui, - org.eclipse.sirius.common, + org.eclipse.sirius.common;bundle-version="6.4.0", org.eclipse.sirius.common.ui, org.eclipse.sirius.ext.base, org.eclipse.sirius.diagram, diff --git a/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/editor/pages/helper/SessionHelper.java b/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/editor/pages/helper/SessionHelper.java index fd3134a3..c0adf27c 100644 --- a/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/editor/pages/helper/SessionHelper.java +++ b/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/editor/pages/helper/SessionHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES. + * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,6 +22,7 @@ import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.sirius.business.api.session.danalysis.DAnalysisSession; +import org.eclipse.sirius.common.tools.api.query.IllegalStateExceptionQuery; public class SessionHelper { @@ -49,25 +50,33 @@ public class SessionHelper { * @param session_p * @return model root of the first semantic resource managed by session_p or null * - * @deprecated will be removed. Do not base client code by calling this method or calling {@link - * org.eclipse.amalgam.explorer.activity.ui.api.manager.ActivityExplorerManager.getRootSemanticModel()} + * @deprecated will be removed. Do not base client code by calling this method or calling + * {@link org.eclipse.amalgam.explorer.activity.ui.api.manager.ActivityExplorerManager.getRootSemanticModel()} * */ @Deprecated public static EObject getRootSemanticModel(Session session_p) { EObject result = null; - if (null != session_p) { - Iterator<Resource> semanticResources = session_p.getSemanticResources().iterator(); - // Iterate over semantic resources to search for a project. - while (semanticResources.hasNext()) { - Resource semanticResource = semanticResources.next(); - String fileExtension = semanticResource.getURI().fileExtension(); - if (fileExtension == null || fileExtension.isEmpty() || AFM_EXTENSION.equals(fileExtension)) { - continue; + try { + if (null != session_p) { + Iterator<Resource> semanticResources = session_p.getSemanticResources().iterator(); + // Iterate over semantic resources to search for a project. + while (semanticResources.hasNext()) { + Resource semanticResource = semanticResources.next(); + String fileExtension = semanticResource.getURI().fileExtension(); + if (fileExtension == null || fileExtension.isEmpty() || AFM_EXTENSION.equals(fileExtension)) { + continue; + } + result = semanticResource.getContents().get(0); + break; } - result = semanticResource.getContents().get(0); - break; + } + } catch (IllegalStateException e) { + if (new IllegalStateExceptionQuery(e).isAConnectionLostException()) { + // Do nothing, just return null. + } else { + throw e; } } return result; |
