From: phjwithyou.park Date: Thu, 2 Aug 2012 04:17:26 +0000 (+0900) Subject: [Title] DA Singletom Add File X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=46f269cff6e6943c24dcd8ef3d60ce060249353f;p=sdk%2Ftools%2Fdynamic-analyzer.git [Title] DA Singletom Add File [Type] bug [Module] init [Priority] high [CQ#] [Redmine#] 6018 [Problem] [Cause] [Solution] [TestCase] --- diff --git a/org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/ApplicationWorkbenchWindowAdvisor.java b/org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/ApplicationWorkbenchWindowAdvisor.java index 8889f07..03e5a5b 100755 --- a/org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/ApplicationWorkbenchWindowAdvisor.java +++ b/org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/ApplicationWorkbenchWindowAdvisor.java @@ -42,8 +42,6 @@ class DAMonitor extends Thread { } } } - - public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { private static final int DEFAULT_WIDTH = 1024; @@ -68,14 +66,9 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { } @Override - public void createWindowContents(Shell shell) { - System.out.print("createWindowContents\n"); - + public void createWindowContents(Shell shell) { CoolbarArea.createInstance(getWindowConfigurer(), shell); - // CoolbarArea.getInstance().setShellSize(width, height); - - - + // Check DA Singleton Dlg. DAMonitor monitor_1 =new DAMonitor( ); monitor_1.start(); @@ -106,8 +99,6 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { @Override public void preWindowOpen() { - System.out.print("preWindowOpen\n"); - Monitor[] monitors = PlatformUI.getWorkbench().getDisplay().getMonitors(); Rectangle rectangle = null; @@ -127,9 +118,6 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { } public void postWindowOpen() { - System.out.print("postWindowOpen\n"); - - PathManager.pathCheck(); AnalyzerManager.setAutoStartDeviceName(deviceName); @@ -139,8 +127,6 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { } public boolean preWindowShellClose() { - - System.out.print("preWindowShellClose\n"); if (ResourceCommunicator.isRunning()) { ResourceCommunicator.sendMessage(AnalyzerConstants.MSG_STOP + AnalyzerConstants.CMD_SPLIT + 0 diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/SingletonInfoDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/SingletonInfoDialog.java new file mode 100644 index 0000000..28942f8 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/SingletonInfoDialog.java @@ -0,0 +1,156 @@ +package org.tizen.dynamicanalyzer.ui.widgets; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.tizen.dynamicanalyzer.ColorResources; +import org.tizen.dynamicanalyzer.FontResources; +import org.tizen.dynamicanalyzer.ImageResources; +import org.tizen.dynamicanalyzer.nl.AnalyzerLabels; +import org.tizen.dynamicanalyzer.widgets.button.DACustomButton; +import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener; + +public class SingletonInfoDialog { + private Shell parent = null; + private Shell shell = null; + private DACustomButton okButton = null; + + private final Image iconImage = ImageResources.DYNAIC_ANALYZER_ICON; + + public SingletonInfoDialog(Shell parent, int style) { + this.parent = parent; + } + + private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() { + + @Override + public void handleClickEvent(DACustomButton button) { + shell.dispose(); + System.exit(-1); + } + }; + + + public int open() { + shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.TITLE); + shell.setSize(446, 153); + shell.setLayout(new FormLayout()); + shell.setText(AnalyzerLabels.SINGLETON_INFO_DLG_TITLE); + + Composite base = new Composite(shell, SWT.NONE); + base.setLayout(new FormLayout()); + FormData baseData = new FormData(); + baseData.top = new FormAttachment(0, 0); + baseData.left = new FormAttachment(0, 0); + baseData.right = new FormAttachment(100, 0); + baseData.height = 76; + base.setLayoutData(baseData); + base.setVisible(true); + base.setBackground(ColorResources.DIALOG_BG_UPPER); + + // Icon + Label icon = new Label(base, SWT.TRANSPARENT); + icon.setBackground(ColorResources.WINDOW_BG_COLOR); + icon.setImage(iconImage); + + // Contents + Label strMessage_1 = new Label(base, SWT.TRANSPARENT); + strMessage_1.setText(AnalyzerLabels.SINGLETON_INFO_DLG_MESSAGE_1); + strMessage_1.setBackground(ColorResources.DIALOG_BG_UPPER); + strMessage_1.setAlignment(SWT.LEFT); + strMessage_1.setForeground(ColorResources.DEFAULT_FONT_COLOR); + strMessage_1.setFont(FontResources.ABOUT_TEXT); + + Label strMessage_2 = new Label(base, SWT.TRANSPARENT); + + strMessage_2.setText(AnalyzerLabels.SINGLETON_INFO_DLG_MESSAGE_2); //$NON-NLS-1$ + strMessage_2.setBackground(ColorResources.DIALOG_BG_UPPER); + strMessage_2.setAlignment(SWT.LEFT); + strMessage_2.setForeground(ColorResources.DEFAULT_FONT_COLOR); + strMessage_2.setFont(FontResources.ABOUT_TEXT); + + FormData labelData = new FormData(); + labelData.left = new FormAttachment(0, 15); + labelData.top = new FormAttachment(0, 6); + labelData.height = 64; + labelData.width = 64; + icon.setLayoutData(labelData); + + labelData = new FormData(); + labelData.left = new FormAttachment(0, 95); + labelData.right = new FormAttachment(100, 0); + labelData.top = new FormAttachment(0, 17); + labelData.height = 22; + strMessage_1.setLayoutData(labelData); + + labelData = new FormData(); + labelData.left = new FormAttachment(0, 95); + labelData.right = new FormAttachment(100, 0); + labelData.top = new FormAttachment(0, 39); + labelData.height = 22; + strMessage_2.setLayoutData(labelData); + + Composite buttonComp = new Composite(shell, SWT.NONE); + FormLayout compLayout = new FormLayout(); + buttonComp.setLayout(compLayout); + buttonComp.setBackground(ColorResources.DIALOG_BG_LOWER); + + buttonComp.addPaintListener(new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + Composite comp = (Composite) e.widget; + Rectangle rect = comp.getClientArea(); + e.gc.setForeground(ColorResources.DIALOG_SUNKEN_1); + e.gc.drawLine(rect.x, rect.y, rect.x + rect.width, rect.y); + e.gc.setForeground(ColorResources.DIALOG_SUNKEN_2); + e.gc.drawLine(rect.x, rect.y + 1, rect.x + rect.width, + rect.y + 1); + } + }); + + + FormData compData = new FormData(); + compData.top = new FormAttachment(base, 0); + compData.left = new FormAttachment(0, 0); + compData.right = new FormAttachment(100, 0); + compData.bottom = new FormAttachment(100, 0); + buttonComp.setLayoutData(compData); + + okButton = new DAButton(buttonComp, SWT.NONE); + okButton.addClickListener(okButtonListener); + okButton.setText(AnalyzerLabels.ABOUT_DIALOG_OK); //$NON-NLS-1$ + okButton.setFont(FontResources.DIALOG_BUTTON_FONT); + FormData okData = new FormData(); + okData.top = new FormAttachment(0, 12); + okData.right = new FormAttachment(100, -9); + okData.width = 100; + okData.height = 34; + okButton.setLayoutData(okData); + + shell.open(); + + Display display = PlatformUI.createDisplay(); + + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) + display.sleep(); + } + + shell.dispose(); + + + + return 0; + } +}