From: ggh1933.go Date: Wed, 9 Mar 2016 06:44:24 +0000 (+0900) Subject: [SRADA-129] Implementation check RunningProcess Invalid X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11a0f3d2851584c8d4bf03cdb99e1c8f2219713c;p=sdk%2Ftools%2Fdynamic-analyzer.git [SRADA-129] Implementation check RunningProcess Invalid + Cutting Needless Argument on process + Comparing by "MapKey" + If Result is null, Avoid NullPointException and close explorer Change-Id: Id21297fc6bfe6e4c5755c97e10d7049f183a46e2 --- diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ProcessExplorer.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ProcessExplorer.java index 5d6d658..71c8e56 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ProcessExplorer.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ProcessExplorer.java @@ -244,11 +244,20 @@ public class ProcessExplorer extends Composite { if (maxnamelen < namelen) { maxnamelen = namelen; } - + GridItem item = new GridItem(table, SWT.NONE); item.setCheckable(0, false); item.setText(1, entry.getKey().toString()); - item.setText(2, name); + + // cut needless arguments (ex:"/usr/bin/Xorg :0 -#$%" -> "/usr/bin/Xorg") + if(name.contains(" ")){ + int cut_index = name.indexOf(" "); + item.setText(2, name.substring(0, cut_index)); + } + else{ + item.setText(2, name); + } + if (initialProcesses != null && initialProcesses.containsKey(entry.getKey())) { item.setChecked(0, true); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ProcessExplorerDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ProcessExplorerDialog.java index 441eea4..213e69b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ProcessExplorerDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ProcessExplorerDialog.java @@ -40,6 +40,8 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.tizen.dynamicanalyzer.appearance.DesignConstants; import org.tizen.dynamicanalyzer.common.Global; +import org.tizen.dynamicanalyzer.communicator.DACommunicator; +import org.tizen.dynamicanalyzer.handlers.UIAction; import org.tizen.dynamicanalyzer.nl.AnalyzerLabels; import org.tizen.dynamicanalyzer.nl.UserErrorWarningLabels; import org.tizen.dynamicanalyzer.nl.WidgetLabels; @@ -119,9 +121,22 @@ public class ProcessExplorerDialog extends DAMessageBox { @Override public void handleClickEvent(DACustomButton button) { result = explorer.getSelectedProcess(); + if (null != result) { + Boolean process_validation = checkInvalidProcess((Map) result); + if(process_validation){ + shell.dispose(); + } + else{ + UIAction.showWarning("Selected Process isn't running. Reselect process"); + explorer.updateData(); + } + } + /// If result is null, close explorer + else{ shell.dispose(); } + } }); @@ -141,7 +156,32 @@ public class ProcessExplorerDialog extends DAMessageBox { } }); } + + + public Boolean checkInvalidProcess(Map result){ + Map processes = DACommunicator.getProcessList(); + + for(Map.Entry result_entry : result.entrySet()){ + + Integer result_key = result_entry.getKey(); + + /// don't have selected PID + if(!processes.containsKey(result_key) ){ + return false; + } + /// don't matched PROCESS_NAME + else{ + String Compare = processes.get(result_key); + + if(!Compare.contains(result_entry.getValue())){ + return false; + } + } + } + return true; + } + public void setProcessList(Map proc) { explorer.setSelectedProcess(proc); }