From 3145ec83d5286a0fdfe8e5d119c532774fde038d Mon Sep 17 00:00:00 2001 From: Bernd Hufmann Date: Thu, 3 May 2012 16:07:59 -0400 Subject: [PATCH] More fixes of static analysis warnings for UML2SD --- .../linuxtools/tmf/ui/views/uml2sd/NGC.java | 63 +++++----- .../tmf/ui/views/uml2sd/SDView.java | 68 ++++++----- .../tmf/ui/views/uml2sd/SDWidget.java | 106 +++++++++-------- .../tmf/ui/views/uml2sd/ScrollView.java | 109 ++++++------------ .../ui/views/uml2sd/TimeCompressionBar.java | 56 +++------ .../ui/views/uml2sd/core/AsyncMessage.java | 14 ++- .../views/uml2sd/core/AsyncMessageReturn.java | 8 +- .../tmf/ui/views/uml2sd/core/BaseMessage.java | 33 +++--- .../uml2sd/core/BasicExecutionOccurrence.java | 22 ++-- .../tmf/ui/views/uml2sd/core/BasicFrame.java | 60 +++------- .../ui/views/uml2sd/core/EllipsisMessage.java | 15 ++- .../uml2sd/core/ExecutionOccurrence.java | 8 +- .../tmf/ui/views/uml2sd/core/Frame.java | 90 +++++++-------- .../tmf/ui/views/uml2sd/core/GraphNode.java | 24 ++-- .../tmf/ui/views/uml2sd/core/HotSpot.java | 11 +- .../tmf/ui/views/uml2sd/core/Lifeline.java | 44 ++++--- .../tmf/ui/views/uml2sd/core/Metrics.java | 11 ++ .../tmf/ui/views/uml2sd/core/Stop.java | 14 ++- .../tmf/ui/views/uml2sd/core/SyncMessage.java | 11 +- .../views/uml2sd/core/SyncMessageReturn.java | 8 +- .../views/uml2sd/dialogs/SDPrintDialogUI.java | 41 ++++--- .../ui/views/uml2sd/dialogs/TabContents.java | 2 +- .../ui/views/uml2sd/load/LoadersManager.java | 2 +- .../uml2sd/loader/TmfUml2SDSyncLoader.java | 43 ++++--- .../uml2sd/preferences/SDViewerPage.java | 10 -- 25 files changed, 446 insertions(+), 427 deletions(-) diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/NGC.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/NGC.java index 3d3e857e67..dd924fef6c 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/NGC.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/NGC.java @@ -13,7 +13,6 @@ **********************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.uml2sd; -import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Frame; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IFont; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; @@ -352,8 +351,8 @@ public class NGC implements IGC { localWidth = Math.round(localWidth * fView.fZoomValue); localHeight = Math.round(localHeight * fView.fZoomValue); - setForeground(Frame.getUserPref().getForeGroundColorSelection()); - setBackground(Frame.getUserPref().getBackGroundColorSelection()); + setForeground(SDViewPref.getInstance().getForeGroundColorSelection()); + setBackground(SDViewPref.getInstance().getBackGroundColorSelection()); fContext.drawFocus(fView.contentsToViewX(localX - 1), fView.contentsToViewY(localY - 1), localWidth + 3, localHeight + 3); @@ -677,37 +676,42 @@ public class NGC implements IGC { */ @Override public void drawTextTruncatedCentred(String name, int xValue, int yValue, int width, int height, boolean trans) { + int localX = xValue; + int localY = yValue; + int localWidth = width; + int localHeight = height; + Point tx = fContext.textExtent(name); - xValue = Math.round(xValue * fView.fZoomValue); + localX = Math.round(localX * fView.fZoomValue); int y = 0; // Workaround to avoid round problems for some special cases (not very nice) - if (yValue != getContentsY()) { - yValue = Math.round(yValue * fView.fZoomValue); - y = fView.contentsToViewY(yValue); - } - width = Math.round(width * fView.fZoomValue); - height = Math.round(height * fView.fZoomValue); - int x = fView.contentsToViewX(xValue); - if (tx.y > height) { + if (localY != getContentsY()) { + localY = Math.round(localY * fView.fZoomValue); + y = fView.contentsToViewY(localY); + } + localWidth = Math.round(localWidth * fView.fZoomValue); + localHeight = Math.round(localHeight * fView.fZoomValue); + int x = fView.contentsToViewX(localX); + if (tx.y > localHeight) { return; } // Adjust height and y if (y < -fVisibleScreenBounds) { - height = height + y + fVisibleScreenBounds; + localHeight = localHeight + y + fVisibleScreenBounds; y = -fVisibleScreenBounds; } - if ((height < -fVisibleScreenBounds) && (y + height < -fVisibleScreenBounds)) { - height = -fVisibleScreenBounds; - } else if (height + y > fView.getVisibleHeight() + fVisibleScreenBounds) { - height = fView.getVisibleHeight() + fVisibleScreenBounds - y; + if ((localHeight < -fVisibleScreenBounds) && (y + localHeight < -fVisibleScreenBounds)) { + localHeight = -fVisibleScreenBounds; + } else if (localHeight + y > fView.getVisibleHeight() + fVisibleScreenBounds) { + localHeight = fView.getVisibleHeight() + fVisibleScreenBounds - y; } - if (tx.x <= width) { - localDrawText(name, x + 1 + (width - tx.x) / 2, y + 1 + (height - tx.y) / 2, trans); + if (tx.x <= localWidth) { + localDrawText(name, x + 1 + (localWidth - tx.x) / 2, y + 1 + (localHeight - tx.y) / 2, trans); } else { String nameToDisplay = name; - for (int i = name.length() - 1; i >= 0 && fContext.textExtent(nameToDisplay).x >= width; i--) { + for (int i = name.length() - 1; i >= 0 && fContext.textExtent(nameToDisplay).x >= localWidth; i--) { nameToDisplay = name.substring(0, i); } int dotCount = 0; @@ -720,7 +724,7 @@ public class NGC implements IGC { buf.append("."); //$NON-NLS-1$ } nameToDisplay = buf.toString(); - localDrawText(nameToDisplay, x + 1 + (width - fContext.textExtent(nameToDisplay).x) / 2, y + 1 + (height - fContext.textExtent(nameToDisplay).y) / 2, trans); + localDrawText(nameToDisplay, x + 1 + (localWidth - fContext.textExtent(nameToDisplay).x) / 2, y + 1 + (localHeight - fContext.textExtent(nameToDisplay).y) / 2, trans); } } @@ -825,14 +829,19 @@ public class NGC implements IGC { */ @Override public void drawArc(int x, int y, int width, int height, int startAngle, int endAngle) { - x = Math.round(x * fView.fZoomValue); - y = Math.round(y * fView.fZoomValue); - width = Math.round(width * fView.fZoomValue); - height = Math.round(height * fView.fZoomValue); - if (width == 0 || height == 0 || endAngle == 0) { + int localX = x; + int localY = y; + int localWidth = width; + int localHeight = height; + + localX = Math.round(localX * fView.fZoomValue); + localY = Math.round(localY * fView.fZoomValue); + localWidth = Math.round(localWidth * fView.fZoomValue); + localHeight = Math.round(localHeight * fView.fZoomValue); + if (localWidth == 0 || localHeight == 0 || endAngle == 0) { return; } - fContext.drawArc(fView.contentsToViewX(x), fView.contentsToViewY(y), width, height, startAngle, endAngle); + fContext.drawArc(fView.contentsToViewX(localX), fView.contentsToViewY(localY), localWidth, localHeight, startAngle, endAngle); } /* diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java index 440f882a2c..ab80dbb556 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java @@ -200,36 +200,7 @@ public class SDView extends ViewPart { * Load a blank page that is supposed to explain that a kind of interaction must be chosen. */ protected void loadBlank() { - IUml2SDLoader loader = new IUml2SDLoader() { - /* - * (non-Javadoc) - * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader#setViewer(org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView) - */ - @Override - public void setViewer(SDView viewer) { - // Nothing to do - Frame f = new Frame(); - f.setName(""); //$NON-NLS-1$ - viewer.setFrame(f); - } - - /* - * (non-Javadoc) - * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader#getTitleString() - */ - @Override - public String getTitleString() { - return ""; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader#dispose() - */ - @Override - public void dispose() { - } - }; + IUml2SDLoader loader = new BlankUml2SdLoader(); loader.setViewer(this); setContentDescription(loader.getTitleString()); } @@ -1087,4 +1058,41 @@ public class SDView extends ViewPart { return obj; } + + /** + * @version 1.0 + * + * Loader for a blank sequence diagram. + * + */ + public static class BlankUml2SdLoader implements IUml2SDLoader { + /* + * (non-Javadoc) + * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader#setViewer(org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView) + */ + @Override + public void setViewer(SDView viewer) { + // Nothing to do + Frame f = new Frame(); + f.setName(""); //$NON-NLS-1$ + viewer.setFrame(f); + } + + /* + * (non-Javadoc) + * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader#getTitleString() + */ + @Override + public String getTitleString() { + return ""; //$NON-NLS-1$ + } + + /* + * (non-Javadoc) + * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader#dispose() + */ + @Override + public void dispose() { + } + } } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java index 6b98f6bf6c..a3722d6c45 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java @@ -225,7 +225,7 @@ public class SDWidget extends ScrollView implements SelectionListener, IProperty /** * The reorder list when in reorder mode. */ - protected ArrayList fReorderList = null; + protected List fReorderList = null; /** * Flag to specify whether in printing mode or not. */ @@ -383,35 +383,9 @@ public class SDWidget extends ScrollView implements SelectionListener, IProperty fArrowUpCaretImg = TmfUiPlugin.getDefault().getImageFromPath(ITmfImageConstants.IMG_UI_ARROW_UP_OBJ); fReorderList = new ArrayList(); - getViewControl().addTraverseListener(new TraverseListener() { + getViewControl().addTraverseListener(new LocalTraverseListener()); - /* - * (non-Javadoc) - * @see org.eclipse.swt.events.TraverseListener#keyTraversed(org.eclipse.swt.events.TraverseEvent) - */ - @Override - public void keyTraversed(TraverseEvent e) { - if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS)) { - e.doit = true; - } - } - - }); - - addTraverseListener(new TraverseListener() { - - /* - * (non-Javadoc) - * @see org.eclipse.swt.events.TraverseListener#keyTraversed(org.eclipse.swt.events.TraverseEvent) - */ - @Override - public void keyTraversed(TraverseEvent e) { - if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS)) { - e.doit = true; - } - } - - }); + addTraverseListener(new LocalTraverseListener()); getViewControl().addFocusListener(new FocusListener() { @@ -421,7 +395,6 @@ public class SDWidget extends ScrollView implements SelectionListener, IProperty */ @Override public void focusGained(FocusEvent e) { - // TODO Auto-generated method stub SDViewPref.getInstance().setNoFocusSelection(false); fCtrlSelection = false; fShiftSelection = false; @@ -766,7 +739,7 @@ public class SDWidget extends ScrollView implements SelectionListener, IProperty * * @return - the re-odered sequence */ - public ArrayList getLifelineReoderList() { + public List getLifelineReoderList() { return fReorderList; } @@ -997,7 +970,7 @@ public class SDWidget extends ScrollView implements SelectionListener, IProperty fPrinter.startJob(jobName); GC gc = new GC(fPrinter); - Frame.setUserPref(SDViewPref.getInstance()); +// Frame.setUserPref(SDViewPref.getInstance()); float lastZoom = fZoomValue; @@ -1012,8 +985,8 @@ public class SDWidget extends ScrollView implements SelectionListener, IProperty Metrics.setLifelineFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_LIFELINE))); Metrics.setLifelineFontWidth(context.getFontWidth(SDViewPref.getInstance().getFont(SDViewPref.PREF_LIFELINE))); Metrics.setLifelineWidth(SDViewPref.getInstance().getLifelineWidth()); - Metrics.setFrameFontHeight(context.getFontHeight(Frame.getUserPref().getFont(ISDPreferences.PREF_FRAME_NAME))); - Metrics.setLifelineHeaderFontHeight(context.getFontHeight(Frame.getUserPref().getFont(ISDPreferences.PREF_LIFELINE_HEADER))); + Metrics.setFrameFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_FRAME_NAME))); + Metrics.setLifelineHeaderFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_LIFELINE_HEADER))); int syncMessFontH = context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_SYNC_MESS)); int syncMessRetFontH = context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_SYNC_MESS_RET)); @@ -1045,7 +1018,7 @@ public class SDWidget extends ScrollView implements SelectionListener, IProperty } resizeContents(width, height); - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_FRAME)); + context.setBackground(SDViewPref.getInstance().getBackGroundColor(ISDPreferences.PREF_FRAME)); context.fillRectangle(0, 0, getContentsWidth(), Metrics.FRAME_V_MARGIN); context.fillRectangle(0, 0, fFrame.getX(), getContentsHeight()); context.fillRectangle(fFrame.getX() + fFrame.getWidth() + 1, 0, getContentsWidth() - (fFrame.getX() + fFrame.getWidth() + 1), getContentsHeight()); @@ -1213,7 +1186,8 @@ public class SDWidget extends ScrollView implements SelectionListener, IProperty * @return the tooltip text. */ protected String getPostfixForTooltip(boolean accessible) { - String postfix = "";//$NON-NLS-1$ + StringBuffer postfix = new StringBuffer(); +// String postfix = "";//$NON-NLS-1$ // Determine if the tooltip must show the time difference between the current mouse position and // the last selected graphNode if ((fCurrentGraphNode != null) && @@ -1222,33 +1196,50 @@ public class SDWidget extends ScrollView implements SelectionListener, IProperty (fCurrentGraphNode != fToolTipNode) && ((ITimeRange) fToolTipNode).hasTimeInfo() && ((ITimeRange) fCurrentGraphNode).hasTimeInfo()) { - postfix = " -> " + fCurrentGraphNode.getName() + "\n" + SDMessages._138 + " "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + postfix.append(" -> "); //$NON-NLS-1$ + postfix.append(fCurrentGraphNode.getName()); + postfix.append("\n"); //$NON-NLS-1$ + postfix.append(SDMessages._138); + postfix.append(" "); //$NON-NLS-1$ + +// postfix = " -> " + fCurrentGraphNode.getName() + "\n" + SDMessages._138 + " "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //double delta = ((ITimeRange)toolTipNode).getLastTime()-((ITimeRange)currentGraphNode).getLastTime(); ITmfTimestamp firstTime = ((ITimeRange) fCurrentGraphNode).getEndTime(); ITmfTimestamp lastTime = ((ITimeRange) fToolTipNode).getEndTime(); TmfTimestamp delta = (TmfTimestamp) lastTime.getDelta(firstTime); - postfix += delta.toString(); + postfix.append(delta.toString()); + +// postfix += delta.toString(); } else { if ((fToolTipNode instanceof ITimeRange) && ((ITimeRange) fToolTipNode).hasTimeInfo()) { - postfix = "\n";//$NON-NLS-1$ + postfix.append("\n"); //$NON-NLS-1$ +// postfix = "\n";//$NON-NLS-1$ ITmfTimestamp firstTime = ((ITimeRange) fToolTipNode).getStartTime(); ITmfTimestamp lastTime = ((ITimeRange) fToolTipNode).getEndTime(); if (firstTime != null) { if (lastTime != null && firstTime.compareTo(lastTime, true) != 0) { - postfix += "start: " + firstTime + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ - postfix += "end: " + lastTime + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ + postfix.append("start: "); //$NON-NLS-1$ + postfix.append(firstTime.toString()); + postfix.append("\n"); //$NON-NLS-1$ + postfix.append("end: "); //$NON-NLS-1$ + postfix.append(lastTime.toString()); + postfix.append("\n"); //$NON-NLS-1$ +// postfix += "start: " + firstTime + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ +// postfix += "end: " + lastTime + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ } else { - postfix += firstTime.toString(); + postfix.append(firstTime.toString()); +// postfix += firstTime.toString(); } } else if (lastTime != null) { - postfix += lastTime.toString(); + postfix.append(lastTime.toString()); +// postfix += lastTime.toString(); } } } - return postfix; + return postfix.toString(); } /** @@ -1317,8 +1308,8 @@ public class SDWidget extends ScrollView implements SelectionListener, IProperty Metrics.setLifelineFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_LIFELINE))); Metrics.setLifelineFontWidth(context.getFontWidth(SDViewPref.getInstance().getFont(SDViewPref.PREF_LIFELINE))); Metrics.setLifelineWidth(SDViewPref.getInstance().getLifelineWidth()); - Metrics.setFrameFontHeight(context.getFontHeight(Frame.getUserPref().getFont(ISDPreferences.PREF_FRAME_NAME))); - Metrics.setLifelineHeaderFontHeight(context.getFontHeight(Frame.getUserPref().getFont(ISDPreferences.PREF_LIFELINE_HEADER))); + Metrics.setFrameFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_FRAME_NAME))); + Metrics.setLifelineHeaderFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_LIFELINE_HEADER))); int syncMessFontH = context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_SYNC_MESS)); int syncMessRetFontH = context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_SYNC_MESS_RET)); @@ -1345,7 +1336,7 @@ public class SDWidget extends ScrollView implements SelectionListener, IProperty resizeContents(width, height); - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_FRAME)); + context.setBackground(SDViewPref.getInstance().getBackGroundColor(ISDPreferences.PREF_FRAME)); context.fillRectangle(0, 0, getContentsWidth(), Metrics.FRAME_V_MARGIN); context.fillRectangle(0, 0, fFrame.getX(), getContentsHeight()); context.fillRectangle(fFrame.getX() + fFrame.getWidth() + 1, 0, getContentsWidth() - (fFrame.getX() + fFrame.getWidth() + 1), getContentsHeight()); @@ -1882,7 +1873,8 @@ public class SDWidget extends ScrollView implements SelectionListener, IProperty gc.dispose(); return; } else { - Frame.setUserPref(SDViewPref.getInstance()); +// Frame.setUserPref(SDViewPref.getInstance()); + SDViewPref.getInstance(); } Rectangle area = getClientArea(); @@ -2112,4 +2104,22 @@ public class SDWidget extends ScrollView implements SelectionListener, IProperty } return super.getContentsY(); } + + /** + * Traverse Listener implementation. + */ + protected static class LocalTraverseListener implements TraverseListener { + + /* + * (non-Javadoc) + * @see org.eclipse.swt.events.TraverseListener#keyTraversed(org.eclipse.swt.events.TraverseEvent) + */ + @Override + public void keyTraversed(TraverseEvent e) { + if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS)) { + e.doit = true; + } + } + } + } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/ScrollView.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/ScrollView.java index 59b6664628..a7c1aa78bb 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/ScrollView.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/ScrollView.java @@ -626,7 +626,7 @@ public class ScrollView extends Composite { * * @return true if the dragAutoScroll property is true */ - public boolean getDragAutoScroll() { + public boolean isDragAutoScroll() { return fAutoScrollEnabled; } @@ -731,7 +731,7 @@ public class ScrollView extends Composite { * @param value true to engage overview feature */ public void setOverviewEnabled(boolean value) { - if (getOverviewEnabled() == value) { + if (isOverviewEnabled() == value) { return; } @@ -760,7 +760,7 @@ public class ScrollView extends Composite { * * @return true is overview feature is enabled */ - public boolean getOverviewEnabled() { + public boolean isOverviewEnabled() { if (fCornerControl instanceof Button) { Object data = ((Button) fCornerControl).getData(); // overview alreay @@ -946,7 +946,6 @@ public class ScrollView extends Composite { * @param height new height of the area. */ public void resizeContents(int width, int height) { - // System.out.println("SV--resizeContents("+_w+","+_h+" ) {"); int localWidth = width; int localHeight = height; @@ -964,7 +963,6 @@ public class ScrollView extends Composite { return; } - // System.out.println("RESIZE-CONTENTS("+_w+","+_h+")"); fContentsWidth = localWidth; fContentsHeight = localHeight; @@ -1000,7 +998,6 @@ public class ScrollView extends Composite { } else { updateScrollBarsValues(); } - // System.out.println("SV--resizeContents() }"); } // redefined for internal use .. @@ -1071,33 +1068,36 @@ public class ScrollView extends Composite { */ protected void ensureVisible(int xValue, int yValue, int width, int height, int align, boolean forceAlign) { + int localX = xValue; + int localY = yValue; int localWidth = width; int localHeight = height; if (localWidth < 0) { - xValue = xValue + localWidth; + localX = localX + localWidth; localWidth = -localWidth; } if (localHeight < 0) { - yValue = yValue + localHeight; + localY = localY + localHeight; localHeight = -localHeight; } int hbar = getHorizontalBarHeight(); int vbar = getVerticalBarWidth(); - int cx = getContentsX(), cy = getContentsY(); + int cx = getContentsX(); + int cy = getContentsY(); int right = getContentsX() + getVisibleWidth() - vbar; int bottom = getContentsY() + getVisibleHeight() - hbar; boolean align_h = false, align_v = false; - if (xValue < getContentsX()) { - cx = xValue; - } else if (xValue + localWidth > right) { - cx = xValue - localWidth; + if (localX < getContentsX()) { + cx = localX; + } else if (localX + localWidth > right) { + cx = localX - localWidth; } - if (yValue < getContentsY()) { - cy = yValue; - } else if (yValue + localHeight > bottom) { - cy = yValue - localHeight; + if (localY < getContentsY()) { + cy = localY; + } else if (localY + localHeight > bottom) { + cy = localY - localHeight; } if (localWidth > getVisibleWidth()) { @@ -1107,25 +1107,25 @@ public class ScrollView extends Composite { align_v = true; } // compute alignment on visible area horizontally - if (align_h || (forceAlign && xValue + localWidth > right)) { + if (align_h || (forceAlign && localX + localWidth > right)) { // use align flags if ((align & SWT.LEFT) != 0) { - cx = xValue; + cx = localX; } else if ((align & SWT.RIGHT) != 0) { cx = right - localWidth; } else { // center - cx = xValue + (localWidth - getVisibleWidth()) / 2; + cx = localX + (localWidth - getVisibleWidth()) / 2; } } // compute alignment on visible area vertically - if (align_v || (forceAlign && yValue + localHeight > bottom)) { + if (align_v || (forceAlign && localY + localHeight > bottom)) { // use align flags if ((align & SWT.TOP) != 0) { - cy = yValue; + cy = localY; } else if ((align & SWT.BOTTOM) != 0) { cy = bottom - localHeight; } else { // center - cy = yValue + (localHeight - getVisibleHeight()) / 2; + cy = localY + (localHeight - getVisibleHeight()) / 2; } } setContentsPos(cx, cy); @@ -1312,6 +1312,8 @@ public class ScrollView extends Composite { } } break; + default: + break; } switch (fHorScrollbarMode) { @@ -1329,6 +1331,8 @@ public class ScrollView extends Composite { } } break; + default: + break; } return vis; } @@ -1344,7 +1348,6 @@ public class ScrollView extends Composite { int barNewVis = computeBarVisibility(getVisibleWidth(), getVisibleHeight(), currHorVis, currVertVis); boolean newVertVis = (barNewVis & VBAR) != 0; boolean newHorVis = (barNewVis & HBAR) != 0; - // System.out.println("SV--updateScrollBarVis old, h:"+curr_h_vis+" v:"+curr_v_vis+" new="+bar_new_vis); if (currVertVis ^ newVertVis) { // vertsb_.getVisible() ) fVertScrollBar.setVisible(newVertVis); change = true; @@ -1369,7 +1372,6 @@ public class ScrollView extends Composite { * Setup scroll bar using contents, visible and scroll bar mode properties. */ protected void updateScrollBarsValues() { - // System.out.println("UPDATE-SCROLL-BAR-VALUES"); /* update vertical scrollbar */ ScrollBar b = getVerticalBar(); if (b != null) { @@ -1502,8 +1504,7 @@ public class ScrollView extends Composite { * @return the visible height of scroll view, might be > contentsHeight() */ public int getVisibleHeight() { - Rectangle r = fViewControl.getClientArea(); - return r.height; + return fViewControl.getClientArea().height; } /** @@ -1512,8 +1513,7 @@ public class ScrollView extends Composite { * @return int the visible width of scroll view, might be > contentsWidth() */ public int getVisibleWidth() { - Rectangle r = fViewControl.getClientArea(); - return r.width; + return fViewControl.getClientArea().width; } /** @@ -1533,30 +1533,19 @@ public class ScrollView extends Composite { case SWT.ARROW_RIGHT: scrollBy(+getVisibleWidth(), 0); break; + default: + break; } } /** * Redefine this method at your convenience + * * @param event The key event. */ protected void keyReleasedEvent(KeyEvent event) { } - /** - * Called when ScrollView view is resized. - */ - protected void viewResized() { - // System.out.println("SV--viewResizeEvent()"); - // scroll contents x,y if visible area bigger than contents... - if (!setContentsPos(getContentsX(), getContentsY())) { - // if no scroll done, scroll bar must be updated. - /* - * if( ocx==getContentsX() && ocy==getContentsY() ) { updateScrollBars(); } - */ - } - } - /** * Returns vertical bar width, even if bar isn't visible. * @@ -1640,7 +1629,6 @@ public class ScrollView extends Composite { dontLayout = true; } - // System.out.println(">>> SV.layout() {"); Point cs = composite.getSize(); int bar_vis = computeBarVisibility(cs.x, cs.y, false, false); boolean vb_vis = (bar_vis & VBAR) != 0; @@ -1652,7 +1640,6 @@ public class ScrollView extends Composite { int wb = vb_vis ? vbw : 0; int hb = hb_vis ? hbh : 0; int cww = 0, cwh = 0; - // System.out.println("SV-LAYOUT H.vis="+hb_vis+" V.vis="+vb_vis); if (fCornerControl != null && (vb_vis || hb_vis)) { // corner_control_.getVisible()) fCornerControl.setVisible(true); @@ -1677,23 +1664,9 @@ public class ScrollView extends Composite { int vh = cs.y - (hb_vis ? hbh : 0); int vbx = cs.x - wb; int hby = cs.y - hb; - Rectangle rc = fViewControl.getClientArea(); - int old_width = rc.width; - int old_height = rc.height; - // provoque pas un viewResize ??? + fViewControl.setBounds(0, 0, vw, vh); - boolean do_view_resize = false; - rc = fViewControl.getClientArea(); - if (old_width != rc.width || old_height != rc.height) { - // area size change, so visibleWidth()/Height() change too - // so scrollbars visibility ma change too.. - // so need an other layout ! - /* - * if( updateScrollBarVisiblity() ) { layout( composite, flushCache); - * System.out.println("<<< SV.layout() } (recursive)"); return ; } - */ - do_view_resize = true; - } + if (vb_vis) { fVertScrollBar.setBounds(vbx, 0, wb, cs.y - cwh); } @@ -1704,11 +1677,7 @@ public class ScrollView extends Composite { fCornerControl.setBounds(vbx, hby, vbw, hbh); } updateScrollBarsValues(); - if (do_view_resize) { - // System.out.println(" -layout do_view_resize old="+old_width+"x"+old_height+" new="+viewcontrol_.getClientArea()); - viewResized(); - } - // System.out.println("<<< SV.layout() }"); + seek--; if (seek == 0) { dontLayout = false; @@ -1717,7 +1686,7 @@ public class ScrollView extends Composite { } // static must take place here... cursor is created once. - static Cursor fOverviewCursor; + volatile static Cursor fOverviewCursor; /** Support for click-and-see overview shell on this ScrollView */ protected class Overview { @@ -1929,9 +1898,6 @@ public class ScrollView extends Composite { // cx,cy to display's global coordinates p = toGlobalCoordinates(fOverview.getParent(), cx, cy); - cx = p.x; - cy = p.y; - } /** @@ -1946,8 +1912,9 @@ public class ScrollView extends Composite { * @param restoreCursorLoc A flag to restore cursor location */ protected void overviewDisappear(boolean restoreCursorLoc) { - if (fOverview == null) + if (fOverview == null) { return; + } fOverview.setVisible(false); fCornerControl.setCursor(null); if (restoreCursorLoc) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/TimeCompressionBar.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/TimeCompressionBar.java index ed4555bde4..4eb2d80668 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/TimeCompressionBar.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/TimeCompressionBar.java @@ -242,35 +242,9 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener { } }); - getViewControl().addTraverseListener(new TraverseListener() { + getViewControl().addTraverseListener(new LocalTraverseListener()); - /* - * (non-Javadoc) - * @see org.eclipse.swt.events.TraverseListener#keyTraversed(org.eclipse.swt.events.TraverseEvent) - */ - @Override - public void keyTraversed(TraverseEvent e) { - if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS)) { - e.doit = true; - } - } - - }); - - addTraverseListener(new TraverseListener() { - - /* - * (non-Javadoc) - * @see org.eclipse.swt.events.TraverseListener#keyTraversed(org.eclipse.swt.events.TraverseEvent) - */ - @Override - public void keyTraversed(TraverseEvent e) { - if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS)) { - e.doit = true; - } - } - - }); + addTraverseListener(new LocalTraverseListener()); getViewControl().addFocusListener(new FocusListener() { @@ -917,15 +891,6 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener { super.keyPressedEvent(event); } - /* - * (non-Javadoc) - * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#keyReleasedEvent(org.eclipse.swt.events.KeyEvent) - */ - @Override - protected void keyReleasedEvent(KeyEvent event) { - super.keyReleasedEvent(event); - } - /** * Selects the time delta for given delta y coordinate and direction. * @@ -1116,4 +1081,21 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener { } } } + + /** + * Traverse Listener implementation. + */ + protected static class LocalTraverseListener implements TraverseListener { + + /* + * (non-Javadoc) + * @see org.eclipse.swt.events.TraverseListener#keyTraversed(org.eclipse.swt.events.TraverseEvent) + */ + @Override + public void keyTraversed(TraverseEvent e) { + if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS)) { + e.doit = true; + } + } + } } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/AsyncMessage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/AsyncMessage.java index 0d0d392e51..10f6eb8411 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/AsyncMessage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/AsyncMessage.java @@ -17,6 +17,7 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp; import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences; +import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SortAsyncForBackward; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SortAsyncMessageComparator; @@ -363,21 +364,24 @@ public class AsyncMessage extends BaseMessage implements ITimeRange { if (!isVisible()) { return; } + + ISDPreferences pref = SDViewPref.getInstance(); + // Draw it selected? if (isSelected() && (fStartLifeline != null && fEndLifeline != null && fStartLifeline == fEndLifeline && (fStartEventOccurrence != fEndEventOccurrence))) { /* * Draw it twice First time, bigger inverting selection colors Second time, regular drawing using selection * colors This create the highlight effect */ - context.setForeground(Frame.getUserPref().getBackGroundColorSelection()); + context.setForeground(pref.getBackGroundColorSelection()); context.setLineWidth(Metrics.SELECTION_LINE_WIDTH); drawAsyncMessage(context); - context.setBackground(Frame.getUserPref().getBackGroundColorSelection()); - context.setForeground(Frame.getUserPref().getForeGroundColorSelection()); + context.setBackground(pref.getBackGroundColorSelection()); + context.setForeground(pref.getForeGroundColorSelection()); // Second drawing is done after the else } else { - context.setBackground(Frame.getUserPref().getBackGroundColor(fPrefId)); - context.setForeground(Frame.getUserPref().getForeGroundColor(fPrefId)); + context.setBackground(pref.getBackGroundColor(fPrefId)); + context.setForeground(pref.getForeGroundColor(fPrefId)); } if (hasFocus()) { context.setDrawTextWithFocusStyle(true); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/AsyncMessageReturn.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/AsyncMessageReturn.java index ec07f04fbe..88e42b391c 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/AsyncMessageReturn.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/AsyncMessageReturn.java @@ -13,6 +13,7 @@ package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences; +import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref; /** * The message return graph node implementation.
@@ -81,13 +82,16 @@ public class AsyncMessageReturn extends AsyncMessage { if (!isVisible()) { return; } + + ISDPreferences pref = SDViewPref.getInstance(); + fPrefId = ISDPreferences.PREF_ASYNC_MESS_RET; int oldStyle = context.getLineStyle(); // Message return are dashed context.setLineStyle(context.getLineDotStyle()); if (!isSelected()) { - context.setBackground(Frame.getUserPref().getBackGroundColor(fPrefId)); - context.setForeground(Frame.getUserPref().getForeGroundColor(fPrefId)); + context.setBackground(pref.getBackGroundColor(fPrefId)); + context.setForeground(pref.getForeGroundColor(fPrefId)); } super.draw(context); // restore the context diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BaseMessage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BaseMessage.java index ab36b912a8..7e91071a47 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BaseMessage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BaseMessage.java @@ -16,6 +16,7 @@ package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences; +import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref; /** * The base UML2 syncMessages implementation.
@@ -434,12 +435,14 @@ public abstract class BaseMessage extends GraphNode { int fX, fY, fW, fH; fX = fY = fW = fH = 0; - // temporay store the coordinates to avoid more methods calls + // temporary store the coordinates to avoid more methods calls int x = getX(); int y = getY(); int width = getWidth(); int height = getHeight(); + ISDPreferences pref = SDViewPref.getInstance(); + // UML2 found message (always drawn from left to right) // or UML2 lost message (always drawn from left to right) if ((fStartLifeline == null || fEndLifeline == null) && fStartLifeline != fEndLifeline) { @@ -447,7 +450,7 @@ public abstract class BaseMessage extends GraphNode { // The label is truncated if it cannot fit between the two message end // 2*Metrics.MESSAGES_NAME_SPACING = space above the label + space below the label IColor temp = context.getForeground(); - context.setForeground(Frame.getUserPref().getFontColor(fPrefId)); + context.setForeground(pref.getFontColor(fPrefId)); context.drawTextTruncatedCentred(getName(), x, y - Metrics.getMessageFontHeigth() - 2 * Metrics.MESSAGES_NAME_SPACING, width, 2 * Metrics.MESSAGES_NAME_SPACING + Metrics.getMessageFontHeigth(), !isSelected()); context.setForeground(temp); int margin = 0; @@ -491,7 +494,7 @@ public abstract class BaseMessage extends GraphNode { context.fillOval(x + width - ray, y + height - ray, ray * 2, ray * 2); } context.setBackground(storedColor); - context.setForeground(Frame.getUserPref().getFontColor(fPrefId)); + context.setForeground(pref.getFontColor(fPrefId)); fX = x; fY = y - yt.intValue(); fW = width; @@ -552,7 +555,7 @@ public abstract class BaseMessage extends GraphNode { // 2*Metrics.MESSAGES_NAME_SPACING = space above the label + space below the label // the space available for the text is sorter if are drawing internal message on the last lifeline - context.setForeground(Frame.getUserPref().getFontColor(fPrefId)); + context.setForeground(pref.getFontColor(fPrefId)); if (fStartLifeline.getIndex() == fStartLifeline.getFrame().getHorizontalIndex()) { context.drawTextTruncated(getName(), x + width + Metrics.INTERNAL_MESSAGE_V_MARGIN / 2, y, Metrics.swimmingLaneWidth() / 2 - Metrics.EXECUTION_OCCURRENCE_WIDTH + -Metrics.INTERNAL_MESSAGE_WIDTH, +Metrics.MESSAGES_NAME_SPACING - Metrics.getMessageFontHeigth(), !isSelected()); @@ -617,7 +620,7 @@ public abstract class BaseMessage extends GraphNode { // Draw the message label above the message and centered // The label is truncated if it cannot fit between the two message end // 2*Metrics.MESSAGES_NAME_SPACING = space above the label + space below the label - context.setForeground(Frame.getUserPref().getFontColor(fPrefId)); + context.setForeground(pref.getFontColor(fPrefId)); if (spaceBTWStartEnd > 0) { context.drawTextTruncatedCentred(getName(), x, y + height / 2 - (2 * Metrics.MESSAGES_NAME_SPACING + Metrics.getMessageFontHeigth()), width, 2 * Metrics.MESSAGES_NAME_SPACING + Metrics.getMessageFontHeigth(), !isSelected()); } else { @@ -635,18 +638,19 @@ public abstract class BaseMessage extends GraphNode { if (!isVisible()) { return; } + // Draw it selected?*/ if (isSelected()) { - + ISDPreferences pref = SDViewPref.getInstance(); /* * Draw it twice First time, bigger inverting selection colors Second time, regular drawing using selection * colors This create the highlight effect */ - context.setForeground(Frame.getUserPref().getBackGroundColorSelection()); + context.setForeground(pref.getBackGroundColorSelection()); context.setLineWidth(Metrics.SELECTION_LINE_WIDTH); drawMessage(context); - context.setBackground(Frame.getUserPref().getBackGroundColorSelection()); - context.setForeground(Frame.getUserPref().getForeGroundColorSelection()); + context.setBackground(pref.getBackGroundColorSelection()); + context.setForeground(pref.getForeGroundColorSelection()); // Second drawing is done after } context.setLineWidth(Metrics.NORMAL_LINE_WIDTH); @@ -727,19 +731,22 @@ public abstract class BaseMessage extends GraphNode { */ @Override public void drawFocus(IGC context) { + + ISDPreferences pref = SDViewPref.getInstance(); + if ((fStartLifeline != fEndLifeline) && (fStartEventOccurrence == fEndEventOccurrence)) { context.setLineStyle(context.getLineDotStyle()); context.setLineWidth(Metrics.NORMAL_LINE_WIDTH); - context.setBackground(Frame.getUserPref().getBackGroundColorSelection()); - context.setForeground(Frame.getUserPref().getForeGroundColorSelection()); + context.setBackground(pref.getBackGroundColorSelection()); + context.setForeground(pref.getForeGroundColorSelection()); context.drawFocus(getX(), getY() - 3, getWidth(), getHeight() + 6); } else if ((fStartLifeline == fEndLifeline) && (fStartEventOccurrence == fEndEventOccurrence)) { context.drawFocus(getX(), getY() - 3, getWidth(), Metrics.SYNC_INTERNAL_MESSAGE_HEIGHT + 6); } else if ((fStartLifeline != fEndLifeline) && (fStartEventOccurrence != fEndEventOccurrence)) { context.setLineStyle(context.getLineDotStyle()); context.setLineWidth(Metrics.NORMAL_LINE_WIDTH); - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_LIFELINE_HEADER)); - context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_LIFELINE_HEADER)); + context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE_HEADER)); + context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_LIFELINE_HEADER)); drawRot(getX(), getY() - 5, getWidth(), 10, context); } else { super.drawFocus(context); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicExecutionOccurrence.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicExecutionOccurrence.java index 96d4d12102..87ad83cc4d 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicExecutionOccurrence.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicExecutionOccurrence.java @@ -16,6 +16,7 @@ package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences; +import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref; /** * BasicExecutionOccurrence is the UML2 execution occurrence graphical representation. It is attached to one Lifeline, @@ -210,15 +211,17 @@ public class BasicExecutionOccurrence extends GraphNode { IColor tempFillColor = null; IColor tempStrokeColor = null; + ISDPreferences pref = SDViewPref.getInstance(); + // The execution occurrence is selected // if the owning lifeline is selected if (fLifeline.isSelected() || isSelected()) { - context.setBackground(Frame.getUserPref().getBackGroundColorSelection()); - context.setForeground(Frame.getUserPref().getForeGroundColorSelection()); + context.setBackground(pref.getBackGroundColorSelection()); + context.setForeground(pref.getForeGroundColorSelection()); } else { tempFillColor = setUnselectedFillColor(context); } - if (Frame.getUserPref().useGradienColor()) { + if (pref.useGradienColor()) { context.fillGradientRectangle(x, y, width, height, false); } else { context.fillRectangle(x, y, width, height); @@ -244,11 +247,14 @@ public class BasicExecutionOccurrence extends GraphNode { * @return IColor */ protected IColor setUnselectedFillColor(IGC context) { - if (Frame.getUserPref().useGradienColor()) { - context.setGradientColor(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_EXEC)); - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_FRAME)); + + ISDPreferences pref = SDViewPref.getInstance(); + + if (pref.useGradienColor()) { + context.setGradientColor(pref.getBackGroundColor(ISDPreferences.PREF_EXEC)); + context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_FRAME)); } else { - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_EXEC)); + context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_EXEC)); } return null; } @@ -260,7 +266,7 @@ public class BasicExecutionOccurrence extends GraphNode { * @return IColor */ protected IColor setUnselectedStrokeColor(IGC context) { - context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_EXEC)); + context.setForeground(SDViewPref.getInstance().getForeGroundColor(ISDPreferences.PREF_EXEC)); return null; } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicFrame.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicFrame.java index 4ca9866c30..5b43af7f2f 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicFrame.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicFrame.java @@ -38,18 +38,10 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref; */ public class BasicFrame extends GraphNode { - // ------------------------------------------------------------------------ - // Static Attributes/Constants - // ------------------------------------------------------------------------ - /** - * The sequence diagram reference. - */ - protected static ISDPreferences fUserPref = null; - // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + /** * Contains the max elapsed time between two consecutive messages in the whole frame */ @@ -280,8 +272,11 @@ public class BasicFrame extends GraphNode { * @param context the context to draw to */ protected void drawFrame(IGC context) { - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_FRAME)); - context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_FRAME)); + + ISDPreferences pref = SDViewPref.getInstance(); + + context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_FRAME)); + context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_FRAME)); int x = getX(); int y = getY(); @@ -292,9 +287,9 @@ public class BasicFrame extends GraphNode { context.fillRectangle(x, y, w, h); context.drawRectangle(x, y, w, h); - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_FRAME_NAME)); - context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_FRAME_NAME)); - context.setFont(Frame.getUserPref().getFont(ISDPreferences.PREF_FRAME_NAME)); + context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_FRAME_NAME)); + context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_FRAME_NAME)); + context.setFont(pref.getFont(ISDPreferences.PREF_FRAME_NAME)); int nameWidth = context.textExtent(getName()) + 2 * Metrics.FRAME_NAME_V_MARGIN; int nameHeight = Metrics.getFrameFontHeigth() + +Metrics.FRAME_NAME_H_MARGIN * 2; @@ -309,11 +304,11 @@ public class BasicFrame extends GraphNode { context.drawPolygon(points); context.drawLine(x, y, x, y + nameHeight); - context.setForeground(Frame.getUserPref().getFontColor(ISDPreferences.PREF_FRAME_NAME)); + context.setForeground(pref.getFontColor(ISDPreferences.PREF_FRAME_NAME)); context.drawTextTruncatedCentred(getName(), x, y, nameWidth - 11, nameHeight, false); - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_FRAME)); - context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_FRAME)); + context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_FRAME)); + context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_FRAME)); } /* @@ -345,27 +340,8 @@ public class BasicFrame extends GraphNode { } else { Metrics.setForcedEventSpacing(-1); } - if (fUserPref == null) { - return; - } - super.drawChildenNodes(context); - } - /** - * Sets the sequence diagram preferences. - * - * @param pref the preferences to set. - */ - public static void setUserPref(ISDPreferences pref) { - fUserPref = pref; - } - - /** - * Returns the sequence diagram preferences. - * @return the sequence diagram preferences. - */ - public static ISDPreferences getUserPref() { - return fUserPref; + super.drawChildenNodes(context); } /** @@ -471,7 +447,8 @@ public class BasicFrame extends GraphNode { } List timeArray = buildTimeArray(); - if (timeArray == null) { + + if ((timeArray == null) || timeArray.isEmpty()) { return; } for (int i = 0; i < timeArray.size(); i++) { @@ -513,7 +490,8 @@ public class BasicFrame extends GraphNode { */ protected void computeMinMax() { List timeArray = buildTimeArray(); - if (timeArray == null) { + + if ((timeArray == null) || timeArray.isEmpty()) { return; } for (int i = 0; i < timeArray.size() - 1; i++) { @@ -553,11 +531,11 @@ public class BasicFrame extends GraphNode { /** * Builds the time array based on the list of graph nodes. * - * @return the time array else null. + * @return the time array else empty list. */ protected List buildTimeArray() { if (!fHasChilden) { - return null; + return new ArrayList(); } Iterator it = fForwardSort.keySet().iterator(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/EllipsisMessage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/EllipsisMessage.java index 98bded1603..5c5d7b7041 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/EllipsisMessage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/EllipsisMessage.java @@ -16,6 +16,7 @@ package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences; +import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref; /** * Class to draw Ellipsis Message. @@ -128,21 +129,25 @@ public class EllipsisMessage extends AsyncMessage { if (!isVisible()) { return; } + + ISDPreferences pref = SDViewPref.getInstance(); + // Draw it selected?*/ if (isSelected()) { + /* * Draw it twice First time, bigger inverting selection colors Second time, regular drawing using selection * colors This create the highlight effect */ - context.setForeground(Frame.getUserPref().getBackGroundColorSelection()); + context.setForeground(pref.getBackGroundColorSelection()); context.setLineWidth(Metrics.SELECTION_LINE_WIDTH); drawMessage(context); - context.setBackground(Frame.getUserPref().getBackGroundColorSelection()); - context.setForeground(Frame.getUserPref().getForeGroundColorSelection()); + context.setBackground(pref.getBackGroundColorSelection()); + context.setForeground(pref.getForeGroundColorSelection()); // Second drawing is done after the else } else { - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_ASYNC_MESS)); - context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_ASYNC_MESS)); + context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_ASYNC_MESS)); + context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_ASYNC_MESS)); } if (hasFocus()) { context.setDrawTextWithFocusStyle(true); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/ExecutionOccurrence.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/ExecutionOccurrence.java index 442c2bd33f..d63f62359c 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/ExecutionOccurrence.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/ExecutionOccurrence.java @@ -18,6 +18,7 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IImage; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences; +import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref; /** * ExecutionOccurrence is the UML2 execution occurrence graphical representation. It is a BasicExecutionOccurrence on @@ -204,12 +205,13 @@ public class ExecutionOccurrence extends BasicExecutionOccurrence implements ITi */ @Override protected IColor setUnselectedFillColor(IGC context) { + ISDPreferences pref = SDViewPref.getInstance(); if (fFillRGB != null) { IColor tempFillColor = context.createColor(fFillRGB[0], fFillRGB[1], fFillRGB[2]); - if (Frame.getUserPref().useGradienColor()) { + if (pref.useGradienColor()) { context.setGradientColor(tempFillColor); - context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_EXEC)); - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_FRAME)); + context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_EXEC)); + context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_FRAME)); } else { context.setBackground(tempFillColor); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java index 45017a130d..6dd12f1ba5 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java @@ -18,9 +18,6 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.linuxtools.internal.tmf.ui.TmfUiPlugin; import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; @@ -526,7 +523,7 @@ public class Frame extends BasicFrame { @Override protected void computeMinMax() { List timeArray = buildTimeArray(); - if (timeArray == null) { + if ((timeArray == null) || timeArray.isEmpty()) { return; } for (int i = 0; i < timeArray.size() - 1; i++) { @@ -556,6 +553,11 @@ public class Frame extends BasicFrame { public boolean findDateBounds(ITmfTimestamp dateToFind, ITimeRange bounds[]) { if (hasTimeInfo()) { List timeArray = buildTimeArray(); + + if ((timeArray == null) || timeArray.isEmpty()) { + return false; + } + bounds[0] = null; bounds[1] = null; for (int i = 0; i < timeArray.size(); i++) { @@ -654,7 +656,7 @@ public class Frame extends BasicFrame { if (fHighlightLifeline != null) { IColor backupColor = context.getBackground(); - context.setBackground(Frame.getUserPref().getTimeCompressionSelectionColor()); + context.setBackground(SDViewPref.getInstance().getTimeCompressionSelectionColor()); int gy = fHighlightLifeline.getY() + fHighlightLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fStartEvent; context.fillRectangle(Metrics.FRAME_H_MARGIN + 1, gy, fHighlightLifeline.getX() + Metrics.getLifelineWidth() / 2 - Metrics.FRAME_H_MARGIN, (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fNbEvent); context.setBackground(backupColor); @@ -689,7 +691,7 @@ public class Frame extends BasicFrame { int tempEvent = fStartEvent; for (int j = 0; j < fNbEvent; j++) { if (((tempEvent >= exec.fStartEventOccurrence) && (tempEvent <= exec.fEndEventOccurrence) && (tempEvent + 1 >= exec.fStartEventOccurrence) && (tempEvent + 1 <= exec.fEndEventOccurrence))) { - toDraw.highlightExecOccurrenceRegion(context, tempEvent, 1, Frame.getUserPref().getTimeCompressionSelectionColor()); + toDraw.highlightExecOccurrenceRegion(context, tempEvent, 1, SDViewPref.getInstance().getTimeCompressionSelectionColor()); } tempEvent = tempEvent + 1; } @@ -711,55 +713,51 @@ public class Frame extends BasicFrame { */ @Override protected List buildTimeArray() { + if (!fHasChilden) { - return null; - } - try { - List timeArray = super.buildTimeArray(); - fExecutionOccurrencesWithTime = null; - if (getLifelines() != null) { - for (int i = 0; i < ((List) fNodes.get(Lifeline.LIFELINE_TAG)).size(); i++) { - Lifeline l = (Lifeline) ((List) fNodes.get(Lifeline.LIFELINE_TAG)).get(i); - if (l.hasTimeInfo() && l.getExecutions() != null) { - for (Iterator j = l.getExecutions().iterator(); j.hasNext();) { - GraphNode o = j.next(); - if (o instanceof ExecutionOccurrence) { - ExecutionOccurrence eo = (ExecutionOccurrence) o; - if (eo.hasTimeInfo()) { - int event = eo.getStartOccurrence(); - ITmfTimestamp time = eo.getStartTime(); - SDTimeEvent f = new SDTimeEvent(time, event, eo); - timeArray.add(f); - if (fExecutionOccurrencesWithTime == null) { - fExecutionOccurrencesWithTime = new ArrayList(); - } - fExecutionOccurrencesWithTime.add(f); - event = eo.getEndOccurrence(); - time = eo.getEndTime(); - f = new SDTimeEvent(time, event, eo); - timeArray.add(f); - fExecutionOccurrencesWithTime.add(f); + return new ArrayList(); + } + + List timeArray = super.buildTimeArray(); + fExecutionOccurrencesWithTime = null; + if (getLifelines() != null) { + for (int i = 0; i < ((List) fNodes.get(Lifeline.LIFELINE_TAG)).size(); i++) { + Lifeline lifeline = (Lifeline) ((List) fNodes.get(Lifeline.LIFELINE_TAG)).get(i); + if (lifeline.hasTimeInfo() && lifeline.getExecutions() != null) { + for (Iterator j = lifeline.getExecutions().iterator(); j.hasNext();) { + GraphNode o = j.next(); + if (o instanceof ExecutionOccurrence) { + ExecutionOccurrence eo = (ExecutionOccurrence) o; + if (eo.hasTimeInfo()) { + int event = eo.getStartOccurrence(); + ITmfTimestamp time = eo.getStartTime(); + SDTimeEvent f = new SDTimeEvent(time, event, eo); + timeArray.add(f); + if (fExecutionOccurrencesWithTime == null) { + fExecutionOccurrencesWithTime = new ArrayList(); } + fExecutionOccurrencesWithTime.add(f); + event = eo.getEndOccurrence(); + time = eo.getEndTime(); + f = new SDTimeEvent(time, event, eo); + timeArray.add(f); + fExecutionOccurrencesWithTime.add(f); } } } } } + } - if (fExecutionOccurrencesWithTime != null) { - SDTimeEvent[] temp = fExecutionOccurrencesWithTime.toArray(new SDTimeEvent[fExecutionOccurrencesWithTime.size()]); - Arrays.sort(temp, new TimeEventComparator()); - fExecutionOccurrencesWithTime = Arrays.asList(temp); - } - SDTimeEvent[] temp = timeArray.toArray(new SDTimeEvent[timeArray.size()]); + if (fExecutionOccurrencesWithTime != null) { + SDTimeEvent[] temp = fExecutionOccurrencesWithTime.toArray(new SDTimeEvent[fExecutionOccurrencesWithTime.size()]); Arrays.sort(temp, new TimeEventComparator()); - timeArray = Arrays.asList(temp); - return timeArray; - } catch (Exception e) { - TmfUiPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, TmfUiPlugin.PLUGIN_ID, "Error building time array", e )); //$NON-NLS-1$ - return null; + fExecutionOccurrencesWithTime = Arrays.asList(temp); } - + SDTimeEvent[] temp = timeArray.toArray(new SDTimeEvent[timeArray.size()]); + Arrays.sort(temp, new TimeEventComparator()); + timeArray = Arrays.asList(temp); + return timeArray; } /** @@ -776,7 +774,7 @@ public class Frame extends BasicFrame { return null; } - if (smallerEvent == false) { + if (!smallerEvent) { int event = 0; if (message != null) { event = message.getEventOccurrence(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java index 03b617bbbe..f52873dbd2 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java @@ -24,6 +24,7 @@ import java.util.Map; import org.eclipse.linuxtools.internal.tmf.ui.TmfUiTracer; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences; +import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref; /** * The base class used for all UML2 graph nodes displayed in the Sequence Diagram SDWidget. @@ -133,10 +134,10 @@ public abstract class GraphNode { fNodes.put(nodeToAdd.getArrayId(), new ArrayList(1)); fIndexes.put(nodeToAdd.getArrayId(), Integer.valueOf(0)); fForwardNodes.put(nodeToAdd.getArrayId(), new ArrayList(1)); - fForwardSort.put(nodeToAdd.getArrayId(), Boolean.valueOf(false)); + fForwardSort.put(nodeToAdd.getArrayId(), Boolean.FALSE); if (nodeToAdd.getBackComparator() != null) { fBackwardNodes.put(nodeToAdd.getArrayId(), new ArrayList(1)); - fBackwardSort.put(nodeToAdd.getArrayId(), Boolean.valueOf(false)); + fBackwardSort.put(nodeToAdd.getArrayId(), Boolean.FALSE); } } @@ -152,10 +153,10 @@ public abstract class GraphNode { Comparator fcomp = nodeToAdd.getComparator(); Comparator bcomp = nodeToAdd.getBackComparator(); if ((fcomp != null) && (fcomp.compare(node, nodeToAdd) > 0)) { - fForwardSort.put(nodeToAdd.getArrayId(), Boolean.valueOf(true)); + fForwardSort.put(nodeToAdd.getArrayId(), Boolean.TRUE); } if ((bcomp != null) && (bcomp.compare(node, nodeToAdd) > 0)) { - fBackwardSort.put(nodeToAdd.getArrayId(), Boolean.valueOf(true)); + fBackwardSort.put(nodeToAdd.getArrayId(), Boolean.TRUE); } } @@ -521,7 +522,8 @@ public abstract class GraphNode { if ((direction == -1) && (fBackwardNodes.get(nodeType) != null)) { GraphNode currentNode = (GraphNode) ((List) fNodes.get(nodeType)).get(drawIndex); - drawIndex = Arrays.binarySearch(((List) fBackwardNodes.get(nodeType)).toArray(new GraphNode[0]), ((List) fNodes.get(nodeType)).get(drawIndex), currentNode.getBackComparator()); + drawIndex = Arrays.binarySearch(((List) fBackwardNodes.get(nodeType)).toArray(new GraphNode[((List) fBackwardNodes.get(nodeType)).size()]), + ((List) fNodes.get(nodeType)).get(drawIndex), currentNode.getBackComparator()); fNodes.put(nodeType, (List) fBackwardNodes.get(nodeType)); if (drawIndex < 0) { drawIndex = 0; @@ -554,7 +556,7 @@ public abstract class GraphNode { GraphNode next = (GraphNode) ((List) fNodes.get(nodeType)).get(i + 1); if ((comp != null) && (comp.compare(currentNode, next) > 0)) { - sort.put(nodeType, Boolean.valueOf(true)); + sort.put(nodeType, Boolean.TRUE); } } if (direction == 1) { @@ -636,7 +638,7 @@ public abstract class GraphNode { GraphNode[] temp = ((List) fForwardNodes.get(nodeType)).toArray(new GraphNode[((List)fForwardNodes.get(nodeType)).size()]); GraphNode node = (GraphNode) ((List) fNodes.get(nodeType)).get(0); Arrays.sort(temp, node.getComparator()); - fForwardSort.put(nodeType, Boolean.valueOf(false)); + fForwardSort.put(nodeType, Boolean.FALSE); fNodes.put(nodeType, Arrays.asList(temp)); fForwardNodes.put(nodeType, Arrays.asList(temp)); if (TmfUiTracer.isSortingTraced()) { @@ -653,7 +655,7 @@ public abstract class GraphNode { GraphNode[] temp = ((List) fBackwardNodes.get(nodeType)).toArray(new GraphNode[((List) fBackwardNodes.get(nodeType)).size()]); GraphNode node = (GraphNode) ((List) fNodes.get(nodeType)).get(0); Arrays.sort(temp, node.getBackComparator()); - fBackwardSort.put(nodeType, Boolean.valueOf(false)); + fBackwardSort.put(nodeType, Boolean.FALSE); fBackwardNodes.put(nodeType, Arrays.asList(temp)); if (TmfUiTracer.isSortingTraced()) { TmfUiTracer.traceSorting(nodeType + " back array sorted\n"); //$NON-NLS-1$ @@ -676,7 +678,7 @@ public abstract class GraphNode { count = 0; Object nodeType = it3.next(); GraphNode node = (GraphNode) ((List) fNodes.get(nodeType)).get(0); - context.setFont(Frame.getUserPref().getFont(node.fPrefId)); + context.setFont(SDViewPref.getInstance().getFont(node.fPrefId)); int index = ((Integer) fIndexes.get(nodeType)).intValue(); count = drawNodes(context, (List) fNodes.get(nodeType), index, arrayStep); if (TmfUiTracer.isDisplayTraced()) { @@ -710,14 +712,14 @@ public abstract class GraphNode { } GraphNode node = (GraphNode) list.get(0); - context.setFont(Frame.getUserPref().getFont(node.fPrefId)); + context.setFont(SDViewPref.getInstance().getFont(node.fPrefId)); Comparator comparator = node.getComparator(); for (int i = startIndex; i < list.size(); i = i + step) { GraphNode toDraw = (GraphNode) list.get(i); if (i < list.size() - 1) { GraphNode next = (GraphNode) list.get(i + 1); if ((comparator != null) && (comparator.compare(toDraw, next) > 0)) { - fForwardSort.put(next.getArrayId(), Boolean.valueOf(true)); + fForwardSort.put(next.getArrayId(), Boolean.TRUE); } } int cx = context.getContentsX(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/HotSpot.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/HotSpot.java index 669dc6201e..db099e50d3 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/HotSpot.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/HotSpot.java @@ -16,6 +16,7 @@ package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IImage; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences; +import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref; /** * Class to add a hot spot marker. @@ -164,14 +165,16 @@ public class HotSpot extends GraphNode { @Override public void draw(IGC context) { + ISDPreferences pref = SDViewPref.getInstance(); + // The execution occurrence is selected // if the owning lifeline is selected if (isSelected() || (fExecOcc != null && fExecOcc.isSelected()) || (fExecOcc != null && fExecOcc.getLifeline() != null && fExecOcc.getLifeline().isSelected())) { - context.setBackground(Frame.getUserPref().getBackGroundColorSelection()); - context.setForeground(Frame.getUserPref().getForeGroundColorSelection()); + context.setBackground(pref.getBackGroundColorSelection()); + context.setForeground(pref.getForeGroundColorSelection()); } else { - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_EXEC)); - context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_EXEC)); + context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_EXEC)); + context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_EXEC)); } context.drawImage(fImage, getX(), getY(), getWidth(), getHeight()); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Lifeline.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Lifeline.java index d0061df34c..22c1f1aa82 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Lifeline.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Lifeline.java @@ -20,6 +20,7 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IImage; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences; +import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref; /** * Lifeline is the UML2 lifeline graphical representation.
@@ -351,25 +352,27 @@ public class Lifeline extends GraphNode { * @param context The graphical context. */ protected void drawName(IGC context) { + ISDPreferences pref = SDViewPref.getInstance(); + int x = getX(); int y = getY(); int height = Metrics.getLifelineHeaderFontHeigth() + 2 * Metrics.LIFELINE_HEARDER_TEXT_V_MARGIN; int hMargin = Metrics.LIFELINE_VT_MAGIN / 4;// (Metrics.LIFELINE_NAME_H_MARGIN)/2; context.setLineStyle(context.getLineSolidStyle()); - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_LIFELINE_HEADER)); - context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_LIFELINE_HEADER)); - context.setFont(Frame.getUserPref().getFont(ISDPreferences.PREF_LIFELINE_HEADER)); + context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE_HEADER)); + context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_LIFELINE_HEADER)); + context.setFont(pref.getFont(ISDPreferences.PREF_LIFELINE_HEADER)); if (hMargin >= 0) { if (fFrame.getVisibleAreaY() < y - height - hMargin) { context.fillRectangle(x - Metrics.LIFELINE_SPACING / 2 + 1, y - height - hMargin, Metrics.swimmingLaneWidth() - 2, height); context.drawRectangle(x - Metrics.LIFELINE_SPACING / 2 + 1, y - height - hMargin, Metrics.swimmingLaneWidth() - 2, height); - context.setForeground(Frame.getUserPref().getFontColor(ISDPreferences.PREF_LIFELINE_HEADER)); + context.setForeground(pref.getFontColor(ISDPreferences.PREF_LIFELINE_HEADER)); context.drawTextTruncatedCentred(getName(), x + Metrics.LIFELINE_NAME_V_MARGIN - Metrics.LIFELINE_SPACING / 2 + 1, y - height - hMargin, Metrics.swimmingLaneWidth() - 2 * Metrics.LIFELINE_NAME_V_MARGIN - 2, height, true); } else { context.fillRectangle(x - Metrics.LIFELINE_SPACING / 2 + 1, fFrame.getVisibleAreaY(), Metrics.swimmingLaneWidth() - 2, height); context.drawRectangle(x - Metrics.LIFELINE_SPACING / 2 + 1, fFrame.getVisibleAreaY(), Metrics.swimmingLaneWidth() - 2, height); - context.setForeground(Frame.getUserPref().getFontColor(ISDPreferences.PREF_LIFELINE_HEADER)); + context.setForeground(pref.getFontColor(ISDPreferences.PREF_LIFELINE_HEADER)); context.drawTextTruncatedCentred(getName(), x - Metrics.LIFELINE_SPACING / 2 + Metrics.LIFELINE_NAME_V_MARGIN + 1, fFrame.getVisibleAreaY(), Metrics.swimmingLaneWidth() - 2 * Metrics.LIFELINE_NAME_V_MARGIN - 2, height, true); } } @@ -383,29 +386,32 @@ public class Lifeline extends GraphNode { * @param y - the y coordinate */ public void draw(IGC context, int x, int y) { + + ISDPreferences pref = SDViewPref.getInstance(); + // Set the draw color depending if the lifeline must be selected or not context.setLineWidth(Metrics.NORMAL_LINE_WIDTH); if (isSelected()) { - if (Frame.getUserPref().useGradienColor()) { - context.setGradientColor(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_LIFELINE)); + if (pref.useGradienColor()) { + context.setGradientColor(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE)); } - context.setBackground(Frame.getUserPref().getBackGroundColorSelection()); - context.setForeground(Frame.getUserPref().getForeGroundColorSelection()); + context.setBackground(pref.getBackGroundColorSelection()); + context.setForeground(pref.getForeGroundColorSelection()); } else { - if (Frame.getUserPref().useGradienColor()) { - context.setGradientColor(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_LIFELINE)); - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_FRAME)); + if (pref.useGradienColor()) { + context.setGradientColor(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE)); + context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_FRAME)); } else { - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_LIFELINE)); + context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE)); } - context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_LIFELINE)); + context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_LIFELINE)); } // Store the lifeline coordinates to save some calls int width = getWidth(); int height = getHeight(); // Draw the rectangle which contain the lifeline name - if (Frame.getUserPref().useGradienColor()) { + if (pref.useGradienColor()) { context.fillGradientRectangle(x, y, width, height / 2 - 7, true); context.fillRectangle(x, y + height / 2 - 8, width, +height / 2 - 5); context.fillGradientRectangle(x, y + height, width, -height / 2 + 6, true); @@ -427,8 +433,8 @@ public class Lifeline extends GraphNode { // Draw the lifeline label into the rectangle // The label is truncated if it cannot fit IColor temp = context.getForeground(); - context.setFont(Frame.getUserPref().getFont(ISDPreferences.PREF_LIFELINE)); - context.setForeground(Frame.getUserPref().getFontColor(ISDPreferences.PREF_LIFELINE)); + context.setFont(pref.getFont(ISDPreferences.PREF_LIFELINE)); + context.setForeground(pref.getFontColor(ISDPreferences.PREF_LIFELINE)); context.drawTextTruncatedCentred(getName(), x + Metrics.LIFELINE_NAME_V_MARGIN, y, Metrics.getLifelineWidth() - 2 * Metrics.LIFELINE_NAME_V_MARGIN, height, true); context.setLineStyle(context.getLineDashStyle()); @@ -446,10 +452,10 @@ public class Lifeline extends GraphNode { */ if (isSelected()) { - context.setForeground(Frame.getUserPref().getBackGroundColorSelection()); + context.setForeground(pref.getBackGroundColorSelection()); context.setLineWidth(5); context.drawLine(x + Metrics.getLifelineWidth() / 2, y + height, x + Metrics.getLifelineWidth() / 2, dashedLineEnd - 4); - context.setForeground(Frame.getUserPref().getForeGroundColorSelection()); + context.setForeground(pref.getForeGroundColorSelection()); } context.setLineWidth(Metrics.NORMAL_LINE_WIDTH); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Metrics.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Metrics.java index 57b6ff178e..895d5241b8 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Metrics.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Metrics.java @@ -165,6 +165,17 @@ public class Metrics { */ private static int fForcedEventSpacing = -1; + // ------------------------------------------------------------------------ + // Constructor + // ------------------------------------------------------------------------ + /** + * Constructor + * + * Hide private constructor + */ + private Metrics() { + } + // ------------------------------------------------------------------------ // Methods // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Stop.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Stop.java index 1948630e19..aa96d020d6 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Stop.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Stop.java @@ -15,6 +15,7 @@ package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences; +import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref; /** *

@@ -126,9 +127,12 @@ public class Stop extends GraphNode { */ @Override public void draw(IGC context) { + + ISDPreferences pref = SDViewPref.getInstance(); + // Set the appropriate color depending if the graph node if selected or not if (fLifeline.isSelected()) { - context.setForeground(Frame.getUserPref().getBackGroundColorSelection()); + context.setForeground(pref.getBackGroundColorSelection()); context.setLineWidth(Metrics.SELECTION_LINE_WIDTH); int lastWidth = context.getLineWidth(); context.setLineWidth(9); @@ -137,11 +141,11 @@ public class Stop extends GraphNode { context.drawLine(getX() + getWidth(), getY(), getX(), getY() + getHeight()); // restore the context context.setLineWidth(lastWidth); - context.setBackground(Frame.getUserPref().getBackGroundColorSelection()); - context.setForeground(Frame.getUserPref().getForeGroundColorSelection()); + context.setBackground(pref.getBackGroundColorSelection()); + context.setForeground(pref.getForeGroundColorSelection()); } else { - context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_LIFELINE)); - context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_LIFELINE)); + context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE)); + context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_LIFELINE)); } int lastWidth = context.getLineWidth(); context.setLineWidth(3); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/SyncMessage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/SyncMessage.java index ff4c6b76f6..0092bbfc49 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/SyncMessage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/SyncMessage.java @@ -19,6 +19,7 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp; import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences; +import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SortSyncMessageComparator; /** @@ -252,12 +253,16 @@ public class SyncMessage extends BaseMessage implements ITimeRange { */ @Override public void draw(IGC context) { - if (!isVisible()) + if (!isVisible()) { return; + } + + ISDPreferences pref = SDViewPref.getInstance(); + // Draw it selected? if (!isSelected()) { - context.setBackground(Frame.getUserPref().getBackGroundColor(fPrefId)); - context.setForeground(Frame.getUserPref().getForeGroundColor(fPrefId)); + context.setBackground(pref.getBackGroundColor(fPrefId)); + context.setForeground(pref.getForeGroundColor(fPrefId)); } super.draw(context); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/SyncMessageReturn.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/SyncMessageReturn.java index 7330d139d5..4637506054 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/SyncMessageReturn.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/SyncMessageReturn.java @@ -15,6 +15,7 @@ package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC; import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences; +import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref; /** * The message return graph node implementation.
@@ -93,13 +94,16 @@ public class SyncMessageReturn extends SyncMessage { if (!isVisible()) { return; } + + ISDPreferences pref = SDViewPref.getInstance(); + int oldStyle = context.getLineStyle(); // Message return are dashed context.setLineStyle(context.getLineDotStyle()); // Draw it selected? if (!isSelected()) { - context.setBackground(Frame.getUserPref().getBackGroundColor(fPrefId)); - context.setForeground(Frame.getUserPref().getForeGroundColor(fPrefId)); + context.setBackground(pref.getBackGroundColor(fPrefId)); + context.setForeground(pref.getForeGroundColor(fPrefId)); } super.draw(context); // restore the context diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/SDPrintDialogUI.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/SDPrintDialogUI.java index cca6d73fc1..366ba69160 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/SDPrintDialogUI.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/SDPrintDialogUI.java @@ -381,8 +381,6 @@ public class SDPrintDialogUI { if (!isEnabled()) { Image toDel = d; d = new Image(super.getShell().getDisplay(), drawRegionSelected(d, new Rectangle(0, 0, lw, lh), new RGB(221, 208, 200))); - // d, new Rectangle(0,0,((int)(stepX*overviewCanvas.zoomValue)),((int)( - // stepY*overviewCanvas.zoomValue))),new RGB(221,208,200))); toDel.dispose(); } @@ -629,6 +627,22 @@ public class SDPrintDialogUI { } + /** + * A traverse listener implementation. + */ + protected static class LocalTraverseListener implements TraverseListener { + /* + * (non-Javadoc) + * @see org.eclipse.swt.events.TraverseListener#keyTraversed(org.eclipse.swt.events.TraverseEvent) + */ + @Override + public void keyTraversed(TraverseEvent e) { + if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS)) { + e.doit = true; + } + } + } + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ @@ -687,7 +701,7 @@ public class SDPrintDialogUI { fCurrentPage.setSelection(false); fAllPages.setSelection(true); } - if (fVertPagesNum.getText() == "") { //$NON-NLS-1$ + if ("".equals(fVertPagesNum.getText())) { //$NON-NLS-1$ fVertPagesNum.setText("1"); //$NON-NLS-1$ } } @@ -829,10 +843,7 @@ public class SDPrintDialogUI { data2.verticalSpan = 1; fOverviewCanvas = new LocalSD(g2, SWT.NO_BACKGROUND); - GridData seqDiagLayoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL// |GridData.GRAB_HORIZONTAL| - /* GridData.GRAB_VERTICAL| */| GridData.VERTICAL_ALIGN_FILL); - // seqDiagLayoutData.widthHint=400; - // seqDiagLayoutData.horizontalAlignment=GridData.HORIZONTAL_ALIGN_FILL; + GridData seqDiagLayoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL); fOverviewCanvas.setLayoutData(seqDiagLayoutData); // overviewCanvas.resizeContents(100,100); if (fSdView.getContentsWidth() < fSdView.getVisibleWidth() && fSdView.getContentsHeight() < fSdView.getVisibleHeight()) { @@ -949,18 +960,7 @@ public class SDPrintDialogUI { }); - fOverviewCanvas.addTraverseListener(new TraverseListener() { - /* - * (non-Javadoc) - * @see org.eclipse.swt.events.TraverseListener#keyTraversed(org.eclipse.swt.events.TraverseEvent) - */ - @Override - public void keyTraversed(TraverseEvent e) { - if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS)) { - e.doit = true; - } - } - }); + fOverviewCanvas.addTraverseListener(new LocalTraverseListener()); fOverviewCanvas.addFocusListener(new FocusListener() { /* @@ -1004,7 +1004,6 @@ public class SDPrintDialogUI { */ @Override public void widgetSelected(SelectionEvent e) { - printButtonSelected(); } @@ -1164,7 +1163,7 @@ public class SDPrintDialogUI { if ((fSdView.getVisibleWidth() > fSdView.getContentsWidth()) && (fSetVPagesNumber.getSelection() || fSetHPagesNumber.getSelection())) { rat = (float) fSdView.getVisibleWidth() / (float) fSdView.getContentsWidth(); } - fZoomFactor = (fOverviewCanvas.getContentsWidth() / cw) / fOverviewCanvas.getZoomFactor() * rat;// /view.getZoomFactor(); + fZoomFactor = (fOverviewCanvas.getContentsWidth() / cw) / fOverviewCanvas.getZoomFactor() * rat; } /** diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/TabContents.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/TabContents.java index eaf19ed33c..238ef339a3 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/TabContents.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/TabContents.java @@ -106,7 +106,7 @@ public class TabContents extends Composite { */ public TabContents(Composite parent, ISDGraphNodeSupporter provider, Button okButton, String[] expressionList) { super(parent, SWT.NONE); - setOkButton(okButton); + fParentOkButton = okButton; setLayout(new GridLayout()); fGraphNodeTypeListener = new GraphNodeTypeListener(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java index 15b9f29829..ff2f7be9c4 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java @@ -77,7 +77,7 @@ public class LoadersManager { /** * This should not be used by the clients */ - private LoadersManager() { + protected LoadersManager() { } // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java index 7c0c70beb4..8d8331398c 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java @@ -262,20 +262,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader, @TmfSignalHandler public void experimentSelected(TmfExperimentSelectedSignal signal) { - final Job job = new Job("Indexing " + getName() + "...") { //$NON-NLS-1$ //$NON-NLS-2$ - @Override - protected IStatus run(IProgressMonitor monitor) { - while (!monitor.isCanceled()) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - return Status.OK_STATUS; - } - } - monitor.done(); - return Status.OK_STATUS; - } - }; + final Job job = new IndexingJob("Indexing " + getName() + "..."); //$NON-NLS-1$ //$NON-NLS-2$ job.setUser(false); job.schedule(); @@ -1466,6 +1453,34 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader, } } + /** + * Job class to provide progress monitor feedback. + * + * @version 1.0 + * @author Bernd Hufmann + * + */ + protected static class IndexingJob extends Job { + + public IndexingJob(String name) { + super(name); + } + + @Override + protected IStatus run(IProgressMonitor monitor) { + while (!monitor.isCanceled()) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + return Status.OK_STATUS; + } + } + monitor.done(); + return Status.OK_STATUS; + } + } + + /** * Returns sequence diagram event if details in given event are available else null. * diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/preferences/SDViewerPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/preferences/SDViewerPage.java index 8c2a8672a9..8ab0833e1f 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/preferences/SDViewerPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/preferences/SDViewerPage.java @@ -103,16 +103,6 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference */ protected IntegerFieldEditor fLifelineWidth = null; - // ------------------------------------------------------------------------ - // Constructors - // ------------------------------------------------------------------------ - /** - * Default constructor - */ - public SDViewerPage() { - super(); - } - // ------------------------------------------------------------------------ // Methods // ------------------------------------------------------------------------ -- 2.34.1