You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2011/04/25 12:43:26 UTC

svn commit: r1096453 [2/3] - in /ant/ivy/ivyde/trunk: ./ builder/component/ builder/maps/ doc/ org.apache.ivyde.eclipse.resolvevisualizer.feature/ org.apache.ivyde.eclipse.resolvevisualizer/ org.apache.ivyde.eclipse.resolvevisualizer/.settings/ org.apa...

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerForm.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerForm.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerForm.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerForm.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,512 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Set;
+
+import org.apache.ivyde.eclipse.resolvevisualizer.label.AllCallersAlgorithm;
+import org.apache.ivyde.eclipse.resolvevisualizer.label.AllDependencyAlgorithm;
+import org.apache.ivyde.eclipse.resolvevisualizer.label.AllRootPathsAlgorithm;
+import org.apache.ivyde.eclipse.resolvevisualizer.label.SameModuleIdAlgorithm;
+import org.apache.ivyde.eclipse.resolvevisualizer.label.ShortestRootPathAlgorithm;
+import org.apache.ivyde.eclipse.resolvevisualizer.model.IvyNodeElement;
+import org.apache.ivyde.eclipse.resolvevisualizer.model.IvyNodeElementFilterAdapter;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.draw2d.LineBorder;
+import org.eclipse.draw2d.parts.ScrollableThumbnail;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.IMessage;
+import org.eclipse.ui.forms.ManagedForm;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.Form;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.zest.core.viewers.GraphViewer;
+import org.eclipse.zest.core.widgets.Graph;
+
+public class ResolveVisualizerForm {
+    public static final String HeaderText = "Ivy Resolve Visualization";
+
+    private FormToolkit toolkit;
+    private GraphViewer viewer;
+    private ScrolledForm form;
+    private ManagedForm managedForm;
+    private ResolveVisualizerView view;
+
+    private Label searchLabel;
+    private Text searchBox;
+
+    private SashForm sash;
+
+    // various auto-select options
+    private Button showAllDependencies;
+    private Button showAllCallers;
+    private Button showShortestRootPath;
+    private Button showAllRootPaths;
+    private Button showSameModuleId;
+
+    private Button evictionFilterEnablement;
+    private Button depthLimitFilterEnablement;
+    private Spinner depthLimit;
+
+    private ThumbnailNavigator thumbnailNavigator;
+
+    private DepthFilter depthFilter = new DepthFilter();
+    private EvictionFilter evictionFilter = new EvictionFilter();
+
+    public ResolveVisualizerForm(Composite parent, FormToolkit toolkit, ResolveVisualizerView view) {
+        this.toolkit = toolkit;
+        this.view = view;
+        form = this.toolkit.createScrolledForm(parent);
+        managedForm = new ManagedForm(this.toolkit, this.form);
+        createHeaderRegion(form);
+        FillLayout layout = new FillLayout();
+        layout.marginHeight = 10;
+        layout.marginWidth = 4;
+        form.getBody().setLayout(layout);
+
+        this.toolkit.decorateFormHeading(this.form.getForm());
+        createSash(form.getBody());
+
+        view.getContentProvider().addFilter(depthFilter);
+        view.getContentProvider().addFilter(evictionFilter);
+    }
+
+    /**
+     * Creates the section of the form where the graph is drawn
+     * 
+     * @param parent
+     */
+    private void createGraphSection(Composite parent) {
+        Section section = this.toolkit.createSection(parent, Section.TITLE_BAR);
+        thumbnailNavigator = new ThumbnailNavigator(section, SWT.NONE);
+        viewer = new InternalGraphViewer(thumbnailNavigator, SWT.NONE);
+        viewer.getGraphControl().setVerticalScrollBarVisibility(FigureCanvas.NEVER);
+        viewer.getGraphControl().setHorizontalScrollBarVisibility(FigureCanvas.NEVER);
+        thumbnailNavigator.setGraph((Graph) viewer.getControl());
+        thumbnailNavigator.setSize(100, 25);
+        section.setClient(thumbnailNavigator);
+    }
+
+    private void createHeaderRegion(ScrolledForm form) {
+        Composite headClient = new Composite(form.getForm().getHead(), SWT.NULL);
+        GridLayout glayout = new GridLayout();
+        glayout.marginWidth = glayout.marginHeight = 0;
+        glayout.numColumns = 3;
+        headClient.setLayout(glayout);
+        headClient.setBackgroundMode(SWT.INHERIT_DEFAULT);
+        searchLabel = new Label(headClient, SWT.NONE);
+        searchLabel.setText("Search:");
+        searchBox = toolkit.createText(headClient, "");
+        GridData data = new GridData();
+        data.widthHint = 300;
+        searchBox.setLayoutData(data);
+
+        toolkit.paintBordersFor(headClient);
+        form.setHeadClient(headClient);
+        form.setText(HeaderText);
+        enableSearchBox(false);
+
+        form.getForm().addMessageHyperlinkListener(new HyperlinkAdapter() {
+            public void linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent e) {
+                String title = e.getLabel();
+                Object href = e.getHref();
+                if (href instanceof IMessage[] && ((IMessage[]) href).length > 1) {
+                    Point hl = ((Control) e.widget).toDisplay(0, 0);
+                    hl.x += 10;
+                    hl.y += 10;
+                    final Shell shell = new Shell(ResolveVisualizerForm.this.form.getShell(), SWT.ON_TOP | SWT.TOOL);
+                    shell.setImage(getImage(ResolveVisualizerForm.this.form.getMessageType()));
+                    shell.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+                    shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
+                    GridLayout layout = new GridLayout();
+                    layout.numColumns = 1;
+                    layout.verticalSpacing = 0;
+                    shell.setText(title);
+                    shell.setLayout(layout);
+                    Link link = new Link(shell, SWT.NONE);
+                    link.setText("<A>close</A>");
+                    GridData data = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
+                    link.setLayoutData(data);
+                    link.addSelectionListener(new SelectionAdapter() {
+                        public void widgetSelected(SelectionEvent e) {
+                            shell.close();
+                        }
+                    });
+                    Group group = new Group(shell, SWT.NONE);
+                    data = new GridData(SWT.LEFT, SWT.TOP, true, true);
+                    group.setLayoutData(data);
+                    group.setLayout(layout);
+                    group.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+                    FormText text = toolkit.createFormText(group, true);
+                    configureFormText(ResolveVisualizerForm.this.form.getForm(), text);
+                    if (href instanceof IMessage[]) {
+                        text.setText(createFormTextContent((IMessage[]) href), true, false);
+                    }
+
+                    shell.setLocation(hl);
+                    shell.pack();
+                    shell.open();
+                } else if (href instanceof IMessage[]) {
+                    IMessage oneMessage = ((IMessage[]) href)[0];
+                    Set/* <IvyNodeElement> */conflicts = (Set/* <IvyNodeElement> */) oneMessage.getData();
+                    if (conflicts != null) {
+                        viewer.setSelection(new StructuredSelection(new ArrayList(conflicts)));
+                    }
+                }
+            }
+        });
+    }
+
+    public void enableSearchBox(boolean enable) {
+        this.searchLabel.setEnabled(enable);
+        this.searchBox.setEnabled(enable);
+    }
+
+    /**
+     * Creates the sash form to separate the graph from the controls.
+     * 
+     * @param parent
+     */
+    private void createSash(Composite parent) {
+        sash = new SashForm(parent, SWT.NONE);
+        this.toolkit.paintBordersFor(parent);
+
+        createGraphSection(sash);
+        createOptionsSection(sash);
+        sash.setWeights(new int[] { 10, 2 });
+    }
+
+    private void createOptionsSection(Composite parent) {
+        Section controls = this.toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);
+
+        controls.setText("Options");
+        Composite controlComposite = new Composite(controls, SWT.NONE) {
+            public Point computeSize(int hint, int hint2, boolean changed) {
+                return new Point(0, 0);
+            }
+        };
+        this.toolkit.adapt(controlComposite);
+        controlComposite.setLayout(new GridLayout());
+
+        Section autoSelectOptions = this.toolkit.createSection(controlComposite, Section.EXPANDED);
+        autoSelectOptions.setText("Auto Selection");
+        autoSelectOptions.setLayout(new FillLayout());
+        Composite autoSelectOptionsComposite = this.toolkit.createComposite(autoSelectOptions);
+        autoSelectOptionsComposite.setLayout(new TableWrapLayout());
+
+        showShortestRootPath = this.toolkit
+                .createButton(autoSelectOptionsComposite, "Shortest path to root", SWT.RADIO);
+        showShortestRootPath.setLayoutData(new TableWrapData(TableWrapData.FILL));
+        showShortestRootPath.setSelection(true);
+        showShortestRootPath.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                view.setAutoSelectDecorator(new ShortestRootPathAlgorithm());
+            }
+        });
+
+        showAllRootPaths = this.toolkit.createButton(autoSelectOptionsComposite, "All paths to root", SWT.RADIO);
+        showAllRootPaths.setLayoutData(new TableWrapData(TableWrapData.FILL));
+        showAllRootPaths.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                view.setAutoSelectDecorator(new AllRootPathsAlgorithm());
+            }
+        });
+
+        showAllCallers = this.toolkit.createButton(autoSelectOptionsComposite, "All callers", SWT.RADIO);
+        showAllCallers.setLayoutData(new TableWrapData(TableWrapData.FILL));
+        showAllCallers.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                view.setAutoSelectDecorator(new AllCallersAlgorithm());
+            }
+        });
+
+        showAllDependencies = this.toolkit.createButton(autoSelectOptionsComposite, "All dependencies", SWT.RADIO);
+        showAllDependencies.setLayoutData(new TableWrapData(TableWrapData.FILL));
+        showAllDependencies.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                view.setAutoSelectDecorator(new AllDependencyAlgorithm());
+            }
+        });
+
+        showSameModuleId = this.toolkit.createButton(autoSelectOptionsComposite, "Other revisions", SWT.RADIO);
+        showSameModuleId.setLayoutData(new TableWrapData(TableWrapData.FILL));
+        showSameModuleId.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                view.setAutoSelectDecorator(new SameModuleIdAlgorithm());
+            }
+        });
+
+        autoSelectOptions.setClient(autoSelectOptionsComposite);
+
+        Section filterOptions = this.toolkit.createSection(controlComposite, Section.EXPANDED);
+        filterOptions.setText("Filter Options");
+        filterOptions.setLayout(new FillLayout());
+        Composite filterOptionsComposite = this.toolkit.createComposite(filterOptions);
+        filterOptionsComposite.setLayout(new TableWrapLayout());
+
+        evictionFilterEnablement = this.toolkit.createButton(filterOptionsComposite, "Hide evicted nodes", SWT.CHECK);
+        evictionFilterEnablement.setLayoutData(new TableWrapData(TableWrapData.FILL));
+        evictionFilterEnablement.setSelection(true);
+        evictionFilter.setEnabled(true);
+        evictionFilterEnablement.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                if (evictionFilterEnablement.getSelection()) {
+                    evictionFilter.setEnabled(true);
+                    view.refresh();
+                } else {
+                    evictionFilter.setEnabled(false);
+                    view.refresh();
+                }
+            }
+        });
+
+        depthLimitFilterEnablement = this.toolkit.createButton(filterOptionsComposite, "Limit depth", SWT.CHECK);
+        depthLimitFilterEnablement.setLayoutData(new TableWrapData(TableWrapData.FILL));
+        depthLimitFilterEnablement.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                if (depthLimitFilterEnablement.getSelection()) {
+                    depthFilter.setDepth(depthLimit.getSelection());
+                    depthFilter.setEnabled(true);
+                    view.refresh();
+                    depthLimit.setEnabled(true);
+                } else {
+                    depthFilter.setEnabled(false);
+                    view.refresh();
+                    depthLimit.setEnabled(false);
+                }
+            }
+        });
+
+        depthLimit = new Spinner(filterOptionsComposite, 0);
+        toolkit.adapt(depthLimit);
+        depthLimit.setMinimum(1);
+        depthLimit.setSelection(2);
+        depthLimit.setIncrement(1);
+        depthLimit.setSize(150, 40);
+        depthLimit.setBackground(new Color(Display.getDefault(), 216, 228, 248));
+        depthLimit.setEnabled(false);
+        depthLimit.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                depthFilter.setDepth(depthLimit.getSelection());
+                depthFilter.setEnabled(true);
+                view.refresh();
+            }
+        });
+
+        filterOptions.setClient(filterOptionsComposite);
+
+        controls.setClient(controlComposite);
+    }
+
+    public GraphViewer getGraphViewer() {
+        return viewer;
+    }
+
+    public ScrolledForm getForm() {
+        return form;
+    }
+
+    public Text getSearchBox() {
+        return this.searchBox;
+    }
+
+    private class InternalGraphViewer extends GraphViewer {
+        public InternalGraphViewer(Composite parent, int style) {
+            super(parent, style);
+            Graph graph = new Graph(parent, style) {
+                public Point computeSize(int hint, int hint2, boolean changed) {
+                    return new Point(0, 0);
+                }
+            };
+            setControl(graph);
+        }
+    }
+
+    private static class ThumbnailNavigator extends Composite {
+        FigureCanvas thumbnail;
+        ScrollableThumbnail tb;
+
+        public ThumbnailNavigator(Composite parent, int style) {
+            super(parent, style);
+            this.setLayout(new FormLayout());
+            createZoomableCanvas(this);
+        }
+
+        public void setGraph(Graph graph) {
+            if (graph.getParent() != this) {
+                throw new AssertionError("Graph must be a child of this zoomable composite.");
+            }
+            createContents(graph);
+            tb.setViewport(graph.getViewport());
+            tb.setSource(graph.getContents());
+        }
+
+        private void createZoomableCanvas(Composite parent) {
+            FormData data = new FormData();
+            data.top = new FormAttachment(100, -100);
+            data.left = new FormAttachment(100, -100);
+            data.right = new FormAttachment(100, 0);
+            data.bottom = new FormAttachment(100, 0);
+
+            thumbnail = new FigureCanvas(parent, SWT.NONE);
+            thumbnail.setBackground(ColorConstants.white);
+            thumbnail.setLayoutData(data);
+
+            tb = new ScrollableThumbnail();
+            tb.setBorder(new LineBorder(1));
+            thumbnail.setContents(tb);
+        }
+
+        private void createContents(Control control) {
+            FormData data = new FormData();
+            data.top = new FormAttachment(0, 0);
+            data.left = new FormAttachment(0, 0);
+            data.right = new FormAttachment(100, 0);
+            data.bottom = new FormAttachment(100, 0);
+            control.setParent(this);
+            control.setLayoutData(data);
+        }
+
+    }
+
+    private class DepthFilter extends IvyNodeElementFilterAdapter {
+        private int depth = 2;
+
+        public boolean accept(IvyNodeElement unfiltered) {
+            return unfiltered.getDepth() - view.getCurrentRoot().getDepth() <= depth;
+        }
+
+        public void setDepth(int depth) {
+            this.depth = depth;
+        }
+    }
+
+    private class EvictionFilter extends IvyNodeElementFilterAdapter {
+        public boolean accept(IvyNodeElement unfiltered) {
+            return !unfiltered.isEvicted();
+        }
+    }
+
+    public ManagedForm getManagedForm() {
+        return managedForm;
+    }
+
+    private Image getImage(int type) {
+        switch (type) {
+        case IMessageProvider.ERROR:
+            return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+        case IMessageProvider.WARNING:
+            return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
+        case IMessageProvider.INFORMATION:
+            return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
+        }
+        return null;
+    }
+
+    private void configureFormText(final Form form, FormText text) {
+        text.addHyperlinkListener(new HyperlinkAdapter() {
+            public void linkActivated(HyperlinkEvent e) {
+                String is = (String) e.getHref();
+                try {
+                    ((FormText) e.widget).getShell().dispose();
+                    int index = Integer.parseInt(is);
+                    IMessage[] messages = form.getChildrenMessages();
+                    IMessage message = messages[index];
+                    Set/* <IvyNodeElement> */conflicts = (Set/* <IvyNodeElement> */) message.getData();
+                    if (conflicts != null) {
+                        viewer.setSelection(new StructuredSelection(new ArrayList(conflicts)));
+                    }
+                } catch (NumberFormatException ex) {
+                }
+            }
+        });
+        text.setImage("error", getImage(IMessageProvider.ERROR));
+        text.setImage("warning", getImage(IMessageProvider.WARNING));
+        text.setImage("info", getImage(IMessageProvider.INFORMATION));
+    }
+
+    String createFormTextContent(IMessage[] messages) {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        pw.println("<form>");
+        for (int i = 0; i < messages.length; i++) {
+            IMessage message = messages[i];
+            pw.print("<li vspace=\"false\" style=\"image\" indent=\"16\" value=\"");
+            switch (message.getMessageType()) {
+            case IMessageProvider.ERROR:
+                pw.print("error");
+                break;
+            case IMessageProvider.WARNING:
+                pw.print("warning");
+                break;
+            case IMessageProvider.INFORMATION:
+                pw.print("info");
+                break;
+            }
+            pw.print("\"> <a href=\"");
+            pw.print(i + "");
+            pw.print("\">");
+            if (message.getPrefix() != null) {
+                pw.print(message.getPrefix());
+            }
+            pw.print(message.getMessage());
+            pw.println("</a></li>");
+        }
+        pw.println("</form>");
+        pw.flush();
+        return sw.toString();
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerForm.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerForm.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerForm.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerPlugin.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerPlugin.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerPlugin.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerPlugin.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ResolveVisualizerPlugin extends AbstractUIPlugin {
+
+    // The plug-in ID
+    public static final String PLUGIN_ID = "org.apache.ivyde.eclipse.resolvevisualizer"; //$NON-NLS-1$
+
+    // The shared instance
+    private static ResolveVisualizerPlugin plugin;
+
+    /**
+     * The constructor
+     */
+    public ResolveVisualizerPlugin() {
+    }
+
+    public void start(BundleContext context) throws Exception {
+        super.start(context);
+        plugin = this;
+    }
+
+    public void stop(BundleContext context) throws Exception {
+        plugin = null;
+        super.stop(context);
+    }
+
+    /**
+     * Returns the shared instance
+     * 
+     * @return the shared instance
+     */
+    public static ResolveVisualizerPlugin getDefault() {
+        return plugin;
+    }
+
+    public static ImageDescriptor getImageDescriptor(String path) {
+        return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerPlugin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerPlugin.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerPlugin.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerView.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerView.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerView.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerView.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,478 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer;
+
+import java.awt.Dimension;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Stack;
+
+import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
+import org.apache.ivyde.eclipse.resolvevisualizer.label.ILabelDecoratorAlgorithm;
+import org.apache.ivyde.eclipse.resolvevisualizer.model.IvyNodeElement;
+import org.apache.ivyde.eclipse.resolvevisualizer.model.IvyNodeElementAdapter;
+import org.apache.ivyde.eclipse.resolvevisualizer.model.IvyNodeElementFilterAdapter;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.zest.core.viewers.AbstractZoomableViewer;
+import org.eclipse.zest.core.viewers.EntityConnectionData;
+import org.eclipse.zest.core.viewers.GraphViewer;
+import org.eclipse.zest.core.viewers.IZoomableWorkbenchPart;
+import org.eclipse.zest.core.viewers.ZoomContributionViewItem;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphItem;
+import org.eclipse.zest.core.widgets.GraphNode;
+import org.eclipse.zest.core.widgets.ZestStyles;
+import org.eclipse.zest.layouts.LayoutAlgorithm;
+import org.eclipse.zest.layouts.LayoutStyles;
+import org.eclipse.zest.layouts.algorithms.CompositeLayoutAlgorithm;
+import org.eclipse.zest.layouts.algorithms.DirectedGraphLayoutAlgorithm;
+import org.eclipse.zest.layouts.algorithms.HorizontalShift;
+
+public class ResolveVisualizerView extends ViewPart implements IZoomableWorkbenchPart {
+    private GraphViewer viewer;
+    private FormToolkit toolKit;
+
+    private Action focusDialogAction;
+    private Action focusDialogActionToolbar;
+    private Action focusOnSelectionAction;
+    private Action hideSelectionAction;
+    private Action showHiddenAction;
+    private Action applyDefaultLayoutAction;
+    private Action historyAction;
+    private Action forwardAction;
+    private Action refreshAction;
+
+    private ZoomContributionViewItem contextZoomContributionViewItem;
+    private ZoomContributionViewItem toolbarZoomContributionViewItem;
+
+    private Stack/* <IvyNodeElement> */historyStack;
+    private Stack/* <IvyNodeElement> */forwardStack;
+
+    private IvyNodeElement currentRoot;
+    private IvyNodeElement currentSelection;
+    private IvyClasspathContainer currentContainer;
+
+    private ResolveVisualizerContentProvider contentProvider = new ResolveVisualizerContentProvider();
+    private MessageContentProvider messageContentProvider = new MessageContentProvider();
+    private IvyNodeLabelProvider labelProvider;
+    private ResolveVisualizerForm visualizationForm;
+
+    private ForceHiddenFilter forceHiddenFilter;
+
+    public ResolveVisualizerView() {
+        historyStack = new Stack/* <IvyNodeElement> */();
+        forwardStack = new Stack/* <IvyNodeElement> */();
+
+        forceHiddenFilter = new ForceHiddenFilter();
+        forceHiddenFilter.setEnabled(true);
+        contentProvider.addFilter(forceHiddenFilter);
+    }
+
+    /**
+     * This is a callback that will allow us to create the viewer and initialize it.
+     */
+    public void createPartControl(Composite parent) {
+        toolKit = new FormToolkit(parent.getDisplay());
+
+        visualizationForm = new ResolveVisualizerForm(parent, toolKit, this);
+        viewer = visualizationForm.getGraphViewer();
+
+        this.labelProvider = new IvyNodeLabelProvider(this.viewer);
+        viewer.setLabelProvider(labelProvider);
+        viewer.setContentProvider(contentProvider);
+        viewer.setInput(null);
+        viewer.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED);
+        viewer.setLayoutAlgorithm(new CompositeLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING,
+                new LayoutAlgorithm[] { new DirectedGraphLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING),
+                                        new HorizontalShift(LayoutStyles.NO_LAYOUT_NODE_RESIZING) }));
+
+        viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+            public void selectionChanged(SelectionChangedEvent event) {
+                Object selectedElement = ((IStructuredSelection) event.getSelection()).getFirstElement();
+                if (selectedElement instanceof EntityConnectionData) {
+                    return;
+                }
+                ResolveVisualizerView.this.selectionChanged((IvyNodeElement) selectedElement);
+            }
+        });
+
+        viewer.addDoubleClickListener(new IDoubleClickListener() {
+            public void doubleClick(DoubleClickEvent event) {
+                focusOnSelectionAction.run();
+            }
+        });
+
+        visualizationForm.getSearchBox().addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                String textString = visualizationForm.getSearchBox().getText();
+
+                HashMap figureListing = new HashMap();
+                ArrayList list = new ArrayList();
+                Iterator iterator = viewer.getGraphControl().getNodes().iterator();
+                while (iterator.hasNext()) {
+                    GraphItem item = (GraphItem) iterator.next();
+                    figureListing.put(item.getText(), item);
+                }
+                iterator = figureListing.keySet().iterator();
+                if (textString.length() > 0) {
+                    while (iterator.hasNext()) {
+                        String string = (String) iterator.next();
+                        if (string.toLowerCase().indexOf(textString.toLowerCase()) >= 0) {
+                            list.add(figureListing.get(string));
+                        }
+                    }
+                }
+                viewer.getGraphControl().setSelection((GraphItem[]) list.toArray(new GraphItem[list.size()]));
+            }
+        });
+
+        messageContentProvider.setMessageManager(visualizationForm.getManagedForm().getMessageManager());
+        contextZoomContributionViewItem = new ZoomContributionViewItem(this);
+        toolbarZoomContributionViewItem = new ZoomContributionViewItem(this);
+
+        // Create the help context id for the viewer's control
+        makeActions();
+        hookContextMenu();
+        contributeToActionBars();
+    }
+
+    private void hookContextMenu() {
+        MenuManager menuMgr = new MenuManager("#PopupMenu");
+        menuMgr.setRemoveAllWhenShown(true);
+        menuMgr.addMenuListener(new IMenuListener() {
+            public void menuAboutToShow(IMenuManager manager) {
+                ResolveVisualizerView.this.fillContextMenu(manager);
+            }
+        });
+        Menu menu = menuMgr.createContextMenu(viewer.getControl());
+        viewer.getControl().setMenu(menu);
+        getSite().registerContextMenu(menuMgr, viewer);
+    }
+
+    private void contributeToActionBars() {
+        IActionBars bars = getViewSite().getActionBars();
+        bars.getMenuManager().add(toolbarZoomContributionViewItem);
+        fillLocalPullDown(bars.getMenuManager());
+        fillLocalToolBar(bars.getToolBarManager());
+    }
+
+    private void fillLocalPullDown(IMenuManager manager) {
+    }
+
+    private void fillContextMenu(IMenuManager manager) {
+        manager.add(new Separator());
+        manager.add(focusDialogAction);
+        manager.add(focusOnSelectionAction);
+        manager.add(new Separator());
+        manager.add(historyAction);
+        manager.add(forwardAction);
+        manager.add(new Separator());
+        manager.add(hideSelectionAction);
+        manager.add(showHiddenAction);
+        manager.add(new Separator());
+        manager.add(refreshAction);
+        manager.add(applyDefaultLayoutAction);
+        manager.add(new Separator());
+        manager.add(contextZoomContributionViewItem);
+    }
+
+    private void fillLocalToolBar(IToolBarManager toolBarManager) {
+        toolBarManager.add(refreshAction);
+        toolBarManager.add(focusDialogActionToolbar);
+        toolBarManager.add(new Separator());
+        toolBarManager.add(historyAction);
+        toolBarManager.add(forwardAction);
+    }
+
+    private void makeActions() {
+        refreshAction = new Action() {
+            public void run() {
+                final IvyClasspathContainer container = currentContainer;
+
+                if (container == null) {
+                    // nothing as been actually selected
+                    return;
+                }
+
+                ResolveReport report = container.getResolveReport();
+                if (report == null) {
+                    // TODO we might want to launch some resolve here
+                    // or at least open a popup inviting the end user to launch one
+                    return;
+                }
+
+                // a resolve report is already saved on the container's state, we will use it
+                focusOnContainer(container);
+
+                // When a new container is selected, disable the forward action
+                // The forward action only stores history when the back button was used (much like a browser)
+                forwardStack.clear();
+                forwardAction.setEnabled(false);
+            }
+        };
+        refreshAction.setText("Resolve");
+        refreshAction.setEnabled(true);
+        refreshAction.setImageDescriptor(IvyPlugin.getImageDescriptor("icons/refresh.gif"));
+
+        focusDialogAction = new Action() {
+            public void run() {
+                ClasspathContainerSelectionDialog dialog = new ClasspathContainerSelectionDialog(viewer.getControl()
+                        .getShell());
+                dialog.create();
+                int dialogStatus = dialog.open();
+                if (dialogStatus == Window.OK) {
+                    currentContainer = (IvyClasspathContainer) dialog.getFirstResult();
+                    refreshAction.run();
+                }
+            }
+        };
+        focusDialogAction.setText("Focus on ivy file...");
+
+        focusDialogActionToolbar = new Action() {
+            public void run() {
+                focusDialogAction.run();
+            }
+        };
+        focusDialogActionToolbar.setToolTipText("Focus on ivy file...");
+        focusDialogActionToolbar.setImageDescriptor(ResolveVisualizerPlugin.getImageDescriptor("icons/focus.gif"));
+
+        focusOnSelectionAction = new Action() {
+            public void run() {
+                if (currentSelection != null) {
+                    if (currentRoot != currentSelection) {
+                        if (currentRoot != null) {
+                            historyStack.push(currentRoot);
+                            historyAction.setEnabled(true);
+                        }
+                        focusOn(currentSelection);
+                    }
+                }
+            }
+        };
+        focusOnSelectionAction.setText("Focus on selection");
+        focusOnSelectionAction.setEnabled(false);
+
+        historyAction = new Action() {
+            public void run() {
+                if (historyStack.size() > 0) {
+                    IvyNodeElement element = (IvyNodeElement) historyStack.pop();
+                    forwardStack.push(currentRoot);
+                    forwardAction.setEnabled(true);
+                    focusOn(element);
+                    if (historyStack.size() <= 0) {
+                        historyAction.setEnabled(false);
+                    }
+                }
+            }
+        };
+        historyAction.setText("Back");
+        historyAction.setToolTipText("Back");
+        historyAction.setEnabled(false);
+        historyAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
+                .getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
+
+        forwardAction = new Action() {
+            public void run() {
+                if (forwardStack.size() > 0) {
+                    IvyNodeElement element = (IvyNodeElement) forwardStack.pop();
+
+                    historyStack.push(currentRoot);
+                    historyAction.setEnabled(true);
+
+                    focusOn(element);
+                    if (forwardStack.size() <= 0) {
+                        forwardAction.setEnabled(false);
+                    }
+                }
+            }
+        };
+
+        forwardAction.setText("Forward");
+        forwardAction.setToolTipText("Forward");
+        forwardAction.setEnabled(false);
+        forwardAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
+                .getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
+
+        hideSelectionAction = new Action() {
+            public void run() {
+                forceHiddenFilter.addHidden(currentSelection);
+                refresh();
+            }
+        };
+        hideSelectionAction.setText("Hide");
+
+        showHiddenAction = new Action() {
+            public void run() {
+                forceHiddenFilter.clearHidden();
+                refresh();
+            }
+        };
+        showHiddenAction.setText("Show hidden");
+
+        applyDefaultLayoutAction = new Action() {
+            public void run() {
+                viewer.applyLayout();
+            }
+        };
+        applyDefaultLayoutAction.setText("Apply default layout");
+    }
+
+    /**
+     * Passing the focus request to the viewer's control.
+     */
+    public void setFocus() {
+        viewer.getControl().setFocus();
+    }
+
+    private final void focusOnContainer(IvyClasspathContainer container) {
+        ResolveReport report = container.getResolveReport();
+
+        if (report != null) {
+            forceHiddenFilter.clearHidden();
+            visualizationForm.getForm().setText(
+                    ResolveVisualizerForm.HeaderText + " - " + container.getConf().getIvyXmlPath() + " in \""
+                            + container.getConf().getJavaProject().getProject().getName() + "\"");
+
+            IvyNodeElement nextRoot = IvyNodeElementAdapter.adapt(report);
+            if (currentRoot != nextRoot) {
+                if (currentRoot != null) {
+                    historyStack.push(currentRoot);
+                    historyAction.setEnabled(true);
+                }
+                focusOn(nextRoot);
+            }
+        }
+    }
+
+    /**
+     * Update the view to focus on a particular bundle. If record history is set to true, and bundle does not equal the
+     * current bundle, then the current bundle will be saved on the history stack
+     * 
+     * @param focus
+     * @param recordHistory
+     */
+    public void focusOn(IvyNodeElement focus) {
+        viewer.setSelection(new StructuredSelection(focus));
+        viewer.setFilters(new ViewerFilter[] {});
+        viewer.setInput(focus);
+
+        Iterator nodes = viewer.getGraphControl().getNodes().iterator();
+        Graph graph = viewer.getGraphControl();
+        Dimension centre = new Dimension(graph.getBounds().width / 2, graph.getBounds().height / 2);
+        while (nodes.hasNext()) {
+            GraphNode graphNode = (GraphNode) nodes.next();
+            if (graphNode.getLocation().x <= 1 && graphNode.getLocation().y <= 1) {
+                graphNode.setLocation(centre.width, centre.height);
+            }
+        }
+
+        currentRoot = focus;
+
+        if (viewer.getGraphControl().getNodes().size() > 0) {
+            visualizationForm.enableSearchBox(true);
+        } else {
+            visualizationForm.enableSearchBox(false);
+        }
+        visualizationForm.enableSearchBox(true);
+        focusOnSelectionAction.setEnabled(true);
+
+        selectionChanged(focus);
+    }
+
+    /**
+     * Handle the select changed. This will update the view whenever a selection occurs.
+     * 
+     * @param selectedItem
+     */
+    private void selectionChanged(IvyNodeElement selectedItem) {
+        currentSelection = selectedItem;
+        labelProvider.setCurrentSelection(currentRoot, selectedItem);
+        messageContentProvider.selectionChanged(currentRoot);
+        viewer.update(contentProvider.getElements(currentRoot), null);
+    }
+
+    public AbstractZoomableViewer getZoomableViewer() {
+        return viewer;
+    }
+
+    public void setAutoSelectDecorator(ILabelDecoratorAlgorithm algorithm) {
+        labelProvider.setAutoSelectDecorator(algorithm);
+
+        if (viewer.getSelection() != null) {
+            Object selected = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
+            this.selectionChanged((IvyNodeElement) selected);
+        }
+    }
+
+    public ResolveVisualizerContentProvider getContentProvider() {
+        return contentProvider;
+    }
+
+    public void refresh() {
+        viewer.refresh();
+        viewer.applyLayout();
+    }
+
+    public IvyNodeElement getCurrentRoot() {
+        return currentRoot;
+    }
+
+    private class ForceHiddenFilter extends IvyNodeElementFilterAdapter {
+        private Collection/* <IvyNodeElement> */forceHidden = new HashSet/* <IvyNodeElement> */();
+
+        public boolean accept(IvyNodeElement unfiltered) {
+            return !forceHidden.contains(unfiltered);
+        }
+
+        public void addHidden(IvyNodeElement hide) {
+            forceHidden.addAll(Arrays.asList(hide.getDeepDependencies()));
+        }
+
+        public void clearHidden() {
+            forceHidden.clear();
+        }
+    }
+}
\ No newline at end of file

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerView.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerView.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerView.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllCallersAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllCallersAlgorithm.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllCallersAlgorithm.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllCallersAlgorithm.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer.label;
+
+import java.util.Map;
+
+import org.apache.ivyde.eclipse.resolvevisualizer.model.IvyNodeElement;
+import org.eclipse.zest.core.viewers.EntityConnectionData;
+
+public class AllCallersAlgorithm extends LabelDecoratorAlgorithmAdapter {
+    public void calculateHighlighted(IvyNodeElement root, IvyNodeElement selected,
+            Map/* <EntityConnectionData> */highlightRelationships, Map/* <IvyNodeElement> */highlightEntities) {
+        if (selected != null) {
+            highlightEntities.put(selected, entityColor);
+            IvyNodeElement[] directCallers = selected.getCallers();
+            for (int i = 0; i < directCallers.length; i++) {
+                highlightRelationships.put(new EntityConnectionData(directCallers[i], selected), relationshipColor);
+                highlightEntities.put(directCallers[i], entityColor);
+                highlightEntities.put(directCallers[i], entityColor);
+            }
+        }
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllCallersAlgorithm.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllCallersAlgorithm.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllCallersAlgorithm.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllDependencyAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllDependencyAlgorithm.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllDependencyAlgorithm.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllDependencyAlgorithm.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer.label;
+
+import java.util.Map;
+
+import org.apache.ivyde.eclipse.resolvevisualizer.model.IvyNodeElement;
+import org.eclipse.zest.core.viewers.EntityConnectionData;
+
+public class AllDependencyAlgorithm extends LabelDecoratorAlgorithmAdapter {
+    public void calculateHighlighted(IvyNodeElement root, IvyNodeElement selected,
+            Map/* <EntityConnectionData, Color> */highlightRelationships,
+            Map/* <IvyNodeElement, Color> */highlightEntities) {
+        if (selected != null) {
+            highlightDependenciesRecursive(selected, highlightRelationships, highlightEntities);
+        }
+    }
+
+    private void highlightDependenciesRecursive(IvyNodeElement node,
+            Map/* <EntityConnectionData, Color> */highlightRelationships,
+            Map/* <IvyNodeElement, Color> */highlightEntities) {
+        highlightEntities.put(node, entityColor);
+
+        IvyNodeElement[] directDependencies = node.getDependencies();
+        for (int i = 0; i < directDependencies.length; i++) {
+            highlightRelationships.put(new EntityConnectionData(node, directDependencies[i]), relationshipColor);
+            highlightDependenciesRecursive(directDependencies[i], highlightRelationships, highlightEntities);
+        }
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllDependencyAlgorithm.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllDependencyAlgorithm.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllDependencyAlgorithm.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllRootPathsAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllRootPathsAlgorithm.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllRootPathsAlgorithm.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllRootPathsAlgorithm.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer.label;
+
+import java.util.Map;
+
+import org.apache.ivyde.eclipse.resolvevisualizer.model.IvyNodeElement;
+import org.eclipse.zest.core.viewers.EntityConnectionData;
+
+public class AllRootPathsAlgorithm extends LabelDecoratorAlgorithmAdapter {
+    public void calculateHighlighted(IvyNodeElement root, IvyNodeElement selected,
+            Map/* <EntityConnectionData> */highlightRelationships, Map/* <IvyNodeElement> */highlightEntities) {
+        if (selected != null) {
+            highlightCallersRecursive(selected, highlightRelationships, highlightEntities);
+        }
+    }
+
+    private void highlightCallersRecursive(IvyNodeElement node, Map/* <EntityConnectionData> */highlightRelationships,
+            Map/* <IvyNodeElement> */highlightEntities) {
+        highlightEntities.put(node, entityColor);
+        IvyNodeElement[] directCallers = node.getCallers();
+        for (int i = 0; i < directCallers.length; i++) {
+            highlightRelationships.put(new EntityConnectionData(directCallers[i], node), relationshipColor);
+            highlightCallersRecursive(directCallers[i], highlightRelationships, highlightEntities);
+        }
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllRootPathsAlgorithm.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllRootPathsAlgorithm.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/AllRootPathsAlgorithm.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConfigurationConflictAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConfigurationConflictAlgorithm.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConfigurationConflictAlgorithm.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConfigurationConflictAlgorithm.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer.label;
+
+import java.util.Map;
+
+import org.apache.ivyde.eclipse.resolvevisualizer.model.IvyNodeElement;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.zest.core.widgets.ZestStyles;
+
+public class ConfigurationConflictAlgorithm extends LabelDecoratorAlgorithmAdapter {
+    public ConfigurationConflictAlgorithm() {
+        // set default colors for this algorithm
+        entityColor = new Color(null, 215, 27, 27);
+        relationshipColor = new ConnectionStyle(ZestStyles.CONNECTIONS_SOLID, ColorConstants.red, 1, false);
+    }
+
+    public void calculateHighlighted(IvyNodeElement root, IvyNodeElement selected, Map highlightRelationships,
+            Map highlightEntities) {
+        if (root == null) {
+            return;
+        }
+        IvyNodeElement[] deepDependencies = root.getDeepDependencies();
+        for (int i = 0; i < deepDependencies.length; i++) {
+            if (deepDependencies[i].getConflicts().length > 0) {
+                highlightEntities.put(deepDependencies[i], entityColor);
+            }
+        }
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConfigurationConflictAlgorithm.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConfigurationConflictAlgorithm.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConfigurationConflictAlgorithm.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConnectionStyle.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConnectionStyle.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConnectionStyle.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConnectionStyle.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,65 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer.label;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.zest.core.widgets.ZestStyles;
+
+public class ConnectionStyle {
+    private static final Color DARK_RED = new Color(Display.getDefault(), 127, 0, 0);
+
+    private int lineWidth = 1;
+    private Color highlightColor = DARK_RED;
+    private int connectionStyle = ZestStyles.CONNECTIONS_SOLID;
+    private boolean revealOnHighlight = true;
+
+    /**
+     * Accept the defaults
+     */
+    public ConnectionStyle() {
+    }
+
+    public ConnectionStyle(int connectionStyle, Color highlightColor, int lineWidth, boolean revealOnHighlight) {
+        super();
+        this.connectionStyle = connectionStyle;
+        this.highlightColor = highlightColor;
+        this.lineWidth = lineWidth;
+        this.revealOnHighlight = revealOnHighlight;
+    }
+
+    public static Color getDARK_RED() {
+        return DARK_RED;
+    }
+
+    public int getLineWidth() {
+        return lineWidth;
+    }
+
+    public Color getHighlightColor() {
+        return highlightColor;
+    }
+
+    public int getConnectionStyle() {
+        return connectionStyle;
+    }
+
+    public boolean isRevealOnHighlight() {
+        return revealOnHighlight;
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConnectionStyle.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConnectionStyle.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ConnectionStyle.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/DirectDependenciesAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/DirectDependenciesAlgorithm.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/DirectDependenciesAlgorithm.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/DirectDependenciesAlgorithm.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer.label;
+
+import java.util.Map;
+
+import org.apache.ivyde.eclipse.resolvevisualizer.model.IvyNodeElement;
+import org.eclipse.zest.core.viewers.EntityConnectionData;
+
+public class DirectDependenciesAlgorithm extends LabelDecoratorAlgorithmAdapter {
+    public void calculateHighlighted(IvyNodeElement root, IvyNodeElement selected,
+            Map/* <EntityConnectionData> */highlightRelationships, Map/* <IvyNodeElement> */highlightEntities) {
+        if (selected != null) {
+            highlightEntities.put(root, entityColor);
+            IvyNodeElement[] dependencies = root.getDependencies();
+            for (int i = 0; i < dependencies.length; i++) {
+                highlightEntities.put(dependencies[i], entityColor);
+                highlightRelationships.put(new EntityConnectionData(root, dependencies[i]), relationshipColor);
+            }
+        }
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/DirectDependenciesAlgorithm.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/DirectDependenciesAlgorithm.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/DirectDependenciesAlgorithm.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ILabelDecoratorAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ILabelDecoratorAlgorithm.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ILabelDecoratorAlgorithm.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ILabelDecoratorAlgorithm.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,27 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer.label;
+
+import java.util.Map;
+
+import org.apache.ivyde.eclipse.resolvevisualizer.model.IvyNodeElement;
+
+public interface ILabelDecoratorAlgorithm {
+    public void calculateHighlighted(IvyNodeElement root, IvyNodeElement selected,
+            Map/* <EntityConnectionData> */highlightRelationships, Map/* <IvyNodeElement> */highlightEntities);
+}
\ No newline at end of file

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ILabelDecoratorAlgorithm.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ILabelDecoratorAlgorithm.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ILabelDecoratorAlgorithm.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/LabelDecoratorAlgorithmAdapter.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/LabelDecoratorAlgorithmAdapter.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/LabelDecoratorAlgorithmAdapter.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/LabelDecoratorAlgorithmAdapter.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer.label;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.swt.graphics.Color;
+
+public abstract class LabelDecoratorAlgorithmAdapter implements ILabelDecoratorAlgorithm {
+    protected Color entityColor = ColorConstants.orange;
+    protected ConnectionStyle relationshipColor = new ConnectionStyle();
+
+    /**
+     * Specify custom colors for this algorithm instance.
+     * 
+     * @param entityColor
+     * @param relationshipColor
+     */
+    public void setStyles(Color entityColor, ConnectionStyle relationshipColor) {
+        this.entityColor = entityColor;
+        this.relationshipColor = relationshipColor;
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/LabelDecoratorAlgorithmAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/LabelDecoratorAlgorithmAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/LabelDecoratorAlgorithmAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/SameModuleIdAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/SameModuleIdAlgorithm.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/SameModuleIdAlgorithm.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/SameModuleIdAlgorithm.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer.label;
+
+import java.util.Map;
+
+import org.apache.ivyde.eclipse.resolvevisualizer.model.IvyNodeElement;
+
+public class SameModuleIdAlgorithm extends LabelDecoratorAlgorithmAdapter {
+    public void calculateHighlighted(IvyNodeElement root, IvyNodeElement selected,
+            Map/* <EntityConnectionData> */highlightRelationships, Map/* <IvyNodeElement> */highlightEntities) {
+        if (selected != null) {
+            IvyNodeElement[] deepDependencies = root.getDeepDependencies();
+            for (int i = 0; i < deepDependencies.length; i++) {
+                if (deepDependencies[i].getOrganization().equals(selected.getOrganization())
+                        && deepDependencies[i].getName().equals(selected.getName())) {
+                    highlightEntities.put(deepDependencies[i], entityColor);
+                }
+            }
+        }
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/SameModuleIdAlgorithm.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/SameModuleIdAlgorithm.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/SameModuleIdAlgorithm.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ShortestRootPathAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ShortestRootPathAlgorithm.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ShortestRootPathAlgorithm.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ShortestRootPathAlgorithm.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,94 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer.label;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ivyde.eclipse.resolvevisualizer.model.IvyNodeElement;
+import org.eclipse.zest.core.viewers.EntityConnectionData;
+
+public class ShortestRootPathAlgorithm extends LabelDecoratorAlgorithmAdapter {
+    public void calculateHighlighted(IvyNodeElement root, IvyNodeElement selected,
+            Map/* <EntityConnectionData> */highlightRelationships, Map/* <IvyNodeElement> */highlightEntities) {
+        // Calculates the smart path.
+        if (selected != null) {
+            IvyNodeElement[] path = getShortestPathToDescendent(root, selected);
+            if (path.length > 1) {
+                for (int i = 0; i < path.length - 1; i++) {
+                    EntityConnectionData entityConnectionData = new EntityConnectionData(path[i + 1], path[i]);
+                    highlightRelationships.put(entityConnectionData, relationshipColor);
+                    highlightEntities.put(path[i], entityColor);
+                }
+                highlightEntities.put(path[path.length - 1], entityColor);
+            }
+            // highlightEntities.put(root, DEFAULT_ENTITY_HIGHLIGHT);
+        }
+    }
+
+    public IvyNodeElement[] getShortestPathToDescendent(IvyNodeElement root, IvyNodeElement target) {
+        LinkedList/* <IvyNodeElement> */q = new LinkedList/* <IvyNodeElement> */();
+        Set/* <IvyNodeElement> */orderedSet = new HashSet/* <IvyNodeElement> */();
+        LinkedList/* <IvyNodeElement> */orderedList = new LinkedList/* <IvyNodeElement> */();
+        q.add(root);
+        while (!q.isEmpty()) {
+            IvyNodeElement head = (IvyNodeElement) q.remove(0);
+            if (!orderedSet.contains(head)) {
+                orderedSet.add(head);
+                orderedList.add(head);
+                q.addAll(Arrays.asList(head.getDependencies()));
+            }
+        }
+        IvyNodeElement[] path = fixedWeightDijkstraAlgorithm(orderedList, root, target);
+        return path;
+    }
+
+    private IvyNodeElement[] fixedWeightDijkstraAlgorithm(LinkedList q, IvyNodeElement s, IvyNodeElement t) {
+        HashMap/* <IvyNodeElement, Integer> */previous = new HashMap/* <IvyNodeElement, Integer> */();
+        HashMap/* <IvyNodeElement, Integer> */dValues = new HashMap/* <IvyNodeElement, Integer> */();
+        for (Iterator/* <IvyNodeElement> */iter = q.iterator(); iter.hasNext();) {
+            dValues.put(iter.next(), new Integer(Integer.MAX_VALUE / 10));
+        }
+        dValues.put(s, new Integer(0));
+
+        while (!q.isEmpty()) {
+            IvyNodeElement head = (IvyNodeElement) q.remove(0);
+            IvyNodeElement[] outgoing = head.getDependencies();
+            for (int i = 0; i < outgoing.length; i++) {
+                IvyNodeElement v = outgoing[i];
+                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));
+                }
+            }
+        }
+        LinkedList/* <IvyNodeElement> */path = new LinkedList/* <IvyNodeElement> */();
+        IvyNodeElement currentNode = t;
+        while (previous.containsKey(currentNode)) {
+            path.add(currentNode);
+            currentNode = (IvyNodeElement) previous.get(currentNode);
+        }
+        path.add(currentNode);
+        return (IvyNodeElement[]) path.toArray(new IvyNodeElement[path.size()]);
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ShortestRootPathAlgorithm.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ShortestRootPathAlgorithm.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/label/ShortestRootPathAlgorithm.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/model/IIvyNodeElementFilter.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/model/IIvyNodeElementFilter.java?rev=1096453&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/model/IIvyNodeElementFilter.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/model/IIvyNodeElementFilter.java Mon Apr 25 10:43:24 2011
@@ -0,0 +1,26 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolvevisualizer.model;
+
+public interface IIvyNodeElementFilter {
+    public IvyNodeElement[] filter(IvyNodeElement[] unfiltered);
+
+    public boolean isEnabled();
+
+    public void setEnabled(boolean enabled);
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/model/IIvyNodeElementFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/model/IIvyNodeElementFilter.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/model/IIvyNodeElementFilter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain