From 6e7387f25e1c1ff7e50de4b51bf4e197b82354d4 Mon Sep 17 00:00:00 2001 From: "yser.lee" Date: Tue, 8 Nov 2011 22:54:25 +0900 Subject: [PATCH] [Title] Modify perspective bar. [Type] Feature [Module] [Priority] [CQ#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- .../dynamicanalyzer/workbench/CoolbarArea.java | 108 ++++++--------------- .../samsung/dynamicanalyzer/AnalyzerPlugin.java | 18 ++-- .../handlers/OpenBatteryPerspectiveHandler.java | 6 +- .../handlers/OpenBottleNeckTabHandler.java | 2 + .../handlers/OpenMemoryTabHandler.java | 2 + .../handlers/OpenNtimePerspectiveHandler.java | 6 +- .../handlers/OpenRealtimePerspectiveHandler.java | 6 +- .../handlers/OpenResourceLifecycleTabHandler.java | 2 + 8 files changed, 57 insertions(+), 93 deletions(-) diff --git a/com.samsung.dynamicanalyzer.workbench/src/com/samsung/dynamicanalyzer/workbench/CoolbarArea.java b/com.samsung.dynamicanalyzer.workbench/src/com/samsung/dynamicanalyzer/workbench/CoolbarArea.java index 4404551..7c22557 100644 --- a/com.samsung.dynamicanalyzer.workbench/src/com/samsung/dynamicanalyzer/workbench/CoolbarArea.java +++ b/com.samsung.dynamicanalyzer.workbench/src/com/samsung/dynamicanalyzer/workbench/CoolbarArea.java @@ -20,26 +20,23 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; import org.eclipse.ui.application.IWorkbenchWindowConfigurer; import org.eclipse.ui.plugin.AbstractUIPlugin; import com.samsung.dynamicanalyzer.AnalyzerConstants; import com.samsung.dynamicanalyzer.SDBManager; +import com.samsung.dynamicanalyzer.handlers.OpenBatteryPerspectiveHandler; +import com.samsung.dynamicanalyzer.handlers.OpenBottleNeckTabHandler; +import com.samsung.dynamicanalyzer.handlers.OpenMemoryTabHandler; +import com.samsung.dynamicanalyzer.handlers.OpenNtimePerspectiveHandler; +import com.samsung.dynamicanalyzer.handlers.OpenRealtimePerspectiveHandler; +import com.samsung.dynamicanalyzer.handlers.OpenResourceLifecycleTabHandler; import com.samsung.dynamicanalyzer.handlers.OpenTraceHandler; import com.samsung.dynamicanalyzer.handlers.SaveTraceHandler; import com.samsung.dynamicanalyzer.handlers.StartStopTraceHandler; import com.samsung.dynamicanalyzer.handlers.TestInputHandler; import com.samsung.dynamicanalyzer.nl.AnalyzerLabels; import com.samsung.dynamicanalyzer.services.RecordStateSourceProvider; -import com.samsung.dynamicanalyzer.ui.views.AnalysisView; -import com.samsung.dynamicanalyzer.ui.views.BatteryAnalysisView; -import com.samsung.dynamicanalyzer.ui.views.CallGraphView; -import com.samsung.dynamicanalyzer.ui.views.LogView; -import com.samsung.dynamicanalyzer.ui.views.NtimeAnalysisView; import com.samsung.dynamicanalyzer.utils.AnalyzerUtil; public class CoolbarArea { @@ -62,13 +59,16 @@ public class CoolbarArea { private Image openImage = createImage("load_record"); //$NON-NLS-1$ private Image pickaxeImage = createImage("pickaxe"); //$NON-NLS-1$ - private Color blackColor = new Color(null, 51, 51, 51); + private Color blackColor = new Color(null, 153, 153, 153); private Color whiteColor = new Color(null, 255, 255, 255); private Color blueColor = new Color(null, 051, 051, 255); private static final String ID = "com.samsung.dynamicanalyzer.workbench"; //$NON-NLS-1$ public CoolbarArea(IWorkbenchWindowConfigurer configurer, Shell shell) { + // Creates empty coolbar control. + configurer.createCoolBarControl(shell); + final FormLayout layout = new FormLayout(); layout.marginWidth = 0; layout.marginHeight = 0; @@ -136,6 +136,7 @@ public class CoolbarArea { deviceCombo.addListener(SWT.FocusIn, new Listener() { @Override public void handleEvent(Event event) { + // Gets device name list. List devices = SDBManager.getDevices(); deviceCombo.removeAll(); int devicesSize = devices.size(); @@ -153,6 +154,7 @@ public class CoolbarArea { appCombo.removeAll(); + // Gets application name list. List apps = SDBManager.getAppList(); if (null == apps) { return; @@ -288,11 +290,7 @@ public class CoolbarArea { memoryLabel.setForeground(whiteColor); bottleNeckLabel.setForeground(whiteColor); - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - CallGraphView view = (CallGraphView) page - .findView(CallGraphView.ID); - page.hideView(view); + AnalyzerUtil.executeCommand(OpenResourceLifecycleTabHandler.ID); } }); @@ -306,11 +304,7 @@ public class CoolbarArea { memoryLabel.setForeground(blueColor); bottleNeckLabel.setForeground(whiteColor); - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - CallGraphView view = (CallGraphView) page - .findView(CallGraphView.ID); - page.hideView(view); + AnalyzerUtil.executeCommand(OpenMemoryTabHandler.ID); } }); @@ -324,15 +318,7 @@ public class CoolbarArea { memoryLabel.setForeground(whiteColor); bottleNeckLabel.setForeground(blueColor); - IWorkbench workbench = PlatformUI.getWorkbench(); - IWorkbenchPage page = workbench.getActiveWorkbenchWindow() - .getActivePage(); - try { - page.showView(CallGraphView.ID); - page.showView(AnalysisView.ID); - } catch (PartInitException e) { - e.printStackTrace(); - } + AnalyzerUtil.executeCommand(OpenBottleNeckTabHandler.ID); } }); } @@ -348,22 +334,11 @@ public class CoolbarArea { batteryLabel.setForeground(whiteColor); ntimeLabel.setForeground(whiteColor); - IWorkbench workbench = PlatformUI.getWorkbench(); - IWorkbenchPage page = workbench.getActiveWorkbenchWindow() - .getActivePage(); - BatteryAnalysisView view = (BatteryAnalysisView) page - .findView(BatteryAnalysisView.ID); - page.hideView(view); - NtimeAnalysisView view2 = (NtimeAnalysisView) page - .findView(NtimeAnalysisView.ID); - page.hideView(view2); - try { - page.showView(AnalysisView.ID); - page.showView(LogView.ID); - page.showView(AnalysisView.ID); - } catch (PartInitException e) { - e.printStackTrace(); - } + resourceLifecycleLabel.setVisible(true); + memoryLabel.setVisible(true); + bottleNeckLabel.setVisible(true); + + AnalyzerUtil.executeCommand(OpenRealtimePerspectiveHandler.ID); } }); @@ -377,22 +352,11 @@ public class CoolbarArea { batteryLabel.setForeground(blueColor); ntimeLabel.setForeground(whiteColor); - IWorkbench workbench = PlatformUI.getWorkbench(); - IWorkbenchPage page = workbench.getActiveWorkbenchWindow() - .getActivePage(); - try { - page.showView(BatteryAnalysisView.ID); - } catch (PartInitException e) { - e.printStackTrace(); - } - AnalysisView view = (AnalysisView) page - .findView(AnalysisView.ID); - page.hideView(view); - LogView view2 = (LogView) page.findView(LogView.ID); - page.hideView(view2); - NtimeAnalysisView view3 = (NtimeAnalysisView) page - .findView(NtimeAnalysisView.ID); - page.hideView(view3); + resourceLifecycleLabel.setVisible(false); + memoryLabel.setVisible(false); + bottleNeckLabel.setVisible(false); + + AnalyzerUtil.executeCommand(OpenBatteryPerspectiveHandler.ID); } }); @@ -406,22 +370,11 @@ public class CoolbarArea { batteryLabel.setForeground(whiteColor); ntimeLabel.setForeground(blueColor); - IWorkbench workbench = PlatformUI.getWorkbench(); - IWorkbenchPage page = workbench.getActiveWorkbenchWindow() - .getActivePage(); - try { - page.showView(NtimeAnalysisView.ID); - } catch (PartInitException e) { - e.printStackTrace(); - } - AnalysisView view = (AnalysisView) page - .findView(AnalysisView.ID); - page.hideView(view); - LogView view2 = (LogView) page.findView(LogView.ID); - page.hideView(view2); - BatteryAnalysisView view3 = (BatteryAnalysisView) page - .findView(BatteryAnalysisView.ID); - page.hideView(view3); + resourceLifecycleLabel.setVisible(false); + memoryLabel.setVisible(false); + bottleNeckLabel.setVisible(false); + + AnalyzerUtil.executeCommand(OpenNtimePerspectiveHandler.ID); } }); } @@ -440,7 +393,6 @@ public class CoolbarArea { data.top = new FormAttachment(main, 0, SWT.BOTTOM); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); - // data.bottom = new FormAttachment(main, 4, SWT.BOTTOM); left.setLayoutData(data); data = new FormData(); diff --git a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/AnalyzerPlugin.java b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/AnalyzerPlugin.java index 2ff09e3..281a14f 100644 --- a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/AnalyzerPlugin.java +++ b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/AnalyzerPlugin.java @@ -22,7 +22,7 @@ import com.samsung.dynamicanalyzer.utils.AnalyzerUtil; public class AnalyzerPlugin extends AbstractUIPlugin { - private static final int rgb = 51; + private static final int rgb = 153; private static final String THEME_ID = "com.samsung.dynamicanalyzer.theme"; //$NON-NLS-1$ private static AnalyzerPlugin plugin; @@ -39,23 +39,24 @@ public class AnalyzerPlugin extends AbstractUIPlugin { workbench.addWorkbenchListener(new IWorkbenchListener() { @Override public void postShutdown(IWorkbench workbench) { - try{ - String cmd = AnalyzerConstants.REMOVE_RECURSIVE_FORCE + AnalyzerConstants.TEMP_FOLDER_PATH; + try { + String cmd = AnalyzerConstants.REMOVE_RECURSIVE_FORCE + + AnalyzerConstants.TEMP_FOLDER_PATH; Process ps = Runtime.getRuntime().exec(cmd); ps.waitFor(); System.out.println(ps.exitValue()); ps.destroy(); - }catch (Exception e) { - // TODO Auto-generated catch block + } catch (Exception e) { e.printStackTrace(); } } @Override public boolean preShutdown(IWorkbench workbench, boolean forced) { - // message yes/no - IConfigurationElement[] config = Platform.getExtensionRegistry() - .getConfigurationElementsFor(IExit.ID); + // TODO message yes/no + IConfigurationElement[] config = Platform + .getExtensionRegistry().getConfigurationElementsFor( + IExit.ID); try { for (IConfigurationElement element : config) { final Object object = element @@ -96,7 +97,6 @@ public class AnalyzerPlugin extends AbstractUIPlugin { } AnalyzerManager.setTempPath(tempPath); AnalyzerUtil.initColors(); - } @Override diff --git a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenBatteryPerspectiveHandler.java b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenBatteryPerspectiveHandler.java index c482cf6..f1872da 100644 --- a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenBatteryPerspectiveHandler.java +++ b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenBatteryPerspectiveHandler.java @@ -9,13 +9,15 @@ import org.eclipse.ui.WorkbenchException; public class OpenBatteryPerspectiveHandler extends AbstractHandler { - private static final String ID = "com.samsung.dynamicanalyzer.batteryPerspective"; //$NON-NLS-1$ + public static final String ID = "com.samsung.dynamicanalyzer.commands.openBatteryPerspective"; //$NON-NLS-1$ + private static final String PERSPECTIVE_ID = "com.samsung.dynamicanalyzer.batteryPerspective"; //$NON-NLS-1$ @Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbench workbench = PlatformUI.getWorkbench(); try { - workbench.showPerspective(ID, workbench.getActiveWorkbenchWindow()); + workbench.showPerspective(PERSPECTIVE_ID, + workbench.getActiveWorkbenchWindow()); } catch (WorkbenchException e) { e.printStackTrace(); } diff --git a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenBottleNeckTabHandler.java b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenBottleNeckTabHandler.java index 356a3e4..b9d504e 100644 --- a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenBottleNeckTabHandler.java +++ b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenBottleNeckTabHandler.java @@ -13,6 +13,8 @@ import com.samsung.dynamicanalyzer.ui.views.CallGraphView; public class OpenBottleNeckTabHandler extends AbstractHandler { + public static final String ID = "com.samsung.dynamicanalyzer.commands.openBottleNeckTab"; //$NON-NLS-1$ + @Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbench workbench = PlatformUI.getWorkbench(); diff --git a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenMemoryTabHandler.java b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenMemoryTabHandler.java index 07dfe3f..bc48e8a 100644 --- a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenMemoryTabHandler.java +++ b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenMemoryTabHandler.java @@ -10,6 +10,8 @@ import com.samsung.dynamicanalyzer.ui.views.CallGraphView; public class OpenMemoryTabHandler extends AbstractHandler { + public static final String ID = "com.samsung.dynamicanalyzer.commands.openMemoryTab"; //$NON-NLS-1$ + @Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchPage page = PlatformUI.getWorkbench() diff --git a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenNtimePerspectiveHandler.java b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenNtimePerspectiveHandler.java index 4444baa..6980ca3 100644 --- a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenNtimePerspectiveHandler.java +++ b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenNtimePerspectiveHandler.java @@ -9,13 +9,15 @@ import org.eclipse.ui.WorkbenchException; public class OpenNtimePerspectiveHandler extends AbstractHandler { - private static final String ID = "com.samsung.dynamicanalyzer.ntimePerspective"; //$NON-NLS-1$ + public static final String ID = "com.samsung.dynamicanalyzer.commands.openNtimePerspective"; //$NON-NLS-1$ + private static final String PERSPECTIVE_ID = "com.samsung.dynamicanalyzer.ntimePerspective"; //$NON-NLS-1$ @Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbench workbench = PlatformUI.getWorkbench(); try { - workbench.showPerspective(ID, workbench.getActiveWorkbenchWindow()); + workbench.showPerspective(PERSPECTIVE_ID, + workbench.getActiveWorkbenchWindow()); } catch (WorkbenchException e) { e.printStackTrace(); } diff --git a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenRealtimePerspectiveHandler.java b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenRealtimePerspectiveHandler.java index 8da32b3..84551b7 100644 --- a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenRealtimePerspectiveHandler.java +++ b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenRealtimePerspectiveHandler.java @@ -9,13 +9,15 @@ import org.eclipse.ui.WorkbenchException; public class OpenRealtimePerspectiveHandler extends AbstractHandler { - private static final String ID = "com.samsung.dynamicanalyzer.realtimePerspective"; //$NON-NLS-1$ + public static final String ID = "com.samsung.dynamicanalyzer.commands.openRealtimePerspective"; //$NON-NLS-1$ + private static final String PERSPECTIVE_ID = "com.samsung.dynamicanalyzer.realtimePerspective"; //$NON-NLS-1$ @Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbench workbench = PlatformUI.getWorkbench(); try { - workbench.showPerspective(ID, workbench.getActiveWorkbenchWindow()); + workbench.showPerspective(PERSPECTIVE_ID, + workbench.getActiveWorkbenchWindow()); } catch (WorkbenchException e) { e.printStackTrace(); } diff --git a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenResourceLifecycleTabHandler.java b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenResourceLifecycleTabHandler.java index f529041..2ace283 100644 --- a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenResourceLifecycleTabHandler.java +++ b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenResourceLifecycleTabHandler.java @@ -10,6 +10,8 @@ import com.samsung.dynamicanalyzer.ui.views.CallGraphView; public class OpenResourceLifecycleTabHandler extends AbstractHandler { + public static final String ID = "com.samsung.dynamicanalyzer.commands.openResourceLifecycleTab"; //$NON-NLS-1$ + @Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchPage page = PlatformUI.getWorkbench() -- 2.7.4