From c7e591bae063fe5a887db0e15fcb3ac533bee201 Mon Sep 17 00:00:00 2001 From: Lee Date: Fri, 9 Nov 2012 19:37:44 +0900 Subject: [PATCH] [Title] Table/Tree search popup [Desc.] Search popup window added and new logc files added [Issue] redmine #7370 --- .../button/toggle/DACustomToggleButton.java | 19 ++ .../dynamic-analyzer/xml/image.logc | 116 -------- .../dynamic-analyzer/xml/scene.logc | 136 +++++++++ .../dynamic-analyzer/xml/screenshot.logc | 105 +++++++ .../dynamic-analyzer/xml/ui_control.logc | 126 +++++++++ .../dynamic-analyzer/xml/ui_event.logc | 67 +++-- .../dynamicanalyzer/common/AnalyzerConstants.java | 1 + .../dynamicanalyzer/handlers/OpenTraceHandler.java | 2 +- .../logparser/LogCenterConstants.java | 2 +- .../tizen/dynamicanalyzer/logparser/LogParser.java | 2 +- .../dynamicanalyzer/logparser/MessageProcess.java | 2 +- .../tizen/dynamicanalyzer/model/FindProperty.java | 60 ++++ .../tizen/dynamicanalyzer/model/SnapshotData.java | 8 +- .../ui/info/callstack/CallstackView.java | 1 + .../ui/summary/failed/FailedApiListView.java | 1 + .../ui/summary/leaks/LeakTable.java | 2 +- .../profiling/FunctionUsageProfilingView.java | 2 +- .../ui/summary/profiling/ProfilingTable.java | 2 +- .../ui/summary/warning/WarningListView.java | 1 + .../ui/timeline/calltrace/CallTraceView.java | 2 +- .../ui/timeline/chart/UserCustomChart.java | 4 - .../UserInterfaceControlListView.java | 4 - .../UserInterfaceFunctionProfilingTable.java | 2 +- .../dynamicanalyzer/ui/widgets/FindDialog.java | 313 +++++++++++++++++++++ .../ui/widgets/table/DATableComposite.java | 167 ++++++++++- .../ui/widgets/table/DATreeComposite.java | 242 ++++++++++++++-- .../tizen/dynamicanalyzer/utils/TimelineUtils.java | 2 - 27 files changed, 1184 insertions(+), 207 deletions(-) delete mode 100644 org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/image.logc create mode 100644 org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/scene.logc create mode 100644 org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/screenshot.logc create mode 100644 org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/ui_control.logc create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/FindProperty.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/FindDialog.java diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomToggleButton.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomToggleButton.java index 58c8c6d..7497353 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomToggleButton.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomToggleButton.java @@ -27,6 +27,7 @@ package org.tizen.dynamicanalyzer.widgets.button.toggle; import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Event; @@ -56,6 +57,24 @@ public class DACustomToggleButton extends DACustomButton { addListeners(); } + public DACustomToggleButton(Composite parent, Color normalStart, + Color normalEnd, Color pushStart, Color pushEnd, Color hoverStart, + Color hoverEnd, Color disableStart, Color disableEnd, + Color toggleStart, Color toggleEnd) { + this(parent, SWT.NONE); + attr.setColor(0, normalStart); + attr.setColor(1, normalEnd); + attr.setColor(2, pushStart); + attr.setColor(3, pushEnd); + attr.setColor(4, hoverStart); + attr.setColor(5, hoverEnd); + attr.setColor(6, disableStart); + attr.setColor(7, disableEnd); + attr.setColor(8, toggleStart); + attr.setColor(9, toggleEnd); + attr.setDrawType(TYPE_GRADATION); + } + public void setToggled(boolean toggled) { if (!toggleByButton) { toggle = toggled; diff --git a/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/image.logc b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/image.logc deleted file mode 100644 index fd193f5..0000000 --- a/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/image.logc +++ /dev/null @@ -1,116 +0,0 @@ - - - 7 - image - 16 - false - - Rid - ID - SeqNumber - APIName - Time - - Pid - Tid - InputParam - Return - PCAddr - - Error - InternalCall - CallerPCAddr - Size - APIType - - Reserved - - INTEGER - INTEGER - INTEGER PRIMARY KEY NOT NULL - TEXT - INTEGER - - INTEGER - INTEGER - TEXT - TEXT - INTEGER - - INTEGER - INTEGER - INTEGER - INTEGER - INTEGER - - TEXT - - - 0 - 0 - 0 - 0 - 0 - - - 0 - 1 - 2 - 3 - 4 - - 5 - 6 - 7 - 8 - 9 - - 10 - 11 - 12 - 13 - 14 - - 15 - - - false - false - true - true - true - - true - true - true - true - false - - true - true - false - false - false - - false - - Row Id - ID - # - API name - Time - - Process id - Thread id - Input parm - Return - PC Addr - - Errno - Internal Call - Caller PC Address - Size - API type - - Reserved - \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/scene.logc b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/scene.logc new file mode 100644 index 0000000..82e6203 --- /dev/null +++ b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/scene.logc @@ -0,0 +1,136 @@ + + + 6 + scene + 20 + false + + Rid + ID + SeqNumber + APIName + Time + + Pid + Tid + InputParam + Return + PCAddr + + Error + InternalCall + CallerPCAddr + SceneName + FormName + + FormPointer + PanelName + PanelPointer + Direction + Reserved + + INTEGER + INTEGER + INTEGER PRIMARY KEY NOT NULL + TEXT + INTEGER + + INTEGER + TEXT + TEXT + TEXT + TEXT + + INTEGER + INTEGER + INTEGER + TEXT + TEXT + + INTEGER + TEXT + INTEGER + INTEGER + TEXT + + 100 + 0 + 80 + 0 + + + 0 + 1 + 2 + 3 + 4 + + 5 + 6 + 7 + 8 + 9 + + 10 + 11 + 12 + 13 + 14 + + 15 + 16 + 17 + 18 + 19 + + + true + true + true + true + true + + true + true + true + true + true + + true + true + true + true + true + + true + true + true + true + true + + + Row Id + ID + # + API name + Time + + Process id + Thread id + Input parm + Return + PC Addr + + Errno + Internal call + Caller PCaddr + Scene name + Form name + + Form pointer + Panel name + Panel pointer + Direction + Reserved + + \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/screenshot.logc b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/screenshot.logc new file mode 100644 index 0000000..70b4205 --- /dev/null +++ b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/screenshot.logc @@ -0,0 +1,105 @@ + + + 7 + screenshot + 15 + false + + Rid + ID + SeqNumber + APIName + Time + + Pid + Tid + InputParam + Return + PCAddr + + Error + InternalCall + CallerPCAddr + ImageFilePath + Reserved + + INTEGER + INTEGER + INTEGER PRIMARY KEY NOT NULL + TEXT + INTEGER + + INTEGER + TEXT + TEXT + TEXT + TEXT + + INTEGER + INTEGER + INTEGER + TEXT + TEXT + + 100 + 0 + 80 + 0 + + + 0 + 1 + 2 + 3 + 4 + + 5 + 6 + 7 + 8 + 9 + + 10 + 11 + 12 + 13 + 14 + + + true + true + true + true + true + + true + true + true + true + true + + true + true + true + true + true + + Row Id + ID + # + API name + Time + + Process id + Thread id + Input parm + Return + PC Addr + + Errno + Internal Call + CallerPCAddr + ImageFilePath + Reserved + + \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/ui_control.logc b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/ui_control.logc new file mode 100644 index 0000000..77b98f3 --- /dev/null +++ b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/ui_control.logc @@ -0,0 +1,126 @@ + + + 3 + ui_control + 18 + false + + Rid + ID + SeqNumber + APIName + Time + + Pid + Tid + InputParam + Return + PCAddr + + Error + InternalCall + CallerPCAddr + ParentName + ParentPointer + + ChildName + ChildPointer + Reserved + + INTEGER + INTEGER + INTEGER PRIMARY KEY NOT NULL + TEXT + INTEGER + + INTEGER + INTEGER + TEXT + TEXT + TEXT + + INTEGER + INTEGER + INTEGER + TEXT + INTEGER + + TEXT + INTEGER + TEXT + + 0 + 0 + 0 + 0 + 0 + + + 0 + 1 + 2 + 3 + 4 + + 5 + 6 + 7 + 8 + 9 + + 10 + 11 + 12 + 13 + 14 + + 15 + 16 + 17 + + + false + false + true + true + true + + true + true + true + true + false + + true + true + true + false + false + + true + true + true + + + Row Id + ID + # + API name + Time + + Process id + Thread id + Input parm + Return + PC Addr + + Errno + Internal Call + Call PC Address + Parent name + Parent pointer + + Child name + Child pointer + Reserved + \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/ui_event.logc b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/ui_event.logc index b8a0d48..4fff5da 100644 --- a/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/ui_event.logc +++ b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/xml/ui_event.logc @@ -2,7 +2,7 @@ 3 ui_event - 17 + 20 false Rid @@ -20,10 +20,13 @@ Error InternalCall CallerPCAddr + EventType + DetailType + x y - - eventType + info1 + info2 Reserved INTEGER @@ -45,6 +48,9 @@ INTEGER INTEGER + INTEGER + INTEGER + INTEGER TEXT 0 @@ -55,25 +61,28 @@ 0 - 1 - 2 - 3 - 4 - - 11 - 12 - 9 - 13 - 7 - - 8 - 10 - 5 - 6 - 14 - - 15 - 16 + 1 + 2 + 3 + 4 + + 5 + 6 + 7 + 8 + 9 + + 10 + 11 + 12 + 13 + 14 + + 15 + 16 + 17 + 18 + 19 false @@ -94,8 +103,11 @@ false false - false - false + true + true + true + false + false Row Id @@ -113,9 +125,12 @@ Errno Internal Call Call PC Address + Event type + Detail type + X Y - - Event type + Info1 + Info2 Reserved \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java index c43b7fa..8e0f3d2 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java @@ -115,6 +115,7 @@ public class AnalyzerConstants { public static final int ERROR_EXTENSION_FAIL = -1; public static final int SUCCESS = 1; public static final int ERROR_SAVE_FAIL = 0; + public static final int FAIL = -2; /* data size */ public static final int INSERT_DATA_PACKAGE_SIZE = 80; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/OpenTraceHandler.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/OpenTraceHandler.java index f317335..5dcd713 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/OpenTraceHandler.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/OpenTraceHandler.java @@ -237,7 +237,7 @@ public class OpenTraceHandler extends AbstractHandler { } private void loadImageSet(Project p) { - ResultSet rs = SqlManager.selectAllFromTable("image"); //$NON-NLS-1$ + ResultSet rs = SqlManager.selectAllFromTable("screenshot"); //$NON-NLS-1$ if (null == rs) { return; } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogCenterConstants.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogCenterConstants.java index d5b4ab6..c493858 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogCenterConstants.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogCenterConstants.java @@ -34,7 +34,7 @@ public class LogCenterConstants { public static final int LOG_USER_FUNCTION = 4; public static final int LOG_RESOURCE = 5; public static final int LOG_LIFECYCLE = 6; - public static final int LOG_IMAGE = 7; + public static final int LOG_SNAPSHOT = 7; public static final int LOG_DEVICE = 9; public static final int LOG_SAMPLE = 11; public static final int LOG_SYSTEM = 12; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java index d89ce8d..b3fc63d 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java @@ -280,7 +280,7 @@ public class LogParser implements Runnable { } } - if (id == LogCenterConstants.LOG_IMAGE) { + if (id == LogCenterConstants.LOG_SNAPSHOT) { ImageInfo imgInfo = new ImageInfo(); imgInfo.setSeq(input.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX)); imgInfo.setTime(input.get(LogCenterConstants.TIME_INDEX)); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/MessageProcess.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/MessageProcess.java index 1993320..66abb62 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/MessageProcess.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/MessageProcess.java @@ -135,7 +135,7 @@ public class MessageProcess { buffer.add(messages[1]); messageCount += 1; break; - case AnalyzerConstants.MSG_IMAGE: /* image : 6 */ + case AnalyzerConstants.MSG_IMAGE: /* screenshot : 6 */ processImage(messages[1]); break; case AnalyzerConstants.MSG_TERMINATE: /* terminate : 7 */ diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/FindProperty.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/FindProperty.java new file mode 100644 index 0000000..0ab85fe --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/FindProperty.java @@ -0,0 +1,60 @@ +package org.tizen.dynamicanalyzer.model; + +import org.tizen.dynamicanalyzer.common.CommonConstants; + +public class FindProperty { + private boolean backward; + private boolean caseSensitive; + private boolean wholeWord; + private int index; + private String lastSearch; + + public FindProperty() { + backward = false; + caseSensitive = false; + wholeWord = false; + index = -1; + lastSearch = CommonConstants.EMPTY; + } + + public String getLastSearch() { + return lastSearch; + } + + public void setLastSearch(String lastSearch) { + this.lastSearch = lastSearch; + } + + public boolean isBackward() { + return backward; + } + + public void setBackward(boolean backward) { + this.backward = backward; + } + + public boolean isCaseSensitive() { + return caseSensitive; + } + + public void setCaseSensitive(boolean caseSensitive) { + this.caseSensitive = caseSensitive; + } + + public boolean isWholeWord() { + return wholeWord; + } + + public void setWholeWord(boolean wholeWord) { + this.wholeWord = wholeWord; + } + + public int getIndex() { + return index; + } + + public void setIndex(int index) { + this.index = index; + } + +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/SnapshotData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/SnapshotData.java index d2b6e87..196128c 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/SnapshotData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/SnapshotData.java @@ -44,7 +44,7 @@ import org.tizen.dynamicanalyzer.utils.ImageUtil; public class SnapshotData { - + private final String SNAPSHOT = "snapshot"; private static SnapshotData snapshotData = new SnapshotData(); private List infos = new ArrayList(); @@ -131,11 +131,11 @@ public class SnapshotData { } private String query() { - return "select * from image"; //$NON-NLS-1$ + return "select * from " + SNAPSHOT; //$NON-NLS-1$ } private String query(String min, String max) { - return "select * from image where time <= " + max + " and time > " //$NON-NLS-1$ //$NON-NLS-2$ + return "select * from " + SNAPSHOT + " where time <= " + max + " and time > " //$NON-NLS-1$ //$NON-NLS-2$ + min + " ;"; //$NON-NLS-1$ } @@ -144,7 +144,7 @@ public class SnapshotData { return; } - LogCenter logc = AnalyzerManager.getLogCenterById(LogCenterConstants.LOG_IMAGE); + LogCenter logc = AnalyzerManager.getLogCenterById(LogCenterConstants.LOG_SNAPSHOT); if (null == logc) { return; } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallstackView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallstackView.java index 93e5fce..297fb04 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallstackView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallstackView.java @@ -60,6 +60,7 @@ public class CallstackView extends DAView { contents.setLayout(new FillLayout()); callstackTableComp = new CallstackTable(contents, SWT.NONE, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); + callstackTableComp.setTableName("Callstack"); callstackTableComp.setColumns(columnNames); callstackTableComp.setColumnSize(columnSizes); callstackTableComp.setColumnVisibility(columnVisibility); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/failed/FailedApiListView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/failed/FailedApiListView.java index 20de9a3..be805c7 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/failed/FailedApiListView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/failed/FailedApiListView.java @@ -79,6 +79,7 @@ public class FailedApiListView extends DAView { contents.setLayout(new FillLayout()); tableComp = new FailedApiTable(contents, SWT.NONE, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); + tableComp.setTableName("Failed APIs"); tableComp.setComparator(new TableComparator()); tableComp.setSortTypes(sortTypes); tableComp.setSourceColumns(sourceColumns); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/leaks/LeakTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/leaks/LeakTable.java index f3e3738..0bb9448 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/leaks/LeakTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/leaks/LeakTable.java @@ -52,7 +52,7 @@ public class LeakTable extends DATreeComposite { public LeakTable(Composite parent, int compStyle, int tableStyle) { super(parent, compStyle, tableStyle); - setSelValueIndex(LeakData.LEAK_SEQ_INDEX); +// setSelValueIndex(LeakData.LEAK_SEQ_INDEX); tree.addListener(SWT.Expand, new Listener() { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/FunctionUsageProfilingView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/FunctionUsageProfilingView.java index 2278d81..4a3d99d 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/FunctionUsageProfilingView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/FunctionUsageProfilingView.java @@ -76,7 +76,7 @@ public class FunctionUsageProfilingView extends DAView { contents.setBackground(ColorResources.WINDOW_BG_COLOR); contents.setLayout(new FillLayout()); treeComp = new ProfilingTable(contents, SWT.NONE, SWT.SINGLE - | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); + | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); /*** setTree set first!!! ***/ treeComp.setTree(true); treeComp.setSortTypes(sortTypes); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/ProfilingTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/ProfilingTable.java index ffa4632..57cc8c4 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/ProfilingTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/ProfilingTable.java @@ -56,7 +56,7 @@ public class ProfilingTable extends DATreeComposite { public ProfilingTable(Composite parent, int compStyle, int tableStyle) { super(parent, compStyle, tableStyle); setComparator(new TreeDataComparator()); - setSelValueIndex(0); +// setSelValueIndex(0); comparator.setType(AnalyzerConstants.SORT_TYPE_NUM); comparator.setColumn(2); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/warning/WarningListView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/warning/WarningListView.java index f0c5074..65efc29 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/warning/WarningListView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/warning/WarningListView.java @@ -65,6 +65,7 @@ public class WarningListView extends DAView { contents.setLayout(new FillLayout()); tableComp = new WarningTable(contents, SWT.NONE, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); + tableComp.setTableName("Warning List"); tableComp.setComparator(new TableComparator()); tableComp.setSortTypes(sortTypes); tableComp.setSourceColumns(sourceColumns); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/calltrace/CallTraceView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/calltrace/CallTraceView.java index 17c921e..df1e73d 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/calltrace/CallTraceView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/calltrace/CallTraceView.java @@ -75,7 +75,7 @@ public class CallTraceView extends DAView { contents.setLayout(new FillLayout()); tableComp = new CallTraceTable(contents, SWT.NONE, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); - + tableComp.setTableName("Calltrace"); // test tableComp.setComparator(new TableComparator()); tableComp.setSortTypes(sortTypes); tableComp.setSourceColumns(sourceColumns); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UserCustomChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UserCustomChart.java index 34559a5..b71b571 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UserCustomChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UserCustomChart.java @@ -75,10 +75,6 @@ public class UserCustomChart extends TimelineChart { } @Override - public void dispose() { - } - - @Override public void parsingLogPackage(LogPackage logPack, int probeType) { if (!isAbleToParse(logPack, LogCenterConstants.LOG_DEVICE)) { return; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/userinterface/UserInterfaceControlListView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/userinterface/UserInterfaceControlListView.java index 93d7e1c..baf0758 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/userinterface/UserInterfaceControlListView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/userinterface/UserInterfaceControlListView.java @@ -5,16 +5,12 @@ import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; -import org.tizen.dynamicanalyzer.common.DASelectionData; -import org.tizen.dynamicanalyzer.listeners.TableTooltipListener; import org.tizen.dynamicanalyzer.model.DAView; import org.tizen.dynamicanalyzer.nl.UserInterfacePageLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; import org.tizen.dynamicanalyzer.ui.file.FileApiListView; import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingData; -import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingTable; import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer; -import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite; public class UserInterfaceControlListView extends DAView { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/userinterface/UserInterfaceFunctionProfilingTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/userinterface/UserInterfaceFunctionProfilingTable.java index e260f2b..7055a6c 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/userinterface/UserInterfaceFunctionProfilingTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/userinterface/UserInterfaceFunctionProfilingTable.java @@ -68,7 +68,7 @@ public class UserInterfaceFunctionProfilingTable extends DATreeComposite { int tableStyle) { super(parent, compStyle, tableStyle); setComparator(new TreeDataComparator()); - setSelValueIndex(0); +// setSelValueIndex(0); comparator.setType(AnalyzerConstants.SORT_TYPE_NUM); comparator.setColumn(2); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/FindDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/FindDialog.java new file mode 100644 index 0000000..0e60ceb --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/FindDialog.java @@ -0,0 +1,313 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.dynamicanalyzer.ui.widgets; + +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +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.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.tizen.dynamicanalyzer.common.AnalyzerConstants; +import org.tizen.dynamicanalyzer.common.DesignConstants; +import org.tizen.dynamicanalyzer.model.FindProperty; +import org.tizen.dynamicanalyzer.resources.ColorResources; +import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite; +import org.tizen.dynamicanalyzer.ui.widgets.table.DATreeComposite; +import org.tizen.dynamicanalyzer.widgets.button.DACustomButton; +import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener; +import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButton; + +public class FindDialog extends DAMessageBox { + + private Text textBox = null; + private DAButton findButton = null; + private DACustomButton forwardButton = null; + private DACustomButton backwardButton = null; + private DACustomToggleButton caseButton = null; + private DACustomToggleButton wholeWordButton = null; + + private FindProperty findProperty = null; + + private Grid table = null; + private String viewName = null; + private Composite composite = null; + + public FindDialog(Shell parentShell, Composite comp) { + super(parentShell); + if (comp instanceof DATableComposite) { + this.table = ((DATableComposite) comp).getTable(); + viewName = ((DATableComposite) comp).getTableName(); + } else if (comp instanceof DATreeComposite) { + this.table = ((DATreeComposite) comp).getTable(); + viewName = ((DATreeComposite) comp).getTableName(); + } else { + table = null; + } + this.composite = comp; + findProperty = DATableComposite.getFindProferty(); + findProperty.setIndex(table.getSelectionIndex()); + } + + protected int run() { + if (null == table) { + return AnalyzerConstants.FAIL; + } + shell.setLayout(new FormLayout()); + shell.setSize(340, 130); + shell.setBackground(ColorResources.DIALOG_BG_UPPER); + shell.setText("Find from " + viewName + " table"); + + textBox = new Text(shell, SWT.SINGLE); + FormData data = new FormData(); + data.top = new FormAttachment(0, 11); + data.left = new FormAttachment(0, 9); + data.height = 22; + data.width = 200; + textBox.setLayoutData(data); + textBox.setBackground(ColorResources.VIEW_BG_COLOR); + textBox.addKeyListener(keyListener); + textBox.setText(findProperty.getLastSearch()); + textBox.setSelection(0, findProperty.getLastSearch().length()); + + findButton = new DAButton(shell, SWT.NONE); + data = new FormData(); + data.top = new FormAttachment(0, 11); + data.left = new FormAttachment(textBox, 9); + data.height = 25; + data.width = DesignConstants.DA_BUTTON_WIDTH; + findButton.setLayoutData(data); + findButton.setText("Find"); + findButton.addClickListener(fnidButtonListener); + + Label directionLabel = new Label(shell, SWT.TRANSPARENT); + data = new FormData(); + data.top = new FormAttachment(textBox, 11); + data.left = new FormAttachment(0, 15); + data.height = 20; + data.width = DesignConstants.DA_BUTTON_WIDTH; + directionLabel.setLayoutData(data); + directionLabel.setText("Direction :"); + directionLabel.setBackground(ColorResources.DIALOG_BG_UPPER); + + forwardButton = new DACustomButton(shell, + ColorResources.TAB_NORMAL_COLOR_START, + ColorResources.TAB_NORMAL_COLOR_END, + ColorResources.TAB_PUSH_COLOR_START, + ColorResources.TAB_PUSH_COLOR_END, + ColorResources.TAB_HOVER_COLOR_START, + ColorResources.TAB_HOVER_COLOR_END, + ColorResources.TAB_SELECTED_COLOR_START, + ColorResources.TAB_SELECTED_COLOR_END); + data = new FormData(); + data.top = new FormAttachment(textBox, 10); + data.left = new FormAttachment(directionLabel, 0); + data.height = 20; + data.width = DesignConstants.DA_BUTTON_WIDTH; + forwardButton.setLayoutData(data); + forwardButton.setText("Forward"); + forwardButton.setEnabled(findProperty.isBackward()); + forwardButton.addClickListener(forwardButtonListener); + + backwardButton = new DACustomButton(shell, + ColorResources.TAB_NORMAL_COLOR_START, + ColorResources.TAB_NORMAL_COLOR_END, + ColorResources.TAB_PUSH_COLOR_START, + ColorResources.TAB_PUSH_COLOR_END, + ColorResources.TAB_HOVER_COLOR_START, + ColorResources.TAB_HOVER_COLOR_END, + ColorResources.TAB_SELECTED_COLOR_START, + ColorResources.TAB_SELECTED_COLOR_END); + data = new FormData(); + data.top = new FormAttachment(textBox, 10); + data.left = new FormAttachment(forwardButton, 1); + data.height = 20; + data.width = DesignConstants.DA_BUTTON_WIDTH; + backwardButton.setLayoutData(data); + backwardButton.setText("Backward"); + backwardButton.setEnabled(!findProperty.isBackward()); + backwardButton.addClickListener(backwardButtonListener); + + Label optionLabel = new Label(shell, SWT.TRANSPARENT); + data = new FormData(); + data.top = new FormAttachment(directionLabel, 5); + data.left = new FormAttachment(0, 15); + data.height = 20; + data.width = DesignConstants.DA_BUTTON_WIDTH; + optionLabel.setLayoutData(data); + optionLabel.setText("Option ;"); + optionLabel.setBackground(ColorResources.DIALOG_BG_UPPER); + + caseButton = new DACustomToggleButton(shell, + ColorResources.TAB_NORMAL_COLOR_START, + ColorResources.TAB_NORMAL_COLOR_END, + ColorResources.TAB_PUSH_COLOR_START, + ColorResources.TAB_PUSH_COLOR_END, + ColorResources.TAB_HOVER_COLOR_START, + ColorResources.TAB_HOVER_COLOR_END, + ColorResources.BUTTON_DISABLE_COLOR_START, + ColorResources.BUTTON_DISABLE_COLOR_END, + ColorResources.TAB_SELECTED_COLOR_START, + ColorResources.TAB_SELECTED_COLOR_END); + data = new FormData(); + data.top = new FormAttachment(forwardButton, 5); + data.left = new FormAttachment(optionLabel, 0); + data.height = 20; + data.width = DesignConstants.DA_BUTTON_WIDTH; + caseButton.setLayoutData(data); + caseButton.setText("Case Sensitive"); + caseButton.addClickListener(caseButtonListener); + caseButton.setToggled(findProperty.isCaseSensitive()); + + wholeWordButton = new DACustomToggleButton(shell, + ColorResources.TAB_NORMAL_COLOR_START, + ColorResources.TAB_NORMAL_COLOR_END, + ColorResources.TAB_PUSH_COLOR_START, + ColorResources.TAB_PUSH_COLOR_END, + ColorResources.TAB_HOVER_COLOR_START, + ColorResources.TAB_HOVER_COLOR_END, + ColorResources.BUTTON_DISABLE_COLOR_START, + ColorResources.BUTTON_DISABLE_COLOR_END, + ColorResources.TAB_SELECTED_COLOR_START, + ColorResources.TAB_SELECTED_COLOR_END); + data = new FormData(); + data.top = new FormAttachment(forwardButton, 5); + data.left = new FormAttachment(caseButton, 1); + data.height = 20; + data.width = DesignConstants.DA_BUTTON_WIDTH; + wholeWordButton.setLayoutData(data); + wholeWordButton.setText("Whole Word"); + wholeWordButton.addClickListener(wholeWordButtonListener); + wholeWordButton.setToggled(findProperty.isWholeWord()); + + return result; + } + + private DACustomButtonClickEventListener fnidButtonListener = new DACustomButtonClickEventListener() { + + @Override + public void handleClickEvent(DACustomButton button) { + findProperty.setLastSearch(textBox.getText()); + if (executeFindCommand()) { + result = AnalyzerConstants.SUCCESS; + } + } + }; + + private KeyListener keyListener = new KeyListener() { + + @Override + public void keyReleased(KeyEvent e) { + if (null != textBox.getText() && !textBox.getText().isEmpty()) { + findButton.setEnabled(true); + } else { + findButton.setEnabled(false); + } + } + + @Override + public void keyPressed(KeyEvent e) { + + } + }; + + private DACustomButtonClickEventListener forwardButtonListener = new DACustomButtonClickEventListener() { + + @Override + public void handleClickEvent(DACustomButton button) { + findProperty.setBackward(false); + if (!backwardButton.isEnabled()) { + backwardButton.setEnabled(true); + } + forwardButton.setEnabled(false); + } + }; + + private DACustomButtonClickEventListener backwardButtonListener = new DACustomButtonClickEventListener() { + + @Override + public void handleClickEvent(DACustomButton button) { + findProperty.setBackward(true); + if (!forwardButton.isEnabled()) { + forwardButton.setEnabled(true); + } + backwardButton.setEnabled(false); + } + }; + + private DACustomButtonClickEventListener caseButtonListener = new DACustomButtonClickEventListener() { + + @Override + public void handleClickEvent(DACustomButton button) { + findProperty.setCaseSensitive(!findProperty.isCaseSensitive()); + caseButton.setToggled(findProperty.isCaseSensitive()); + } + }; + + private DACustomButtonClickEventListener wholeWordButtonListener = new DACustomButtonClickEventListener() { + + @Override + public void handleClickEvent(DACustomButton button) { + findProperty.setWholeWord(!findProperty.isWholeWord()); + wholeWordButton.setToggled(findProperty.isWholeWord()); + } + }; + + private boolean executeFindCommand() { + + int index = findProperty.getIndex(); + GridItem[] items = table.getItems(); + int itemCount = items.length; + + if (itemCount != 0) { + if (findProperty.isBackward()) { + index = (index - 1 < 0) ? itemCount - 1 : index - 1; + } else { + + index = (index + 1 > itemCount - 1) ? 0 : index + 1; + } + int findIndex = -1; + findProperty.setIndex(index); + if (composite instanceof DATableComposite) { + findIndex = ((DATableComposite) composite).search(findProperty); + } else if (composite instanceof DATreeComposite) { + findIndex = ((DATreeComposite) composite).search(findProperty); + } else { + return false; + } + findProperty.setIndex(findIndex); + return true; + } + return false; + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATableComposite.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATableComposite.java index 2ce944d..6e792b8 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATableComposite.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATableComposite.java @@ -35,22 +35,34 @@ import org.eclipse.nebula.widgets.grid.Grid; import org.eclipse.nebula.widgets.grid.GridColumn; import org.eclipse.nebula.widgets.grid.GridItem; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.tizen.dynamicanalyzer.common.CommonConstants; import org.tizen.dynamicanalyzer.listeners.TableTooltipListener; import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; +import org.tizen.dynamicanalyzer.model.FindProperty; import org.tizen.dynamicanalyzer.model.LogCenter; import org.tizen.dynamicanalyzer.model.TableInput; import org.tizen.dynamicanalyzer.resources.ColorResources; import org.tizen.dynamicanalyzer.resources.FontResources; +import org.tizen.dynamicanalyzer.ui.widgets.FindDialog; +import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; public abstract class DATableComposite extends Composite { + // for find + private String tableName = CommonConstants.EMPTY; + private DATableComposite me = null; + private static FindProperty findProferty; + private boolean ctrlPressed = false; + protected Grid table; protected int itemCount = 0; protected List selectionIndex; @@ -125,6 +137,38 @@ public abstract class DATableComposite extends Composite { } }); + + table.addKeyListener(new KeyListener() { + + @Override + public void keyReleased(KeyEvent e) { + + if (SWT.CTRL == e.keyCode) { + System.out.println("ctrl released!"); + ctrlPressed = false; + } else if (e.keyCode == 102) { // f + if (ctrlPressed) { + ctrlPressed = false; + Shell shell = AnalyzerUtil.getWorkbenchWindow() + .getShell(); + FindDialog dialog = new FindDialog(shell, me); + dialog.open(); + System.out.println("ctrl + f released!!"); + // FIXME: debug + } + } + + } + + @Override + public void keyPressed(KeyEvent e) { + if (SWT.CTRL == e.keyCode) { + ctrlPressed = true; + } + } + }); + + me = this; } public void setTree(boolean tree) { @@ -286,16 +330,6 @@ public abstract class DATableComposite extends Composite { return selectionIndex; } - public int getItemCount() { - if (0 == itemCount) { - Rectangle rect = table.getClientArea(); - int itemHeight = table.getItemHeight(); - itemCount = (rect.height - table.getHeaderHeight()) / itemHeight - - 1; - } - return itemCount; - } - public void setSourceView(boolean toggle) { if (null != tableListener) { tableListener.setSourceButtonToggle(toggle); @@ -303,6 +337,8 @@ public abstract class DATableComposite extends Composite { } public void clear() { + getSelectionIndex().clear(); + getSelections().clear(); table.removeAll(); } @@ -326,6 +362,113 @@ public abstract class DATableComposite extends Composite { getSelectionIndex().clear(); getSelections().clear(); table.deselectAll(); - // updateTable(); + } + + private int getScrollSelectionIndex(int selection) { + int size = table.getVerticalBar().getThumb() / 2; + int output = selection - size; + + output = (output < 0) ? 0 : output; + return output; + } + + public int search(FindProperty findProperty) { + GridItem[] items = table.getItems(); + int size = items.length; + boolean next = !findProperty.isBackward(); + int start = findProperty.getIndex(); + setFindProferty(findProperty); + + // forward + if (next) { + for (int i = start; i < size; i++) { + if (checkText(findProperty, items[i])) { + table.getVerticalBar().setSelection( + getScrollSelectionIndex(i)); + table.setSelection(i); + updateTable(); + return i; + } + } + // can't find + for (int i = 0; i < start; i++) { + if (checkText(findProperty, items[i])) { + table.getVerticalBar().setSelection( + getScrollSelectionIndex(i)); + table.setSelection(i); + updateTable(); + return i; + } + } + } else { // back + for (int i = start; i >= 0; i--) { + if (checkText(findProperty, items[i])) { + table.getVerticalBar().setSelection( + getScrollSelectionIndex(i)); + table.setSelection(i); + updateTable(); + return i; + } + } + + for (int i = size - 1; i > start; i--) { + if (checkText(findProperty, items[i])) { + table.getVerticalBar().setSelection( + getScrollSelectionIndex(i)); + table.setSelection(i); + updateTable(); + return i; + } + } + } + table.deselectAll(); + return -1; + } + + private boolean checkText(FindProperty findProperty, GridItem items) { + GridColumn[] columns = table.getColumns(); + int columnSize = columns.length; + String input = findProperty.getLastSearch(); + boolean wholeWord = findProperty.isWholeWord(); + boolean caseSensitive = findProperty.isCaseSensitive(); + + for (int ii = 0; ii < columnSize; ii++) { + String text = items.getText(ii); + + if (!caseSensitive) { + text = text.toUpperCase(); + input = input.toUpperCase(); + } + + if (!wholeWord) { + if (text.contains(input)) { + return true; + } + } else { + if (0 == input.compareTo(text)) { + return true; + } + } + } + return false; + } + + public void setTableName(String name) { + tableName = name; + } + + public String getTableName() { + return tableName; + } + + public static FindProperty getFindProferty() { + if (null == findProferty) { + findProferty = new FindProperty(); + } + return findProferty; + } + + public static void setFindProferty(FindProperty findProferty) { + DATableComposite.findProferty = findProferty; } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATreeComposite.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATreeComposite.java index 3cb4fa3..4e4fe8c 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATreeComposite.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATreeComposite.java @@ -35,6 +35,8 @@ import org.eclipse.nebula.widgets.grid.Grid; import org.eclipse.nebula.widgets.grid.GridColumn; import org.eclipse.nebula.widgets.grid.GridItem; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; @@ -42,15 +44,25 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.tizen.dynamicanalyzer.common.CommonConstants; import org.tizen.dynamicanalyzer.listeners.TableTooltipListener; -import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; +import org.tizen.dynamicanalyzer.model.FindProperty; import org.tizen.dynamicanalyzer.model.LogCenter; import org.tizen.dynamicanalyzer.model.TreeInput; import org.tizen.dynamicanalyzer.resources.ColorResources; import org.tizen.dynamicanalyzer.resources.FontResources; +import org.tizen.dynamicanalyzer.ui.widgets.FindDialog; +import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; public abstract class DATreeComposite extends Composite { + // for find + private String treeName = CommonConstants.EMPTY; + private DATreeComposite me = null; + private static FindProperty findProferty; + private boolean ctrlPressed = false; + protected Grid tree; protected int itemCount = 0; protected List selectionIndex; @@ -58,8 +70,8 @@ public abstract class DATreeComposite extends Composite { protected LogCenter logc; protected TableTooltipListener tableListener; protected boolean treeTable = false; - protected int selValueIndex = LogCenterConstants.SEQUENCE_NUMBER_INDEX; - protected String focusSeq = null; + // protected int selValueIndex = LogCenterConstants.SEQUENCE_NUMBER_INDEX; + // protected String focusSeq = null; protected DefaultTableComparator comparator = null; protected int[] sortTypes = null; @@ -72,6 +84,8 @@ public abstract class DATreeComposite extends Composite { int gridItemCount = -1; int selIndex = 0; + private List selList = null; + protected HashMap expandMap = null; protected HashMap gridMap = null; @@ -99,31 +113,33 @@ public abstract class DATreeComposite extends Composite { tree.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { + getSelList().clear(); GridItem[] ti = ((Grid) e.widget).getSelection(); - GridItem focusedItem = ((Grid) e.widget).getFocusItem(); - if (null != focusedItem) { - DATableDataFormat td = (DATableDataFormat) focusedItem - .getData(); - if (null == td) { - return; - } - focusSeq = td.getSelectionKey(); - } - if (selValueIndex < 0 || null == ti || ti.length == 0) { - return; - } + // GridItem focusedItem = ((Grid) e.widget).getFocusItem(); + // if (null != focusedItem) { + // DATableDataFormat td = (DATableDataFormat) focusedItem + // .getData(); + // if (null == td) { + // return; + // } + // focusSeq = td.getSelectionKey(); + // } + // if (selValueIndex < 0 || null == ti || ti.length == 0) { + // return; + // } int size = ti.length; HashMap sel = getSelections(); sel.clear(); + for (int i = 0; i < size; i++) { DATableDataFormat tableData = (DATableDataFormat) ti[i] .getData(); - if (null == tableData) { - return; - } - String seq = tableData.getSelectionKey(); - if (null != seq && !seq.isEmpty()) { - sel.put(seq, seq); + if (null != tableData) { + String seq = tableData.getSelectionKey(); + if (null != seq && !seq.isEmpty()) { + sel.put(seq, seq); + getSelList().add(seq); + } } } } @@ -135,6 +151,34 @@ public abstract class DATreeComposite extends Composite { } }); + tree.addKeyListener(new KeyListener() { + + @Override + public void keyReleased(KeyEvent e) { + + if (SWT.CTRL == e.keyCode) { + ctrlPressed = false; + } else if (e.keyCode == 102) { // f + if (ctrlPressed) { + ctrlPressed = false; + Shell shell = AnalyzerUtil.getWorkbenchWindow() + .getShell(); + FindDialog dialog = new FindDialog(shell, me); + dialog.open(); + // FIXME: debug + } + } + } + + @Override + public void keyPressed(KeyEvent e) { + if (SWT.CTRL == e.keyCode) { + ctrlPressed = true; + } + } + }); + + me = this; } public void setTree(boolean tree) { @@ -163,6 +207,13 @@ public abstract class DATreeComposite extends Composite { return gridMap; } + private List getSelList() { + if (null == selList) { + selList = new ArrayList(); + } + return selList; + } + public void setTableToolTipListener(TableTooltipListener tableListener) { this.tableListener = tableListener; if (null == tableListener) { @@ -315,6 +366,7 @@ public abstract class DATreeComposite extends Composite { public void updateTree() { selections = tree.getSelection(); selSeqs = new ArrayList(); + // selSeqs.addAll(getSelections().values()); for (int i = 0; i < selections.length; i++) { DATableDataFormat tableData = (DATableDataFormat) selections[i] .getData(); @@ -327,12 +379,33 @@ public abstract class DATreeComposite extends Composite { List input = makeTreeInput(); createTree(input, tree); - for (int i = 0; i < sels.length; i++) { - System.out.println(sels[i]); - } - tree.setSelection(sels); +// tree.setSelection(sels); + tree.select(sels); +// setSelections(); } +// private void setSelections() { +// if (tree.isFocusControl()) { +// GridItem[] items = tree.getItems(); +// List selList = getSelList(); +// int size = items.length; +// int selSize = selList.size(); +// +// for (int i = 0; i < size; i++) { +// DATableDataFormat tableData = (DATableDataFormat) items[i] +// .getData(); +// String key = tableData.getSelectionKey(); +// +// for (int ii = 0; ii < selSize; ii++) { +// if (key.equals(selList.get(ii))) { +// System.out.println("selection " + i + " key " + key); +// tree.setSelection(i); +// } +// } +// } +// } +// } + public abstract List makeTreeInput(); public HashMap getSelections() { @@ -384,14 +457,123 @@ public abstract class DATreeComposite extends Composite { sourceColumns = columns; } - public void setSelValueIndex(int index) { - selValueIndex = index; - } - public void deselectAll() { getSelectionIndex().clear(); getSelections().clear(); tree.deselectAll(); - // updateTable(); + } + + public void setTableName(String name) { + treeName = name; + } + + public String getTableName() { + return treeName; + } + + public static FindProperty getFindProferty() { + if (null == findProferty) { + findProferty = new FindProperty(); + } + return findProferty; + } + + public static void setFindProferty(FindProperty findProferty) { + DATreeComposite.findProferty = findProferty; + } + + public int search(FindProperty findProperty) { + GridItem[] items = tree.getItems(); + int size = items.length; + boolean next = !findProperty.isBackward(); + int start = findProperty.getIndex(); + setFindProferty(findProperty); + + // forward + if (next) { + for (int i = start; i < size; i++) { + if (checkText(findProperty, items[i])) { + tree.getVerticalBar().setSelection( + getScrollSelectionIndex(i)); + System.out.println("select : " + i); +// tree.setSelection(i); + tree.select(i); + System.out.println(tree.getSelectionIndex()); + updateTree(); + return i; + } + } + // can't find + for (int i = 0; i < start; i++) { + if (checkText(findProperty, items[i])) { + tree.getVerticalBar().setSelection( + getScrollSelectionIndex(i)); + System.out.println("select : " + i); +// tree.setSelection(i); + tree.select(i); + System.out.println(tree.getSelectionIndex()); + updateTree(); + return i; + } + } + } else { // back + for (int i = start; i >= 0; i--) { + if (checkText(findProperty, items[i])) { + tree.getVerticalBar().setSelection( + getScrollSelectionIndex(i)); + tree.setSelection(i); + updateTree(); + return i; + } + } + + for (int i = size - 1; i > start; i--) { + if (checkText(findProperty, items[i])) { + tree.getVerticalBar().setSelection( + getScrollSelectionIndex(i)); + tree.setSelection(i); + updateTree(); + return i; + } + } + } + tree.deselectAll(); + return -1; + } + + private int getScrollSelectionIndex(int selection) { + int size = tree.getVerticalBar().getThumb() / 2; + int output = selection - size; + + output = (output < 0) ? 0 : output; + return output; + } + + private boolean checkText(FindProperty findProperty, GridItem items) { + GridColumn[] columns = tree.getColumns(); + int columnSize = columns.length; + String input = findProperty.getLastSearch(); + boolean wholeWord = findProperty.isWholeWord(); + boolean caseSensitive = findProperty.isCaseSensitive(); + + for (int ii = 0; ii < columnSize; ii++) { + String text = items.getText(ii); + + if (!caseSensitive) { + text = text.toUpperCase(); + input = input.toUpperCase(); + } + + if (!wholeWord) { + if (text.contains(input)) { + return true; + } + } else { + if (0 == input.compareTo(text)) { + return true; + } + } + } + return false; } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/TimelineUtils.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/TimelineUtils.java index 1fe62bd..e3481bd 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/TimelineUtils.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/TimelineUtils.java @@ -29,9 +29,7 @@ package org.tizen.dynamicanalyzer.utils; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.services.ISourceProviderService; import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; -import org.tizen.dynamicanalyzer.services.TimelineUpdateSourceProvider; import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; -- 2.7.4