diff options
author | cletavernie | 2013-01-31 13:52:13 +0000 |
---|---|---|
committer | cletavernie | 2013-01-31 13:52:13 +0000 |
commit | bdacbe98ac748d6e5ae90df0b2e53895487e7670 (patch) | |
tree | c4369bbf8fe3a87598d5f6b5393f7d3db4ec4cf4 /plugins | |
parent | 72046fe397d21186d35240974ceada59f3b23068 (diff) | |
download | org.eclipse.papyrus-bdacbe98ac748d6e5ae90df0b2e53895487e7670.tar.gz org.eclipse.papyrus-bdacbe98ac748d6e5ae90df0b2e53895487e7670.tar.xz org.eclipse.papyrus-bdacbe98ac748d6e5ae90df0b2e53895487e7670.zip |
370797: [Theme] Papyrus should provide a support for CSS files on its diagrams
https://bugs.eclipse.org/bugs/show_bug.cgi?id=370797
Fix the reset style handler
Diffstat (limited to 'plugins')
2 files changed, 16 insertions, 7 deletions
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 ab2618afde8..d514aa3b5d6 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 @@ -42,6 +42,7 @@ public class ResetStyleWidget implements SelectionListener { ResetStyleHandler handler = new ResetStyleHandler();
try {
+ //FIXME: The ExecutionEvent needs the EclipseContext
handler.execute(new ExecutionEvent(null, new HashMap<String, String>(), event, null));
} catch (ExecutionException ex) {
Activator.log.error(ex);
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/handler/ResetStyleHandler.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/handler/ResetStyleHandler.java index 4bb39cfc34c..49d15a4f9c1 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/handler/ResetStyleHandler.java +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/handler/ResetStyleHandler.java @@ -31,11 +31,11 @@ import org.eclipse.gmf.runtime.notation.Style; import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.emf.Activator;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSAnnotations;
@@ -57,13 +57,16 @@ public class ResetStyleHandler extends AbstractHandler { public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection;
+
try {
- selection = ServiceUtilsForHandlers.getInstance().getNestedActiveIEditorPart(event).getSite().getSelectionProvider().getSelection();
- if(selection.isEmpty()) {
- return null;
- }
+ IMultiDiagramEditor editor = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry().getService(IMultiDiagramEditor.class);
+ selection = editor.getEditorSite().getSelectionProvider().getSelection();
} catch (ServiceException ex) {
- Activator.log.error(ex);
+ throw new ExecutionException(ex.getMessage(), ex);
+ }
+
+ // selection = HandlerUtil.getCurrentSelection(event);
+ if(selection == null || selection.isEmpty()) {
return null;
}
@@ -134,6 +137,11 @@ public class ResetStyleHandler extends AbstractHandler { resetStyle((View)viewObject, true);
}
}
+ for(Object lineObject : diagram.getEdges()) {
+ if(lineObject instanceof View) {
+ resetStyle((View)lineObject, true);
+ }
+ }
}
private void resetStyle(View view, boolean recursive) {
|