1 /**********************************************************************
2 * Copyright (c) 2005, 2008 IBM Corporation and others.
3 * Copyright (c) 2011, 2012 Ericsson.
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
11 * IBM - Initial API and implementation
12 * Bernd Hufmann - Updated for TMF
13 **********************************************************************/
14 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
;
16 import java
.text
.MessageFormat
;
17 import java
.util
.ArrayList
;
18 import java
.util
.List
;
19 import java
.util
.Timer
;
20 import java
.util
.TimerTask
;
22 import org
.eclipse
.core
.runtime
.IStatus
;
23 import org
.eclipse
.core
.runtime
.Status
;
24 import org
.eclipse
.jface
.contexts
.IContextIds
;
25 import org
.eclipse
.jface
.util
.IPropertyChangeListener
;
26 import org
.eclipse
.jface
.util
.PropertyChangeEvent
;
27 import org
.eclipse
.jface
.viewers
.ISelectionProvider
;
28 import org
.eclipse
.jface
.viewers
.StructuredSelection
;
29 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.ITmfImageConstants
;
30 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.TmfUiPlugin
;
31 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfTimestamp
;
32 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimestamp
;
33 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.core
.BaseMessage
;
34 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.core
.BasicExecutionOccurrence
;
35 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.core
.Frame
;
36 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.core
.GraphNode
;
37 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.core
.ITimeRange
;
38 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.core
.Lifeline
;
39 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.core
.Metrics
;
40 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.dialogs
.SDPrintDialog
;
41 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.dialogs
.SDPrintDialogUI
;
42 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.drawings
.IColor
;
43 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.handlers
.provider
.ISDCollapseProvider
;
44 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.load
.LoadersManager
;
45 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.preferences
.ISDPreferences
;
46 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.preferences
.SDViewPref
;
47 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.util
.SDMessages
;
48 import org
.eclipse
.swt
.SWT
;
49 import org
.eclipse
.swt
.accessibility
.ACC
;
50 import org
.eclipse
.swt
.accessibility
.Accessible
;
51 import org
.eclipse
.swt
.accessibility
.AccessibleAdapter
;
52 import org
.eclipse
.swt
.accessibility
.AccessibleControlAdapter
;
53 import org
.eclipse
.swt
.accessibility
.AccessibleControlEvent
;
54 import org
.eclipse
.swt
.accessibility
.AccessibleEvent
;
55 import org
.eclipse
.swt
.events
.DisposeEvent
;
56 import org
.eclipse
.swt
.events
.DisposeListener
;
57 import org
.eclipse
.swt
.events
.FocusEvent
;
58 import org
.eclipse
.swt
.events
.FocusListener
;
59 import org
.eclipse
.swt
.events
.KeyEvent
;
60 import org
.eclipse
.swt
.events
.MouseEvent
;
61 import org
.eclipse
.swt
.events
.SelectionEvent
;
62 import org
.eclipse
.swt
.events
.SelectionListener
;
63 import org
.eclipse
.swt
.events
.TraverseEvent
;
64 import org
.eclipse
.swt
.events
.TraverseListener
;
65 import org
.eclipse
.swt
.graphics
.GC
;
66 import org
.eclipse
.swt
.graphics
.Image
;
67 import org
.eclipse
.swt
.graphics
.ImageData
;
68 import org
.eclipse
.swt
.graphics
.Rectangle
;
69 import org
.eclipse
.swt
.printing
.Printer
;
70 import org
.eclipse
.swt
.printing
.PrinterData
;
71 import org
.eclipse
.swt
.widgets
.Canvas
;
72 import org
.eclipse
.swt
.widgets
.Caret
;
73 import org
.eclipse
.swt
.widgets
.Composite
;
74 import org
.eclipse
.swt
.widgets
.Control
;
75 import org
.eclipse
.swt
.widgets
.Display
;
76 import org
.eclipse
.swt
.widgets
.Event
;
77 import org
.eclipse
.swt
.widgets
.Listener
;
78 import org
.eclipse
.swt
.widgets
.MenuItem
;
79 import org
.eclipse
.ui
.contexts
.IContextService
;
80 import org
.eclipse
.ui
.part
.ViewPart
;
84 * This class implements sequence diagram widget used in the sequence diagram view.
91 public class SDWidget
extends ScrollView
implements SelectionListener
, IPropertyChangeListener
, DisposeListener
, ITimeCompressionListener
{
93 // ------------------------------------------------------------------------
95 // ------------------------------------------------------------------------
98 * The frame to display in the sequence diagram widget.
100 protected Frame fFrame
;
102 * The overview image to display.
104 protected Image fOverView
= null;
106 * The zoom in menu item.
108 protected MenuItem fZoomIn
= null;
110 * The zoom out menu item.
112 protected MenuItem fZoomOut
= null;
114 * The sequence diagram selection provider.
116 protected SDWidgetSelectionProvider fSelProvider
= null;
118 * The current zoom value.
120 public float fZoomValue
= 1;
122 * The current zoomInMode (true for zoom in).
124 protected boolean fZoomInMode
= false;
126 * The current zoomOutMode (true for zoom out).
128 protected boolean fZoomOutMode
= false;
130 * The current list of selected graph nodes.
132 protected List
<GraphNode
> fSelectedNodeList
= null;
134 * Flag whether ctrl button is selected or not.
136 protected boolean fCtrlSelection
= false;
138 * A reference to the view site.
140 protected ViewPart fSite
= null;
142 * The current graph node (the last selected one).
144 public GraphNode fCurrentGraphNode
= null;
146 * The first graph node in list (multiple selection).
148 public GraphNode fListStart
= null;
150 * The previous graph node (multiple selection).
152 public List
<GraphNode
> fPrevList
= null;
154 * The time compression bar.
156 protected TimeCompressionBar fTimeBar
= null;
158 * The current diagram tool tip.
160 protected DiagramToolTip fToolTip
= null;
162 * The accessible object reference of view control.
164 protected Accessible fAccessible
= null;
166 * The current node for the tooltip to display.
168 protected GraphNode fToolTipNode
;
170 * The life line to drag and drop.
172 protected Lifeline fDragAndDrop
= null;
174 * The number of focused widgets.
176 protected int fFocusedWidget
= -1;
180 protected float fPrinterZoom
= 0;
182 * Y coordinate for printer.
184 protected int fPrinterY
= 0;
186 * X coordinate for printer.
188 protected int fPrinterX
= 0;
190 * Flag whether drag and drop is enabled or not.
192 protected boolean fIsDragAndDrop
= false;
194 * The x coordinate for drag.
196 protected int fDragX
= 0;
198 * The y coordinate for drag.
200 protected int fDragY
= 0;
204 protected boolean fReorderMode
= false;
206 * The collapse caret image.
208 protected Image fCollapaseCaretImg
= null;
210 * The arrow up caret image.
212 protected Image fArrowUpCaretImg
= null;
214 * The current caret image.
216 protected Image fCurrentCaretImage
= null;
218 * A sequence diagramm collapse provider (for collapsing graph nodes)
220 protected ISDCollapseProvider fCollapseProvider
= null;
222 * The insertion caret.
224 protected Caret fInsertionCartet
= null;
226 * The reorder list when in reorder mode.
228 protected ArrayList
<Lifeline
[]> fReorderList
= null;
230 * Flag to specify whether in printing mode or not.
232 protected boolean fIsPrinting
= false;
234 * A printer reference.
236 protected Printer fPrinter
= null;
238 * Flag whether shift was selected or not.
240 protected boolean fShiftSelection
= false;
242 * The scroll tooltip.
244 protected DiagramToolTip fScrollToolTip
= null;
246 * Timer for auto_scroll feature
248 protected AutoScroll fLocalAutoScroll
= null;
250 * TimerTask for auto_scroll feature !=null when auto scroll is running
252 protected Timer fLocalAutoScrollTimer
= null;
254 // ------------------------------------------------------------------------
256 // ------------------------------------------------------------------------
258 * Constructor for SDWidget.
259 * @param c The parent composite
262 public SDWidget(Composite c
, int s
) {
263 super(c
, s
| SWT
.NO_BACKGROUND
, true);
264 setOverviewEnabled(true);
265 fSelectedNodeList
= new ArrayList
<GraphNode
>();
266 fSelProvider
= new SDWidgetSelectionProvider();
267 SDViewPref
.getInstance().addPropertyChangeListener(this);
268 fToolTip
= new DiagramToolTip(getViewControl());
269 super.addDisposeListener(this);
271 fScrollToolTip
= new DiagramToolTip(c
);
272 getVerticalBar().addListener(SWT
.MouseUp
, new Listener() {
275 public void handleEvent(Event event
) {
276 fScrollToolTip
.hideToolTip();
280 fAccessible
= getViewControl().getAccessible();
282 fAccessible
.addAccessibleListener(new AccessibleAdapter() {
285 * @see org.eclipse.swt.accessibility.AccessibleAdapter#getName(org.eclipse.swt.accessibility.AccessibleEvent)
288 public void getName(AccessibleEvent e
) {
290 if (e
.childID
== 0) {
291 if (fToolTipNode
!= null) {
292 if (fToolTipNode
instanceof Lifeline
) {
293 Lifeline lifeline
= (Lifeline
) fToolTipNode
;
294 e
.result
= lifeline
.getToolTipText();
296 e
.result
= fToolTipNode
.getName() + getPostfixForTooltip(true);
300 if (getFocusNode() != null) {
301 if (getFocusNode() instanceof Lifeline
) {
302 e
.result
= MessageFormat
.format(SDMessages
._1
, new Object
[] { String
.valueOf(getFocusNode().getName()) });
304 if (getFocusNode() instanceof BaseMessage
) {
305 BaseMessage mes
= (BaseMessage
) getFocusNode();
306 if ((mes
.getStartLifeline() != null) && (mes
.getEndLifeline() != null)) {
307 e
.result
= MessageFormat
.format(
309 new Object
[] { String
.valueOf(mes
.getName()), String
.valueOf(mes
.getStartLifeline().getName()), Integer
.valueOf(mes
.getStartOccurrence()), String
.valueOf(mes
.getEndLifeline().getName()),
310 Integer
.valueOf(mes
.getEndOccurrence()) });
311 } else if ((mes
.getStartLifeline() == null) && (mes
.getEndLifeline() != null)) {
312 e
.result
= MessageFormat
.format(SDMessages
._4
, new Object
[] { String
.valueOf(mes
.getName()), String
.valueOf(mes
.getEndLifeline().getName()), Integer
.valueOf(mes
.getEndOccurrence()) });
313 } else if ((mes
.getStartLifeline() != null) && (mes
.getEndLifeline() == null)) {
314 e
.result
= MessageFormat
.format(SDMessages
._3
, new Object
[] { String
.valueOf(mes
.getName()), String
.valueOf(mes
.getStartLifeline().getName()), Integer
.valueOf(mes
.getStartOccurrence()) });
316 } else if (getFocusNode() instanceof BasicExecutionOccurrence
) {
317 BasicExecutionOccurrence exec
= (BasicExecutionOccurrence
) getFocusNode();
318 e
.result
= MessageFormat
.format(SDMessages
._5
,
319 new Object
[] { String
.valueOf(exec
.getName()), String
.valueOf(exec
.getLifeline().getName()), Integer
.valueOf(exec
.getStartOccurrence()), Integer
.valueOf(exec
.getEndOccurrence()) });
327 fAccessible
.addAccessibleControlListener(new AccessibleControlAdapter() {
330 * @see org.eclipse.swt.accessibility.AccessibleControlAdapter#getFocus(org.eclipse.swt.accessibility.AccessibleControlEvent)
333 public void getFocus(AccessibleControlEvent e
) {
334 if (fFocusedWidget
== -1) {
335 e
.childID
= ACC
.CHILDID_SELF
;
337 e
.childID
= fFocusedWidget
;
343 * @see org.eclipse.swt.accessibility.AccessibleControlAdapter#getRole(org.eclipse.swt.accessibility.AccessibleControlEvent)
346 public void getRole(AccessibleControlEvent e
) {
348 case ACC
.CHILDID_SELF
:
349 e
.detail
= ACC
.ROLE_CLIENT_AREA
;
352 e
.detail
= ACC
.ROLE_TOOLTIP
;
355 e
.detail
= ACC
.ROLE_LABEL
;
364 * @see org.eclipse.swt.accessibility.AccessibleControlAdapter#getState(org.eclipse.swt.accessibility.AccessibleControlEvent)
367 public void getState(AccessibleControlEvent e
) {
368 e
.detail
= ACC
.STATE_FOCUSABLE
;
369 if (e
.childID
== ACC
.CHILDID_SELF
) {
370 e
.detail
|= ACC
.STATE_FOCUSED
;
372 e
.detail
|= ACC
.STATE_SELECTABLE
;
373 if (e
.childID
== fFocusedWidget
)
374 e
.detail
|= ACC
.STATE_FOCUSED
| ACC
.STATE_SELECTED
| ACC
.STATE_CHECKED
;
379 fInsertionCartet
= new Caret((Canvas
) getViewControl(), SWT
.NONE
);
380 fInsertionCartet
.setVisible(false);
382 fCollapaseCaretImg
= TmfUiPlugin
.getDefault().getImageFromPath(ITmfImageConstants
.IMG_UI_ARROW_COLLAPSE_OBJ
);
383 fArrowUpCaretImg
= TmfUiPlugin
.getDefault().getImageFromPath(ITmfImageConstants
.IMG_UI_ARROW_UP_OBJ
);
385 fReorderList
= new ArrayList
<Lifeline
[]>();
386 getViewControl().addTraverseListener(new TraverseListener() {
390 * @see org.eclipse.swt.events.TraverseListener#keyTraversed(org.eclipse.swt.events.TraverseEvent)
393 public void keyTraversed(TraverseEvent e
) {
394 if ((e
.detail
== SWT
.TRAVERSE_TAB_NEXT
) || (e
.detail
== SWT
.TRAVERSE_TAB_PREVIOUS
)) {
401 addTraverseListener(new TraverseListener() {
405 * @see org.eclipse.swt.events.TraverseListener#keyTraversed(org.eclipse.swt.events.TraverseEvent)
408 public void keyTraversed(TraverseEvent e
) {
409 if ((e
.detail
== SWT
.TRAVERSE_TAB_NEXT
) || (e
.detail
== SWT
.TRAVERSE_TAB_PREVIOUS
)) {
416 getViewControl().addFocusListener(new FocusListener() {
420 * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
423 public void focusGained(FocusEvent e
) {
424 // TODO Auto-generated method stub
425 SDViewPref
.getInstance().setNoFocusSelection(false);
426 fCtrlSelection
= false;
427 fShiftSelection
= false;
433 * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
436 public void focusLost(FocusEvent e
) {
437 SDViewPref
.getInstance().setNoFocusSelection(true);
443 // ------------------------------------------------------------------------
445 // ------------------------------------------------------------------------
447 * Sets the time compression bar.
449 * @param bar The time compression bar to set
451 public void setTimeBar(TimeCompressionBar bar
) {
454 fTimeBar
.addTimeCompressionListener(this);
459 * Resize the contents to insure the frame fit into the view
461 * @param frame the frame which will be drawn in the view
463 public void resizeContents(Frame frame
) {
464 int width
= Math
.round((frame
.getWidth() + 2 * Metrics
.FRAME_H_MARGIN
) * fZoomValue
);
465 int height
= Math
.round((frame
.getHeight() + 2 * Metrics
.FRAME_V_MARGIN
) * fZoomValue
);
466 resizeContents(width
, height
);
470 * The frame to render (the sequence diagram)
472 * @param theFrame the frame to display
473 * @param resetPosition boolean
475 public void setFrame(Frame theFrame
, boolean resetPosition
) {
476 fReorderList
.clear();
477 fSelectedNodeList
.clear();
478 fSelProvider
.setSelection(new StructuredSelection());
481 setContentsPos(0, 0);
482 resizeContents(fFrame
);
485 // prepare the old overview to be reused
486 if (fOverView
!= null) {
490 resizeContents(fFrame
);
494 * Returns the current Frame (the sequence diagram container)
498 public Frame
getFrame() {
503 * Returns the selection provider for the current sequence diagram
505 * @return the selection provider
507 public ISelectionProvider
getSelectionProvider() {
512 * Returns a list of selected graph nodes.
514 * @return a list of selected graph nodes.
516 public List
<GraphNode
> getSelection() {
517 return fSelectedNodeList
;
521 * Adds a graph node to the selected nodes list.
523 * @param node A graph node
525 public void addSelection(GraphNode node
) {
529 fSelectedNodeList
.add(node
);
530 node
.setSelected(true);
531 fCurrentGraphNode
= node
;
532 StructuredSelection selection
= new StructuredSelection(fSelectedNodeList
);
533 fSelProvider
.setSelection(selection
);
537 * Adds a list of node to the selected nodes list.
539 * @param list of graph nodes
541 public void addSelection(List
<GraphNode
> list
) {
542 // selectedNodeList.addAll(list);
543 for (int i
= 0; i
< list
.size(); i
++) {
544 if (!fSelectedNodeList
.contains(list
.get(i
))) {
545 fSelectedNodeList
.add(list
.get(i
));
546 ((GraphNode
) list
.get(i
)).setSelected(true);
549 StructuredSelection selection
= new StructuredSelection(fSelectedNodeList
);
550 fSelProvider
.setSelection(selection
);
554 * Removes a node from the selected nodes list.
556 * @param node to remove
558 public void removeSelection(GraphNode node
) {
559 fSelectedNodeList
.remove(node
);
560 node
.setSelected(false);
561 node
.setFocused(false);
562 StructuredSelection selection
= new StructuredSelection(fSelectedNodeList
);
563 fSelProvider
.setSelection(selection
);
567 * Removes a list of graph nodes from the selected nodes list.
569 * @param list of nodes to remove.
571 public void removeSelection(List
<GraphNode
> list
) {
572 fSelectedNodeList
.removeAll(list
);
573 for (int i
= 0; i
< list
.size(); i
++) {
574 ((GraphNode
) list
.get(i
)).setSelected(false);
575 ((GraphNode
) list
.get(i
)).setFocused(false);
577 StructuredSelection selection
= new StructuredSelection(fSelectedNodeList
);
578 fSelProvider
.setSelection(selection
);
582 * Clear the list of GraphNodes which must be drawn selected.
584 public void clearSelection() {
585 for (int i
= 0; i
< fSelectedNodeList
.size(); i
++) {
586 ((GraphNode
) fSelectedNodeList
.get(i
)).setSelected(false);
587 ((GraphNode
) fSelectedNodeList
.get(i
)).setFocused(false);
589 fCurrentGraphNode
= null;
590 fSelectedNodeList
.clear();
591 fSelProvider
.setSelection(new StructuredSelection());
597 * @param viewSite The view part to set
599 public void setSite(ViewPart viewSite
) {
601 fSite
.getSite().setSelectionProvider(fSelProvider
);
602 IContextService service
= (IContextService
) fSite
.getSite().getWorkbenchWindow().getService(IContextService
.class);
603 service
.activateContext("org.eclipse.linuxtools.tmf.ui.view.uml2sd.context"); //$NON-NLS-1$
604 service
.activateContext(IContextIds
.CONTEXT_ID_WINDOW
);
608 * Returns the GraphNode overView the mouse if any
610 * @return the current graph node
612 public GraphNode
getMouseOverNode() {
613 return fCurrentGraphNode
;
617 * Sets the zoom in mode.
619 * @param The mode value to set.
621 public void setZoomInMode(boolean value
) {
623 setZoomOutMode(false);
629 * Sets the zoom out mode.
631 * @param The mode value to set.
633 public void setZoomOutMode(boolean value
) {
635 setZoomInMode(false);
637 fZoomOutMode
= value
;
641 * Moves the Sequence diagram to ensure the given node is visible and draw it selected
643 * @param node the GraphNode to move to
645 public void moveTo(GraphNode node
) {
655 * Moves the Sequence diagram to ensure the given node is visible
657 * @param node the GraphNode to move to
659 public void ensureVisible(GraphNode node
) {
663 int x
= Math
.round(node
.getX() * fZoomValue
);
664 int y
= Math
.round(node
.getY() * fZoomValue
);
665 int width
= Math
.round(node
.getWidth() * fZoomValue
);
666 int height
= Math
.round(node
.getHeight() * fZoomValue
);
667 if ((node
instanceof BaseMessage
) && (height
== 0)) {
668 int header
= Metrics
.LIFELINE_HEARDER_TEXT_V_MARGIN
* 2 + Metrics
.getLifelineHeaderFontHeigth();
669 height
= -Math
.round((Metrics
.getMessagesSpacing() + header
) * fZoomValue
);
670 y
= y
+ Math
.round(Metrics
.SYNC_INTERNAL_MESSAGE_HEIGHT
* fZoomValue
);
672 if (node
instanceof BasicExecutionOccurrence
) {
676 if (node
instanceof Lifeline
) {
678 height
= getVisibleHeight();
680 ensureVisible(x
, y
, width
, height
, SWT
.CENTER
, true);
685 * Returns the current zoom factor.
686 * @return the current zoom factor.
688 public float getZoomFactor() {
693 * Returns teh printer reference.
695 * @return the printer reference
697 public Printer
getPrinter() {
702 * Returns whether the widget is used for printing or not.
704 * @return whether the widget is used for printing or not
706 public boolean isPrinting() {
711 * Gets the overview image.
713 * @param rect Rectangle to include overview.
714 * @return the overview image
716 public Image
getOverview(Rectangle rect
) {
717 float oldzoom
= fZoomValue
;
718 if ((fOverView
!= null) && ((rect
.width
!= fOverView
.getBounds().width
) || (rect
.height
!= fOverView
.getBounds().height
))) {
722 if (fOverView
== null) {
723 int backX
= getContentsX();
724 int backY
= getContentsY();
725 setContentsPos(0, 0);
726 fOverView
= new Image(getDisplay(), rect
.width
, rect
.height
);
727 GC gcim
= new GC(fOverView
);
728 NGC context
= new NGC(this, gcim
);
729 context
.setBackground(SDViewPref
.getInstance().getBackGroundColor(SDViewPref
.PREF_FRAME
));
730 fFrame
.draw(context
);
731 setContentsPos(backX
, backY
);
735 fZoomValue
= oldzoom
;
740 * Resets the zoom factor.
742 public void resetZoomFactor() {
743 int currentX
= Math
.round(getContentsX() / fZoomValue
);
744 int currentY
= Math
.round(getContentsY() / fZoomValue
);
746 if (fTimeBar
!= null && !fTimeBar
.isDisposed()) {
747 fTimeBar
.setZoom(fZoomValue
);
751 setContentsPos(currentX
, currentY
);
755 * Enable or disable the lifeline reodering using Drag and Drop
757 * @param mode - true to enable false otherwise
759 public void setReorderMode(boolean mode
) {
764 * Return the lifelines reorder sequence (using Drag and Drop) if the the reorder mode is turn on. Each ArryList
765 * element is of type Lifeline[2] with Lifeline[0] inserted before Lifeline[1] in the diagram
767 * @return - the re-odered sequence
769 public ArrayList
<Lifeline
[]> getLifelineReoderList() {
774 * Sets the focus on given graph node (current node).
776 * @param the graph node to focus on.
778 public void setFocus(GraphNode node
) {
782 if (fCurrentGraphNode
!= null) {
783 fCurrentGraphNode
.setFocused(false);
785 fCurrentGraphNode
= node
;
786 node
.setFocused(true);
792 * Returns the graph node focused on.
794 * @return the current graph node
796 public GraphNode
getFocusNode() {
797 return fCurrentGraphNode
;
801 * Method to traverse right.
803 public void traverseRight() {
804 Object selectedNode
= getFocusNode();
805 if (selectedNode
== null) {
808 GraphNode node
= null;
809 if ((selectedNode
instanceof BaseMessage
) && (((BaseMessage
) selectedNode
).getEndLifeline() != null)) {
810 node
= fFrame
.getCalledMessage((BaseMessage
) selectedNode
);
812 if (selectedNode
instanceof BasicExecutionOccurrence
) {
813 selectedNode
= ((BasicExecutionOccurrence
) selectedNode
).getLifeline();
815 if ((node
== null) && (selectedNode
instanceof Lifeline
)) {
816 for (int i
= 0; i
< fFrame
.lifeLinesCount(); i
++) {
817 if ((selectedNode
== fFrame
.getLifeline(i
)) && (i
< fFrame
.lifeLinesCount() - 1)) {
818 node
= fFrame
.getLifeline(i
+ 1);
830 * Method to traverse left.
832 public void traverseLeft() {
833 Object selectedNode
= getFocusNode();
834 GraphNode node
= null;
835 if ((selectedNode
instanceof BaseMessage
) && (((BaseMessage
) selectedNode
).getStartLifeline() != null)) {
836 node
= fFrame
.getCallerMessage((BaseMessage
) selectedNode
);
838 if (selectedNode
instanceof BasicExecutionOccurrence
) {
839 selectedNode
= ((BasicExecutionOccurrence
) selectedNode
).getLifeline();
842 if ((selectedNode
instanceof BaseMessage
) && (((BaseMessage
) selectedNode
).getEndLifeline() != null)) {
843 selectedNode
= ((BaseMessage
) selectedNode
).getEndLifeline();
845 for (int i
= 0; i
< fFrame
.lifeLinesCount(); i
++) {
846 if ((selectedNode
== fFrame
.getLifeline(i
)) && (i
> 0)) {
847 node
= fFrame
.getLifeline(i
- 1);
851 if ((fFrame
.lifeLinesCount() > 0) && (node
== null)) {
852 node
= fFrame
.getLifeline(0);
862 * Method to traverse up.
864 public void traverseUp() {
865 Object selectedNode
= getFocusNode();
866 if (selectedNode
== null) {
869 GraphNode node
= null;
870 if (selectedNode
instanceof BaseMessage
) {
871 node
= fFrame
.getPrevLifelineMessage(((BaseMessage
) selectedNode
).getStartLifeline(), (BaseMessage
) selectedNode
);
872 } else if (selectedNode
instanceof Lifeline
) {
873 node
= fFrame
.getPrevLifelineMessage((Lifeline
) selectedNode
, null);
874 if (!(node
instanceof Lifeline
)) {
877 } else if (selectedNode
instanceof BasicExecutionOccurrence
) {
878 node
= fFrame
.getPrevExecOccurrence((BasicExecutionOccurrence
) selectedNode
);
880 node
= ((BasicExecutionOccurrence
) selectedNode
).getLifeline();
883 if ((node
== null) && (selectedNode
instanceof BaseMessage
) && (((BaseMessage
) selectedNode
).getStartLifeline() != null)) {
884 node
= ((BaseMessage
) selectedNode
).getStartLifeline();
894 * Method to traverse down.
896 public void traverseDown() {
897 Object selectedNode
= getFocusNode();
898 if (selectedNode
== null) {
902 if (selectedNode
instanceof BaseMessage
) {
903 node
= fFrame
.getNextLifelineMessage(((BaseMessage
) selectedNode
).getStartLifeline(), (BaseMessage
) selectedNode
);
904 } else if (selectedNode
instanceof Lifeline
) {
905 // node = frame.getNextLifelineMessage((Lifeline)selectedNode,null);
906 node
= fFrame
.getFirstExecution((Lifeline
) selectedNode
);
907 } else if (selectedNode
instanceof BasicExecutionOccurrence
) {
908 node
= fFrame
.getNextExecOccurrence((BasicExecutionOccurrence
) selectedNode
);
920 * Method to traverse home.
922 public void traverseHome() {
923 Object selectedNode
= getFocusNode();
924 if (selectedNode
== null) {
927 GraphNode node
= null;
929 if (selectedNode
instanceof BaseMessage
) {
930 if (((BaseMessage
) selectedNode
).getStartLifeline() != null) {
931 node
= fFrame
.getNextLifelineMessage(((BaseMessage
) selectedNode
).getStartLifeline(), null);
933 node
= fFrame
.getNextLifelineMessage(((BaseMessage
) selectedNode
).getEndLifeline(), null);
935 } else if (selectedNode
instanceof Lifeline
) {
936 node
= fFrame
.getNextLifelineMessage((Lifeline
) selectedNode
, null);
937 } else if (selectedNode
instanceof BasicExecutionOccurrence
) {
938 node
= fFrame
.getFirstExecution(((BasicExecutionOccurrence
) selectedNode
).getLifeline());
940 if (fFrame
.lifeLinesCount() > 0) {
941 Lifeline lifeline
= fFrame
.getLifeline(0);
942 node
= fFrame
.getNextLifelineMessage(lifeline
, null);
953 * Method to traverse to the end.
955 public void traverseEnd() {
956 Object selectedNode
= getFocusNode();
957 if (selectedNode
== null) {
961 if (selectedNode
instanceof BaseMessage
) {
962 node
= fFrame
.getPrevLifelineMessage(((BaseMessage
) selectedNode
).getStartLifeline(), null);
963 } else if (selectedNode
instanceof Lifeline
) {
964 node
= fFrame
.getPrevLifelineMessage((Lifeline
) selectedNode
, null);
965 } else if (selectedNode
instanceof BasicExecutionOccurrence
) {
966 node
= fFrame
.getLastExecOccurrence(((BasicExecutionOccurrence
) selectedNode
).getLifeline());
968 if (fFrame
.lifeLinesCount() > 0) {
969 Lifeline lifeline
= fFrame
.getLifeline(0);
970 node
= fFrame
.getPrevLifelineMessage(lifeline
, null);
983 * Method to print UI.
985 * @param sdPrintDialog the sequence diagram printer dialog.
987 public void printUI(SDPrintDialogUI sdPrintDialog
) {
988 PrinterData data
= sdPrintDialog
.getPrinterData();
990 if ((data
== null) || (fFrame
== null)) {
994 fPrinter
= new Printer(data
);
996 String jobName
= MessageFormat
.format(SDMessages
._116
, new Object
[] { String
.valueOf(fSite
.getContentDescription()), String
.valueOf(fFrame
.getName()) });
997 fPrinter
.startJob(jobName
);
999 GC gc
= new GC(fPrinter
);
1000 Frame
.setUserPref(SDViewPref
.getInstance());
1002 float lastZoom
= fZoomValue
;
1004 Rectangle area
= getClientArea();
1008 NGC context
= new NGC(this, gcim
);
1010 // Set the metrics to use for lifeline text and message text
1011 // using the Graphical Context
1012 Metrics
.setLifelineFontHeight(context
.getFontHeight(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_LIFELINE
)));
1013 Metrics
.setLifelineFontWidth(context
.getFontWidth(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_LIFELINE
)));
1014 Metrics
.setLifelineWidth(SDViewPref
.getInstance().getLifelineWidth());
1015 Metrics
.setFrameFontHeight(context
.getFontHeight(Frame
.getUserPref().getFont(ISDPreferences
.PREF_FRAME_NAME
)));
1016 Metrics
.setLifelineHeaderFontHeight(context
.getFontHeight(Frame
.getUserPref().getFont(ISDPreferences
.PREF_LIFELINE_HEADER
)));
1018 int syncMessFontH
= context
.getFontHeight(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_SYNC_MESS
));
1019 int syncMessRetFontH
= context
.getFontHeight(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_SYNC_MESS_RET
));
1020 int asyncMessFontH
= context
.getFontHeight(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_ASYNC_MESS
));
1021 int asyncMessRetFontH
= context
.getFontHeight(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_ASYNC_MESS_RET
));
1023 int messageFontHeight
= 0;
1024 if (syncMessFontH
> syncMessRetFontH
) {
1025 messageFontHeight
= syncMessFontH
;
1027 messageFontHeight
= syncMessRetFontH
;
1029 if (messageFontHeight
< asyncMessFontH
) {
1030 messageFontHeight
= asyncMessFontH
;
1032 if (messageFontHeight
< asyncMessRetFontH
) {
1033 messageFontHeight
= asyncMessRetFontH
;
1035 Metrics
.setMessageFontHeight(messageFontHeight
);
1036 context
.setFont(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_LIFELINE
));
1038 int width
= Math
.round((fFrame
.getWidth() + 2 * Metrics
.FRAME_H_MARGIN
) * fZoomValue
);
1039 int height
= Math
.round((fFrame
.getHeight() + 2 * Metrics
.FRAME_V_MARGIN
) * fZoomValue
);
1040 if (width
< area
.width
) {
1043 if (height
< area
.height
) {
1044 height
= area
.height
;
1046 resizeContents(width
, height
);
1048 context
.setBackground(Frame
.getUserPref().getBackGroundColor(ISDPreferences
.PREF_FRAME
));
1049 context
.fillRectangle(0, 0, getContentsWidth(), Metrics
.FRAME_V_MARGIN
);
1050 context
.fillRectangle(0, 0, fFrame
.getX(), getContentsHeight());
1051 context
.fillRectangle(fFrame
.getX() + fFrame
.getWidth() + 1, 0, getContentsWidth() - (fFrame
.getX() + fFrame
.getWidth() + 1), getContentsHeight());
1052 context
.fillRectangle(0, fFrame
.getY() + fFrame
.getHeight() + 1, getContentsWidth(), getContentsHeight() - (fFrame
.getY() + fFrame
.getHeight() + 1));
1053 gcim
.setLineWidth(1);
1055 fPrinter
.startPage();
1056 fZoomValue
= lastZoom
;
1058 int restoreX
= getContentsX();
1059 int restoreY
= getContentsY();
1061 float zh
= sdPrintDialog
.getStepY() * sdPrintDialog
.getZoomFactor();
1062 float zw
= sdPrintDialog
.getStepX() * sdPrintDialog
.getZoomFactor();
1064 float zoomValueH
= fPrinter
.getClientArea().height
/ zh
;
1065 float zoomValueW
= fPrinter
.getClientArea().width
/ zw
;
1066 if (zoomValueH
> zoomValueW
) {
1067 fPrinterZoom
= zoomValueH
;
1069 fPrinterZoom
= zoomValueW
;
1072 if (sdPrintDialog
.printSelection()) {
1073 int[] pagesList
= sdPrintDialog
.getPageList();
1075 for (int pageIndex
= 0; pageIndex
< pagesList
.length
; pageIndex
++) {
1076 printPage(pagesList
[pageIndex
], sdPrintDialog
, context
);
1078 } else if (sdPrintDialog
.printAll()) {
1079 for (int pageIndex
= 1; pageIndex
<= sdPrintDialog
.maxNumOfPages(); pageIndex
++) {
1080 printPage(pageIndex
, sdPrintDialog
, context
);
1082 } else if (sdPrintDialog
.printCurrent()) {
1083 printPage(getContentsX(), getContentsY(), sdPrintDialog
, context
, 1);
1084 } else if (sdPrintDialog
.printRange()) {
1085 for (int pageIndex
= sdPrintDialog
.getFrom(); pageIndex
<= sdPrintDialog
.maxNumOfPages() && pageIndex
<= sdPrintDialog
.getTo(); pageIndex
++) {
1086 printPage(pageIndex
, sdPrintDialog
, context
);
1091 fIsPrinting
= false;
1096 fZoomValue
= lastZoom
;
1098 setContentsPos(restoreX
, restoreY
);
1104 public void print() {
1105 SDPrintDialog sdPrinter
= new SDPrintDialog(this.getShell(), this);
1107 if (sdPrinter
.open() != 0) {
1110 } catch (Exception e
) {
1111 TmfUiPlugin
.getDefault().getLog().log(new Status(IStatus
.ERROR
,TmfUiPlugin
.PLUGIN_ID
, "Error creating image", e
)); //$NON-NLS-1$
1114 printUI(sdPrinter
.getDialogUI());
1118 * Method to print a page.
1120 * @param pageNum The page number
1121 * @param pd The sequence diagram print dialog
1122 * @param context The graphical context
1124 public void printPage(int pageNum
, SDPrintDialogUI pd
, NGC context
) {
1125 int j
= pageNum
/ pd
.getNbRow();
1126 int i
= pageNum
% pd
.getNbRow();
1136 i
= (int) (i
* pd
.getStepX());
1137 j
= (int) (j
* pd
.getStepY());
1139 printPage(i
, j
, pd
, context
, pageNum
);
1145 * Method to print page ranges.
1147 * @param i The start page
1148 * @param j The end page
1149 * @param pd The sequence diagram print dialog
1150 * @param context The graphical context
1151 * @param pageNum int the current page
1153 public void printPage(int i
, int j
, SDPrintDialogUI pd
, NGC context
, int pageNum
) {
1154 fIsPrinting
= false;
1155 int pageNumFontZoom
= fPrinter
.getClientArea().height
/ getVisibleHeight();
1158 setContentsPos(i
, j
);
1161 float lastZoom
= fZoomValue
;
1162 fZoomValue
= fPrinterZoom
* lastZoom
;
1164 fFrame
.draw(context
);
1166 fZoomValue
= pageNumFontZoom
;
1167 context
.setFont(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_LIFELINE
));
1168 String currentPageNum
= String
.valueOf(pageNum
);
1169 int ii
= context
.textExtent(currentPageNum
);
1170 int jj
= context
.getCurrentFontHeight();
1171 // context.setBackground(ColorImpl.getSystemColor(SWT.COLOR_BLACK));
1172 // context.setForeground(ColorImpl.getSystemColor(SWT.COLOR_WHITE));
1173 fZoomValue
= fPrinterZoom
* lastZoom
;
1174 context
.drawText(currentPageNum
, Math
.round(fPrinterX
+ getVisibleWidth() / fPrinterZoom
- ii
/ fPrinterZoom
), Math
.round(fPrinterY
+ getVisibleHeight() / fPrinterZoom
- jj
/ fPrinterZoom
), false);
1175 fIsPrinting
= false;
1176 fZoomValue
= lastZoom
;
1180 * Sets the collapse provider.
1182 * @param provider The collapse provider to set
1184 protected void setCollapseProvider(ISDCollapseProvider provider
) {
1185 fCollapseProvider
= provider
;
1190 * Checks for focus of children.
1192 * @param children Control to check
1193 * @return true if child is on focus else false
1195 protected boolean checkFocusOnChilds(Control children
) {
1196 if (children
instanceof Composite
) {
1197 Control
[] child
= ((Composite
) children
).getChildren();
1198 for (int i
= 0; i
< child
.length
; i
++) {
1199 if (child
[i
].isFocusControl()) {
1202 checkFocusOnChilds(child
[i
]);
1210 * A post action for a tooltip (before displaying).
1212 * @param accessible true if accessible else false
1213 * @return the tooltip text.
1215 protected String
getPostfixForTooltip(boolean accessible
) {
1216 String postfix
= "";//$NON-NLS-1$
1217 // Determine if the tooltip must show the time difference between the current mouse position and
1218 // the last selected graphNode
1219 if ((fCurrentGraphNode
!= null) &&
1220 (fCurrentGraphNode
instanceof ITimeRange
) &&
1221 (fToolTipNode
instanceof ITimeRange
) &&
1222 (fCurrentGraphNode
!= fToolTipNode
) &&
1223 ((ITimeRange
) fToolTipNode
).hasTimeInfo() &&
1224 ((ITimeRange
) fCurrentGraphNode
).hasTimeInfo()) {
1225 postfix
= " -> " + fCurrentGraphNode
.getName() + "\n" + SDMessages
._138
+ " "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1227 //double delta = ((ITimeRange)toolTipNode).getLastTime()-((ITimeRange)currentGraphNode).getLastTime();
1228 ITmfTimestamp firstTime
= ((ITimeRange
) fCurrentGraphNode
).getEndTime();
1229 ITmfTimestamp lastTime
= ((ITimeRange
) fToolTipNode
).getEndTime();
1230 TmfTimestamp delta
= (TmfTimestamp
) lastTime
.getDelta(firstTime
);
1231 postfix
+= delta
.toString();
1233 if ((fToolTipNode
instanceof ITimeRange
) && ((ITimeRange
) fToolTipNode
).hasTimeInfo()) {
1234 postfix
= "\n";//$NON-NLS-1$
1235 ITmfTimestamp firstTime
= ((ITimeRange
) fToolTipNode
).getStartTime();
1236 ITmfTimestamp lastTime
= ((ITimeRange
) fToolTipNode
).getEndTime();
1238 if (firstTime
!= null) {
1239 if (lastTime
!= null && firstTime
.compareTo(lastTime
, true) != 0) {
1240 postfix
+= "start: " + firstTime
+ "\n"; //$NON-NLS-1$ //$NON-NLS-2$
1241 postfix
+= "end: " + lastTime
+ "\n"; //$NON-NLS-1$ //$NON-NLS-2$
1243 postfix
+= firstTime
.toString();
1246 else if (lastTime
!= null) {
1247 postfix
+= lastTime
.toString();
1255 * Sets a new focused widget.
1257 * @param newFocusShape A new focus shape.
1259 protected void setFocus(int newFocusShape
) {
1260 fFocusedWidget
= newFocusShape
;
1261 if (fFocusedWidget
== -1) {
1262 getViewControl().getAccessible().setFocus(ACC
.CHILDID_SELF
);
1264 getViewControl().getAccessible().setFocus(fFocusedWidget
);
1269 * Highlight the given GraphNode<br>
1270 * The GraphNode is then displayed using the system default selection color
1272 * @param node the GraphNode to highlight
1274 protected void performSelection(GraphNode node
) {
1275 if ((fCtrlSelection
) || (fShiftSelection
)) {
1277 if (fSelectedNodeList
.contains(node
)) {
1278 removeSelection(node
);
1294 * Returns a draw buffer image.
1296 * @return a Image containing the draw buffer.
1298 protected Image
getDrawBuffer() {
1301 Rectangle area
= getClientArea();
1302 Image dbuffer
= null;
1306 dbuffer
= new Image(getDisplay(), area
.width
, area
.height
);
1307 } catch (Exception e
) {
1308 TmfUiPlugin
.getDefault().getLog().log(new Status(IStatus
.ERROR
,TmfUiPlugin
.PLUGIN_ID
, "Error creating image", e
)); //$NON-NLS-1$
1311 gcim
= new GC(dbuffer
);
1313 NGC context
= new NGC(this, gcim
);
1315 // Set the metrics to use for lifeline text and message text
1316 // using the Graphical Context
1317 Metrics
.setLifelineFontHeight(context
.getFontHeight(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_LIFELINE
)));
1318 Metrics
.setLifelineFontWidth(context
.getFontWidth(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_LIFELINE
)));
1319 Metrics
.setLifelineWidth(SDViewPref
.getInstance().getLifelineWidth());
1320 Metrics
.setFrameFontHeight(context
.getFontHeight(Frame
.getUserPref().getFont(ISDPreferences
.PREF_FRAME_NAME
)));
1321 Metrics
.setLifelineHeaderFontHeight(context
.getFontHeight(Frame
.getUserPref().getFont(ISDPreferences
.PREF_LIFELINE_HEADER
)));
1323 int syncMessFontH
= context
.getFontHeight(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_SYNC_MESS
));
1324 int syncMessRetFontH
= context
.getFontHeight(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_SYNC_MESS_RET
));
1325 int asyncMessFontH
= context
.getFontHeight(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_ASYNC_MESS
));
1326 int asyncMessRetFontH
= context
.getFontHeight(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_ASYNC_MESS_RET
));
1328 int messageFontHeight
= 0;
1329 if (syncMessFontH
> syncMessRetFontH
) {
1330 messageFontHeight
= syncMessFontH
;
1332 messageFontHeight
= syncMessRetFontH
;
1334 if (messageFontHeight
< asyncMessFontH
) {
1335 messageFontHeight
= asyncMessFontH
;
1337 if (messageFontHeight
< asyncMessRetFontH
) {
1338 messageFontHeight
= asyncMessRetFontH
;
1340 Metrics
.setMessageFontHeight(messageFontHeight
);
1341 context
.setFont(SDViewPref
.getInstance().getFont(SDViewPref
.PREF_LIFELINE
));
1343 int width
= (int) ((fFrame
.getWidth() + 2 * Metrics
.FRAME_H_MARGIN
) * fZoomValue
);
1344 int height
= (int) ((fFrame
.getHeight() + 2 * Metrics
.FRAME_V_MARGIN
) * fZoomValue
);
1346 resizeContents(width
, height
);
1348 context
.setBackground(Frame
.getUserPref().getBackGroundColor(ISDPreferences
.PREF_FRAME
));
1349 context
.fillRectangle(0, 0, getContentsWidth(), Metrics
.FRAME_V_MARGIN
);
1350 context
.fillRectangle(0, 0, fFrame
.getX(), getContentsHeight());
1351 context
.fillRectangle(fFrame
.getX() + fFrame
.getWidth() + 1, 0, getContentsWidth() - (fFrame
.getX() + fFrame
.getWidth() + 1), getContentsHeight());
1352 context
.fillRectangle(0, fFrame
.getY() + fFrame
.getHeight() + 1, getContentsWidth(), getContentsHeight() - (fFrame
.getY() + fFrame
.getHeight() + 1));
1353 gcim
.setLineWidth(1);
1355 fFrame
.draw(context
);
1356 if (fDragAndDrop
!= null) {
1357 Lifeline node
= (Lifeline
) fDragAndDrop
;
1358 boolean isSelected
= fDragAndDrop
.isSelected();
1359 boolean hasFocus
= fDragAndDrop
.hasFocus();
1360 node
.setSelected(false);
1361 node
.setFocused(false);
1362 node
.draw(context
, fDragX
, fDragY
);
1363 node
.setSelected(isSelected
);
1364 node
.setFocused(hasFocus
);
1373 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#keyPressedEvent(org.eclipse.swt.events.KeyEvent)
1376 protected void keyPressedEvent(KeyEvent event
) {
1377 if (!(isFocusControl() || getViewControl().isFocusControl())) {
1378 Control
[] child
= getParent().getChildren();
1379 for (int i
= 0; i
< child
.length
; i
++) {
1380 if ((child
[i
].isFocusControl())&& (!(child
[i
] instanceof ScrollView
))) {
1381 getViewControl().setFocus();
1388 if (event
.keyCode
== SWT
.CTRL
) {
1389 fCtrlSelection
= true;
1391 if (event
.keyCode
== SWT
.SHIFT
) {
1392 fShiftSelection
= true;
1393 fPrevList
= new ArrayList
<GraphNode
>();
1394 fPrevList
.addAll(getSelection());
1397 GraphNode prevNode
= getFocusNode();
1399 if (event
.keyCode
== SWT
.ARROW_RIGHT
) {
1403 if (event
.keyCode
== SWT
.ARROW_LEFT
) {
1407 if (event
.keyCode
== SWT
.ARROW_DOWN
) {
1411 if (event
.keyCode
== SWT
.ARROW_UP
) {
1415 if (event
.keyCode
== SWT
.HOME
) {
1419 if (event
.keyCode
== SWT
.END
) {
1423 if ((!fShiftSelection
) && (!fCtrlSelection
)) {
1424 fListStart
= fCurrentGraphNode
;
1427 if (event
.character
== ' ') {
1428 performSelection(fCurrentGraphNode
);
1429 if (!fShiftSelection
)
1430 fListStart
= fCurrentGraphNode
;
1433 if ((fShiftSelection
) && (prevNode
!= getFocusNode())) {
1435 addSelection(fPrevList
);
1436 addSelection(fFrame
.getNodeList(fListStart
, getFocusNode()));
1437 if (getFocusNode() instanceof Lifeline
) {
1438 ensureVisible(getFocusNode().getX(), getFocusNode().getY(), getFocusNode().getWidth(), getFocusNode().getHeight(), SWT
.CENTER
| SWT
.VERTICAL
, true);
1440 ensureVisible(getFocusNode());
1442 } else if ((!fCtrlSelection
) && (!fShiftSelection
)) {
1445 if (getFocusNode() != null) {
1446 addSelection(getFocusNode());
1448 if (getFocusNode() instanceof Lifeline
) {
1449 ensureVisible(getFocusNode().getX(), getFocusNode().getY(), getFocusNode().getWidth(), getFocusNode().getHeight(), SWT
.CENTER
| SWT
.VERTICAL
, true);
1451 ensureVisible(getFocusNode());
1456 if (fCurrentGraphNode
!= null) {
1457 fCurrentGraphNode
.setFocused(true);
1461 if ((event
.character
== ' ') && ((fZoomInMode
) || (fZoomOutMode
))) {
1462 int cx
= Math
.round((getContentsX() + getVisibleWidth() / 2) / fZoomValue
);
1463 int cy
= Math
.round((getContentsY() + getVisibleHeight() / 2) / fZoomValue
);
1465 if (fZoomValue
< 64) {
1466 fZoomValue
= fZoomValue
* (float) 1.25;
1469 fZoomValue
= fZoomValue
/ (float) 1.25;
1471 int x
= Math
.round(cx
* fZoomValue
- getVisibleWidth() / (float) 2);
1472 int y
= Math
.round(cy
* fZoomValue
- getVisibleHeight() / (float) 2);
1473 setContentsPos(x
, y
);
1474 if (fTimeBar
!= null) {
1475 fTimeBar
.setZoom(fZoomValue
);
1477 // redraw also resize the scrollView content
1484 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#keyReleasedEvent(org.eclipse.swt.events.KeyEvent)
1487 protected void keyReleasedEvent(KeyEvent event
) {
1489 if (event
.keyCode
== SWT
.CTRL
)
1490 fCtrlSelection
= false;
1491 if (event
.keyCode
== SWT
.SHIFT
)
1492 fShiftSelection
= false;
1493 super.keyReleasedEvent(event
);
1499 * @see org.eclipse.swt.widgets.Control#isFocusControl()
1502 public boolean isFocusControl() {
1503 Control
[] child
= getChildren();
1504 for (int i
= 0; i
< child
.length
; i
++) {
1505 if (child
[i
].isFocusControl()) {
1508 checkFocusOnChilds(child
[i
]);
1516 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#setContentsPos(int, int)
1519 public boolean setContentsPos(int x
, int y
) {
1529 if (fFrame
== null) {
1532 if (localX
+ getVisibleWidth() > getContentsWidth()) {
1533 localX
= getContentsWidth() - getVisibleWidth();
1535 if (localY
+ getVisibleHeight() > getContentsHeight()) {
1536 localY
= getContentsHeight() - getVisibleHeight();
1538 int x1
= Math
.round(localX
/ fZoomValue
);
1539 int y2
= Math
.round(localY
/ fZoomValue
);
1540 int width
= Math
.round(getVisibleWidth() / fZoomValue
);
1541 int height
= Math
.round(getVisibleHeight() / fZoomValue
);
1542 fFrame
.updateIndex(x1
, y2
, width
, height
);
1544 if (fInsertionCartet
!= null && fInsertionCartet
.isVisible()) {
1545 fInsertionCartet
.setVisible(false);
1548 return super.setContentsPos(localX
, localY
);
1553 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#contentsMouseHover(org.eclipse.swt.events.MouseEvent)
1556 protected void contentsMouseHover(MouseEvent event
) {
1557 GraphNode graphNode
= null;
1558 if (fFrame
!= null) {
1559 int x
= Math
.round(event
.x
/ fZoomValue
);
1560 int y
= Math
.round(event
.y
/ fZoomValue
);
1561 graphNode
= fFrame
.getNodeAt(x
, y
);
1562 if ((graphNode
!= null) && (SDViewPref
.getInstance().tooltipEnabled())) {
1563 fToolTipNode
= graphNode
;
1564 String postfix
= getPostfixForTooltip(true);
1565 if (graphNode
instanceof Lifeline
) {
1566 Lifeline lifeline
= (Lifeline
) graphNode
;
1567 fToolTip
.showToolTip(lifeline
.getToolTipText() + postfix
);
1570 fToolTip
.showToolTip(graphNode
.getName() + postfix
);
1574 fToolTip
.hideToolTip();
1581 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#contentsMouseMoveEvent(org.eclipse.swt.events.MouseEvent)
1584 protected void contentsMouseMoveEvent(MouseEvent e
) {
1585 fScrollToolTip
.hideToolTip();
1586 fToolTip
.hideToolTip();
1587 // super.contentsMouseMoveEvent(e);
1588 if (!(isFocusControl() || getViewControl().isFocusControl())) {
1589 Control
[] child
= getParent().getChildren();
1590 for (int i
= 0; i
< child
.length
; i
++) {
1591 if ((child
[i
].isFocusControl()) && (!(child
[i
] instanceof ScrollView
))) {
1592 getViewControl().setFocus();
1599 if (((e
.stateMask
& SWT
.BUTTON_MASK
) != 0) && ((fDragAndDrop
!= null) || fIsDragAndDrop
) && (fReorderMode
|| fCollapseProvider
!= null)) {
1600 fIsDragAndDrop
= false;
1601 if (fCurrentGraphNode
instanceof Lifeline
) {
1602 fDragAndDrop
= (Lifeline
) fCurrentGraphNode
;
1604 if (fDragAndDrop
!= null) {
1607 if (e
.x
> getContentsX() + getVisibleWidth()) {
1608 dx
= e
.x
- (getContentsX() + getVisibleWidth());
1609 } else if (e
.x
< getContentsX()) {
1610 dx
= -getContentsX() + e
.x
;
1612 if (e
.y
> getContentsY() + getVisibleHeight()) {
1613 dy
= e
.y
- (getContentsY() + getVisibleHeight());
1614 } else if (e
.y
< getContentsY()) {
1615 dy
= -getContentsY() + e
.y
;
1619 if (dx
!= 0 || dy
!= 0) {
1620 if (fLocalAutoScroll
== null) {
1621 if (fLocalAutoScrollTimer
== null) {
1622 fLocalAutoScrollTimer
= new Timer(true);
1624 fLocalAutoScroll
= new AutoScroll(this, dx
, dy
);
1625 fLocalAutoScrollTimer
.schedule(fLocalAutoScroll
, 0, 75);
1627 fLocalAutoScroll
.fDeltaX
= dx
;
1628 fLocalAutoScroll
.fDeltaY
= dy
;
1630 } else if (fLocalAutoScroll
!= null) {
1631 fLocalAutoScroll
.cancel();
1632 fLocalAutoScroll
= null;
1634 fDragX
= Math
.round(e
.x
/ fZoomValue
);
1635 fDragY
= Math
.round(e
.y
/ fZoomValue
);
1637 Lifeline node
= fFrame
.getCloserLifeline(fDragX
);
1638 if ((node
!= null) && (node
!= fDragAndDrop
)) {
1641 int height
= Metrics
.getLifelineHeaderFontHeigth() + 2 * Metrics
.LIFELINE_HEARDER_TEXT_V_MARGIN
;
1642 int hMargin
= Metrics
.LIFELINE_VT_MAGIN
/ 4;
1643 int x
= node
.getX();
1644 int width
= node
.getWidth();
1645 if (fFrame
.getVisibleAreaY() < node
.getY() + node
.getHeight() - height
- hMargin
) {
1646 y
= contentsToViewY(Math
.round((node
.getY() + node
.getHeight()) * fZoomValue
));
1648 y
= Math
.round(height
* fZoomValue
);
1651 if (fFrame
.getVisibleAreaY() < contentsToViewY(node
.getY() - hMargin
)) {
1652 y1
= contentsToViewY(Math
.round((node
.getY() - hMargin
) * fZoomValue
));
1654 y1
= Math
.round(height
* fZoomValue
);
1657 int rx
= Math
.round(x
* fZoomValue
);
1659 fInsertionCartet
.setVisible(true);
1660 if ((fInsertionCartet
.getImage() != null) && (!fInsertionCartet
.getImage().isDisposed())) {
1661 fInsertionCartet
.getImage().dispose();
1663 if (rx
<= e
.x
&& Math
.round(rx
+ (width
* fZoomValue
)) >= e
.x
) {
1664 if (fCollapseProvider
!= null) {
1665 ImageData data
= fCollapaseCaretImg
.getImageData();
1666 data
= data
.scaledTo(Math
.round(fCollapaseCaretImg
.getBounds().width
* fZoomValue
), Math
.round(fCollapaseCaretImg
.getBounds().height
* fZoomValue
));
1667 fCurrentCaretImage
= new Image(Display
.getCurrent(), data
);
1668 fInsertionCartet
.setImage(fCurrentCaretImage
);
1669 fInsertionCartet
.setLocation(contentsToViewX(rx
+ Math
.round((width
/ (float) 2) * fZoomValue
)) - fCurrentCaretImage
.getBounds().width
/ 2, y
);
1671 } else if (fReorderMode
) {
1673 if (node
.getIndex() > 1 && fFrame
.getLifeline(node
.getIndex() - 2) == fDragAndDrop
) {
1676 ImageData data
= fArrowUpCaretImg
.getImageData();
1677 data
= data
.scaledTo(Math
.round(fArrowUpCaretImg
.getBounds().width
* fZoomValue
), Math
.round(fArrowUpCaretImg
.getBounds().height
* fZoomValue
));
1678 fCurrentCaretImage
= new Image(Display
.getCurrent(), data
);
1679 fInsertionCartet
.setImage(fCurrentCaretImage
);
1680 fInsertionCartet
.setLocation(contentsToViewX(Math
.round((x
- Metrics
.LIFELINE_SPACING
/ 2) * fZoomValue
)) - fCurrentCaretImage
.getBounds().width
/ 2, y1
);
1682 if (node
.getIndex() < fFrame
.lifeLinesCount() && fFrame
.getLifeline(node
.getIndex()) == fDragAndDrop
) {
1685 ImageData data
= fArrowUpCaretImg
.getImageData();
1686 data
= data
.scaledTo(Math
.round(fArrowUpCaretImg
.getBounds().width
* fZoomValue
), Math
.round(fArrowUpCaretImg
.getBounds().height
* fZoomValue
));
1687 fCurrentCaretImage
= new Image(Display
.getCurrent(), data
);
1688 fInsertionCartet
.setImage(fCurrentCaretImage
);
1689 fInsertionCartet
.setLocation(contentsToViewX(Math
.round((x
+ width
+ Metrics
.LIFELINE_SPACING
/ 2) * fZoomValue
)) - fCurrentCaretImage
.getBounds().width
/ 2 + 1, y1
);
1693 fInsertionCartet
.setVisible(false);
1697 super.contentsMouseMoveEvent(e
);
1703 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#contentsMouseUpEvent(org.eclipse.swt.events.MouseEvent)
1706 protected void contentsMouseUpEvent(MouseEvent event
) {
1707 // Just in case the diagram highlight a time compression region
1708 // this region need to be released when clicking everywhere
1709 fInsertionCartet
.setVisible(false);
1710 if (fDragAndDrop
!= null) {
1711 if ((fOverView
!= null) && (!fOverView
.isDisposed())) {
1712 fOverView
.dispose();
1715 Lifeline node
= fFrame
.getCloserLifeline(fDragX
);
1717 int rx
= Math
.round(node
.getX() * fZoomValue
);
1718 if (rx
<= event
.x
&& Math
.round(rx
+ (node
.getWidth() * fZoomValue
)) >= event
.x
) {
1719 if ((fCollapseProvider
!= null) && (fDragAndDrop
!= node
)) {
1720 fCollapseProvider
.collapseTwoLifelines((Lifeline
) fDragAndDrop
, node
);
1722 } else if (rx
< event
.x
) {
1723 fFrame
.insertLifelineAfter((Lifeline
) fDragAndDrop
, node
);
1724 if (node
.getIndex() < fFrame
.lifeLinesCount()) {
1725 Lifeline temp
[] = { (Lifeline
) fDragAndDrop
, fFrame
.getLifeline(node
.getIndex()) };
1726 fReorderList
.add(temp
);
1728 Lifeline temp
[] = { (Lifeline
) fDragAndDrop
, null };
1729 fReorderList
.add(temp
);
1732 fFrame
.insertLifelineBefore((Lifeline
) fDragAndDrop
, node
);
1733 Lifeline temp
[] = { (Lifeline
) fDragAndDrop
, node
};
1734 fReorderList
.add(temp
);
1738 fDragAndDrop
= null;
1740 if (fFrame
== null) {
1743 fFrame
.resetTimeCompression();
1745 // reset auto scroll if it's engaged
1746 if (fLocalAutoScroll
!= null) {
1747 fLocalAutoScroll
.cancel();
1748 fLocalAutoScroll
= null;
1750 super.contentsMouseUpEvent(event
);
1755 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#contentsMouseDownEvent(org.eclipse.swt.events.MouseEvent)
1758 protected void contentsMouseDownEvent(MouseEvent event
) {
1759 if (fCurrentGraphNode
!= null) {
1760 fCurrentGraphNode
.setFocused(false);
1763 // Just in case the diagram highlight a time compression region
1764 // this region need to be released when clicking everywhere
1765 if (fFrame
== null) {
1769 fFrame
.resetTimeCompression();
1771 if ((event
.stateMask
& SWT
.CTRL
) != 0) {
1772 fCtrlSelection
= true;
1774 fCtrlSelection
= false;
1777 if (((fZoomInMode
) || (fZoomOutMode
)) && (event
.button
== 1)) {
1778 int cx
= Math
.round(event
.x
/ fZoomValue
);
1779 int cy
= Math
.round(event
.y
/ fZoomValue
);
1781 if (fZoomValue
< 64) {
1782 fZoomValue
= fZoomValue
* (float) 1.25;
1785 fZoomValue
= fZoomValue
/ (float) 1.25;
1787 int x
= Math
.round(cx
* fZoomValue
- getVisibleWidth() / (float) 2);
1788 int y
= Math
.round(cy
* fZoomValue
- getVisibleHeight() / (float) 2);
1789 setContentsPos(x
, y
);
1790 if (fTimeBar
!= null) {
1791 fTimeBar
.setZoom(fZoomValue
);
1793 // redraw also resize the scrollView content
1795 } else {// if (event.button ==1)
1796 GraphNode node
= null;
1797 int x
= Math
.round(event
.x
/ fZoomValue
);
1798 int y
= Math
.round(event
.y
/ fZoomValue
);
1799 node
= fFrame
.getNodeAt(x
, y
);
1801 if ((event
.button
== 1) || ((node
!= null) && !node
.isSelected())) {
1802 if (!fShiftSelection
) {
1805 if (fShiftSelection
) {
1807 addSelection(fFrame
.getNodeList(fListStart
, node
));
1809 performSelection(node
);
1811 fCurrentGraphNode
= node
;
1813 node
.setFocused(true);
1818 if (fDragAndDrop
== null) {
1819 super.contentsMouseDownEvent(event
);
1821 fIsDragAndDrop
= (event
.button
== 1);
1826 * TimerTask for auto scroll feature.
1828 protected static class AutoScroll
extends TimerTask
{
1838 * Field sequence diagram reference.
1840 public SDWidget fSdWidget
;
1843 * Constructor for AutoScroll.
1844 * @param sv sequence diagram widget reference
1848 public AutoScroll(SDWidget sv
, int dx
, int dy
) {
1856 * @see java.util.TimerTask#run()
1860 Display
.getDefault().asyncExec(new Runnable() {
1863 if (fSdWidget
.isDisposed())
1865 fSdWidget
.fDragX
+= fDeltaX
;
1866 fSdWidget
.fDragY
+= fDeltaY
;
1867 fSdWidget
.scrollBy(fDeltaX
, fDeltaY
);
1875 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#drawContents(org.eclipse.swt.graphics.GC, int, int, int, int)
1878 protected void drawContents(GC gc
, int clipx
, int clipy
, int clipw
, int cliph
) {
1879 if (fFrame
== null) {
1880 gc
.setBackground(getDisplay().getSystemColor(SWT
.COLOR_WHITE
));
1881 gc
.fillRectangle(0, 0, getVisibleWidth(), getVisibleHeight());
1885 Frame
.setUserPref(SDViewPref
.getInstance());
1888 Rectangle area
= getClientArea();
1889 Image dbuffer
= getDrawBuffer();
1890 int height
= Math
.round((fFrame
.getHeight() + 2 * Metrics
.FRAME_V_MARGIN
) * fZoomValue
);
1893 gc
.drawImage(dbuffer
, 0, 0, area
.width
, area
.height
, 0, 0, area
.width
, area
.height
);
1894 } catch (Exception e
) {
1895 TmfUiPlugin
.getDefault().getLog().log(new Status(IStatus
.ERROR
,TmfUiPlugin
.PLUGIN_ID
, "Error drawin content", e
)); //$NON-NLS-1$
1898 setHScrollBarIncrement(Math
.round(SDViewPref
.getInstance().getLifelineWidth() / (float) 2 * fZoomValue
));
1899 setVScrollBarIncrement(Math
.round(Metrics
.getMessagesSpacing() * fZoomValue
));
1900 if ((fTimeBar
!= null) && (fFrame
.hasTimeInfo())) {
1901 fTimeBar
.resizeContents(9, height
+ getHorizontalBarHeight());
1902 fTimeBar
.setContentsPos(getContentsX(), getContentsY());
1906 float xRatio
= getContentsWidth() / (float) getVisibleWidth();
1907 float yRatio
= getContentsHeight() / (float) getVisibleHeight();
1908 if (yRatio
> xRatio
) {
1909 setOverviewSize((int) (getVisibleHeight() * 0.75));
1911 setOverviewSize((int) (getVisibleWidth() * 0.75));
1917 * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
1920 public void widgetDefaultSelected(SelectionEvent event
) {
1925 * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
1928 public void widgetSelected(SelectionEvent event
) {
1929 if (event
.widget
== fZoomIn
) {
1930 fZoomValue
= fZoomValue
* 2;
1931 } else if (event
.widget
== fZoomOut
) {
1932 fZoomValue
= fZoomValue
/ 2;
1938 * Called when property changed occurs in the preference page. "PREFOK" is fired when the user press the ok or apply button
1941 * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
1944 public void propertyChange(PropertyChangeEvent e
) {
1945 if (fFrame
!= null && !isDisposed()) {
1946 fFrame
.resetTimeCompression();
1948 if (e
.getProperty().equals("PREFOK")) //$NON-NLS-1$
1950 // Prepare the overview to be reused for the new
1951 // settings (especially the colors)
1952 if (fOverView
!= null)
1953 fOverView
.dispose();
1961 * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
1964 public void widgetDisposed(DisposeEvent e
) {
1965 if (fOverView
!= null) {
1966 fOverView
.dispose();
1968 super.removeDisposeListener(this);
1969 if ((fCurrentCaretImage
!= null) && (!fCurrentCaretImage
.isDisposed())) {
1970 fCurrentCaretImage
.dispose();
1972 if ((fArrowUpCaretImg
!= null) && (!fArrowUpCaretImg
.isDisposed())) {
1973 fArrowUpCaretImg
.dispose();
1975 if ((fCollapaseCaretImg
!= null) && (!fCollapaseCaretImg
.isDisposed())) {
1976 fCollapaseCaretImg
.dispose();
1978 SDViewPref
.getInstance().removePropertyChangeListener(this);
1979 LoadersManager lm
= LoadersManager
.getInstance();
1980 if (fSite
instanceof SDView
) {
1981 ((SDView
) fSite
).resetProviders();
1983 lm
.resetLoader(((SDView
) fSite
).getViewSite().getId());
1990 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#drawOverview(org.eclipse.swt.graphics.GC, org.eclipse.swt.graphics.Rectangle)
1993 protected void drawOverview(GC gc
, Rectangle r
) {
1994 float oldzoom
= fZoomValue
;
1995 if (getContentsWidth() > getContentsHeight()) {
1996 fZoomValue
= (float) r
.width
/ (float) getContentsWidth() * oldzoom
;
1998 fZoomValue
= (float) r
.height
/ (float) getContentsHeight() * oldzoom
;
2000 if ((fOverView
!= null) && ((r
.width
!= fOverView
.getBounds().width
) || (r
.height
!= fOverView
.getBounds().height
))) {
2001 fOverView
.dispose();
2004 if (fOverView
== null) {
2005 int backX
= getContentsX();
2006 int backY
= getContentsY();
2007 setContentsPos(0, 0);
2008 fOverView
= new Image(getDisplay(), r
.width
, r
.height
);
2009 GC gcim
= new GC(fOverView
);
2010 NGC context
= new NGC(this, gcim
);
2011 context
.setBackground(SDViewPref
.getInstance().getBackGroundColor(SDViewPref
.PREF_FRAME
));
2012 fFrame
.draw(context
);
2013 setContentsPos(backX
, backY
);
2017 if ((fOverView
!= null) && (r
.width
== fOverView
.getBounds().width
) && (r
.height
== fOverView
.getBounds().height
)) {
2018 gc
.drawImage(fOverView
, 0, 0, r
.width
, r
.height
, 0, 0, r
.width
, r
.height
);
2021 fZoomValue
= oldzoom
;
2023 super.drawOverview(gc
, r
);
2028 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ITimeCompressionListener#deltaSelected(org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Lifeline, int, int, org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor)
2031 public void deltaSelected(Lifeline lifeline
, int startEvent
, int nbEvent
, IColor color
) {
2032 fFrame
.highlightTimeCompression(lifeline
, startEvent
, nbEvent
, color
);
2033 ensureVisible(lifeline
);
2034 int y1
= lifeline
.getY() + lifeline
.getHeight() + (Metrics
.getMessageFontHeigth() + Metrics
.getMessagesSpacing()) * startEvent
;
2035 int y2
= lifeline
.getY() + lifeline
.getHeight() + (Metrics
.getMessageFontHeigth() + Metrics
.getMessagesSpacing()) * (startEvent
+ nbEvent
);
2036 ensureVisible(lifeline
.getX(), y1
- (Metrics
.getLifelineHeaderFontHeigth() + +2 * Metrics
.LIFELINE_HEARDER_TEXT_V_MARGIN
), lifeline
.getWidth(), y2
- y1
+ 3, SWT
.CENTER
| SWT
.VERTICAL
, true);
2043 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#getVisibleWidth()
2046 public int getVisibleWidth() {
2048 return fPrinter
.getClientArea().width
;
2050 return super.getVisibleWidth();
2055 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#getVisibleHeight()
2058 public int getVisibleHeight() {
2060 return fPrinter
.getClientArea().height
;
2062 return super.getVisibleHeight();
2067 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#contentsToViewX(int)
2070 public int contentsToViewX(int x
) {
2072 int v
= Math
.round(fPrinterX
* fPrinterZoom
);
2075 return x
- getContentsX();
2080 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#contentsToViewY(int)
2083 public int contentsToViewY(int y
) {
2085 int v
= Math
.round(fPrinterY
* fPrinterZoom
);
2088 return y
- getContentsY();
2093 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#getContentsX()
2096 public int getContentsX() {
2098 return Math
.round(fPrinterX
* fPrinterZoom
);
2100 return super.getContentsX();
2106 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.ScrollView#getContentsY()
2109 public int getContentsY() {
2111 return Math
.round(fPrinterY
* fPrinterZoom
);
2113 return super.getContentsY();