From c12e91a9acfd2ad8d317837c6bb7627d0c753fa9 Mon Sep 17 00:00:00 2001 From: Lee Date: Thu, 16 Aug 2012 13:30:55 +0900 Subject: [PATCH] [Title] resize bug fix [Type] bug fix [Module] Dynamic Analyzer [Priority] major [CQ#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- .../ApplicationWorkbenchWindowAdvisor.java | 48 ++++++------- .../tizen/dynamicanalyzer/ide/CommandExecutor.java | 78 +++++++++++----------- .../tizen/dynamicanalyzer/ide/FocusDAManager.java | 67 ++++++++++--------- .../tizen/dynamicanalyzer/ide/ThreadOutput.java | 19 +++--- .../nl/InformationViewLabels.properties | 2 +- .../timeline/TimelineComposite.java | 74 ++++++++++++-------- .../ui/views/summaryPage/SummaryPage.java | 11 ++- 7 files changed, 160 insertions(+), 139 deletions(-) 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 241d7c9..ffbf696 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,20 +42,18 @@ import org.tizen.dynamicanalyzer.ide.*; import org.tizen.dynamicanalyzer.ui.views.CoolbarArea; import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; - - class DAMonitor extends Thread { static int portNumber = 6824; public int bDARunning = -1; - - public void run( ) { + + public void run() { try { portNumber += 12345; bDARunning = 0; ServerSocket local = new ServerSocket(portNumber); local.accept(); } catch (SocketException e) { - bDARunning = 1; + bDARunning = 1; } catch (IOException e) { e.printStackTrace(); bDARunning = 1; @@ -87,49 +85,51 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { } @Override - public void createWindowContents(Shell shell) { + public void createWindowContents(Shell shell) { CoolbarArea.createInstance(getWindowConfigurer(), shell); // Check DA Singleton Dlg. - DAMonitor monitor_1 =new DAMonitor( ); + DAMonitor monitor_1 = new DAMonitor(); monitor_1.start(); - while( monitor_1.bDARunning < 0 ){ + while (monitor_1.bDARunning < 0) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } - DAMonitor monitors_2 =new DAMonitor( ); - monitors_2.start(); - while( monitors_2.bDARunning < 0 ){ + + DAMonitor monitors_2 = new DAMonitor(); + monitors_2.start(); + while (monitors_2.bDARunning < 0) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } - if ( monitor_1.bDARunning == 1 && monitors_2.bDARunning == 1 ) - { + if (monitor_1.bDARunning == 1 && monitors_2.bDARunning == 1) { FocusDAManager.SetFocusDA(); System.exit(-1); - - }else{ - FocusDAManager.SetSaveFocusDAPid(); - IDESocketThread.InitIDESocketThreadListener(); - } + + } else { + FocusDAManager.SetSaveFocusDAPid(); + IDESocketThread.InitIDESocketThreadListener(); + } } @Override public void preWindowOpen() { - Monitor[] monitors = PlatformUI.getWorkbench().getDisplay().getMonitors(); - + Monitor[] monitors = PlatformUI.getWorkbench().getDisplay() + .getMonitors(); + Rectangle rectangle = null; - + rectangle = monitors[0].getBounds(); - - if (rectangle.width < DEFAULT_WIDTH || rectangle.height < DEFAULT_HEIGHT) { + + if (rectangle.width < DEFAULT_WIDTH + || rectangle.height < DEFAULT_HEIGHT) { width = MIN_WIDTH; height = MIN_HEIGHT; } @@ -138,7 +138,7 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { configurer.setInitialSize(new Point(width, height)); configurer.setShowStatusLine(false); configurer.setShellStyle(SWT.SHELL_TRIM/* | SWT.NO_BACKGROUND */); - + } public void postWindowOpen() { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ide/CommandExecutor.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ide/CommandExecutor.java index 4428a3b..995a737 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ide/CommandExecutor.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ide/CommandExecutor.java @@ -1,6 +1,5 @@ package org.tizen.dynamicanalyzer.ide; - import java.io.IOException; import java.util.StringTokenizer; @@ -9,69 +8,68 @@ import org.eclipse.core.runtime.IPath; public class CommandExecutor { private Runtime runtime; - private Process process; + private Process process; public IPath file; - public CommandExecutor() { + public CommandExecutor() { } - + public int executeCommand(String[] cmds) { - int retValue = 0; + int retValue = 0; - try{ + try { - if(cmds.length == 0){ - retValue = -1; + if (cmds.length == 0) { + retValue = -1; } else { - + runtime = Runtime.getRuntime(); - process = runtime.exec(cmds); + process = runtime.exec(cmds); - if(process != null) - { - ThreadOutput gboInput = new ThreadOutput(process.getInputStream()); - ThreadOutput gboError = new ThreadOutput(process.getErrorStream()); + if (process != null) { + ThreadOutput gboInput = new ThreadOutput( + process.getInputStream()); + ThreadOutput gboError = new ThreadOutput( + process.getErrorStream()); gboInput.start(); gboError.start(); process.waitFor(); - retValue = process.exitValue(); - while(true){ - if(!gboInput.isAlive() && !gboError.isAlive()){ + retValue = process.exitValue(); + while (true) { + if (!gboInput.isAlive() && !gboError.isAlive()) { break; } } - } - } - }catch(IOException e){ - System.out.println(" " + e.getMessage()+ " " + e + " \n"); - } catch(InterruptedException e){ - System.out.println(" " + e.getMessage()+ " " + e + " \n"); - } finally{ - if(process != null){ - process.destroy(); - } + } + } + } catch (IOException e) { + System.out.println(" " + e.getMessage() + " " + e + " \n"); + } catch (InterruptedException e) { + System.out.println(" " + e.getMessage() + " " + e + " \n"); + } finally { + if (process != null) { + process.destroy(); + } } return retValue; - } - - public String changeString(String cmd,String finder, String changer) - { - String retValue=""; - if(cmd== null) - { - retValue=""; + } + + public String changeString(String cmd, String finder, String changer) { + String retValue = ""; + if (cmd == null) { + retValue = ""; } else { StringTokenizer token = new StringTokenizer(cmd, finder); while (token.hasMoreTokens()) { - if(retValue.length() >0){ - retValue = retValue+changer+token.nextToken(); + if (retValue.length() > 0) { + retValue = retValue + changer + token.nextToken(); } else { - retValue = token.nextToken(); + retValue = token.nextToken(); } } } - return retValue; - } + return retValue; + } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ide/FocusDAManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ide/FocusDAManager.java index b66eb68..69f12e0 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ide/FocusDAManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ide/FocusDAManager.java @@ -1,6 +1,5 @@ package org.tizen.dynamicanalyzer.ide; - import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; @@ -9,54 +8,56 @@ import org.tizen.dynamicanalyzer.constants.AnalyzerConstants; import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; public class FocusDAManager { - private static String pid = null; - private static String Processid = null; - private static int selfPid = 0; + private static String pid = null; + private static String Processid = null; + private static int selfPid = 0; - private FocusDAManager(){ - selfPid = -1; + private FocusDAManager() { + selfPid = -1; } - private FocusDAManager(int iPid){ - selfPid = iPid; + private FocusDAManager(int iPid) { + selfPid = iPid; } - private static void GetPid(){ - - if(selfPid > 0){ - pid = String.valueOf(selfPid); - } - else{ - //get IDE pid. + private static void GetPid() { + + if (selfPid > 0) { + pid = String.valueOf(selfPid); + } else { + // get IDE pid. ManagementFactory.getRuntimeMXBean(); RuntimeMXBean rt = ManagementFactory.getRuntimeMXBean(); Processid = rt.getName(); - pid = Processid.substring(0, Processid.indexOf("@")); + pid = Processid.substring(0, Processid.indexOf("@")); } } - - public static void SetSaveFocusDAPid(){ + + public static void SetSaveFocusDAPid() { GetPid(); - ConfigureManager.getInstance().setValue(ConfigureManager.SINGLETON_FOCUS_DA_PID, pid); + ConfigureManager.getInstance().setValue( + ConfigureManager.SINGLETON_FOCUS_DA_PID, pid); } - private static String[] GetSaveFocusPath(){ - + + private static String[] GetSaveFocusPath() { + String[] returnStr = null; - String strPid = ConfigureManager.getInstance().getValue(ConfigureManager.SINGLETON_FOCUS_DA_PID); - + String strPid = ConfigureManager.getInstance().getValue( + ConfigureManager.SINGLETON_FOCUS_DA_PID); + if (AnalyzerUtil.isWin()) { - returnStr = new String[]{ "wscript", AnalyzerConstants.InstallPathForWindow, strPid }; + returnStr = new String[] { "wscript", + AnalyzerConstants.InstallPathForWindow, strPid }; + } else { + returnStr = new String[] { AnalyzerConstants.InstallPathForLinux, + strPid }; } - else{ - returnStr = new String[]{ AnalyzerConstants.InstallPathForLinux , strPid }; - } - - return returnStr; + + return returnStr; } - - public static void SetFocusDA(){ - CommandExecutor prt = new CommandExecutor(); - prt.executeCommand( GetSaveFocusPath() ); + public static void SetFocusDA() { + CommandExecutor prt = new CommandExecutor(); + prt.executeCommand(GetSaveFocusPath()); } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ide/ThreadOutput.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ide/ThreadOutput.java index 739df3a..1518016 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ide/ThreadOutput.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ide/ThreadOutput.java @@ -1,28 +1,27 @@ package org.tizen.dynamicanalyzer.ide; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -public class ThreadOutput extends Thread{ - private InputStream _ips; +public class ThreadOutput extends Thread { + private InputStream _ips; - public ThreadOutput(InputStream is){ - _ips = is; + public ThreadOutput(InputStream is) { + _ips = is; } - public void run(){ + public void run() { try { InputStreamReader isr = new InputStreamReader(_ips); BufferedReader br = new BufferedReader(isr); String line; - while ( (line = br.readLine()) != null){ - System.out.println("log : "+line); + while ((line = br.readLine()) != null) { + System.out.println("log : " + line); } - - } catch (IOException ioe) { + + } catch (IOException ioe) { } finally { } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/InformationViewLabels.properties b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/InformationViewLabels.properties index 3fab039..6c676b0 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/InformationViewLabels.properties +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/InformationViewLabels.properties @@ -23,7 +23,7 @@ SCORE_VIEW_SCORE=Score SCORE_VIEW_WARNING_COUNT=Warning Count SNAPSHOT_VIEW_TITLE=Snapshot -SNAPSHOT_VIEW_BLUETOOTH_ELSE=Bluetooth else +SNAPSHOT_VIEW_BLUETOOTH_ELSE=Bluetooth on SNAPSHOT_VIEW_BLUETOOTH_OFF=Bluetooth off SNAPSHOT_VIEW_BLUETOOTH_TRANSFER=Bluetooth transfer SNAPSHOT_VIEW_BYTE=Byte diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/timeline/TimelineComposite.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/timeline/TimelineComposite.java index f75d677..19d8d49 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/timeline/TimelineComposite.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/timeline/TimelineComposite.java @@ -18,13 +18,11 @@ import org.tizen.dynamicanalyzer.model.DAView; import org.tizen.dynamicanalyzer.model.LogPackage; import org.tizen.dynamicanalyzer.model.Logs; import org.tizen.dynamicanalyzer.model.SnapshotData; -import org.tizen.dynamicanalyzer.timeline.chart.DATimelineChart; import org.tizen.dynamicanalyzer.timeline.chart.TimelineChart; import org.tizen.dynamicanalyzer.ui.views.CoolbarArea; import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; import org.tizen.dynamicanalyzer.utils.TimelineUtils; - public class TimelineComposite extends DAView { public static final String ID = TimelineComposite.class.getName(); private String activedItemName; // for resizing @@ -78,7 +76,7 @@ public class TimelineComposite extends DAView { TempConstants.chartRunningSec = (int) (runTimeMs / TimelineConstants.TIME_SEC_TO_MS); TimelineMaster.getInstance().redrawTimeTickCanvas(); - + } public void setActivateItem(String itemID) { @@ -121,13 +119,15 @@ public class TimelineComposite extends DAView { setLayoutDataBaseComp(itemsAreaScrolledComp, true, true, false); /* RangeSelector -> Scroll bar */ - scaleAndRangeComp = timelineRangeSelector.createScaleAndRangeComp(parent); + scaleAndRangeComp = timelineRangeSelector + .createScaleAndRangeComp(parent); setLayoutDataBaseComp(scaleAndRangeComp, true, false, true); return parent; } - private void setLayoutDataBaseComp(Composite comp, boolean h_space, boolean v_space, boolean setHint) { + private void setLayoutDataBaseComp(Composite comp, boolean h_space, + boolean v_space, boolean setHint) { GridData gData = new GridData(); if (setHint) { @@ -147,12 +147,14 @@ public class TimelineComposite extends DAView { comp.setLayoutData(gData); } - private ScrolledComposite createItemsAreaScrolledComp(Composite baseComposite) { + private ScrolledComposite createItemsAreaScrolledComp( + Composite baseComposite) { if (null == baseComposite) { return null; } - ScrolledComposite scrolledComp = new ScrolledComposite(baseComposite, SWT.V_SCROLL); + ScrolledComposite scrolledComp = new ScrolledComposite(baseComposite, + SWT.V_SCROLL); /* Item Area */ itemsAreaComp = new Composite(scrolledComp, SWT.NONE); @@ -183,7 +185,7 @@ public class TimelineComposite extends DAView { scrolledComp.setAlwaysShowScrollBars(true); resetItems(TimelineItemsProvider.getInstance().getSelectedItemsList()); - + return scrolledComp; } @@ -192,17 +194,22 @@ public class TimelineComposite extends DAView { return; } - List zoomedItemTypeList = TimelineItemSettingProvider.getZoomedItemList(); + List zoomedItemTypeList = TimelineItemSettingProvider + .getZoomedItemList(); int zoomedItemNum = 0; if (null != zoomedItemTypeList) { zoomedItemNum = zoomedItemTypeList.size(); } - int defItemNum = TimelineItemsProvider.getInstance().getSelectedItemsList().size() - zoomedItemNum; + int defItemNum = TimelineItemsProvider.getInstance() + .getSelectedItemsList().size() + - zoomedItemNum; - int defItemsHeight = defItemNum * TimelineItemSettingProvider.getDefaultSizeMode(); - int zoomedItemsHeight = zoomedItemNum * TimelineConstants.ITEM_HEIGHT_MAX; + int defItemsHeight = defItemNum + * TimelineItemSettingProvider.getDefaultSizeMode(); + int zoomedItemsHeight = zoomedItemNum + * TimelineConstants.ITEM_HEIGHT_MAX; itemsAreaScrolledComp.setMinHeight(defItemsHeight + zoomedItemsHeight); timelineItemManager.resizeItems(); @@ -216,8 +223,10 @@ public class TimelineComposite extends DAView { long start = selData.getStartTime(); long end = selData.getEndTime(); - double startTime = (double) start / TimelineConstants.TIME_SEC_TO_MS / TimelineConstants.TIME_US_TO_MS; - double endTime = (double) end / TimelineConstants.TIME_SEC_TO_MS / TimelineConstants.TIME_US_TO_MS; + double startTime = (double) start / TimelineConstants.TIME_SEC_TO_MS + / TimelineConstants.TIME_US_TO_MS; + double endTime = (double) end / TimelineConstants.TIME_SEC_TO_MS + / TimelineConstants.TIME_US_TO_MS; double middleTime = Math.round((startTime + endTime) / 2.0); if (endTime == startTime) { middleTime = startTime; @@ -237,8 +246,10 @@ public class TimelineComposite extends DAView { startPx = middlePx - TempConstants.MIN_SELECTION_HALF_WIDTH_PX; endPx = middlePx + TempConstants.MIN_SELECTION_HALF_WIDTH_PX; } - startTime = timelineMaster.getSecByPx(startPx) * TimelineConstants.TIME_SEC_TO_MS; - endTime = timelineMaster.getSecByPx(endPx) * TimelineConstants.TIME_SEC_TO_MS; + startTime = timelineMaster.getSecByPx(startPx) + * TimelineConstants.TIME_SEC_TO_MS; + endTime = timelineMaster.getSecByPx(endPx) + * TimelineConstants.TIME_SEC_TO_MS; timelineMaster.setSelectionMarkerValues(startTime, endTime); } @@ -253,9 +264,10 @@ public class TimelineComposite extends DAView { if (null == logPack) { return; } - + Logs logList = logPack.getLogs(LogCenterConstants.LOG_LIFECYCLE); - if (null != logList && null != logList.getLogs() && 0 <= logList.getLogs().size()) { + if (null != logList && null != logList.getLogs() + && 0 <= logList.getLogs().size()) { List> deviceLogs = logList.getLogs(); for (List deviceLog : deviceLogs) { if (null == deviceLog || 0 > deviceLog.size()) { @@ -264,23 +276,27 @@ public class TimelineComposite extends DAView { } } - List itemList = TimelineItemsProvider.getInstance().getAvailableItemsList(); - - //FIXME chart manager + List itemList = TimelineItemsProvider.getInstance() + .getAvailableItemsList(); + + // FIXME chart manager for (int i = 0; i < itemList.size(); i++) { - updateChartDataSet(logPack, TimelineUtils.getChartType(itemList.get(i))); + updateChartDataSet(logPack, + TimelineUtils.getChartType(itemList.get(i))); } } - + private void updateChartDataSet(LogPackage logPack, int chartType) { int probeType = TimelineUtils.getProbeID(chartType); - TimelineChart timelineChart = TimelineChartManager.getInstance().getTimelineChartInstance(chartType); -// if(chartType == TimelineConstants.CHART_TYPE_CPU && TimelineItemManager.bCustomChart == true) { -// ((DATimelineChart)timelineChart).parsingLogList(logPack, probeType); -// } else { - timelineChart.parsingLogList(logPack, probeType); -// } + TimelineChart timelineChart = TimelineChartManager.getInstance() + .getTimelineChartInstance(chartType); + // if(chartType == TimelineConstants.CHART_TYPE_CPU && + // TimelineItemManager.bCustomChart == true) { + // ((DATimelineChart)timelineChart).parsingLogList(logPack, probeType); + // } else { + timelineChart.parsingLogList(logPack, probeType); + // } } @Override diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/views/summaryPage/SummaryPage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/views/summaryPage/SummaryPage.java index b00e5cb..a5aba6e 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/views/summaryPage/SummaryPage.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/views/summaryPage/SummaryPage.java @@ -76,11 +76,13 @@ public class SummaryPage extends DAPageComposite { { SnapshotView currentView = new SnapshotView( tabView.getContentComposite(), SWT.NONE, false); - tabView.addView(currentView, SummaryLabels.SUMMARY_PAGE_SNAPSHOT_TITLE); + tabView.addView(currentView, + SummaryLabels.SUMMARY_PAGE_SNAPSHOT_TITLE); CallstackView callstack = new CallstackView( tabView.getContentComposite(), SWT.NONE); - tabView.addView(callstack, SummaryLabels.SUMMARY_PAGE_CALLSTACK_TITLE); + tabView.addView(callstack, + SummaryLabels.SUMMARY_PAGE_CALLSTACK_TITLE); } upperForm.setWeights(new int[] { 37, 40, 23 }); @@ -108,6 +110,7 @@ public class SummaryPage extends DAPageComposite { @Override public void controlResized(ControlEvent e) { + Composite composite = (Composite) e.widget; Rectangle rect = composite.getBounds(); int pageWidth = rect.width; @@ -117,6 +120,10 @@ public class SummaryPage extends DAPageComposite { int hRate = (int) (DEFAULT_HEIGHT * 100 / pageHeight); wRate = (wRate >= 100) ? 100 : wRate; hRate = (hRate >= 100) ? 100 : hRate; + + if ((wRate >= (100 - 37)) || hRate >= 100) { + return; + } upperForm.setWeights(new int[] { 37, 100 - 37 - wRate, wRate }); baseForm.setWeights(new int[] { hRate, 100 - hRate }); } -- 2.7.4