Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Pascual2014-08-21 09:05:41 +0000
committerCamille Letavernier2014-08-26 11:27:20 +0000
commitf26b097487bc5bf4b858e8f2103f9b776bfb9b78 (patch)
treeb2ad0d5e4b72453f3d498bd89a2700fa9bd0496d /plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties
parent39d755a43184d542634a73b5dd4cd33d66961730 (diff)
downloadorg.eclipse.papyrus-f26b097487bc5bf4b858e8f2103f9b776bfb9b78.tar.gz
org.eclipse.papyrus-f26b097487bc5bf4b858e8f2103f9b776bfb9b78.tar.xz
org.eclipse.papyrus-f26b097487bc5bf4b858e8f2103f9b776bfb9b78.zip
442185: [CSS] NPE when trying to edit a local theme
https://bugs.eclipse.org/bugs/show_bug.cgi?id=442185 - Add behavior for CSS Theme edition starting from CSS file selection when there is no workspace theme Change-Id: I9c1d5c2a5ee9ea8c1cdf0b04a7d12134ecabe32a Signed-off-by: Gabriel Pascual <gabriel.pascual@all4tec.net>
Diffstat (limited to 'plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties')
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/messages.properties3
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/handler/CSSFileHandler.java13
2 files changed, 13 insertions, 3 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/messages.properties b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/messages.properties
index b4cac9de22c..c5fda00b514 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/messages.properties
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/messages.properties
@@ -1,2 +1,5 @@
StyleSheetsPropertyPage.preference.page.label=Add CSS style sheets on project properties to apply them to all models.
StyleSheetsPropertyPage.preference.page.title=CSS Style Sheet
+
+CSSFileHandler.edition.warning.title=CSS Theme Edition
+CSSFileHandler.edition.warning.message=No workspace theme has been defined. Only local themes can be edited. You need to define at least one local theme (See Window > Preferences > Papyrus > CSS Theme)
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/handler/CSSFileHandler.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/handler/CSSFileHandler.java
index ef6d3bd97d3..1b87144ccb6 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/handler/CSSFileHandler.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/handler/CSSFileHandler.java
@@ -23,12 +23,14 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.gmfdiag.css.helper.WorkspaceThemesHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.properties.dialog.CSSThemeCreationDialog;
import org.eclipse.papyrus.infra.gmfdiag.css.properties.dialog.CSSThemeEditionDialog;
+import org.eclipse.papyrus.infra.gmfdiag.css.properties.messages.Messages;
import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme;
import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes;
@@ -107,10 +109,15 @@ public class CSSFileHandler extends AbstractHandler implements IHandler {
}
// Open a specific dialog to edit existing theme according to selection
- CSSThemeEditionDialog dialog = new CSSThemeEditionDialog(shell, workspaceThemes, (IStructuredSelection) selection);
- dialogResult = dialog.open();
+ if (workspaceThemes != null && !workspaceThemes.getThemes().isEmpty()) {
+
+ CSSThemeEditionDialog dialog = new CSSThemeEditionDialog(shell, workspaceThemes, (IStructuredSelection) selection);
+ dialogResult = dialog.open();
- theme = dialog.getEditedTheme();
+ theme = dialog.getEditedTheme();
+ } else {
+ MessageDialog.openWarning(shell, Messages.getString("CSSFileHandler.edition.warning.title"), Messages.getString("CSSFileHandler.edition.warning.message"));
+ }

Back to the top