diff options
author | rbrooks | 2010-07-24 17:38:31 +0000 |
---|---|---|
committer | rbrooks | 2010-07-24 17:38:31 +0000 |
commit | 4081f04850d3eff9eb1bd7241763707bfbb43a45 (patch) | |
tree | 258620df94d4b24077ff103a6c4dea9cb78493fb /plugins/org.eclipse.osee.framework.ui.branch.graph | |
parent | 4ed8bddc791fda93940f238c5135556a07041dc0 (diff) | |
download | org.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.tar.gz org.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.tar.xz org.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.zip |
applied Eclipse source cleanup
Diffstat (limited to 'plugins/org.eclipse.osee.framework.ui.branch.graph')
29 files changed, 328 insertions, 247 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/BranchGraphActivator.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/BranchGraphActivator.java index 3baa0d33d1e..8df9bf282ac 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/BranchGraphActivator.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/BranchGraphActivator.java @@ -25,11 +25,13 @@ public class BranchGraphActivator extends OseeUiActivator { public BranchGraphActivator() { } + @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; } + @Override public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context); diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/OpenBranchGraph.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/OpenBranchGraph.java index c7bfac9e8ce..08163b90be8 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/OpenBranchGraph.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/OpenBranchGraph.java @@ -39,7 +39,7 @@ public class OpenBranchGraph extends AbstractSelectionChangedHandler { List<Branch> branches = Handlers.getBranchesFromStructuredSelection((IStructuredSelection) selection); if (!branches.isEmpty()) { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor( - new BranchGraphEditorInput(branches.iterator().next()), BranchGraphEditor.EDITOR_ID); + new BranchGraphEditorInput(branches.iterator().next()), BranchGraphEditor.EDITOR_ID); } } } catch (Exception ex) { diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphActionBarContributor.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphActionBarContributor.java index 1060452b560..40750e2b8fd 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphActionBarContributor.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphActionBarContributor.java @@ -61,19 +61,18 @@ public class BranchGraphActionBarContributor extends ActionBarContributor { toolBarManager.add(new Separator()); toggleFilterConnectionAction = - new ToggleFilterConnectionAction[] { - new ToggleFilterConnectionAction("None", ConnectionFilter.NO_FILTER), - new ToggleFilterConnectionAction("Filter All Connections", ConnectionFilter.FILTER_ALL_CONNECTIONS), - new ToggleFilterConnectionAction("Filter Branch Hierarchy Connections", - ConnectionFilter.FILTER_CHILD_BRANCH_CONNECTIONS), - new ToggleFilterConnectionAction("Filter Merge Connections", - ConnectionFilter.FILTER_MERGE_CONNECTIONS)}; + new ToggleFilterConnectionAction[] { + new ToggleFilterConnectionAction("None", ConnectionFilter.NO_FILTER), + new ToggleFilterConnectionAction("Filter All Connections", ConnectionFilter.FILTER_ALL_CONNECTIONS), + new ToggleFilterConnectionAction("Filter Branch Hierarchy Connections", + ConnectionFilter.FILTER_CHILD_BRANCH_CONNECTIONS), + new ToggleFilterConnectionAction("Filter Merge Connections", ConnectionFilter.FILTER_MERGE_CONNECTIONS)}; toolBarManager.add(new FilterConnectionAction()); toggleTxFilterAction = - new ToggleTxFilterAction[] {new ToggleTxFilterAction("Show All", TxFilter.NO_FILTER), - new ToggleTxFilterAction("Hide All", TxFilter.HIDE_ALL)}; + new ToggleTxFilterAction[] {new ToggleTxFilterAction("Show All", TxFilter.NO_FILTER), + new ToggleTxFilterAction("Hide All", TxFilter.HIDE_ALL)}; toolBarManager.add(new FilterTxAction()); } @@ -127,6 +126,7 @@ public class BranchGraphActionBarContributor extends ActionBarContributor { setMenuCreator(this); } + @Override public void dispose() { if (menu != null) { menu.dispose(); @@ -134,6 +134,7 @@ public class BranchGraphActionBarContributor extends ActionBarContributor { } } + @Override public Menu getMenu(Control parent) { if (menu != null) { menu.dispose(); @@ -145,6 +146,7 @@ public class BranchGraphActionBarContributor extends ActionBarContributor { return menu; } + @Override public Menu getMenu(Menu parent) { return null; } @@ -166,6 +168,7 @@ public class BranchGraphActionBarContributor extends ActionBarContributor { setMenuCreator(this); } + @Override public void dispose() { if (menu != null) { menu.dispose(); @@ -173,6 +176,7 @@ public class BranchGraphActionBarContributor extends ActionBarContributor { } } + @Override public Menu getMenu(Control parent) { if (menu != null) { menu.dispose(); @@ -184,6 +188,7 @@ public class BranchGraphActionBarContributor extends ActionBarContributor { return menu; } + @Override public Menu getMenu(Menu parent) { return null; } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphEditor.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphEditor.java index b0d20f9e517..77ad0519660 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphEditor.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphEditor.java @@ -69,6 +69,7 @@ public class BranchGraphEditor extends GraphicalEditorWithFlyoutPalette { setEditDomain(new DefaultEditDomain(this)); } + @Override public ActionRegistry getActionRegistry() { if (actionRegistry == null) { actionRegistry = new ActionRegistry(); @@ -76,13 +77,14 @@ public class BranchGraphEditor extends GraphicalEditorWithFlyoutPalette { return actionRegistry; } + @Override public void setFocus() { } public void showGraphFor(BranchGraphEditorInput editorInput) { setPartName(editorInput.getName() + " Graph"); LoadGraphOperation task = - new LoadGraphOperation(getSite().getPart(), getGraphicalViewer(), this, editorInput.getBranch()); + new LoadGraphOperation(getSite().getPart(), getGraphicalViewer(), this, editorInput.getBranch()); Jobs.runInJob(task.getName(), task, BranchGraphActivator.class, BranchGraphActivator.PLUGIN_ID, true); } @@ -104,21 +106,26 @@ public class BranchGraphEditor extends GraphicalEditorWithFlyoutPalette { showGraphFor((BranchGraphEditorInput) getEditorInput()); } + @Override public void doSave(IProgressMonitor monitor) { } + @Override public void doSaveAs() { } + @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { setSite(site); setInput(input); } + @Override public boolean isDirty() { return false; } + @Override public boolean isSaveAsAllowed() { return false; } @@ -137,6 +144,7 @@ public class BranchGraphEditor extends GraphicalEditorWithFlyoutPalette { return overviewOutlinePage; } + @Override protected void configureGraphicalViewer() { super.configureGraphicalViewer(); @@ -174,12 +182,12 @@ public class BranchGraphEditor extends GraphicalEditorWithFlyoutPalette { getSite().getKeyBindingService().registerAction(zoomIn); getSite().getKeyBindingService().registerAction(zoomOut); List<String> zoomContributions = - Arrays.asList(new String[] {ZoomManager.FIT_ALL, ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH}); + Arrays.asList(new String[] {ZoomManager.FIT_ALL, ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH}); zoomManager.setZoomLevelContributions(zoomContributions); try { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView( - "org.eclipse.ui.views.ContentOutline"); + "org.eclipse.ui.views.ContentOutline"); } catch (PartInitException ex) { OseeLog.log(BranchGraphActivator.class, Level.SEVERE, ex); } @@ -189,12 +197,13 @@ public class BranchGraphEditor extends GraphicalEditorWithFlyoutPalette { protected KeyHandler getCommonKeyHandler() { if (shareKeyHandler == null) { shareKeyHandler = new GraphicalViewerKeyHandler(getViewer()); - shareKeyHandler.put(KeyStroke.getPressed(SWT.F2, 0), getActionRegistry().getAction( - GEFActionConstants.DIRECT_EDIT)); + shareKeyHandler.put(KeyStroke.getPressed(SWT.F2, 0), + getActionRegistry().getAction(GEFActionConstants.DIRECT_EDIT)); } return shareKeyHandler; } + @Override protected void initializeGraphicalViewer() { } @@ -209,12 +218,15 @@ public class BranchGraphEditor extends GraphicalEditorWithFlyoutPalette { @Override protected PaletteViewerProvider createPaletteViewerProvider() { return new PaletteViewerProvider(getEditDomain()) { + @Override protected void configurePaletteViewer(PaletteViewer viewer) { super.configurePaletteViewer(viewer); viewer.setCustomizer(new PaletteCustomizer() { + @Override public void revertToSaved() { } + @Override public void save() { } }); @@ -226,6 +238,7 @@ public class BranchGraphEditor extends GraphicalEditorWithFlyoutPalette { @Override protected CustomPalettePage createPalettePage() { return new CustomPalettePage(getPaletteViewerProvider()) { + @Override public void init(IPageSite pageSite) { super.init(pageSite); IAction copy = getActionRegistry().getAction(ActionFactory.COPY.getId()); diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphEditorInput.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphEditorInput.java index 741d2341e36..2026b71a4f1 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphEditorInput.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphEditorInput.java @@ -35,22 +35,27 @@ public class BranchGraphEditorInput implements IEditorInput { this(BranchManager.getSystemRootBranch()); } + @Override public boolean exists() { return false; } + @Override public ImageDescriptor getImageDescriptor() { return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(getName()); } + @Override public String getName() { return branch != null ? branch.getName() : "Branch was Null"; } + @Override public IPersistableElement getPersistable() { return null; } + @Override public String getToolTipText() { return getName(); } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphOutlinePage.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphOutlinePage.java index 93b15f4d02f..f3ed3f099ae 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphOutlinePage.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphOutlinePage.java @@ -36,7 +36,7 @@ public class BranchGraphOutlinePage extends Page implements IContentOutlinePage private Composite composite; private Canvas overview; - private ScalableRootEditPart rootEditPart; + private final ScalableRootEditPart rootEditPart; private Thumbnail thumbnail; public BranchGraphOutlinePage(ScalableRootEditPart rootEditPart) { @@ -44,10 +44,12 @@ public class BranchGraphOutlinePage extends Page implements IContentOutlinePage this.rootEditPart = rootEditPart; } + @Override public void addSelectionChangedListener(ISelectionChangedListener listener) { } + @Override public void createControl(Composite parent) { composite = new Composite(parent, SWT.BORDER); composite.setLayout(new FillLayout(SWT.VERTICAL)); @@ -64,27 +66,37 @@ public class BranchGraphOutlinePage extends Page implements IContentOutlinePage lws.setContents(thumbnail); } + @Override public void dispose() { - if (null != thumbnail) thumbnail.deactivate(); + if (null != thumbnail) { + thumbnail.deactivate(); + } super.dispose(); } + @Override public Control getControl() { return composite; } + @Override public ISelection getSelection() { return StructuredSelection.EMPTY; } + @Override public void removeSelectionChangedListener(ISelectionChangedListener listener) { } + @Override public void setFocus() { - if (getControl() != null) getControl().setFocus(); + if (getControl() != null) { + getControl().setFocus(); + } } + @Override public void setSelection(ISelection selection) { } @@ -93,6 +105,7 @@ public class BranchGraphOutlinePage extends Page implements IContentOutlinePage // viewer.setInput(object != null ? object : "Data not available"); } + @Override public void init(IPageSite pageSite) { super.init(pageSite); } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphPaletteProvider.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphPaletteProvider.java index 49e2489fa2d..ecd520826d8 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphPaletteProvider.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/core/BranchGraphPaletteProvider.java @@ -33,89 +33,89 @@ import org.eclipse.osee.framework.ui.swt.KeyedImage; */ public class BranchGraphPaletteProvider { - private static final String[] drawerNames = new String[] {"Filters"}; - private PaletteRoot paletteRoot; - private final BranchGraphEditor editor; - - public BranchGraphPaletteProvider(BranchGraphEditor editor) { - this.paletteRoot = null; - this.editor = editor; - } - - public PaletteRoot getPaletteRoot() { - if (paletteRoot == null) { - paletteRoot = new PaletteRoot(); - paletteRoot.add(createToolsGroup(paletteRoot)); - // addDrawers(paletteRoot); - } - return paletteRoot; - } - - private void addDrawers(PaletteRoot paletteRoot) { - for (String drawerName : drawerNames) { - PaletteContainer container = new PaletteDrawer(drawerName); - - String name = "one"; - String description = "example"; - Class<?> clazz = Object.class; - - container.add(createComponent(name, description, clazz, FrameworkImage.RECTANGLE_16, - FrameworkImage.RECTANGLE_24)); - paletteRoot.add(container); - } - } - - private ToolEntry createComponent(String label, String description, Class<?> clazz, KeyedImage smallImage, KeyedImage largeImage) { - ToolEntry toolEntry = - new ToolEntry(label, description, ImageManager.getImageDescriptor(smallImage), - ImageManager.getImageDescriptor(largeImage)) { - - }; - return toolEntry; - } - - private PaletteContainer createToolsGroup(PaletteRoot palette) { - PaletteToolbar toolbar = new PaletteToolbar("Tools"); - - ToolEntry tool = new PanningSelectionToolEntry(); - toolbar.add(tool); - palette.setDefaultEntry(tool); - - toolbar.add(new MarqueeToolEntry()); - - final Action action = - OseeUiActions.createBugAction(BranchGraphActivator.getInstance(), editor, BranchGraphEditor.EDITOR_ID, - "Branch Graph"); - final ImageDescriptor img = action.getImageDescriptor(); - - toolbar.add(new ToolEntry("", action.getText(), img, img, null) { - - @Override - public Tool createTool() { - return new AbstractTool() { - - @Override - protected String getCommandName() { - return action.getText(); - } - - @Override - public void activate() { - super.activate(); - Displays.ensureInDisplayThread(new Runnable() { - @Override - public void run() { - deactivate(); - action.run(); - } - }); - - } - }; - } - - }); - - return toolbar; - } + private static final String[] drawerNames = new String[] {"Filters"}; + private PaletteRoot paletteRoot; + private final BranchGraphEditor editor; + + public BranchGraphPaletteProvider(BranchGraphEditor editor) { + this.paletteRoot = null; + this.editor = editor; + } + + public PaletteRoot getPaletteRoot() { + if (paletteRoot == null) { + paletteRoot = new PaletteRoot(); + paletteRoot.add(createToolsGroup(paletteRoot)); + // addDrawers(paletteRoot); + } + return paletteRoot; + } + + private void addDrawers(PaletteRoot paletteRoot) { + for (String drawerName : drawerNames) { + PaletteContainer container = new PaletteDrawer(drawerName); + + String name = "one"; + String description = "example"; + Class<?> clazz = Object.class; + + container.add(createComponent(name, description, clazz, FrameworkImage.RECTANGLE_16, + FrameworkImage.RECTANGLE_24)); + paletteRoot.add(container); + } + } + + private ToolEntry createComponent(String label, String description, Class<?> clazz, KeyedImage smallImage, KeyedImage largeImage) { + ToolEntry toolEntry = + new ToolEntry(label, description, ImageManager.getImageDescriptor(smallImage), + ImageManager.getImageDescriptor(largeImage)) { + + }; + return toolEntry; + } + + private PaletteContainer createToolsGroup(PaletteRoot palette) { + PaletteToolbar toolbar = new PaletteToolbar("Tools"); + + ToolEntry tool = new PanningSelectionToolEntry(); + toolbar.add(tool); + palette.setDefaultEntry(tool); + + toolbar.add(new MarqueeToolEntry()); + + final Action action = + OseeUiActions.createBugAction(BranchGraphActivator.getInstance(), editor, BranchGraphEditor.EDITOR_ID, + "Branch Graph"); + final ImageDescriptor img = action.getImageDescriptor(); + + toolbar.add(new ToolEntry("", action.getText(), img, img, null) { + + @Override + public Tool createTool() { + return new AbstractTool() { + + @Override + protected String getCommandName() { + return action.getText(); + } + + @Override + public void activate() { + super.activate(); + Displays.ensureInDisplayThread(new Runnable() { + @Override + public void run() { + deactivate(); + action.run(); + } + }); + + } + }; + } + + }); + + return toolbar; + } } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/BranchFigure.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/BranchFigure.java index 50a24df9166..cb49920e53e 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/BranchFigure.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/BranchFigure.java @@ -37,7 +37,7 @@ public class BranchFigure extends RoundedRectangle { add(new ImageFigure(branchImage), BorderLayout.LEFT); add(FigureFactory.createLabel(branchName, getFont(), PositionConstants.CENTER, GraphColorConstants.FONT_COLOR), - BorderLayout.CENTER); + BorderLayout.CENTER); setToolTip(toolTip); setCursor(Cursors.HAND); } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/ContainerFigure.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/ContainerFigure.java index e5f9639cacb..b48cda722e4 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/ContainerFigure.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/ContainerFigure.java @@ -27,6 +27,7 @@ public class ContainerFigure extends Figure { setLayoutManager(layout); } + @Override public Dimension getPreferredSize(int wHint, int hHint) { Dimension size = super.getPreferredSize(wHint, hHint); size.height = Math.max(size.height, 10); diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/FrameFigure.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/FrameFigure.java index 0f5d913666f..de85edb3a40 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/FrameFigure.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/FrameFigure.java @@ -34,8 +34,8 @@ public class FrameFigure extends LabeledContainer { outer = new CompoundBorder(new SchemeBorder(SchemeBorder.SCHEMES.RAISED), titlebar); inner = - new CompoundBorder(new LineBorder(FigureUtilities.mixColors(ColorConstants.buttonDarker, - ColorConstants.button), 3), new SchemeBorder(SchemeBorder.SCHEMES.LOWERED)); + new CompoundBorder(new LineBorder(FigureUtilities.mixColors(ColorConstants.buttonDarker, + ColorConstants.button), 3), new SchemeBorder(SchemeBorder.SCHEMES.LOWERED)); } } @@ -51,6 +51,7 @@ public class FrameFigure extends LabeledContainer { setLabel(title); } + @Override public Dimension getPreferredSize(int wHint, int hHint) { Dimension size = super.getPreferredSize(wHint, hHint); size.height = Math.max(size.height, 10); diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/PlusMinus.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/PlusMinus.java index 5ed5a22a0b9..81889005749 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/PlusMinus.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/PlusMinus.java @@ -23,6 +23,7 @@ public class PlusMinus extends Toggle { setPreferredSize(9, 9); } + @Override protected void paintFigure(Graphics g) { super.paintFigure(g); Rectangle r = Rectangle.SINGLETON; @@ -31,7 +32,9 @@ public class PlusMinus extends Toggle { int xMid = r.x + r.width / 2; int yMid = r.y + r.height / 2; g.drawLine(r.x + 2, yMid, r.right() - 2, yMid); - if (!isSelected()) g.drawLine(xMid, r.y + 2, xMid, r.bottom() - 2); + if (!isSelected()) { + g.drawLine(xMid, r.y + 2, xMid, r.bottom() - 2); + } } } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/TxFigure.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/TxFigure.java index 62b574200e1..22c6131c650 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/TxFigure.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/figure/TxFigure.java @@ -23,7 +23,7 @@ import org.eclipse.swt.graphics.Color; */ public class TxFigure extends Ellipse { - private Color bgcolor; + private final Color bgcolor; private boolean selected; private final long txNumber; diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/BranchModel.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/BranchModel.java index 699e2236702..04bf3535fe0 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/BranchModel.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/BranchModel.java @@ -162,7 +162,7 @@ public class BranchModel extends Node implements Serializable { @Override public boolean equals(Object obj) { if (obj instanceof BranchModel) { - BranchModel other = ((BranchModel) obj); + BranchModel other = (BranchModel) obj; return other.getBranch().equals(getBranch()); } return false; @@ -176,7 +176,7 @@ public class BranchModel extends Node implements Serializable { @Override public String toString() { return String.format("Branch:[%s] Type:[%s] Children:[%s] TxNodes:[%s]", branch.getName(), - branch.getBranchType().name(), children.size(), txs.size()); + branch.getBranchType().name(), children.size(), txs.size()); } public boolean areTxsVisible() { diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphCache.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphCache.java index ccbb5f6fa81..69fbe033ac9 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphCache.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphCache.java @@ -106,10 +106,9 @@ public class GraphCache { if (toReturn == null) { toReturn = new BranchModel(branch); - TransactionRecord headTransaction = TransactionManager.getHeadTransaction(branch); - addTxsToBranchModel(toReturn, branch.getBaseTransaction()); - if ( branch.getBaseTransaction().equals(headTransaction)) { + addTxsToBranchModel(toReturn, branch.getBaseTransaction()); + if (branch.getBaseTransaction().equals(headTransaction)) { addTxsToBranchModel(toReturn, headTransaction); } addBranchModel(toReturn); diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java index 1524adfed89..aaa38c5a00f 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java @@ -29,7 +29,7 @@ import org.eclipse.osee.framework.ui.branch.graph.operation.IProgressListener; */ public class GraphLoader { private static final String GET_TRANSACTION_DATA = - "SELECT otd.* FROM osee_join_transaction ojt, osee_tx_details otd WHERE ojt.transaction_id = otd.transaction_id and ojt.query_id = ? ORDER BY otd.transaction_id desc"; + "SELECT otd.* FROM osee_join_transaction ojt, osee_tx_details otd WHERE ojt.transaction_id = otd.transaction_id and ojt.query_id = ? ORDER BY otd.transaction_id desc"; private GraphLoader() { } @@ -106,9 +106,11 @@ public class GraphLoader { if (source != null) { connect(source, txModel); } else { - OseeLog.log(BranchGraphActivator.class, Level.SEVERE, - String.format("Invalid parent transaction id of [%s] for branch [%s]", parentTxId, - branchModel.getBranch())); + OseeLog.log( + BranchGraphActivator.class, + Level.SEVERE, + String.format("Invalid parent transaction id of [%s] for branch [%s]", parentTxId, + branchModel.getBranch())); // StubBranchModel stubModel = graphCache.getStubBranchModel(); // TxModel stubTxModel = stubModel.addTx(parentTxId); // graphCache.addTxModel(stubTxModel); @@ -150,9 +152,9 @@ public class GraphLoader { while (chStmt.next()) { Branch branch = BranchManager.getBranch(chStmt.getInt("branch_id")); TxData txData = - new TxData(branch, chStmt.getInt("author"), chStmt.getTimestamp("time"), - chStmt.getString("osee_comment"), chStmt.getInt("tx_type"), chStmt.getInt("commit_art_id"), - chStmt.getInt("transaction_id")); + new TxData(branch, chStmt.getInt("author"), chStmt.getTimestamp("time"), + chStmt.getString("osee_comment"), chStmt.getInt("tx_type"), chStmt.getInt("commit_art_id"), + chStmt.getInt("transaction_id")); txDatas.add(txData); } } finally { diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/StubBranchModel.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/StubBranchModel.java index 17a97fea3ee..6553e4c197e 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/StubBranchModel.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/StubBranchModel.java @@ -35,8 +35,8 @@ public class StubBranchModel extends BranchModel { TxModel toReturn = stubs.get(value); if (toReturn == null) { toReturn = - new TxModel(new TxData(STUB_BRANCH, 0, new Timestamp(new Date().getTime()), String.format( - "Transaction: [%s] not found", value), 0, 0, value)); + new TxModel(new TxData(STUB_BRANCH, 0, new Timestamp(new Date().getTime()), String.format( + "Transaction: [%s] not found", value), 0, 0, value)); addTx(toReturn); } return toReturn; diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/TxData.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/TxData.java index cd312099fd1..fc02e9bc219 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/TxData.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/TxData.java @@ -117,11 +117,11 @@ public class TxData { @Override public String toString() { return String.format("Tx:[%s] Author:[%s] Branch:[%s] Comment:[%s]", getTxId(), getAuthor(), - getBranch().getName(), getComment()); + getBranch().getName(), getComment()); } protected static TxData createTxData(TransactionRecord txId) throws OseeCoreException { return new TxData(txId.getBranch(), txId.getAuthor(), txId.getTimeStamp(), txId.getComment(), - txId.getTxType().getId(), txId.getCommit(), txId.getId()); + txId.getTxType().getId(), txId.getCommit(), txId.getId()); } } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/TxModel.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/TxModel.java index bc428054b4c..23deb919f87 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/TxModel.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/TxModel.java @@ -21,7 +21,7 @@ public class TxModel extends Node implements Serializable, Comparable<TxModel> { private static final long serialVersionUID = -2246486595572509094L; - private TxData txData; + private final TxData txData; private BranchModel branchModel; private TxModel parentTxModel; private TxModel sourceTxModel; @@ -74,6 +74,7 @@ public class TxModel extends Node implements Serializable, Comparable<TxModel> { return getTxData().getTxId(); } + @Override public int compareTo(TxModel other) { return getRevision().compareTo(other.getRevision()); } @@ -81,7 +82,7 @@ public class TxModel extends Node implements Serializable, Comparable<TxModel> { @Override public boolean equals(Object obj) { if (obj instanceof TxModel) { - TxModel other = ((TxModel) obj); + TxModel other = (TxModel) obj; return other.getTxData().equals(getTxData()); } return false; @@ -92,6 +93,7 @@ public class TxModel extends Node implements Serializable, Comparable<TxModel> { return txData.hashCode(); } + @Override public String toString() { return txData.toString(); } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/operation/LoadGraphOperation.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/operation/LoadGraphOperation.java index ec640ba4b93..70b11a34647 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/operation/LoadGraphOperation.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/operation/LoadGraphOperation.java @@ -35,101 +35,102 @@ import org.eclipse.ui.IWorkbenchWindow; */ public class LoadGraphOperation implements IExceptionableRunnable { - private Branch resource; - private final GraphicalViewer viewer; - private final BranchGraphEditor editor; - private GraphCache graph; - - private static final int TOTAL_STEPS = Integer.MAX_VALUE; - private static final int SHORT_TASK_STEPS = TOTAL_STEPS / 50; - private static final int VERY_LONG_TASK = TOTAL_STEPS / 2; - private static final int TASK_STEPS = (TOTAL_STEPS - SHORT_TASK_STEPS * 3 - VERY_LONG_TASK) / 2; - - protected LoadGraphOperation(IWorkbenchPart part, GraphicalViewer viewer, BranchGraphEditor editor) { - super(); - this.viewer = viewer; - this.editor = editor; - } - - public LoadGraphOperation(IWorkbenchPart part, GraphicalViewer viewer, BranchGraphEditor editor, Branch resource) { - this(part, viewer, editor); - this.resource = resource; - } - - public String getName() { - return "Loading graph information"; - } - - @Override - public IStatus run(IProgressMonitor monitor) throws Exception { - boolean error = false; - monitor.beginTask(getName(), TOTAL_STEPS); - monitor.worked(SHORT_TASK_STEPS); - try { - TransactionRecord transaction = TransactionManager.getHeadTransaction(resource); - if (editor != null) { - ((BranchGraphEditorInput) editor.getEditorInput()).setTransactionId(transaction); - } - Branch path = transaction.getBranch(); - - monitor.setTaskName("Initializating cache"); - - monitor.worked(SHORT_TASK_STEPS); - - if (editor != null) { - if (error == true || monitor.isCanceled()) { - Displays.pendInDisplayThread(new Runnable() { - @Override - public void run() { - IWorkbenchWindow window = editor.getEditorSite().getWorkbenchWindow(); - IWorkbenchPage page = window.getActivePage(); - page.activate(editor); - page.closeEditor(editor, false); - } - }); - } else { - updateView(monitor, path, transaction); - } - } - } catch (Exception ex) { - AWorkbench.popup("Error Calculating Revision Graph Information", Lib.exceptionToString(ex)); - } finally { - monitor.done(); - } - return Status.OK_STATUS; - } - - private void updateView(IProgressMonitor monitor, Branch branch, TransactionRecord revision) throws OseeCoreException { - monitor.setTaskName("Finding root node"); - int unitWork = TASK_STEPS / (revision.getId()); - if (unitWork < 1) { - unitWork = 1; - } - monitor.setTaskName("Calculating graph"); - graph = new GraphCache(branch); - GraphLoader.load(graph, new InternalTaskProgressListener(monitor, unitWork)); - monitor.setTaskName("Drawing graph"); - - Displays.pendInDisplayThread(new Runnable() { - @Override - public void run() { - viewer.setContents(graph); - editor.setOutlineContent(graph); - } - }); - } - private final class InternalTaskProgressListener implements IProgressListener { - - private final IProgressMonitor monitor; - private final int unitWork; - - public InternalTaskProgressListener(IProgressMonitor monitor, int unitWork) { - this.monitor = monitor; - this.unitWork = unitWork; - } - - public void worked() { - monitor.worked(unitWork); - } - } + private Branch resource; + private final GraphicalViewer viewer; + private final BranchGraphEditor editor; + private GraphCache graph; + + private static final int TOTAL_STEPS = Integer.MAX_VALUE; + private static final int SHORT_TASK_STEPS = TOTAL_STEPS / 50; + private static final int VERY_LONG_TASK = TOTAL_STEPS / 2; + private static final int TASK_STEPS = (TOTAL_STEPS - SHORT_TASK_STEPS * 3 - VERY_LONG_TASK) / 2; + + protected LoadGraphOperation(IWorkbenchPart part, GraphicalViewer viewer, BranchGraphEditor editor) { + super(); + this.viewer = viewer; + this.editor = editor; + } + + public LoadGraphOperation(IWorkbenchPart part, GraphicalViewer viewer, BranchGraphEditor editor, Branch resource) { + this(part, viewer, editor); + this.resource = resource; + } + + public String getName() { + return "Loading graph information"; + } + + @Override + public IStatus run(IProgressMonitor monitor) throws Exception { + boolean error = false; + monitor.beginTask(getName(), TOTAL_STEPS); + monitor.worked(SHORT_TASK_STEPS); + try { + TransactionRecord transaction = TransactionManager.getHeadTransaction(resource); + if (editor != null) { + ((BranchGraphEditorInput) editor.getEditorInput()).setTransactionId(transaction); + } + Branch path = transaction.getBranch(); + + monitor.setTaskName("Initializating cache"); + + monitor.worked(SHORT_TASK_STEPS); + + if (editor != null) { + if (error == true || monitor.isCanceled()) { + Displays.pendInDisplayThread(new Runnable() { + @Override + public void run() { + IWorkbenchWindow window = editor.getEditorSite().getWorkbenchWindow(); + IWorkbenchPage page = window.getActivePage(); + page.activate(editor); + page.closeEditor(editor, false); + } + }); + } else { + updateView(monitor, path, transaction); + } + } + } catch (Exception ex) { + AWorkbench.popup("Error Calculating Revision Graph Information", Lib.exceptionToString(ex)); + } finally { + monitor.done(); + } + return Status.OK_STATUS; + } + + private void updateView(IProgressMonitor monitor, Branch branch, TransactionRecord revision) throws OseeCoreException { + monitor.setTaskName("Finding root node"); + int unitWork = TASK_STEPS / revision.getId(); + if (unitWork < 1) { + unitWork = 1; + } + monitor.setTaskName("Calculating graph"); + graph = new GraphCache(branch); + GraphLoader.load(graph, new InternalTaskProgressListener(monitor, unitWork)); + monitor.setTaskName("Drawing graph"); + + Displays.pendInDisplayThread(new Runnable() { + @Override + public void run() { + viewer.setContents(graph); + editor.setOutlineContent(graph); + } + }); + } + private final class InternalTaskProgressListener implements IProgressListener { + + private final IProgressMonitor monitor; + private final int unitWork; + + public InternalTaskProgressListener(IProgressMonitor monitor, int unitWork) { + this.monitor = monitor; + this.unitWork = unitWork; + } + + @Override + public void worked() { + monitor.worked(unitWork); + } + } } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/BranchDataEditPart.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/BranchDataEditPart.java index 62f46910902..69750cf03d2 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/BranchDataEditPart.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/BranchDataEditPart.java @@ -29,6 +29,7 @@ import org.eclipse.osee.framework.ui.branch.graph.utility.GraphFigureConstants; */ public class BranchDataEditPart extends AbstractGraphicalEditPart { + @Override protected IFigure createFigure() { Branch branch = (Branch) getModel(); GraphEditPart graphEditPart = (GraphEditPart) getParent().getParent(); @@ -55,11 +56,13 @@ public class BranchDataEditPart extends AbstractGraphicalEditPart { return figure; } + @Override protected void refreshVisuals() { getFigure().setSize(220, 30); super.refreshVisuals(); } + @Override protected void createEditPolicies() { } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/BranchEditPart.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/BranchEditPart.java index 9e2305a4c05..48bfca09c26 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/BranchEditPart.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/BranchEditPart.java @@ -52,6 +52,7 @@ public class BranchEditPart extends AbstractGraphicalEditPart { return txContainer; } + @Override @SuppressWarnings("unchecked") protected List getModelChildren() { List toReturn = new ArrayList(); @@ -83,17 +84,17 @@ public class BranchEditPart extends AbstractGraphicalEditPart { int xMiddle = maxBranches * GraphFigureConstants.BRANCH_X_OFFSET / 2; - int xStart = xMiddle + (((branchAtLevel - 1) * GraphFigureConstants.BRANCH_X_OFFSET) / 2) * -1; + int xStart = xMiddle + (branchAtLevel - 1) * GraphFigureConstants.BRANCH_X_OFFSET / 2 * -1; xStart += - GraphFigureConstants.GRAPH_MARGIN + (branchModel.getIndex() - branchesAboveLevel) * GraphFigureConstants.BRANCH_X_OFFSET; + GraphFigureConstants.GRAPH_MARGIN + (branchModel.getIndex() - branchesAboveLevel) * GraphFigureConstants.BRANCH_X_OFFSET; int totalTxs = 0; for (int index = 0; index < graphLevel; index++) { totalTxs += gPart.getMaxTxForGraphLevel(index); } int yStart = - GraphFigureConstants.GRAPH_MARGIN + (GraphFigureConstants.BRANCH_Y_OFFSET * graphLevel) + (GraphFigureConstants.TX_Y_OFFSET * totalTxs); + GraphFigureConstants.GRAPH_MARGIN + GraphFigureConstants.BRANCH_Y_OFFSET * graphLevel + GraphFigureConstants.TX_Y_OFFSET * totalTxs; return new Point(xStart, yStart); } @@ -135,12 +136,15 @@ public class BranchEditPart extends AbstractGraphicalEditPart { // return new Point(xStart, yStart); // } + @Override protected void createEditPolicies() { installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new SelectionEditPolicy() { + @Override protected void hideSelection() { refreshVisuals(); } + @Override protected void showSelection() { refreshVisuals(); } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/BranchSelectionEditPolicy.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/BranchSelectionEditPolicy.java index e74d3b03a07..1af31438904 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/BranchSelectionEditPolicy.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/BranchSelectionEditPolicy.java @@ -22,6 +22,7 @@ public class BranchSelectionEditPolicy extends NonResizableEditPolicy { /** * @see org.eclipse.gef.editpolicies.NonResizableEditPolicy#hideFocus() */ + @Override protected void hideFocus() { // getLabel().setFocus(false); } @@ -29,6 +30,7 @@ public class BranchSelectionEditPolicy extends NonResizableEditPolicy { /** * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#hideSelection() */ + @Override protected void hideSelection() { // getLabel().setSelected(false); // getLabel().setFocus(false); @@ -38,6 +40,7 @@ public class BranchSelectionEditPolicy extends NonResizableEditPolicy { /** * @see org.eclipse.gef.editpolicies.NonResizableEditPolicy#showFocus() */ + @Override protected void showFocus() { // getLabel().setFocus(true); } @@ -45,6 +48,7 @@ public class BranchSelectionEditPolicy extends NonResizableEditPolicy { /** * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#showSelection() */ + @Override protected void showPrimarySelection() { // getLabel().setSelected(true); // getLabel().setFocus(true); @@ -53,6 +57,7 @@ public class BranchSelectionEditPolicy extends NonResizableEditPolicy { /** * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#showSelection() */ + @Override protected void showSelection() { // getLabel().setSelected(true); // getLabel().setFocus(false); diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/GraphEditPart.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/GraphEditPart.java index 840dae7d8b0..80542d3f2d5 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/GraphEditPart.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/GraphEditPart.java @@ -71,7 +71,9 @@ public class GraphEditPart extends AbstractGraphicalEditPart { private final IPreferenceStore preferenceStore; private enum ConnectionType { - BRANCH_INTERNAL, PARENT_CHILD, MERGE; + BRANCH_INTERNAL, + PARENT_CHILD, + MERGE; } public GraphEditPart(GraphicalViewer viewer) { @@ -173,8 +175,8 @@ public class GraphEditPart extends AbstractGraphicalEditPart { txNumberToTxModelMap.put(txNumber, model); txNumberToTxFigureMap.put(txNumber, FigureFactory.createTxFigure(model)); } else { - OseeLog.log(BranchGraphActivator.class, Level.SEVERE, String.format("Orphan TxModel: [%s]", - model.toString())); + OseeLog.log(BranchGraphActivator.class, Level.SEVERE, + String.format("Orphan TxModel: [%s]", model.toString())); } } @@ -240,7 +242,7 @@ public class GraphEditPart extends AbstractGraphicalEditPart { private String getConnectionLabel(TxModel source, TxModel target) { return String.format("%s:%s - %s:%s", source.getParentBranchModel().getBranch().getShortName(), - source.getRevision(), target.getParentBranchModel().getBranch().getShortName(), target.getRevision()); + source.getRevision(), target.getParentBranchModel().getBranch().getShortName(), target.getRevision()); } private void createTxConnections(Collection<BranchModel> toReturn) { @@ -256,7 +258,7 @@ public class GraphEditPart extends AbstractGraphicalEditPart { if (parent != null) { msg = getConnectionLabel(parentTxModel, txModel); connect(ConnectionType.BRANCH_INTERNAL, getFigure(), parent, txFigure, msg, false, - ColorConstants.black); + ColorConstants.black); } } else if (txModel.getSourceTx() != null) { TxModel sourceTx = txModel.getSourceTx(); @@ -273,14 +275,14 @@ public class GraphEditPart extends AbstractGraphicalEditPart { BranchFigure branchFigure = branchFigureMap.get(branchModel.getBranch()); msg = getConnectionLabel(branchModel.getFirstTx(), txModel); connect(ConnectionType.BRANCH_INTERNAL, getFigure(), branchFigure, txFigure, msg, false, - ColorConstants.black); + ColorConstants.black); } } } else { TxModel txModel = branchModel.getFirstTx(); if (txModel == null) { - OseeLog.log(BranchGraphActivator.class, Level.SEVERE, String.format( - "Branch did not have a starting tx [%s]", branchModel)); + OseeLog.log(BranchGraphActivator.class, Level.SEVERE, + String.format("Branch did not have a starting tx [%s]", branchModel)); } else { if (txModel.getSourceTx() != null) { TxModel sourceTx = txModel.getSourceTx(); @@ -291,12 +293,12 @@ public class GraphEditPart extends AbstractGraphicalEditPart { TxFigure source = getTxFigure(sourceTx); if (source != null) { connect(ConnectionType.PARENT_CHILD, getFigure(), source, branchFigure, msg, true, - ColorConstants.lightBlue); + ColorConstants.lightBlue); } } else { BranchFigure source = branchFigureMap.get(sourceTx.getParentBranchModel().getBranch()); connect(ConnectionType.PARENT_CHILD, getFigure(), source, branchFigure, msg, true, - ColorConstants.lightBlue); + ColorConstants.lightBlue); } } } @@ -371,7 +373,7 @@ public class GraphEditPart extends AbstractGraphicalEditPart { private void connect(ConnectionType connectType, IFigure contents, IFigure source, IFigure target, String toolTip, boolean hasEndPoint, Color color) { PolylineConnection connection = - FigureFactory.createConnection(getFigure(), source, target, toolTip, hasEndPoint, color); + FigureFactory.createConnection(getFigure(), source, target, toolTip, hasEndPoint, color); ConnectionMouseListener listener = new ConnectionMouseListener(connection); connection.addMouseMotionListener(listener); connection.addMouseListener(listener); @@ -405,26 +407,33 @@ public class GraphEditPart extends AbstractGraphicalEditPart { this.connection = connection; } + @Override public void mouseDragged(MouseEvent event) { } + @Override public void mouseEntered(MouseEvent event) { } + @Override public void mouseExited(MouseEvent event) { connection.setLineWidth(1); } + @Override public void mouseHover(MouseEvent event) { connection.setLineWidth(3); } + @Override public void mouseMoved(MouseEvent event) { } + @Override public void mouseDoubleClicked(MouseEvent event) { } + @Override public void mousePressed(MouseEvent event) { TxFigure txFigure = (TxFigure) connection.getTargetAnchor().getOwner(); scrollTo(txFigure); @@ -439,6 +448,7 @@ public class GraphEditPart extends AbstractGraphicalEditPart { } } + @Override public void mouseReleased(MouseEvent event) { } } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/GraphEditPartFactory.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/GraphEditPartFactory.java index 5104c7a8c3a..e181aed4c18 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/GraphEditPartFactory.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/GraphEditPartFactory.java @@ -23,12 +23,13 @@ import org.eclipse.osee.framework.ui.branch.graph.model.TxModel; */ public class GraphEditPartFactory implements EditPartFactory { - private GraphicalViewer viewer; + private final GraphicalViewer viewer; public GraphEditPartFactory(GraphicalViewer viewer) { this.viewer = viewer; } + @Override public EditPart createEditPart(EditPart context, Object model) { EditPart editPart = null; if (model instanceof String) { diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/GraphXYLayoutEditPolicy.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/GraphXYLayoutEditPolicy.java index b5bf9572cd0..30380afcbef 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/GraphXYLayoutEditPolicy.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/GraphXYLayoutEditPolicy.java @@ -21,8 +21,9 @@ import org.eclipse.gef.requests.CreateRequest; public class GraphXYLayoutEditPolicy extends XYLayoutEditPolicy { /* - * @see org.eclipse.gef.editpolicies.ConstrainedLayoutTEditPolicy#createChangeConstraintCommand(org.eclipse.gef.EditPart, - * java.lang.Object) + * @see + * org.eclipse.gef.editpolicies.ConstrainedLayoutTEditPolicy#createChangeConstraintCommand(org.eclipse.gef.EditPart, + * java.lang.Object) */ @Override protected Command createChangeConstraintCommand(EditPart child, Object constraint) { diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/LabelEditPart.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/LabelEditPart.java index fe2fcfe19fd..0fa89833120 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/LabelEditPart.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/LabelEditPart.java @@ -25,10 +25,12 @@ public class LabelEditPart extends AbstractGraphicalEditPart { this.data = data; } + @Override protected IFigure createFigure() { return new Label(data); } + @Override protected void createEditPolicies() { } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/TxEditPart.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/TxEditPart.java index 78b1928e50e..8af65648f0d 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/TxEditPart.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/parts/TxEditPart.java @@ -26,6 +26,7 @@ import org.eclipse.osee.framework.ui.branch.graph.utility.GraphFigureConstants; */ public class TxEditPart extends AbstractGraphicalEditPart { + @Override protected IFigure createFigure() { IFigure figure = new Panel(); figure.setLayoutManager(new BorderLayout()); @@ -37,14 +38,15 @@ public class TxEditPart extends AbstractGraphicalEditPart { figure.add(txFigure, BorderLayout.CENTER); Rectangle rect = - new Rectangle(GraphFigureConstants.TX_X_OFFSET + GraphFigureConstants.PLUS_MINUS_PADDING * 2, - 10 + GraphFigureConstants.BRANCH_HEIGHT + txModel.getIndex() * GraphFigureConstants.TX_Y_OFFSET, - GraphFigureConstants.TX_WIDTH, GraphFigureConstants.TX_HEIGHT); + new Rectangle(GraphFigureConstants.TX_X_OFFSET + GraphFigureConstants.PLUS_MINUS_PADDING * 2, + 10 + GraphFigureConstants.BRANCH_HEIGHT + txModel.getIndex() * GraphFigureConstants.TX_Y_OFFSET, + GraphFigureConstants.TX_WIDTH, GraphFigureConstants.TX_HEIGHT); ((AbstractGraphicalEditPart) getParent()).getFigure().getLayoutManager().setConstraint(txFigure, rect); return txFigure; } + @Override protected void refreshVisuals() { getFigure().setSize(GraphFigureConstants.TX_WIDTH, GraphFigureConstants.TX_HEIGHT); TxModel txModel = (TxModel) getModel(); @@ -54,12 +56,15 @@ public class TxEditPart extends AbstractGraphicalEditPart { graphEditPart.setConnectionVisibility(); } + @Override protected void createEditPolicies() { installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new SelectionEditPolicy() { + @Override protected void hideSelection() { refreshVisuals(); } + @Override protected void showSelection() { refreshVisuals(); } diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/utility/GraphOptions.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/utility/GraphOptions.java index a1d6f1a57b3..bb1b86d244e 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/utility/GraphOptions.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/utility/GraphOptions.java @@ -19,11 +19,15 @@ public class GraphOptions { public final static String TRANSACTION_FILTER = "revision.graph.show.all.transactions"; public static enum ConnectionFilter { - NO_FILTER, FILTER_ALL_CONNECTIONS, FILTER_CHILD_BRANCH_CONNECTIONS, FILTER_MERGE_CONNECTIONS; + NO_FILTER, + FILTER_ALL_CONNECTIONS, + FILTER_CHILD_BRANCH_CONNECTIONS, + FILTER_MERGE_CONNECTIONS; } public static enum TxFilter { - NO_FILTER, HIDE_ALL; + NO_FILTER, + HIDE_ALL; } private GraphOptions() { diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/utility/GraphTextFormat.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/utility/GraphTextFormat.java index 47b2e7d79d3..fe2e4380b2f 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/utility/GraphTextFormat.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/utility/GraphTextFormat.java @@ -11,7 +11,6 @@ package org.eclipse.osee.framework.ui.branch.graph.utility; import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.Date; /** @@ -26,7 +25,7 @@ public class GraphTextFormat { public static String formatDate(Date date) { if (dateFormat == null) { - dateFormat = SimpleDateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); + dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); } return dateFormat.format(date); } |