Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Charles David2017-05-30 09:37:22 -0400
committerPierre-Charles David2017-05-31 07:35:41 -0400
commit0cd6b6685065fb8dea9ecb4df8a3c0b2bee75c1b (patch)
tree4208075fb3f7337ff1a4942df2627f5d93a0368a
parent4ef71263c274158af80275b6a94bfe781cd77c2c (diff)
downloadorg.eclipse.sirius-0cd6b6685065fb8dea9ecb4df8a3c0b2bee75c1b.tar.gz
org.eclipse.sirius-0cd6b6685065fb8dea9ecb4df8a3c0b2bee75c1b.tar.xz
org.eclipse.sirius-0cd6b6685065fb8dea9ecb4df8a3c0b2bee75c1b.zip
[514682] Avoid exception when Browser can't be createdv5.0.0rc2
Under some systems (Linux, depending on various parameters), it may be impossible to create an SWT Browser, which results in an SWTException. In this cases, do not display the "Documentation" section on the wizard's first page. Bug: 514682 Change-Id: Ie7f8bf89e8e67bada20cbeaf8ef633653a413f7e Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/SelectEMFMetamodelWizardPage.java24
1 files changed, 18 insertions, 6 deletions
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/SelectEMFMetamodelWizardPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/SelectEMFMetamodelWizardPage.java
index 83c03b7181..327cb603ba 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/SelectEMFMetamodelWizardPage.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/SelectEMFMetamodelWizardPage.java
@@ -21,6 +21,7 @@ import org.eclipse.sirius.common.tools.DslCommonPlugin;
import org.eclipse.sirius.common.tools.api.ecore.EPackageMetaData;
import org.eclipse.sirius.viewpoint.provider.Messages;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTError;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.KeyAdapter;
@@ -46,7 +47,7 @@ public class SelectEMFMetamodelWizardPage extends WizardPage {
/** The package separator used to display qualified name of an EPackage. */
private static final String PACKAGE_SEPARATOR = "::"; //$NON-NLS-1$
-
+
/** The icon used for EPackages. */
private final Image ePacakgeIcon = ExtendedImageRegistry.getInstance().getImage(EcoreEditPlugin.INSTANCE.getImage("full/obj16/EPackage")); //$NON-NLS-1$
@@ -163,11 +164,15 @@ public class SelectEMFMetamodelWizardPage extends WizardPage {
if (selection.length == 1) {
dataModel.setSelectedPackage(((Entry<String, Object>) selection[0]).getValue());
String documentation = getDocumentation(dataModel.getSelectedPackage());
- documentationBrowser.setText(documentation);
+ if (documentationBrowser != null) {
+ documentationBrowser.setText(documentation);
+ }
setPageComplete(true);
} else {
dataModel.setSelectedPackage(null);
- documentationBrowser.setText(""); //$NON-NLS-1$
+ if (documentationBrowser != null) {
+ documentationBrowser.setText(""); //$NON-NLS-1$
+ }
setPageComplete(false);
}
}
@@ -184,8 +189,15 @@ public class SelectEMFMetamodelWizardPage extends WizardPage {
Label lblDocumentation = new Label(parent, SWT.NONE);
lblDocumentation.setText(Messages.SelectEMFMetamodelWizardPage_documentationLabel);
- this.documentationBrowser = new Browser(parent, SWT.BORDER);
- this.documentationBrowser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 2));
+ try {
+ this.documentationBrowser = new Browser(parent, SWT.BORDER);
+ this.documentationBrowser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 2));
+ } catch (SWTError error) {
+ /*
+ * The browser could not be created: "hide" the "Documentation" label.
+ */
+ lblDocumentation.setText(""); //$NON-NLS-1$
+ }
}
/**
@@ -257,7 +269,7 @@ public class SelectEMFMetamodelWizardPage extends WizardPage {
} else {
String documentation = getDocumentationFromEPackageExtraData(ePackage);
if (documentation == null) {
- documentation = "<code>" + ePackage.getNsURI() + "</code>"; //$NON-NLS-1$//$NON-NLS-2$
+ documentation = "<code>" + ePackage.getNsURI() + "</code>"; //$NON-NLS-1$//$NON-NLS-2$
} else {
documentation = documentation + "<br><br><smaller><code>" + ePackage.getNsURI() + "</code></smaller>"; //$NON-NLS-1$ //$NON-NLS-2$
}

Back to the top