Refactored dependency view to use the new Zest API
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/.classpath b/visualization/plugins/org.eclipse.pde.visualization.dependency/.classpath
index ce73933..890f69d 100644
--- a/visualization/plugins/org.eclipse.pde.visualization.dependency/.classpath
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/.classpath
@@ -1,7 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry exported="true" kind="lib" path="Graph_1.0.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="org.eclipse.draw2d_3.2.2.200703221218.jar"/>
+ <classpathentry exported="true" kind="lib" path="org.eclipse.mylar.zest.layouts_0.3.1.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4">
+ <accessrules>
+ <accessrule kind="nonaccessible" pattern="**/System/**"/>
+ </accessrules>
+ </classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/Graph_1.0.0.jar b/visualization/plugins/org.eclipse.pde.visualization.dependency/Graph_1.0.0.jar
new file mode 100644
index 0000000..a87041e
--- /dev/null
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/Graph_1.0.0.jar
Binary files differ
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/META-INF/MANIFEST.MF b/visualization/plugins/org.eclipse.pde.visualization.dependency/META-INF/MANIFEST.MF
index f3e9116..4621b44 100644
--- a/visualization/plugins/org.eclipse.pde.visualization.dependency/META-INF/MANIFEST.MF
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/META-INF/MANIFEST.MF
@@ -7,10 +7,10 @@
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.pde.ui,
- org.eclipse.ui.forms,
- org.eclipse.gef,
- org.eclipse.mylar.zest.core,
- org.eclipse.mylar.zest.layouts
+ org.eclipse.ui.forms
Eclipse-LazyStart: true
-Bundle-ClassPath: .
+Bundle-ClassPath: .,
+ Graph_1.0.0.jar,
+ org.eclipse.draw2d_3.2.2.200703221218.jar,
+ org.eclipse.mylar.zest.layouts_0.3.1.jar
Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/build.properties b/visualization/plugins/org.eclipse.pde.visualization.dependency/build.properties
index c8fdd1e..bcf7c79 100644
--- a/visualization/plugins/org.eclipse.pde.visualization.dependency/build.properties
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/build.properties
@@ -1,6 +1,9 @@
bin.includes = META-INF/,\
plugin.xml,\
- .
+ .,\
+ Graph_1.0.0.jar,\
+ org.eclipse.draw2d_3.2.2.200703221218.jar,\
+ org.eclipse.mylar.zest.layouts_0.3.1.jar
src.includes = src/,\
plugin.xml,\
META-INF/
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/org.eclipse.draw2d_3.2.2.200703221218.jar b/visualization/plugins/org.eclipse.pde.visualization.dependency/org.eclipse.draw2d_3.2.2.200703221218.jar
new file mode 100644
index 0000000..fbc15ed
--- /dev/null
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/org.eclipse.draw2d_3.2.2.200703221218.jar
Binary files differ
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/org.eclipse.mylar.zest.layouts_0.3.1.jar b/visualization/plugins/org.eclipse.pde.visualization.dependency/org.eclipse.mylar.zest.layouts_0.3.1.jar
new file mode 100644
index 0000000..c2bab40
--- /dev/null
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/org.eclipse.mylar.zest.layouts_0.3.1.jar
Binary files differ
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/AbstractVisualizationLabelProvider.java b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/AbstractVisualizationLabelProvider.java
index 5c8dc97..866a4d2 100644
--- a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/AbstractVisualizationLabelProvider.java
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/AbstractVisualizationLabelProvider.java
@@ -1,27 +1,25 @@
/*******************************************************************************
- * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC, Canada.
- * 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
+ * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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:
- * The Chisel Group, University of Victoria
- * IBM CAS, IBM Toronto Lab
- *******************************************************************************/
+ *
+ * Contributors: The Chisel Group, University of Victoria IBM CAS, IBM Toronto
+ * Lab
+ ******************************************************************************/
package org.eclipse.pde.visualization.dependency.views;
import java.util.HashSet;
import java.util.Iterator;
+import org.eclipse.draw2d.IFigure;
import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.mylar.zest.core.IZestColorConstants;
-import org.eclipse.mylar.zest.core.ZestPlugin;
import org.eclipse.mylar.zest.core.ZestStyles;
-import org.eclipse.mylar.zest.core.viewers.EntityConnectionData;
-import org.eclipse.mylar.zest.core.viewers.IConnectionStyleProvider;
-import org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider;
-import org.eclipse.mylar.zest.core.viewers.StaticGraphViewer;
+import org.eclipse.mylar.zest.core.viewer.EntityConnectionData;
+import org.eclipse.mylar.zest.core.viewer.IConnectionStyleProvider;
+import org.eclipse.mylar.zest.core.viewer.IEntityStyleProvider;
+import org.eclipse.mylar.zest.core.viewer.StaticGraphViewer;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
@@ -29,12 +27,38 @@
import org.eclipse.swt.widgets.Display;
/**
- * Computes the colour of the labels and connections. This is subclassed depending on the
- * view style used.
+ * Computes the colour of the labels and connections. This is subclassed
+ * depending on the view style used.
+ *
* @author Ian Bull
*/
-abstract class AbstractVisualizationLabelProvider implements VisualizationLabelProvider, IConnectionStyleProvider,
- IEntityStyleProvider {
+abstract class AbstractVisualizationLabelProvider implements VisualizationLabelProvider, IConnectionStyleProvider, IEntityStyleProvider {
+
+ public Color LIGHT_BLUE = new Color(Display.getDefault(), 216, 228, 248);
+ public Color DARK_BLUE = new Color(Display.getDefault(), 1, 70, 122);
+ public Color GREY_BLUE = new Color(Display.getDefault(), 139, 150, 171);
+ public Color LIGHT_BLUE_CYAN = new Color(Display.getDefault(), 213, 243, 255);
+ public Color LIGHT_YELLOW = new Color(Display.getDefault(), 255, 255, 206);
+ public Color GRAY = new Color(Display.getDefault(), 128, 128, 128);
+ public Color LIGHT_GRAY = new Color(Display.getDefault(), 220, 220, 220);
+ public Color BLACK = new Color(Display.getDefault(), 0, 0, 0);
+ public Color RED = new Color(Display.getDefault(), 255, 0, 0);
+ public Color DARK_RED = new Color(Display.getDefault(), 127, 0, 0);
+ public Color ORANGE = new Color(Display.getDefault(), 255, 196, 0);
+ public Color YELLOW = new Color(Display.getDefault(), 255, 255, 0);
+ public Color GREEN = new Color(Display.getDefault(), 0, 255, 0);
+ public Color DARK_GREEN = new Color(Display.getDefault(), 0, 127, 0);
+ public Color LIGHT_GREEN = new Color(Display.getDefault(), 96, 255, 96);
+ public Color CYAN = new Color(Display.getDefault(), 0, 255, 255);
+ public Color BLUE = new Color(Display.getDefault(), 0, 0, 255);
+ public Color WHITE = new Color(Display.getDefault(), 255, 255, 255);
+ public Color EDGE_WEIGHT_0 = new Color(Display.getDefault(), 192, 192, 255);
+ public Color EDGE_WEIGHT_01 = new Color(Display.getDefault(), 64, 128, 225);
+ public Color EDGE_WEIGHT_02 = new Color(Display.getDefault(), 32, 32, 128);
+ public Color EDGE_WEIGHT_03 = new Color(Display.getDefault(), 0, 0, 128);
+ public Color EDGE_DEFAULT = new Color(Display.getDefault(), 64, 64, 128);
+ public Color EDGE_HIGHLIGHT = new Color(Display.getDefault(), 192, 32, 32);
+ public Color DISABLED = new Color(Display.getDefault(), 230, 240, 250);
private BundleDescription selected = null;
protected BundleDescription rootNode = null;
@@ -46,13 +70,12 @@
/**
* Create a new Abstract Visualization Label Provider
+ *
* @param viewer
*/
public AbstractVisualizationLabelProvider(StaticGraphViewer viewer) {
this.viewer = viewer;
}
-
-
public Image getImage(Object element) {
/*
@@ -74,7 +97,6 @@
}
-
public boolean isLabelProperty(Object element, String property) {
return false;
@@ -85,24 +107,31 @@
}
public Color getColor(Object rel) {
- if (interestingRelationships.contains(rel))
- return ZestPlugin.getDefault().getColor(IZestColorConstants.DARK_RED);
- return ZestPlugin.getDefault().getColor(IZestColorConstants.LIGHT_GRAY);
+ if (interestingRelationships.contains(rel)) {
+ return DARK_RED;
+ }
+ return LIGHT_GRAY;
}
public int getConnectionStyle(Object rel) {
- if (interestingRelationships.contains(rel))
+ if (interestingRelationships.contains(rel)) {
return ZestStyles.CONNECTIONS_DASH | ZestStyles.CONNECTIONS_DIRECTED;
+ }
return ZestStyles.CONNECTIONS_DIRECTED;
}
public Color getHighlightColor(Object rel) {
- return ZestPlugin.getDefault().getColor(IZestColorConstants.DARK_RED);
+ return DARK_RED;
+ }
+
+ public Color getNodeHighlightColor(Object entity) {
+ return null;
}
public int getLineWidth(Object rel) {
- if (interestingRelationships.contains(rel))
+ if (interestingRelationships.contains(rel)) {
return 3;
+ }
return 0;
}
@@ -115,16 +144,17 @@
if (entity == this.selected || entity == this.pinnedNode) {
// If this is the selected node return no colour. The default
// selected colour is fine.
- return ZestPlugin.getDefault().getColor(IZestColorConstants.BLACK);
+ return BLACK;
} else if (interestingDependencies.contains(entity)) {
// If this entity is directly connected to the selected entity
- return ZestPlugin.getDefault().getColor(IZestColorConstants.BLACK);
- } else
- return ZestPlugin.getDefault().getColor(IZestColorConstants.LIGHT_GRAY);
+ return BLACK;
+ } else {
+ return LIGHT_GRAY;
+ }
}
- return ZestPlugin.getDefault().getColor(IZestColorConstants.BLACK);
+ return BLACK;
}
public Color getBorderHighlightColor(Object entity) {
@@ -142,11 +172,12 @@
public Color getBackgroundColour(Object entity) {
if (entity == this.selected || this.pinnedNode == entity) {
- return ZestPlugin.getDefault().getColor(IZestColorConstants.NODE_DEFAULT_HIGHLIGHT);
+ return viewer.getGraphControl().DEFAULT_NODE_COLOR;
} else if (interestingDependencies.contains(entity)) {
- return ZestPlugin.getDefault().getColor(IZestColorConstants.NODE_DEFAULT_ADJACENT);
- } else
+ return viewer.getGraphControl().HIGHLIGHT_ADJACENT_COLOR;
+ } else {
return getDisabledColor();
+ }
}
public Color getForegroundColour(Object entity) {
@@ -154,15 +185,16 @@
if (entity == this.selected || this.pinnedNode == entity) {
// If this is the selected node return no colour. The default
// selected colour is fine.
- return ZestPlugin.getDefault().getColor(IZestColorConstants.BLACK);
+ return BLACK;
} else if (interestingDependencies.contains(entity)) {
// If this entity is directly connected to the selected entity
- return ZestPlugin.getDefault().getColor(IZestColorConstants.BLACK);
- } else
- return ZestPlugin.getDefault().getColor(IZestColorConstants.GRAY);
+ return BLACK;
+ } else {
+ return GRAY;
+ }
}
- return ZestPlugin.getDefault().getColor(IZestColorConstants.BLACK);
+ return BLACK;
}
/*
@@ -175,13 +207,15 @@
}
protected BundleDescription getSelected() {
- if (pinnedNode != null)
+ if (pinnedNode != null) {
return pinnedNode;
+ }
return selected;
}
/**
- * Sets the current selection
+ * Sets the current selection
+ *
* @param root
* @param currentSelection
*/
@@ -196,22 +230,24 @@
this.selected = null;
this.selected = (BundleDescription) currentSelection;
-
+
interestingRelationships = new HashSet();
interestingDependencies = new HashSet();
- if (this.selected != null || this.pinnedNode != null)
+ if (this.selected != null || this.pinnedNode != null) {
calculateInterestingDependencies(interestingRelationships, interestingDependencies);
-
+ }
+
for (Iterator iter = interestingRelationships.iterator(); iter.hasNext();) {
Object entityConnectionData = iter.next();
viewer.reveal(entityConnectionData);
}
-
+
}
/**
- * Calculate all the interesting dependencies. Create an instance of this method to
- * calculate the entities and relationships that should "stand-out" for this view.
+ * Calculate all the interesting dependencies. Create an instance of this
+ * method to calculate the entities and relationships that should
+ * "stand-out" for this view.
*
* @param interestingRels
* @param interestingEntities
@@ -221,19 +257,27 @@
public Object[] getInterestingRelationships() {
return interestingRelationships.toArray();
}
-
+
/**
* Creates a colour for disabled lines.
+ *
* @return
*/
private Color getDisabledColor() {
- if (disabledColor == null)
+ if (disabledColor == null) {
disabledColor = new Color(Display.getDefault(), new RGB(225, 238, 255));
+ }
return disabledColor;
}
-
+
+ public IFigure getTooltip(Object entity) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
/*
* (non-Javadoc)
+ *
* @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
*/
public void dispose() {
@@ -243,4 +287,9 @@
}
}
+ public IFigure getNodeFigure(Object entity) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
\ No newline at end of file
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/AnalysisUtil.java b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/AnalysisUtil.java
index 38f8615..1ffb9a3 100644
--- a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/AnalysisUtil.java
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/AnalysisUtil.java
@@ -1,14 +1,13 @@
/*******************************************************************************
- * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC, Canada.
- * 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
+ * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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:
- * The Chisel Group, University of Victoria
- * IBM CAS, IBM Toronto Lab
- *******************************************************************************/
+ *
+ * Contributors: The Chisel Group, University of Victoria IBM CAS, IBM Toronto
+ * Lab
+ ******************************************************************************/
package org.eclipse.pde.visualization.dependency.views;
import java.util.ArrayList;
@@ -27,18 +26,18 @@
/**
*
* @author Ian Bull
- *
+ *
*/
public class AnalysisUtil {
-
- public static BundleDescription[] getPath(BundleDescription root, BundleDescription bundle ) {
+
+ public static BundleDescription[] getPath(BundleDescription root, BundleDescription bundle) {
LinkedList q = new LinkedList();
Set orderedSet = new HashSet();
LinkedList orderedList = new LinkedList();
q.add(root);
- while(!q.isEmpty()) {
+ while (!q.isEmpty()) {
BundleDescription head = (BundleDescription) q.remove(0);
- if ( !orderedSet.contains(head)) {
+ if (!orderedSet.contains(head)) {
orderedSet.add(head);
orderedList.add(head);
buildQueue(head, q);
@@ -47,128 +46,140 @@
BundleDescription[] path = modifiedDijkstra(orderedList, root, bundle);
return path;
}
-
+
private static void buildQueue(BundleDescription root, LinkedList q) {
BundleDescription[] descriptions = getDependencies(root);
- if ( descriptions == null || descriptions.length == 0 ) return;
+ if (descriptions == null || descriptions.length == 0) {
+ return;
+ }
for (int i = 0; i < descriptions.length; i++) {
q.add(descriptions[i]);
}
}
-
-
+
public static BundleDescription[] modifiedDijkstra(LinkedList q, BundleDescription s, BundleDescription t) {
HashMap previous = new HashMap();
HashMap dValues = new HashMap();
- for( Iterator iter = q.iterator(); iter.hasNext(); ) {
- dValues.put(iter.next(), new Integer(Integer.MAX_VALUE/ 10));
+ for (Iterator iter = q.iterator(); iter.hasNext();) {
+ dValues.put(iter.next(), new Integer(Integer.MAX_VALUE / 10));
}
dValues.put(s, new Integer(0));
-
- while ( !q.isEmpty() ) {
+
+ while (!q.isEmpty()) {
BundleDescription head = (BundleDescription) q.remove(0);
BundleDescription[] outgoing = getDependencies(head);
+ if (outgoing == null) {
+ // @tag PDE bug : I guess null in my array of dependencies
+ continue;
+ }
for (int i = 0; i < outgoing.length; i++) {
BundleDescription v = outgoing[i];
- if ( ((Integer)dValues.get(head)).intValue() + 1 < ((Integer)dValues.get(v)).intValue()) {
+ if (((Integer) dValues.get(head)).intValue() + 1 < ((Integer) dValues.get(v)).intValue()) {
previous.put(v, head);
- dValues.put(v, new Integer(((Integer)dValues.get(head)).intValue() + 1));
+ dValues.put(v, new Integer(((Integer) dValues.get(head)).intValue() + 1));
}
}
}
LinkedList path = new LinkedList();
BundleDescription currentNode = t;
- while ( previous.containsKey(currentNode) ) {
+ while (previous.containsKey(currentNode)) {
path.add(currentNode);
currentNode = (BundleDescription) previous.get(currentNode);
}
path.add(currentNode);
return (BundleDescription[]) path.toArray(new BundleDescription[path.size()]);
}
-
+
public static BundleDescription[] getCallers(BundleDescription bundle, BundleDescription[] bundles) {
HashSet callers = new HashSet();
for (int i = 0; i < bundles.length; i++) {
HashSet hashSet = new HashSet();
hashSet.addAll(Arrays.asList(getDependencies(bundles[i])));
- if ( hashSet.contains(bundle)) {
+ if (hashSet.contains(bundle)) {
callers.add(bundles[i]);
}
}
return (BundleDescription[]) callers.toArray(new BundleDescription[callers.size()]);
}
-
+
/**
* Finds all the callers for bundle within bunldes[]
+ *
* @return
*/
public static BundleDescription[] getAllCallers(BundleDescription bundle, BundleDescription[] bundles) {
HashSet callers = new HashSet();
for (int i = 0; i < bundles.length; i++) {
HashSet hashSet = new HashSet();
- hashSet.addAll(Arrays.asList(getPrerequisites(new BundleDescription[]{bundles[i]})));
- if ( hashSet.contains(bundle)) {
+ hashSet.addAll(Arrays.asList(getPrerequisites(new BundleDescription[] { bundles[i] })));
+ if (hashSet.contains(bundle)) {
callers.add(bundles[i]);
}
}
return (BundleDescription[]) callers.toArray(new BundleDescription[callers.size()]);
}
-
+
public static BundleDescription[] getPrerequisites(BundleDescription[] bundles) {
- if (bundles == null || bundles.length == 0)
+ if (bundles == null || bundles.length == 0) {
return new BundleDescription[0];
+ }
Set reachable = new HashSet(bundles.length);
- for (int i = 0; i < bundles.length; i++)
+ for (int i = 0; i < bundles.length; i++) {
addPrerequisites(bundles[i], reachable);
+ }
return (BundleDescription[]) reachable.toArray(new BundleDescription[reachable.size()]);
}
-
- private static Collection getExportedDescription( BundleDescription element, ExportPackageDescription[] exportedPackages ) {
+
+ private static Collection getExportedDescription(BundleDescription element, ExportPackageDescription[] exportedPackages) {
Set descriptionList = new HashSet();
- for ( int i = 0; i < exportedPackages.length; i++ ) {
+ for (int i = 0; i < exportedPackages.length; i++) {
ExportPackageDescription exportedPackage = exportedPackages[i];
- if ( !element.getLocation().equals(exportedPackage.getExporter().getLocation()))
+ if (!element.getLocation().equals(exportedPackage.getExporter().getLocation())) {
descriptionList.add(exportedPackage.getExporter());
+ }
}
return descriptionList;
}
-
public static BundleDescription[] getDependencies(BundleDescription bundle) {
- if ( bundle == null ) return null;
-
-
+
+ if (bundle == null) {
+ return null;
+ }
+
Collection c = AnalysisUtil.getDescription(bundle.getRequiredBundles());
c.addAll(getExportedDescription(bundle, bundle.getResolvedImports()));
/*
- Iterator iterator = c.iterator();
- while (iterator.hasNext() ) {
- if ( iterator.next() == null ) iterator.remove();
- }
- */
+ * Iterator iterator = c.iterator(); while (iterator.hasNext() ) { if (
+ * iterator.next() == null ) iterator.remove(); }
+ */
return (BundleDescription[]) c.toArray(new BundleDescription[c.size()]);
}
private static void addPrerequisites(BundleDescription bundle, Set reachable) {
- if (reachable.contains(bundle))
+ if (reachable.contains(bundle)) {
return;
+ }
reachable.add(bundle);
-
- BundleDescription[] dependencies =getDependencies(bundle);
- for (int i = 0; i < dependencies.length; i++) {
+ BundleDescription[] dependencies = getDependencies(bundle);
+ for (int i = 0; i < dependencies.length; i++) {
+ if (dependencies[i] == null) {
+ //@tag PDE bug : I guess null in my array of dependencies
+ continue;
+ }
addPrerequisites(dependencies[i], reachable);
}
}
-
- public static Collection getDescription( BundleSpecification[] specifications ) {
+
+ public static Collection getDescription(BundleSpecification[] specifications) {
ArrayList descriptionList = new ArrayList();
- for ( int i = 0; i < specifications.length; i++ ) {
+ for (int i = 0; i < specifications.length; i++) {
BundleSpecification specification = specifications[i];
descriptionList.add(specification.getSupplier());
}
return descriptionList;
}
-
+
}
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/GraphContentProvider.java b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/GraphContentProvider.java
index 2e85704..e9b2d95 100644
--- a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/GraphContentProvider.java
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/GraphContentProvider.java
@@ -1,24 +1,23 @@
/*******************************************************************************
- * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC, Canada.
- * 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
+ * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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:
- * The Chisel Group, University of Victoria
- * IBM CAS, IBM Toronto Lab
- *******************************************************************************/
+ *
+ * Contributors: The Chisel Group, University of Victoria IBM CAS, IBM Toronto
+ * Lab
+ ******************************************************************************/
package org.eclipse.pde.visualization.dependency.views;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.mylar.zest.core.viewers.IGraphEntityContentProvider;
+import org.eclipse.mylar.zest.core.viewer.IGraphEntityContentProvider;
import org.eclipse.osgi.service.resolver.BundleDescription;
/**
*
* @author Ian Bull
- *
+ *
*/
class GraphContentProvider implements IGraphEntityContentProvider {
@@ -27,7 +26,7 @@
private BundleDescription[] getDependencies(BundleDescription bundle) {
if (bundle != null) {
return AnalysisUtil.getPrerequisites(new BundleDescription[] { currentBundle });
- }
+ }
return new BundleDescription[0];
}
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/HighlightDependencyLableProvider.java b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/HighlightDependencyLableProvider.java
index 05356be..0925395 100644
--- a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/HighlightDependencyLableProvider.java
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/HighlightDependencyLableProvider.java
@@ -1,26 +1,25 @@
/*******************************************************************************
- * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC, Canada.
- * 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
+ * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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:
- * The Chisel Group, University of Victoria
- * IBM CAS, IBM Toronto Lab
- *******************************************************************************/
+ *
+ * Contributors: The Chisel Group, University of Victoria IBM CAS, IBM Toronto
+ * Lab
+ ******************************************************************************/
package org.eclipse.pde.visualization.dependency.views;
import java.util.HashSet;
-import org.eclipse.mylar.zest.core.viewers.EntityConnectionData;
-import org.eclipse.mylar.zest.core.viewers.StaticGraphViewer;
+import org.eclipse.mylar.zest.core.viewer.EntityConnectionData;
+import org.eclipse.mylar.zest.core.viewer.StaticGraphViewer;
import org.eclipse.osgi.service.resolver.BundleDescription;
/**
*
* @author Ian Bull
- *
+ *
*/
class HighlightDependencyLableProvider extends AbstractVisualizationLabelProvider {
@@ -28,8 +27,7 @@
super(viewer);
}
- protected void calculateInterestingDependencies(HashSet interestingRels,
- HashSet interestingEntities) {
+ protected void calculateInterestingDependencies(HashSet interestingRels, HashSet interestingEntities) {
if (getSelected() != null) {
BundleDescription[] descriptions = AnalysisUtil.getDependencies(this.getSelected());
@@ -38,7 +36,7 @@
interestingRels.add(entityConnectionData);
interestingEntities.add(descriptions[i]);
}
- }
+ }
}
}
\ No newline at end of file
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/PathDependencyAnalysis.java b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/PathDependencyAnalysis.java
index e9277b2..009c193 100644
--- a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/PathDependencyAnalysis.java
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/PathDependencyAnalysis.java
@@ -1,45 +1,42 @@
/*******************************************************************************
- * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC, Canada.
- * 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
+ * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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:
- * The Chisel Group, University of Victoria
- * IBM CAS, IBM Toronto Lab
- *******************************************************************************/
+ *
+ * Contributors: The Chisel Group, University of Victoria IBM CAS, IBM Toronto
+ * Lab
+ ******************************************************************************/
package org.eclipse.pde.visualization.dependency.views;
import java.util.Arrays;
import java.util.HashSet;
-import org.eclipse.mylar.zest.core.viewers.EntityConnectionData;
-import org.eclipse.mylar.zest.core.viewers.StaticGraphViewer;
+import org.eclipse.mylar.zest.core.viewer.EntityConnectionData;
+import org.eclipse.mylar.zest.core.viewer.StaticGraphViewer;
import org.eclipse.osgi.service.resolver.BundleDescription;
/**
*
* @author Ian Bull
- *
+ *
*/
-public class PathDependencyAnalysis extends
- AbstractVisualizationLabelProvider {
+public class PathDependencyAnalysis extends AbstractVisualizationLabelProvider {
public PathDependencyAnalysis(StaticGraphViewer viewer) {
super(viewer);
}
- protected void calculateInterestingDependencies(
- HashSet interestingRels, HashSet interestingEntities) {
-
- if ( this.getSelected() != null ) {
- BundleDescription[] descriptions = AnalysisUtil.getAllCallers(this.getSelected(), AnalysisUtil.getPrerequisites(new BundleDescription[]{this.rootNode}));
- for (int i = 0; i < descriptions.length; i++) {
- for ( int j = 0; j < descriptions.length; j++ ) {
- EntityConnectionData entityConnectionData = new EntityConnectionData(descriptions[i],descriptions[j]);
- interestingRels.add(entityConnectionData);
- }
+ protected void calculateInterestingDependencies(HashSet interestingRels, HashSet interestingEntities) {
+
+ if (this.getSelected() != null) {
+ BundleDescription[] descriptions = AnalysisUtil.getAllCallers(this.getSelected(), AnalysisUtil.getPrerequisites(new BundleDescription[] { this.rootNode }));
+ for (int i = 0; i < descriptions.length; i++) {
+ for (int j = 0; j < descriptions.length; j++) {
+ EntityConnectionData entityConnectionData = new EntityConnectionData(descriptions[i], descriptions[j]);
+ interestingRels.add(entityConnectionData);
+ }
}
interestingEntities.addAll(Arrays.asList(descriptions));
}
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/PluginVisualizationView.java b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/PluginVisualizationView.java
index 33cb1ee..14e5cf7 100644
--- a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/PluginVisualizationView.java
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/PluginVisualizationView.java
@@ -1,14 +1,13 @@
/*******************************************************************************
- * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC, Canada.
- * 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
+ * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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:
- * The Chisel Group, University of Victoria
- * IBM CAS, IBM Toronto Lab
- *******************************************************************************/
+ *
+ * Contributors: The Chisel Group, University of Victoria IBM CAS, IBM Toronto
+ * Lab
+ ******************************************************************************/
package org.eclipse.pde.visualization.dependency.views;
import java.util.Stack;
@@ -25,11 +24,11 @@
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.mylar.zest.core.ZestStyles;
-import org.eclipse.mylar.zest.core.viewers.AbstractZoomableViewer;
-import org.eclipse.mylar.zest.core.viewers.IGraphEntityContentProvider;
-import org.eclipse.mylar.zest.core.viewers.IZoomableWorkbenchPart;
-import org.eclipse.mylar.zest.core.viewers.StaticGraphViewer;
-import org.eclipse.mylar.zest.core.viewers.ZoomContributionViewItem;
+import org.eclipse.mylar.zest.core.viewer.AbstractZoomableViewer;
+import org.eclipse.mylar.zest.core.viewer.IGraphEntityContentProvider;
+import org.eclipse.mylar.zest.core.viewer.IZoomableWorkbenchPart;
+import org.eclipse.mylar.zest.core.viewer.StaticGraphViewer;
+import org.eclipse.mylar.zest.core.viewer.ZoomContributionViewItem;
import org.eclipse.mylar.zest.layouts.LayoutAlgorithm;
import org.eclipse.mylar.zest.layouts.LayoutStyles;
import org.eclipse.mylar.zest.layouts.algorithms.CompositeLayoutAlgorithm;
@@ -75,6 +74,8 @@
private VisualizationLabelProvider currentLabelProvider;
private IGraphEntityContentProvider contentProvider;
private Object pinnedNode = null;
+ private ZoomContributionViewItem contextZoomContributionViewItem;
+ private ZoomContributionViewItem toolbarZoomContributionViewItem;
/**
* The constructor.
@@ -100,17 +101,17 @@
viewer.setLabelProvider(this.currentLabelProvider);
viewer.setInput(null);
viewer.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED);
- viewer.setLayoutAlgorithm(new CompositeLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING,
- new LayoutAlgorithm[] { new TreeLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING),
- new HorizontalShift(LayoutStyles.NO_LAYOUT_NODE_RESIZING) }));
+ viewer.setLayoutAlgorithm(new CompositeLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING, new LayoutAlgorithm[] { new TreeLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING), new HorizontalShift(LayoutStyles.NO_LAYOUT_NODE_RESIZING) }));
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
- PluginVisualizationView.this.selectionChanged(((IStructuredSelection) event.getSelection())
- .getFirstElement());
+ PluginVisualizationView.this.selectionChanged(((IStructuredSelection) event.getSelection()).getFirstElement());
}
});
+ toolbarZoomContributionViewItem = new ZoomContributionViewItem(this);
+ contextZoomContributionViewItem = new ZoomContributionViewItem(this);
+
makeActions();
hookContextMenu();
fillToolBar();
@@ -124,19 +125,23 @@
*/
void setDependencyPath(boolean dependencyPath, String dependencyPathType) {
// If the viewer has not been created, return
- if (viewer == null)
+ if (viewer == null) {
return;
+ }
if (dependencyPath) {
// If dependencyPath is set to true set the
// ShortestPathDependencyAnalyis label provider
- if (dependencyPathType == VisualizationForm.Show_Smart_Path)
+ if (dependencyPathType == VisualizationForm.Show_Smart_Path) {
this.currentLabelProvider = new SmartPathDependencyAnalysis(this.viewer);
- if (dependencyPathType == VisualizationForm.Show_All_Paths)
+ }
+ if (dependencyPathType == VisualizationForm.Show_All_Paths) {
this.currentLabelProvider = new PathDependencyAnalysis(this.viewer);
- if (dependencyPathType == VisualizationForm.Show_Shortest_Path)
+ }
+ if (dependencyPathType == VisualizationForm.Show_Shortest_Path) {
this.currentLabelProvider = new ShortestPathDependencyAnalysis(this.viewer);
+ }
viewer.setLabelProvider(this.currentLabelProvider);
@@ -151,8 +156,7 @@
this.currentLabelProvider.setPinnedNode((BundleDescription) pinnedNode);
if (viewer.getSelection() != null) {
viewer.setSelection(viewer.getSelection());
- this.currentLabelProvider.setCurrentSelection(currentNode, ((IStructuredSelection) viewer.getSelection())
- .getFirstElement());
+ this.currentLabelProvider.setCurrentSelection(currentNode, ((IStructuredSelection) viewer.getSelection()).getFirstElement());
}
}
@@ -172,6 +176,8 @@
*/
private void fillToolBar() {
IActionBars bars = getViewSite().getActionBars();
+ bars.getMenuManager().add(toolbarZoomContributionViewItem);
+
fillLocalToolBar(bars.getToolBarManager());
}
@@ -286,8 +292,7 @@
private void pinNode(Object objectToPin) {
this.currentLabelProvider.setPinnedNode((BundleDescription) objectToPin);
this.pinnedNode = objectToPin;
- this.currentLabelProvider.setCurrentSelection(this.currentNode, ((IStructuredSelection) viewer.getSelection())
- .getFirstElement());
+ this.currentLabelProvider.setCurrentSelection(this.currentNode, ((IStructuredSelection) viewer.getSelection()).getFirstElement());
this.viewer.update(contentProvider.getElements(currentNode), null);
}
@@ -297,14 +302,18 @@
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
+ fillContextMenu(menuMgr);
+
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
PluginVisualizationView.this.fillContextMenu(manager);
+
}
});
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
+
}
/**
@@ -336,8 +345,7 @@
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
manager.add(historyAction);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- ZoomContributionViewItem contributionViewItem = new ZoomContributionViewItem(this.getSite().getPage());
- manager.add(contributionViewItem);
+ manager.add(contextZoomContributionViewItem);
}
/**
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/ShortestPathDependencyAnalysis.java b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/ShortestPathDependencyAnalysis.java
index 2158821..09316f1 100644
--- a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/ShortestPathDependencyAnalysis.java
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/ShortestPathDependencyAnalysis.java
@@ -1,45 +1,42 @@
/*******************************************************************************
- * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC, Canada.
- * 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
+ * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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:
- * The Chisel Group, University of Victoria
- * IBM CAS, IBM Toronto Lab
- *******************************************************************************/
+ *
+ * Contributors: The Chisel Group, University of Victoria IBM CAS, IBM Toronto
+ * Lab
+ ******************************************************************************/
package org.eclipse.pde.visualization.dependency.views;
import java.util.Arrays;
import java.util.HashSet;
-import org.eclipse.mylar.zest.core.viewers.EntityConnectionData;
-import org.eclipse.mylar.zest.core.viewers.StaticGraphViewer;
+import org.eclipse.mylar.zest.core.viewer.EntityConnectionData;
+import org.eclipse.mylar.zest.core.viewer.StaticGraphViewer;
import org.eclipse.osgi.service.resolver.BundleDescription;
/**
*
* @author Ian Bull
*/
-public class ShortestPathDependencyAnalysis extends
- AbstractVisualizationLabelProvider {
+public class ShortestPathDependencyAnalysis extends AbstractVisualizationLabelProvider {
public ShortestPathDependencyAnalysis(StaticGraphViewer viewer) {
super(viewer);
}
- protected void calculateInterestingDependencies(
- HashSet interestingRels, HashSet interestingEntities) {
-
- if ( this.getSelected() != null ) {
- BundleDescription[] descriptions = AnalysisUtil.getPath(this.rootNode, this.getSelected());
-
- for (int i = 0; i < descriptions.length; i++) {
- for ( int j = 0; j < descriptions.length; j++ ) {
- EntityConnectionData entityConnectionData = new EntityConnectionData(descriptions[i],descriptions[j]);
- interestingRels.add(entityConnectionData);
- }
+ protected void calculateInterestingDependencies(HashSet interestingRels, HashSet interestingEntities) {
+
+ if (this.getSelected() != null) {
+ BundleDescription[] descriptions = AnalysisUtil.getPath(this.rootNode, this.getSelected());
+
+ for (int i = 0; i < descriptions.length; i++) {
+ for (int j = 0; j < descriptions.length; j++) {
+ EntityConnectionData entityConnectionData = new EntityConnectionData(descriptions[i], descriptions[j]);
+ interestingRels.add(entityConnectionData);
+ }
}
interestingEntities.addAll(Arrays.asList(descriptions));
}
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/SmartPathDependencyAnalysis.java b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/SmartPathDependencyAnalysis.java
index 64c5cfe..34e176e 100644
--- a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/SmartPathDependencyAnalysis.java
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/SmartPathDependencyAnalysis.java
@@ -1,46 +1,48 @@
/*******************************************************************************
- * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC, Canada.
- * 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
+ * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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:
- * The Chisel Group, University of Victoria
- * IBM CAS, IBM Toronto Lab
- *******************************************************************************/
+ *
+ * Contributors: The Chisel Group, University of Victoria IBM CAS, IBM Toronto
+ * Lab
+ ******************************************************************************/
package org.eclipse.pde.visualization.dependency.views;
import java.util.Arrays;
import java.util.HashSet;
-import org.eclipse.mylar.zest.core.viewers.EntityConnectionData;
-import org.eclipse.mylar.zest.core.viewers.StaticGraphViewer;
+import org.eclipse.mylar.zest.core.viewer.EntityConnectionData;
+import org.eclipse.mylar.zest.core.viewer.StaticGraphViewer;
import org.eclipse.osgi.service.resolver.BundleDescription;
/**
*
- * This computues the nodes and edges in the "smart" path. The smart path consists of all
- * your direct dependencies that have paths to the selected nodes.
+ * This computues the nodes and edges in the "smart" path. The smart path
+ * consists of all your direct dependencies that have paths to the selected
+ * nodes.
*
* @author Ian Bull
- *
+ *
*/
public class SmartPathDependencyAnalysis extends AbstractVisualizationLabelProvider {
-
/**
* SmartPathDependencyAnalysis constructor
- * @param viewer The GraphViewer
+ *
+ * @param viewer
+ * The GraphViewer
*/
public SmartPathDependencyAnalysis(StaticGraphViewer viewer) {
super(viewer);
}
-
/*
* (non-Javadoc)
- * @see org.eclipse.pde.visualization.views.AbstractVisualizationLabelProvider#calculateInterestingDependencies(java.util.HashSet, java.util.HashSet)
+ *
+ * @see org.eclipse.pde.visualization.views.AbstractVisualizationLabelProvider#calculateInterestingDependencies(java.util.HashSet,
+ * java.util.HashSet)
*/
protected void calculateInterestingDependencies(HashSet interestingRels, HashSet interestingEntities) {
@@ -74,7 +76,7 @@
}
}
interestingEntities.addAll(Arrays.asList(path));
-
+
}
interestingEntities.add(this.rootNode);
}
diff --git a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/VisualizationForm.java b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/VisualizationForm.java
index 44b5d18..96a5a67 100644
--- a/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/VisualizationForm.java
+++ b/visualization/plugins/org.eclipse.pde.visualization.dependency/src/org/eclipse/pde/visualization/dependency/views/VisualizationForm.java
@@ -1,17 +1,16 @@
/*******************************************************************************
- * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC, Canada.
- * 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
+ * Copyright 2005-2006, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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:
- * The Chisel Group, University of Victoria
- * IBM CAS, IBM Toronto Lab
- *******************************************************************************/
+ *
+ * Contributors: The Chisel Group, University of Victoria IBM CAS, IBM Toronto
+ * Lab
+ ******************************************************************************/
package org.eclipse.pde.visualization.dependency.views;
-import org.eclipse.mylar.zest.core.viewers.StaticGraphViewer;
+import org.eclipse.mylar.zest.core.viewer.StaticGraphViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.SelectionAdapter;
@@ -38,8 +37,8 @@
/* package */class VisualizationForm {
/*
- * These are all the strings used in the form. These can probably be abstracted
- * for internationalization
+ * These are all the strings used in the form. These can probably be
+ * abstracted for internationalization
*/
private static String Plugin_Dependency_Analysis = "Plug-in Dependency Analysis";
private static String Controls = "Controls";
@@ -53,9 +52,9 @@
private static String Java3 = "Java 3.0 and above";
private static String Java2 = "Java 2.0 and above";
private static String Java1 = "Java 1.0 and above";
-
+
/*
- * These are strings and used to determine which radio button is selected
+ * These are strings and used to determine which radio button is selected
*/
public static String Show_All_Paths = "Show All Paths";
public static String Show_Smart_Path = "Show Smart Path";
@@ -68,7 +67,7 @@
private FormToolkit toolkit;
private StaticGraphViewer viewer;
private PluginVisualizationView view;
-
+
/*
* Some buttons that we need to access in local methods
*/
@@ -76,7 +75,7 @@
private Button showShortestPath = null;
private Button showAllPaths = null;
private Button dependencyAnalysis = null;
-
+
private String currentPathAnalysis = null;
/**
@@ -103,7 +102,7 @@
SashForm sash = new SashForm(parent, SWT.NONE);
sash.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
this.toolkit.paintBordersFor(parent);
-
+
sash.setLayout(new GridLayout());
createGraphSection(sash);
createControlsSection(sash);
@@ -125,27 +124,36 @@
section.setClient(composite);
}
-
private void setDependencyPath(boolean enabled) {
- if ( showAllPaths.getEnabled() != enabled ) showAllPaths.setEnabled(enabled);
- if ( showSmartPath.getEnabled() != enabled ) showSmartPath.setEnabled(enabled);
- if ( showShortestPath.getEnabled() != enabled ) showShortestPath.setEnabled(enabled);
+ if (showAllPaths.getEnabled() != enabled) {
+ showAllPaths.setEnabled(enabled);
+ }
+ if (showSmartPath.getEnabled() != enabled) {
+ showSmartPath.setEnabled(enabled);
+ }
+ if (showShortestPath.getEnabled() != enabled) {
+ showShortestPath.setEnabled(enabled);
+ }
if (!enabled) {
showAllPaths.setSelection(false);
showSmartPath.setSelection(false);
showShortestPath.setSelection(false);
- }
- else {
- if ( currentPathAnalysis == Show_All_Paths ) showAllPaths.setSelection(true);
- else if (currentPathAnalysis == Show_Smart_Path ) showSmartPath.setSelection(true);
- else if (currentPathAnalysis == Show_Shortest_Path ) showShortestPath.setSelection(true);
+ } else {
+ if (currentPathAnalysis == Show_All_Paths) {
+ showAllPaths.setSelection(true);
+ } else if (currentPathAnalysis == Show_Smart_Path) {
+ showSmartPath.setSelection(true);
+ } else if (currentPathAnalysis == Show_Shortest_Path) {
+ showShortestPath.setSelection(true);
+ }
}
view.setDependencyPath(enabled, currentPathAnalysis);
}
-
+
/**
* Creates the section holding the analysis controls.
+ *
* @param parent
*/
private void createControlsSection(Composite parent) {
@@ -158,15 +166,15 @@
dependencyAnalysis.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
dependencyAnalysis.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- setDependencyPath(((Button)e.getSource()).getSelection());
+ setDependencyPath(((Button) e.getSource()).getSelection());
}
});
-
- Section dependencyOptions = this.toolkit.createSection(controlComposite, Section.EXPANDED | Section.NO_TITLE );
+
+ Section dependencyOptions = this.toolkit.createSection(controlComposite, Section.EXPANDED | Section.NO_TITLE);
dependencyOptions.setLayout(new FillLayout());
Composite dependencyOptionsComposite = this.toolkit.createComposite(dependencyOptions);
dependencyOptionsComposite.setLayout(new TableWrapLayout());
-
+
showSmartPath = this.toolkit.createButton(dependencyOptionsComposite, Show_Smart_Path, SWT.RADIO);
showSmartPath.setLayoutData(new TableWrapData(TableWrapData.FILL));
showSmartPath.addSelectionListener(new SelectionAdapter() {
@@ -175,7 +183,7 @@
view.setDependencyPath(dependencyAnalysis.getSelection(), currentPathAnalysis);
}
});
-
+
showAllPaths = this.toolkit.createButton(dependencyOptionsComposite, Show_All_Paths, SWT.RADIO);
showAllPaths.setLayoutData(new TableWrapData(TableWrapData.FILL));
showAllPaths.addSelectionListener(new SelectionAdapter() {
@@ -184,7 +192,7 @@
view.setDependencyPath(dependencyAnalysis.getSelection(), currentPathAnalysis);
}
});
-
+
showShortestPath = this.toolkit.createButton(dependencyOptionsComposite, Show_Shortest_Path, SWT.RADIO);
showShortestPath.setLayoutData(new TableWrapData(TableWrapData.FILL));
showShortestPath.addSelectionListener(new SelectionAdapter() {
@@ -193,20 +201,21 @@
view.setDependencyPath(dependencyAnalysis.getSelection(), currentPathAnalysis);
}
});
-
+
currentPathAnalysis = Show_Smart_Path;
-
+
setDependencyPath(false);
dependencyOptions.setClient(dependencyOptionsComposite);
-
+
Button filterEnabled = this.toolkit.createButton(controlComposite, Filter_Enanled_Plugins, SWT.CHECK);
filterEnabled.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
createEEAnalysisSection(controlComposite);
controls.setClient(controlComposite);
}
-
+
/**
* Creates the section holding the Execution Environment Controls
+ *
* @param parent
*/
private void createEEAnalysisSection(Composite parent) {
@@ -216,17 +225,17 @@
Composite eeAnalysisControls = this.toolkit.createComposite(eeAnalysis);
eeAnalysisControls.setLayout(new TableWrapLayout());
this.toolkit.createLabel(eeAnalysisControls, Execution_Environment_Instructions, SWT.WRAP);
- Button ee6 = this.toolkit.createButton( eeAnalysisControls, Java6, SWT.RADIO);
+ Button ee6 = this.toolkit.createButton(eeAnalysisControls, Java6, SWT.RADIO);
ee6.setLayoutData(new TableWrapData(TableWrapData.FILL));
- Button ee5 = this.toolkit.createButton( eeAnalysisControls, Java5, SWT.RADIO);
+ Button ee5 = this.toolkit.createButton(eeAnalysisControls, Java5, SWT.RADIO);
ee5.setLayoutData(new TableWrapData(TableWrapData.FILL));
- Button ee4 = this.toolkit.createButton( eeAnalysisControls, Java4, SWT.RADIO);
+ Button ee4 = this.toolkit.createButton(eeAnalysisControls, Java4, SWT.RADIO);
ee4.setLayoutData(new TableWrapData(TableWrapData.FILL));
- Button ee3 = this.toolkit.createButton( eeAnalysisControls, Java3, SWT.RADIO);
+ Button ee3 = this.toolkit.createButton(eeAnalysisControls, Java3, SWT.RADIO);
ee3.setLayoutData(new TableWrapData(TableWrapData.FILL));
- Button ee2 = this.toolkit.createButton( eeAnalysisControls, Java2, SWT.RADIO);
+ Button ee2 = this.toolkit.createButton(eeAnalysisControls, Java2, SWT.RADIO);
ee2.setLayoutData(new TableWrapData(TableWrapData.FILL));
- Button ee1 = this.toolkit.createButton( eeAnalysisControls, Java1, SWT.RADIO);
+ Button ee1 = this.toolkit.createButton(eeAnalysisControls, Java1, SWT.RADIO);
ee1.setLayoutData(new TableWrapData(TableWrapData.FILL));
eeAnalysis.setClient(eeAnalysisControls);
}
@@ -239,8 +248,7 @@
public StaticGraphViewer getGraphViewer() {
return viewer;
}
-
-
+
/**
* Gets the form we created.
*/