Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordstadnik2007-04-03 07:37:16 -0400
committerdstadnik2007-04-03 07:37:16 -0400
commitc3368322e105fd887eeec4a843dd7aa57d7e87ae (patch)
tree89c9a8f638a863f586421149292e3706bf50b4ec /devtools
parenteb82c229e32e53a72944225dc89944e063646fbe (diff)
downloadorg.eclipse.gmf-tooling-c3368322e105fd887eeec4a843dd7aa57d7e87ae.tar.gz
org.eclipse.gmf-tooling-c3368322e105fd887eeec4a843dd7aa57d7e87ae.tar.xz
org.eclipse.gmf-tooling-c3368322e105fd887eeec4a843dd7aa57d7e87ae.zip
add action to show bounds
Diffstat (limited to 'devtools')
-rw-r--r--devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderActionGroup.java6
-rw-r--r--devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderLabelProvider.java31
-rw-r--r--devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderView.java12
-rw-r--r--devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/actions/ShowBoundsAction.java36
4 files changed, 85 insertions, 0 deletions
diff --git a/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderActionGroup.java b/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderActionGroup.java
index c9d4e7a5a..98f1885a7 100644
--- a/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderActionGroup.java
+++ b/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderActionGroup.java
@@ -14,6 +14,7 @@ package org.eclipse.gmf.dev.insider.internal.ui;
import org.eclipse.gmf.dev.insider.internal.InsiderAccess;
import org.eclipse.gmf.dev.insider.internal.ui.actions.MemorizeActiveEditorAction;
import org.eclipse.gmf.dev.insider.internal.ui.actions.OpenPresentationAction;
+import org.eclipse.gmf.dev.insider.internal.ui.actions.ShowBoundsAction;
import org.eclipse.gmf.dev.insider.internal.ui.actions.ShowIdsAction;
import org.eclipse.gmf.dev.insider.internal.ui.actions.ShowSimpleTypesAction;
import org.eclipse.jface.action.Action;
@@ -41,6 +42,8 @@ public class InsiderActionGroup extends ActionGroup {
view.setShowSimpleTypes(myShowSimpleTypesAction.isChecked());
myShowIdsAction = new ShowIdsAction(view);
view.setShowIds(myShowIdsAction.isChecked());
+ myShowBoundsAction = new ShowBoundsAction(view);
+ view.setShowBounds(myShowBoundsAction.isChecked());
myClearAction = new Action("Clear") {
public void run() {
@@ -54,6 +57,7 @@ public class InsiderActionGroup extends ActionGroup {
manager.add(myOpenPresentationAction);
manager.add(myShowSimpleTypesAction);
manager.add(myShowIdsAction);
+ manager.add(myShowBoundsAction);
manager.add(new Separator());
myDrill.addNavigationActions(manager);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
@@ -67,6 +71,7 @@ public class InsiderActionGroup extends ActionGroup {
private void fillLocalPullDown(IMenuManager manager) {
manager.add(myShowSimpleTypesAction);
manager.add(myShowIdsAction);
+ manager.add(myShowBoundsAction);
manager.add(myClearAction);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
@@ -79,6 +84,7 @@ public class InsiderActionGroup extends ActionGroup {
private ShowSimpleTypesAction myShowSimpleTypesAction;
private ShowIdsAction myShowIdsAction;
+ private ShowBoundsAction myShowBoundsAction;
private OpenPresentationAction myOpenPresentationAction;
private MemorizeActiveEditorAction myMemorizeActiveEditorAction;
private IAction myClearAction;
diff --git a/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderLabelProvider.java b/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderLabelProvider.java
index 8525cc565..0ceb88a98 100644
--- a/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderLabelProvider.java
+++ b/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderLabelProvider.java
@@ -23,6 +23,8 @@ import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* @author dstadnik
@@ -56,6 +58,26 @@ public class InsiderLabelProvider extends LabelProvider {
type += ' ' + id;
}
}
+ if (isShowBounds()) {
+ NodeList children = element.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child instanceof Element && ElementMetaInfo.BOUNDS_ELEMENT.equals(child.getNodeName())) {
+ Element boundsElement = (Element) child;
+ StringBuffer sb = new StringBuffer();
+ sb.append(" / [");
+ sb.append(boundsElement.getAttribute(ElementMetaInfo.X_ATTRIBUTE));
+ sb.append(',');
+ sb.append(boundsElement.getAttribute(ElementMetaInfo.Y_ATTRIBUTE));
+ sb.append(',');
+ sb.append(boundsElement.getAttribute(ElementMetaInfo.WIDTH_ATTRIBUTE));
+ sb.append(',');
+ sb.append(boundsElement.getAttribute(ElementMetaInfo.HEIGHT_ATTRIBUTE));
+ sb.append("]");
+ type += sb;
+ }
+ }
+ }
return type;
}
return super.getText(object);
@@ -105,6 +127,15 @@ public class InsiderLabelProvider extends LabelProvider {
myShowIds = showIds;
}
+ public final boolean isShowBounds() {
+ return myShowBounds;
+ }
+
+ public void setShowBounds(boolean showBounds) {
+ myShowBounds = showBounds;
+ }
+
private boolean myShowSimpleTypes;
private boolean myShowIds;
+ private boolean myShowBounds;
}
diff --git a/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderView.java b/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderView.java
index 78de2b51e..7e573911c 100644
--- a/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderView.java
+++ b/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/InsiderView.java
@@ -97,6 +97,18 @@ public class InsiderView extends ViewPart {
myViewer.refresh(true);
}
+ public final boolean isShowBounds() {
+ return getLabelProvider().isShowBounds();
+ }
+
+ public void setShowBounds(boolean showBounds) {
+ if (getLabelProvider().isShowBounds() == showBounds) {
+ return;
+ }
+ getLabelProvider().setShowBounds(showBounds);
+ myViewer.refresh(true);
+ }
+
private InsiderLabelProvider getLabelProvider() {
return (InsiderLabelProvider) myViewer.getLabelProvider();
}
diff --git a/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/actions/ShowBoundsAction.java b/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/actions/ShowBoundsAction.java
new file mode 100644
index 000000000..729e9c75d
--- /dev/null
+++ b/devtools/org.eclipse.gmf.dev.insider/src/org/eclipse/gmf/dev/insider/internal/ui/actions/ShowBoundsAction.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2007 Borland Software Corporation
+ *
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+package org.eclipse.gmf.dev.insider.internal.ui.actions;
+
+import org.eclipse.gmf.dev.insider.internal.ui.InsiderView;
+
+/**
+ * @author dstadnik
+ */
+public class ShowBoundsAction extends StatefulAction {
+
+ public ShowBoundsAction(InsiderView view) {
+ super("Bounds");
+ myView = view;
+ }
+
+ protected String getKey() {
+ return "bounds";
+ }
+
+ protected void saveState() {
+ super.saveState();
+ myView.setShowBounds(isChecked());
+ }
+
+ private InsiderView myView;
+}

Back to the top