Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r4104 - trunk/subclipse/org.tigris.subversion.subclipse.graph/src/org/tigris/subversion/subclipse/graph: editors popup/actions

subclipse
Discussion topic

Back to topic list

svn commit: r4104 - trunk/subclipse/org.tigris.subversion.subclipse.graph/src/org/tigris/subversion/subclipse/graph: editors popup/actions

Author selsemore
Full name Stephen Elsemore
Date 2008-11-20 15:56:31 PST
Message Author: selsemore
Date: 2008-11-20 15:56:31-0800
New Revision: 4104

Modified:
   trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/GraphActionBarCo​ntributor.java
   trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/GraphEditPart2.j​ava
   trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/GraphEditPartFac​tory.java
   trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/NodeFigure.java
   trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/RevisionEditPart​.java
   trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/RevisionGraphEdi​tor.java
   trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/RevisionGraphMen​uProvider.java
   trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/popu​p/actions/BranchTagA​ction.java
   trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/popu​p/actions/RefreshNod​eAction.java
   trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/popu​p/actions/RevisionDe​tailsAction.java

Log:
Revision graph - Refactor editor to extend GraphicalEditor. This makes it more similar to
the GEF example editors, which helps when comparing behavior and debugging. Also, enabled
multiple selection which was easier to do after the refactoring.

These changes cause a few regressions which I will work on fixing:

1) Properties view is no longer updated with values for selected revision.
2) Clicking on a connection no longer automatically selects the connection's
target revision and scrolls to it.

Modified: trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/GraphActionBarCo​ntributor.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/su​bclipse/org.tigris.s​ubversion.subclipse.​graph/src/org/tigris​/subversion/subclips​e/graph/editors/Grap​hActionBarContributo​r.java?view=diff​&rev=4104&p1=tru​nk/subclipse/org.tig​ris.subversion.subcl​ipse.graph/src/org/t​igris/subversion/sub​clipse/graph/editors​/GraphActionBarContr​ibutor.java&p2=t​runk/subclipse/org.t​igris.subversion.sub​clipse.graph/src/org​/tigris/subversion/s​ubclipse/graph/edito​rs/GraphActionBarCon​tributor.java&r1​=4103&r2=4104
====================​====================​====================​==================
--- trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/GraphActionBarCo​ntributor.java (original)
+++ trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/GraphActionBarCo​ntributor.java 2008-11-20 15:56:31-0800
@@ -69,7 +69,7 @@
             public void run() {
                 store.setValue(Revis​ionGraphEditor.FILTE​R_CONNECTIONS, isChecked());
                 GraphEditPart2 graphEditPart = (GraphEditPart2)edit​or.getViewer().getCo​ntents();
- graphEditPart.setCon​nectionVisibility(gr​aphEditPart.getSelec​tedNode());
+ graphEditPart.setCon​nectionVisibility();​
             }
         };
         filterConnectionsAct​ion.setImageDescript​or(SVNUIPlugin.getPl​ugin().getImageDescr​iptor(ISVNUIConstant​s.IMG_FILTER_CONNECT​IONS));

Modified: trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/GraphEditPart2.j​ava
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/su​bclipse/org.tigris.s​ubversion.subclipse.​graph/src/org/tigris​/subversion/subclips​e/graph/editors/Grap​hEditPart2.java?view​=diff&rev=4104​&p1=trunk/subclips​e/org.tigris.subvers​ion.subclipse.graph/​src/org/tigris/subve​rsion/subclipse/grap​h/editors/GraphEditP​art2.java&p2=tru​nk/subclipse/org.tig​ris.subversion.subcl​ipse.graph/src/org/t​igris/subversion/sub​clipse/graph/editors​/GraphEditPart2.java​&r1=4103&r2=​4104
====================​====================​====================​==================
--- trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/GraphEditPart2.j​ava (original)
+++ trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/GraphEditPart2.j​ava 2008-11-20 15:56:31-0800
@@ -24,8 +24,8 @@
 import org.eclipse.draw2d.g​eometry.Point;
 import org.eclipse.draw2d.g​eometry.Rectangle;
 import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Grap​hicalViewer;
 import org.eclipse.gef.edit​parts.AbstractGraphi​calEditPart;
-import org.eclipse.gef.ui.p​arts.ScrollingGraphi​calViewer;
 import org.eclipse.jface.pr​eference.IPreference​Store;
 import org.eclipse.swt.graphics.Color;
 import org.tigris.subversio​n.subclipse.graph.Ac​tivator;
@@ -34,18 +34,15 @@
 import org.tigris.subversio​n.subclipse.graph.ca​che.Graph;
 import org.tigris.subversio​n.subclipse.graph.ca​che.Node;
 
-public class GraphEditPart2 extends AbstractGraphicalEditPart implements MouseListener {
- private Graph graph;
- private NodeFigure selected;
- private ScrollingGraphicalViewer viewer;
+public class GraphEditPart2 extends AbstractGraphicalEditPart {
+ private GraphicalViewer viewer;
     private Map branchMap = new HashMap();
     private Map nodeMap = new HashMap();
     private List connections = new ArrayList();
     private IPreferenceStore store = Activator.getDefault​().getPreferenceStor​e();
 
- public GraphEditPart2(Graph graph, ScrollingGraphicalViewer viewer) {
+ public GraphEditPart2(GraphicalViewer viewer) {
         super();
- this.graph = graph;
         this.viewer = viewer;
     }
 
@@ -121,7 +118,6 @@
                 Color bgcolor = Activator.BG_COLORS[mod];
                 Color fgcolor = Activator.FG_COLORS[mod];
                 NodeFigure nodeFigure = new NodeFigure(node, bgcolor, fgcolor);
- nodeFigure.addMouseL​istener(this);
                 nodeMap.put(node, nodeFigure);
             }
         }
@@ -170,18 +166,19 @@
             }
         }
 
- Branch selectedBranch = graph.getBranch(grap​h.getSelectedPath())​;
- if (selectedBranch != null) {
- Node n = selectedBranch.getSo​urce(graph.getSelect​edRevision());
- NodeFigure nodeFigure = (NodeFigure)nodeMap.get(n);
- if(nodeFigure != null) {
- selectNode(nodeFigure);
- // FIXME: it doesn't work
-// scrollTo((Rectangle) contentsLayout.getCo​nstraint(nodeFigure)​);
- }
- }
+// TODO: Preserve selections
+// Branch selectedBranch = graph.getBranch(grap​h.getSelectedPath())​;
+// if (selectedBranch != null) {
+// Node n = selectedBranch.getSo​urce(graph.getSelect​edRevision());
+// NodeFigure nodeFigure = (NodeFigure)nodeMap.get(n);
+// if(nodeFigure != null) {
+// selectNode(nodeFigure);
+// // FIXME: it doesn't work
+//// scrollTo((Rectangle) contentsLayout.getCo​nstraint(nodeFigure)​);
+// }
+// }
         
- setConnectionVisibil​ity(selected);
+ setConnectionVisibility();
         
         return branches;
     }
@@ -212,30 +209,22 @@
         super.refreshVisuals();
     }
     
- public void setConnectionVisibil​ity(NodeFigure figure) {
+ public void setConnectionVisibility() {
         Iterator iter = connections.iterator();
         while (iter.hasNext()) {
             PolylineConnection con = (PolylineConnection)​iter.next();
- boolean show = !store.getBoolean(Re​visionGraphEditor.FI​LTER_CONNECTIONS) || (con.getSourceAnchor​().getOwner() == figure || con.getTargetAnchor(​).getOwner() == figure);
+ boolean show = false;
+ if (!store.getBoolean(R​evisionGraphEditor.F​ILTER_CONNECTIONS)) show = true;
+ else {
+ IFigure source =con.getSourceAnchor​().getOwner();
+ IFigure target = con.getTargetAnchor(​).getOwner();
+ if (source instanceof NodeFigure && ((NodeFigure)source)​.isSelected()) show = true;
+ else if (target instanceof NodeFigure && ((NodeFigure)target)​.isSelected()) show = true;
+ }
             con.setVisible(show);
         }
     }
-
- private void selectNode(NodeFigure figure) {
- setConnectionVisibil​ity(figure);
-
- if(selected != null)
- selected.setSelected(false);
- figure.setSelected(true);
- selected = figure;
- if (figure == null) graph.setSelectedNode(null);
- else graph.setSelectedNod​e(figure.getNode());​
- }
-
- public NodeFigure getSelectedNode() {
- return selected;
- }
-
+
     private PolylineConnection makeConnection(IFigure contents, IFigure source, NodeFigure target) {
         return makeConnection(contents, source, target, Activator.CONNECTION_COLOR);
     }
@@ -276,20 +265,7 @@
     private void scrollTo(IFigure target) {
         scrollTo(target.getBounds());
     }
-
- public void mouseDoubleClicked(MouseEvent event) {
- }
-
- public void mousePressed(MouseEvent event) {
- }
 
- public void mouseReleased(MouseEvent event) {
- Object source = event.getSource();
- if (source instanceof NodeFigure) {
- selectNode((NodeFigure) source);
- }
- }
-
     class ConnectionMouseListener implements MouseMotionListener, MouseListener {
 
         private PolylineConnection connection;
@@ -324,7 +300,7 @@
         public void mouseReleased(MouseEvent event) {
             NodeFigure nodeFigure = (NodeFigure) connection.getTarget​Anchor().getOwner();​
             scrollTo(nodeFigure);
- selectNode(nodeFigure);
+// selectNode(nodeFigure);
         }
 
     } class MyXYAnchor extends XYAnchor {

Modified: trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/GraphEditPartFac​tory.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/su​bclipse/org.tigris.s​ubversion.subclipse.​graph/src/org/tigris​/subversion/subclips​e/graph/editors/Grap​hEditPartFactory.jav​a?view=diff&rev=​4104&p1=trunk/su​bclipse/org.tigris.s​ubversion.subclipse.​graph/src/org/tigris​/subversion/subclips​e/graph/editors/Grap​hEditPartFactory.jav​a&p2=trunk/subcl​ipse/org.tigris.subv​ersion.subclipse.gra​ph/src/org/tigris/su​bversion/subclipse/g​raph/editors/GraphEd​itPartFactory.java​&r1=4103&r2=41​04
====================​====================​====================​==================
--- trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/GraphEditPartFac​tory.java (original)
+++ trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/GraphEditPartFac​tory.java 2008-11-20 15:56:31-0800
@@ -4,8 +4,8 @@
 import org.eclipse.draw2d.Label;
 import org.eclipse.gef.EditPart;
 import org.eclipse.gef.Edit​PartFactory;
+import org.eclipse.gef.Grap​hicalViewer;
 import org.eclipse.gef.edit​parts.AbstractGraphi​calEditPart;
-import org.eclipse.gef.ui.p​arts.ScrollingGraphi​calViewer;
 import org.tigris.subversio​n.subclipse.graph.ca​che.Branch;
 import org.tigris.subversio​n.subclipse.graph.ca​che.Graph;
 import org.tigris.subversio​n.subclipse.graph.ca​che.Node;
@@ -13,9 +13,9 @@
 
 public class GraphEditPartFactory implements EditPartFactory {
     
- private ScrollingGraphicalViewer viewer;
+ private GraphicalViewer viewer;
     
- public GraphEditPartFactory​(ScrollingGraphicalV​iewer viewer) {
+ public GraphEditPartFactory​(GraphicalViewer viewer) {
         this.viewer = viewer;
     }
 
@@ -32,7 +32,7 @@
                 }
             };
         } else if (model instanceof Graph) {
- editPart = new GraphEditPart2((Graph) model, viewer);
+ editPart = new GraphEditPart2(viewer);
         } else if (model instanceof Branch) {
             editPart = new BranchEditPart();
         } else if (model instanceof Path) {

Modified: trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/NodeFigure.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/su​bclipse/org.tigris.s​ubversion.subclipse.​graph/src/org/tigris​/subversion/subclips​e/graph/editors/Node​Figure.java?view=dif​f&rev=4104&p​1=trunk/subclipse/or​g.tigris.subversion.​subclipse.graph/src/​org/tigris/subversio​n/subclipse/graph/ed​itors/NodeFigure.jav​a&p2=trunk/subcl​ipse/org.tigris.subv​ersion.subclipse.gra​ph/src/org/tigris/su​bversion/subclipse/g​raph/editors/NodeFig​ure.java&r1=4103​&r2=4104
====================​====================​====================​==================
--- trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/NodeFigure.java (original)
+++ trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/NodeFigure.java 2008-11-20 15:56:31-0800
@@ -19,8 +19,7 @@
     private int sourceIndex;
     private boolean hasTags;
     private Color bgcolor;
-
-// private List connections = null;
+ private boolean selected;
     
     public NodeFigure(Node node, Color bgcolor, Color fgcolor) {
         this.node = node;
@@ -51,19 +50,6 @@
         return node;
     }
     
-// public int addConnection(Polyli​neConnection c, Node source) {
-// if(connections == null)
-// connections = new ArrayList();
-// connections.add(c);
-// NodeTooltipFigure tt = (NodeTooltipFigure) getToolTip();
-// tt.addSource(source);
-// return connections.size();
-// }
-//
-// public List getConnections() {
-// return connections;
-// }
-
     public void addTag(Node source) {
         NodeTooltipFigure tt = (NodeTooltipFigure) getToolTip();
         tt.addTag(source);
@@ -88,10 +74,15 @@
     }
     
     public void setSelected(boolean selected) {
+ this.selected = selected;
         if(selected)
             setBackgroundColor(C​olorConstants.white)​;
         else
             setBackgroundColor(bgcolor);
     }
     
+ public boolean isSelected() {
+ return selected;
+ }
+
 }

Modified: trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/RevisionEditPart​.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/su​bclipse/org.tigris.s​ubversion.subclipse.​graph/src/org/tigris​/subversion/subclips​e/graph/editors/Revi​sionEditPart.java?vi​ew=diff&rev=4104​&p1=trunk/subcli​pse/org.tigris.subve​rsion.subclipse.grap​h/src/org/tigris/sub​version/subclipse/gr​aph/editors/Revision​EditPart.java&p2​=trunk/subclipse/org​.tigris.subversion.s​ubclipse.graph/src/o​rg/tigris/subversion​/subclipse/graph/edi​tors/RevisionEditPar​t.java&r1=4103​&r2=4104
====================​====================​====================​==================
--- trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/RevisionEditPart​.java (original)
+++ trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/RevisionEditPart​.java 2008-11-20 15:56:31-0800
@@ -42,11 +42,21 @@
         return nodeFigure;
     }
 
+ protected void refreshVisuals() {
+ Node node = (Node)getModel();
+ GraphEditPart2 graphEditPart = (GraphEditPart2)getP​arent().getParent();​
+ NodeFigure nodeFigure = graphEditPart.getNod​eFigure(node);
+ nodeFigure.setSelect​ed(getSelected() != SELECTED_NONE);
+ graphEditPart.setCon​nectionVisibility();​
+ }
+
     protected void createEditPolicies() {
         installEditPolicy(Ed​itPolicy.SELECTION_F​EEDBACK_ROLE, new SelectionEditPolicy() {
             protected void hideSelection() {
+ refreshVisuals();
             }
             protected void showSelection() {
+ refreshVisuals();
             }
         });
     }

Modified: trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/RevisionGraphEdi​tor.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/su​bclipse/org.tigris.s​ubversion.subclipse.​graph/src/org/tigris​/subversion/subclips​e/graph/editors/Revi​sionGraphEditor.java​?view=diff&rev=4​104&p1=trunk/sub​clipse/org.tigris.su​bversion.subclipse.g​raph/src/org/tigris/​subversion/subclipse​/graph/editors/Revis​ionGraphEditor.java​&p2=trunk/subclip​se/org.tigris.subver​sion.subclipse.graph​/src/org/tigris/subv​ersion/subclipse/gra​ph/editors/RevisionG​raphEditor.java&​r1=4103&r2=4104
====================​====================​====================​==================
--- trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/RevisionGraphEdi​tor.java (original)
+++ trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/RevisionGraphEdi​tor.java 2008-11-20 15:56:31-0800
@@ -6,6 +6,7 @@
 import org.eclipse.core.res​ources.IResource;
 import org.eclipse.core.run​time.IProgressMonito​r;
 import org.eclipse.gef.Cont​extMenuProvider;
+import org.eclipse.gef.Defa​ultEditDomain;
 import org.eclipse.gef.EditPartViewer;
 import org.eclipse.gef.Grap​hicalViewer;
 import org.eclipse.gef.Mous​eWheelHandler;
@@ -16,15 +17,12 @@
 import org.eclipse.gef.ui.a​ctions.ActionRegistr​y;
 import org.eclipse.gef.ui.a​ctions.ZoomInAction;​
 import org.eclipse.gef.ui.a​ctions.ZoomOutAction​;
-import org.eclipse.gef.ui.p​arts.ScrollingGraphi​calViewer;
+import org.eclipse.gef.ui.p​arts.GraphicalEditor​;
 import org.eclipse.jface.ac​tion.IAction;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.widg​ets.Composite;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorSite;
 import org.eclipse.ui.PartI​nitException;
-import org.eclipse.ui.part.EditorPart;
 import org.eclipse.ui.part.​FileEditorInput;
 import org.eclipse.ui.views​.contentoutline.ICon​tentOutlinePage;
 import org.tigris.subversio​n.subclipse.graph.ca​che.Cache;
@@ -34,10 +32,9 @@
 import org.tigris.subversio​n.svnclientadapter.I​SVNLogMessageCallbac​k;
 import org.tigris.subversio​n.svnclientadapter.S​VNClientException;
 
-public class RevisionGraphEditor extends EditorPart {
+public class RevisionGraphEditor extends GraphicalEditor {
 
     private OverviewOutlinePage overviewOutlinePage;
- private ScrollingGraphicalViewer viewer;
 
     private ActionRegistry actionRegistry;
     
@@ -47,6 +44,11 @@
     public final static int SHOW_DELETED_YES = 1;
     public final static int SHOW_DELETED_NO = 2;
 
+ public RevisionGraphEditor() {
+ super();
+ setEditDomain(new DefaultEditDomain(this));
+ }
+
     public ActionRegistry getActionRegistry() {
         if (actionRegistry == null)
             actionRegistry = new ActionRegistry();
@@ -58,9 +60,8 @@
     
     public void showGraphFor(IResource resource) {
         setPartName(resource​.getName()+" revision graph");
-// setContentDescription("Revision graph for "+resource.getName());
         GraphBackgroundTask task =
- new GraphBackgroundTask(​getSite().getPart(),​ viewer, this, resource);
+ new GraphBackgroundTask(​getSite().getPart(),​ getGraphicalViewer(), this, resource);
         try {
             task.run();
         } catch (Exception e) {
@@ -72,8 +73,8 @@
     public void showGraphFor(Revisio​nGraphEditorInput editorInput) {
         setPartName(editorIn​put.getName() + " revision graph");
         GraphBackgroundTask task;
- if (editorInput.getResource() == null) task = new GraphBackgroundTask(​getSite().getPart(),​ viewer, this, editorInput.getRemot​eResource());
- else task = new GraphBackgroundTask(​getSite().getPart(),​ viewer, this, editorInput.getResource());
+ if (editorInput.getResource() == null) task = new GraphBackgroundTask(​getSite().getPart(),​ getGraphicalViewer(), this, editorInput.getRemot​eResource());
+ else task = new GraphBackgroundTask(​getSite().getPart(),​ getGraphicalViewer(), this, editorInput.getResource());
         try {
             task.run();
         } catch (Exception e) {
@@ -85,20 +86,59 @@
     public Object getAdapter(Class adapter) {
         if(adapter == GraphicalViewer.class ||
                 adapter == EditPartViewer.class) {
- return viewer;
+ return getGraphicalViewer();
         } else if(adapter == ZoomManager.class) {
- return ((ScalableRootEditPart) viewer.getRootEditPa​rt()).getZoomManager​();
+ return ((ScalableRootEditPart) getGraphicalViewer()​.getRootEditPart()).​getZoomManager();
         } else if (adapter == IContentOutlinePage.class) {
             return getOverviewOutlinePage();
         }
         return super.getAdapter(adapter);
     }
+
+ public void refresh() {
+ getGraphicalViewer()​.setContents("Loadin​g graph... This can take several minutes");
+ showGraphFor((Revisi​onGraphEditorInput)g​etEditorInput());
+ }
+
+ public void doSave(IProgressMonitor monitor) {
+ }
+
+ public void doSaveAs() {
+ }
+
+ public void init(IEditorSite site, IEditorInput input)
+ throws PartInitException {
+ setSite(site);
+ setInput(input);
+ }
+
+ public boolean isDirty() {
+ return false;
+ }
+
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
     
- public void createPartControl(Composite parent) {
- GC gc = new GC(parent);
- gc.setAntialias(SWT.ON);
- viewer = new ScrollingGraphicalViewer();
- viewer.createControl(parent);
+ public GraphicalViewer getViewer() {
+ return getGraphicalViewer();
+ }
+
+ protected OverviewOutlinePage getOverviewOutlinePage() {
+ if(null == overviewOutlinePage && null != getGraphicalViewer()) {
+ RootEditPart rootEditPart = getGraphicalViewer()​.getRootEditPart();
+ if(rootEditPart instanceof ScalableRootEditPart) {
+ overviewOutlinePage =
+ new OverviewOutlinePage(
+ (ScalableRootEditPart) rootEditPart);
+ }
+ }
+ return overviewOutlinePage;
+ }
+
+ protected void configureGraphicalViewer() {
+ super.configureGraph​icalViewer();
+ GraphicalViewer viewer = getGraphicalViewer();
         ScalableRootEditPart root = new ScalableRootEditPart();
         viewer.setRootEditPart(root);
         viewer.setEditPartFactory(new GraphEditPartFactory(viewer));
@@ -106,7 +146,6 @@
         ContextMenuProvider cmProvider = new RevisionGraphMenuPro​vider(viewer, this);
         viewer.setContextMen​u(cmProvider);
         getSite().setSelecti​onProvider(viewer);
-// getSite().registerCo​ntextMenu(cmProvider​, viewer);
         IEditorInput input = getEditorInput();
         if(input instanceof FileEditorInput) {
             FileEditorInput fileEditorInput = (FileEditorInput) input;
@@ -134,47 +173,11 @@
         viewer.setProperty(M​ouseWheelHandler.Key​Generator.getKey(SWT​.MOD1),
                 MouseWheelZoomHandle​r.SINGLETON);
     }
-
- public void refresh() {
- viewer.setContents("Loading graph... This can take several minutes");
- showGraphFor((Revisi​onGraphEditorInput)g​etEditorInput());
- }
 
- public void doSave(IProgressMonitor monitor) {
- }
-
- public void doSaveAs() {
- }
-
- public void init(IEditorSite site, IEditorInput input)
- throws PartInitException {
- setSite(site);
- setInput(input);
- }
-
- public boolean isDirty() {
- return false;
- }
-
- public boolean isSaveAsAllowed() {
- return false;
+ protected void initializeGraphicalViewer() {
     }
     
- public ScrollingGraphicalViewer getViewer() {
- return viewer;
- }
     
- protected OverviewOutlinePage getOverviewOutlinePage() {
- if(null == overviewOutlinePage && null != viewer) {
- RootEditPart rootEditPart = viewer.getRootEditPart();
- if(rootEditPart instanceof ScalableRootEditPart) {
- overviewOutlinePage =
- new OverviewOutlinePage(
- (ScalableRootEditPart) rootEditPart);
- }
- }
- return overviewOutlinePage;
- }
 
 } class WorkMonitorListener implements WorkListener {
     
@@ -191,9 +194,7 @@
     }
 
 } class CallbackUpdater implements ISVNLogMessageCallback {
-
-// private List messages = new ArrayList();
-
+
     private Cache cache;
     private IProgressMonitor monitor;
     private int unitWork;
@@ -215,19 +216,8 @@
             } catch (SVNClientException e) {}
             return;
         }
-// messages.add(message);
-// monitor.worked(unitWork);
         cache.update(message);
         monitor.worked(unitWork);
     }
-
-// public void writeMessages() {
-// Iterator iter = messages.iterator();
-// while (iter.hasNext()) {
-// ISVNLogMessage message = (ISVNLogMessage)iter.next();
-// cache.update(message);
-// monitor.worked(unitWork);
-// }
-// }
 
 }
\ No newline at end of file

Modified: trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/RevisionGraphMen​uProvider.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/su​bclipse/org.tigris.s​ubversion.subclipse.​graph/src/org/tigris​/subversion/subclips​e/graph/editors/Revi​sionGraphMenuProvide​r.java?view=diff​&rev=4104&p1=tru​nk/subclipse/org.tig​ris.subversion.subcl​ipse.graph/src/org/t​igris/subversion/sub​clipse/graph/editors​/RevisionGraphMenuPr​ovider.java&p2=t​runk/subclipse/org.t​igris.subversion.sub​clipse.graph/src/org​/tigris/subversion/s​ubclipse/graph/edito​rs/RevisionGraphMenu​Provider.java&r1​=4103&r2=4104
====================​====================​====================​==================
--- trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/RevisionGraphMen​uProvider.java (original)
+++ trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/RevisionGraphMen​uProvider.java 2008-11-20 15:56:31-0800
@@ -1,9 +1,15 @@
 package org.tigris.subversio​n.subclipse.graph.ed​itors;
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
 import org.eclipse.gef.Cont​extMenuProvider;
+import org.eclipse.gef.EditPart;
 import org.eclipse.gef.EditPartViewer;
 import org.eclipse.jface.ac​tion.IMenuManager;
 import org.eclipse.jface.ac​tion.Separator;
+import org.tigris.subversio​n.subclipse.graph.ca​che.Node;
 import org.tigris.subversio​n.subclipse.graph.po​pup.actions.BranchTa​gAction;
 import org.tigris.subversio​n.subclipse.graph.po​pup.actions.ImageAct​ion;
 import org.tigris.subversio​n.subclipse.graph.po​pup.actions.RefreshN​odeAction;
@@ -19,16 +25,29 @@
     }
 
     public void buildContextMenu(IMenuManager menu) {
- GraphEditPart2 graphEditPart = (GraphEditPart2)getV​iewer().getContents(​);
- NodeFigure nodeFigure = graphEditPart.getSel​ectedNode();
- if (nodeFigure != null) {
- menu.add(new RevisionDetailsActio​n(nodeFigure, editor));
+ List selectedRevisions = getSelectedRevisions();
+ if (selectedRevisions.size() == 1) {
+ RevisionEditPart revision = (RevisionEditPart)se​lectedRevisions.get(​0);
+ Node node = (Node)revision.getModel();
+ NodeFigure nodeFigure = (NodeFigure)revision​.getFigure();
+ menu.add(new RevisionDetailsAction(node, editor));
             menu.add(new SetCommitPropertiesA​ction(nodeFigure, editor));
- menu.add(new BranchTagAction("Create Branch/Tag from Revision " + nodeFigure.getNode()​.getRevision() + "...", editor, nodeFigure));
- menu.add(new RefreshNodeAction(nodeFigure, editor));
+ menu.add(new BranchTagAction("Create Branch/Tag from Revision " + node.getRevision() + "...", editor, node));
+ menu.add(new RefreshNodeAction(node, editor));
         }
         menu.add(new Separator());
         menu.add(new ImageAction(editor));
     }
+
+ private List getSelectedRevisions() {
+ List selectedRevisions = new ArrayList();
+ List selectedEditParts = getViewer().getSelec​tedEditParts();
+ Iterator iter = selectedEditParts.iterator();
+ while (iter.hasNext()) {
+ EditPart editPart = (EditPart)iter.next();
+ if (editPart instanceof RevisionEditPart) selectedRevisions.ad​d(editPart);
+ }
+ return selectedRevisions;
+ }
 
 }

Modified: trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/popu​p/actions/BranchTagA​ction.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/su​bclipse/org.tigris.s​ubversion.subclipse.​graph/src/org/tigris​/subversion/subclips​e/graph/popup/action​s/BranchTagAction.ja​va?view=diff&rev​=4104&p1=trunk/s​ubclipse/org.tigris.​subversion.subclipse​.graph/src/org/tigri​s/subversion/subclip​se/graph/popup/actio​ns/BranchTagAction.j​ava&p2=trunk/sub​clipse/org.tigris.su​bversion.subclipse.g​raph/src/org/tigris/​subversion/subclipse​/graph/popup/actions​/BranchTagAction.jav​a&r1=4103&r2​=4104
====================​====================​====================​==================
--- trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/popu​p/actions/BranchTagA​ction.java (original)
+++ trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/popu​p/actions/BranchTagA​ction.java 2008-11-20 15:56:31-0800
@@ -9,7 +9,7 @@
 import org.tigris.subversio​n.subclipse.core.ISV​NRemoteResource;
 import org.tigris.subversio​n.subclipse.core.SVN​ProviderPlugin;
 import org.tigris.subversio​n.subclipse.core.his​tory.Alias;
-import org.tigris.subversio​n.subclipse.graph.ed​itors.NodeFigure;
+import org.tigris.subversio​n.subclipse.graph.ca​che.Node;
 import org.tigris.subversio​n.subclipse.graph.ed​itors.RevisionGraphE​ditor;
 import org.tigris.subversio​n.subclipse.graph.ed​itors.RevisionGraphE​ditorInput;
 import org.tigris.subversio​n.subclipse.ui.Polic​y;
@@ -22,12 +22,12 @@
 
 public class BranchTagAction extends Action {
     private RevisionGraphEditor editor;
- private NodeFigure nodeFigure;
+ private Node node;
 
- public BranchTagAction(String text, RevisionGraphEditor editor, NodeFigure nodeFigure) {
+ public BranchTagAction(String text, RevisionGraphEditor editor, Node node) {
         super(text);
         this.editor = editor;
- this.nodeFigure = nodeFigure;
+ this.node = node;
     }
 
     public void run() {
@@ -41,7 +41,7 @@
             IResource[] resources = { resource };
             wizard = new BranchTagWizard(resources);
         }
- wizard.setRevisionNu​mber(nodeFigure.getN​ode().getRevision())​;
+ wizard.setRevisionNu​mber(node.getRevisio​n());
         WizardDialog dialog = new ClosableWizardDialog​(Display.getDefault(​).getActiveShell(), wizard);
         if (dialog.open() == WizardDialog.OK) {
             final SVNUrl sourceUrl = wizard.getUrl();

Modified: trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/popu​p/actions/RefreshNod​eAction.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/su​bclipse/org.tigris.s​ubversion.subclipse.​graph/src/org/tigris​/subversion/subclips​e/graph/popup/action​s/RefreshNodeAction.​java?view=diff&r​ev=4104&p1=trunk​/subclipse/org.tigri​s.subversion.subclip​se.graph/src/org/tig​ris/subversion/subcl​ipse/graph/popup/act​ions/RefreshNodeActi​on.java&p2=trunk​/subclipse/org.tigri​s.subversion.subclip​se.graph/src/org/tig​ris/subversion/subcl​ipse/graph/popup/act​ions/RefreshNodeActi​on.java&r1=4103​&r2=4104
====================​====================​====================​==================
--- trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/popu​p/actions/RefreshNod​eAction.java (original)
+++ trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/popu​p/actions/RefreshNod​eAction.java 2008-11-20 15:56:31-0800
@@ -7,7 +7,6 @@
 import org.tigris.subversio​n.subclipse.core.ISV​NRemoteResource;
 import org.tigris.subversio​n.subclipse.graph.ca​che.Node;
 import org.tigris.subversio​n.subclipse.graph.ed​itors.GraphBackgroun​dTask;
-import org.tigris.subversio​n.subclipse.graph.ed​itors.NodeFigure;
 import org.tigris.subversio​n.subclipse.graph.ed​itors.RevisionGraphE​ditor;
 import org.tigris.subversio​n.subclipse.graph.ed​itors.RevisionGraphE​ditorInput;
 import org.tigris.subversio​n.subclipse.ui.Polic​y;
@@ -18,10 +17,10 @@
     private Node node;
     private RevisionGraphEditor editor;
 
- public RefreshNodeAction(NodeFigure nodeFigure, RevisionGraphEditor editor) {
+ public RefreshNodeAction(Node node, RevisionGraphEditor editor) {
         super();
         this.editor = editor;
- node = nodeFigure.getNode();
+ this.node = node;
         setText(Policy.bind(​"RefreshNodeAction.t​itle")); //$NON-NLS-1$
     }
     

Modified: trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/popu​p/actions/RevisionDe​tailsAction.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/su​bclipse/org.tigris.s​ubversion.subclipse.​graph/src/org/tigris​/subversion/subclips​e/graph/popup/action​s/RevisionDetailsAct​ion.java?view=diff​&rev=4104&p1=t​runk/subclipse/org.t​igris.subversion.sub​clipse.graph/src/org​/tigris/subversion/s​ubclipse/graph/popup​/actions/RevisionDet​ailsAction.java&​p2=trunk/subclipse/o​rg.tigris.subversion​.subclipse.graph/src​/org/tigris/subversi​on/subclipse/graph/p​opup/actions/Revisio​nDetailsAction.java​&r1=4103&r2=4​104
====================​====================​====================​==================
--- trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/popu​p/actions/RevisionDe​tailsAction.java (original)
+++ trunk/subclipse/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/popu​p/actions/RevisionDe​tailsAction.java 2008-11-20 15:56:31-0800
@@ -12,7 +12,6 @@
 import org.tigris.subversio​n.subclipse.core.his​tory.ILogEntry;
 import org.tigris.subversio​n.subclipse.core.res​ources.RemoteFile;
 import org.tigris.subversio​n.subclipse.graph.ca​che.Node;
-import org.tigris.subversio​n.subclipse.graph.ed​itors.NodeFigure;
 import org.tigris.subversio​n.subclipse.graph.ed​itors.RevisionGraphE​ditor;
 import org.tigris.subversio​n.subclipse.graph.ed​itors.RevisionGraphE​ditorInput;
 import org.tigris.subversio​n.subclipse.ui.ISVNU​IConstants;
@@ -23,18 +22,16 @@
 import org.tigris.subversio​n.svnclientadapter.S​VNUrl;
 
 public class RevisionDetailsAction extends Action {
- private NodeFigure nodeFigure;
     private Node node;
     private RevisionGraphEditor editor;
     private ISVNRemoteResource remoteResource;
     private ILogEntry logEntry;
     private boolean includeTags;
 
- public RevisionDetailsActio​n(NodeFigure nodeFigure, RevisionGraphEditor editor) {
+ public RevisionDetailsAction(Node node, RevisionGraphEditor editor) {
         super();
- this.nodeFigure = nodeFigure;
+ this.node = node;
         this.editor = editor;
- node = nodeFigure.getNode();
         setText("Revision info...");
     }
     
@@ -48,7 +45,6 @@
                     RevisionGraphEditorInput input = (RevisionGraphEditor​Input)editor.getEdit​orInput();
                     ISVNInfo info = input.getInfo();
                     ISVNRepositoryLocation repository = SVNProviderPlugin.ge​tPlugin().getReposit​ory(info.getReposito​ry().toString());
-// remoteResource = repository.getRemote​File(node.getPath())​;
                     
                     remoteResource = new RemoteFile(repository, new SVNUrl(repository.getLocation() + node.getPath()), new SVNRevision.Number(n​ode.getRevision()));​

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r4104 - trunk/subclipse/org.tigris.subversion.subclipse.graph/src/org/tigris/subversion/subclipse/graph: editors popup/actions selsemore Stephen Elsemore 2008-11-20 15:56:31 PST
Messages per page: