import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.events.ShellListener;
-import org.eclipse.swt.graphics.Color;
+//import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Font;
+//import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Pattern;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.graphics.Region;
+//import org.eclipse.swt.graphics.Pattern;
+//import org.eclipse.swt.graphics.Point;
+//import org.eclipse.swt.graphics.Rectangle;
+//import org.eclipse.swt.graphics.Region;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
+//import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Monitor;
+//import org.eclipse.swt.widgets.Listener;
+//import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.tizen.dynamicanalyzer.ui.widgets.AboutDialog;
import org.tizen.dynamicanalyzer.ui.widgets.ConfigurationDialog;
import org.tizen.dynamicanalyzer.ui.widgets.OpenTraceDialog;
-import org.tizen.dynamicanalyzer.ui.widgets.TimerClock;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButton;
import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;
import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboSelectionListener;
+import org.tizen.dynamicanalyzer.widgets.timer.TimerClock;
public class CoolbarArea {
private Composite baseComposite;
// Title bar
- private Composite titlebarComposite;
- private Label titleLabel;
- private DACustomButton minButton;
- private DACustomButton maxButton;
- private DACustomButton closeButton;
+ // private Composite titlebarComposite;
+ // private Label titleLabel;
+ // private DACustomButton minButton;
+ // private DACustomButton maxButton;
+ // private DACustomButton closeButton;
// Toolbar
private Composite toolbarComposite;
private Composite controlComposite;
private DACustomButton startButton;
- private Composite timerComposite;
+ // private Composite timerComposite;
private TimerClock timerClock;
private DACustomButton saveTraceButton;
private DACustomButton openTraceButton;
private static final int TAB_THREAD = 3; // FIXME
// Titlebar image
- private final Image minImage = ImageResources.MIN;
- private final Image minPushImage = ImageResources.MIN_PUSH;
- private final Image minHoverImage = ImageResources.MIN_HOVER;
- private final Image maxImage = ImageResources.MAX;
- private final Image maxPushImage = ImageResources.MAX_PUSH;
- private final Image maxHoverImage = ImageResources.MAX_HOVER;
- private final Image restoreImage = ImageResources.RESTORE;
- private final Image restorePushImage = ImageResources.RESTORE_PUSH;
- private final Image restoreHoverImage = ImageResources.RESTORE_HOVER;
- private final Image closeImage = ImageResources.CLOSE;
- private final Image closePushImage = ImageResources.CLOSE_PUSH;
- private final Image closeHoverImage = ImageResources.CLOSE_HOVER;
+ // private final Image minImage = ImageResources.MIN;
+ // private final Image minPushImage = ImageResources.MIN_PUSH;
+ // private final Image minHoverImage = ImageResources.MIN_HOVER;
+ // private final Image maxImage = ImageResources.MAX;
+ // private final Image maxPushImage = ImageResources.MAX_PUSH;
+ // private final Image maxHoverImage = ImageResources.MAX_HOVER;
+ // private final Image restoreImage = ImageResources.RESTORE;
+ // private final Image restorePushImage = ImageResources.RESTORE_PUSH;
+ // private final Image restoreHoverImage = ImageResources.RESTORE_HOVER;
+ // private final Image closeImage = ImageResources.CLOSE;
+ // private final Image closePushImage = ImageResources.CLOSE_PUSH;
+ // private final Image closeHoverImage = ImageResources.CLOSE_HOVER;
// Toolbar image
- private final Image iconImage = ImageResources.ICON;
+ // private final Image iconImage = ImageResources.ICON;
private final Image bracketImage = ImageResources.BRACKET;
private final Image startImage = ImageResources.START;
private final Image startPushImage = ImageResources.START_PUSH;
private final Image viewSourceDisableImage = ImageResources.VIEW_SOURCE_DISABLE;
// Trim image
- private final Image windowTopFrameImage = ImageResources.WINDOW_TOP;
-// private final Image topImage2 = ImageResources.WINDOW_TOP2;
- private final Image windowLeftFrameImage = ImageResources.WINDOW_LEFT;
- private final Image topLeftNormalImage = ImageResources.WINDOW_TOP_LEFT;
- private final Image topLeftNormalImage2 = ImageResources.WINDOW_TOP_LEFT2;
- private final Image topLeftMaxImage = ImageResources.WINDOW_TOP_LEFT_MAX;
- private final Image topRightNormalImage = ImageResources.WINDOW_TOP_RIGHT;
- private final Image topRightNormalImage2 = ImageResources.WINDOW_TOP_RIGHT2;
- private final Image topRightMaxImage = ImageResources.WINDOW_TOP_RIGHT_MAX;
- private final Image bottomLeftNormalImage = ImageResources.WINDOW_BOTTOM_LEFT;
- private final Image bottomLeftMaxImage = ImageResources.WINDOW_BOTTOM_LEFT_MAX;
- private final Image bottomRightNormalImage = ImageResources.WINDOW_BOTTOM_RIGHT;
- private final Image bottomRightMaxImage = ImageResources.WINDOW_BOTTOM_RIGHT_MAX;
- private final Image windowRightFrameGrayPart = ImageResources.WINDOW_RIGHT_GRAY;
- private final Image windowRightFrameDartGrayPart = ImageResources.WINDOW_RIGHT_DARKGARY;
- private final Image windowRightFrameBlackPart = ImageResources.WINDOW_RIGHT_BLACK;
+ // private final Image windowTopFrameImage = ImageResources.WINDOW_TOP;
+ // private final Image topImage2 = ImageResources.WINDOW_TOP2;
+ // private final Image windowLeftFrameImage = ImageResources.WINDOW_LEFT;
+ // private final Image topLeftNormalImage = ImageResources.WINDOW_TOP_LEFT;
+ // private final Image topLeftNormalImage2 =
+ // ImageResources.WINDOW_TOP_LEFT2;
+ // private final Image topLeftMaxImage = ImageResources.WINDOW_TOP_LEFT_MAX;
+ // private final Image topRightNormalImage =
+ // ImageResources.WINDOW_TOP_RIGHT;
+ // private final Image topRightNormalImage2 =
+ // ImageResources.WINDOW_TOP_RIGHT2;
+ // private final Image topRightMaxImage =
+ // ImageResources.WINDOW_TOP_RIGHT_MAX;
+ // private final Image bottomLeftNormalImage =
+ // ImageResources.WINDOW_BOTTOM_LEFT;
+ // private final Image bottomLeftMaxImage =
+ // ImageResources.WINDOW_BOTTOM_LEFT_MAX;
+ // private final Image bottomRightNormalImage =
+ // ImageResources.WINDOW_BOTTOM_RIGHT;
+ // private final Image bottomRightMaxImage =
+ // ImageResources.WINDOW_BOTTOM_RIGHT_MAX;
+ // private final Image windowRightFrameGrayPart =
+ // ImageResources.WINDOW_RIGHT_GRAY;
+ // private final Image windowRightFrameDartGrayPart =
+ // ImageResources.WINDOW_RIGHT_DARKGARY;
+ // private final Image windowRightFrameBlackPart =
+ // ImageResources.WINDOW_RIGHT_BLACK;
// Tab Image
private final Image tabNormalImage = ImageResources.TAB;
private final Image tabHoverImage = ImageResources.TAB_HOVER;
private final Image tabDisableImage = ImageResources.TAB_DISABLE;
- private Image topLeftImage = topLeftNormalImage;
- private Image topRightImage = topRightNormalImage;
- private Image bottomLeftImage = bottomLeftNormalImage;
- private Image bottomRightImage = bottomRightNormalImage;
+ // private Image topLeftImage = topLeftNormalImage;
+ // private Image topRightImage = topRightNormalImage;
+ // private Image bottomLeftImage = bottomLeftNormalImage;
+ // private Image bottomRightImage = bottomRightNormalImage;
// Color
- private final Color titlebarColor = ColorResources.TITLEBAR_BG_COLOR;
- private final Color titlebarTextColor = ColorResources.TITLEBAR_TEXT_COLOR;
-
- private final Font titlebarTextFont = FontResources.TITLEBAR;
+ // private final Color titlebarColor = ColorResources.TITLEBAR_BG_COLOR;
+ // private final Color titlebarTextColor =
+ // ColorResources.TITLEBAR_TEXT_COLOR;
+ //
+ // private final Font titlebarTextFont = FontResources.TITLEBAR;
private Cursor cursor;
- private static final int DEFAULT_WIDTH = 1024;
- private static final int DEFAULT_HEIGHT = 768;
- private int windowWidth = DEFAULT_WIDTH;
- private int windowHeight = DEFAULT_HEIGHT;
- private boolean isMaximized = false;
- private Point oldSizeOfWindow;
- private Point oldLocationOfWindow;
-
- private static final int START = 0;
- private static final int END = 100;
- private static final int OFFSET_ZERO = 0;
- private static final int OFFSET_ONE = 1;
- private static final int OFFSET_TWO = 2;
- private static final int OFFSET_THREE = 3;
- private static final int OFFSET_FOUR = 4;
- private static final int OFFSET_FIVE = 5;
- private static final int OFFSET_TEN = 10;
-
- private static final int TIMER_WIDTH = 125;
+ // private static final int DEFAULT_WIDTH = 1024;
+ // private static final int DEFAULT_HEIGHT = 768;
+ // private int windowWidth = DEFAULT_WIDTH;
+ // private int windowHeight = DEFAULT_HEIGHT;
+ // private boolean isMaximized = false;
+ // private Point oldSizeOfWindow;
+ // private Point oldLocationOfWindow;
+
+ // private static final int START = 0;
+ // private static final int END = 100;
+ // private static final int OFFSET_ZERO = 0;
+ // private static final int OFFSET_ONE = 1;
+ // private static final int OFFSET_TWO = 2;
+ // private static final int OFFSET_THREE = 3;
+ // private static final int OFFSET_FOUR = 4;
+ // private static final int OFFSET_FIVE = 5;
+ // private static final int OFFSET_TEN = 10;
+
+ private static final int TIMER_WIDTH = 148;
private static final int PAGE_BUTTON_WIDTH = 128;
private static final int PAGE_BUTTON_HEIGHT = 23;
}
};
- private Listener titlebarListener = new Listener() {
- Point downPt = null;
- Point downLocation = null;
-
- @Override
- public void handleEvent(Event e) {
- // Sets start location.
- if (SWT.MouseDown == e.type && 1 == e.button) {
- Display display = Display.getCurrent();
- if (null == display)
- display = Display.getDefault();
- downPt = display.getCursorLocation();
- downLocation = shell.getLocation();
- }
- // Handles move of window.
- if (SWT.MouseMove == e.type && 0 != (e.stateMask & SWT.BUTTON1)) {
- Display display = Display.getCurrent();
- if (null == display)
- display = Display.getDefault();
- Point p = display.getCursorLocation();
- shell.setLocation(downLocation.x - (downPt.x - p.x),
- downLocation.y - (downPt.y - p.y));
- }
-
- // Handles maximization of window.
- if (SWT.MouseDoubleClick == e.type && 1 == e.button) {
- handleMaximization();
- }
- }
- };
-
- public int setCursorStyle(int oldCursorStyle, int width, int height, int x,
- int y) {
- int ret = oldCursorStyle;
+ // private Listener titlebarListener = new Listener() {
+ // Point downPt = null;
+ // Point downLocation = null;
+ //
+ // @Override
+ // public void handleEvent(Event e) {
+ // // Sets start location.
+ // if (SWT.MouseDown == e.type && 1 == e.button) {
+ // Display display = Display.getCurrent();
+ // if (null == display)
+ // display = Display.getDefault();
+ // downPt = display.getCursorLocation();
+ // downLocation = shell.getLocation();
+ // }
+ //
+ // // Handles move of window.
+ // if (SWT.MouseMove == e.type && 0 != (e.stateMask & SWT.BUTTON1)) {
+ // Display display = Display.getCurrent();
+ // if (null == display)
+ // display = Display.getDefault();
+ // Point p = display.getCursorLocation();
+ // shell.setLocation(downLocation.x - (downPt.x - p.x),
+ // downLocation.y - (downPt.y - p.y));
+ // }
+ //
+ // // Handles maximization of window.
+ // if (SWT.MouseDoubleClick == e.type && 1 == e.button) {
+ // handleMaximization();
+ // }
+ // }
+ // };
- if (x < OFFSET_TEN) {
- if (y < OFFSET_TEN)
- ret = SWT.CURSOR_SIZENW;
- else if (y > (height - OFFSET_TEN))
- ret = SWT.CURSOR_SIZESW;
- else
- ret = SWT.CURSOR_SIZEW;
- } else if (x > (width - OFFSET_TEN)) {
- if (y < OFFSET_TEN)
- ret = SWT.CURSOR_SIZENE;
- else if (y > (height - OFFSET_TEN))
- ret = SWT.CURSOR_SIZESE;
- else
- ret = SWT.CURSOR_SIZEE;
- } else {
- if (y < OFFSET_TEN)
- ret = SWT.CURSOR_SIZEN;
- else if (y > (height - OFFSET_TEN))
- ret = SWT.CURSOR_SIZES;
- else
- ;
- }
+ // public int setCursorStyle(int oldCursorStyle, int width, int height, int
+ // x,
+ // int y) {
+ // int ret = oldCursorStyle;
+ //
+ // if (x < OFFSET_TEN) {
+ // if (y < OFFSET_TEN)
+ // ret = SWT.CURSOR_SIZENW;
+ // else if (y > (height - OFFSET_TEN))
+ // ret = SWT.CURSOR_SIZESW;
+ // else
+ // ret = SWT.CURSOR_SIZEW;
+ // } else if (x > (width - OFFSET_TEN)) {
+ // if (y < OFFSET_TEN)
+ // ret = SWT.CURSOR_SIZENE;
+ // else if (y > (height - OFFSET_TEN))
+ // ret = SWT.CURSOR_SIZESE;
+ // else
+ // ret = SWT.CURSOR_SIZEE;
+ // } else {
+ // if (y < OFFSET_TEN)
+ // ret = SWT.CURSOR_SIZEN;
+ // else if (y > (height - OFFSET_TEN))
+ // ret = SWT.CURSOR_SIZES;
+ // else
+ // ;
+ // }
- return setCursor(oldCursorStyle, ret);
- }
+ // return setCursor(oldCursorStyle, ret);
+ // }
public int setCursor(int oldStyle, int newStyle) {
if (oldStyle == newStyle)
return newStyle;
}
- private Display getDisplay() {
- Display display = Display.getCurrent();
- if (null == display)
- display = Display.getDefault();
- return display;
- }
-
- public void resizeWindow(Rectangle downRect, Point oldPoint,
- Point newPoint, int cursorStyle) {
- Rectangle newRect = new Rectangle(downRect.x, downRect.y,
- downRect.width, downRect.height);
-
- if (oldPoint == null || newPoint == null)
- return;
-
- switch (cursorStyle) {
- case SWT.CURSOR_SIZEN:
- newRect.y -= (oldPoint.y - newPoint.y);
- newRect.height += (oldPoint.y - newPoint.y);
- break;
- case SWT.CURSOR_SIZENW:
- newRect.x -= (oldPoint.x - newPoint.x);
- newRect.y -= (oldPoint.y - newPoint.y);
- newRect.width += (oldPoint.x - newPoint.x);
- newRect.height += (oldPoint.y - newPoint.y);
- break;
- case SWT.CURSOR_SIZENE:
- newRect.y -= (oldPoint.y - newPoint.y);
- newRect.width -= (oldPoint.x - newPoint.x);
- newRect.height += (oldPoint.y - newPoint.y);
- break;
- case SWT.CURSOR_SIZES:
- newRect.height -= (oldPoint.y - newPoint.y);
- break;
- case SWT.CURSOR_SIZESW:
- newRect.x -= (oldPoint.x - newPoint.x);
- newRect.width += (oldPoint.x - newPoint.x);
- newRect.height -= (oldPoint.y - newPoint.y);
- break;
- case SWT.CURSOR_SIZESE:
- newRect.width -= oldPoint.x - newPoint.x;
- newRect.height -= (oldPoint.y - newPoint.y);
- break;
- case SWT.CURSOR_SIZEW:
- newRect.x -= (oldPoint.x - newPoint.x);
- newRect.width += (oldPoint.x - newPoint.x);
- break;
- case SWT.CURSOR_SIZEE:
- newRect.width -= (oldPoint.x - newPoint.x);
- break;
- default:
- return;
- }
-
- if (newRect.height < 400 || newRect.width < 600)
- return;
- windowHeight = newRect.height;
- windowWidth = newRect.width;
- shell.setBounds(newRect);
- }
-
- private Listener trimListener = new Listener() {
- int cursorStyle;
- Point downPoint = null;
- boolean isPatternInit = false;
- Pattern topP = null;
- Pattern leftP = null;
- Pattern grayP = null;
- Pattern darkGrayP = null;
- Pattern blackP = null;
- Rectangle downRect = null;
- Display display = null;
-
- boolean isMouseDown = false;
-
- @Override
- public void handleEvent(Event e) {
- int x = e.x;
- int y = e.y;
-
- // Sets start location.
- if (SWT.MouseDown == e.type && 1 == e.button) {
- isMouseDown = true;
- if (null == display) {
- display = getDisplay();
- }
- downPoint = display.getCursorLocation();
- downRect = shell.getBounds();
- }
-
- // Sets mouse moving state.
- if (SWT.MouseUp == e.type) {
- if (null == display) {
- display = getDisplay();
- }
- Point p = display.getCursorLocation();
- resizeWindow(downRect, downPoint, p, cursorStyle);
- isMouseDown = false;
- }
-
- if (SWT.MouseMove == e.type) {
- if (false == isMouseDown) {
- cursorStyle = setCursorStyle(cursorStyle, windowWidth,
- windowHeight, x, y);
- } else {
- if (null == display) {
- display = getDisplay();
- }
- Point p = display.getCursorLocation();
- resizeWindow(downRect, downPoint, p, cursorStyle);
- }
- }
- if (SWT.MouseEnter == e.type) {
- }
- if (SWT.MouseExit == e.type) {
- cursorStyle = setCursor(cursorStyle, SWT.CURSOR_ARROW);
- }
-
- if (SWT.MouseHover == e.type) {
- if (true == isMouseDown) {
- if (null == display) {
- display = getDisplay();
- }
- Point p = display.getCursorLocation();
- resizeWindow(downRect, downPoint, p, cursorStyle);
- }
- }
- // Draws trim image.
- if (SWT.Paint == e.type) {
- // Draws top trim.
- if (false == isPatternInit) {
- topP = new Pattern(shell.getDisplay(), windowTopFrameImage);
-
- leftP = new Pattern(shell.getDisplay(),
- windowLeftFrameImage);
-
- grayP = new Pattern(shell.getDisplay(),
- windowRightFrameGrayPart);
-
- darkGrayP = new Pattern(shell.getDisplay(),
- windowRightFrameDartGrayPart);
+ // private Display getDisplay() {
+ // Display display = Display.getCurrent();
+ // if (null == display)
+ // display = Display.getDefault();
+ // return display;
+ // }
- blackP = new Pattern(shell.getDisplay(),
- windowRightFrameBlackPart);
+ // public void resizeWindow(Rectangle downRect, Point oldPoint,
+ // Point newPoint, int cursorStyle) {
+ // Rectangle newRect = new Rectangle(downRect.x, downRect.y,
+ // downRect.width, downRect.height);
+ //
+ // if (oldPoint == null || newPoint == null)
+ // return;
+ //
+ // switch (cursorStyle) {
+ // case SWT.CURSOR_SIZEN:
+ // newRect.y -= (oldPoint.y - newPoint.y);
+ // newRect.height += (oldPoint.y - newPoint.y);
+ // break;
+ // case SWT.CURSOR_SIZENW:
+ // newRect.x -= (oldPoint.x - newPoint.x);
+ // newRect.y -= (oldPoint.y - newPoint.y);
+ // newRect.width += (oldPoint.x - newPoint.x);
+ // newRect.height += (oldPoint.y - newPoint.y);
+ // break;
+ // case SWT.CURSOR_SIZENE:
+ // newRect.y -= (oldPoint.y - newPoint.y);
+ // newRect.width -= (oldPoint.x - newPoint.x);
+ // newRect.height += (oldPoint.y - newPoint.y);
+ // break;
+ // case SWT.CURSOR_SIZES:
+ // newRect.height -= (oldPoint.y - newPoint.y);
+ // break;
+ // case SWT.CURSOR_SIZESW:
+ // newRect.x -= (oldPoint.x - newPoint.x);
+ // newRect.width += (oldPoint.x - newPoint.x);
+ // newRect.height -= (oldPoint.y - newPoint.y);
+ // break;
+ // case SWT.CURSOR_SIZESE:
+ // newRect.width -= oldPoint.x - newPoint.x;
+ // newRect.height -= (oldPoint.y - newPoint.y);
+ // break;
+ // case SWT.CURSOR_SIZEW:
+ // newRect.x -= (oldPoint.x - newPoint.x);
+ // newRect.width += (oldPoint.x - newPoint.x);
+ // break;
+ // case SWT.CURSOR_SIZEE:
+ // newRect.width -= (oldPoint.x - newPoint.x);
+ // break;
+ // default:
+ // return;
+ // }
+ //
+ // if (newRect.height < 400 || newRect.width < 600)
+ // return;
+ // windowHeight = newRect.height;
+ // windowWidth = newRect.width;
+ // shell.setBounds(newRect);
+ // }
- isPatternInit = true;
- }
- e.gc.setBackgroundPattern(topP);
- e.gc.fillRectangle(
- DesignConstants.WINDOW_FRAME_LEFT_MARGIN,
- 0,
- windowWidth
- - (DesignConstants.WINDOW_FRAME_LEFT_MARGIN + DesignConstants.WINDOW_FRAME_RIGHT_MARGIN),
- DesignConstants.WINDOW_FRAME_TOP_MARGIN);
-
- // Draws left trim.
- e.gc.setBackgroundPattern(leftP);
- e.gc.fillRectangle(
- 0,
- DesignConstants.WINDOW_FRAME_TOP_MARGIN
- + DesignConstants.TITLEBAR_HEIGHT,
- DesignConstants.WINDOW_FRAME_LEFT_MARGIN,
- windowHeight
- - (DesignConstants.WINDOW_FRAME_TOP_MARGIN
- + DesignConstants.TITLEBAR_HEIGHT + DesignConstants.WINDOW_FRAME_BOTTOM_MARGIN));
- // pattern.dispose();
-
- // Draws right trim.
- e.gc.setBackgroundPattern(grayP);
- e.gc.fillRectangle(
- windowWidth - DesignConstants.WINDOW_FRAME_RIGHT_MARGIN,
- DesignConstants.WINDOW_FRAME_TOP_MARGIN
- + DesignConstants.TITLEBAR_HEIGHT,
- DesignConstants.WINDOW_FRAME_PART_SIZE,
- windowHeight
- - (DesignConstants.TITLEBAR_HEIGHT
- + DesignConstants.WINDOW_FRAME_TOP_MARGIN + DesignConstants.WINDOW_FRAME_BOTTOM_MARGIN));
-
- e.gc.setBackgroundPattern(darkGrayP);
- e.gc.fillRectangle(
- windowWidth - DesignConstants.WINDOW_FRAME_RIGHT_MARGIN
- + DesignConstants.WINDOW_FRAME_PART_SIZE,
- DesignConstants.WINDOW_FRAME_TOP_MARGIN
- + DesignConstants.TITLEBAR_HEIGHT,
- DesignConstants.WINDOW_FRAME_PART_SIZE * 2,
- windowHeight
- - (DesignConstants.TITLEBAR_HEIGHT
- + DesignConstants.WINDOW_FRAME_TOP_MARGIN + DesignConstants.WINDOW_FRAME_BOTTOM_MARGIN));
-
- e.gc.setBackgroundPattern(grayP);
- e.gc.fillRectangle(
- windowWidth - DesignConstants.WINDOW_FRAME_PART_SIZE
- * 2,
- DesignConstants.WINDOW_FRAME_TOP_MARGIN
- + DesignConstants.TITLEBAR_HEIGHT,
- DesignConstants.WINDOW_FRAME_PART_SIZE,
- windowHeight
- - (DesignConstants.TITLEBAR_HEIGHT
- + DesignConstants.WINDOW_FRAME_TOP_MARGIN + DesignConstants.WINDOW_FRAME_BOTTOM_MARGIN));
-
- e.gc.setBackgroundPattern(blackP);
- e.gc.fillRectangle(
- windowWidth - DesignConstants.WINDOW_FRAME_PART_SIZE,
- DesignConstants.WINDOW_FRAME_TOP_MARGIN
- + DesignConstants.TITLEBAR_HEIGHT,
- DesignConstants.WINDOW_FRAME_PART_SIZE,
- windowHeight
- - (DesignConstants.TITLEBAR_HEIGHT
- + DesignConstants.WINDOW_FRAME_TOP_MARGIN + DesignConstants.WINDOW_FRAME_BOTTOM_MARGIN));
-
- // Draws bottom trim.
- e.gc.setBackgroundPattern(grayP);
- e.gc.fillRectangle(OFFSET_FIVE, windowHeight - OFFSET_FIVE,
- windowWidth - OFFSET_TEN, OFFSET_ONE);
-
- e.gc.setBackgroundPattern(darkGrayP);
- e.gc.fillRectangle(OFFSET_FIVE, windowHeight - OFFSET_FOUR,
- windowWidth - OFFSET_TEN, OFFSET_TWO);
-
- e.gc.setBackgroundPattern(grayP);
- e.gc.fillRectangle(OFFSET_FIVE, windowHeight - OFFSET_TWO,
- windowWidth - OFFSET_TEN, OFFSET_ONE);
-
- e.gc.setBackgroundPattern(blackP);
- e.gc.fillRectangle(OFFSET_FIVE, windowHeight - OFFSET_ONE,
- windowWidth - OFFSET_TEN, OFFSET_ONE);
-
- // pattern.dispose();
-
- // Draws corner trim.
- e.gc.drawImage(topLeftImage, START, START);
- e.gc.drawImage(topLeftNormalImage2, START, OFFSET_FIVE);
- e.gc.drawImage(topRightImage, windowWidth - OFFSET_FIVE, START);
- e.gc.drawImage(topRightNormalImage2, windowWidth - OFFSET_FIVE,
- OFFSET_FIVE);
- e.gc.drawImage(bottomLeftImage, START, windowHeight
- - OFFSET_FIVE);
- e.gc.drawImage(bottomRightImage, windowWidth - OFFSET_FIVE,
- windowHeight - OFFSET_FIVE);
-
- // Sets region.
- setShellRegion();
- }
- }
- };
+ // private Listener trimListener = new Listener() {
+ // int cursorStyle;
+ // Point downPoint = null;
+ // boolean isPatternInit = false;
+ // Pattern topP = null;
+ // Pattern leftP = null;
+ // Pattern grayP = null;
+ // Pattern darkGrayP = null;
+ // Pattern blackP = null;
+ // Rectangle downRect = null;
+ // Display display = null;
+ //
+ // boolean isMouseDown = false;
+ //
+ // @Override
+ // public void handleEvent(Event e) {
+ // int x = e.x;
+ // int y = e.y;
+ //
+ // // Sets start location.
+ // if (SWT.MouseDown == e.type && 1 == e.button) {
+ // isMouseDown = true;
+ // if (null == display) {public void resizeWindow(Rectangle downRect, Point
+ // oldPoint,
+ // Point newPoint, int cursorStyle) {
+ // Rectangle newRect = new Rectangle(downRect.x, downRect.y,
+ // downRect.width, downRect.height);
+ //
+ // if (oldPoint == null || newPoint == null)
+ // return;
+ //
+ // switch (cursorStyle) {
+ // case SWT.CURSOR_SIZEN:
+ // newRect.y -= (oldPoint.y - newPoint.y);
+ // newRect.height += (oldPoint.y - newPoint.y);
+ // break;
+ // case SWT.CURSOR_SIZENW:
+ // newRect.x -= (oldPoint.x - newPoint.x);
+ // newRect.y -= (oldPoint.y - newPoint.y);
+ // newRect.width += (oldPoint.x - newPoint.x);
+ // newRect.height += (oldPoint.y - newPoint.y);
+ // break;
+ // case SWT.CURSOR_SIZENE:
+ // newRect.y -= (oldPoint.y - newPoint.y);
+ // newRect.width -= (oldPoint.x - newPoint.x);
+ // newRect.height += (oldPoint.y - newPoint.y);
+ // break;
+ // case SWT.CURSOR_SIZES:
+ // newRect.height -= (oldPoint.y - newPoint.y);
+ // break;
+ // case SWT.CURSOR_SIZESW:
+ // newRect.x -= (oldPoint.x - newPoint.x);
+ // newRect.width += (oldPoint.x - newPoint.x);
+ // newRect.height -= (oldPoint.y - newPoint.y);
+ // break;
+ // case SWT.CURSOR_SIZESE:
+ // newRect.width -= oldPoint.x - newPoint.x;
+ // newRect.height -= (oldPoint.y - newPoint.y);
+ // break;
+ // case SWT.CURSOR_SIZEW:
+ // newRect.x -= (oldPoint.x - newPoint.x);
+ // newRect.width += (oldPoint.x - newPoint.x);
+ // break;
+ // case SWT.CURSOR_SIZEE:
+ // newRect.width -= (oldPoint.x - newPoint.x);
+ // break;
+ // default:
+ // return;
+ // }
+ //
+ // if (newRect.height < 400 || newRect.width < 600)
+ // return;
+ // windowHeight = newRect.height;
+ // windowWidth = newRect.width;
+ // shell.setBounds(newRect);
+ // }
+ // display = getDisplay();
+ // }
+ // downPoint = display.getCursorLocation();
+ // downRect = shell.getBounds();
+ // }
+ //
+ // // Sets mouse moving state.
+ // if (SWT.MouseUp == e.type) {
+ // if (null == display) {
+ // display = getDisplay();
+ // }
+ // Point p = display.getCursorLocation();
+ // resizeWindow(downRect, downPoint, p, cursorStyle);
+ // isMouseDown = false;
+ // }
+ //
+ // if (SWT.MouseMove == e.type) {
+ // if (false == isMouseDown) {
+ // cursorStyle = setCursorStyle(cursorStyle, windowWidth,
+ // windowHeight, x, y);
+ // } else {
+ // if (null == display) {
+ // display = getDisplay();
+ // }
+ // Point p = display.getCursorLocation();
+ // resizeWindow(downRect, downPoint, p, cursorStyle);
+ // }
+ // }
+ // if (SWT.MouseEnter == e.type) {
+ // }
+ // if (SWT.MouseExit == e.type) {
+ // cursorStyle = setCursor(cursorStyle, SWT.CURSOR_ARROW);
+ // }
+ //
+ // if (SWT.MouseHover == e.type) {
+ // if (true == isMouseDown) {
+ // if (null == display) {
+ // display = getDisplay();
+ // }
+ // Point p = display.getCursorLocation();
+ // resizeWindow(downRect, downPoint, p, cursorStyle);
+ // }
+ // }
+ // // Draws trim image.
+ // if (SWT.Paint == e.type) {
+ // // Draws top trim.
+ // if (false == isPatternInit) {
+ // topP = new Pattern(shell.getDisplay(), windowTopFrameImage);
+ //
+ // leftP = new Pattern(shell.getDisplay(),
+ // windowLeftFrameImage);
+ //
+ // grayP = new Pattern(shell.getDisplay(),
+ // windowRightFrameGrayPart);
+ //
+ // darkGrayP = new Pattern(shell.getDisplay(),
+ // windowRightFrameDartGrayPart);
+ //
+ // blackP = new Pattern(shell.getDisplay(),
+ // windowRightFrameBlackPart);
+ //
+ // isPatternInit = true;
+ // }
+ // e.gc.setBackgroundPattern(topP);
+ // e.gc.fillRectangle(
+ // DesignConstants.WINDOW_FRAME_LEFT_MARGIN,
+ // 0,
+ // windowWidth
+ // - (DesignConstants.WINDOW_FRAME_LEFT_MARGIN +
+ // DesignConstants.WINDOW_FRAME_RIGHT_MARGIN),
+ // DesignConstants.WINDOW_FRAME_TOP_MARGIN);
+ //
+ // // Draws left trim.
+ // e.gc.setBackgroundPattern(leftP);
+ // e.gc.fillRectangle(
+ // 0,
+ // DesignConstants.WINDOW_FRAME_TOP_MARGIN
+ // + DesignConstants.TITLEBAR_HEIGHT,
+ // DesignConstants.WINDOW_FRAME_LEFT_MARGIN,
+ // windowHeight
+ // - (DesignConstants.WINDOW_FRAME_TOP_MARGIN
+ // + DesignConstants.TITLEBAR_HEIGHT +
+ // DesignConstants.WINDOW_FRAME_BOTTOM_MARGIN));
+ // // pattern.dispose();
+ //
+ // // Draws right trim.
+ // e.gc.setBackgroundPattern(grayP);
+ // e.gc.fillRectangle(
+ // windowWidth - DesignConstants.WINDOW_FRAME_RIGHT_MARGIN,
+ // DesignConstants.WINDOW_FRAME_TOP_MARGIN
+ // + DesignConstants.TITLEBAR_HEIGHT,
+ // DesignConstants.WINDOW_FRAME_PART_SIZE,
+ // windowHeight
+ // - (DesignConstants.TITLEBAR_HEIGHT
+ // + DesignConstants.WINDOW_FRAME_TOP_MARGIN +
+ // DesignConstants.WINDOW_FRAME_BOTTOM_MARGIN));
+ //
+ // e.gc.setBackgroundPattern(darkGrayP);
+ // e.gc.fillRectangle(
+ // windowWidth - DesignConstants.WINDOW_FRAME_RIGHT_MARGIN
+ // + DesignConstants.WINDOW_FRAME_PART_SIZE,
+ // DesignConstants.WINDOW_FRAME_TOP_MARGIN
+ // + DesignConstants.TITLEBAR_HEIGHT,
+ // DesignConstants.WINDOW_FRAME_PART_SIZE * 2,
+ // windowHeight
+ // - (DesignConstants.TITLEBAR_HEIGHT
+ // + DesignConstants.WINDOW_FRAME_TOP_MARGIN +
+ // DesignConstants.WINDOW_FRAME_BOTTOM_MARGIN));
+ //
+ // e.gc.setBackgroundPattern(grayP);
+ // e.gc.fillRectangle(
+ // windowWidth - DesignConstants.WINDOW_FRAME_PART_SIZE
+ // * 2,
+ // DesignConstants.WINDOW_FRAME_TOP_MARGIN
+ // + DesignConstants.TITLEBAR_HEIGHT,
+ // DesignConstants.WINDOW_FRAME_PART_SIZE,
+ // windowHeight
+ // - (DesignConstants.TITLEBAR_HEIGHT
+ // + DesignConstants.WINDOW_FRAME_TOP_MARGIN +
+ // DesignConstants.WINDOW_FRAME_BOTTOM_MARGIN));
+ //
+ // e.gc.setBackgroundPattern(blackP);
+ // e.gc.fillRectangle(
+ // windowWidth - DesignConstants.WINDOW_FRAME_PART_SIZE,
+ // DesignConstants.WINDOW_FRAME_TOP_MARGIN
+ // + DesignConstants.TITLEBAR_HEIGHT,
+ // DesignConstants.WINDOW_FRAME_PART_SIZE,
+ // windowHeight
+ // - (DesignConstants.TITLEBAR_HEIGHT
+ // + DesignConstants.WINDOW_FRAME_TOP_MARGIN +
+ // DesignConstants.WINDOW_FRAME_BOTTOM_MARGIN));
+ //
+ // // Draws bottom trim.
+ // e.gc.setBackgroundPattern(grayP);
+ // e.gc.fillRectangle(OFFSET_FIVE, windowHeight - OFFSET_FIVE,
+ // windowWidth - OFFSET_TEN, OFFSET_ONE);
+ //
+ // e.gc.setBackgroundPattern(darkGrayP);
+ // e.gc.fillRectangle(OFFSET_FIVE, windowHeight - OFFSET_FOUR,
+ // windowWidth - OFFSET_TEN, OFFSET_TWO);
+ //
+ // e.gc.setBackgroundPattern(grayP);
+ // e.gc.fillRectangle(OFFSET_FIVE, windowHeight - OFFSET_TWO,
+ // windowWidth - OFFSET_TEN, OFFSET_ONE);
+ //
+ // e.gc.setBackgroundPattern(blackP);
+ // e.gc.fillRectangle(OFFSET_FIVE, windowHeight - OFFSET_ONE,
+ // windowWidth - OFFSET_TEN, OFFSET_ONE);
+ //
+ // // pattern.dispose();
+ //
+ // // Draws corner trim.
+ // e.gc.drawImage(topLeftImage, START, START);
+ // e.gc.drawImage(topLeftNormalImage2, START, OFFSET_FIVE);
+ // e.gc.drawImage(topRightImage, windowWidth - OFFSET_FIVE, START);
+ // e.gc.drawImage(topRightNormalImage2, windowWidth - OFFSET_FIVE,
+ // OFFSET_FIVE);
+ // e.gc.drawImage(bottomLeftImage, START, windowHeight
+ // - OFFSET_FIVE);
+ // e.gc.drawImage(bottomRightImage, windowWidth - OFFSET_FIVE,
+ // windowHeight - OFFSET_FIVE);
+ //
+ // // Sets region.
+ // setShellRegion();
+ // }
+ // }
+ // };
private CoolbarArea(IWorkbenchWindowConfigurer configurer, Shell sh) {
shell = sh;
// createTitlebar(titlebarComposite);
final FormLayout formLayout = new FormLayout();
- formLayout.marginWidth = OFFSET_ZERO;
+ formLayout.marginWidth = 0;
// Creates toolbar.
toolbarComposite = new Composite(baseComposite, SWT.NONE);
toolbarComposite.setLayoutData(data);
data = new FormData();
- data.top = new FormAttachment(toolbarComposite, OFFSET_ZERO, SWT.BOTTOM);
- data.left = new FormAttachment(START, 0);
- data.right = new FormAttachment(END, 0);
+ data.top = new FormAttachment(toolbarComposite, 0, SWT.BOTTOM);
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
// data.bottom = new FormAttachment(toolbarComposite, 25, SWT.BOTTOM);
lineComposite.setLayoutData(data);
data = new FormData();
- data.top = new FormAttachment(lineComposite, OFFSET_ZERO, SWT.BOTTOM);
- data.left = new FormAttachment(START, 0);
- data.right = new FormAttachment(END, 0);
- data.bottom = new FormAttachment(END, 0);
+ data.top = new FormAttachment(lineComposite, 0, SWT.BOTTOM);
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.bottom = new FormAttachment(100, 0);
page.setLayoutData(data);
configurer.getWindow().getShell().layout(true);
// addTitlebarAndShellListeners();
}
- private void addTitlebarListeners() {
- minButton.addClickListener(new DACustomButtonClickEventListener() {
-
- @Override
- public void handleClickEvent(DACustomButton button) {
- shell.setMinimized(true);
- }
- });
-
- maxButton.addClickListener(new DACustomButtonClickEventListener() {
-
- @Override
- public void handleClickEvent(DACustomButton button) {
- handleMaximization();
- }
-
- });
+ // private void addTitlebarListeners() {
+ // minButton.addClickListener(new DACustomButtonClickEventListener() {
+ //
+ // @Override
+ // public void handleClickEvent(DACustomButton button) {
+ // shell.setMinimized(true);
+ // }
+ // });
- closeButton.addClickListener(new DACustomButtonClickEventListener() {
+ // maxButton.addClickListener(new DACustomButtonClickEventListener() {
+ //
+ // @Override
+ // public void handleClickEvent(DACustomButton button) {
+ // handleMaximization();
+ // }
+ //
+ // });
- @Override
- public void handleClickEvent(DACustomButton button) {
- PlatformUI.getWorkbench().close();
- }
- });
- }
+ // closeButton.addClickListener(new DACustomButtonClickEventListener() {
+ //
+ // @Override
+ // public void handleClickEvent(DACustomButton button) {
+ // PlatformUI.getWorkbench().close();
+ // }
+ // });
+ // }
public void setRepalyButtonEnable(boolean enabled) {
Project p = AnalyzerManager.getProject();
}
- private void addTitlebarAndShellListeners() {
- titlebarComposite.addListener(SWT.MouseDoubleClick, titlebarListener);
- titleLabel.addListener(SWT.MouseDoubleClick, titlebarListener);
- shell.addListener(SWT.Paint, trimListener);
- addTitlebarAndShellMouseListeners();
- }
-
- private void addTitlebarAndShellMouseListeners() {
- titlebarComposite.addListener(SWT.MouseDown, titlebarListener);
- titlebarComposite.addListener(SWT.MouseMove, titlebarListener);
- titleLabel.addListener(SWT.MouseDown, titlebarListener);
- titleLabel.addListener(SWT.MouseMove, titlebarListener);
- shell.addListener(SWT.MouseDown, trimListener);
- shell.addListener(SWT.MouseMove, trimListener);
- shell.addListener(SWT.MouseUp, trimListener);
- shell.addListener(SWT.MouseHover, trimListener);
- shell.addListener(SWT.MouseEnter, trimListener);
- shell.addListener(SWT.MouseExit, trimListener);
+ // private void addTitlebarAndShellListeners() {
+ // titlebarComposite.addListener(SWT.MouseDoubleClick, titlebarListener);
+ // titleLabel.addListener(SWT.MouseDoubleClick, titlebarListener);
+ // shell.addListener(SWT.Paint, trimListener);
+ // addTitlebarAndShellMouseListeners();
+ // }
- }
+ // private void addTitlebarAndShellMouseListeners() {
+ // titlebarComposite.addListener(SWT.MouseDown, titlebarListener);
+ // titlebarComposite.addListener(SWT.MouseMove, titlebarListener);
+ // titleLabel.addListener(SWT.MouseDown, titlebarListener);
+ // titleLabel.addListener(SWT.MouseMove, titlebarListener);
+ // shell.addListener(SWT.MouseDown, trimListener);
+ // shell.addListener(SWT.MouseMove, trimListener);
+ // shell.addListener(SWT.MouseUp, trimListener);
+ // shell.addListener(SWT.MouseHover, trimListener);
+ // shell.addListener(SWT.MouseEnter, trimListener);
+ // shell.addListener(SWT.MouseExit, trimListener);
+ //
+ // }
// TODO Remove or modify.
// private void createCategoryMenu() {
// });
// }
- private void createTitlebar(Composite parent) {
- // Creates icon label.
- Label iconLabel = new Label(parent, SWT.NONE);
- iconLabel.setImage(iconImage);
-
- // Set layout
- FormData data = new FormData();
- data.top = new FormAttachment(START, OFFSET_TWO);
- data.left = new FormAttachment(START, OFFSET_FIVE);
- iconLabel.setLayoutData(data);
-
- // Creates title label.
- titleLabel = new Label(parent, SWT.TRANSPARENT);
- titleLabel.setBackground(titlebarColor);
- titleLabel.setForeground(titlebarTextColor);
- titleLabel.setFont(titlebarTextFont);
- titleLabel.setText(AnalyzerLabels.DYNAMIC_ANALYZER);
- // set layout
- data = new FormData();
- data.top = new FormAttachment(START, OFFSET_THREE);
- data.left = new FormAttachment(iconLabel, OFFSET_FOUR);
- titleLabel.setLayoutData(data);
-
- // Creates button composite
- // which contains category combo, min, max and exit buttons.
- Composite buttonComposite = new Composite(parent, SWT.NONE);
- buttonComposite.setLayout(new FormLayout());
- buttonComposite.setBackground(titlebarColor);
-
- // Creates minimization button.
- minButton = new DACustomButton(buttonComposite, minImage, minPushImage,
- minHoverImage, null);
- minButton.setToolTipText(AnalyzerLabels.MIN);
-
- // Creates maximization button.
- maxButton = new DACustomButton(buttonComposite, maxImage, maxPushImage,
- maxHoverImage, null);
- maxButton.setToolTipText(AnalyzerLabels.MAX);
-
- // Creates exit button.
- closeButton = new DACustomButton(buttonComposite, closeImage,
- closePushImage, closeHoverImage, null);
- closeButton.setToolTipText(AnalyzerLabels.CLOSE);
-
- data = new FormData();
- data.top = new FormAttachment(START, OFFSET_ZERO);
- data.right = new FormAttachment(END, OFFSET_ZERO);
- data.bottom = new FormAttachment(END, -OFFSET_FIVE);
- buttonComposite.setLayoutData(data);
-
- data = new FormData();
- data.top = new FormAttachment(START, OFFSET_TWO);
- data.height = 18;
- data.width = 28;
- minButton.setLayoutData(data);
-
- data = new FormData();
- data.top = new FormAttachment(START, OFFSET_TWO);
- data.left = new FormAttachment(minButton, OFFSET_ZERO, SWT.RIGHT);
- data.height = 18;
- data.width = 27;
- maxButton.setLayoutData(data);
-
- data = new FormData();
- data.top = new FormAttachment(START, OFFSET_TWO);
- data.left = new FormAttachment(maxButton, OFFSET_ZERO, SWT.RIGHT);
- data.height = 18;
- data.width = 46;
- closeButton.setLayoutData(data);
-
- // Adds title bar listeners.
- addTitlebarListeners();
- }
+ // private void createTitlebar(Composite parent) {
+ // // Creates icon label.
+ // Label iconLabel = new Label(parent, SWT.NONE);
+ // iconLabel.setImage(iconImage);
+ //
+ // // Set layout
+ // FormData data = new FormData();
+ // data.top = new FormAttachment(0, 2);
+ // data.left = new FormAttachment(0, 5);
+ // iconLabel.setLayoutData(data);
+ //
+ // // Creates title label.
+ // titleLabel = new Label(parent, SWT.TRANSPARENT);
+ // titleLabel.setBackground(titlebarColor);
+ // titleLabel.setForeground(titlebarTextColor);
+ // titleLabel.setFont(titlebarTextFont);
+ // titleLabel.setText(AnalyzerLabels.DYNAMIC_ANALYZER);
+ // // set layout
+ // data = new FormData();
+ // data.top = new FormAttachment(0, 3);
+ // data.left = new FormAttachment(iconLabel, 4);
+ // titleLabel.setLayoutData(data);
+ //
+ // // Creates button composite
+ // // which contains category combo, min, max and exit buttons.
+ // Composite buttonComposite = new Composite(parent, SWT.NONE);
+ // buttonComposite.setLayout(new FormLayout());
+ // buttonComposite.setBackground(titlebarColor);
+ //
+ // // Creates minimization button.
+ // minButton = new DACustomButton(buttonComposite, minImage, minPushImage,
+ // minHoverImage, null);
+ // minButton.setToolTipText(AnalyzerLabels.MIN);
+ //
+ // // Creates maximization button.
+ // maxButton = new DACustomButton(buttonComposite, maxImage, maxPushImage,
+ // maxHoverImage, null);
+ // maxButton.setToolTipText(AnalyzerLabels.MAX);
+ //
+ // // Creates exit button.
+ // closeButton = new DACustomButton(buttonComposite, closeImage,
+ // closePushImage, closeHoverImage, null);
+ // closeButton.setToolTipText(AnalyzerLabels.CLOSE);
+ //
+ // data = new FormData();
+ // data.top = new FormAttachment(0, 0);
+ // data.right = new FormAttachment(100, 0);
+ // data.bottom = new FormAttachment(100, -5);
+ // buttonComposite.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.top = new FormAttachment(0, 2);
+ // data.height = 18;
+ // data.width = 28;
+ // minButton.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.top = new FormAttachment(0, 2);
+ // data.left = new FormAttachment(minButton, 0, SWT.RIGHT);
+ // data.height = 18;
+ // data.width = 27;
+ // maxButton.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.top = new FormAttachment(0, 2);
+ // data.left = new FormAttachment(maxButton, 0, SWT.RIGHT);
+ // data.height = 18;
+ // data.width = 46;
+ // closeButton.setLayoutData(data);
+ //
+ // // Adds title bar listeners.
+ // addTitlebarListeners();
+ // }
private void createToolbar(Composite parent) {
startButton.setToolTipText(AnalyzerLabels.START_TRACE);
// Creates TimerClock widget.
- timerComposite = new Composite(controlComposite, SWT.NONE);
- timerClock = new TimerClock(timerComposite);
+ // timerComposite = new Composite(controlComposite, SWT.NONE);
+ // timerClock = new TimerClock(timerComposite);
+ timerClock = new TimerClock(controlComposite, SWT.NONE);
+ timerClock.setBgImage(ImageResources.TIMER);
+ timerClock.setFont(FontResources.TIMER);
// // Creates save trace button.
saveTraceButton = new DACustomButton(controlComposite, saveImage,
FormData data = new FormData();
data.top = new FormAttachment(0, 4);
data.left = new FormAttachment(0, 345);
- data.height = 34;
+ data.height = 30;
controlComposite.setLayoutData(data);
+ controlComposite.setBackground(ColorResources.RED);
data = new FormData();
data.top = new FormAttachment(controlComposite, 0);
startButton.setLayoutData(data);
data = new FormData();
- data.top = new FormAttachment(0, 1);
- data.left = new FormAttachment(startButton, OFFSET_ZERO);
+ data.top = new FormAttachment(0, 0);
+ data.left = new FormAttachment(startButton, 0);
data.width = TIMER_WIDTH;
- data.height = 28;
- timerComposite.setLayoutData(data);
+ data.height = 30;
+ timerClock.setLayoutData(data);
data = new FormData();
- data.top = new FormAttachment(START, 0);
- data.left = new FormAttachment(timerComposite, OFFSET_ZERO, SWT.RIGHT);
- data.width = 32;
+ data.top = new FormAttachment(0, 0);
+ data.left = new FormAttachment(timerClock, 0, SWT.RIGHT);
+ data.width = 31;
data.height = 30;
saveTraceButton.setLayoutData(data);
data = new FormData();
- data.top = new FormAttachment(START, 0);
- data.left = new FormAttachment(saveTraceButton, OFFSET_ZERO, SWT.RIGHT);
- data.width = 32;
+ data.top = new FormAttachment(0, 0);
+ data.left = new FormAttachment(saveTraceButton, 0, SWT.RIGHT);
+ data.width = 31;
data.height = 30;
openTraceButton.setLayoutData(data);
data = new FormData();
- data.top = new FormAttachment(START, 0);
- data.left = new FormAttachment(openTraceButton, OFFSET_ZERO, SWT.RIGHT);
- data.width = 32;
+ data.top = new FormAttachment(0, 0);
+ data.left = new FormAttachment(openTraceButton, 0, SWT.RIGHT);
+ data.width = 31;
data.height = 30;
replayButton.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(0, 2);
- data.left = new FormAttachment(controlComposite, OFFSET_FIVE);
- data.right = new FormAttachment(END, -OFFSET_FIVE);
+ data.left = new FormAttachment(controlComposite, 5);
+ data.right = new FormAttachment(100, -5);
sourceViewComposite.setLayoutData(data);
data = new FormData();
- data.top = new FormAttachment(START, 2);
- data.right = new FormAttachment(END, 0);
+ data.top = new FormAttachment(0, 2);
+ data.right = new FormAttachment(100, 0);
data.width = 0;
data.height = 0;
settingsButton.setLayoutData(data);
data = new FormData();
- data.top = new FormAttachment(START, 2);
+ data.top = new FormAttachment(0, 2);
data.right = new FormAttachment(settingsButton, 0);
data.width = 32;
data.height = 30;
aboutButton.setLayoutData(data);
data = new FormData();
- data.top = new FormAttachment(START, 2);
+ data.top = new FormAttachment(0, 2);
data.right = new FormAttachment(aboutButton, -10);
data.width = 32;
data.height = 30;
timerClock.setTime(time);
}
- private Monitor findMaximizeTargetMonitor() {
- int ret = -1;
- int area = 0;
-
- Rectangle shellRect = shell.getBounds();
- Rectangle monitorRect = null;
- Rectangle intersectRect = null;
-
- Monitor[] monitors = PlatformUI.getWorkbench().getDisplay()
- .getMonitors();
-
- for (int i = 0; i < monitors.length; i++) {
- monitorRect = monitors[i].getBounds();
- intersectRect = monitorRect.intersection(shellRect);
- int interArea = intersectRect.width * intersectRect.height;
- if (area < interArea) {
- area = interArea;
- ret = i;
- }
- }
-
- if (-1 != ret)
- return monitors[ret];
- else
- return null;
- }
-
- private void handleMaximization() {
- if (isMaximized) {
- isMaximized = false;
- windowWidth = oldSizeOfWindow.x;
- windowHeight = oldSizeOfWindow.y;
- // shell.setBounds(100,100,windowWidth,windowHeight);
- shell.setLocation(oldLocationOfWindow);
- shell.setSize(oldSizeOfWindow);
-
- // Sets trim corner image.
- topLeftImage = topLeftNormalImage;
- topRightImage = topRightNormalImage;
- bottomLeftImage = bottomLeftNormalImage;
- bottomRightImage = bottomRightNormalImage;
-
- setMaxButtonState(isMaximized);
-
- maxButton.setToolTipText(AnalyzerLabels.MAX);
-
- // Adds mouse listeners.
- addTitlebarAndShellMouseListeners();
- } else {
- isMaximized = true;
- oldSizeOfWindow = shell.getSize();
- oldLocationOfWindow = shell.getLocation();
-
- Monitor mon = findMaximizeTargetMonitor();
- Rectangle clientRectangle = mon.getBounds();
- Rectangle rectangle = mon.getClientArea();
- if (rectangle.width < clientRectangle.width) {
- windowWidth = rectangle.width - clientRectangle.x;
- windowHeight = rectangle.height - clientRectangle.y;
- shell.setSize(windowWidth, windowHeight);
- shell.setLocation(rectangle.x + clientRectangle.x, rectangle.y
- + clientRectangle.y);
- } else {
- windowWidth = clientRectangle.width;
- windowHeight = clientRectangle.height;
- shell.setSize(windowWidth, windowHeight);
- shell.setLocation(clientRectangle.x, clientRectangle.y);
- }
+ // private Monitor findMaximizeTargetMonitor() {
+ // int ret = -1;
+ // int area = 0;
+ //
+ // Rectangle shellRect = shell.getBounds();
+ // Rectangle monitorRect = null;
+ // Rectangle intersectRect = null;
+ //
+ // Monitor[] monitors = PlatformUI.getWorkbench().getDisplay()
+ // .getMonitors();
+ //
+ // for (int i = 0; i < monitors.length; i++) {
+ // monitorRect = monitors[i].getBounds();
+ // intersectRect = monitorRect.intersection(shellRect);
+ // int interArea = intersectRect.width * intersectRect.height;
+ // if (area < interArea) {
+ // area = interArea;
+ // ret = i;
+ // }
+ // }
+ //
+ // if (-1 != ret)
+ // return monitors[ret];
+ // else
+ // return null;
+ // }
- // Sets max width and height.
- // int midX = shell.getLocation().x + (oldSizeOfWindow.x / 2);
- // Monitor[] monitors = PlatformUI.getWorkbench().getDisplay()
- // .getMonitors();
- // int monitorsLength = monitors.length;
- //
- //
- // Rectangle clientRectangle = null;
- // Rectangle rectangle = null;
- // for (int i = 0; i < monitorsLength; i++) {
- // rectangle = monitors[i].getBounds();
- // clientRectangle = monitors[i].getClientArea();
- // // for ubuntu getClientArea bug FIXME
- // if(rectangle.width < clientRectangle.width){
- // if (rectangle.x < midX && rectangle.x + rectangle.width > midX) {
- // break;
- // }
- // }
- // if (rectangle.x < midX && rectangle.x + rectangle.width > midX) {
- // break;
- // }
- // }
- // windowWidth = rectangle.width;
- // windowHeight = rectangle.height;
- // shell.setSize(windowWidth, windowHeight);
- // shell.setLocation(rectangle.x, rectangle.y);
-
- // Sets trim corner image.
- topLeftImage = topLeftMaxImage;
- topRightImage = topRightMaxImage;
- bottomLeftImage = bottomLeftMaxImage;
- bottomRightImage = bottomRightMaxImage;
-
- setMaxButtonState(isMaximized);
-
- maxButton.setToolTipText(AnalyzerLabels.RESTORE);
-
- // Removes mouse listeners.
- removeTitlebarAndShellMouseListeners();
- }
- }
+ // private void handleMaximization() {
+ // if (isMaximized) {
+ // isMaximized = false;
+ // windowWidth = oldSizeOfWindow.x;
+ // windowHeight = oldSizeOfWindow.y;
+ // // shell.setBounds(100,100,windowWidth,windowHeight);
+ // shell.setLocation(oldLocationOfWindow);
+ // shell.setSize(oldSizeOfWindow);
+ //
+ // // Sets trim corner image.
+ // topLeftImage = topLeftNormalImage;
+ // topRightImage = topRightNormalImage;
+ // bottomLeftImage = bottomLeftNormalImage;
+ // bottomRightImage = bottomRightNormalImage;
+ //
+ // setMaxButtonState(isMaximized);
+ //
+ // maxButton.setToolTipText(AnalyzerLabels.MAX);
+ //
+ // // Adds mouse listeners.
+ // // addTitlebarAndShellMouseListeners();
+ // } else {
+ // isMaximized = true;
+ // oldSizeOfWindow = shell.getSize();
+ // oldLocationOfWindow = shell.getLocation();
+ //
+ // Monitor mon = findMaximizeTargetMonitor();
+ // Rectangle clientRectangle = mon.getBounds();
+ // Rectangle rectangle = mon.getClientArea();
+ // if (rectangle.width < clientRectangle.width) {
+ // windowWidth = rectangle.width - clientRectangle.x;
+ // windowHeight = rectangle.height - clientRectangle.y;
+ // shell.setSize(windowWidth, windowHeight);
+ // shell.setLocation(rectangle.x + clientRectangle.x, rectangle.y
+ // + clientRectangle.y);
+ // } else {
+ // windowWidth = clientRectangle.width;
+ // windowHeight = clientRectangle.height;
+ // shell.setSize(windowWidth, windowHeight);
+ // shell.setLocation(clientRectangle.x, clientRectangle.y);
+ // }
+ //
+ // // Sets max width and height.
+ // // int midX = shell.getLocation().x + (oldSizeOfWindow.x / 2);
+ // // Monitor[] monitors = PlatformUI.getWorkbench().getDisplay()
+ // // .getMonitors();
+ // // int monitorsLength = monitors.length;
+ // //
+ // //
+ // // Rectangle clientRectangle = null;
+ // // Rectangle rectangle = null;
+ // // for (int i = 0; i < monitorsLength; i++) {
+ // // rectangle = monitors[i].getBounds();
+ // // clientRectangle = monitors[i].getClientArea();
+ // // // for ubuntu getClientArea bug FIXME
+ // // if(rectangle.width < clientRectangle.width){
+ // // if (rectangle.x < midX && rectangle.x + rectangle.width > midX) {
+ // // break;
+ // // }
+ // // }
+ // // if (rectangle.x < midX && rectangle.x + rectangle.width > midX) {
+ // // break;
+ // // }
+ // // }
+ // // windowWidth = rectangle.width;
+ // // windowHeight = rectangle.height;
+ // // shell.setSize(windowWidth, windowHeight);
+ // // shell.setLocation(rectangle.x, rectangle.y);
+ //
+ // // Sets trim corner image.
+ // topLeftImage = topLeftMaxImage;
+ // topRightImage = topRightMaxImage;
+ // bottomLeftImage = bottomLeftMaxImage;
+ // bottomRightImage = bottomRightMaxImage;
+ //
+ // setMaxButtonState(isMaximized);
+ //
+ // maxButton.setToolTipText(AnalyzerLabels.RESTORE);
+ //
+ // // Removes mouse listeners.
+ // // removeTitlebarAndShellMouseListeners();
+ // }
+ // }
private void initAppCombo() {
String device = deviceCombo.getText();
saveTraceButton.setEnabled(false);
}
- private void removeTitlebarAndShellListeners() {
- titlebarComposite
- .removeListener(SWT.MouseDoubleClick, titlebarListener);
- titleLabel.removeListener(SWT.MouseDoubleClick, titlebarListener);
- shell.removeListener(SWT.Paint, trimListener);
- removeTitlebarAndShellMouseListeners();
- }
+ // private void removeTitlebarAndShellListeners() {
+ // titlebarComposite
+ // .removeListener(SWT.MouseDoubleClick, titlebarListener);
+ // titleLabel.removeListener(SWT.MouseDoubleClick, titlebarListener);
+ // shell.removeListener(SWT.Paint, trimListener);
+ // removeTitlebarAndShellMouseListeners();
+ // }
- private void removeTitlebarAndShellMouseListeners() {
- titlebarComposite.removeListener(SWT.MouseDown, titlebarListener);
- titlebarComposite.removeListener(SWT.MouseMove, titlebarListener);
- titleLabel.removeListener(SWT.MouseDown, titlebarListener);
- titleLabel.removeListener(SWT.MouseMove, titlebarListener);
- shell.removeListener(SWT.MouseDown, trimListener);
- shell.removeListener(SWT.MouseMove, trimListener);
- shell.removeListener(SWT.MouseUp, trimListener);
- shell.removeListener(SWT.MouseHover, trimListener);
- shell.removeListener(SWT.MouseExit, trimListener);
- }
+ // private void removeTitlebarAndShellMouseListeners() {
+ // titlebarComposite.removeListener(SWT.MouseDown, titlebarListener);
+ // titlebarComposite.removeListener(SWT.MouseMove, titlebarListener);
+ // titleLabel.removeListener(SWT.MouseDown, titlebarListener);
+ // titleLabel.removeListener(SWT.MouseMove, titlebarListener);
+ // shell.removeListener(SWT.MouseDown, trimListener);
+ // shell.removeListener(SWT.MouseMove, trimListener);
+ // shell.removeListener(SWT.MouseUp, trimListener);
+ // shell.removeListener(SWT.MouseHover, trimListener);
+ // shell.removeListener(SWT.MouseExit, trimListener);
+ // }
public void setDeviceComboItems(List<String> items) {
// deviceCombo.removeAll();
AppDesktopInfo appInfo = DACommunicator
.getAppDesktopInfoByName(items.get(0));
DACommunicator.setSelectedApp(appInfo);
- appCombo.setToolTipText(appCombo.getItem(START));
+ appCombo.setToolTipText(appCombo.getItem(0));
startButton.setEnabled(true);
} else {
appCombo.add(AnalyzerConstants.EMPTY);
// sourceViewButton.setVisible(visibility);
// }
- private void setMaxButtonState(boolean isMaximized) {
- if (isMaximized) {
-
- // maxButton.setImage(restoreImage);
- maxButton.setImages(restoreImage, restorePushImage,
- restoreHoverImage, null);
- // maxButton.setNormalImage(restoreImage);
- // maxButton.setPushImage(restorePushImage);
- // maxButton.setHoverImage(restoreHoverImage);
- } else {
- // maxButton.setImage(maxImage);
- maxButton.setImages(maxImage, maxPushImage, maxHoverImage, null);
- // maxButton.setNormalImage(maxImage);
- // maxButton.setPushImage(maxPushImage);
- // maxButton.setHoverImage(maxHoverImage);
- }
- }
-
- private void setShellRegion() {
- Region shellRegion = new Region();
-
- // Adds total region.
- shellRegion.add(new Rectangle(START, START, windowWidth, windowHeight));
-
- if (!isMaximized) {
- int offset = OFFSET_TWO;
- if (AnalyzerUtil.isWin()) {
- offset = OFFSET_TWO;
- } else if (AnalyzerUtil.isLinux()) {
- offset = OFFSET_TWO;
- }
-
- // Subtracts top left corner region.
- for (int i = 0; i < offset; i++) {
- shellRegion.subtract(0, i, offset - i, 1);
- }
- // Subtracts top right corner region.
- for (int i = 0; i < offset; i++) {
- shellRegion
- .subtract(windowWidth - offset + i, i, offset - i, 1);
- }
- // Subtracts bottom left corner region.
- for (int i = 0; i < offset; i++) {
- shellRegion.subtract(0, windowHeight - i, offset - i, 1);
- }
- // Subtracts bottom right corner region.
- for (int i = 0; i < offset; i++) {
- shellRegion.subtract(windowWidth - offset + i,
- windowHeight - i, offset - i, 1);
- }
- }
+ // private void setMaxButtonState(boolean isMaximized) {
+ // if (isMaximized) {
+ //
+ // // maxButton.setImage(restoreImage);
+ // maxButton.setImages(restoreImage, restorePushImage,
+ // restoreHoverImage, null);
+ // // maxButton.setNormalImage(restoreImage);
+ // // maxButton.setPushImage(restorePushImage);
+ // // maxButton.setHoverImage(restoreHoverImage);
+ // } else {
+ // // maxButton.setImage(maxImage);
+ // maxButton.setImages(maxImage, maxPushImage, maxHoverImage, null);
+ // // maxButton.setNormalImage(maxImage);
+ // // maxButton.setPushImage(maxPushImage);
+ // // maxButton.setHoverImage(maxHoverImage);
+ // }
+ // }
- shell.setRegion(shellRegion);
- shellRegion.dispose();
- }
+ // private void setShellRegion() {
+ // Region shellRegion = new Region();
+ //
+ // // Adds total region.
+ // shellRegion.add(new Rectangle(0, 0, windowWidth, windowHeight));
+ //
+ // if (!isMaximized) {
+ // int offset = 2;
+ // if (AnalyzerUtil.isWin()) {
+ // offset = 2;
+ // } else if (AnalyzerUtil.isLinux()) {
+ // offset = 2;
+ // }
+ //
+ // // Subtracts top left corner region.
+ // for (int i = 0; i < offset; i++) {
+ // shellRegion.subtract(0, i, offset - i, 1);
+ // }
+ // // Subtracts top right corner region.
+ // for (int i = 0; i < offset; i++) {
+ // shellRegion
+ // .subtract(windowWidth - offset + i, i, offset - i, 1);
+ // }
+ // // Subtracts bottom left corner region.
+ // for (int i = 0; i < offset; i++) {
+ // shellRegion.subtract(0, windowHeight - i, offset - i, 1);
+ // }
+ // // Subtracts bottom right corner region.
+ // for (int i = 0; i < offset; i++) {
+ // shellRegion.subtract(windowWidth - offset + i,
+ // windowHeight - i, offset - i, 1);
+ // }
+ // }
+ //
+ // shell.setRegion(shellRegion);
+ // shellRegion.dispose();
+ // }
- public void setShellSize(int width, int height) {
- this.windowWidth = width;
- this.windowHeight = height;
- }
+ // public void setShellSize(int width, int height) {
+ // this.windowWidth = width;
+ // this.windowHeight = height;
+ // }
// public void setSourceViewButtonToggleState(boolean isToggled) {
// if (!isToggled) {
}
public void autoStart() {
- String deviceName = AnalyzerManager.getAutoStartDeviceName();
- String appName = AnalyzerManager.getAutoStartApplicationName();
-// String deviceName = " emulator-26100";
-// String appName = "testapp";
+ String deviceName = AnalyzerManager.getAutoStartDeviceName();
+ String appName = AnalyzerManager.getAutoStartApplicationName();
+ // String deviceName = " emulator-26100";
+ // String appName = "testapp";
if (null != deviceName && null != appName && !deviceName.isEmpty()
&& !appName.isEmpty()) {
CoolbarArea.getInstance().setAppComboText(appName);