diff options
author | Christian W. Damus | 2014-02-25 14:26:03 +0000 |
---|---|---|
committer | Christian W. Damus | 2014-02-25 14:26:03 +0000 |
commit | aa39e096c72baf1d24ed629fddc8ce46d8e7e111 (patch) | |
tree | a9d778d6e833be3d66b9af7d02800b086e3470fd /plugins | |
parent | fc47d25bd01993b1fda17c0c2cf862181ac96b92 (diff) | |
download | org.eclipse.papyrus-aa39e096c72baf1d24ed629fddc8ce46d8e7e111.tar.gz org.eclipse.papyrus-aa39e096c72baf1d24ed629fddc8ce46d8e7e111.tar.xz org.eclipse.papyrus-aa39e096c72baf1d24ed629fddc8ce46d8e7e111.zip |
323802: [General] Papyrus shall provide a read only mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=323802
Make presentation of the Reset Style button in the Appearance properties sensitive to the read-only state of the notation view. This requires injecting the CSS property into the widget from the XWT model so that the input may be consulted for editability.
Diffstat (limited to 'plugins')
4 files changed, 27 insertions, 4 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/MultipleStylableElement.xwt b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/MultipleStylableElement.xwt index 208f3a1d236..40dbfbfbce4 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/MultipleStylableElement.xwt +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/MultipleStylableElement.xwt @@ -8,5 +8,5 @@ <Composite.layout>
<GridLayout numColumns="1"></GridLayout>
</Composite.layout>
- <css:ResetStyleWidget input="{Binding}"></css:ResetStyleWidget>
+ <css:ResetStyleWidget input="{Binding}" property="CSS:PapyrusCSSStyle:cssStyle"></css:ResetStyleWidget>
</Composite>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleDiagram.xwt b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleDiagram.xwt index 64704634d72..5d97981f0a2 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleDiagram.xwt +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleDiagram.xwt @@ -18,7 +18,7 @@ <Composite.layout>
<GridLayout></GridLayout>
</Composite.layout>
- <css:ResetStyleWidget input="{Binding}"></css:ResetStyleWidget>
+ <css:ResetStyleWidget input="{Binding}" property="CSS:PapyrusCSSStyle:cssStyle"></css:ResetStyleWidget>
</Composite>
<Composite>
<Composite.layout>
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStylableElement.xwt b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStylableElement.xwt index b4b4f789285..827e0614086 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStylableElement.xwt +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStylableElement.xwt @@ -11,7 +11,7 @@ <Composite.layout>
<GridLayout></GridLayout>
</Composite.layout>
- <css:ResetStyleWidget input="{Binding}"></css:ResetStyleWidget>
+ <css:ResetStyleWidget input="{Binding}" property="CSS:PapyrusCSSStyle:cssStyle"></css:ResetStyleWidget>
</Composite>
<Composite>
<Composite.layout>
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/widgets/ResetStyleWidget.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/widgets/ResetStyleWidget.java index 470316e7202..f0955ffb7ee 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/widgets/ResetStyleWidget.java +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/widgets/ResetStyleWidget.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@ *
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.properties.widgets;
@@ -27,6 +29,8 @@ public class ResetStyleWidget implements SelectionListener { private DataSource input;
+ private String propertyPath;
+
public ResetStyleWidget(Composite parent, int style) {
button = new Button(parent, SWT.PUSH);
button.addSelectionListener(this);
@@ -65,9 +69,28 @@ public class ResetStyleWidget implements SelectionListener { public void setInput(DataSource input) {
this.input = input;
+ checkInput();
}
public DataSource getInput() {
return input;
}
+
+ public String getProperty() {
+ return propertyPath;
+ }
+
+ public void setProperty(String property) {
+ this.propertyPath = property;
+ checkInput();
+ }
+
+ protected void checkInput() {
+ if((propertyPath != null) && (input != null)) {
+ button.setEnabled(input.isEditable(propertyPath));
+ } else {
+ button.setEnabled(true); // For compatibility with XWT models that don't specify the property
+ }
+ }
+
}
|