/**
* The end time of the sequence diagram event (i.e. time when signal was received).
*/
- final protected ITmfTimestamp fEndTime;
+ private final ITmfTimestamp fEndTime;
// ------------------------------------------------------------------------
// Constructors
/**
* The start time of the sequence diagram event (i.e. time when signal was sent).
*/
- final protected ITmfTimestamp fStartTime;
+ private final ITmfTimestamp fStartTime;
/**
* The name of the sender of the signal.
*/
- final protected String fSender;
+ private final String fSender;
/**
* The name of the receiver of the signal.
*/
- final protected String fReceiver;
+ private final String fReceiver;
/**
* The name of the signal
*/
- final protected String fName;
+ private final String fName;
// ------------------------------------------------------------------------
// Constructors
/**********************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation, Ericsson
+ * Copyright (c) 2005, 2013 IBM Corporation, Ericsson
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
/**
* The parent control where the tooltip must be drawn.
*/
- protected Control fParent = null;
+ private Control fParent = null;
/**
* The tooltip shell.
*/
- protected Shell fToolTipShell = null;
- /**
- * The tooltip text.
- */
- protected String fText = null;
+ private Shell fToolTipShell = null;
/**
* The text box.
*/
- protected Text fTextBox = null;
+ private Text fTextBox = null;
// ------------------------------------------------------------------------
// Constructors
return;
}
- fText = value;
int w = fToolTipShell.getBounds().width;
Point hr = Display.getDefault().getCursorLocation();
int cursorH = 32;
fToolTipShell.setSize(fTextBox.getSize());
fTextBox.setVisible(true);
fToolTipShell.setVisible(true);
-
}
/**
fToolTipShell.setVisible(false);
}
+ /**
+ * @return parent control
+ * @since 2.0
+ */
+ protected Control getParent() {
+ return fParent;
+ }
+
}
/**
* The parent control where the tooltip must be drawn
*/
- protected Composite fParent = null;
+ private Composite fParent = null;
/**
* The tooltip shell
*/
- protected Shell fToolTipShell = null;
+ private Shell fToolTipShell = null;
/**
* The Time range data.
*/
- protected TmfTimeRange fMinMaxRange;
+ private TmfTimeRange fMinMaxRange;
/**
* The current time.
*/
- protected ITmfTimestamp fCurrentValue;
+ private ITmfTimestamp fCurrentValue;
/**
* The horizontal margin used for drawing.
*/
/**
* The text to display
*/
- protected String fMessage;
+ private String fMessage;
/**
* The color array used to represent the 10 time range slices
*/
- protected Color[] fColors;
+ private Color[] fColors;
// ------------------------------------------------------------------------
// Constructors
/**
* The graphical context.
*/
- protected GC fContext;
+ private GC fContext;
/**
* The reference to the sequence diagram view.
*/
- protected SDWidget fView;
+ private SDWidget fView;
/**
* A reference to the last used font.
*/
- protected Font fTempFont = null;
+ private Font fTempFont = null;
/**
* The color of the gradient.
*/
- protected IColor fGradientColor = null;
+ private IColor fGradientColor = null;
/**
* The color of the background.
*/
- protected IColor fBackground = null;
+ private IColor fBackground = null;
/**
* The color of the foreground.
*/
- protected IColor fForeground = null;
+ private IColor fForeground = null;
/**
* The current visible y screen bounds
*/
- protected int fVisibleY;
+ private int fVisibleY;
/**
* The current visible x screen bound.
*/
- protected int fVisibleX;
+ private int fVisibleX;
/**
* The current yx value (view visible height - visible screen bounds)
*/
- protected int yx;
+ private int yx;
/**
* The current xx value (view visible width - visible screen bounds)
*/
- protected int xx;
+ private int xx;
/**
* <code>true</code> to draw with focus else <code>false</code>.
*/
- protected boolean fDrawWithFocus = false;
+ private boolean fDrawWithFocus = false;
/**
* The static visible screen bounds.
@Override
public int getContentsX() {
- return Math.round(fView.getContentsX() / fView.fZoomValue);
+ return Math.round(fView.getContentsX() / fView.getZoomValue());
}
@Override
public int getContentsY() {
- return Math.round(fView.getContentsY() / fView.fZoomValue);
+ return Math.round(fView.getContentsY() / fView.getZoomValue());
}
@Override
public int getVisibleWidth() {
- return Math.round(fView.getVisibleWidth() / fView.fZoomValue);
+ return Math.round(fView.getVisibleWidth() / fView.getZoomValue());
}
@Override
public int getVisibleHeight() {
- return Math.round(fView.getVisibleHeight() / fView.fZoomValue);
+ return Math.round(fView.getVisibleHeight() / fView.getZoomValue());
+ }
+
+ /**
+ * Returns the current visible y screen bounds.
+ *
+ * @return the current visible y screen bounds
+ * @since 2.0
+ */
+ protected int getVisibleY() {
+ return fVisibleY;
+ }
+
+ /**
+ * Sets the current visible y screen bounds.
+ *
+ * @param visibleY
+ * the current visible y screen bounds
+ * @since 2.0
+ */
+ protected void setVisibleY(int visibleY) {
+ fVisibleY = visibleY;
+ }
+
+ /**
+ * Returns the current visible x screen bound.
+ *
+ * @return the current visible x screen bound.
+ * @since 2.0
+ *
+ */
+ protected int getfVisibleX() {
+ return fVisibleX;
+ }
+
+ /**
+ * Sets the current visible x screen bound.
+ *
+ * @param visibleX
+ * the current visible x screen bound.
+ * @since 2.0
+ *
+ */
+ protected void setVisibleX(int visibleX) {
+ fVisibleX = visibleX;
+ }
+
+ /**
+ * Returns current yx value (view visible height - visible screen bounds).
+ *
+ * @return current yx value
+ * @since 2.0
+ */
+ protected int getYx() {
+ return yx;
+ }
+
+ /**
+ * Sets current yx value (view visible height - visible screen bounds).
+ *
+ * @param yx
+ * current yx value
+ * @since 2.0
+ */
+ protected void setYx(int yx) {
+ this.yx = yx;
+ }
+
+ /**
+ * Returns the current xx value (view visible width - visible screen bounds)
+ *
+ * @return the current xx value
+ * @since 2.0
+ */
+ protected int getXx() {
+ return xx;
+ }
+
+ /**
+ * Sets the current xx value (view visible width - visible screen bounds)
+ *
+ * @param xx
+ * the current xx value
+ * @since 2.0
+ */
+ protected void setXx(int xx) {
+ this.xx = xx;
}
@Override
int localX2 = x2;
int localY2 = y2;
- localX1 = Math.round(localX1 * fView.fZoomValue);
- localY1 = Math.round(localY1 * fView.fZoomValue);
- localX2 = Math.round(localX2 * fView.fZoomValue);
- localY2 = Math.round(localY2 * fView.fZoomValue);
+ localX1 = Math.round(localX1 * fView.getZoomValue());
+ localY1 = Math.round(localY1 * fView.getZoomValue());
+ localX2 = Math.round(localX2 * fView.getZoomValue());
+ localY2 = Math.round(localY2 * fView.getZoomValue());
localX1 = fView.contentsToViewX(localX1);
localY1 = fView.contentsToViewY(localY1);
localX2 = fView.contentsToViewX(localX2);
int localWidth = width;
int localHeight = height;
- localX = Math.round(localX * fView.fZoomValue);
+ localX = Math.round(localX * fView.getZoomValue());
// Workaround to avoid problems for some special cases (not very nice)
if (localY != getContentsY()) {
- localY = Math.round(localY * fView.fZoomValue);
+ localY = Math.round(localY * fView.getZoomValue());
localY = fView.contentsToViewY(localY);
} else {
localY = 0;
}
- localWidth = Math.round(localWidth * fView.fZoomValue);
- localHeight = Math.round(localHeight * fView.fZoomValue);
+ localWidth = Math.round(localWidth * fView.getZoomValue());
+ localHeight = Math.round(localHeight * fView.getZoomValue());
localX = fView.contentsToViewX(localX);
if (localX < -fVisibleScreenBounds) {
localHeight = -localHeight;
}
- localX = Math.round(localX * fView.fZoomValue);
- localY = Math.round(localY * fView.fZoomValue);
- localWidth = Math.round(localWidth * fView.fZoomValue);
- localHeight = Math.round(localHeight * fView.fZoomValue);
+ localX = Math.round(localX * fView.getZoomValue());
+ localY = Math.round(localY * fView.getZoomValue());
+ localWidth = Math.round(localWidth * fView.getZoomValue());
+ localHeight = Math.round(localHeight * fView.getZoomValue());
setForeground(SDViewPref.getInstance().getForeGroundColorSelection());
setBackground(SDViewPref.getInstance().getBackGroundColorSelection());
int len = (points.length / 2) * 2;
int[] localPoint = new int[len];
for (int i = 0; i < len; i++) {
- localPoint[i] = fView.contentsToViewX(Math.round(points[i] * fView.fZoomValue));
+ localPoint[i] = fView.contentsToViewX(Math.round(points[i] * fView.getZoomValue()));
i++;
- localPoint[i] = fView.contentsToViewY(Math.round(points[i] * fView.fZoomValue));
+ localPoint[i] = fView.contentsToViewY(Math.round(points[i] * fView.getZoomValue()));
}
if (validatePolygonHeight(localPoint) <= 0) {
int len = (points.length / 2) * 2;
int[] localPoint = new int[len];
for (int i = 0; i < len; i++) {
- localPoint[i] = fView.contentsToViewX(Math.round(points[i] * fView.fZoomValue));
+ localPoint[i] = fView.contentsToViewX(Math.round(points[i] * fView.getZoomValue()));
i++;
- localPoint[i] = fView.contentsToViewY(Math.round(points[i] * fView.fZoomValue));
+ localPoint[i] = fView.contentsToViewY(Math.round(points[i] * fView.getZoomValue()));
}
if (validatePolygonHeight(localPoint) <= 0) {
int localWidth = width;
int localHeight = height;
- localX = Math.round(localX * fView.fZoomValue);
+ localX = Math.round(localX * fView.getZoomValue());
// Workaround to avoid problems for some special cases (not very nice)
if (localY != getContentsY()) {
- localY = Math.round(localY * fView.fZoomValue);
+ localY = Math.round(localY * fView.getZoomValue());
localY = fView.contentsToViewY(localY) + 1;
} else {
localY = 1;
}
- localWidth = Math.round(localWidth * fView.fZoomValue) - 1;
- localHeight = Math.round(localHeight * fView.fZoomValue) - 1;
+ localWidth = Math.round(localWidth * fView.getZoomValue()) - 1;
+ localHeight = Math.round(localHeight * fView.getZoomValue()) - 1;
localX = fView.contentsToViewX(localX) + 1;
if (localX < -fVisibleScreenBounds) {
localWidth = localWidth + localX + fVisibleScreenBounds;
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);
+ localX = Math.round(localX * fView.getZoomValue());
+ localY = Math.round(localY * fView.getZoomValue());
+ localWidth = Math.round(localWidth * fView.getZoomValue());
+ localHeight = Math.round(localHeight * fView.getZoomValue());
IColor tempColor = fForeground;
setForeground(fGradientColor);
localX = fView.contentsToViewX(localX);
int localX = x;
int localY = y;
- localX = Math.round(localX * fView.fZoomValue);
- localY = Math.round(localY * fView.fZoomValue);
+ localX = Math.round(localX * fView.getZoomValue());
+ localY = Math.round(localY * fView.getZoomValue());
fContext.drawText(string, fView.contentsToViewX(localX), fView.contentsToViewY(localY), isTrans);
if (fDrawWithFocus) {
Point r = fContext.textExtent(string);
int localX = x;
int localY = y;
- localX = Math.round(localX * fView.fZoomValue);
- localY = Math.round(localY * fView.fZoomValue);
+ localX = Math.round(localX * fView.getZoomValue());
+ localY = Math.round(localY * fView.getZoomValue());
fContext.drawText(string, fView.contentsToViewX(localX), fView.contentsToViewY(localY), true);
if (fDrawWithFocus) {
Point r = fContext.textExtent(string);
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);
+ localX = Math.round(localX * fView.getZoomValue());
+ localY = Math.round(localY * fView.getZoomValue());
+ localWidth = Math.round(localWidth * fView.getZoomValue());
+ localHeight = Math.round(localHeight * fView.getZoomValue());
fContext.fillOval(fView.contentsToViewX(localX), fView.contentsToViewY(localY), localWidth, localHeight);
}
int localHeight = height;
Point tx = fContext.textExtent(name);
- localX = Math.round(localX * fView.fZoomValue);
+ localX = Math.round(localX * fView.getZoomValue());
int y = 0;
// Workaround to avoid round problems for some special cases (not very nice)
if (localY != getContentsY()) {
- localY = Math.round(localY * fView.fZoomValue);
+ localY = Math.round(localY * fView.getZoomValue());
y = fView.contentsToViewY(localY);
}
- localWidth = Math.round(localWidth * fView.fZoomValue);
- localHeight = Math.round(localHeight * fView.fZoomValue);
+ localWidth = Math.round(localWidth * fView.getZoomValue());
+ localHeight = Math.round(localHeight * fView.getZoomValue());
int x = fView.contentsToViewX(localX);
if (tx.y > localHeight) {
return;
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);
+ localX = Math.round(localX * fView.getZoomValue());
+ localY = Math.round(localY * fView.getZoomValue());
+ localWidth = Math.round(localWidth * fView.getZoomValue());
+ localHeight = Math.round(localHeight * fView.getZoomValue());
int x = fView.contentsToViewX(localX);
int y = fView.contentsToViewY(localY);
if (fContext.textExtent(name).x <= localWidth) {
if (image != null && image.getImage() instanceof Image) {
img = (Image) image.getImage();
} else {
- localX = Math.round(localX * fView.fZoomValue);
- localY = Math.round(localY * fView.fZoomValue);
+ localX = Math.round(localX * fView.getZoomValue());
+ localY = Math.round(localY * fView.getZoomValue());
int x = fView.contentsToViewX(localX);
int y = fView.contentsToViewY(localY);
- float tempZoom = fView.fZoomValue;
+ float tempZoom = fView.getZoomValue();
int width = Math.round(maxWith * tempZoom);
int height = Math.round(maxHeight * tempZoom);
fContext.setBackground(fView.getDisplay().getSystemColor(SWT.COLOR_RED));
fContext.fillRectangle(x, y, width, height);
return;
}
- localX = Math.round(localX * fView.fZoomValue);
- localY = Math.round(localY * fView.fZoomValue);
+ localX = Math.round(localX * fView.getZoomValue());
+ localY = Math.round(localY * fView.getZoomValue());
int x = fView.contentsToViewX(localX);
int y = fView.contentsToViewY(localY);
Rectangle b = ((Image) image.getImage()).getBounds();
if (height > maxHeight) {
height = maxHeight;
}
- float tempZoom = fView.fZoomValue;
+ float tempZoom = fView.getZoomValue();
width = Math.round(width * tempZoom);
height = Math.round(height * tempZoom);
- if (fView.fIsPrinting && width > 0 && height > 0) {
+ if (fView.isPrinting() && width > 0 && height > 0) {
Image dbuffer = new Image(fView.getDisplay(), width, height);
GC tempgc = new GC(dbuffer);
tempgc.drawImage(img, 0, 0, b.width, b.height, 0, 0, width, height);
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);
+ localX = Math.round(localX * fView.getZoomValue());
+ localY = Math.round(localY * fView.getZoomValue());
+ localWidth = Math.round(localWidth * fView.getZoomValue());
+ localHeight = Math.round(localHeight * fView.getZoomValue());
if (localWidth == 0 || localHeight == 0 || endAngle == 0) {
return;
}
public void setFont(IFont font) {
if (font.getFont() != null && ((Font) font.getFont()).getFontData().length > 0) {
FontData fontData = ((Font) font.getFont()).getFontData()[0];
- if (SDViewPref.getInstance().fontLinked() || fView.fIsPrinting) {
- int h = Math.round(fontData.getHeight() * fView.fZoomValue);
+ if (SDViewPref.getInstance().fontLinked() || fView.isPrinting()) {
+ int h = Math.round(fontData.getHeight() * fView.getZoomValue());
if (h > 0) {
fontData.setHeight(h);
}
@Override
public float getZoom() {
if (fView != null) {
- return fView.fZoomValue;
+ return fView.getZoomValue();
}
return 1;
}
fVisibleScreenBounds = vBounds;
}
+ /**
+ * Returns the graphical context.
+ *
+ * @return the graphical context
+ * @since 2.0
+ */
+ protected GC getGc() {
+ return fContext;
+ }
+
+ /**
+ * Returns the SD widget.
+ *
+ * @return the SD widget
+ * @since 2.0
+ */
+ protected SDWidget getSDWidget() {
+ return fView;
+ }
+
+ /**
+ * Returns the gradient color.
+ *
+ * @return the gradient color
+ * @since 2.0
+ */
+ protected IColor setGradientColor() {
+ return fGradientColor;
+ }
+
// ------------------------------------------------------------------------
// Helper methods
// ------------------------------------------------------------------------
*/
public class SDView extends ViewPart {
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+ /**
+ * Name of menu separator for view modes
+ * @since 2.0
+ */
+ public final static String UML2SD_VIEW_MODES_SEPARATOR = "UML2SD_VIEW_MODES"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for working set
+ * @since 2.0
+ */
+ public final static String UML2SD_WORKING_SET_SEPARATOR = "UML2SD_WORKING_SET"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for sorting
+ * @since 2.0
+ */
+ public final static String UML2SD_SORTING_SEPARATOR = "UML2SD_SORTING"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for filtering
+ * @since 2.0
+ */
+ public final static String UML2SD_FILTERING_SEPARATOR = "UML2SD_FILTERING"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for view layout
+ * @since 2.0
+ */
+ public final static String UML2SD_VIEW_LAYOUT_SEPARATOR = "UML2SD_VIEW_LAYOUT"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for link editor
+ * @since 2.0
+ */
+ public final static String UML2SD_LINK_EDITOR_SEPARATOR = "UML2SD_LINK_EDITOR"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for other commands
+ * @since 2.0
+ */
+ public final static String UML2SD_OTHER_COMMANDS_SEPARATOR = "UML2SD_OTHER_COMMANDS"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for other plug-in commands
+ * @since 2.0
+ */
+ public final static String UML2SD_OTHER_PLUGINS_COMMANDS_SEPARATOR = "UML2SD_OTHER_PLUGINS_COMMANDS"; //$NON-NLS-1$
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
/**
* The sequence diagram widget.
*/
- protected SDWidget fSdWidget = null;
+ private SDWidget fSdWidget = null;
/**
* The time compression bar.
*/
- protected TimeCompressionBar fTimeCompressionBar = null;
+ private TimeCompressionBar fTimeCompressionBar = null;
/**
* The sequence diagram find provider implementation.
*/
- protected ISDFindProvider fSdFindProvider = null;
+ private ISDFindProvider fSdFindProvider = null;
/**
* The sequence diagram paging provider implementation.
*/
- protected ISDPagingProvider fSdPagingProvider = null;
+ private ISDPagingProvider fSdPagingProvider = null;
/**
* The sequence diagram filter provider implementation.
*/
- protected ISDFilterProvider fSdFilterProvider = null;
+ private ISDFilterProvider fSdFilterProvider = null;
/**
* The extended sequence diagram filter provider implementation.
*/
- protected IExtendedFilterProvider fSdExFilterProvider = null;
+ private IExtendedFilterProvider fSdExFilterProvider = null;
/**
* The extended sequence diagram find provider implementation.
*/
- protected IExtendedFindProvider fSdExFindProvider = null;
+ private IExtendedFindProvider fSdExFindProvider = null;
/**
* The extended sequence diagram action bar provider implementation.
*/
- protected ISDExtendedActionBarProvider fSdExtendedActionBarProvider = null;
+ private ISDExtendedActionBarProvider fSdExtendedActionBarProvider = null;
/**
* The sequence diagram property provider implementation.
*/
- protected ISDPropertiesProvider fSdPropertiesProvider = null;
+ private ISDPropertiesProvider fSdPropertiesProvider = null;
/**
* Button for executing the next page action.
*/
- protected NextPage fNextPageButton = null;
+ private NextPage fNextPageButton = null;
/**
* Button for executing the previous page action.
*/
- protected PrevPage fPrevPageButton = null;
+ private PrevPage fPrevPageButton = null;
/**
* Button for executing the first page page action.
*/
- protected FirstPage fFirstPageButton = null;
+ private FirstPage fFirstPageButton = null;
/**
* Button for executing the last page action.
*/
- protected LastPage fLastPageButton = null;
+ private LastPage fLastPageButton = null;
/**
* The menu manager reference.
*/
- protected MenuManager fMenuMgr = null;
+ private MenuManager fMenuMgr = null;
/**
* Flag to indicate whether view needs initialization or not.
*/
- protected boolean fNeedInit = true;
+ private boolean fNeedInit = true;
/**
* WaitCursor is the cursor to be displayed when long tasks are running
*/
- protected Cursor fWaitCursor;
+ private Cursor fWaitCursor;
// ------------------------------------------------------------------------
// Methods
GridData seqDiagLayoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
fTimeCompressionBar = new TimeCompressionBar(parent, SWT.NONE);
fTimeCompressionBar.setLayoutData(timeLayoutdata);
- fSdWidget = new SDWidget(parent, SWT.NONE);// SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ fSdWidget = new SDWidget(parent, SWT.NONE);
fSdWidget.setLayoutData(seqDiagLayoutData);
fSdWidget.setSite(this);
fSdWidget.setTimeBar(fTimeCompressionBar);
public void setSDFilterProvider(ISDFilterProvider provider) {
fSdFilterProvider = provider;
// Both systems can be used now, commenting out next statement
- // sdExFilterProvider = null;
createCoolbarContent();
}
public void setExtendedFilterProvider(IExtendedFilterProvider provider) {
fSdExFilterProvider = provider;
// Both systems can be used now, commenting out next statement
- // sdFilterProvider = null;
createCoolbarContent();
}
return fSdPropertiesProvider;
}
+ /**
+ * Sets the sdWidget.
+ *
+ * @param sdWidget
+ * A sdWidget to set
+ * @since 2.0
+ */
+ protected void setSDWidget(SDWidget sdWidget) {
+ fSdWidget = sdWidget;
+ }
+
+ /**
+ * Sets the time compression bar.
+ *
+ * @param timeCompressionbar
+ * A sdWidget to set
+ * @since 2.0
+ */
+ protected void setTimeBar(TimeCompressionBar timeCompressionbar) {
+ fTimeCompressionBar = timeCompressionbar;
+ }
+
+ /**
+ * Sets the initialization flag.
+ *
+ * @param needInit
+ * flag value to set
+ * @since 2.0
+ */
+ protected void setNeedInit(boolean needInit) {
+ fNeedInit = needInit;
+ }
+
/**
* Creates the basic sequence diagram menu
*/
*/
protected void fillContextMenu(IMenuManager manager) {
manager.add(new Separator("Additions")); //$NON-NLS-1$
- if (getSDWidget() != null && getSDWidget().fCurrentGraphNode != null) {
+ if (getSDWidget() != null && getSDWidget().getCurrentGraphNode() != null) {
ISelectionProvider selProvider = fSdWidget.getSelectionProvider();
ISelection sel = selProvider.getSelection();
int nbMessage = 0;
if (nbMessage != 1) {
return;
}
- GraphNode node = getSDWidget().fCurrentGraphNode;
+ GraphNode node = getSDWidget().getCurrentGraphNode();
if ((node instanceof SyncMessageReturn) && (((SyncMessageReturn) node).getMessage() != null)) {
Action goToMessage = new MoveToMessage(this);
goToMessage.setText(Messages.SequenceDiagram_GoToMessage);
createMenuGroup();
Zoom resetZoom = new Zoom(this, ZoomType.ZOOM_RESET);
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", resetZoom);//$NON-NLS-1$
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", resetZoom); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, resetZoom);
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, resetZoom);
Zoom noZoom = new Zoom(this, ZoomType.ZOOM_NONE);
noZoom.setChecked(true);
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", noZoom);//$NON-NLS-1$
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", noZoom); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, noZoom);
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, noZoom);
Zoom zoomIn = new Zoom(this, ZoomType.ZOOM_IN);
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", zoomIn);//$NON-NLS-1$
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", zoomIn); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, zoomIn);
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, zoomIn);
Zoom zoomOut = new Zoom(this, ZoomType.ZOOM_OUT);
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", zoomOut);//$NON-NLS-1$
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", zoomOut); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, zoomOut);
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, zoomOut);
MenuManager navigation = new MenuManager(Messages.SequenceDiagram_Navigation);
showNodeEnd.setActionDefinitionId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeEnd");//$NON-NLS-1$
navigation.add(showNodeEnd);
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", navigation); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, navigation);
ConfigureMinMax minMax = new ConfigureMinMax(this);
minMax.setText(Messages.SequenceDiagram_ConfigureMinMax);
minMax.setId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ConfigureMinMax");//$NON-NLS-1$
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", minMax); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, minMax);
if ((fSdWidget.getFrame() != null) && (fSdWidget.getFrame().hasTimeInfo())) {
minMax.setEnabled(true);
// Do we need to display a paging item
if (fSdPagingProvider != null) {
fNextPageButton = new NextPage(this);
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", fNextPageButton); //$NON-NLS-1$
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fNextPageButton);
fNextPageButton.setEnabled(fSdPagingProvider.hasNextPage());
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", fNextPageButton); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fNextPageButton);
fPrevPageButton = new PrevPage(this);
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", fPrevPageButton); //$NON-NLS-1$
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fPrevPageButton);
fPrevPageButton.setEnabled(fSdPagingProvider.hasPrevPage());
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", fPrevPageButton); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fPrevPageButton);
fFirstPageButton = new FirstPage(this);
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", fFirstPageButton); //$NON-NLS-1$
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fFirstPageButton);
fFirstPageButton.setEnabled(fSdPagingProvider.hasPrevPage());
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", fFirstPageButton); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fFirstPageButton);
fLastPageButton = new LastPage(this);
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", fLastPageButton); //$NON-NLS-1$
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fLastPageButton);
fLastPageButton.setEnabled(fSdPagingProvider.hasNextPage());
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", fLastPageButton); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fLastPageButton);
}
if (fSdExFilterProvider != null) {
if (action.getText() == null || action.getText().length() == 0) {
action.setText(Messages.SequenceDiagram_EditFilters);
}
- bar.getMenuManager().prependToGroup("UML2SD_FILTERING", action); //$NON-NLS-1$
- bar.getToolBarManager().prependToGroup("UML2SD_FILTERING", action); //$NON-NLS-1$
+ bar.getMenuManager().prependToGroup(UML2SD_FILTERING_SEPARATOR, action);
+ bar.getToolBarManager().prependToGroup(UML2SD_FILTERING_SEPARATOR, action);
}
}
// Both systems can be used now: commenting out else keyword
- /* else */if (fSdFilterProvider != null) {
- bar.getMenuManager().appendToGroup("UML2SD_FILTERING", new OpenSDFiltersDialog(this, fSdFilterProvider)); //$NON-NLS-1$
- // No longer in the coolbar: commenting out next statement
- //bar.getToolBarManager().appendToGroup("UML2SD_FILTERING",new OpenSDFiltersDialog(this, sdFilterProvider)); //$NON-NLS-1$
+ if (fSdFilterProvider != null) {
+ bar.getMenuManager().appendToGroup(UML2SD_FILTERING_SEPARATOR, new OpenSDFiltersDialog(this, fSdFilterProvider));
}
if (fSdPagingProvider instanceof ISDAdvancedPagingProvider) {
IContributionItem sdPaging = bar.getMenuManager().find(OpenSDPagesDialog.ID);
bar.getMenuManager().remove(sdPaging);
sdPaging = null;
}
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", new OpenSDPagesDialog(this, (ISDAdvancedPagingProvider) fSdPagingProvider)); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, new OpenSDPagesDialog(this, (ISDAdvancedPagingProvider) fSdPagingProvider));
updatePagesMenuItem(bar);
}
if (action.getText() == null) {
action.setText(Messages.SequenceDiagram_Find + "..."); //$NON-NLS-1$
}
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", action); //$NON-NLS-1$
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", action); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, action);
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, action);
}
} else if (fSdFindProvider != null) {
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", new OpenSDFindDialog(this)); //$NON-NLS-1$
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", new OpenSDFindDialog(this)); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, new OpenSDFindDialog(this));
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, new OpenSDFindDialog(this));
}
if (fSdExtendedActionBarProvider != null) {
return null;
}
+ /**
+ * Gets the initialization flag.
+ * @return the value of the initialization flag.
+ * @since 2.0
+ */
+ private boolean isNeedInit() {
+ return fNeedInit;
+ }
+
/**
* Restores the loader for the view based on the view ID.
*
*/
protected boolean restoreLoader() {
String id = getViewSite().getId();
- // System.err.println("restoreLoader() id="+id);
if (id == null) {
return true;
}
IUml2SDLoader loader = LoadersManager.getInstance().getCurrentLoader(id, this);
- // System.err.println("restoreLoader() l="+l);
- if ((loader != null)) {// &&( LoadersManager.getLoadersManager().getViewer(l)==this)){
+ if ((loader != null)) {
loader.setViewer(this);
return false;
}
if (bar == null) {
return;
}
- bar.getToolBarManager().add(new Separator("UML2SD_VIEW_MODES")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_WORKING_SET")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_SORTING")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_FILTERING")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_VIEW_LAYOUT")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_LINK_EDITOR")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_OTHER_COMMANDS")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_OTHER_PLUGINS_COMMANDS")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_VIEW_MODES")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_WORKING_SET")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_SORTING")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_FILTERING")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_VIEW_LAYOUT")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_LINK_EDITOR")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_OTHER_COMMANDS")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_OTHER_PLUGINS_COMMANDS")); //$NON-NLS-1$
+ bar.getToolBarManager().add(new Separator(UML2SD_VIEW_MODES_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_WORKING_SET_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_SORTING_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_FILTERING_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_VIEW_LAYOUT_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_LINK_EDITOR_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_OTHER_COMMANDS_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_OTHER_PLUGINS_COMMANDS_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_VIEW_MODES_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_WORKING_SET_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_SORTING_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_FILTERING_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_VIEW_LAYOUT_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_LINK_EDITOR_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_OTHER_COMMANDS_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_OTHER_PLUGINS_COMMANDS_SEPARATOR));
}
@Override
/**
* The frame to display in the sequence diagram widget.
*/
- protected Frame fFrame;
+ private Frame fFrame;
/**
* The overview image to display.
*/
- protected Image fOverView = null;
+ private Image fOverView = null;
/**
* The zoom in menu item.
*/
- protected MenuItem fZoomIn = null;
+ private MenuItem fZoomIn = null;
/**
* The zoom out menu item.
*/
- protected MenuItem fZoomOut = null;
+ private MenuItem fZoomOut = null;
/**
* The sequence diagram selection provider.
*/
- protected SDWidgetSelectionProvider fSelProvider = null;
+ private SDWidgetSelectionProvider fSelProvider = null;
/**
* The current zoom value.
*/
- public float fZoomValue = 1;
+ private float fZoomValue = 1;
/**
* The current zoomInMode (true for zoom in).
*/
- protected boolean fZoomInMode = false;
+ private boolean fZoomInMode = false;
/**
* The current zoomOutMode (true for zoom out).
*/
- protected boolean fZoomOutMode = false;
+ private boolean fZoomOutMode = false;
/**
* The current list of selected graph nodes.
*/
- protected List<GraphNode> fSelectedNodeList = null;
+ private List<GraphNode> fSelectedNodeList = null;
/**
* Flag whether ctrl button is selected or not.
*/
- protected boolean fCtrlSelection = false;
+ private boolean fCtrlSelection = false;
/**
* A reference to the view site.
*/
- protected ViewPart fSite = null;
+ private ViewPart fSite = null;
/**
* The current graph node (the last selected one).
*/
- public GraphNode fCurrentGraphNode = null;
+ private GraphNode fCurrentGraphNode = null;
/**
* The first graph node in list (multiple selection).
*/
- public GraphNode fListStart = null;
+ private GraphNode fListStart = null;
/**
* The previous graph node (multiple selection).
*/
- public List<GraphNode> fPrevList = null;
+ private List<GraphNode> fPrevList = null;
/**
* The time compression bar.
*/
- protected TimeCompressionBar fTimeBar = null;
+ private TimeCompressionBar fTimeBar = null;
/**
* The current diagram tool tip.
*/
- protected DiagramToolTip fToolTip = null;
+ private DiagramToolTip fToolTip = null;
/**
* The accessible object reference of view control.
*/
- protected Accessible fAccessible = null;
+ private Accessible fAccessible = null;
/**
* The current node for the tooltip to display.
*/
- protected GraphNode fToolTipNode;
+ private GraphNode fToolTipNode;
/**
* The life line to drag and drop.
*/
- protected Lifeline fDragAndDrop = null;
+ private Lifeline fDragAndDrop = null;
/**
* The number of focused widgets.
*/
- protected int fFocusedWidget = -1;
+ private int fFocusedWidget = -1;
/**
* The printer zoom.
*/
- protected float fPrinterZoom = 0;
+ private float fPrinterZoom = 0;
/**
* Y coordinate for printer.
*/
- protected int fPrinterY = 0;
+ private int fPrinterY = 0;
/**
* X coordinate for printer.
*/
- protected int fPrinterX = 0;
+ private int fPrinterX = 0;
/**
* Flag whether drag and drop is enabled or not.
*/
- protected boolean fIsDragAndDrop = false;
+ private boolean fIsDragAndDrop = false;
/**
* The x coordinate for drag.
*/
- protected int fDragX = 0;
+ private int fDragX = 0;
/**
* The y coordinate for drag.
*/
- protected int fDragY = 0;
+ private int fDragY = 0;
/**
* The reorder mode.
*/
- protected boolean fReorderMode = false;
+ private boolean fReorderMode = false;
/**
* The collapse caret image.
*/
- protected Image fCollapaseCaretImg = null;
+ private Image fCollapaseCaretImg = null;
/**
* The arrow up caret image.
*/
- protected Image fArrowUpCaretImg = null;
+ private Image fArrowUpCaretImg = null;
/**
* The current caret image.
*/
- protected Image fCurrentCaretImage = null;
+ private Image fCurrentCaretImage = null;
/**
* A sequence diagramm collapse provider (for collapsing graph nodes)
*/
- protected ISDCollapseProvider fCollapseProvider = null;
+ private ISDCollapseProvider fCollapseProvider = null;
/**
* The insertion caret.
*/
- protected Caret fInsertionCartet = null;
+ private Caret fInsertionCartet = null;
/**
* The reorder list when in reorder mode.
*/
- protected List<Lifeline[]> fReorderList = null;
+ private List<Lifeline[]> fReorderList = null;
/**
* Flag to specify whether in printing mode or not.
*/
- protected boolean fIsPrinting = false;
+ private boolean fIsPrinting = false;
/**
* A printer reference.
*/
- protected Printer fPrinter = null;
+ private Printer fPrinter = null;
/**
* Flag whether shift was selected or not.
*/
- protected boolean fShiftSelection = false;
+ private boolean fShiftSelection = false;
/**
* The scroll tooltip.
*/
- protected DiagramToolTip fScrollToolTip = null;
+ private DiagramToolTip fScrollToolTip = null;
/**
* Timer for auto_scroll feature
*/
- protected AutoScroll fLocalAutoScroll = null;
+ private AutoScroll fLocalAutoScroll = null;
/**
* TimerTask for auto_scroll feature !=null when auto scroll is running
*/
- protected Timer fLocalAutoScrollTimer = null;
+ private Timer fLocalAutoScrollTimer = null;
// ------------------------------------------------------------------------
// Constructor
* @param list of graph nodes
*/
public void addSelection(List<GraphNode> list) {
- // selectedNodeList.addAll(list);
for (int i = 0; i < list.size(); i++) {
if (!fSelectedNodeList.contains(list.get(i))) {
fSelectedNodeList.add(list.get(i));
* Sets the zoom out mode.
*
* @param value
- * The mode value to set.
+ * The mode value to set.
*/
public void setZoomOutMode(boolean value) {
if (value) {
fZoomOutMode = value;
}
+ /**
+ * Sets the current zoom value.
+ *
+ * @param zoomValue
+ * The current zoom value
+ * @since 2.0
+ */
+ public void setZoomValue(float zoomValue) {
+ fZoomValue = zoomValue;
+ }
+
/**
* Moves the Sequence diagram to ensure the given node is visible and draw it selected
*
return fIsPrinting;
}
+ /**
+ * Returns the current graph node.
+ *
+ * @return the current graph node
+ * @since 2.0
+ */
+ public GraphNode getCurrentGraphNode() {
+ return fCurrentGraphNode;
+ }
+
+ /**
+ * Returns the current zoom value.
+ *
+ * @return the current zoom value
+ * @since 2.0
+ */
+ public float getZoomValue() {
+ return fZoomValue;
+ }
+
+ /**
+ * Gets the zoom in mode.
+ *
+ * @return the mode value to set.
+ * @since 2.0
+ */
+ public boolean getZoomInMode() {
+ return fZoomInMode;
+ }
+
+
+ /**
+ * Gets the zoom out mode.
+ *
+ * @return the mode value to set.
+ * @since 2.0
+ */
+ public boolean getZoomOutMode() {
+ return fZoomOutMode;
+ }
+
+ /**
+ * Returns if ctrl selection
+ * @return true if ctrl selection else false
+ * @since 2.0
+ */
+ public boolean isCtrlSelection() {
+ return fCtrlSelection;
+ }
+
+ /**
+ * Returns if shift selection
+ * @return true if shift Selection else false
+ * @since 2.0
+ */
+ public boolean isShiftSelection() {
+ return fCtrlSelection;
+ }
+
/**
* Gets the overview image.
*
if (selectedNode instanceof BaseMessage) {
node = fFrame.getNextLifelineMessage(((BaseMessage) selectedNode).getStartLifeline(), (BaseMessage) selectedNode);
} else if (selectedNode instanceof Lifeline) {
- // node = frame.getNextLifelineMessage((Lifeline)selectedNode,null);
node = fFrame.getFirstExecution((Lifeline) selectedNode);
} else if (selectedNode instanceof BasicExecutionOccurrence) {
node = fFrame.getNextExecOccurrence((BasicExecutionOccurrence) selectedNode);
fPrinter.startJob(jobName);
GC gc = new GC(fPrinter);
-// Frame.setUserPref(SDViewPref.getInstance());
float lastZoom = fZoomValue;
String currentPageNum = String.valueOf(pageNum);
int ii = context.textExtent(currentPageNum);
int jj = context.getCurrentFontHeight();
- // context.setBackground(ColorImpl.getSystemColor(SWT.COLOR_BLACK));
- // context.setForeground(ColorImpl.getSystemColor(SWT.COLOR_WHITE));
fZoomValue = fPrinterZoom * lastZoom;
context.drawText(currentPageNum, Math.round(fPrinterX + getVisibleWidth() / fPrinterZoom - ii / fPrinterZoom), Math.round(fPrinterY + getVisibleHeight() / fPrinterZoom - jj / fPrinterZoom), false);
fIsPrinting = false;
protected void contentsMouseMoveEvent(MouseEvent e) {
fScrollToolTip.hideToolTip();
fToolTip.hideToolTip();
- // super.contentsMouseMoveEvent(e);
if (!(isFocusControl() || getViewControl().isFocusControl())) {
Control[] child = getParent().getChildren();
for (int i = 0; i < child.length; i++) {
}
// redraw also resize the scrollView content
redraw();
- } else {// if (event.button ==1)
+ } else {
GraphNode node = null;
int x = Math.round(event.x / fZoomValue);
int y = Math.round(event.y / fZoomValue);
gc.dispose();
return;
}
- // Frame.setUserPref(SDViewPref.getInstance());
SDViewPref.getInstance();
Rectangle area = getClientArea();
/**
* The listener list
*/
- protected List<ISelectionChangedListener> fListenerList = null;
+ private List<ISelectionChangedListener> fListenerList = null;
/**
* The current selection
*/
- protected ISelection fCurrentSelection = null;
+ private ISelection fCurrentSelection = null;
// ------------------------------------------------------------------------
// Constructor
// Attributes
// ------------------------------------------------------------------------
- // Value for scroll bar mode, default is AUTO
/**
* Scroll bar mode AUTO
*/
/**
* Value of the contents height property.
*/
- protected int fContentsHeight = 0;
+ private int fContentsHeight = 0;
/**
* Value of the contents width property.
*/
- protected int fContentsWidth = 0;
+ private int fContentsWidth = 0;
/**
* Value of the contents x coordinate property
*/
- protected int fContentsX = 0;
+ private int fContentsX = 0;
/**
* Value of the contents y coordinate property
*/
- protected int fContentsY = 0;
+ private int fContentsY = 0;
/**
* Scroll bar mode of horizontal scroll bar.
*/
- protected int fHorScrollbarMode = AUTO;
+ private int fHorScrollbarMode = AUTO;
/**
* Scroll bar mode of vertical scroll bar.
*/
- protected int fVertScrollbarMode = AUTO;
+ private int fVertScrollbarMode = AUTO;
/**
* Increment for the horizontal scroll bar.
*/
- protected int fHorScrollbarIncrement = 10;
+ private int fHorScrollbarIncrement = 10;
/**
* Increment for the vertical scroll bar.
*/
- protected int fVertScrollbarIncrement = 10;
+ private int fVertScrollbarIncrement = 10;
/**
* Flag whether auto scroll is enabled or not.
*/
- protected boolean fAutoScrollEnabled = true;
+ private boolean fAutoScrollEnabled = true;
/**
* Value of the auto scroll period.
*/
- protected int fAutoScrollPeriod = 75;
+ private int fAutoScrollPeriod = 75;
/**
* The local paint listener reference.
*/
- protected PaintListener fLocalPaintListener = null;
+ private PaintListener fLocalPaintListener = null;
/**
* The local mouse move listener reference.
*/
- protected MouseMoveListener fLocalMouseMoveListener = null;
+ private MouseMoveListener fLocalMouseMoveListener = null;
/**
* The local mouse listener reference.
*/
- protected MouseListener fLocalMouseListener = null;
+ private MouseListener fLocalMouseListener = null;
/**
* The local control listener reference.
*/
- protected ControlListener fLocalControlListener = null;
+ private ControlListener fLocalControlListener = null;
/**
* The local key listener reference.
*/
- protected KeyListener fLocalKeyListener = null;
+ private KeyListener fLocalKeyListener = null;
// Canvas for vertical/horizontal Scroll Bar only ... because new ScrollBar() does works.
/**
* Canvas for horizontal scroll bar.
*/
- protected Canvas fHorScrollBar;
+ private Canvas fHorScrollBar;
/**
* Canvas for vertical scroll bar.
*/
- protected Canvas fVertScrollBar;
+ private Canvas fVertScrollBar;
/**
* Canvas for the view control.
*/
- protected Canvas fViewControl;
+ private Canvas fViewControl;
/**
* Control used in the bottom right corner @see setCornerControl() and @see setOverviewEnabled(true)
*/
- protected Control fCornerControl;
+ private Control fCornerControl;
/**
* Size of overview widget.
*/
- protected int fOverviewSize = 100; // default size for overview
+ private int fOverviewSize = 100; // default size for overview
/**
* Timer for auto_scroll feature
*/
- protected AutoScroll fAutoScroll = null;
+ private AutoScroll fAutoScroll = null;
/**
* TimerTask for auto_scroll feature !=null when auto scroll is running
*/
- protected Timer fAutoScrollTimer = null;
+ private Timer fAutoScrollTimer = null;
/**
* where mouse down appear on contents area (x coordinate)
*/
- protected int fMouseDownX = -1;
+ private int fMouseDownX = -1;
/**
* where mouse down appear on contents area (y coordinate)
*/
- protected int fMousDownY = -1;
-
+ private int fMousDownY = -1;
// ------------------------------------------------------------------------
// Constructors
* @param mouseWheel Flag to force scrollView to handles mouse wheel
*/
public ScrollView(Composite c, int style, boolean mouseWheel) {
- super(c, SWT.NONE); // style&(~(SWT.H_SCROLL|SWT.V_SCROLL)));
+ super(c, SWT.NONE);
fHorScrollBar = new Canvas(this, SWT.H_SCROLL);
if (mouseWheel) {
fViewControl.getHorizontalBar().setVisible(false);
}
fVertScrollBar = new Canvas(this, SWT.V_SCROLL);
- // make fVerScrollBar able to receive mouse wheel
- // does not help as we can't set a MouseListener on fVerScrollBar.getVerticalBar()
- // to set focus on viewcontrol_
- // fVerScrollBar.addKeyListener( new KeyAdapter() {});
setLayout(new SVLayout());
@Override
public void mouseDown(MouseEvent e) {
int ox = e.x, oy = e.y;
- e.x = fMouseDownX = viewToContentsX(e.x);
- e.y = fMousDownY = viewToContentsY(e.y);
+ e.x = viewToContentsX(e.x);
+ fMouseDownX = e.x;
+ e.y = viewToContentsY(e.y);
+ fMousDownY = e.y;
contentsMouseDownEvent(e);
e.x = ox;
e.y = oy;
contentsMouseUpEvent(e);
e.x = ox;
e.y = oy;
- // here because class extenting me can catch mouse Up and want to scroll...
- fMouseDownX = fMousDownY = -1;
+ // here because class extending me can catch mouse Up and want to scroll...
+ fMouseDownX = -1;
+ fMousDownY = -1;
}
};
fViewControl.addMouseListener(fLocalMouseListener);
protected static class AutoScroll extends TimerTask {
/** X delta */
- public int deltaX;
+ private int deltaX;
/** Y delta */
- public int deltaY;
+ private int deltaY;
/** ScrollView object */
- public ScrollView scrollView;
+ private ScrollView scrollView;
/**
* Constructor.
int sx = 0, sy = 0;
- int v_right = getContentsX() + getVisibleWidth();
- int v_bottom = getContentsY() + getVisibleHeight();
+ int vRight = getContentsX() + getVisibleWidth();
+ int vBottom = getContentsY() + getVisibleHeight();
// auto scroll... ?
if (event.x < getContentsX()) {
sx = (getContentsX() - event.x);
fMouseDownX = getContentsX();
- } else if (event.x > v_right) {
- sx = -event.x + v_right;
- fMouseDownX = v_right;
+ } else if (event.x > vRight) {
+ sx = -event.x + vRight;
+ fMouseDownX = vRight;
}
if (event.y < getContentsY()) {
sy = (getContentsY() - event.y);
fMousDownY = getContentsY();
- } else if (event.y > v_bottom) {
- sy = -event.y + v_bottom;
- fMousDownY = v_bottom;
+ } else if (event.y > vBottom) {
+ sy = -event.y + vBottom;
+ fMousDownY = vBottom;
}
if (sx != 0 || sy != 0) {
oldW = s;
}
- int vis_width = getVisibleWidth();
- int vis_height = getVisibleHeight();
- if (oldW < vis_width) {
- if (localWidth > vis_width) {
- localWidth = vis_width;
+ int visWidth = getVisibleWidth();
+ int visHeight = getVisibleHeight();
+ if (oldW < visWidth) {
+ if (localWidth > visWidth) {
+ localWidth = visWidth;
}
- fViewControl.redraw(getContentsX() + oldW, 0, localWidth - oldW, vis_height, true);
+ fViewControl.redraw(getContentsX() + oldW, 0, localWidth - oldW, visHeight, true);
}
if (oldH > localHeight) {
oldH = s;
}
- if (oldH < vis_height) {
- if (localHeight > vis_height) {
- localHeight = vis_height;
+ if (oldH < visHeight) {
+ if (localHeight > visHeight) {
+ localHeight = visHeight;
}
- fViewControl.redraw(0, getContentsY() + oldH, vis_width, localHeight - oldH, true);
+ fViewControl.redraw(0, getContentsY() + oldH, visWidth, localHeight - oldH, true);
}
if (updateScrollBarVisiblity()) {
layout();
int cy = getContentsY();
int right = getContentsX() + getVisibleWidth() - vbar;
int bottom = getContentsY() + getVisibleHeight() - hbar;
- boolean align_h = false, align_v = false;
+ boolean alignH = false, alignV = false;
if (localX < getContentsX()) {
cx = localX;
}
if (localWidth > getVisibleWidth()) {
- align_h = true;
+ alignH = true;
}
if (localHeight > getVisibleHeight()) {
- align_v = true;
+ alignV = true;
}
// compute alignment on visible area horizontally
- if (align_h || (forceAlign && localX + localWidth > right)) {
+ if (alignH || (forceAlign && localX + localWidth > right)) {
// use align flags
if ((align & SWT.LEFT) != 0) {
cx = localX;
}
}
// compute alignment on visible area vertically
- if (align_v || (forceAlign && localY + localHeight > bottom)) {
+ if (alignV || (forceAlign && localY + localHeight > bottom)) {
// use align flags
if ((align & SWT.TOP) != 0) {
cy = localY;
@Override
public Rectangle computeTrim(int x, int y, int w, int h) {
Rectangle r = new Rectangle(x, y, w, h);
- int bar_vis = computeBarVisibility(w, h, false, false);
- if ((bar_vis & VBAR) != 0) {
+ int barVis = computeBarVisibility(w, h, false, false);
+ if ((barVis & VBAR) != 0) {
r.width += getVerticalBarWidth();
}
- if ((bar_vis & HBAR) != 0) {
+ if ((barVis & HBAR) != 0) {
r.height += getHorizontalBarHeight();
}
return r;
* Internal layout for ScrollView, handle scrollbars, drawzone and corner control
*/
protected class SVLayout extends Layout {
+
+ private final static int DEFAULT_X = 250;
+ private final static int DEFAULT_Y = 250;
+ private final static int MAX_SEEK = 10;
+ private final static int MIN_SEEK = 0;
+
/**
* The seek value
*/
- int seek = 0;
+ private int seek = 0;
/**
* The do-it-not flag
*/
- boolean dontLayout = false;
+ private boolean dontLayout = false;
@Override
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
- Point p = new Point(250, 250);
+ Point p = new Point(DEFAULT_X, DEFAULT_Y);
if (fContentsWidth < p.x) {
p.x = fContentsWidth;
}
return;
}
seek++;
- if (seek > 10) {
+ if (seek > MAX_SEEK) {
dontLayout = true;
}
Point cs = composite.getSize();
- int bar_vis = computeBarVisibility(cs.x, cs.y, false, false);
- boolean vb_vis = (bar_vis & VBAR) != 0;
- boolean hb_vis = (bar_vis & HBAR) != 0;
- fVertScrollBar.setVisible(vb_vis);
- fHorScrollBar.setVisible(hb_vis);
+ int barVis = computeBarVisibility(cs.x, cs.y, false, false);
+ boolean vbVis = (barVis & VBAR) != 0;
+ boolean hbVis = (barVis & HBAR) != 0;
+ fVertScrollBar.setVisible(vbVis);
+ fHorScrollBar.setVisible(hbVis);
int vbw = getVerticalBarWidth();
int hbh = getHorizontalBarHeight();
- int wb = vb_vis ? vbw : 0;
- int hb = hb_vis ? hbh : 0;
+ int wb = vbVis ? vbw : 0;
+ int hb = hbVis ? hbh : 0;
int cww = 0, cwh = 0;
- if (fCornerControl != null && (vb_vis || hb_vis)) { // corner_control_.getVisible())
+ if (fCornerControl != null && (vbVis || hbVis)) { // corner_control_.getVisible())
fCornerControl.setVisible(true);
cww = vbw;
cwh = hbh;
if (hb == 0) {
hb = hbh;
}
- } else if (vb_vis && hb_vis) {
+ } else if (vbVis && hbVis) {
if (fCornerControl != null) {
fCornerControl.setVisible(false);
}
cww = vbw;
cwh = hbh;
}
- if (vb_vis || hb_vis) {
+ if (vbVis || hbVis) {
updateScrollBarsValues();
}
- int vw = cs.x - (vb_vis ? vbw : 0);
- int vh = cs.y - (hb_vis ? hbh : 0);
+ int vw = cs.x - (vbVis ? vbw : 0);
+ int vh = cs.y - (hbVis ? hbh : 0);
int vbx = cs.x - wb;
int hby = cs.y - hb;
fViewControl.setBounds(0, 0, vw, vh);
- if (vb_vis) {
+ if (vbVis) {
fVertScrollBar.setBounds(vbx, 0, wb, cs.y - cwh);
}
- if (hb_vis) {
+ if (hbVis) {
fHorScrollBar.setBounds(0, hby, cs.x - cww, hb);
}
if (fCornerControl != null && fCornerControl.getVisible()) {
updateScrollBarsValues();
seek--;
- if (seek == 0) {
+ if (seek == MIN_SEEK) {
dontLayout = false;
}
}
+
+ boolean isDontLayout() {
+ return dontLayout;
+ }
+
+ void setSontLayout(boolean dontLayout) {
+ this.dontLayout = dontLayout;
+ }
}
// static must take place here... cursor is created once.
- volatile static Cursor fOverviewCursor;
+ private volatile static Cursor fOverviewCursor;
/** Support for click-and-see overview shell on this ScrollView */
protected class Overview {
+ private final static int REFRESH_FREQ = 4;
+
/**
* factor for X from real and overview sizes, for mouse move speed.
*/
- protected float fOverviewFactorX;
+ private float fOverviewFactorX;
/**
* factor for Y from real and overview sizes, for mouse move speed.
*/
- protected float fOverviewFactorY;
+ private float fOverviewFactorY;
/**
* shell use to show overview
*/
- protected Shell fOverview;
+ private Shell fOverview;
/**
* save mouse X cursor location for disappear();
*/
- protected int fSaveCursorX;
+ private int fSaveCursorX;
/**
* save mouse Y cursor location for disappear();
*/
- protected int fSaveCursorY;
+ private int fSaveCursorY;
/**
* Apply overview support on a control. Replace existing corner_widget
public void mouseMove(MouseEvent event) {
if (overviewing()) {
// Slow down the refresh
- if (refReshCount % 4 == 0) {
+ if (refReshCount % REFRESH_FREQ == 0) {
overviewMove(event);
}
refReshCount++;
});
}
// always the same..
- // overview.setBackground( viewcontrol_.getBackground() );
fOverview.setForeground(fViewControl.getForeground());
// get location of shell (in screeen coordinates)
int x = p.x;
int y = p.y;
int w, h;
- w = h = fOverviewSize;
+ h = fOverviewSize;
+ w = h;
Rectangle scr = getDisplay().getBounds();
Point ccs = fCornerControl.getSize();
try {
}
// try pop-up on button, extending to bottom right,
- // if outside screen, extend pop-up to top left
- // if( x+w > scr.width ) x = scr.width-w; //x += corner_control_.getSize().x-w;
- // if( y+h > scr.height ) y = scr.height-h;//y += corner_control_.getSize().y-h;
if (x <= 0) {
x = 1;
}
Point p = new Point(x, y);
for (Control c = loc; c != null; c = c.getParent()) {
// control might have client area with 'decorations'
- int trim_x = 0, trim_y = 0;
+ int trimX = 0, trimY = 0;
// other kind of widget with trimming ??
if (c instanceof Scrollable) {
Scrollable s = (Scrollable) c;
Rectangle rr = s.getClientArea();
Rectangle tr = s.computeTrim(rr.x, rr.y, rr.width, rr.height);
- trim_x = rr.x - tr.x;
- trim_y = rr.y - tr.y;
+ trimX = rr.x - tr.x;
+ trimY = rr.y - tr.y;
}
- p.x += c.getLocation().x + trim_x;
- p.y += c.getLocation().y + trim_y;
+ p.x += c.getLocation().x + trimX;
+ p.y += c.getLocation().y + trimY;
}
return p;
}
/**
* The listener list
*/
- protected List<ITimeCompressionListener> fListenerList = null;
+ private List<ITimeCompressionListener> fListenerList = null;
/**
* The current frame displayed.
*/
- protected Frame fFrame = null;
+ private Frame fFrame = null;
/**
* List of time events.
*/
- protected List<SDTimeEvent> fNodeList = null;
+ private List<SDTimeEvent> fNodeList = null;
/**
* The minimum time delta.
*/
- protected ITmfTimestamp fMinTime = new TmfTimestamp();
+ private ITmfTimestamp fMinTime = new TmfTimestamp();
/**
* The maximum time delta.
*/
- protected ITmfTimestamp fMaxTime = new TmfTimestamp();
+ private ITmfTimestamp fMaxTime = new TmfTimestamp();
/**
* The current zoom value.
*/
- protected float fZoomValue = 1;
+ private float fZoomValue = 1;
/**
* The tooltip to display.
*/
- protected DrawableToolTip fTooltip = null;
+ private DrawableToolTip fTooltip = null;
/**
* Array of colors for displaying wight of time deltas.
*/
- protected ColorImpl[] fColors;
+ private ColorImpl[] fColors;
/**
* The accessible object reference.
*/
- protected Accessible fAccessible = null;
+ private Accessible fAccessible = null;
/**
* The focused widget reference.
*/
- protected int fFocusedWidget = -1;
- /**
- * The sequence diagram view reference.
- */
- protected SDView view = null;
+ private int fFocusedWidget = -1;
/**
* The current lifeline.
*/
- protected Lifeline fLifeline = null;
+ private Lifeline fLifeline = null;
/**
* The current start event value.
*/
- protected int fLifelineStart = 0;
+ private int fLifelineStart = 0;
/**
* The current number of events.
*/
- protected int fLifelineNumEvents = 0;
+ private int fLifelineNumEvents = 0;
/**
* The Current color of range to display.
*/
- protected IColor fLifelineColor = null;
+ private IColor fLifelineColor = null;
/**
* The next graph node y coordinate.
*/
- protected int fNextNodeY = 0;
+ private int fNextNodeY = 0;
/**
* The previous graph node y coordinate.
*/
- protected int fPrevNodeY = 0;
+ private int fPrevNodeY = 0;
// ------------------------------------------------------------------------
// Constructors
/**
* Flag whether message has time information or not.
*/
- protected boolean fHasTime = false;
+ private boolean fHasTime = false;
/**
* The time when the message begin
*/
- protected ITmfTimestamp fEndTime = new TmfTimestamp();
+ private ITmfTimestamp fEndTime = new TmfTimestamp();
/**
* The time when the message end
*/
- protected ITmfTimestamp fStartTime = new TmfTimestamp();
+ private ITmfTimestamp fStartTime = new TmfTimestamp();
/**
* The associated message.
*/
* Default constructor
*/
public AsyncMessage() {
- fPrefId = ISDPreferences.PREF_ASYNC_MESS;
+ setColorPrefId(ISDPreferences.PREF_ASYNC_MESS);
}
// ------------------------------------------------------------------------
public int getX() {
int x = super.getX(true);
int activationWidth = Metrics.EXECUTION_OCCURRENCE_WIDTH / 2;
- if ((fStartLifeline != null) && (fEndLifeline != null) && (fStartLifeline.getX() > fEndLifeline.getX())) {
+ if ((getStartLifeline() != null) && (getEndLifeline() != null) && (getStartLifeline().getX() > getEndLifeline().getX())) {
activationWidth = -activationWidth;
}
- if (isMessageStartInActivation(fStartEventOccurrence)) {
+ if (isMessageStartInActivation(getStartOccurrence())) {
x = x + activationWidth;
}
return x;
@Override
public int getY() {
- if ((fStartLifeline != null) && (fEndLifeline != null)) {
- return fEndLifeline.getY() + fEndLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fStartEventOccurrence;
+ if ((getStartLifeline() != null) && (getEndLifeline() != null)) {
+ return getEndLifeline().getY() + getEndLifeline().getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * getStartOccurrence();
}
return super.getY();
}
public int getWidth() {
int width = super.getWidth(true);
int activationWidth = Metrics.EXECUTION_OCCURRENCE_WIDTH / 2;
- if ((fStartLifeline != null) && (fEndLifeline != null) && (fStartLifeline.getX() > fEndLifeline.getX())) {
+ if ((getStartLifeline() != null) && (getEndLifeline() != null) && (getStartLifeline().getX() > getEndLifeline().getX())) {
activationWidth = -activationWidth;
}
- if (isMessageStartInActivation(fStartEventOccurrence)) {
+ if (isMessageStartInActivation(getStartOccurrence())) {
width = width - activationWidth;
}
- if (isMessageEndInActivation(fEndEventOccurrence)) {
+ if (isMessageEndInActivation(getEndOccurrence())) {
width = width - activationWidth;
}
@Override
public int getHeight() {
- if ((fStartLifeline != null) && (fEndLifeline != null)) {
- return (fEndLifeline.getY() + fEndLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEndEventOccurrence) - getY();
+ if ((getStartLifeline() != null) && (getEndLifeline() != null)) {
+ return (getEndLifeline().getY() + getEndLifeline().getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * getEndOccurrence()) - getY();
}
return super.getHeight();
}
*
* @param occurrence the event occurrence to set
*/
+ @Override
public void setEndOccurrence(int occurrence) {
- fEndEventOccurrence = occurrence;
+ super.setEndOccurrence(occurrence);
if (getStartLifeline() == null) {
- fStartEventOccurrence = occurrence;
+ setStartOccurrence(occurrence);
}
informFrame(getEndLifeline(), occurrence);
}
*
* @param occurrence the event occurrence to set
*/
+ @Override
public void setStartOccurrence(int occurrence) {
- fStartEventOccurrence = occurrence;
+ super.setStartOccurrence(occurrence);
if (getEndLifeline() == null) {
- fEndEventOccurrence = fStartEventOccurrence;
+ setEndOccurrence(getStartOccurrence());
}
informFrame(getStartLifeline(), occurrence);
}
super.setStartLifeline(lifeline);
setStartOccurrence(getStartLifeline().getEventOccurrence());
if (getEndLifeline() == null) {
- fEndEventOccurrence = fStartEventOccurrence;
+ setEndOccurrence(getStartOccurrence());
}
}
@Override
public boolean contains(int x, int y) {
// Is it a self message?
- if (fStartLifeline == fEndLifeline) {
+ if (getStartLifeline() == getEndLifeline()) {
return super.contains(x, y);
}
if (isNearSegment(getX(), getY(), getX() + getWidth(), getY() + getHeight(), x, y)) {
* @param context A graphical context to draw in.
*/
protected void drawAsyncMessage(IGC context) {
- if (fStartLifeline != null && fEndLifeline != null && fStartLifeline == fEndLifeline && (fStartEventOccurrence != fEndEventOccurrence)) {
+ if (getStartLifeline() != null && getEndLifeline() != null && getStartLifeline() == getEndLifeline() && (getStartOccurrence() != getEndOccurrence())) {
int x = getX();
int y = getY();
int height = getHeight();
int tempx = 0;
- boolean startInActivation = isMessageStartInActivation(fStartEventOccurrence);
- boolean endInActivation = isMessageEndInActivation(fEndEventOccurrence);
+ boolean startInActivation = isMessageStartInActivation(getStartOccurrence());
+ boolean endInActivation = isMessageEndInActivation(getEndOccurrence());
if (endInActivation && !startInActivation) {
tempx = Metrics.EXECUTION_OCCURRENCE_WIDTH / 2;
ISDPreferences pref = SDViewPref.getInstance();
// Draw it selected?
- if (isSelected() && (fStartLifeline != null && fEndLifeline != null && fStartLifeline == fEndLifeline && (fStartEventOccurrence != fEndEventOccurrence))) {
+ if (isSelected() && (getStartLifeline() != null && getEndLifeline() != null && getStartLifeline() == getEndLifeline() && (getStartOccurrence() != getEndOccurrence()))) {
/*
* Draw it twice First time, bigger inverting selection colors Second time, regular drawing using selection
* colors This create the highlight effect
context.setForeground(pref.getForeGroundColorSelection());
// Second drawing is done after the else
} else {
- context.setBackground(pref.getBackGroundColor(fPrefId));
- context.setForeground(pref.getForeGroundColor(fPrefId));
+ context.setBackground(pref.getBackGroundColor(getColorPrefId()));
+ context.setForeground(pref.getForeGroundColor(getColorPrefId()));
}
if (hasFocus()) {
context.setDrawTextWithFocusStyle(true);
return fHasTime;
}
+ /**
+ * @return message return instance or null
+ * @since 2.0
+ */
+ public AsyncMessageReturn getMessageReturn() {
+ return fMessageReturn;
+ }
+
@Override
public boolean isVisible(int x, int y, int width, int height) {
int toDrawY = getY();
* Default constructor.
*/
public AsyncMessageReturn() {
- fPrefId = ISDPreferences.PREF_ASYNC_MESS_RET;
+ setColorPrefId(ISDPreferences.PREF_ASYNC_MESS_RET);
}
// ------------------------------------------------------------------------
fMessage = parentMessage;
}
+ /**
+ * Returns the associated message (the message it is the return).<br>
+ *
+ * @return parentMessage the message to associate
+ * @since 2.0
+ */
+ public AsyncMessage getMessage() {
+ return fMessage;
+ }
+
@Override
public void draw(IGC context) {
if (!isVisible()) {
ISDPreferences pref = SDViewPref.getInstance();
- fPrefId = ISDPreferences.PREF_ASYNC_MESS_RET;
+ setColorPrefId(ISDPreferences.PREF_ASYNC_MESS_RET);
int oldStyle = context.getLineStyle();
// Message return are dashed
context.setLineStyle(context.getLineDotStyle());
if (!isSelected()) {
- context.setBackground(pref.getBackGroundColor(fPrefId));
- context.setForeground(pref.getForeGroundColor(fPrefId));
+ context.setBackground(pref.getBackGroundColor(getColorPrefId()));
+ context.setForeground(pref.getForeGroundColor(getColorPrefId()));
}
super.draw(context);
// restore the context
/**
* The lifeline which send the message
*/
- protected Lifeline fStartLifeline = null;
+ private Lifeline fStartLifeline = null;
/**
* The lifeline which receive the message
*/
- protected Lifeline fEndLifeline = null;
+ private Lifeline fEndLifeline = null;
/**
* The visiblitiy flag.
*/
- protected boolean fVisible = true;
+ private boolean fVisible = true;
// ------------------------------------------------------------------------
// Methods
/*
* Regular message, both ends are attached to a lifeline
*/
- return fEndLifeline.getY() + fEndLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEndEventOccurrence;
+ return fEndLifeline.getY() + fEndLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * getEndOccurrence();
}
/*
* UML2 lost message kind
*/
if (fStartLifeline != null) {
- return fStartLifeline.getY() + fStartLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEndEventOccurrence;
+ return fStartLifeline.getY() + fStartLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * getEndOccurrence();
}
/*
* UML2 found message kind
*/
if (fEndLifeline != null) {
- return fEndLifeline.getY() + fEndLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEndEventOccurrence;
+ return fEndLifeline.getY() + fEndLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * getEndOccurrence();
}
// return 0 by default
return 0;
activationWidth = -activationWidth;
}
- if (isMessageStartInActivation(fEndEventOccurrence)) {
+ if (isMessageStartInActivation(getEndOccurrence())) {
x = x + activationWidth;
}
activationWidth = -activationWidth;
}
- if (isMessageStartInActivation(fEndEventOccurrence)) {
+ if (isMessageStartInActivation(getEndOccurrence())) {
width = width - activationWidth;
}
- if (isMessageEndInActivation(fEndEventOccurrence)) {
+ if (isMessageEndInActivation(getEndOccurrence())) {
width = width - activationWidth;
}
* @see Lifeline Lifeline for more event occurence details
*/
protected void setEventOccurrence(int occurrence) {
- fEndEventOccurrence = occurrence;
+ setEndOccurrence(occurrence);
}
/**
* @see Lifeline Lifeline for more event occurence details
*/
public int getEventOccurrence() {
- return fEndEventOccurrence;
+ return getEndOccurrence();
}
/**
int thisY = getY();
for (int i = 0; i < fStartLifeline.getExecutions().size(); i++) {
BasicExecutionOccurrence toDraw = (BasicExecutionOccurrence) fStartLifeline.getExecutions().get(i);
- if ((event >= toDraw.fStartEventOccurrence) && (event <= toDraw.fEndEventOccurrence)) {
+ if ((event >= toDraw.getStartOccurrence()) && (event <= toDraw.getEndOccurrence())) {
inActivation = true;
}
// if we are outside the visible area we stop right now
// for drawing speed reason with only search on the visivle subset
for (int i = 0; i < fEndLifeline.getExecutions().size(); i++) {
BasicExecutionOccurrence toDraw = (BasicExecutionOccurrence) fEndLifeline.getExecutions().get(i);
- if ((event >= toDraw.fStartEventOccurrence) && (event <= toDraw.fEndEventOccurrence)) {
+ if ((event >= toDraw.getStartOccurrence()) && (event <= toDraw.getEndOccurrence())) {
inActivation = true;
}
// if we are outside the visible area we stop right now
* @param context A graphical context to draw in.
*/
protected void drawMessage(IGC context) {
- int fX, fY, fW, fH;
- fX = fY = fW = fH = 0;
+ int fX = 0;
+ int fY = 0;
+ int fW = 0;
+ int fH = 0;
// temporary store the coordinates to avoid more methods calls
int x = getX();
// 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(pref.getFontColor(fPrefId));
+ context.setForeground(pref.getFontColor(getColorPrefId()));
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;
context.fillOval(x + width - ray, y + height - ray, ray * 2, ray * 2);
}
context.setBackground(storedColor);
- context.setForeground(pref.getFontColor(fPrefId));
+ context.setForeground(pref.getFontColor(getColorPrefId()));
fX = x;
fY = y - yt.intValue();
fW = width;
// 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(pref.getFontColor(fPrefId));
+ context.setForeground(pref.getFontColor(getColorPrefId()));
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());
// 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(pref.getFontColor(fPrefId));
+ context.setForeground(pref.getFontColor(getColorPrefId()));
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 {
ISDPreferences pref = SDViewPref.getInstance();
- if ((fStartLifeline != fEndLifeline) && (fStartEventOccurrence == fEndEventOccurrence)) {
+ if ((fStartLifeline != fEndLifeline) && (getStartOccurrence() == getEndOccurrence())) {
context.setLineStyle(context.getLineDotStyle());
context.setLineWidth(Metrics.NORMAL_LINE_WIDTH);
context.setBackground(pref.getBackGroundColorSelection());
context.setForeground(pref.getForeGroundColorSelection());
context.drawFocus(getX(), getY() - 3, getWidth(), getHeight() + 6);
- } else if ((fStartLifeline == fEndLifeline) && (fStartEventOccurrence == fEndEventOccurrence)) {
+ } else if ((fStartLifeline == fEndLifeline) && (getStartOccurrence() == getEndOccurrence())) {
context.drawFocus(getX(), getY() - 3, getWidth(), Metrics.SYNC_INTERNAL_MESSAGE_HEIGHT + 6);
- } else if ((fStartLifeline != fEndLifeline) && (fStartEventOccurrence != fEndEventOccurrence)) {
+ } else if ((fStartLifeline != fEndLifeline) && (getStartOccurrence() != getEndOccurrence())) {
context.setLineStyle(context.getLineDotStyle());
context.setLineWidth(Metrics.NORMAL_LINE_WIDTH);
context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE_HEADER));
/**
* The corresponding lifeline.
*/
- protected Lifeline fLifeline = null;
+ private Lifeline fLifeline = null;
// ------------------------------------------------------------------------
// Constructors
* Default constructore
*/
public BasicExecutionOccurrence() {
- fPrefId = ISDPreferences.PREF_EXEC;
+ setColorPrefId(ISDPreferences.PREF_EXEC);
}
// ------------------------------------------------------------------------
if (fLifeline == null) {
return 0;
}
- return fLifeline.getY() + fLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fStartEventOccurrence;
+ return fLifeline.getY() + fLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * getStartOccurrence();
}
@Override
if (fLifeline == null) {
return 0;
}
- return ((Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing())) * (fEndEventOccurrence - fStartEventOccurrence);
+ return ((Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing())) * (getEndOccurrence() - getStartOccurrence());
}
@Override
*/
@Override
public int getStartOccurrence() {
- return fStartEventOccurrence;
+ return super.getStartOccurrence();
}
/**
*/
@Override
public int getEndOccurrence() {
- return fEndEventOccurrence;
+ return super.getEndOccurrence();
}
/**
*
* @param occurrence the start event occurrence to set
*/
+ @Override
public void setStartOccurrence(int occurrence) {
- fStartEventOccurrence = occurrence;
+ super.setStartOccurrence(occurrence);
}
/**
*
* @param occurrence the end event occurrence to set
*/
+ @Override
public void setEndOccurrence(int occurrence) {
- fEndEventOccurrence = occurrence;
+ super.setEndOccurrence(occurrence);
}
@Override
/**
* Contains the max elapsed time between two consecutive messages in the whole frame
*/
- protected ITmfTimestamp fMaxTime = new TmfTimestamp(0);
+ private ITmfTimestamp fMaxTime = new TmfTimestamp(0);
/**
* Contains the min elapsed time between two consecutive messages in the whole frame
*/
- protected ITmfTimestamp fMinTime = new TmfTimestamp(0);
+ private ITmfTimestamp fMinTime = new TmfTimestamp(0);
/**
* Indicate if the min and max elapsed time between two consecutive messages in the whole frame need to be computed
*/
- protected boolean fComputeMinMax = true;
+ private boolean fComputeMinMax = true;
/**
* Store the preference set by the user regarding the external time. This flag is used determine if the min and max
* need to be recomputed in case this preference is changed.
*/
- protected boolean fLastExternalTimePref = SDViewPref.getInstance().excludeExternalTime();
+ private boolean fLastExternalTimePref = SDViewPref.getInstance().excludeExternalTime();
/**
* The greater event occurrence created on graph nodes drawn in this Frame This directly impact the Frame height
*/
- protected int fVerticalIndex = 0;
+ private int fVerticalIndex = 0;
/**
* The index along the x axis where the next lifeline will is drawn This directly impact the Frame width
*/
- protected int fHorizontalIndex = 0;
+ private int fHorizontalIndex = 0;
/**
* The time information flag.
*/
- protected boolean fHasTimeInfo = false;
+ private boolean fHasTimeInfo = false;
/**
* The current Frame visible area - x coordinates
*/
- protected int fVisibleAreaX;
+ private int fVisibleAreaX;
/**
* The current Frame visible area - y coordinates
*/
- protected int fVisibleAreaY;
+ private int fVisibleAreaY;
/**
* The current Frame visible area - width
*/
- protected int fVisibleAreaWidth;
+ private int fVisibleAreaWidth;
/**
* The current Frame visible area - height
*/
- protected int fVisibleAreaHeight;
+ private int fVisibleAreaHeight;
/**
* The event occurrence spacing (-1 for none)
*/
- protected int fForceEventOccurrenceSpacing = -1;
+ private int fForceEventOccurrenceSpacing = -1;
/**
* Flag to indicate customized minumum and maximum.
*/
- protected boolean fCustomMinMax = false;
+ private boolean fCustomMinMax = false;
/**
* The minimum time between messages of the sequence diagram frame.
*/
- protected ITmfTimestamp fMinSDTime = new TmfTimestamp();
+ private ITmfTimestamp fMinSDTime = new TmfTimestamp();
/**
* The maximum time between messages of the sequence diagram frame.
*/
- protected ITmfTimestamp fMaxSDTime = new TmfTimestamp();
+ private ITmfTimestamp fMaxSDTime = new TmfTimestamp();
/**
* Flag to indicate that initial minimum has to be computed.
*/
- protected boolean fInitSDMin = true;
+ private boolean fInitSDMin = true;
// ------------------------------------------------------------------------
// Constructors
@Override
public void addNode(GraphNode nodeToAdd) {
- fComputeMinMax = true;
+ setComputeMinMax(true);
super.addNode(nodeToAdd);
}
+ Metrics.LIFELINE_NAME_H_MARGIN + Metrics.FRAME_NAME_H_MARGIN + Metrics.getLifelineFontHeigth() * 2;
}
+ /**
+ * @return true if mininum and maximum time needs to be calculated else false
+ * @since 2.0
+ */
+ protected boolean isComputeMinMax() {
+ return fComputeMinMax;
+ }
+
+ /**
+ * @return true if mininum and maximum time needs to be calculated else false
+ * @since 2.0
+ */
+ protected boolean isCustomMinMax() {
+ return fCustomMinMax;
+ }
+
+ /**
+ * gets the initialization flag for SD minimum.
+ *
+ * @return the initialization flag for SD minimum
+ * @since 2.0
+ */
+ protected boolean getInitSDMin() {
+ return fInitSDMin;
+ }
+
/**
* Returns the graph node which contains the point given in parameter for the given graph node list and starting the
* iteration at the given index<br>
public ITmfTimestamp getMinTime() {
if (fLastExternalTimePref != SDViewPref.getInstance().excludeExternalTime()) {
fLastExternalTimePref = SDViewPref.getInstance().excludeExternalTime();
- fComputeMinMax = true;
+ setComputeMinMax(true);
}
if ((fComputeMinMax) && (!fCustomMinMax)) {
computeMinMax();
- fComputeMinMax = false;
+ setComputeMinMax(false);
}
return fMinTime;
}
*/
public void resetCustomMinMax() {
fCustomMinMax = false;
- fComputeMinMax = true;
+ setComputeMinMax(true);
}
/**
public ITmfTimestamp getMaxTime() {
if (fLastExternalTimePref != SDViewPref.getInstance().excludeExternalTime()) {
fLastExternalTimePref = SDViewPref.getInstance().excludeExternalTime();
- fComputeMinMax = true;
+ setComputeMinMax(true);
}
if (fComputeMinMax) {
computeMinMax();
- fComputeMinMax = false;
+ setComputeMinMax(false);
}
return fMaxTime;
}
fMinTime = new TmfTimestamp(0, m1.getTime().getScale(), m1.getTime().getPrecision());
}
fMaxTime = fMinTime;
- fComputeMinMax = false;
+ setComputeMinMax(false);
}
if ((delta.compareTo(fMinTime, true) < 0) && (delta.compareTo(TmfTimestamp.ZERO, false) > 0)) {
* @return the time array else empty list.
*/
protected List<SDTimeEvent> buildTimeArray() {
- if (!fHasChilden) {
+ if (!hasChildren()) {
return new ArrayList<SDTimeEvent>();
}
- Iterator<String> it = fForwardSort.keySet().iterator();
+ Iterator<String> it = getForwardSortMap().keySet().iterator();
List<SDTimeEvent> timeArray = new ArrayList<SDTimeEvent>();
while (it.hasNext()) {
String nodeType = it.next();
- List<GraphNode> list = fNodes.get(nodeType);
+ List<GraphNode> list = getNodeMap().get(nodeType);
for (int i = 0; i < list.size(); i++) {
Object timedNode = list.get(i);
if ((timedNode instanceof ITimeRange) && ((ITimeRange) timedNode).hasTimeInfo()) {
SDTimeEvent f = new SDTimeEvent(time, event, (ITimeRange) list.get(i));
timeArray.add(f);
if (event != list.get(i).getEndOccurrence()) {
- event = ((AsyncMessage) list.get(i)).getEndOccurrence();
+ event = (list.get(i)).getEndOccurrence();
time = ((ITimeRange) list.get(i)).getEndTime();
f = new SDTimeEvent(time, event, (ITimeRange) list.get(i));
timeArray.add(f);
public boolean contains(int x, int y) {
return false;
}
+
+ /**
+ * @return true if frame has time info else false
+ * @since 2.0
+ */
+ public boolean hasTimeInfo() {
+ return fHasTimeInfo;
+ }
+
+ /**
+ * Sets the flag whether the frame has time info or not
+ * @since 2.0
+ * @param hasTimeInfo
+ * true if frame has time info else false
+ */
+ public void setHasTimeInfo(boolean hasTimeInfo) {
+ fHasTimeInfo = hasTimeInfo;
+ }
+
+ /**
+ * Sets the flag for minimum and maximum computation.
+ * @param computeMinMax
+ * true if mininum and maximum time needs to be calculated else false
+ * @since 2.0
+ */
+ public void setComputeMinMax(boolean computeMinMax) {
+ fComputeMinMax = computeMinMax;
+ }
+
+ /**
+ * Sets the initialization flag for SD minimum.
+ *
+ * @param initSDMin
+ * the flag to set
+ * @since 2.0
+ */
+ public void setInitSDMin(boolean initSDMin) {
+ fInitSDMin = initSDMin;
+ }
}
@Override
public int getX() {
- if (fStartLifeline == null) {
+ if (getStartLifeline() == null) {
return super.getX() + super.getWidth() - 16;
}
return super.getX();
int height = getHeight();
// UML2 found message (always drawn from left to right)
- if (fStartLifeline == null && fEndLifeline != null) {
+ if (getStartLifeline() == null && getEndLifeline() != null) {
// 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.setBackground(storedColor);
}
// UML2 lost message (always drawn from left to right)
- else if (fEndLifeline == null && fStartLifeline != null) {
+ else if (getEndLifeline() == null && getStartLifeline() != null) {
// 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
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
+import java.util.Arrays;
+
import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
/**
* Set the red, green and blue value of the optional color to be used for filling the execution occurrence.
*/
- protected int[] fFillRGB;
+ private int[] fFillRGB;
/**
* Set the red, green and blue value of the optional color to be used for drawing the execution occurrence
*/
- protected int[] fStrokeRGB;
+ private int[] fStrokeRGB;
/**
* The occurrence image.
*/
- protected IImage fImage;
+ private IImage fImage;
/**
* The top ellipses image.
*/
- protected IImage fEllipsesImage;
+ private IImage fEllipsesImage;
/**
* The start time stamp.
*/
- protected ITmfTimestamp fStartTime;
+ private ITmfTimestamp fStartTime;
/**
* The end time stamp;
*/
- protected ITmfTimestamp fEndTime;
+ private ITmfTimestamp fEndTime;
/**
* Flag to indicate whether time information is available or not.
*/
- protected boolean fHasTimeInfo;
+ private boolean fHasTimeInfo;
// ------------------------------------------------------------------------
// Methods
@Override
public void setLifeline(Lifeline theLifeline) {
super.setLifeline(theLifeline);
- if (fLifeline != null && fHasTimeInfo) {
- fLifeline.fHasTimeInfo = true;
- if (fLifeline.getFrame() != null) {
- fLifeline.getFrame().setHasTimeInfo(true);
+ if (getLifeline() != null && fHasTimeInfo) {
+ getLifeline().setTimeInfo(true);
+ if (getLifeline().getFrame() != null) {
+ getLifeline().getFrame().setHasTimeInfo(true);
}
}
}
public void setStartTime(ITmfTimestamp time) {
fStartTime = time;
fHasTimeInfo = true;
- if (fLifeline != null) {
- fLifeline.setTimeInfo(true);
+ if (getLifeline() != null) {
+ getLifeline().setTimeInfo(true);
}
}
public void setEndTime(ITmfTimestamp time) {
fEndTime = time;
fHasTimeInfo = true;
- if (fLifeline != null) {
- fLifeline.setTimeInfo(true);
+ if (getLifeline() != null) {
+ getLifeline().setTimeInfo(true);
}
}
return fHasTimeInfo;
}
+ /**
+ * @return the RGB of the occurrence filler.
+ * @since 2.0
+ */
+ public int[] getFillRGB() {
+ if (fFillRGB == null) {
+ return null;
+ }
+ return Arrays.copyOf(fFillRGB, fFillRGB.length);
+ }
+
+ /**
+ * @return the RGB of the occurrence filler.
+ * @since 2.0
+ */
+ public int[] getStrokeRGB() {
+ if (fStrokeRGB == null) {
+ return null;
+ }
+ return Arrays.copyOf(fStrokeRGB, fStrokeRGB.length);
+ }
+
+ /**
+ * @return the image.
+ * @since 2.0
+ */
+ protected IImage getImage() {
+ return fImage;
+ }
+
+ /**
+ * @return the image.
+ * @since 2.0
+ */
+ protected IImage getEllipsesImage() {
+ return fEllipsesImage;
+ }
+
@Override
public void draw(IGC context) {
super.draw(context);
}
return super.setUnselectedStrokeColor(context);
}
+
+ /**
+ * Sets the flag whether the frame has time info or not
+ * @since 2.0
+ * @param hasTimeInfo
+ * true if frame has time info else false
+ */
+ public void setHasTimeInfo(boolean hasTimeInfo) {
+ fHasTimeInfo = hasTimeInfo;
+ }
}
/**
* The lifeline that is current highlighted.
*/
- protected Lifeline fHighlightLifeline = null;
+ private Lifeline fHighlightLifeline = null;
/**
* The value of the start event.
*/
- protected int fStartEvent = 0;
+ private int fStartEvent = 0;
/**
- * The nubmer of events in the frame.
+ * The number of events in the frame.
*/
- protected int fNbEvent = 0;
+ private int fNbEvent = 0;
/**
* The color for highlighting.
*/
- protected IColor fHighlightColor = null;
+ private IColor fHighlightColor = null;
/**
* The list of time events of the corresponding execution occurrences.
*/
- protected List<SDTimeEvent> fExecutionOccurrencesWithTime;
+ private List<SDTimeEvent> fExecutionOccurrencesWithTime;
/**
* The Array of lifeline categories.
*/
- protected LifelineCategories[] fLifelineCategories = null;
+ private LifelineCategories[] fLifelineCategories = null;
// ------------------------------------------------------------------------
// Methods
* @return the lifelines list
*/
protected List<GraphNode> getLifelines() {
- if (!fHasChilden) {
+ if (!hasChildren()) {
return null;
}
- return fNodes.get(Lifeline.LIFELINE_TAG);
+ return getNodeMap().get(Lifeline.LIFELINE_TAG);
}
/**
* @return the syncMessages list
*/
protected List<GraphNode> getSyncMessages() {
- if (!fHasChilden) {
+ if (!hasChildren()) {
return null;
}
- return fNodes.get(SyncMessage.SYNC_MESS_TAG);
+ return getNodeMap().get(SyncMessage.SYNC_MESS_TAG);
}
/**
* @return the asyncMessages list or <code>null</code>
*/
protected List<GraphNode> getAsyncMessages() {
- if (!fHasChilden) {
+ if (!hasChildren()) {
return null;
}
- return fNodes.get(AsyncMessage.ASYNC_MESS_TAG);
+ return getNodeMap().get(AsyncMessage.ASYNC_MESS_TAG);
}
/**
* @return the syncMessages return list or <code>null</code>
*/
protected List<GraphNode> getSyncMessagesReturn() {
- if (!fHasChilden) {
+ if (!hasChildren()) {
return null;
}
- return fNodes.get(SyncMessageReturn.SYNC_MESS_RET_TAG);
+ return getNodeMap().get(SyncMessageReturn.SYNC_MESS_RET_TAG);
}
/**
* @return the asyncMessageRetun list or <code>null</code>
*/
protected List<GraphNode> getAsyncMessagesReturn() {
- if (!fHasChilden) {
+ if (!hasChildren()) {
return null;
}
- return fNodes.get(AsyncMessageReturn.ASYNC_MESS_RET_TAG);
+ return getNodeMap().get(AsyncMessageReturn.ASYNC_MESS_RET_TAG);
}
/**
* @param lifeline the lifeline to add
*/
public void addLifeLine(Lifeline lifeline) {
- fComputeMinMax = true;
+ setComputeMinMax(true);
if (lifeline == null) {
return;
}
// and set the lifeline drawing order
lifeline.setIndex(getNewHorizontalIndex());
if (lifeline.hasTimeInfo()) {
- fHasTimeInfo = true;
+ setHasTimeInfo(true);
}
// add the lifeline to the lifelines list
addNode(lifeline);
* @return the first visible lifeline index
*/
public int getFirstVisibleLifeline() {
- if (!fHasChilden) {
+ if (!hasChildren()) {
return 0;
- } else if (fIndexes.get(Lifeline.LIFELINE_TAG) != null) {
- return fIndexes.get(Lifeline.LIFELINE_TAG).intValue();
+ } else if (getIndexes().get(Lifeline.LIFELINE_TAG) != null) {
+ return getIndexes().get(Lifeline.LIFELINE_TAG).intValue();
}
return 0;
}
* @return the first visible synchronous message index
*/
public int getFirstVisibleSyncMessage() {
- if (!fHasChilden) {
+ if (!hasChildren()) {
return 0;
- } else if (fIndexes.get(SyncMessage.SYNC_MESS_TAG) != null) {
- return fIndexes.get(SyncMessage.SYNC_MESS_TAG).intValue();
+ } else if (getIndexes().get(SyncMessage.SYNC_MESS_TAG) != null) {
+ return getIndexes().get(SyncMessage.SYNC_MESS_TAG).intValue();
}
return 0;
}
* @return the first visible synchronous message return index
*/
public int getFirstVisibleSyncMessageReturn() {
- if (!fHasChilden) {
+ if (!hasChildren()) {
return 0;
- } else if (fIndexes.get(SyncMessageReturn.SYNC_MESS_RET_TAG) != null) {
- return fIndexes.get(SyncMessageReturn.SYNC_MESS_RET_TAG).intValue();
+ } else if (getIndexes().get(SyncMessageReturn.SYNC_MESS_RET_TAG) != null) {
+ return getIndexes().get(SyncMessageReturn.SYNC_MESS_RET_TAG).intValue();
}
return 0;
}
* @return the first visible synchronous message index
*/
public int getFirstVisibleAsyncMessage() {
- if (!fHasChilden) {
+ if (!hasChildren()) {
return 0;
- } else if (fIndexes.get(AsyncMessage.ASYNC_MESS_TAG) != null) {
- return fIndexes.get(AsyncMessage.ASYNC_MESS_TAG).intValue();
+ } else if (getIndexes().get(AsyncMessage.ASYNC_MESS_TAG) != null) {
+ return getIndexes().get(AsyncMessage.ASYNC_MESS_TAG).intValue();
}
return 0;
}
* @return the first visible synchronous message return index
*/
public int getFirstVisibleAsyncMessageReturn() {
- if (!fHasChilden) {
+ if (!hasChildren()) {
return 0;
- } else if (fIndexes.get(AsyncMessageReturn.ASYNC_MESS_RET_TAG) != null) {
- return fIndexes.get(AsyncMessageReturn.ASYNC_MESS_RET_TAG).intValue();
+ } else if (getIndexes().get(AsyncMessageReturn.ASYNC_MESS_RET_TAG) != null) {
+ return getIndexes().get(AsyncMessageReturn.ASYNC_MESS_RET_TAG).intValue();
}
return 0;
}
if (SDViewPref.getInstance().excludeExternalTime() && ((m1.getGraphNode() instanceof BaseMessage) && (m2.getGraphNode() instanceof BaseMessage))) {
BaseMessage mes1 = (BaseMessage) m1.getGraphNode();
BaseMessage mes2 = (BaseMessage) m2.getGraphNode();
- if ((mes2.fStartLifeline == null) || (mes1.fEndLifeline == null)) {
+ if ((mes2.getStartLifeline() == null) || (mes1.getEndLifeline() == null)) {
continue;
}
}
return false;
}
- /**
- * Set whether time information is available or not
- *
- * @param value <code>true</code> for has time information else <code>false</code>
- */
- protected void setHasTimeInfo(boolean value) {
- fHasTimeInfo = value;
- }
-
- /**
- * Returns whether frame has time info or not.
- *
- * @return <code>true</code> whether frame has time info else <code>false</code>
- */
- public boolean hasTimeInfo() {
- return fHasTimeInfo;
- }
-
/**
* Highlights the time compression.
*
@Override
public void draw(IGC context) {
drawFrame(context);
- if (!fHasChilden) {
+ if (!hasChildren()) {
return;
}
if (Metrics.swimmingLaneWidth() * context.getZoom() < Metrics.LIFELINE_SIGNIFICANT_HSPACING) {
lifelineArryStep = Math.round(Metrics.LIFELINE_SIGNIFICANT_HSPACING / (Metrics.swimmingLaneWidth() * context.getZoom()));
}
- if (fIndexes.size() == 0) {
+ if (getIndexes().size() == 0) {
return;
}
- int lifeLineDrawIndex = fIndexes.get(Lifeline.LIFELINE_TAG).intValue();
- for (int i = lifeLineDrawIndex; i < fNodes.get(Lifeline.LIFELINE_TAG).size(); i = i + lifelineArryStep) {
- Lifeline toDraw = (Lifeline) fNodes.get(Lifeline.LIFELINE_TAG).get(i);
+ int lifeLineDrawIndex = getIndexes().get(Lifeline.LIFELINE_TAG).intValue();
+ for (int i = lifeLineDrawIndex; i < getNodeMap().get(Lifeline.LIFELINE_TAG).size(); i = i + lifelineArryStep) {
+ Lifeline toDraw = (Lifeline) getNodeMap().get(Lifeline.LIFELINE_TAG).get(i);
if (toDraw.getX() - Metrics.LIFELINE_SPACING / 2 > context.getContentsX() + context.getVisibleWidth()) {
break;
}
BasicExecutionOccurrence exec = (BasicExecutionOccurrence) toDraw.getExecutions().get(index);
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))) {
+ if (((tempEvent >= exec.getStartOccurrence()) && (tempEvent <= exec.getEndOccurrence()) && (tempEvent + 1 >= exec.getStartOccurrence()) && (tempEvent + 1 <= exec.getEndOccurrence()))) {
toDraw.highlightExecOccurrenceRegion(context, tempEvent, 1, SDViewPref.getInstance().getTimeCompressionSelectionColor());
}
tempEvent = tempEvent + 1;
@Override
protected List<SDTimeEvent> buildTimeArray() {
- if (!fHasChilden) {
+ if (!hasChildren()) {
return new ArrayList<SDTimeEvent>();
}
List<SDTimeEvent> timeArray = super.buildTimeArray();
fExecutionOccurrencesWithTime = null;
if (getLifelines() != null) {
- for (int i = 0; i < fNodes.get(Lifeline.LIFELINE_TAG).size(); i++) {
- Lifeline lifeline = (Lifeline) fNodes.get(Lifeline.LIFELINE_TAG).get(i);
+ for (int i = 0; i < getNodeMap().get(Lifeline.LIFELINE_TAG).size(); i++) {
+ Lifeline lifeline = (Lifeline) getNodeMap().get(Lifeline.LIFELINE_TAG).get(i);
if (lifeline.hasTimeInfo() && lifeline.getExecutions() != null) {
for (Iterator<GraphNode> j = lifeline.getExecutions().iterator(); j.hasNext();) {
GraphNode o = j.next();
BasicExecutionOccurrence result = null;
for (int i = 0; i < list.size(); i++) {
BasicExecutionOccurrence e = (BasicExecutionOccurrence) list.get(i);
- if ((e.getStartOccurrence() < exec.fStartEventOccurrence) && (result == null)) {
+ if ((e.getStartOccurrence() < exec.getStartOccurrence()) && (result == null)) {
result = e;
}
- if ((e.getStartOccurrence() < exec.fStartEventOccurrence) && (result != null) && (e.getStartOccurrence() >= result.getEndOccurrence())) {
+ if ((e.getStartOccurrence() < exec.getStartOccurrence()) && (result != null) && (e.getStartOccurrence() >= result.getEndOccurrence())) {
result = e;
}
}
BasicExecutionOccurrence result = null;
for (int i = 0; i < list.size(); i++) {
BasicExecutionOccurrence e = (BasicExecutionOccurrence) list.get(i);
- if ((e.getStartOccurrence() > exec.fStartEventOccurrence) && (result == null)) {
+ if ((e.getStartOccurrence() > exec.getStartOccurrence()) && (result == null)) {
result = e;
}
- if ((e.getStartOccurrence() > exec.fStartEventOccurrence) && (result != null) && (e.getStartOccurrence() <= result.getEndOccurrence())) {
+ if ((e.getStartOccurrence() > exec.getStartOccurrence()) && (result != null) && (e.getStartOccurrence() <= result.getEndOccurrence())) {
result = e;
}
}
}
return result;
}
-}
+
+ /**
+ * @return highlighted life line if set else null.
+ * @since 2.0
+ */
+ protected Lifeline getHighlightLifeline() {
+ return fHighlightLifeline;
+ }
+
+ /**
+ * @return the start event value.
+ * @since 2.0
+ */
+ protected int getStartEvent() {
+ return fStartEvent;
+ }
+
+ /**
+ * Returns the number of events
+ *
+ * @return the number of events
+ * @since 2.0
+ */
+ protected int getNumberOfEvents() {
+ return fNbEvent;
+ }
+
+ /**
+ * Returns the highlight color.
+ * @return the highlight color
+ * @since 2.0
+ */
+ protected IColor getHighlightColor() {
+ return fHighlightColor;
+ }
+
+ /**
+ * Set the highlighted life line.
+ * @param lifeline
+ * The highlighted life line if set else null
+ * @since 2.0
+ */
+ protected void setHighlightLifeline(Lifeline lifeline) {
+ fHighlightLifeline = lifeline;
+ }
+
+ /**
+ * Sets the start event value
+ * @param startEvent
+ * the start event value.
+ * @since 2.0
+ */
+ protected void setStartEvent(int startEvent) {
+ fStartEvent = startEvent;
+ }
+
+ /**
+ * Sets the number of events
+ *
+ * @param nbEvents
+ * The number of events
+ * @since 2.0
+ */
+ protected void setNumberOfEvents(int nbEvents) {
+ fNbEvent = nbEvents;
+ }
+
+ /**
+ * Sets the highlight color.
+ * @param color
+ * the highlight color
+ * @since 2.0
+ */
+ protected void setHighlightColor(IColor color) {
+ fHighlightColor = color;
+ }
+
+ /**
+ * sets the list of execution occurrences.
+ *
+ * @param occurences
+ * the list of execution occurrences
+ * @since 2.0
+ */
+ protected void setExecutionOccurrencesWithTime(List<SDTimeEvent> occurences) {
+ fExecutionOccurrencesWithTime = occurences;
+ }
+}
\ No newline at end of file
/**********************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation, Ericsson
+ * Copyright (c) 2005, 2013 IBM Corporation, Ericsson
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
/**
* The start event occurrence.
*/
- protected int fStartEventOccurrence = 0;
+ private int fStartEventOccurrence = 0;
/**
* The event event occurrence.
*/
- protected int fEndEventOccurrence = 0;
+ private int fEndEventOccurrence = 0;
/**
* Preference ColorId to use to draw font
*/
- public String fPrefId = ISDPreferences.PREF_SYNC_MESS;
+ private String fPrefId = ISDPreferences.PREF_SYNC_MESS;
/**
* The selection state of the graph node.
*/
- protected boolean fSelected = false;
+ private boolean fSelected = false;
/**
* The focus state of the graph node.
*/
- protected boolean fFocused = false;
+ private boolean fFocused = false;
/**
* Flag to indicate whether node has children or not.
*/
- protected boolean fHasChilden = false;
+ private boolean fHasChilden = false;
/**
* The graph node name used to label the graph node in the View.
*/
- protected String fName = ""; //$NON-NLS-1$
+ private String fName = ""; //$NON-NLS-1$
/**
* A map from node name to graph node.
*/
- protected Map<String, List<GraphNode>> fNodes;
+ private Map<String, List<GraphNode>> fNodes;
/**
* A map from node name to graph node for forward sorting
*/
- protected Map<String, List<GraphNode>> fForwardNodes;
+ private Map<String, List<GraphNode>> fForwardNodes;
/**
* A map from node name to graph node for backwards sorting.
*/
- protected Map<String, List<GraphNode>> fBackwardNodes;
+ private Map<String, List<GraphNode>> fBackwardNodes;
/**
* A map from node name to index.
*/
- protected Map<String, Integer> fIndexes;
+ private Map<String, Integer> fIndexes;
/**
- * A map from node name to index for forwards sorting.
+ * A map from node name to flag for forwards sorting.
*/
- protected Map<String, Boolean> fForwardSort;
+ private Map<String, Boolean> fForwardSort;
/**
- * A map from node name to index for forwards sorting.
+ * A map from node name to flag for backwards sorting.
*/
- protected Map<String, Boolean> fBackwardSort;
+ private Map<String, Boolean> fBackwardSort;
// ------------------------------------------------------------------------
// Methods
}
return (px >= locX) && (py >= locY) && ((px - locX) <= locWidth) && ((py - locY) <= locHeight);
}
+
+ /**
+ * Sets the start event occurrence attached to this graphNode.
+ *
+ * @param occurence
+ * the start event occurrence attached to the graphNode
+ * @since 2.0
+ */
+ protected void setStartOccurrence(int occurence) {
+ fStartEventOccurrence = occurence;
+ }
+
+ /**
+ * Sets the end event occurrence attached to this graphNode
+ *
+ * @param occurence
+ * the start event occurrence attached to the graphNode
+ * @since 2.0
+ */
+ protected void setEndOccurrence(int occurence) {
+ fEndEventOccurrence = occurence;
+ }
+
+ /**
+ * Sets the color preference id
+ * @param id
+ * The color preference id
+ * @since 2.0
+ */
+ protected void setColorPrefId(String id) {
+ fPrefId = id;
+ }
+
+ /**
+ * Gets the color preference id
+ * @return the color preference id
+ * @since 2.0
+ */
+ protected String getColorPrefId() {
+ return fPrefId;
+ }
+
+ /**
+ * @return if node has children or not
+ * @since 2.0
+ */
+ protected boolean hasChildren() {
+ return fHasChilden;
+ }
+
+ /**
+ * Sets the flag indicating where the node has children or not.
+ * @param hasChildren
+ * if node has children or not
+ * @since 2.0
+ */
+ protected void hasChildren(boolean hasChildren) {
+ fHasChilden = hasChildren;
+ }
+ /**
+ * Returns a map from node name to graph node.
+ *
+ * @return map with children graph bodes
+ * @since 2.0
+ */
+ protected Map<String, List<GraphNode>> getNodeMap() {
+ return fNodes;
+ }
+ /**
+ * Returns a map from node name to graph node for forward sorting
+ *
+ * @return forward sorting map
+ * @since 2.0
+ */
+ protected Map<String, List<GraphNode>> getForwardNodes() {
+ return fForwardNodes;
+ }
+ /**
+ * Returns a map from node name to graph node for backwards sorting.
+ *
+ * @return backwards sorting map
+ * @since 2.0
+ */
+ protected Map<String, List<GraphNode>> getBackwardNodes() {
+ return fBackwardNodes;
+ }
+ /**
+ * Returns a map from node name to index.
+ *
+ * @return map with node name to index
+ * @since 2.0
+ */
+ protected Map<String, Integer> getIndexes() {
+ return fIndexes;
+ }
+
+ /**
+ * Returns a map from node name to sort flag for forwards sorting.
+ * @return a map from node name to sort flag
+ * @since 2.0
+ */
+ protected Map<String, Boolean> getForwardSortMap() {
+ return fForwardSort;
+ }
+ /**
+ * Returns a map from node name to flag for backwards sorting.
+ * @return map from node name to flag for backwards sorting.
+ * @since 2.0
+ */
+ protected Map<String, Boolean> getBackwardSortMap() {
+ return fBackwardSort;
+ }
}
/**
* The execution occurrence the hot spot marker is for.
*/
- protected BasicExecutionOccurrence fExecOcc = null;
+ private BasicExecutionOccurrence fExecOcc = null;
/**
* The occurrence number.
*/
- protected int fOccurrence = 0;
+ private int fOccurrence = 0;
/**
* The marker image to display.
*/
- protected IImage fImage = null;
+ private IImage fImage = null;
// ------------------------------------------------------------------------
// Constructors
* Default constructor
*/
public HotSpot() {
- fPrefId = ISDPreferences.PREF_EXEC;
+ setColorPrefId(ISDPreferences.PREF_EXEC);
}
// ------------------------------------------------------------------------
fImage = img;
}
+ /**
+ * Returns the marker image.
+ *
+ * @return the image
+ * @since 2.0
+ */
+ protected IImage getImage() {
+ return fImage;
+ }
+
@Override
public int getX() {
if (fExecOcc != null) {
/**
* The lifeline position in the containing frame
*/
- protected int fIndexInFrame = 0;
+ private int fIndexInFrame = 0;
/**
* The frame where the lifeline is drawn
*/
- protected Frame fFrame = null;
+ private Frame fFrame = null;
/**
* The current event occurrence created in the lifeline
*/
- protected int fEventOccurrence = 0;
+ private int fEventOccurrence = 0;
/**
* The lifeline category.
*/
- protected int fCategory = -1;
+ private int fCategory = -1;
/**
* Flag whether lifeline has time information available or not
*/
- protected boolean fHasTimeInfo = false;
+ private boolean fHasTimeInfo = false;
// ------------------------------------------------------------------------
// Constructors
* Default constructor
*/
public Lifeline() {
- fPrefId = ISDPreferences.PREF_LIFELINE;
+ setColorPrefId(ISDPreferences.PREF_LIFELINE);
}
// ------------------------------------------------------------------------
fCategory = arrayIndex;
}
+ /**
+ * Gets the lifeline category for this lifeline.
+ *
+ * @return arrayIndex the index of the category to use
+ * @since 2.0
+ */
+ public int getCategory() {
+ return fCategory;
+ }
+
/**
* Returns the tooltip text for the lifeline. It is the combination between the category name(if any) and the
* lifeline name
* @return the first visible Execution Occurrence
*/
public int getExecOccurrenceDrawIndex() {
- if (!fHasChilden) {
+ if (!hasChildren()) {
return 0;
}
- if (fIndexes.get(BasicExecutionOccurrence.EXEC_OCC_TAG) != null) {
- return fIndexes.get(BasicExecutionOccurrence.EXEC_OCC_TAG).intValue();
+ if (getIndexes().get(BasicExecutionOccurrence.EXEC_OCC_TAG) != null) {
+ return getIndexes().get(BasicExecutionOccurrence.EXEC_OCC_TAG).intValue();
}
return 0;
}
public void addExecution(BasicExecutionOccurrence exec) {
exec.setLifeline(this);
addNode(exec);
- if ((fFrame != null) && (fFrame.getMaxEventOccurrence() < exec.fEndEventOccurrence)) {
- fFrame.setMaxEventOccurrence(exec.fEndEventOccurrence);
+ if ((fFrame != null) && (fFrame.getMaxEventOccurrence() < exec.getEndOccurrence())) {
+ fFrame.setMaxEventOccurrence(exec.getEndOccurrence());
}
}
* @return the execution occurrence list
*/
public List<GraphNode> getExecutions() {
- if (fHasChilden) {
- return fNodes.get(BasicExecutionOccurrence.EXEC_OCC_TAG);
+ if (hasChildren()) {
+ return getNodeMap().get(BasicExecutionOccurrence.EXEC_OCC_TAG);
}
return new ArrayList<GraphNode>();
}
/**********************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation, Ericsson
+ * Copyright (c) 2005, 2013 IBM Corporation, Ericsson
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
/**
* The category name
*/
- protected String fName = null;
+ private String fName = null;
/**
* The category image
*/
- protected IImage fCategoryImage = null;
+ private IImage fCategoryImage = null;
// ------------------------------------------------------------------------
// Methods
/**
* The time stamp of the event
*/
- protected ITmfTimestamp fTimestamp;
+ private final ITmfTimestamp fTimestamp;
/**
* The event index.
*/
- protected int fEvent;
+ private final int fEvent;
/**
* The time range implementing node.
*/
- protected ITimeRange fNode;
+ private final ITimeRange fNode;
// ------------------------------------------------------------------------
// Constructors
/**
* The owning lifeline on which the stop appears
*/
- protected Lifeline fLifeline = null;
+ private Lifeline fLifeline = null;
/**
* This basically represents the time when the stop occurs on the owning Lifeline
*
* @see Lifeline Lifeline for more event occurence details
*/
- protected int fEventOccurrence = 0;
+ private int fEventOccurrence = 0;
// ------------------------------------------------------------------------
// Methods
fLifeline = theLifeline;
}
+ /**
+ * Get the lifeline on which the stop must be draw
+ *
+ * @return the the stop owing lifeline
+ * @since 2.0
+ */
+ public Lifeline getLifeline() {
+ return fLifeline;
+ }
+
+ /**
+ * Get the event occurrence when this stop appears
+ *
+ * @return the eventOccurence to assign to the stop
+ * @since 2.0
+ */
+ public int getEventOccurrence() {
+ return fEventOccurrence;
+ }
+
/**
* Set the event occurrence when this stop appears
*
/**
* The associated message return
*/
- protected SyncMessageReturn fMessageReturn;
+ private SyncMessageReturn fMessageReturn;
/**
* The time when the message occurs
*/
- protected ITmfTimestamp fEventTime = new TmfTimestamp();
+ private ITmfTimestamp fEventTime = new TmfTimestamp();
/**
* Flag whether the message has time information available or not
*/
- protected boolean fHasTimeInfo = false;
+ private boolean fHasTimeInfo = false;
// ------------------------------------------------------------------------
// Constructors
* Default constructor
*/
public SyncMessage() {
- fPrefId = ISDPreferences.PREF_SYNC_MESS;
+ setColorPrefId(ISDPreferences.PREF_SYNC_MESS);
}
// ------------------------------------------------------------------------
*/
@Override
protected void setEventOccurrence(int occurrence) {
- fStartEventOccurrence = occurrence;
- fEndEventOccurrence = occurrence;
+ setStartOccurrence(occurrence);
+ setEndOccurrence(occurrence);
}
/**
// Draw it selected?
if (!isSelected()) {
- context.setBackground(pref.getBackGroundColor(fPrefId));
- context.setForeground(pref.getForeGroundColor(fPrefId));
+ context.setBackground(pref.getBackGroundColor(getColorPrefId()));
+ context.setForeground(pref.getForeGroundColor(getColorPrefId()));
}
super.draw(context);
}
// UML2 lost/found message visibility special case
// Others visibility cases are perform in the ***common*** case
- if ((fEndLifeline == null && fStartLifeline != null) || (fEndLifeline != null && fStartLifeline == null)) {
+ if ((getEndLifeline() == null && getStartLifeline() != null) || (getEndLifeline() != null && getStartLifeline() == null)) {
if (x + width > getX() + getWidth() && x < getX() + getWidth()) {
return true;
}
/**
* The associated message(the message it is the return).
*/
- protected SyncMessage fMessage = null;
+ private SyncMessage fMessage = null;
// ------------------------------------------------------------------------
// Constractors
* Default constructor
*/
public SyncMessageReturn() {
- fPrefId = ISDPreferences.PREF_SYNC_MESS_RET;
+ setColorPrefId(ISDPreferences.PREF_SYNC_MESS_RET);
}
// ------------------------------------------------------------------------
context.setLineStyle(context.getLineDotStyle());
// Draw it selected?
if (!isSelected()) {
- context.setBackground(pref.getBackGroundColor(fPrefId));
- context.setForeground(pref.getForeGroundColor(fPrefId));
+ context.setBackground(pref.getBackGroundColor(getColorPrefId()));
+ context.setForeground(pref.getForeGroundColor(getColorPrefId()));
}
super.draw(context);
// restore the context
/**
* Flag whether lifeline is selected or not.
*/
- protected boolean fLifeLineSelected = false;
+ private boolean fLifeLineSelected = false;
/**
* Flag whether synchronous message is selected or not.
*/
- protected boolean fSyncMessageSelected = false;
+ private boolean fSyncMessageSelected = false;
/**
* Flag whether synchronous message return is selected or not.
*/
- protected boolean fSyncMessageReturnSelected = false;
+ private boolean fSyncMessageReturnSelected = false;
/**
* Flag whether asynchronous message is selected or not.
*/
- protected boolean fAsyncMessageSelected = false;
+ private boolean fAsyncMessageSelected = false;
/**
* Flag whether asynchronous message return is selected or not.
*/
- protected boolean fAsyncMessageReturnSelected = false;
+ private boolean fAsyncMessageReturnSelected = false;
/**
* Flag whether case sensitive find is required or not.
*/
- protected boolean fCaseSenstiveSelected = false;
+ private boolean fCaseSenstiveSelected = false;
/**
* Flag whether stop graph node is selected or not.
*/
- protected boolean fStopSelected = false;
+ private boolean fStopSelected = false;
/**
* The find expression.
*/
- protected String fExpression = null;
+ private String fExpression = null;
/**
* The find pattern as regular expression.
*/
- protected Pattern pattern = null;
+ private Pattern pattern = null;
// ------------------------------------------------------------------------
// Constructors
/**
* The criteria reference.
*/
- protected Criteria fCriteria;
+ private Criteria fCriteria;
/**
* Flag whether this criteria is active or not
*/
- protected boolean fIsActive;
+ private boolean fIsActive;
/**
* Flag whether this criteria is for positive filter or not
*/
- protected boolean fIsPositive;
+ private boolean fIsPositive;
/**
* The loader class name.
*/
- protected String fLoaderClassName;
+ private String fLoaderClassName;
// ------------------------------------------------------------------------
// Constructor
/**
* The viewer and provided are kept here as attributes
*/
- protected IViewPart fViewer = null;
+ private final IViewPart fViewer;
/**
* The filter provider implementation
*/
- protected ISDFilterProvider fProvider = null;
+ private final ISDFilterProvider fProvider;
/**
* The filters are the result of editing this list
*/
- protected List<FilterCriteria> fFilters;
+ private List<FilterCriteria> fFilters;
/**
* The add button.
*/
- protected Button fAdd;
+ private Button fAdd;
/**
* The remove button.
*/
- protected Button fRemove;
+ private Button fRemove;
/**
* The edit button.
*/
- protected Button fEdit;
+ private Button fEdit;
/**
* The table with list of filters.
*/
- protected Table fTable;
+ private Table fTable;
// ------------------------------------------------------------------------
// Constructor
/**
* Label for minimum.
*/
- protected Label fMinLabel;
+ private Label fMinLabel;
/**
* Label for maximum.
*/
- protected Label fMaxLabel;
+ private Label fMaxLabel;
/**
* Label for scale
*/
- protected Label fScaleLabel;
+ private Label fScaleLabel;
/**
* Label for precision.
*/
- protected Label fPrecisionLabel;
+ private Label fPrecisionLabel;
/**
* Text field for minimum.
*/
- protected Text fMinText;
+ private Text fMinText;
/**
* Text field for maximum.
*/
- protected Text fMaxText;
+ private Text fMaxText;
/**
* Text field for scale.
*/
- protected Text fScaleText;
+ private Text fScaleText;
/**
* Text field for precision.
*/
- protected Text fPrecisionText;
+ private Text fPrecisionText;
/**
* The sequence diagram widget reference.
*/
- protected SDWidget fSdWidget;
+ private SDWidget fSdWidget;
// ------------------------------------------------------------------------
// Constructor
/**
* viewer and provided are kept here as attributes
*/
- protected ISDAdvancedPagingProvider fProvider = null;
+ private ISDAdvancedPagingProvider fProvider = null;
/** Current page */
- protected TextArea fCurrentPage;
+ private TextArea fCurrentPage;
/** Comment label */
- protected Label fTotalPageComment;
+ private Label fTotalPageComment;
// ------------------------------------------------------------------------
// Constructors
/**
* Updates the comments texts.
*/
- protected void updateComments() {
+ private void updateComments() {
int pages = Math.max(0, fProvider.pagesCount());
StringBuffer totalPageCommentText = new StringBuffer();
totalPageCommentText.append(Messages.SequenceDiagram_Total);
/**
* The sequence dialog widget reference.
*/
- protected SDWidget fSdView;
+ private SDWidget fSdView;
/**
* Sequence dialog print dialog UI
*/
- protected SDPrintDialogUI fDialogUI;
+ private SDPrintDialogUI fDialogUI;
/**
* Error message to display.
*/
- protected String fErrorMessage = null;
+ private String fErrorMessage = null;
/**
* A message label.
*/
- protected Label fMessageLabel = null;
+ private Label fMessageLabel = null;
/**
* Flag whether the page is complete or not
*/
- protected boolean fIsPageComplete = true;
+ private boolean fIsPageComplete = true;
// ------------------------------------------------------------------------
// Constructors
/**
* The set horizontal pages number.
*/
- protected Button fSetHPagesNumber;
+ private Button fSetHPagesNumber;
/**
* The set vertical pages number.
*/
- protected Button fSetVPagesNumber;
+ private Button fSetVPagesNumber;
/**
* Flag whether to use current zoom or not.
*/
- protected Button fUseCurrentZoom;
+ private Button fUseCurrentZoom;
/**
* Flag whether to print all pages or not
*/
- protected Button fAllPages;
+ private Button fAllPages;
/**
* Flag whether to print current page only
*/
- protected Button fCurrentPage;
+ private Button fCurrentPage;
/**
* Button to select a page list.
*/
- protected Button fPageList;
+ private Button fPageList;
/**
* Button to select a page range.
*/
- protected Button fPageRange;
+ private Button fPageRange;
/**
* Text field to enter from page.
*/
- protected Text fFromPage;
+ private Text fFromPage;
/**
* Text field to enter to page.
*/
- protected Text fToPage;
+ private Text fToPage;
/**
* The sequence diagram widget reference.
*/
- protected SDWidget fSdView;
+ private SDWidget fSdView;
/**
* Text field for number of horizontal pages
*/
- protected Text fHorPagesNum;
+ private Text fHorPagesNum;
/**
* Text field for number of vertical pages
*/
- protected Text fVertPagesNum;
+ private Text fVertPagesNum;
/**
* Text field for toal number of pages
*/
- protected Text fTotalPages;
+ private Text fTotalPages;
/**
* A modify listener implementation to handle modifications.
*/
- protected ModifyListener fModifyListener;
+ private ModifyListener fModifyListener;
/**
* A selection listener implementation to handle selections.
*/
- protected SelectionListener fSelectionListener;
+ private SelectionListener fSelectionListener;
/**
* Local canvas displaying sequence diagram overview.
*/
- protected LocalSD fOverviewCanvas;
+ private LocalSD fOverviewCanvas;
/**
* Number of pages
*/
- protected int fNbPages = 0;
+ private int fNbPages = 0;
/**
* Number of selected pages.
*/
- protected int fPageNum = -1;
+ private int fPageNum = -1;
/**
* Number of first page.
*/
- protected int fFirstPage = -1;
+ private int fFirstPage = -1;
/**
* List of pages to print.
*/
- protected int fPagesList[];
+ private int fPagesList[];
/**
* Value for dividing the sequence diagram into pages
*/
- protected float fStepX;
+ private float fStepX;
/**
* Value for dividing the sequence diagram into pages
*/
- protected float fStepY;
+ private float fStepY;
/**
* Value for dividing the sequence diagram into pages
*/
- protected float sTX;
+ private float sTX;
/**
* Value for dividing the sequence diagram into pages
*/
- protected float sTY;
+ private float sTY;
/**
* Page which to print from.
*/
- protected int fFrom;
+ private int fFrom;
/**
* Page which to print to.
*/
- protected int fTo;
+ private int fTo;
/**
* Flag for enabling multi-selection.
*/
- protected boolean fMultiSelection = false;
+ private boolean fMultiSelection = false;
/**
* Flag for enabling area selection.
*/
- protected boolean fAreaSelection = false;
+ private boolean fAreaSelection = false;
/**
* Flag for printing all.
*/
- protected boolean fPrintAll;
+ private boolean fPrintAll;
/**
* Flag for printing current page only.
*/
- protected boolean fPrintCurrent;
+ private boolean fPrintCurrent;
/**
* Flag for printing a selection of pages.
*/
- protected boolean fPrintSelection;
+ private boolean fPrintSelection;
/**
* Flag for printing a range of pages.
*/
- protected boolean fPrintRange;
+ private boolean fPrintRange;
/**
* Number of selected rows
*/
- protected int fNbRows;
+ private int fNbRows;
/**
* Number of selected lines
*/
- protected int fNbLines;
+ private int fNbLines;
/**
* The zoom factor.
*/
- protected float fZoomFactor;
+ private float fZoomFactor;
/**
* The printer data reference.
*/
- protected PrinterData fPrinterData;
+ private PrinterData fPrinterData;
/**
* The diagram tooltip to show if necessary.
*/
- protected DiagramToolTip fToolTip = null;
+ private DiagramToolTip fToolTip = null;
/**
* Label for current selection.
*/
- protected Label fCurrentSelection;
+ private Label fCurrentSelection;
/**
* The shell reference.
*/
- protected Shell fShell;
+ private Shell fShell;
/**
* Button to open printer dialog from OS.
*/
- protected Button fPrinterDialog;
+ private Button fPrinterDialog;
/**
* Flag for showing print button.
*/
- protected boolean fShowPrintButton;
+ private boolean fShowPrintButton;
/**
* Test value
*/
- protected int fTest = 3;
+ private int fTest = 3;
/**
* Parent wizard page if used as wizard
*/
- protected WizardPage fParentWizardPage = null;
+ private WizardPage fParentWizardPage = null;
/**
* Reference to parent print dialog.
*/
- protected SDPrintDialog fParentDialog = null;
+ private SDPrintDialog fParentDialog = null;
// ------------------------------------------------------------------------
// Helper Class
* Local sequence diagram widget used to display overview of sequence diagram to print.
* @version 1.0
*/
- protected class LocalSD extends SDWidget {
+ private class LocalSD extends SDWidget {
/**
* Constructor
@Override
public int getContentsHeight() {
if (fSdView.getContentsHeight() > fSdView.getContentsHeight()) {
- return (int) (fSdView.getVisibleHeight() / (float) fTest / fSdView.fZoomValue);
+ return (int) (fSdView.getVisibleHeight() / (float) fTest / fSdView.getZoomValue());
}
return super.getContentsHeight();
}
@Override
public int getContentsWidth() {
if (fSdView.getVisibleWidth() > fSdView.getContentsWidth()) {
- return (int) (fSdView.getVisibleWidth() / (float) fTest / fSdView.fZoomValue);
+ return (int) (fSdView.getVisibleWidth() / (float) fTest / fSdView.getZoomValue());
}
return super.getContentsWidth();
}
Image toDel = over;
if (fOverviewCanvas.isFocusControl()) {
- over = new Image(super.getShell().getDisplay(), drawRegionSelected(toDel, new Rectangle(contentsToViewX((int) (row * stepX * fOverviewCanvas.fZoomValue)), contentsToViewY((int) (line * stepY * fOverviewCanvas.fZoomValue)),
- ((int) (stepX * fOverviewCanvas.fZoomValue)), ((int) (stepY * fOverviewCanvas.fZoomValue))), new RGB(0, 0, 128)));
+ over = new Image(super.getShell().getDisplay(), drawRegionSelected(toDel, new Rectangle(contentsToViewX((int) (row * stepX * fOverviewCanvas.getZoomValue())), contentsToViewY((int) (line * stepY * fOverviewCanvas.getZoomValue())),
+ ((int) (stepX * fOverviewCanvas.getZoomValue())), ((int) (stepY * fOverviewCanvas.getZoomValue()))), new RGB(0, 0, 128)));
} else {
- over = new Image(super.getShell().getDisplay(), drawRegionSelected(toDel, new Rectangle(contentsToViewX((int) (row * stepX * fOverviewCanvas.fZoomValue)), contentsToViewY((int) (line * stepY * fOverviewCanvas.fZoomValue)),
- ((int) (stepX * fOverviewCanvas.fZoomValue)), ((int) (stepY * fOverviewCanvas.fZoomValue))), new RGB(221, 208, 200)));
+ over = new Image(super.getShell().getDisplay(), drawRegionSelected(toDel, new Rectangle(contentsToViewX((int) (row * stepX * fOverviewCanvas.getZoomValue())), contentsToViewY((int) (line * stepY * fOverviewCanvas.getZoomValue())),
+ ((int) (stepX * fOverviewCanvas.getZoomValue())), ((int) (stepY * fOverviewCanvas.getZoomValue()))), new RGB(221, 208, 200)));
}
toDel.dispose();
}
row--;
Image toDel = over;
- over = new Image(super.getShell().getDisplay(), drawRegionSelected(toDel, new Rectangle(contentsToViewX((int) (row * stepX * fOverviewCanvas.fZoomValue)), contentsToViewY((int) (line * stepY * fOverviewCanvas.fZoomValue)),
- ((int) (stepX * fOverviewCanvas.fZoomValue)), ((int) (stepY * fOverviewCanvas.fZoomValue))), new RGB(221, 208, 200)));
+ over = new Image(super.getShell().getDisplay(), drawRegionSelected(toDel, new Rectangle(contentsToViewX((int) (row * stepX * fOverviewCanvas.getZoomValue())), contentsToViewY((int) (line * stepY * fOverviewCanvas.getZoomValue())),
+ ((int) (stepX * fOverviewCanvas.getZoomValue())), ((int) (stepY * fOverviewCanvas.getZoomValue()))), new RGB(221, 208, 200)));
toDel.dispose();
}
computeStepXY();
Image d;
- int lw = (int) (getContentsWidth() / fZoomValue);
+ int lw = (int) (getContentsWidth() / getZoomValue());
if (getContentsWidth() < getVisibleWidth()) {
- lw = (int) (getVisibleWidth() / fZoomValue);
+ lw = (int) (getVisibleWidth() / getZoomValue());
}
- int lh = (int) (getContentsHeight() / fZoomValue);
+ int lh = (int) (getContentsHeight() / getZoomValue());
if (getContentsHeight() < getVisibleHeight()) {
- lh = (int) (getVisibleHeight() / fZoomValue);
+ lh = (int) (getVisibleHeight() / getZoomValue());
}
d = createPagesSelectionImages(dbuffer, lw, fStepX, lh, fStepY);
if (row == 0) {
line--;
}
- if ((line + 1) * fStepY > (fOverviewCanvas.getContentsY() + fOverviewCanvas.getVisibleHeight()) / fOverviewCanvas.fZoomValue) {
- fOverviewCanvas.scrollBy(0, (int) (fStepY * fOverviewCanvas.fZoomValue));
+ if ((line + 1) * fStepY > (fOverviewCanvas.getContentsY() + fOverviewCanvas.getVisibleHeight()) / fOverviewCanvas.getZoomValue()) {
+ fOverviewCanvas.scrollBy(0, (int) (fStepY * fOverviewCanvas.getZoomValue()));
}
}
if (e.keyCode == SWT.ARROW_UP) {
if (row == 0) {
line--;
}
- if ((line) * fStepY <= fOverviewCanvas.getContentsY() / fOverviewCanvas.fZoomValue) {
- fOverviewCanvas.scrollBy(0, -(int) (fStepY * fOverviewCanvas.fZoomValue));
+ if ((line) * fStepY <= fOverviewCanvas.getContentsY() / fOverviewCanvas.getZoomValue()) {
+ fOverviewCanvas.scrollBy(0, -(int) (fStepY * fOverviewCanvas.getZoomValue()));
}
}
if (e.keyCode == SWT.ARROW_LEFT) {
fPageNum--;
}
int row = fPageNum % getNbRow();
- if ((row - 1) * fStepX < (fOverviewCanvas.getContentsX()) / fOverviewCanvas.fZoomValue) {
- fOverviewCanvas.scrollBy(-(int) (fStepX * fOverviewCanvas.fZoomValue), 0);
+ if ((row - 1) * fStepX < (fOverviewCanvas.getContentsX()) / fOverviewCanvas.getZoomValue()) {
+ fOverviewCanvas.scrollBy(-(int) (fStepX * fOverviewCanvas.getZoomValue()), 0);
}
}
if (e.keyCode == SWT.ARROW_RIGHT) {
if (row == 0) {
row = getNbRow();
}
- if ((row) * fStepX > (fOverviewCanvas.getContentsX() + fOverviewCanvas.getVisibleWidth()) / fOverviewCanvas.fZoomValue) {
- fOverviewCanvas.scrollBy((int) (fStepX * fOverviewCanvas.fZoomValue), 0);
+ if ((row) * fStepX > (fOverviewCanvas.getContentsX() + fOverviewCanvas.getVisibleWidth()) / fOverviewCanvas.getZoomValue()) {
+ fOverviewCanvas.scrollBy((int) (fStepX * fOverviewCanvas.getZoomValue()), 0);
}
}
protected void contentsMouseDownEvent(MouseEvent event) {
computeStepXY();
- int x1 = (int) ((event.x / fOverviewCanvas.fZoomValue) / fStepX);
- int x2 = (int) ((event.y / fOverviewCanvas.fZoomValue) / fStepY);
+ int x1 = (int) ((event.x / fOverviewCanvas.getZoomValue()) / fStepX);
+ int x2 = (int) ((event.y / fOverviewCanvas.getZoomValue()) / fStepY);
int oldPage = fPageNum;
fTest = 10;
}
fOverviewCanvas.setFrame(fSdView.getFrame(), true);
- fOverviewCanvas.fZoomValue = (float) 1 / fTest;
+ fOverviewCanvas.setZoomValue((float) 1 / fTest);
fOverviewCanvas.setCornerControl(null);
seqDiagLayoutData.widthHint = fOverviewCanvas.getContentsWidth() / fTest;
seqDiagLayoutData.widthHint = fOverviewCanvas.getFrame().getWidth() / fTest + 15;
@Override
public void mouseHover(MouseEvent e) {
- int x1 = (int) (fOverviewCanvas.viewToContentsX(e.x) / fOverviewCanvas.fZoomValue / fStepX);
- int x2 = (int) (fOverviewCanvas.viewToContentsY(e.y) / fOverviewCanvas.fZoomValue / fStepY);
+ int x1 = (int) (fOverviewCanvas.viewToContentsX(e.x) / fOverviewCanvas.getZoomValue() / fStepX);
+ int x2 = (int) (fOverviewCanvas.viewToContentsY(e.y) / fOverviewCanvas.getZoomValue() / fStepY);
int num = x1 + x2 * getNbRow() + 1;
if (num > maxNumOfPages()) {
return;
* Computes value for X coordinates step and Y coordinates step.
*/
protected void computeStepXY() {
- float cw = fOverviewCanvas.getContentsWidth() / fOverviewCanvas.fZoomValue;
- float ch = fOverviewCanvas.getContentsHeight() / fOverviewCanvas.fZoomValue;
+ float cw = fOverviewCanvas.getContentsWidth() / fOverviewCanvas.getZoomValue();
+ float ch = fOverviewCanvas.getContentsHeight() / fOverviewCanvas.getZoomValue();
try {
if (fPrinterData == null) {
fStepX = 0;
*/
public int getNbRow() {
if (!fSetHPagesNumber.isDisposed()) {
- int cw = (int) (fOverviewCanvas.getContentsWidth() / fOverviewCanvas.fZoomValue);
+ int cw = (int) (fOverviewCanvas.getContentsWidth() / fOverviewCanvas.getZoomValue());
int row = 1;
if (fStepX != 0) {
row = (int) (cw / fStepX);
*/
public int getNbLines() {
if (!fSetVPagesNumber.isDisposed()) {
- int ch = (int) (fOverviewCanvas.getContentsHeight() / fOverviewCanvas.fZoomValue);
+ int ch = (int) (fOverviewCanvas.getContentsHeight() / fOverviewCanvas.getZoomValue());
int line = 1;
if (fStepY != 0) {
line = (int) (ch / fStepY);
/**
* The sequence diagram view reference.
*/
- protected SDView fSdView = null;
+ private final SDView fSdView;
/**
* The tab with the controls for a Criteria
*/
- protected TabFolder fTabFolder = null;
+ private final TabFolder fTabFolder = null;
/**
* The Criteria updated by this dialog
*/
- protected Criteria fCriteria = null;
+ private Criteria fCriteria = null;
/**
* The find/filter provider telling which graph nodes are supported
*/
- protected ISDGraphNodeSupporter fProvider = null;
+ final private ISDGraphNodeSupporter fProvider;
/**
* The okText is the text for the Ok button and title is the title of the
/**
* A graph node type listener implementation.
*/
- protected GraphNodeTypeListener fGraphNodeTypeListener = null;
+ private final GraphNodeTypeListener fGraphNodeTypeListener;
/**
* A expression listener implementation.
*/
- protected ExpressionListener fExpressionListener = null;
+ private final ExpressionListener fExpressionListener;
/**
* The button for lifelines.
*/
- protected Button fLifelineButton = null;
+ private Button fLifelineButton;
/**
* The button for stops.
*/
- protected Button fStopButton = null;
+ private Button fStopButton = null;
/**
* The button for synchronous messages
*/
- protected Button fSynMessageButton = null;
+ private Button fSynMessageButton = null;
/**
* The button for synchronous return messages
*/
- protected Button fSynMessageReturnButton = null;
+ private Button fSynMessageReturnButton = null;
/**
* The button for asynchronous messages
*/
- protected Button fAsynMessageButton = null;
+ private Button fAsynMessageButton = null;
/**
* The button for asynchronous return messages
*/
- protected Button fAsynMessageReturnButton = null;
+ private Button fAsynMessageReturnButton = null;
/**
* The search text combo box.
*/
- protected Combo fSearchText = null;
+ private Combo fSearchText = null;
/**
* The group for selection kind.
*/
- protected Group fKindSelection = null;
+ private Group fKindSelection = null;
/**
* The button for case sensitive expressions.
*/
- protected Button fCaseSensitive = null;
+ private Button fCaseSensitive = null;
/**
* The label for the result string.
*/
- protected Label fResult = null;
+ private Label fResult = null;
/**
* The button for notifying parent about valid data.
*/
- protected Button fParentOkButton = null;
+ private Button fParentOkButton = null;
// ------------------------------------------------------------------------
// Constructors
/**
* The color object.
*/
- protected Color fColor = null;
+ private final Color fColor;
/**
* Flag to indicate that this object is managing the resource.
*/
- protected boolean fManageColor = true;
+ private boolean fManageColor = true;
// ------------------------------------------------------------------------
// Constructors
/**
* The font object
*/
- protected Font fFont = null;
+ private final Font fFont;
/**
* Flag to indicate that this object is managing the resource.
*/
/**
* The image reference
*/
- protected Image fImage = null;
+ private final Image fImage;
// ------------------------------------------------------------------------
// Constructors
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2013 Ericsson
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
+
+/**
+ * Base class for sequence diagram actions.
+ *
+ * @author Bernd Hufmann
+ * @since 2.0
+ */
+public class BaseSDAction extends Action {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+ /**
+ * The sequence diagram view reference.
+ */
+ private SDView fView = null;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+ /**
+ * Default constructor
+ */
+ public BaseSDAction() {
+ this(null);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param view
+ * a sequence diagram view reference
+ */
+ public BaseSDAction(SDView view) {
+ super();
+ fView = view;
+ }
+
+ /**
+ * Constructor
+ * @param view
+ * a sequence diagram view reference
+ * @param text
+ * The action text
+ * @param style
+ * The style
+ */
+ protected BaseSDAction(SDView view, String text, int style) {
+ super(text, style);
+ fView = view;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * Sets the active SD view.
+ *
+ * @param view The SD view.
+ */
+ public void setView(SDView view) {
+ fView = view;
+ }
+
+ /**
+ * Gets the active SD view.
+ *
+ * @return view The SD view.
+ * @since 2.0
+ */
+ public SDView getView() {
+ return fView;
+ }
+}
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.dialogs.MinMaxDialog;
-import org.eclipse.ui.IViewPart;
/**
* Action class implementation to configure minimum and maximum time range values.
* @author sveyrier
*
*/
-public class ConfigureMinMax extends Action {
+public class ConfigureMinMax extends BaseSDAction {
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
/**
- * The corresponding sequence diagram view reference.
+ * Constructor
+ * @param view
+ * the sequence diagram view reference
+ * @since 2.0
*/
- protected SDView fView = null;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Standard constructor.
- *
- * @param view The sequence diagram view for the action
- */
- public ConfigureMinMax(IViewPart view) {
- super();
- if (view instanceof SDView) {
- fView = (SDView) view;
- }
+ public ConfigureMinMax(SDView view) {
+ super(view);
}
-
// ------------------------------------------------------------------------
// Methods
// ------------------------------------------------------------------------
-
@Override
public void run() {
- if ((fView != null) && (fView.getSDWidget() != null)) {
- MinMaxDialog minMax = new MinMaxDialog(fView.getSite().getShell(), fView.getSDWidget());
+ if ((getView() != null) && (getView().getSDWidget() != null)) {
+ MinMaxDialog minMax = new MinMaxDialog(getView().getSite().getShell(), getView().getSDWidget());
minMax.open();
}
}
**********************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
-import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.Messages;
* @version 1.0
* @author Bernd Hufmann
*/
-public class FirstPage extends Action {
+public class FirstPage extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
*/
public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.firstpage"; //$NON-NLS-1$
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * The sequence diagram view reference
- */
- protected SDView fView = null;
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
* @param view the view reference
*/
public FirstPage(SDView view) {
- super();
- fView = view;
+ super(view);
setText(Messages.SequenceDiagram_FirstPage);
setToolTipText(Messages.SequenceDiagram_GoToFirstPage);
setId(ID);
@Override
public void run() {
- if ((fView == null) || (fView.getSDWidget()) == null) {
+ if ((getView() == null) || (getView().getSDWidget()) == null) {
return;
}
- if (fView.getSDPagingProvider() != null) {
- fView.getSDPagingProvider().firstPage();
+ if (getView().getSDPagingProvider() != null) {
+ getView().getSDPagingProvider().firstPage();
}
- fView.updateCoolBar();
- fView.getSDWidget().redraw();
+ getView().updateCoolBar();
+ getView().getSDWidget().redraw();
}
}
**********************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
-import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.Messages;
* @version 1.0
* @author Bernd Hufmann
*/
-public class LastPage extends Action {
+public class LastPage extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
*/
public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.lastpage"; //$NON-NLS-1$
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * The sequence diagram view reference
- */
- protected SDView fView = null;
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
* @param view the view reference
*/
public LastPage(SDView view) {
- super();
- fView = view;
+ super(view);
setText(Messages.SequenceDiagram_LastPage);
setToolTipText(Messages.SequenceDiagram_GoToLastPage);
setId(ID);
@Override
public void run() {
- if ((fView == null) || (fView.getSDWidget()) == null) {
+ if ((getView() == null) || (getView().getSDWidget()) == null) {
return;
}
- if (fView.getSDPagingProvider() != null) {
- fView.getSDPagingProvider().lastPage();
+ if (getView().getSDPagingProvider() != null) {
+ getView().getSDPagingProvider().lastPage();
}
- fView.updateCoolBar();
- fView.getSDWidget().redraw();
+ getView().updateCoolBar();
+ getView().getSDWidget().redraw();
}
}
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDWidget;
* @author sveyrier
*
*/
-public class MoveSDDown extends Action {
+public class MoveSDDown extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
*/
public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.MoveSDDown"; //$NON-NLS-1$
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
- /**
- * The sequence diagram view reference.
- */
- protected SDView fView = null;
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
* @param view a sequence diagram view reference
*/
public MoveSDDown(SDView view) {
- super();
+ super(view);
setId(ID);
setActionDefinitionId(ID);
- fView = view;
}
// ------------------------------------------------------------------------
// Methods
// ------------------------------------------------------------------------
-
@Override
public void run() {
- if (fView == null) {
+ if (getView() == null) {
return;
}
- SDWidget viewer = fView.getSDWidget();
+ SDWidget viewer = getView().getSDWidget();
if (viewer != null) {
viewer.scrollBy(0, +viewer.getVisibleHeight());
}
}
-
- /**
- * Sets the active SD view.
- *
- * @param view The SD view.
- */
- public void setView(SDView view) {
- fView = view;
- }
}
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDWidget;
* @author sveyrier
*
*/
-public class MoveSDLeft extends Action {
+public class MoveSDLeft extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
*/
public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.MoveSDLeft"; //$NON-NLS-1$
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
- /**
- * The sequence diagram view reference.
- */
- protected SDView fView = null;
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
* @param view a sequence diagram view reference
*/
public MoveSDLeft(SDView view) {
- super();
+ super(view);
setId(ID);
setActionDefinitionId(ID);
- fView = view;
}
// ------------------------------------------------------------------------
@Override
public void run() {
- if (fView == null) {
+ if (getView() == null) {
return;
}
- SDWidget viewer = fView.getSDWidget();
+ SDWidget viewer = getView().getSDWidget();
if (viewer != null) {
viewer.scrollBy(-viewer.getVisibleWidth(), 0);
}
}
-
- /**
- * Sets the active SD view.
- *
- * @param view The SD view.
- */
- public void setView(SDView view) {
- fView = view;
- }
}
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDWidget;
*
*/
-public class MoveSDRight extends Action {
+public class MoveSDRight extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
*/
public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.MoveSDRight"; //$NON-NLS-1$
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
- /**
- * The sequence diagram view reference.
- */
- protected SDView fView = null;
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
* @param view a sequence diagram view reference
*/
public MoveSDRight(SDView view) {
- super();
+ super(view);
setId(ID);
setActionDefinitionId(ID);
- fView = view;
}
// ------------------------------------------------------------------------
@Override
public void run() {
- if (fView == null) {
+ if (getView() == null) {
return;
}
- SDWidget viewer = fView.getSDWidget();
+ SDWidget viewer = getView().getSDWidget();
if (viewer != null) {
viewer.scrollBy(+viewer.getVisibleWidth(), 0);
}
}
-
- /**
- * Sets the active SD view.
- *
- * @param view The SD view.
- */
- public void setView(SDView view) {
- fView = view;
- }
}
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDWidget;
* @version 1.0
* @author sveyrier
*/
-public class MoveSDUp extends Action {
+public class MoveSDUp extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
*/
public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.MoveSDUp"; //$NON-NLS-1$
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
- /**
- * The sequence diagram view reference.
- */
- protected SDView fView = null;
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
* @param view a sequence diagram view reference
*/
public MoveSDUp(SDView view) {
- super();
+ super(view);
setId(ID);
setActionDefinitionId(ID);
- fView = view;
}
// ------------------------------------------------------------------------
@Override
public void run() {
- if (fView == null) {
+ if (getView() == null) {
return;
}
- SDWidget viewer = fView.getSDWidget();
+ SDWidget viewer = getView().getSDWidget();
if (viewer != null) {
viewer.scrollBy(0, -viewer.getVisibleHeight());
}
}
-
- /**
- * Sets the active SD view.
- * @param view The SD view.
- */
- public void setView(SDView view) {
- fView = view;
- }
}
import java.util.Iterator;
-import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDWidget;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.BaseMessage;
* @author sveyrier
*
*/
-public class MoveToMessage extends Action {
+public class MoveToMessage extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
*/
public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.GoToMessage"; //$NON-NLS-1$
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
- /**
- * The sequence diagram view reference.
- */
- protected SDView fView = null;
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
* @param view a sequence diagram view reference
*/
public MoveToMessage(SDView view) {
- super();
+ super(view);
setId(ID);
setActionDefinitionId(ID);
setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH_MATCH));
- fView = view;
}
// ------------------------------------------------------------------------
@Override
public void run() {
- if (fView == null) {
+ if (getView() == null) {
return;
}
- SDWidget sdWidget = fView.getSDWidget();
+ SDWidget sdWidget = getView().getSDWidget();
if (sdWidget == null) {
return;
sdWidget.clearSelection();
sdWidget.addSelection(node);
sdWidget.ensureVisible(node);
- // sdWidget.setFocusNode(node);
sdWidget.redraw();
} else if (selectedNode instanceof SyncMessage) {
GraphNode node = ((SyncMessage) selectedNode).getMessageReturn();
sdWidget.clearSelection();
sdWidget.addSelection(node);
sdWidget.ensureVisible(node);
- // sdWidget.setFocusNode(node);
sdWidget.redraw();
}
}
-
- /**
- * Sets the active SD view.
- *
- * @param view The SD view.
- */
- public void setView(SDView view) {
- fView = view;
- }
}
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
-import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.Messages;
* @author sveyrier
*
*/
-public class NextPage extends Action {
+public class NextPage extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
*/
public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.nextpage"; //$NON-NLS-1$
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
- /**
- * The sequence diagram view reference.
- */
- protected SDView fView = null;
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
* @param view the view reference
*/
public NextPage(SDView view) {
- super();
- fView = view;
+ super(view);
setText(Messages.SequenceDiagram_NextPage);
setToolTipText(Messages.SequenceDiagram_GoToNextPage);
setId(ID);
@Override
public void run() {
- if ((fView == null) || (fView.getSDWidget()) == null) {
+ if ((getView() == null) || (getView().getSDWidget()) == null) {
return;
}
- if (fView.getSDPagingProvider() != null) {
- fView.getSDPagingProvider().nextPage();
+ if (getView().getSDPagingProvider() != null) {
+ getView().getSDPagingProvider().nextPage();
}
- fView.updateCoolBar();
- fView.getSDWidget().redraw();
+ getView().updateCoolBar();
+ getView().getSDWidget().redraw();
}
}
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
* @version 1.0
* @author sveyrier
*/
-public class OpenSDFiltersDialog extends Action {
+public class OpenSDFiltersDialog extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
*/
public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.sdFilters"; //$NON-NLS-1$
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
- /**
- * The sequence diagram view reference
- */
- protected SDView fView;
-
/**
* The filter provider reference
*/
- protected ISDFilterProvider fProvider;
+ private final ISDFilterProvider fProvider;
// ------------------------------------------------------------------------
// Constructors
* The provider
*/
public OpenSDFiltersDialog(SDView view, ISDFilterProvider provider) {
- super(Messages.SequenceDiagram_HidePatterns);
+ super(view);
+ setText(Messages.SequenceDiagram_HidePatterns);
setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_FILTERS));
setId(ID);
setToolTipText(Messages.SequenceDiagram_HidePatterns);
- fView = view;
fProvider = provider;
}
@Override
public void run() {
- if (fView == null) {
+ if (getView() == null) {
return;
}
- FilterListDialog dialog = new FilterListDialog(fView, fProvider);
+ FilterListDialog dialog = new FilterListDialog(getView(), fProvider);
dialog.open();
}
}
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
-import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.dialogs.SearchFilterDialog;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.Messages;
* @author sveyrier
*
*/
-public class OpenSDFindDialog extends Action {
+public class OpenSDFindDialog extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
* The action ID.
*/
public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.sdFind"; //$NON-NLS-1$
+
/**
* The action definition ID.
*/
public final static String ACTION_DEFINITION_ID = "org.eclipse.ui.edit.findReplace"; //$NON-NLS-1$
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
- /**
- * The sequence diagram view reference
- */
- protected SDView fView;
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
* @param view The view reference
*/
public OpenSDFindDialog(SDView view) {
- super(Messages.SequenceDiagram_Find + "..."); //$NON-NLS-1$
+ super(view);
+ setText(Messages.SequenceDiagram_Find + "..."); //$NON-NLS-1$
setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH_SEQ));
setId(ID);
setActionDefinitionId(ACTION_DEFINITION_ID);
setToolTipText(Messages.SequenceDiagram_Find + "..."); //$NON-NLS-1$
- fView = view;
}
// ------------------------------------------------------------------------
@Override
public void run() {
- if (fView == null) {
+ if (getView() == null) {
return;
}
this.setEnabled(false);
try {
- if ((fView.getExtendedFindProvider() != null) && (fView.getExtendedFindProvider().getFindAction() != null)) {
- fView.getExtendedFindProvider().getFindAction().run();
- } else if (fView.getSDFindProvider() != null) {
- SearchFilterDialog dialog = new SearchFilterDialog(fView, fView.getSDFindProvider(), false, SWT.NORMAL);
+ if ((getView().getExtendedFindProvider() != null) && (getView().getExtendedFindProvider().getFindAction() != null)) {
+ getView().getExtendedFindProvider().getFindAction().run();
+ } else if (getView().getSDFindProvider() != null) {
+ SearchFilterDialog dialog = new SearchFilterDialog(getView(), getView().getSDFindProvider(), false, SWT.NORMAL);
dialog.open();
}
} finally {
this.setEnabled(true);
}
}
-
- /**
- * Sets the active SD view.
- *
- * @param view The SD view.
- */
- public void setView(SDView view) {
- fView = view;
- }
}
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
* @version 1.0
* @author Bernd Hufmann
*/
-public class OpenSDPagesDialog extends Action {
+public class OpenSDPagesDialog extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
// Attributes
// ------------------------------------------------------------------------
- /**
- * The sequence diagram view reference
- */
- protected SDView fView;
/**
* The advanced paging provider reference.
*/
- protected ISDAdvancedPagingProvider fProvider;
+ private final ISDAdvancedPagingProvider fProvider;
// ------------------------------------------------------------------------
// Constructors
* The provider
*/
public OpenSDPagesDialog(SDView view, ISDAdvancedPagingProvider provider) {
- super(Messages.SequenceDiagram_Pages);
+ super(view);
+ setText(Messages.SequenceDiagram_Pages);
setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_GOTO_PAGE));
setId(ID);
- fView = view;
fProvider = provider;
}
@Override
public void run() {
- if (fView == null) {
+ if (getView() == null) {
return;
}
- PagesDialog dialog = new PagesDialog(fView, fProvider);
+ PagesDialog dialog = new PagesDialog(getView(), fProvider);
dialog.open();
}
}
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
-import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.Messages;
* @author sveyrier
*
*/
-public class PrevPage extends Action {
+public class PrevPage extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
*/
public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.prevpage"; //$NON-NLS-1$
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * The sequence diagram view reference.
- */
- protected SDView fView = null;
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
* @param view the view reference
*/
public PrevPage(SDView view) {
- super();
- fView = view;
+ super(view);
setText(Messages.SequenceDiagram_PreviousPage);
setToolTipText(Messages.SequenceDiagram_GoToPreviousPage);
setId(ID);
@Override
public void run() {
- if ((fView == null) || (fView.getSDWidget()) == null) {
+ if ((getView() == null) || (getView().getSDWidget()) == null) {
return;
}
- if (fView.getSDPagingProvider() != null) {
- fView.getSDPagingProvider().prevPage();
+ if (getView().getSDPagingProvider() != null) {
+ getView().getSDPagingProvider().prevPage();
}
- fView.updateCoolBar();
- fView.getSDWidget().redraw();
+ getView().updateCoolBar();
+ getView().getSDWidget().redraw();
}
}
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
/**
* @version 1.0
* @author sveyrier
*/
-public class Print extends Action {
+public class Print extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
*/
public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.print"; //$NON-NLS-1$
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * The sequence diagram view reference
- */
- private SDView fView;
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
* @param view The view reference
*/
public Print(SDView view) {
- super();
+ super(view);
setId(ID);
- fView = view;
}
// ------------------------------------------------------------------------
@Override
public void run() {
- if ((fView == null) || fView.getSDWidget() == null){
+ if ((getView() == null) || getView().getSDWidget() == null){
return;
}
- fView.getSDWidget().print();
+ getView().getSDWidget().print();
}
}
import java.util.Iterator;
-import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDWidget;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
-import org.eclipse.ui.IViewPart;
/**
* Action class implementation to show end of a graph node.
* @version 1.0
* @author sveyrier
*/
-public class ShowNodeEnd extends Action {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
- /**
- * The sequence diagram view reference
- */
- protected SDView fView = null;
+public class ShowNodeEnd extends BaseSDAction {
// ------------------------------------------------------------------------
// Constructors
* Constructor
*
* @param view The sequence diagram view reference
+ * @since 2.0
*/
- public ShowNodeEnd(IViewPart view) {
- super();
- if (view instanceof SDView) {
- fView = (SDView)view;
- }
+ public ShowNodeEnd(SDView view) {
+ super(view);
setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_NODE_END));
}
@Override
@SuppressWarnings("rawtypes")
public void run() {
- if (fView == null) {
+ if (getView() == null) {
return;
}
- SDWidget sdWidget = fView.getSDWidget();
+ SDWidget sdWidget = getView().getSDWidget();
if (sdWidget == null) {
return;
}
}
}
-
- /**
- * Sets the active SD view.
- *
- * @param view The SD view.
- */
- public void setView(SDView view) {
- fView = view;
- }
}
import java.util.Iterator;
-import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDWidget;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
-import org.eclipse.ui.IViewPart;
/**
* Action class implementation to show end of a graph node.
* @version 1.0
* @author sveyrier
*/
-public class ShowNodeStart extends Action {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * The sequence diagram view reference
- */
- protected SDView fView = null;
+public class ShowNodeStart extends BaseSDAction {
// ------------------------------------------------------------------------
// Constructors
*
* @param view
* The sequence diagram view reference
+ * @since 2.0
*/
- public ShowNodeStart(IViewPart view) {
- super();
- if (view instanceof SDView) {
- fView = (SDView) view;
- }
+ public ShowNodeStart(SDView view) {
+ super(view);
setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_NODE_START));
}
@Override
@SuppressWarnings("rawtypes")
public void run() {
- if (fView == null) {
+ if (getView() == null) {
return;
}
- SDWidget sdWidget = fView.getSDWidget();
+ SDWidget sdWidget = getView().getSDWidget();
if (sdWidget == null) {
return;
}
}
}
-
- /**
- * Sets the active SD view.
- *
- * @param view
- * The SD view.
- */
- public void setView(SDView view) {
- fView = view;
- }
}
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
* @author sveyrier
*
*/
-public class Zoom extends Action {
+public class Zoom extends BaseSDAction {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
- /**
- * The sequence diagram view reference
- */
- protected SDView fView = null;
/**
* Flag to indicate last zoom in.
*/
- protected boolean fLastZoomIn = false;
+ private boolean fLastZoomIn = false;
/**
* Flag to indicate last zoom out.
*/
- protected boolean fLastZoomOut = false;
- /**
- * Flag to indicate last zoom.
- */
- protected boolean fLastZoom = true;
+ private boolean fLastZoomOut = false;
/**
* The cursor used when zooming in.
*/
* @param type The type of zoom.
*/
public Zoom(SDView view, ZoomType type) {
- super("", AS_RADIO_BUTTON);//$NON-NLS-1$
-
- fView = view;
+ super(view, "", AS_RADIO_BUTTON); //$NON-NLS-1$
// Pre-create zooming cursors
fZoomInCursor = new Cursor(Display.getCurrent(),
@Override
public void run() {
- if ((fView == null) || (fView.getSDWidget() == null)) {
+ if ((getView() == null) || (getView().getSDWidget() == null)) {
return;
}
- SDWidget viewer = fView.getSDWidget();
+ SDWidget viewer = getView().getSDWidget();
if (getId().equals(ZOOM_OUT_ID)) {
// Eclipse 3.0 M7 workaround
viewer.setZoomOutMode(isChecked());
fLastZoomOut = isChecked();
- fLastZoom = false;
if (isChecked()) {
viewer.setCursor(fZoomOutCursor);
setActionChecked(NO_ZOOM_ID, false);
viewer.setZoomInMode(isChecked());
fLastZoomIn = isChecked();
- fLastZoom = false;
if (isChecked()) {
viewer.setCursor(fZoomInCursor);
setActionChecked(NO_ZOOM_ID, false);
// The reset action is a radio button only to uncheck the zoom in and out button
// when it is clicked. This avoid adding code to do it manually
// We only have to force it to false every time
- fLastZoom = false;
setChecked(false);
setActionChecked(NO_ZOOM_ID, true);
} else if (getId().equals(NO_ZOOM_ID)) {
* @param checked true to check the action, false to uncheck the action
*/
protected void setActionChecked(String id, boolean checked) {
- if (fView != null) {
- IActionBars bar = fView.getViewSite().getActionBars();
+ if (getView() != null) {
+ IActionBars bar = getView().getViewSite().getActionBars();
if (bar == null) {
return;
}
/**
* Map for caching information (view ID to loader class)
*/
- protected Map<String, IUml2SDLoader> fViewLoaderMap = new HashMap<String, IUml2SDLoader>();
+ private Map<String, IUml2SDLoader> fViewLoaderMap = new HashMap<String, IUml2SDLoader>();
/**
* Map for caching information (view ID to list of configuration elements)
*/
- protected Map<String, ArrayList<IConfigurationElement>> fViewLoadersList = new HashMap<String, ArrayList<IConfigurationElement>>();
+ private Map<String, ArrayList<IConfigurationElement>> fViewLoadersList = new HashMap<String, ArrayList<IConfigurationElement>>();
// ------------------------------------------------------------------------
// Constructor
/**
* A asynchronous sequence diagram event implementation
*/
- protected ITmfAsyncSequenceDiagramEvent fSdEvent;
+ private ITmfAsyncSequenceDiagramEvent fSdEvent;
// ------------------------------------------------------------------------
// Constructors
/**
* A synchronous sequence diagram event implementation
*/
- protected ITmfSyncSequenceDiagramEvent fSdEvent;
+ private ITmfSyncSequenceDiagramEvent fSdEvent;
// ------------------------------------------------------------------------
// Constructors
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Hashtable;
import java.util.Map;
private static final String[] PREF_TEXT_COLOR_LIST = { PREF_LIFELINE, PREF_SYNC_MESS, PREF_SYNC_MESS_RET, PREF_ASYNC_MESS, PREF_ASYNC_MESS_RET, PREF_LIFELINE_HEADER, PREF_FRAME_NAME };
/**
* Temporary tag
+ * @since 2.0
*/
- protected static final String TEMP_TAG = "_TEMP";//$NON-NLS-1$
+ public static final String TEMP_TAG = "_TEMP";//$NON-NLS-1$
// ------------------------------------------------------------------------
// Attributes
/**
* Hashtable for font preferences
*/
- protected Map<String, IFont> fFontPref;
+ private Map<String, IFont> fFontPref;
+
/**
* Hashtable for foreground color preferences
*/
- protected Map<String, IColor> fForeColorPref;
+ private Map<String, IColor> fForeColorPref;
/**
* Hashtable for background color preferences
*/
- protected Map<String, IColor> fBackColorPref;
+ private Map<String, IColor> fBackColorPref;
/**
* Hashtable for text color preferences
*/
- protected Map<String, IColor> fTextColorPref;
+ private Map<String, IColor> fTextColorPref;
/**
* The reference to the preference store.
*/
- protected IPreferenceStore fPrefStore = null;
+ private IPreferenceStore fPrefStore = null;
/**
* Color for the time compression selection
*/
- protected IColor fTimeCompressionSelectionColor = null;
+ private IColor fTimeCompressionSelectionColor = null;
/**
* Flag whether no focus selection or not.
*/
- protected boolean fNoFocusSelection = false;
+ private boolean fNoFocusSelection = false;
// ------------------------------------------------------------------------
// Constructors
fNoFocusSelection = v;
}
+ /**
+ * Returns a unmodifiable map with font preferences.
+ *
+ * @return map with font preferences
+ * @since 2.0
+ */
+ protected Map<String, IFont> getFontPref() {
+ return Collections.unmodifiableMap(fFontPref);
+ }
+
+ /**
+ * Returns a unmodifiable map with foreground color preferences
+ *
+ * @return map with foreground color preferences
+ * @since 2.0
+ */
+ public Map<String, IColor> getForeColorPref() {
+ return Collections.unmodifiableMap(fForeColorPref);
+ }
+
+ /**
+ * Returns a unmodifiable map with background color preferences
+ *
+ * @return map with background color preferences
+ * @since 2.0
+ */
+ public Map<String, IColor> getBackColorPref() {
+ return Collections.unmodifiableMap(fBackColorPref);
+ }
+
+ /**
+ * Returns a unmodifiable map with text color preferences
+ *
+ * @return map with text color preferences
+ * @since 2.0
+ */
+ public Map<String, IColor> getTextColorPref() {
+ return Collections.unmodifiableMap(fTextColorPref);
+ }
+
+ /**
+ * Returns the preference store.
+ *
+ * @return the preference store
+ * @since 2.0
+ */
+ public IPreferenceStore getPrefStore() {
+ return fPrefStore;
+ }
+
+ /**
+ * Returns flag about focus selection
+ *
+ * @return flag about focus selection
+ * @since 2.0
+ */
+ public boolean isNoFocusSelection() {
+ return fNoFocusSelection;
+ }
+
/**
* Returns the static font list.
*
/**
* Temporary preferences tag
*/
- protected static final String TEMP_TAG = SDViewPref.TEMP_TAG;
+ private static final String TEMP_TAG = SDViewPref.TEMP_TAG;
// ------------------------------------------------------------------------
// Attributes
/**
* The preference handler used to access the PreferenceStore
*/
- protected SDViewPref fPreferences = null;
+ private SDViewPref fPreferences = null;
/**
* BackGround color selector
*/
- protected ColorFieldEditor fLineColor = null;
+ private ColorFieldEditor fLineColor = null;
/**
* Foreground color selector
*/
- protected ColorFieldEditor fBackGroundColor = null;
+ private ColorFieldEditor fBackGroundColor = null;
/**
* Font color selector
*/
- protected ColorFieldEditor fTextColor = null;
+ private ColorFieldEditor fTextColor = null;
/**
* List which display all modifiable sequence Diagram font
*/
- protected List fClassItemList = null;
+ private List fClassItemList = null;
/**
* Font selector (The same is used for each modifiable font)
*/
- protected FontFieldEditor fFont = null;
+ private FontFieldEditor fFont = null;
/**
* Link font when zooming selector
*/
- protected BooleanFieldEditor fLink = null;
+ private BooleanFieldEditor fLink = null;
/**
* Enable tooltip selector
*/
- protected BooleanFieldEditor fTooltip = null;
+ private BooleanFieldEditor fTooltip = null;
/**
* Do not take external time into account in the min max computation
*/
- protected BooleanFieldEditor fNoExternalTime = null;
+ private BooleanFieldEditor fNoExternalTime = null;
/**
* Use gradient color selector
*/
- protected BooleanFieldEditor fUseGrad = null;
+ private BooleanFieldEditor fUseGrad = null;
/**
* A button area.
*/
- protected Composite fButtonArea;
+ private Composite fButtonArea;
/**
* SwimLane width selector
*/
- protected IntegerFieldEditor fLifelineWidth = null;
+ private IntegerFieldEditor fLifelineWidth = null;
// ------------------------------------------------------------------------
// Methods
// and all the fonts and colors
// fonts and colors are stored for each time because
// we are using only one FontFieldEditor
- Set<String> keySet = SDViewPref.getInstance().fFontPref.keySet();
+ Set<String> keySet = SDViewPref.getInstance().getFontPref().keySet();
Iterator<String> it = keySet.iterator();
while (it.hasNext()) {
Object prefName = it.next();
}
}
- keySet = SDViewPref.getInstance().fBackColorPref.keySet();
+ keySet = SDViewPref.getInstance().getBackColorPref().keySet();
it = keySet.iterator();
while (it.hasNext()) {
Object prefName = it.next();
fBackGroundColor.setPreferenceName(fontList[fClassItemList.getSelectionIndex()] + SDViewPref.BACK_COLOR_POSTFIX + TEMP_TAG);
fBackGroundColor.load();
- keySet = SDViewPref.getInstance().fForeColorPref.keySet();
+ keySet = SDViewPref.getInstance().getForeColorPref().keySet();
it = keySet.iterator();
while (it.hasNext()) {
Object prefName = it.next();
fLineColor.setPreferenceName(fontList[fClassItemList.getSelectionIndex()] + SDViewPref.FORE_COLOR_POSTFIX + TEMP_TAG);
fLineColor.load();
- keySet = SDViewPref.getInstance().fTextColorPref.keySet();
+ keySet = SDViewPref.getInstance().getTextColorPref().keySet();
it = keySet.iterator();
while (it.hasNext()) {
Object prefName = it.next();
TAG1 = TEMP_TAG;
TAG2 = "";//$NON-NLS-1$
}
- Set<String> keySet = SDViewPref.getInstance().fFontPref.keySet();
+ Set<String> keySet = SDViewPref.getInstance().getFontPref().keySet();
Iterator<String> it = keySet.iterator();
while (it.hasNext()) {
Object prefName = it.next();
}
}
- keySet = SDViewPref.getInstance().fBackColorPref.keySet();
+ keySet = SDViewPref.getInstance().getBackColorPref().keySet();
it = keySet.iterator();
while (it.hasNext()) {
Object prefName = it.next();
}
}
- keySet = SDViewPref.getInstance().fForeColorPref.keySet();
+ keySet = SDViewPref.getInstance().getForeColorPref().keySet();
it = keySet.iterator();
while (it.hasNext()) {
Object prefName = it.next();
}
}
- keySet = SDViewPref.getInstance().fTextColorPref.keySet();
+ keySet = SDViewPref.getInstance().getTextColorPref().keySet();
it = keySet.iterator();
while (it.hasNext()) {
Object prefName = it.next();