2010-11-22 Francois Chouinard <fchouinard@gmail.com> Final contribution for Bug315307
authorFrancois Chouinard <fchouinard@gmail.com>
Mon, 22 Nov 2010 15:10:20 +0000 (15:10 +0000)
committerFrancois Chouinard <fchouinard@gmail.com>
Mon, 22 Nov 2010 15:10:20 +0000 (15:10 +0000)
22 files changed:
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeViewerProvider.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/DataTransferMessages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/IDEWorkbenchMessages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/ImportTraceWizard.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/ImportTraceWizardPage.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/Messages.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewExperimentDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectWizard.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceErrorDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/messages.properties
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/KernelStatisticsData.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsData.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/TimeFrameView.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/messages.properties [new file with mode: 0644]

diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/Messages.java
new file mode 100644 (file)
index 0000000..2269cd5
--- /dev/null
@@ -0,0 +1,20 @@
+package org.eclipse.linuxtools.lttng.ui.model.trange;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.model.trange.messages"; //$NON-NLS-1$
+    public static String TimeRangeViewerProvider_BadRangeExtraInfo;
+    public static String TimeRangeViewerProvider_EndTime;
+    public static String TimeRangeViewerProvider_ProcessType;
+    public static String TimeRangeViewerProvider_StartTime;
+    public static String TimeRangeViewerProvider_UndefinedEndTime;
+    public static String TimeRangeViewerProvider_UndefinedStartTime;
+    static {
+       // initialize resource bundle
+       NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
index 6e80469b2b21b431fdffef9658ae1175f8e9770c..997eb99d17b3c0f36b8cf8e6a5c133685ee806f7 100644 (file)
@@ -27,221 +27,204 @@ import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent;
 import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;\r
 \r
 public class TimeRangeViewerProvider extends TmfTimeAnalysisProvider {\r
-       // ========================================================================\r
-       // Data\r
-       // =======================================================================\r
-       Map<String, StateColor> procStateToColor = new HashMap<String, StateColor>(\r
-                       16);\r
-       Map<String, StateColor> bdevStateToColor = new HashMap<String, StateColor>(\r
-                       4);\r
-       Map<String, StateColor> softIrqStateToColor = new HashMap<String, StateColor>(\r
-                       4);\r
-       Map<String, StateColor> trapStateToColor = new HashMap<String, StateColor>(\r
-                       4);\r
-       Map<String, StateColor> irqStateToColor = new HashMap<String, StateColor>(4);\r
-       Map<String, StateColor> cpuStateToColor = new HashMap<String, StateColor>(8);\r
-\r
-       private final ParamsUpdater fviewParameters;\r
-\r
-       // ========================================================================\r
-       // Constructors\r
-       // =======================================================================\r
-       public TimeRangeViewerProvider(ParamsUpdater paramsUpdater) {\r
-               // Fill the statemode to color maps\r
-               fillProcessStateToColor();\r
-               fillBdevStateToColor();\r
-               fillSoftIRQStateToColor();\r
-               fillTrapStateToColor();\r
-               fillIrqStateToColor();\r
-               fillCpuStateToColor();\r
-               fviewParameters = paramsUpdater;\r
-       }\r
-\r
-       // ========================================================================\r
-       // Methods\r
-       // =======================================================================\r
-       @Override\r
-       public StateColor getEventColor(ITimeEvent event) {\r
-               StateColor retColor = null;\r
-               \r
-               if (event instanceof TimeRangeEvent) {\r
-                       TimeRangeEvent devent = (TimeRangeEvent) event;\r
-                       String stateMode = devent.getStateMode();\r
-                       switch (devent.getEventType()) {\r
-                       case PROCESS_MODE:\r
-                               retColor = procStateToColor.get(stateMode);\r
-                               break;\r
-                       case BDEV_MODE:\r
-                               retColor = bdevStateToColor.get(stateMode);\r
-                               break;\r
-                       case IRQ_MODE:\r
-                               retColor = irqStateToColor.get(stateMode);\r
-                               break;\r
-                       case SOFT_IRQ_MODE:\r
-                               retColor = softIrqStateToColor.get(stateMode);\r
-                               break;\r
-                       case CPU_MODE:\r
-                               retColor = cpuStateToColor.get(stateMode);\r
-                               break;\r
-                       case TRAP_MODE:\r
-                               retColor = trapStateToColor.get(stateMode);\r
-                               break;\r
-                       }\r
-               }\r
-               \r
-               if (retColor == null) {\r
-                       return StateColor.MAGENTA3;\r
-               }\r
-               return retColor;\r
-       }\r
 \r
-       /* (non-Javadoc)\r
-        * @see org.eclipse.linuxtools.tmf.ui.widgets.timeAnalysis.api.TsfTmAbstractImplProvider#getStateName(org.eclipse.linuxtools.tmf.ui.widgets.timeAnalysis.api.TsfTmAbstractImplProvider.StateColor)\r
-        */\r
-       @Override\r
-       public String getStateName(StateColor color) {\r
-               //Override to multiple instances of the widget, the same color can have multiple meanings\r
-               return "Not mapped"; //$NON-NLS-1$\r
+    // ------------------------------------------------------------------------\r
+    // Data\r
+    // ------------------------------------------------------------------------\r
+\r
+    Map<String, StateColor> procStateToColor = new HashMap<String, StateColor>(16);\r
+    Map<String, StateColor> bdevStateToColor = new HashMap<String, StateColor>(4);\r
+    Map<String, StateColor> softIrqStateToColor = new HashMap<String, StateColor>(4);\r
+    Map<String, StateColor> trapStateToColor = new HashMap<String, StateColor>(4);\r
+    Map<String, StateColor> irqStateToColor = new HashMap<String, StateColor>(4);\r
+    Map<String, StateColor> cpuStateToColor = new HashMap<String, StateColor>(8);\r
+\r
+    private final ParamsUpdater fviewParameters;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+\r
+    public TimeRangeViewerProvider(ParamsUpdater paramsUpdater) {\r
+       // Fill the state mode to color maps\r
+       fillProcessStateToColor();\r
+       fillBdevStateToColor();\r
+       fillSoftIRQStateToColor();\r
+       fillTrapStateToColor();\r
+       fillIrqStateToColor();\r
+       fillCpuStateToColor();\r
+       fviewParameters = paramsUpdater;\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Methods\r
+    // ------------------------------------------------------------------------\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getEventColor(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent)\r
+     */\r
+    @Override\r
+    public StateColor getEventColor(ITimeEvent event) {\r
+       StateColor retColor = null;\r
+\r
+       if (event instanceof TimeRangeEvent) {\r
+           TimeRangeEvent devent = (TimeRangeEvent) event;\r
+           String stateMode = devent.getStateMode();\r
+           switch (devent.getEventType()) {\r
+           case PROCESS_MODE:\r
+               retColor = procStateToColor.get(stateMode);\r
+               break;\r
+           case BDEV_MODE:\r
+               retColor = bdevStateToColor.get(stateMode);\r
+               break;\r
+           case IRQ_MODE:\r
+               retColor = irqStateToColor.get(stateMode);\r
+               break;\r
+           case SOFT_IRQ_MODE:\r
+               retColor = softIrqStateToColor.get(stateMode);\r
+               break;\r
+           case CPU_MODE:\r
+               retColor = cpuStateToColor.get(stateMode);\r
+               break;\r
+           case TRAP_MODE:\r
+               retColor = trapStateToColor.get(stateMode);\r
+               break;\r
+           }\r
        }\r
 \r
-       @Override\r
-       public Map<String, String> getEventHoverToolTipInfo(ITimeEvent revent) {\r
-               Map<String, String> toolTipEventMsgs = new HashMap<String, String>();\r
-               //if the selected resource is a Process, add the Process type to the tool tip\r
-               if (revent instanceof TimeRangeComponent) {\r
-                       ITimeRangeComponent parent = ((TimeRangeComponent) revent)\r
-                                       .getEventParent();\r
-\r
-                       // if the event start time is unknown, indicate it to the user\r
-                       String extraInfo = "\ni.e. outside of data time window";\r
-                       long eventStart = revent.getTime();\r
-                       if (eventStart < fviewParameters.getStartTime()) {\r
-                               toolTipEventMsgs.put("Start Time:", "Actual Event Start Time is undefined" + extraInfo);\r
-                               // avoid repeated details\r
-                               extraInfo = ""; //$NON-NLS-1$\r
-                       }\r
-\r
-                       long eventEnd = revent.getTime() + revent.getDuration();\r
-                       if (eventEnd > fviewParameters.getEndTime()) {\r
-                               toolTipEventMsgs.put("Stop Time:", "Actual Event Stop Time is undefined" + extraInfo);\r
-                       }\r
-\r
-                       if (parent != null && parent instanceof TimeRangeEventProcess) {\r
-                               TimeRangeEventProcess localProcess = (TimeRangeEventProcess) parent;\r
-                               toolTipEventMsgs.put("Process Type", localProcess.getProcessType());\r
-                       }\r
-               }\r
-\r
-               return toolTipEventMsgs;\r
+       if (retColor == null) {\r
+           return StateColor.MAGENTA3;\r
        }\r
-\r
-       @Override\r
-       public String getEventName(ITimeEvent event, boolean upper, boolean extInfo) {\r
-               String name = null;\r
-               //The relevant event name for the time range is the actual state mode\r
-               if (event instanceof TimeRangeEvent) {\r
-                       TimeRangeEvent devent = (TimeRangeEvent) event;\r
-                       StringBuilder sb = new StringBuilder(devent.getStateMode());\r
-                       name = sb.toString();\r
-               }\r
-               \r
-               if (name == null) {\r
-                       return "Unknown"; //$NON-NLS-1$\r
-               }\r
-               return name;\r
+       return retColor;\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getStateName(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider.StateColor)\r
+     */\r
+    @Override\r
+    public String getStateName(StateColor color) {\r
+       // Override to multiple instances of the widget, the same color can have\r
+       // multiple meanings\r
+       return "Not mapped"; //$NON-NLS-1$\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getEventHoverToolTipInfo(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent)\r
+     */\r
+    @Override\r
+    public Map<String, String> getEventHoverToolTipInfo(ITimeEvent revent) {\r
+       Map<String, String> toolTipEventMsgs = new HashMap<String, String>();\r
+       // if the selected resource is a Process, add the Process type to the\r
+       // tool tip\r
+       if (revent instanceof TimeRangeComponent) {\r
+           ITimeRangeComponent parent = ((TimeRangeComponent) revent).getEventParent();\r
+\r
+           // if the event start time is unknown, indicate it to the user\r
+           String extraInfo = "\n" + Messages.TimeRangeViewerProvider_BadRangeExtraInfo; //$NON-NLS-1$\r
+           long eventStart = revent.getTime();\r
+           if (eventStart < fviewParameters.getStartTime()) {\r
+               toolTipEventMsgs.put(Messages.TimeRangeViewerProvider_StartTime, Messages.TimeRangeViewerProvider_UndefinedStartTime + extraInfo);\r
+               // avoid repeated details\r
+               extraInfo = ""; //$NON-NLS-1$\r
+           }\r
+\r
+           long eventEnd = revent.getTime() + revent.getDuration();\r
+           if (eventEnd > fviewParameters.getEndTime()) {\r
+               toolTipEventMsgs.put(Messages.TimeRangeViewerProvider_EndTime, Messages.TimeRangeViewerProvider_UndefinedEndTime + extraInfo);\r
+           }\r
+\r
+           if (parent != null && parent instanceof TimeRangeEventProcess) {\r
+               TimeRangeEventProcess localProcess = (TimeRangeEventProcess) parent;\r
+               toolTipEventMsgs.put(Messages.TimeRangeViewerProvider_ProcessType, localProcess.getProcessType());\r
+           }\r
        }\r
 \r
-       @Override\r
-       public String getTraceClassName(ITmfTimeAnalysisEntry trace) {\r
-               String name = ""; //$NON-NLS-1$\r
-               if (trace instanceof TimeRangeComposite) {\r
-                       TimeRangeComposite dTrace = (TimeRangeComposite) trace;\r
-                       name = dTrace.getClassName();\r
-               }\r
-               return name;\r
+       return toolTipEventMsgs;\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getEventName(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent, boolean, boolean)\r
+     */\r
+    @Override\r
+    public String getEventName(ITimeEvent event, boolean upper, boolean extInfo) {\r
+       String name = null;\r
+       // The relevant event name for the time range is the actual state mode\r
+       if (event instanceof TimeRangeEvent) {\r
+           TimeRangeEvent devent = (TimeRangeEvent) event;\r
+           StringBuilder sb = new StringBuilder(devent.getStateMode());\r
+           name = sb.toString();\r
        }\r
 \r
-       private void fillCpuStateToColor() {\r
-               cpuStateToColor.put(CpuMode.LTTV_CPU_UNKNOWN.getInName(),\r
-                               StateColor.BLACK);\r
-               cpuStateToColor.put(CpuMode.LTTV_CPU_IDLE.getInName(), StateColor.GRAY);\r
-               cpuStateToColor.put(CpuMode.LTTV_CPU_BUSY.getInName(),\r
-                               StateColor.LIGHT_BLUE);\r
-               cpuStateToColor\r
-                               .put(CpuMode.LTTV_CPU_IRQ.getInName(), StateColor.ORANGE);\r
-               cpuStateToColor.put(CpuMode.LTTV_CPU_SOFT_IRQ.getInName(),\r
-                               StateColor.PURPLE1);\r
-               cpuStateToColor.put(CpuMode.LTTV_CPU_TRAP.getInName(), StateColor.GOLD);\r
+       if (name == null) {\r
+           return "Unknown"; //$NON-NLS-1$\r
        }\r
-\r
-       private void fillIrqStateToColor() {\r
-               irqStateToColor.put(IRQMode.LTTV_IRQ_UNKNOWN.getInName(),\r
-                               StateColor.BLACK);\r
-               irqStateToColor.put(IRQMode.LTTV_IRQ_IDLE.getInName(), StateColor.GRAY);\r
-               irqStateToColor.put(IRQMode.LTTV_IRQ_BUSY.getInName(),\r
-                               StateColor.ORANGE);\r
-       }\r
-\r
-       private void fillTrapStateToColor() {\r
-               trapStateToColor.put(TrapMode.LTTV_TRAP_UNKNOWN.getInName(),\r
-                               StateColor.BLACK);\r
-               trapStateToColor.put(TrapMode.LTTV_TRAP_IDLE.getInName(),\r
-                               StateColor.BLACK);\r
-               trapStateToColor.put(TrapMode.LTTV_TRAP_BUSY.getInName(),\r
-                               StateColor.GOLD);\r
-       }\r
-\r
-       private void fillSoftIRQStateToColor() {\r
-               softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_UNKNOWN.getInName(),\r
-                               StateColor.BLACK);\r
-               softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_IDLE.getInName(),\r
-                               StateColor.BLACK);\r
-               softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_PENDING.getInName(),\r
-                               StateColor.PINK1);\r
-               softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_BUSY.getInName(),\r
-                               StateColor.PURPLE1);\r
-       }\r
-\r
-       private void fillBdevStateToColor() {\r
-               softIrqStateToColor.put(BdevMode.LTTV_BDEV_UNKNOWN.getInName(),\r
-                               StateColor.BLACK);\r
-               softIrqStateToColor.put(BdevMode.LTTV_BDEV_IDLE.getInName(),\r
-                               StateColor.BLACK);\r
-               softIrqStateToColor.put(BdevMode.LTTV_BDEV_BUSY_READING.getInName(),\r
-                               StateColor.DARK_BLUE);\r
-               softIrqStateToColor.put(BdevMode.LTTV_BDEV_BUSY_WRITING.getInName(),\r
-                               StateColor.RED);\r
-       }\r
-\r
-       private void fillProcessStateToColor() {\r
-               // Process Status\r
-               procStateToColor.put(ProcessStatus.LTTV_STATE_UNNAMED.getInName(),\r
-                               StateColor.GRAY);\r
-               procStateToColor.put(ProcessStatus.LTTV_STATE_DEAD.getInName(),\r
-                               StateColor.BLACK);\r
-               procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT_FORK.getInName(),\r
-                               StateColor.DARK_GREEN);\r
-               procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT_CPU.getInName(),\r
-                               StateColor.DARK_YELLOW);\r
-               procStateToColor.put(ProcessStatus.LTTV_STATE_EXIT.getInName(),\r
-                               StateColor.MAGENTA3);\r
-               procStateToColor.put(ProcessStatus.LTTV_STATE_ZOMBIE.getInName(),\r
-                               StateColor.PURPLE1);\r
-               procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT.getInName(),\r
-                               StateColor.RED);\r
-\r
-               // Execution Mode\r
-               procStateToColor.put(ExecutionMode.LTTV_STATE_MODE_UNKNOWN.getInName(),\r
-                               StateColor.BLACK);\r
-               procStateToColor.put(ExecutionMode.LTTV_STATE_USER_MODE.getInName(),\r
-                               StateColor.GREEN);\r
-               procStateToColor.put(ExecutionMode.LTTV_STATE_SYSCALL.getInName(),\r
-                               StateColor.DARK_BLUE);\r
-               procStateToColor.put(ExecutionMode.LTTV_STATE_TRAP.getInName(),\r
-                               StateColor.GOLD);\r
-               procStateToColor.put(ExecutionMode.LTTV_STATE_IRQ.getInName(),\r
-                               StateColor.ORANGE);\r
-               procStateToColor.put(ExecutionMode.LTTV_STATE_SOFT_IRQ.getInName(),\r
-                               StateColor.PINK1);\r
+       return name;\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getTraceClassName(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry)\r
+     */\r
+    @Override\r
+    public String getTraceClassName(ITmfTimeAnalysisEntry trace) {\r
+       String name = ""; //$NON-NLS-1$\r
+       if (trace instanceof TimeRangeComposite) {\r
+           TimeRangeComposite dTrace = (TimeRangeComposite) trace;\r
+           name = dTrace.getClassName();\r
        }\r
+       return name;\r
+    }\r
+\r
+    private void fillCpuStateToColor() {\r
+       cpuStateToColor.put(CpuMode.LTTV_CPU_UNKNOWN.getInName(), StateColor.BLACK);\r
+       cpuStateToColor.put(CpuMode.LTTV_CPU_IDLE.getInName(), StateColor.GRAY);\r
+       cpuStateToColor.put(CpuMode.LTTV_CPU_BUSY.getInName(), StateColor.LIGHT_BLUE);\r
+       cpuStateToColor.put(CpuMode.LTTV_CPU_IRQ.getInName(), StateColor.ORANGE);\r
+       cpuStateToColor.put(CpuMode.LTTV_CPU_SOFT_IRQ.getInName(), StateColor.PURPLE1);\r
+       cpuStateToColor.put(CpuMode.LTTV_CPU_TRAP.getInName(), StateColor.GOLD);\r
+    }\r
+\r
+    private void fillIrqStateToColor() {\r
+       irqStateToColor.put(IRQMode.LTTV_IRQ_UNKNOWN.getInName(), StateColor.BLACK);\r
+       irqStateToColor.put(IRQMode.LTTV_IRQ_IDLE.getInName(), StateColor.GRAY);\r
+       irqStateToColor.put(IRQMode.LTTV_IRQ_BUSY.getInName(), StateColor.ORANGE);\r
+    }\r
+\r
+    private void fillTrapStateToColor() {\r
+       trapStateToColor.put(TrapMode.LTTV_TRAP_UNKNOWN.getInName(), StateColor.BLACK);\r
+       trapStateToColor.put(TrapMode.LTTV_TRAP_IDLE.getInName(), StateColor.BLACK);\r
+       trapStateToColor.put(TrapMode.LTTV_TRAP_BUSY.getInName(), StateColor.GOLD);\r
+    }\r
+\r
+    private void fillSoftIRQStateToColor() {\r
+       softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_UNKNOWN.getInName(), StateColor.BLACK);\r
+       softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_IDLE.getInName(), StateColor.BLACK);\r
+       softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_PENDING.getInName(), StateColor.PINK1);\r
+       softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_BUSY.getInName(), StateColor.PURPLE1);\r
+    }\r
+\r
+    private void fillBdevStateToColor() {\r
+       softIrqStateToColor.put(BdevMode.LTTV_BDEV_UNKNOWN.getInName(), StateColor.BLACK);\r
+       softIrqStateToColor.put(BdevMode.LTTV_BDEV_IDLE.getInName(), StateColor.BLACK);\r
+       softIrqStateToColor.put(BdevMode.LTTV_BDEV_BUSY_READING.getInName(), StateColor.DARK_BLUE);\r
+       softIrqStateToColor.put(BdevMode.LTTV_BDEV_BUSY_WRITING.getInName(), StateColor.RED);\r
+    }\r
+\r
+    private void fillProcessStateToColor() {\r
+       // Process Status\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_UNNAMED.getInName(), StateColor.GRAY);\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_DEAD.getInName(), StateColor.BLACK);\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT_FORK.getInName(), StateColor.DARK_GREEN);\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT_CPU.getInName(), StateColor.DARK_YELLOW);\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_EXIT.getInName(), StateColor.MAGENTA3);\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_ZOMBIE.getInName(), StateColor.PURPLE1);\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT.getInName(), StateColor.RED);\r
+\r
+       // Execution Mode\r
+       procStateToColor.put(ExecutionMode.LTTV_STATE_MODE_UNKNOWN.getInName(), StateColor.BLACK);\r
+       procStateToColor.put(ExecutionMode.LTTV_STATE_USER_MODE.getInName(), StateColor.GREEN);\r
+       procStateToColor.put(ExecutionMode.LTTV_STATE_SYSCALL.getInName(), StateColor.DARK_BLUE);\r
+       procStateToColor.put(ExecutionMode.LTTV_STATE_TRAP.getInName(), StateColor.GOLD);\r
+       procStateToColor.put(ExecutionMode.LTTV_STATE_IRQ.getInName(), StateColor.ORANGE);\r
+       procStateToColor.put(ExecutionMode.LTTV_STATE_SOFT_IRQ.getInName(), StateColor.PINK1);\r
+    }\r
 }\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/messages.properties
new file mode 100644 (file)
index 0000000..86fb8ff
--- /dev/null
@@ -0,0 +1,6 @@
+TimeRangeViewerProvider_BadRangeExtraInfo=(i.e. outside of data time window)
+TimeRangeViewerProvider_EndTime=Stop Time
+TimeRangeViewerProvider_ProcessType=Process Type
+TimeRangeViewerProvider_StartTime=Start Time
+TimeRangeViewerProvider_UndefinedEndTime=Actual Event Stop Time is undefined
+TimeRangeViewerProvider_UndefinedStartTime=Actual Event Start Time is undefined
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/DataTransferMessages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/DataTransferMessages.java
new file mode 100644 (file)
index 0000000..e09ef87
--- /dev/null
@@ -0,0 +1,18 @@
+package org.eclipse.linuxtools.lttng.ui.views.project.dialogs;
+
+import org.eclipse.osgi.util.NLS;
+
+public class DataTransferMessages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.views.project.dialogs.messages"; //$NON-NLS-1$
+    public static String ImportTraceWizard_LocationError;
+    public static String ImportTraceWizard_LocationErrorMsg1;
+    public static String ImportTraceWizard_LocationErrorMsg2;
+    public static String ImportTraceWizard_LocationErrorMsg3;
+    static {
+       // initialize resource bundle
+       NLS.initializeMessages(BUNDLE_NAME, DataTransferMessages.class);
+    }
+
+    private DataTransferMessages() {
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/IDEWorkbenchMessages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/IDEWorkbenchMessages.java
new file mode 100644 (file)
index 0000000..de49374
--- /dev/null
@@ -0,0 +1,16 @@
+package org.eclipse.linuxtools.lttng.ui.views.project.dialogs;
+
+import org.eclipse.osgi.util.NLS;
+
+public class IDEWorkbenchMessages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.views.project.dialogs.messages"; //$NON-NLS-1$
+    public static String NewExperimentDialog_DialogTitle;
+    public static String NewExperimentDialog_ExperimentLabel;
+    static {
+       // initialize resource bundle
+       NLS.initializeMessages(BUNDLE_NAME, IDEWorkbenchMessages.class);
+    }
+
+    private IDEWorkbenchMessages() {
+    }
+}
index 9afae8ab8cd0db801555013cb0e588f4cea8af23..2ea9f1fb7acce36538ce0dfc04331342c4f8d8c0 100644 (file)
@@ -23,12 +23,11 @@ import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.ide.IDE;
 import org.eclipse.ui.internal.WorkbenchPlugin;
 import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
-import org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages;
 
 /**
  * <b><u>ImportTraceWizard</u></b>
  * <p>
- *
+ * 
  * TODO: Implement me. Please.
  */
 @SuppressWarnings("restriction")
@@ -38,82 +37,84 @@ public class ImportTraceWizard extends Wizard implements IImportWizard {
     private IStructuredSelection fSelection;
     private ImportTraceWizardPage fMainPage;
 
-       /**
+    /**
      * 
      */
     private final String IMPORT_WIZARD = "LTTngTraceImportWizard"; //$NON-NLS-1$
+
     public ImportTraceWizard() {
-        IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
-        IDialogSettings section = workbenchSettings.getSection(IMPORT_WIZARD);
-        if (section == null) {
-                       section = workbenchSettings.addNewSection(IMPORT_WIZARD);
-               }
-        
-        setDialogSettings(section);
+       IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
+       IDialogSettings section = workbenchSettings.getSection(IMPORT_WIZARD);
+       if (section == null) {
+           section = workbenchSettings.addNewSection(IMPORT_WIZARD);
+       }
+
+       setDialogSettings(section);
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.eclipse.jface.wizard.Wizard#addPages()
      */
     @Override
-       public void addPages() {
-        super.addPages();
-        fMainPage = new ImportTraceWizardPage(fWorkbench, fSelection);
-        addPage(fMainPage);
+    public void addPages() {
+       super.addPages();
+       fMainPage = new ImportTraceWizardPage(fWorkbench, fSelection);
+       addPage(fMainPage);
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
+     * org.eclipse.jface.viewers.IStructuredSelection)
      */
-       @Override
-       @SuppressWarnings("rawtypes")
-       public void init(IWorkbench workbench, IStructuredSelection selection) {
-        fWorkbench = workbench;
-        fSelection = selection;
-
-        List selectedResources = IDE.computeSelectedResources(selection);
-        if (!selectedResources.isEmpty()) {
-            fSelection = new StructuredSelection(selectedResources);
-        }
-        
-        setWindowTitle(DataTransferMessages.DataTransfer_importTitle);
-        setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/importdir_wiz.png")); //$NON-NLS-1$
-        setNeedsProgressMonitor(true);
+    @Override
+    @SuppressWarnings("rawtypes")
+    public void init(IWorkbench workbench, IStructuredSelection selection) {
+       fWorkbench = workbench;
+       fSelection = selection;
+
+       List selectedResources = IDE.computeSelectedResources(selection);
+       if (!selectedResources.isEmpty()) {
+           fSelection = new StructuredSelection(selectedResources);
+       }
+
+       setWindowTitle(""); //$NON-NLS-1$
+       setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/importdir_wiz.png")); //$NON-NLS-1$
+       setNeedsProgressMonitor(true);
     }
-       
+
     public ImportTraceWizardPage getMainPage() {
-               return fMainPage;
-       }
-       
-       /**
-        * performFinish is called after the "finish" button is pressed in the import wizard
-        * If we return "false", the wizard will not close. 
-        
-        * We perform here version check on the imported LTTng trace
-        
-        */
+       return fMainPage;
+    }
+
+    /**
+     * performFinish is called after the "finish" button is pressed in the
+     * import wizard If we return "false", the wizard will not close.
+     * 
+     * We perform here version check on the imported LTTng trace
+     * 
+     */
     @Override
-       public boolean performFinish() {
-       
-       if ( fMainPage.getDestination().equals( fMainPage.getInitialContainerString() ) ) {
-               
-               String errMessage[] = { "Error : import destination is wrong." }; 
-                       errMessage = fMainPage.extendErrorMessage(errMessage, "");
-                       errMessage = fMainPage.extendErrorMessage(errMessage, "You cannot import your trace directly into the \"" + fMainPage.getInitialContainerString() + "\"");
-                       errMessage = fMainPage.extendErrorMessage(errMessage, "The trace has to be into a subdirectly, like \"" + fMainPage.getInitialContainerString() + "/MyTrace\"" );
-                       errMessage = fMainPage.extendErrorMessage(errMessage, "");
-                       errMessage = fMainPage.extendErrorMessage(errMessage, "Please change the destination folder.");
-                       fMainPage.showVersionErrorPopup(errMessage);
-               
-                       return false;
-       }
-       
-       return fMainPage.finish();
+    public boolean performFinish() {
+       if (fMainPage.getDestination().equals(fMainPage.getInitialContainerString())) {
+           String errMessage[] = { org.eclipse.linuxtools.lttng.ui.views.project.dialogs.DataTransferMessages.ImportTraceWizard_LocationError };
+           errMessage = fMainPage.extendErrorMessage(errMessage, ""); //$NON-NLS-1$
+           errMessage = fMainPage.extendErrorMessage(errMessage, org.eclipse.linuxtools.lttng.ui.views.project.dialogs.DataTransferMessages.ImportTraceWizard_LocationErrorMsg1 + fMainPage.getInitialContainerString() + "\""); //$NON-NLS-1$
+           errMessage = fMainPage.extendErrorMessage(errMessage, org.eclipse.linuxtools.lttng.ui.views.project.dialogs.DataTransferMessages.ImportTraceWizard_LocationErrorMsg2 + fMainPage.getInitialContainerString() + "/MyTrace\""); //$NON-NLS-1$
+           errMessage = fMainPage.extendErrorMessage(errMessage, ""); //$NON-NLS-1$
+           errMessage = fMainPage.extendErrorMessage(errMessage, org.eclipse.linuxtools.lttng.ui.views.project.dialogs.DataTransferMessages.ImportTraceWizard_LocationErrorMsg3);
+           fMainPage.showVersionErrorPopup(errMessage);
+           return false;
+       }
+       return fMainPage.finish();
     }
-    
+
     @Override
-       public boolean canFinish() {
-       return fMainPage.isSelectedElementsValidLttngTraces();
+    public boolean canFinish() {
+       return fMainPage.isSelectedElementsValidLttngTraces();
     }
 
 }
index 839355fc11cde4aa8b1f0cf95fc3b0c57d3970e6..36670ef2c75971dcfd8806d99199aadd9c34653e 100644 (file)
@@ -27,316 +27,331 @@ import org.eclipse.ui.internal.wizards.datatransfer.WizardFileSystemResourceImpo
  */
 @SuppressWarnings("restriction")
 public class ImportTraceWizardPage extends WizardFileSystemResourceImportPage1 {
-       
-       private boolean isContainerSet = false;
-       private String  initialContainerString = ""; //$NON-NLS-1$
-       private String  selectedSourceDirectory = ""; //$NON-NLS-1$
-       
-       public ImportTraceWizardPage(IWorkbench workbench, IStructuredSelection selection) {
-               super(workbench, selection);
-               
-               LTTngProjectNode folder = (LTTngProjectNode) selection.getFirstElement();
-               String path = folder.getTracesFolder().getFolder().getFullPath().toOSString();
-               
-               initialContainerString = path;
-               setContainerFieldValue(path);
-       }
-       
-       
-       public String getTraceDirectory() {
-               String tmpPath = ""; //$NON-NLS-1$
-               if ( (getSourceDirectory() != null) && (getSourceDirectory().getName() != null) ) {
-                       tmpPath = this.getSourceDirectory().getName().toString();
-               }
-               
-               return tmpPath;
-       }
-       
-       public String getInitialContainerString() {
-               return initialContainerString;
+
+    private boolean isContainerSet = false;
+    private String initialContainerString = ""; //$NON-NLS-1$
+    private String selectedSourceDirectory = ""; //$NON-NLS-1$
+
+    public ImportTraceWizardPage(IWorkbench workbench, IStructuredSelection selection) {
+       super(workbench, selection);
+
+       LTTngProjectNode folder = (LTTngProjectNode) selection.getFirstElement();
+       String path = folder.getTracesFolder().getFolder().getFullPath().toOSString();
+
+       initialContainerString = path;
+       setContainerFieldValue(path);
+    }
+
+    public String getTraceDirectory() {
+       String tmpPath = ""; //$NON-NLS-1$
+       if ((getSourceDirectory() != null) && (getSourceDirectory().getName() != null)) {
+           tmpPath = this.getSourceDirectory().getName().toString();
        }
-       
-       public String getTracepath() {
-               String tmpPath = ""; //$NON-NLS-1$
-               if ( (getSourceDirectory() != null) && (getSourceDirectory().getPath() != null) ) {
-                       tmpPath = this.getSourceDirectory().getPath().toString();
-               }
-               
-               return tmpPath;
+
+       return tmpPath;
+    }
+
+    public String getInitialContainerString() {
+       return initialContainerString;
+    }
+
+    public String getTracepath() {
+       String tmpPath = ""; //$NON-NLS-1$
+       if ((getSourceDirectory() != null) && (getSourceDirectory().getPath() != null)) {
+           tmpPath = this.getSourceDirectory().getPath().toString();
        }
-       
-       public String getDestination() {
-               String returnPath = null;
-               
-               if ( getContainerFullPath() != null ) {
-                       returnPath = getContainerFullPath().toString();
-               }
-               return returnPath;
+
+       return tmpPath;
+    }
+
+    public String getDestination() {
+       String returnPath = null;
+
+       if (getContainerFullPath() != null) {
+           returnPath = getContainerFullPath().toString();
        }
-       
-       public boolean isSelectedElementsValidLttngTraces() {
-               boolean returnedValue = true;
-               
-               // We don't want to test until something is selected
-               if ( selectionGroup.getCheckedElementCount() > 0 ) {
-                       
-                       // We don't want to revalidate each time, only want a new directory is selected
-                       if ( ! selectedSourceDirectory.equals(getSourceDirectory().getAbsolutePath().toString()) )
-                       {
-                               try {
-                                       if ( isPathLttngTrace( getSourceDirectory().getAbsolutePath() ) == false ) {
-                                               returnedValue = false;
-                                               selectedSourceDirectory = ""; //$NON-NLS-1$
-                                               
-                                               String errMessage[] = { "Couldn't get LTTng version number for the path : " }; 
-                                               errMessage = extendErrorMessage(errMessage, getSourceDirectory().getAbsolutePath() );
-                                               errMessage = extendErrorMessage(errMessage, "");
-                                       errMessage = extendErrorMessage(errMessage, "Verify that the directory is a valid LTTng trace directory.");
-                                       errMessage = extendErrorMessage(errMessage, "Make sure the top directory is the trace itself and not any of its parent.");
-                                       showVersionErrorPopup(errMessage);
-                                       selectionGroup.setAllSelections(false);
-                                       }
-                                       else {
-                                               selectedSourceDirectory = getSourceDirectory().getAbsolutePath();
-                                               
-                                               if ( isContainerSet == false ) {
-                                                       isContainerSet = true;
-                                                       
-                                                       if ( ! getDestination().toString().equals( getInitialContainerString() + "/" + getTraceDirectory() )  ) { //$NON-NLS-1$
-                                                               // *** HACK ***
-                                                       // Force a sane destination to avoid imported files to end up in the root of the "Traces/" directory
-                                                       setContainerFieldValue(getInitialContainerString() + "/" + getTraceDirectory()); //$NON-NLS-1$
-                                                       }
-                                               }
-                                       }
-                       }
-                       catch (LttngException e) {
-                               String[] errorMessages = e.toString().split("\n"); //$NON-NLS-1$
-                               String exceptionMessage[] = { "Version check failed for the path : ", this.getTracepath(), "", "Returned error was :" };   //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
-                               
-                               for ( int pos=0; pos<errorMessages.length; pos++) {
-                                       exceptionMessage = extendErrorMessage(exceptionMessage, errorMessages[pos]);
-                               }
-                               
-                               showVersionErrorPopup(exceptionMessage);
-                               selectionGroup.setAllSelections(false);
-                               returnedValue = false;
-                       }
+       return returnPath;
+    }
+
+    public boolean isSelectedElementsValidLttngTraces() {
+       boolean returnedValue = true;
+
+       // We don't want to test until something is selected
+       if (selectionGroup.getCheckedElementCount() > 0) {
+
+           // We don't want to revalidate each time, only want a new directory
+           // is selected
+           if (!selectedSourceDirectory.equals(getSourceDirectory().getAbsolutePath().toString())) {
+               try {
+                   if (isPathLttngTrace(getSourceDirectory().getAbsolutePath()) == false) {
+                       returnedValue = false;
+                       selectedSourceDirectory = ""; //$NON-NLS-1$
+
+                       String errMessage[] = { Messages.ImportTraceWizardPage_BadTraceVersion + getSourceDirectory().getAbsolutePath() };
+                       errMessage = extendErrorMessage(errMessage, ""); //$NON-NLS-1$
+                       errMessage = extendErrorMessage(errMessage, Messages.ImportTraceWizardPage_BadTraceVersionMsg1);
+                       errMessage = extendErrorMessage(errMessage, Messages.ImportTraceWizardPage_BadTraceVersionMsg2);
+                       showVersionErrorPopup(errMessage);
+                       selectionGroup.setAllSelections(false);
+                   } else {
+                       selectedSourceDirectory = getSourceDirectory().getAbsolutePath();
+
+                       if (isContainerSet == false) {
+                           isContainerSet = true;
+
+                           if (!getDestination().toString().equals(getInitialContainerString() + "/" + getTraceDirectory())) { //$NON-NLS-1$
+                               // *** HACK ***
+                               // Force a sane destination to avoid imported
+                               // files to end up in the root of the "Traces/"
+                               // directory
+                               setContainerFieldValue(getInitialContainerString() + "/" + getTraceDirectory()); //$NON-NLS-1$
+                           }
                        }
+                   }
+               } catch (LttngException e) {
+                   String[] errorMessages = e.toString().split("\n"); //$NON-NLS-1$
+                   String exceptionMessage[] = { "Version check failed for the path : ", this.getTracepath(), "", "Returned error was :" }; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+
+                   for (int pos = 0; pos < errorMessages.length; pos++) {
+                       exceptionMessage = extendErrorMessage(exceptionMessage, errorMessages[pos]);
+                   }
+
+                   showVersionErrorPopup(exceptionMessage);
+                   selectionGroup.setAllSelections(false);
+                   returnedValue = false;
                }
-               isContainerSet = false;
-               
-       return returnedValue;
+           }
        }
-       
-       
-       public boolean isPathLttngTrace(String path) throws LttngException {
-               
-               boolean returnedValue = true;
-               
-               // Ask for a LttngTraceVersion for the given path
-               LTTngTraceVersion traceVersion = new LTTngTraceVersion( path );
-               
-               // If this is not a valid LTTng trace
-               if ( traceVersion.isValidLttngTrace() == false ) {
-               returnedValue = false;
-       }
-               
-               return returnedValue;
+       isContainerSet = false;
+
+       return returnedValue;
+    }
+
+    public boolean isPathLttngTrace(String path) throws LttngException {
+
+       boolean returnedValue = true;
+
+       // Ask for a LttngTraceVersion for the given path
+       LTTngTraceVersion traceVersion = new LTTngTraceVersion(path);
+
+       // If this is not a valid LTTng trace
+       if (traceVersion.isValidLttngTrace() == false) {
+           returnedValue = false;
        }
-       
-       
-       public String[] extendErrorMessage(String[] oldErrorMessage, String lineToAdd) {
-               String tmSwapMessage[] = new String[oldErrorMessage.length + 1];
-               for ( int pos = 0; pos<oldErrorMessage.length; pos++) {
-                       tmSwapMessage[pos] = oldErrorMessage[pos];
-               }
-               tmSwapMessage[oldErrorMessage.length] = lineToAdd;
-               
-               return tmSwapMessage;
+
+       return returnedValue;
+    }
+
+    public String[] extendErrorMessage(String[] oldErrorMessage, String lineToAdd) {
+       String tmSwapMessage[] = new String[oldErrorMessage.length + 1];
+       for (int pos = 0; pos < oldErrorMessage.length; pos++) {
+           tmSwapMessage[pos] = oldErrorMessage[pos];
        }
-       
-       
+       tmSwapMessage[oldErrorMessage.length] = lineToAdd;
+
+       return tmSwapMessage;
+    }
+
     /**
-     * This function will show a version error popup that contain the given message.
+     * This function will show a version error popup that contain the given
+     * message.
      * 
      */
     public void showVersionErrorPopup(String[] errMessages) {
-       TraceErrorHandler errorDialog = new TraceErrorHandler(errMessages);
-       try {
-               errorDialog.execute(null);
-       }
-       catch (Exception e) {
-               e.printStackTrace();
-       }
+       TraceErrorHandler errorDialog = new TraceErrorHandler(errMessages);
+       try {
+           errorDialog.execute(null);
+       } catch (Exception e) {
+           e.printStackTrace();
+       }
     }
-       
-    
-//    // *** HACK HACK AND HACK ***
-//    // Everything below is a proof of concept on how we could tweak the import wizard to act according to our plan
-//    // Uncomment everything below if you want to test it, but please, does not put any of this into production
-//    @SuppressWarnings({ "unchecked", "rawtypes" })
-//     @Override
-//    public boolean finish() {
-//        if (!ensureSourceIsValid()) {
-//                     return false;
-//             }
-//        saveWidgetValues();
-//        
-//        Iterator resourcesEnum = getSelectedResources().iterator();
-//        List listRealFiles = new ArrayList();
-//        
-//        // ****
-//        // HACK #1 : 
-//        // We need to convert everything into java.io.File because ImportOperation does NOT support FileSystemElement
-//        while (resourcesEnum.hasNext()) {
-//             FileSystemElement tmpFileElement = ((FileSystemElement)resourcesEnum.next());
-//             java.io.File tmpRealFile = new java.io.File(tmpFileElement.getFileSystemObject().toString());
-//             
-//            listRealFiles.add(tmpRealFile);
-//        }
-//        
-//        if (listRealFiles.size() > 0) {
-//             // Call import ressources (code is below)
-//                     return importResources(listRealFiles);
-//             }
-//
-//        MessageDialog.openInformation(getContainer().getShell(),
-//                DataTransferMessages.DataTransfer_information,
-//                DataTransferMessages.FileImport_noneSelected);
-//        return false;
-//    }
-//    
-//    @Override
-//    protected boolean importResources(List fileSystemObjects) {
-//     // *** Explanation of the hackssss
-//     // We want the import wizard to import everything in the form of : 
-//     //              trace1/ -> tracefiles*
-//     //
-//     // However, the wizard is too dumb to do the following and will recreate the full architecture the user selected.
-//     // So, depending what the user select, we could end up with something like : 
-//     //              home/user/somewhere/trace1/ -> tracefiles*
-//     //
-//     // Since there is nothing to do with that, we need to change the "source" and the "to-import files" to reflect this.
-//     // Basically, from the case above, the "source" should be changed to "trace1/" and "to-import files" 
-//     //              should have the correct parent so the wizard can still find them
-//     //
-//     // Let's see how fun it is to do with mr. import wizard.
-//     
-//     
-//     List listRealFilesShortPath = new ArrayList();
-//     java.io.File newFullSource = getSourceDirectory();
-//     
-//     // We will loop for every "to-import full path files" we have and recreate "short path" files
-//     // Mean, the current path of the file is currently something like : 
-//     //              Path : /home/billybob/mytraces/trace1/metadata_0        Parent : null
-//     // And we want something less dumb like : 
-//     //              Path : metadata_0                                                                       Parent : /home/billybob/mytraces/trace1/
-//     for (int pos=0; pos<fileSystemObjects.size(); pos++) {
-//             java.io.File oldFile  = (java.io.File)fileSystemObjects.get(pos);
-//             java.io.File newShortPathFile = oldFile;
-//             
-//             // ***
-//             // HACK #2 : We need to ajust the source of the files!
-//             // Our current source is probably like : 
-//             //              (Source)        Path : / (or null?)
-//             //              (Files)         Path : /home/billybob/mytraces/trace1/metadata_0        Parent : null
-//             // We want something like : 
-//             //              (Source)        Path : /home/billybob/mytraces/trace1/
-//             //      (Files)         Path : metadata_0                                                                       Parent : /home/billybob/mytraces/trace1/
-//             // 
-//             // *BUG : However, we might need MULTIPLE sources since we could have MULTIPLE traces selected... 
-//             //      THIS IS NOT HANDLED YET.
-//             
-//             // Make a new path like -> /home/billybob/mytraces/trace1/
-//             String newParent = oldFile.getAbsolutePath().substring(0, oldFile.getAbsolutePath().lastIndexOf("/") );
-//             
-//             // Create a "short path file" with the good parent from it. This give : 
-//             // (Files)      Path : metadata_0  Parent : /home/billybob/mytraces/trace1/
-//                     newShortPathFile = new java.io.File(newParent, oldFile.getName() );
-//                     
-//                     // Create a new "full source" directory -> /home/billybob/mytraces/trace1/
-//                     newFullSource = new java.io.File( newParent );
-//                     
-//                     // Add our pretty file to the new List
-//             listRealFilesShortPath.add(newShortPathFile);
-//     }
-//     
-//     // ***
-//     // HACK #3
-//     // Now that we have everything, we need to AJUST THE DESTINATION
-//     // To do so, we ajust the "ContainerValue" text field.
-//     //
-//     // Right now we have something like : 
-//     //              Path -> /where/to/import/
-//     //      (Files)         Path : metadata_0       Parent : /home/billybob/mytraces/trace1/
-//             // We want something like : 
-//     //              Path -> /where/to/import/trace1/
-//     //      (Files)         Path : metadata_0       Parent : /home/billybob/mytraces/trace1/
-//     //
-//     
-//     // We take the current text field and we add the "full source" name
-//     //      Note : the "name" is the last directory name so "trace1" is returned for a path like "/home/billybob/mytraces/trace1/"
-//     setContainerFieldValue(getContainerFullPath() + "/" + newFullSource.getName());
-//     
-//     /*
-//     System.out.println("\n\n" + getContainerFullPath());
-//     System.out.println(newFullSource);
-//     System.out.println(FileSystemStructureProvider.INSTANCE);
-//     System.out.println(this.getContainer());
-//     System.out.println(fileSystemObjects);
-//     */
-//     
-//     // Finally import !!
-//        ImportOperation operation = new ImportOperation(getContainerFullPath(), newFullSource, FileSystemStructureProvider.INSTANCE, this, listRealFilesShortPath);
-//        
-//        operation.setContext(getShell());
-//        return executeImportOperation(operation);
-//    }
-//    
-//    // This function test if the selected directory are LTTng traces
-//    // This one is made to work with the madness above.
-//     public boolean isSelectedElementsValidLttngTraces() {
-//             boolean returnedValue = true;
-//             
-//             String errMessage[] = { "Couldn't get LTTng version number for the path : " }; 
-//             
-//             // We don't want to test until something is selected
-//             if ( selectionGroup.getCheckedElementCount() > 0 ) {
-//                     try {
-//                             List<MinimizedFileSystemElement> selectionList = selectionGroup.getAllWhiteCheckedItems();
-//                             MinimizedFileSystemElement tmpSelectedElement = null;
-//                             
-//                             for ( int x=0; x<selectionList.size(); x++) {
-//                                     tmpSelectedElement = selectionList.get(x);
-//                                     
-//                                     // *** VERIFY ***
-//                                     // Not sure ALL directory are checked.
-//                                     if ( tmpSelectedElement.isDirectory() ) {
-//                                             String tmpPath = tmpSelectedElement.getFileSystemObject().toString();
-//                                             if ( isPathLttngTrace( tmpPath ) == false ) {
-//                                                     returnedValue = false;
-//                                                     errMessage = extendErrorMessage(errMessage, tmpPath);
-//                                             }
-//                                     }
-//                             }
-//                             
-//                     if ( returnedValue == false ) {
-//                             errMessage = extendErrorMessage(errMessage, "");
-//                             errMessage = extendErrorMessage(errMessage, "Verify that the directory is a valid LTTng trace directory.");
-//                             showVersionErrorPopup(errMessage);
-//                             selectionGroup.setAllSelections(false);
-//                     }
-//             }
-//             catch (LttngException e) {
-//                     String exceptionMessage[] = { "Version check failed for the path : ", this.getTracepath(), "", "Returned error was :", e.toString() }; 
-//                     showVersionErrorPopup(exceptionMessage);
-//                     selectionGroup.setAllSelections(false);
-//                     returnedValue = false;
-//             }
-//             }
-//             
-//     return returnedValue;
-//     }
-    
+
+    // // *** HACK HACK AND HACK ***
+    // // Everything below is a proof of concept on how we could tweak the
+    // import wizard to act according to our plan
+    // // Uncomment everything below if you want to test it, but please, does
+    // not put any of this into production
+    // @SuppressWarnings({ "unchecked", "rawtypes" })
+    // @Override
+    // public boolean finish() {
+    // if (!ensureSourceIsValid()) {
+    // return false;
+    // }
+    // saveWidgetValues();
+    //
+    // Iterator resourcesEnum = getSelectedResources().iterator();
+    // List listRealFiles = new ArrayList();
+    //
+    // // ****
+    // // HACK #1 :
+    // // We need to convert everything into java.io.File because
+    // ImportOperation does NOT support FileSystemElement
+    // while (resourcesEnum.hasNext()) {
+    // FileSystemElement tmpFileElement =
+    // ((FileSystemElement)resourcesEnum.next());
+    // java.io.File tmpRealFile = new
+    // java.io.File(tmpFileElement.getFileSystemObject().toString());
+    //
+    // listRealFiles.add(tmpRealFile);
+    // }
+    //
+    // if (listRealFiles.size() > 0) {
+    // // Call import ressources (code is below)
+    // return importResources(listRealFiles);
+    // }
+    //
+    // MessageDialog.openInformation(getContainer().getShell(),
+    // DataTransferMessages.DataTransfer_information,
+    // DataTransferMessages.FileImport_noneSelected);
+    // return false;
+    // }
+    //
+    // @Override
+    // protected boolean importResources(List fileSystemObjects) {
+    // // *** Explanation of the hackssss
+    // // We want the import wizard to import everything in the form of :
+    // // trace1/ -> tracefiles*
+    // //
+    // // However, the wizard is too dumb to do the following and will recreate
+    // the full architecture the user selected.
+    // // So, depending what the user select, we could end up with something
+    // like :
+    // // home/user/somewhere/trace1/ -> tracefiles*
+    // //
+    // // Since there is nothing to do with that, we need to change the "source"
+    // and the "to-import files" to reflect this.
+    // // Basically, from the case above, the "source" should be changed to
+    // "trace1/" and "to-import files"
+    // // should have the correct parent so the wizard can still find them
+    // //
+    // // Let's see how fun it is to do with mr. import wizard.
+    //
+    //
+    // List listRealFilesShortPath = new ArrayList();
+    // java.io.File newFullSource = getSourceDirectory();
+    //
+    // // We will loop for every "to-import full path files" we have and
+    // recreate "short path" files
+    // // Mean, the current path of the file is currently something like :
+    // // Path : /home/billybob/mytraces/trace1/metadata_0 Parent : null
+    // // And we want something less dumb like :
+    // // Path : metadata_0 Parent : /home/billybob/mytraces/trace1/
+    // for (int pos=0; pos<fileSystemObjects.size(); pos++) {
+    // java.io.File oldFile = (java.io.File)fileSystemObjects.get(pos);
+    // java.io.File newShortPathFile = oldFile;
+    //
+    // // ***
+    // // HACK #2 : We need to ajust the source of the files!
+    // // Our current source is probably like :
+    // // (Source) Path : / (or null?)
+    // // (Files) Path : /home/billybob/mytraces/trace1/metadata_0 Parent : null
+    // // We want something like :
+    // // (Source) Path : /home/billybob/mytraces/trace1/
+    // // (Files) Path : metadata_0 Parent : /home/billybob/mytraces/trace1/
+    // //
+    // // *BUG : However, we might need MULTIPLE sources since we could have
+    // MULTIPLE traces selected...
+    // // THIS IS NOT HANDLED YET.
+    //
+    // // Make a new path like -> /home/billybob/mytraces/trace1/
+    // String newParent = oldFile.getAbsolutePath().substring(0,
+    // oldFile.getAbsolutePath().lastIndexOf("/") );
+    //
+    // // Create a "short path file" with the good parent from it. This give :
+    // // (Files) Path : metadata_0 Parent : /home/billybob/mytraces/trace1/
+    // newShortPathFile = new java.io.File(newParent, oldFile.getName() );
+    //
+    // // Create a new "full source" directory ->
+    // /home/billybob/mytraces/trace1/
+    // newFullSource = new java.io.File( newParent );
+    //
+    // // Add our pretty file to the new List
+    // listRealFilesShortPath.add(newShortPathFile);
+    // }
+    //
+    // // ***
+    // // HACK #3
+    // // Now that we have everything, we need to AJUST THE DESTINATION
+    // // To do so, we ajust the "ContainerValue" text field.
+    // //
+    // // Right now we have something like :
+    // // Path -> /where/to/import/
+    // // (Files) Path : metadata_0 Parent : /home/billybob/mytraces/trace1/
+    // // We want something like :
+    // // Path -> /where/to/import/trace1/
+    // // (Files) Path : metadata_0 Parent : /home/billybob/mytraces/trace1/
+    // //
+    //
+    // // We take the current text field and we add the "full source" name
+    // // Note : the "name" is the last directory name so "trace1" is returned
+    // for a path like "/home/billybob/mytraces/trace1/"
+    // setContainerFieldValue(getContainerFullPath() + "/" +
+    // newFullSource.getName());
+    //
+    // /*
+    // System.out.println("\n\n" + getContainerFullPath());
+    // System.out.println(newFullSource);
+    // System.out.println(FileSystemStructureProvider.INSTANCE);
+    // System.out.println(this.getContainer());
+    // System.out.println(fileSystemObjects);
+    // */
+    //
+    // // Finally import !!
+    // ImportOperation operation = new ImportOperation(getContainerFullPath(),
+    // newFullSource, FileSystemStructureProvider.INSTANCE, this,
+    // listRealFilesShortPath);
+    //
+    // operation.setContext(getShell());
+    // return executeImportOperation(operation);
+    // }
+    //
+    // // This function test if the selected directory are LTTng traces
+    // // This one is made to work with the madness above.
+    // public boolean isSelectedElementsValidLttngTraces() {
+    // boolean returnedValue = true;
+    //
+    // String errMessage[] = {
+    // "Couldn't get LTTng version number for the path : " };
+    //
+    // // We don't want to test until something is selected
+    // if ( selectionGroup.getCheckedElementCount() > 0 ) {
+    // try {
+    // List<MinimizedFileSystemElement> selectionList =
+    // selectionGroup.getAllWhiteCheckedItems();
+    // MinimizedFileSystemElement tmpSelectedElement = null;
+    //
+    // for ( int x=0; x<selectionList.size(); x++) {
+    // tmpSelectedElement = selectionList.get(x);
+    //
+    // // *** VERIFY ***
+    // // Not sure ALL directory are checked.
+    // if ( tmpSelectedElement.isDirectory() ) {
+    // String tmpPath = tmpSelectedElement.getFileSystemObject().toString();
+    // if ( isPathLttngTrace( tmpPath ) == false ) {
+    // returnedValue = false;
+    // errMessage = extendErrorMessage(errMessage, tmpPath);
+    // }
+    // }
+    // }
+    //
+    // if ( returnedValue == false ) {
+    // errMessage = extendErrorMessage(errMessage, "");
+    // errMessage = extendErrorMessage(errMessage,
+    // "Verify that the directory is a valid LTTng trace directory.");
+    // showVersionErrorPopup(errMessage);
+    // selectionGroup.setAllSelections(false);
+    // }
+    // }
+    // catch (LttngException e) {
+    // String exceptionMessage[] = { "Version check failed for the path : ",
+    // this.getTracepath(), "", "Returned error was :", e.toString() };
+    // showVersionErrorPopup(exceptionMessage);
+    // selectionGroup.setAllSelections(false);
+    // returnedValue = false;
+    // }
+    // }
+    //
+    // return returnedValue;
+    // }
+
 }
index 718cdb6c6ef368cc16add04efc6485e984f76f85..aa0dd62c27cd8c64e1439622874a4e7ef7ac9a33 100644 (file)
@@ -9,6 +9,13 @@ public class Messages extends NLS {
        public static String AddTraceWizardPage_columnHeader;
        public static String AddTraceWizardPage_description;
        public static String AddTraceWizardPage_windowTitle;
+       public static String ImportTraceWizardPage_BadTraceVersion;
+       public static String ImportTraceWizardPage_BadTraceVersionMsg1;
+       public static String ImportTraceWizardPage_BadTraceVersionMsg2;
+       public static String NewProjectWizard_Description;
+       public static String NewProjectWizard_Title;
+       public static String TraceErrorDialog_DalogTitle;
+       public static String TraceErrorDialog_DialogMsgLabel;
        static {
                // initialize resource bundle
                NLS.initializeMessages(BUNDLE_NAME, Messages.class);
index 396207855e32a7d4b8caf675e3e9d7e9ee68ad6f..c5a4f999f980eb768705c99c0c792747474804ad 100644 (file)
@@ -58,283 +58,287 @@ import org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup;
 @SuppressWarnings("restriction")
 public class NewExperimentDialog extends SelectionStatusDialog {
 
-       private Text folderNameField;
-       private IContainer container;
-       private boolean firstLinkCheck = true;
-       private CreateLinkedResourceGroup linkedResourceGroup;
+    private Text folderNameField;
+    private IContainer container;
+    private boolean firstLinkCheck = true;
+    private CreateLinkedResourceGroup linkedResourceGroup;
 
-       /**
-        * Creates a NewFolderDialog
-        * 
-        * @param parentShell parent of the new dialog
-        * @param container parent of the new folder
-        */
-       public NewExperimentDialog(Shell parentShell, LTTngExperimentFolderNode experimentFolder) {
-               super(parentShell);
-               this.container = experimentFolder.getFolder();
-               setTitle("LTTng Experiment");
-               setStatusLineAboveButtons(true);
-       }
+    /**
+     * Creates a NewFolderDialog
+     * 
+     * @param parentShell
+     *            parent of the new dialog
+     * @param container
+     *            parent of the new folder
+     */
+    public NewExperimentDialog(Shell parentShell, LTTngExperimentFolderNode experimentFolder) {
+       super(parentShell);
+       this.container = experimentFolder.getFolder();
+       setTitle(org.eclipse.linuxtools.lttng.ui.views.project.dialogs.IDEWorkbenchMessages.NewExperimentDialog_DialogTitle);
+       setStatusLineAboveButtons(true);
+    }
 
-       /**
-        * Creates the folder using the name and link target entered by the user.
-        * Sets the dialog result to the created folder.  
-        */
-       @Override
-       protected void computeResult() {
-       }
+    /**
+     * Creates the folder using the name and link target entered by the user.
+     * Sets the dialog result to the created folder.
+     */
+    @Override
+    protected void computeResult() {
+    }
 
-       /**
-        * @see org.eclipse.jface.window.Window#create()
-        */
-       @Override
-       public void create() {
-               super.create();
-               getButton(IDialogConstants.OK_ID).setEnabled(false);
-       }
+    /**
+     * @see org.eclipse.jface.window.Window#create()
+     */
+    @Override
+    public void create() {
+       super.create();
+       getButton(IDialogConstants.OK_ID).setEnabled(false);
+    }
 
-       /**
-        * Creates the widget for advanced options.
-        *  
-        * @param parent the parent composite
-        */
-       protected void createLinkResourceGroup(Composite parent) {
-               linkedResourceGroup = new CreateLinkedResourceGroup(IResource.FOLDER,
-                               new Listener() {
-                                       @Override
-                                       public void handleEvent(Event e) {
-                                               validateLinkedResource();
-                                               firstLinkCheck = false;
-                                       }
-                               }, new CreateLinkedResourceGroup.IStringValue() {
-                                       @Override
-                                       public void setValue(String string) {
-                                               folderNameField.setText(string);
-                                       }
+    /**
+     * Creates the widget for advanced options.
+     * 
+     * @param parent
+     *            the parent composite
+     */
+    protected void createLinkResourceGroup(Composite parent) {
+       linkedResourceGroup = new CreateLinkedResourceGroup(IResource.FOLDER, new Listener() {
+           @Override
+           public void handleEvent(Event e) {
+               validateLinkedResource();
+               firstLinkCheck = false;
+           }
+       }, new CreateLinkedResourceGroup.IStringValue() {
+           @Override
+           public void setValue(String string) {
+               folderNameField.setText(string);
+           }
 
-                                       @Override
-                                       public String getValue() {
-                                               return folderNameField.getText();
-                                       }
+           @Override
+           public String getValue() {
+               return folderNameField.getText();
+           }
 
-                                       @Override
-                                       public IResource getResource() {
-                                               // TODO Auto-generated method stub
-                                               return null;
-                                       }
-                               });
-       }
+           @Override
+           public IResource getResource() {
+               // TODO Auto-generated method stub
+               return null;
+           }
+       });
+    }
 
-       /* (non-Javadoc)
-        * Method declared on Dialog.
-        */
-       @Override
-       protected Control createDialogArea(Composite parent) {
-               Composite composite = (Composite) super.createDialogArea(parent);
-               composite.setLayout(new GridLayout());
-               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+    /*
+     * (non-Javadoc) Method declared on Dialog.
+     */
+    @Override
+    protected Control createDialogArea(Composite parent) {
+       Composite composite = (Composite) super.createDialogArea(parent);
+       composite.setLayout(new GridLayout());
+       composite.setLayoutData(new GridData(GridData.FILL_BOTH));
 
-               createFolderNameGroup(composite);
-               createLinkResourceGroup(composite);
-               return composite;
-       }
+       createFolderNameGroup(composite);
+       createLinkResourceGroup(composite);
+       return composite;
+    }
 
-       /**
-        * Creates the folder name specification controls.
-        *
-        * @param parent the parent composite
-        */
-       private void createFolderNameGroup(Composite parent) {
-               Font font = parent.getFont();
-               Composite folderGroup = new Composite(parent, SWT.NONE);
-               GridLayout layout = new GridLayout();
-               layout.numColumns = 2;
-               folderGroup.setLayout(layout);
-               folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+    /**
+     * Creates the folder name specification controls.
+     * 
+     * @param parent
+     *            the parent composite
+     */
+    private void createFolderNameGroup(Composite parent) {
+       Font font = parent.getFont();
+       Composite folderGroup = new Composite(parent, SWT.NONE);
+       GridLayout layout = new GridLayout();
+       layout.numColumns = 2;
+       folderGroup.setLayout(layout);
+       folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
 
-               // new folder label
-               Label folderLabel = new Label(folderGroup, SWT.NONE);
-               folderLabel.setFont(font);
-               folderLabel.setText("Experiment name: ");
+       // new folder label
+       Label folderLabel = new Label(folderGroup, SWT.NONE);
+       folderLabel.setFont(font);
+       folderLabel.setText(org.eclipse.linuxtools.lttng.ui.views.project.dialogs.IDEWorkbenchMessages.NewExperimentDialog_ExperimentLabel);
 
-               // new folder name entry field
-               folderNameField = new Text(folderGroup, SWT.BORDER);
-               GridData data = new GridData(GridData.FILL_HORIZONTAL);
-               data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
-               folderNameField.setLayoutData(data);
-               folderNameField.setFont(font);
-               folderNameField.addListener(SWT.Modify, new Listener() {
-                       @Override
-                       public void handleEvent(Event event) {
-                               validateLinkedResource();
-                       }
-               });
-       }
+       // new folder name entry field
+       folderNameField = new Text(folderGroup, SWT.BORDER);
+       GridData data = new GridData(GridData.FILL_HORIZONTAL);
+       data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
+       folderNameField.setLayoutData(data);
+       folderNameField.setFont(font);
+       folderNameField.addListener(SWT.Modify, new Listener() {
+           @Override
+           public void handleEvent(Event event) {
+               validateLinkedResource();
+           }
+       });
+    }
 
-       /**
-        * Creates a folder resource handle for the folder with the given name.
-        * The folder handle is created relative to the container specified during 
-        * object creation. 
-        *
-        * @param folderName the name of the folder resource to create a handle for
-        * @return the new folder resource handle
-        */
-       private IFolder createFolderHandle(String folderName) {
-               IWorkspaceRoot workspaceRoot = container.getWorkspace().getRoot();
-               IPath folderPath = container.getFullPath().append(folderName);
-               IFolder folderHandle = workspaceRoot.getFolder(folderPath);
+    /**
+     * Creates a folder resource handle for the folder with the given name. The
+     * folder handle is created relative to the container specified during
+     * object creation.
+     * 
+     * @param folderName
+     *            the name of the folder resource to create a handle for
+     * @return the new folder resource handle
+     */
+    private IFolder createFolderHandle(String folderName) {
+       IWorkspaceRoot workspaceRoot = container.getWorkspace().getRoot();
+       IPath folderPath = container.getFullPath().append(folderName);
+       IFolder folderHandle = workspaceRoot.getFolder(folderPath);
 
-               return folderHandle;
-       }
+       return folderHandle;
+    }
 
-       /**
-        * Creates a new folder with the given name and optionally linking to
-        * the specified link target.
-        * 
-        * @param folderName name of the new folder
-        * @param linkTarget name of the link target folder. may be null.
-        * @return IFolder the new folder
-        */
-       private IFolder createNewFolder(String folderName, final URI linkTarget) {
-               final IFolder folderHandle = createFolderHandle(folderName);
+    /**
+     * Creates a new folder with the given name and optionally linking to the
+     * specified link target.
+     * 
+     * @param folderName
+     *            name of the new folder
+     * @param linkTarget
+     *            name of the link target folder. may be null.
+     * @return IFolder the new folder
+     */
+    private IFolder createNewFolder(String folderName, final URI linkTarget) {
+       final IFolder folderHandle = createFolderHandle(folderName);
 
-               WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
-                       @Override
-                       public void execute(IProgressMonitor monitor) throws CoreException {
-                               try {
-                                       monitor.beginTask(IDEWorkbenchMessages.NewFolderDialog_progress, 2000);
-                                       if (monitor.isCanceled()) {
-                                               throw new OperationCanceledException();
-                                       }
-                                       if (linkTarget == null) {
-                                               folderHandle.create(false, true, monitor);
-                                       } else {
-                                               folderHandle.createLink(linkTarget, IResource.ALLOW_MISSING_LOCAL, monitor);
-                                       }
-                                       if (monitor.isCanceled()) {
-                                               throw new OperationCanceledException();
-                                       }
-                               } finally {
-                                       monitor.done();
-                               }
-                       }
-               };
+       WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
+           @Override
+           public void execute(IProgressMonitor monitor) throws CoreException {
                try {
-                       PlatformUI.getWorkbench().getProgressService().busyCursorWhile(operation);
-               } catch (InterruptedException exception) {
-                       return null;
-               } catch (InvocationTargetException exception) {
-                       if (exception.getTargetException() instanceof CoreException) {
-                               ErrorDialog.openError(getShell(),
-                                               IDEWorkbenchMessages.NewFolderDialog_errorTitle, null, // no special message
-                                               ((CoreException) exception.getTargetException()).getStatus());
-                       } else {
-                               // CoreExceptions are handled above, but unexpected runtime exceptions and errors may still occur.
-                               IDEWorkbenchPlugin.log(getClass(),
-                                               "createNewExperiment", exception.getTargetException());
-                               MessageDialog.openError(getShell(),
-                                               IDEWorkbenchMessages.NewFolderDialog_errorTitle,
-                                               NLS.bind(IDEWorkbenchMessages.NewFolderDialog_internalError,
-                                                       exception.getTargetException().getMessage()));
-                       }
-                       return null;
+                   monitor.beginTask(IDEWorkbenchMessages.NewFolderDialog_progress, 2000);
+                   if (monitor.isCanceled()) {
+                       throw new OperationCanceledException();
+                   }
+                   if (linkTarget == null) {
+                       folderHandle.create(false, true, monitor);
+                   } else {
+                       folderHandle.createLink(linkTarget, IResource.ALLOW_MISSING_LOCAL, monitor);
+                   }
+                   if (monitor.isCanceled()) {
+                       throw new OperationCanceledException();
+                   }
+               } finally {
+                   monitor.done();
                }
-               return folderHandle;
+           }
+       };
+       try {
+           PlatformUI.getWorkbench().getProgressService().busyCursorWhile(operation);
+       } catch (InterruptedException exception) {
+           return null;
+       } catch (InvocationTargetException exception) {
+           if (exception.getTargetException() instanceof CoreException) {
+               ErrorDialog.openError(getShell(), IDEWorkbenchMessages.NewFolderDialog_errorTitle, null,
+                       ((CoreException) exception.getTargetException()).getStatus());
+           } else {
+               // CoreExceptions are handled above, but unexpected runtime
+               // exceptions and errors may still occur.
+               IDEWorkbenchPlugin.log(getClass(), "createNewExperiment", exception.getTargetException()); //$NON-NLS-1$
+               MessageDialog.openError(getShell(), IDEWorkbenchMessages.NewFolderDialog_errorTitle,
+                       NLS.bind(IDEWorkbenchMessages.NewFolderDialog_internalError, exception.getTargetException().getMessage()));
+           }
+           return null;
        }
+       return folderHandle;
+    }
 
-       /**
-        * Update the dialog's status line to reflect the given status. It is safe to call
-        * this method before the dialog has been opened.
-        */
-       @Override
-       protected void updateStatus(IStatus status) {
-               if (firstLinkCheck && status != null) {
-                       Status newStatus = new Status(IStatus.OK, status.getPlugin(),
-                                       status.getCode(), status.getMessage(), status.getException());
-                       super.updateStatus(newStatus);
-               } else {
-                       super.updateStatus(status);
-               }
+    /**
+     * Update the dialog's status line to reflect the given status. It is safe
+     * to call this method before the dialog has been opened.
+     */
+    @Override
+    protected void updateStatus(IStatus status) {
+       if (firstLinkCheck && status != null) {
+           Status newStatus = new Status(IStatus.OK, status.getPlugin(), status.getCode(), status.getMessage(), status.getException());
+           super.updateStatus(newStatus);
+       } else {
+           super.updateStatus(status);
        }
+    }
 
-       /**
-        * Update the dialog's status line to reflect the given status. It is safe to call
-        * this method before the dialog has been opened.
-        * @param severity
-        * @param message
-        */
-       private void updateStatus(int severity, String message) {
-               updateStatus(new Status(severity, IDEWorkbenchPlugin.IDE_WORKBENCH, severity, message, null));
-       }
+    /**
+     * Update the dialog's status line to reflect the given status. It is safe
+     * to call this method before the dialog has been opened.
+     * 
+     * @param severity
+     * @param message
+     */
+    private void updateStatus(int severity, String message) {
+       updateStatus(new Status(severity, IDEWorkbenchPlugin.IDE_WORKBENCH, severity, message, null));
+    }
 
-       /**
-        * Checks whether the folder name and link location are valid.
-        * Disable the OK button if the folder name and link location are valid.
-        * a message that indicates the problem otherwise.
-        */
-       private void validateLinkedResource() {
-               boolean valid = validateFolderName();
+    /**
+     * Checks whether the folder name and link location are valid. Disable the
+     * OK button if the folder name and link location are valid. a message that
+     * indicates the problem otherwise.
+     */
+    private void validateLinkedResource() {
+       boolean valid = validateFolderName();
 
-               if (valid) {
-                       IFolder linkHandle = createFolderHandle(folderNameField.getText());
-                       IStatus status = linkedResourceGroup.validateLinkLocation(linkHandle);
+       if (valid) {
+           IFolder linkHandle = createFolderHandle(folderNameField.getText());
+           IStatus status = linkedResourceGroup.validateLinkLocation(linkHandle);
 
-                       if (status.getSeverity() != IStatus.ERROR) {
-                               getOkButton().setEnabled(true);
-                       } else {
-                               getOkButton().setEnabled(false);
-                       }
+           if (status.getSeverity() != IStatus.ERROR) {
+               getOkButton().setEnabled(true);
+           } else {
+               getOkButton().setEnabled(false);
+           }
 
-                       if (status.isOK() == false) {
-                               updateStatus(status);
-                       }
-               } else {
-                       getOkButton().setEnabled(false);
-               }
+           if (status.isOK() == false) {
+               updateStatus(status);
+           }
+       } else {
+           getOkButton().setEnabled(false);
        }
+    }
 
-       /**
-        * Checks if the folder name is valid.
-        *
-        * @return null if the new folder name is valid.
-        *      a message that indicates the problem otherwise.
-        */
-       private boolean validateFolderName() {
-               String name = folderNameField.getText();
-               IWorkspace workspace = container.getWorkspace();
-               IStatus nameStatus = workspace.validateName(name, IResource.FOLDER);
+    /**
+     * Checks if the folder name is valid.
+     * 
+     * @return null if the new folder name is valid. a message that indicates
+     *         the problem otherwise.
+     */
+    private boolean validateFolderName() {
+       String name = folderNameField.getText();
+       IWorkspace workspace = container.getWorkspace();
+       IStatus nameStatus = workspace.validateName(name, IResource.FOLDER);
 
-               if ("".equals(name)) { //$NON-NLS-1$
-                       updateStatus(IStatus.ERROR, "Experiment name is empty"); //$NON-NLS-1$
-                       return false;
-               }
-               if (nameStatus.isOK() == false) {
-                       updateStatus(nameStatus);
-                       return false;
-               }
-               IPath path = new Path(name);
-               if (container.getFolder(path).exists()
-                               || container.getFile(path).exists()) {
-                       updateStatus(IStatus.ERROR, NLS.bind("Experiment already exists", name)); //$NON-NLS-1$
-                       return false;
-               }
-               updateStatus(IStatus.OK, ""); //$NON-NLS-1$
-               return true;
+       if ("".equals(name)) { //$NON-NLS-1$
+           updateStatus(IStatus.ERROR, "Experiment name is empty"); //$NON-NLS-1$
+           return false;
+       }
+       if (nameStatus.isOK() == false) {
+           updateStatus(nameStatus);
+           return false;
        }
+       IPath path = new Path(name);
+       if (container.getFolder(path).exists() || container.getFile(path).exists()) {
+           updateStatus(IStatus.ERROR, NLS.bind("Experiment already exists", name)); //$NON-NLS-1$
+           return false;
+       }
+       updateStatus(IStatus.OK, ""); //$NON-NLS-1$
+       return true;
+    }
 
-       /* (non-Javadoc)
-        * @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed()
-        */
-       @Override
-       protected void okPressed() {
-               URI linkTarget = linkedResourceGroup.getLinkTargetURI();
-               IFolder folder = createNewFolder(folderNameField.getText(), linkTarget);
-               if (folder == null) {
-                       return;
-               }
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed()
+     */
+    @Override
+    protected void okPressed() {
+       URI linkTarget = linkedResourceGroup.getLinkTargetURI();
+       IFolder folder = createNewFolder(folderNameField.getText(), linkTarget);
+       if (folder == null) {
+           return;
+       }
 
-               setSelectionResult(new IFolder[] { folder });
+       setSelectionResult(new IFolder[] { folder });
 
-               super.okPressed();
-       }
+       super.okPressed();
+    }
 }
\ No newline at end of file
index e0bd8a303cdb6f9231c3fe1a6a76012133ffbefa..8438a9c50cda284b7ad3b4425e094c2711246be0 100644 (file)
@@ -50,7 +50,7 @@ public class NewProjectWizard extends BasicNewResourceWizard {
      * 
      */
     public NewProjectWizard() {
-        this("LTTng Project", "Create an LTTng Project");
+        this(Messages.NewProjectWizard_Title, Messages.NewProjectWizard_Description);
     }
 
     /**
@@ -72,7 +72,7 @@ public class NewProjectWizard extends BasicNewResourceWizard {
      */
     @Override
     public void addPages() {
-        fMainPage= new NewProjectMainWizardPage("LTTng Project");
+        fMainPage= new NewProjectMainWizardPage(Messages.NewProjectWizard_Title);
         fMainPage.setTitle(fTtitle);
         fMainPage.setDescription(fDescription);
         addPage(fMainPage);
index 2ad28a440f14ef9272f8582c7a15f5c090ce145f..7ed347913b101be7a33c8f780deb50f519bfe944 100644 (file)
@@ -1,5 +1,3 @@
-package org.eclipse.linuxtools.lttng.ui.views.project.dialogs;
-
 /*******************************************************************************
  * Copyright (c) 2009 Ericsson
  * 
@@ -12,6 +10,8 @@ package org.eclipse.linuxtools.lttng.ui.views.project.dialogs;
  *   William Bourque - Initial API and implementation
  *******************************************************************************/
 
+package org.eclipse.linuxtools.lttng.ui.views.project.dialogs;
+
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.dialogs.IDialogConstants;
@@ -28,108 +28,105 @@ import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.dialogs.SelectionStatusDialog;
 
 public class TraceErrorDialog extends SelectionStatusDialog {
-       
-       private String[] messages = null; 
-       
-       public TraceErrorDialog(Shell parentShell, String[] newMessages) {
-               super(parentShell);
-               
-               messages = newMessages;
-               setTitle("Trace Selection");
-               setStatusLineAboveButtons(true);
-       }
-       
-       @Override
-       protected void computeResult() {
-       }
-       
-       @Override
-       public void create() {
-               super.create();
-               getButton(IDialogConstants.OK_ID).setEnabled(true);
-               getButton(IDialogConstants.OK_ID).setAlignment(GridData.CENTER);
-               getButton(IDialogConstants.CANCEL_ID).setVisible(false);
-       }
-       
-       @Override
-       protected Control createDialogArea(Composite parent) {
-               Composite composite = (Composite) super.createDialogArea(parent);
-               composite.setLayout(new GridLayout());
-               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-               
-               createFolderNameGroup(composite);
-               return composite;
-       }
-       
-       private void createFolderNameGroup(Composite parent) {
-               Font font = parent.getFont();
-               Composite folderGroup = new Composite(parent, SWT.NONE);
-               
-               GridLayout layout = new GridLayout();
-               layout.numColumns = 1;
-               layout.verticalSpacing = 3;
-               folderGroup.setLayout(layout);
-               folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-               
-               
-               // Position grid for the messages
-               GridData positionningData = new GridData(GridData.FILL_VERTICAL);
-               
-               // New message label
-               Label lblMessage = new Label(folderGroup, SWT.NONE);
-               lblMessage.setFont(font);
-               lblMessage.setText("Error while opening the trace! Error message was : ");
-               lblMessage.setLayoutData(positionningData);
-               
-               // The actual messages
-               GC graphicContext = new GC(parent);
-               String longuestLine = ""; //$NON-NLS-1$
-               int msgSize = 0;
-               
-               // *** Font and FontData are nowhere near elegant to use.
-               Font errorFont = new Font(graphicContext.getDevice(), font.getFontData()[0].getName(), font.getFontData()[0].getHeight(), SWT.ITALIC);
-               
-               Label[] lblErrorMessages = new Label[messages.length];
-               for(int x=0; x<messages.length; x++) {
-                       lblErrorMessages[x] = new Label(folderGroup, SWT.NONE);
-                       lblErrorMessages[x].setFont(errorFont);
-                       
-                       lblErrorMessages[x].setForeground(new Color(lblErrorMessages[x].getForeground().getDevice(), 255, 0, 0));
-                       lblErrorMessages[x].setText(messages[x]);
-                       lblErrorMessages[x].setLayoutData(positionningData);
-                       
-                       if ( messages[x].length() > longuestLine.length() ) {
-                               longuestLine = messages[x];
-                       }
-               }
-               
-               for ( int pos=0; pos<longuestLine.length(); pos++ ) {
-                       msgSize += graphicContext.getAdvanceWidth( longuestLine.charAt(pos) );
-               }
-               // Seems we need to count the final \n of the line otherwise we miss some space
-               msgSize += graphicContext.getAdvanceWidth( '\n' );
-               
-               positionningData.widthHint = msgSize;
-               positionningData.grabExcessHorizontalSpace = true;
-               
-               graphicContext.dispose();
-               
+
+    private String[] messages = null;
+
+    public TraceErrorDialog(Shell parentShell, String[] newMessages) {
+       super(parentShell);
+       messages = newMessages;
+       setTitle(Messages.TraceErrorDialog_DalogTitle);
+       setStatusLineAboveButtons(true);
+    }
+
+    @Override
+    protected void computeResult() {
+    }
+
+    @Override
+    public void create() {
+       super.create();
+       getButton(IDialogConstants.OK_ID).setEnabled(true);
+       getButton(IDialogConstants.OK_ID).setAlignment(GridData.CENTER);
+       getButton(IDialogConstants.CANCEL_ID).setVisible(false);
+    }
+
+    @Override
+    protected Control createDialogArea(Composite parent) {
+       Composite composite = (Composite) super.createDialogArea(parent);
+       composite.setLayout(new GridLayout());
+       composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+       createFolderNameGroup(composite);
+       return composite;
+    }
+
+    private void createFolderNameGroup(Composite parent) {
+       Font font = parent.getFont();
+       Composite folderGroup = new Composite(parent, SWT.NONE);
+
+       GridLayout layout = new GridLayout();
+       layout.numColumns = 1;
+       layout.verticalSpacing = 3;
+       folderGroup.setLayout(layout);
+       folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+       // Position grid for the messages
+       GridData positionningData = new GridData(GridData.FILL_VERTICAL);
+
+       // New message label
+       Label lblMessage = new Label(folderGroup, SWT.NONE);
+       lblMessage.setFont(font);
+       lblMessage.setText(Messages.TraceErrorDialog_DialogMsgLabel);
+       lblMessage.setLayoutData(positionningData);
+
+       // The actual messages
+       GC graphicContext = new GC(parent);
+       String longuestLine = ""; //$NON-NLS-1$
+       int msgSize = 0;
+
+       // *** Font and FontData are nowhere near elegant to use.
+       Font errorFont = new Font(graphicContext.getDevice(), font.getFontData()[0].getName(), font.getFontData()[0].getHeight(), SWT.ITALIC);
+
+       Label[] lblErrorMessages = new Label[messages.length];
+       for (int x = 0; x < messages.length; x++) {
+           lblErrorMessages[x] = new Label(folderGroup, SWT.NONE);
+           lblErrorMessages[x].setFont(errorFont);
+
+           lblErrorMessages[x].setForeground(new Color(lblErrorMessages[x].getForeground().getDevice(), 255, 0, 0));
+           lblErrorMessages[x].setText(messages[x]);
+           lblErrorMessages[x].setLayoutData(positionningData);
+
+           if (messages[x].length() > longuestLine.length()) {
+               longuestLine = messages[x];
+           }
        }
-       
-       
-       @Override
-       protected void updateStatus(IStatus status) {
-               if (status != null) {
-                       Status newStatus = new Status(IStatus.OK, status.getPlugin(),
-                                       status.getCode(), status.getMessage(), status.getException());
-                       super.updateStatus(newStatus);
-               } else {
-                       super.updateStatus(status);
-               }
+
+       for (int pos = 0; pos < longuestLine.length(); pos++) {
+           msgSize += graphicContext.getAdvanceWidth(longuestLine.charAt(pos));
        }
-       
-       @Override
-       protected void okPressed() {
-               super.okPressed();
+       // Seems we need to count the final \n of the line otherwise we miss
+       // some space
+       msgSize += graphicContext.getAdvanceWidth('\n');
+
+       positionningData.widthHint = msgSize;
+       positionningData.grabExcessHorizontalSpace = true;
+
+       graphicContext.dispose();
+
+    }
+
+    @Override
+    protected void updateStatus(IStatus status) {
+       if (status != null) {
+           Status newStatus = new Status(IStatus.OK, status.getPlugin(), status.getCode(), status.getMessage(), status.getException());
+           super.updateStatus(newStatus);
+       } else {
+           super.updateStatus(status);
        }
+    }
+
+    @Override
+    protected void okPressed() {
+       super.okPressed();
+    }
 }
index 93f37e27bf2e1f5187f75fbeec6a6540e6ae2f40..717b96b99fa3345bee44f84cde02ebd46c2a6f3c 100644 (file)
@@ -3,3 +3,19 @@ AddTraceWizard_windowTitle=Adding traces to experiment
 AddTraceWizardPage_columnHeader=Trace
 AddTraceWizardPage_description=Select the traces to add to the experiment
 AddTraceWizardPage_windowTitle=Select traces
+ImportTraceWizard_LocationError=Error: Trace location is wrong.
+ImportTraceWizard_LocationErrorMsg1=You cannot import your trace directly into "
+ImportTraceWizard_LocationErrorMsg2=The trace has to be into a directory, like "
+ImportTraceWizard_LocationErrorMsg3=Please adjust the location of the LTTng trace.
+ImportTraceWizardPage_BadTraceVersion=Error: Unrecognized trace version for 
+ImportTraceWizardPage_BadTraceVersionMsg1=Verify that the directory is a valid LTTng trace directory.
+ImportTraceWizardPage_BadTraceVersionMsg2=Make sure the top directory is the trace itself and not any of its parent.
+NewExperimentDialog_DialogTitle=LTTng Experiment
+NewExperimentDialog_ExperimentLabel=Experiment name: 
+NewFolderDialog_errorTitle=
+NewFolderDialog_internalError=
+NewFolderDialog_progress=
+NewProjectWizard_Description=Create an LTTng Project
+NewProjectWizard_Title=LTTng Project
+TraceErrorDialog_DalogTitle=Trace Selection
+TraceErrorDialog_DialogMsgLabel=Error while opening the trace\! Error message: 
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/Messages.java
new file mode 100644 (file)
index 0000000..63fb853
--- /dev/null
@@ -0,0 +1,24 @@
+package org.eclipse.linuxtools.lttng.ui.views.statistics;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.views.statistics.messages"; //$NON-NLS-1$
+    public static String StatisticsView_CPUTimeColumn;
+    public static String StatisticsView_CPUTimeTip;
+    public static String StatisticsView_CumCPUTimeColumn;
+    public static String StatisticsView_CumCPUTimeTip;
+    public static String StatisticsView_ElapsedTimeColumn;
+    public static String StatisticsView_ElapsedTimeTip;
+    public static String StatisticsView_LevelColumn;
+    public static String StatisticsView_LevelColumnTip;
+    public static String StatisticsView_NbEventsColumn;
+    public static String StatisticsView_NbEventsTip;
+    static {
+       // initialize resource bundle
+       NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
index 6f17dea3ae6112de4967fb651975ea0b7a1c539c..c43e14a73c035e11313dd8842bed9dca81f66689 100644 (file)
@@ -71,29 +71,28 @@ public class StatisticsView extends AbsTimeUpdateView {
        private TreeViewer treeViewer;
 
        // Table column names
-       private final String LEVEL_COLUMN = "Level";
-       private final String EVENTS_COUNT_COLUMN = "Number of Events";
-       private final String CPU_TIME_COLUMN = "CPU Time";
-       private final String CUMULATIVE_CPU_TIME_COLUMN = "Cumulative CPU Time";
-       private final String ELAPSED_TIME_COLUMN = "Elapsed Time";
+       private final String LEVEL_COLUMN = Messages.StatisticsView_LevelColumn;
+       private final String EVENTS_COUNT_COLUMN = Messages.StatisticsView_NbEventsColumn;
+       private final String CPU_TIME_COLUMN = Messages.StatisticsView_CPUTimeColumn;
+       private final String CUMULATIVE_CPU_TIME_COLUMN = Messages.StatisticsView_CumCPUTimeColumn;
+       private final String ELAPSED_TIME_COLUMN = Messages.StatisticsView_ElapsedTimeColumn;
 
        // Table column tooltips
-       private final String LEVEL_COLUMN_TIP = "Level at which statistics apply.";
-       private final String EVENTS_COUNT_COLUMN_TIP = "Total amount of events that are tied to given resource.";
-       private final String CPU_TIME_COLUMN_TIP = "Total amount of time the CPU was used excluding wait times(I/O, etc.) at that level.";
-       private final String CUMULATIVE_CPU_TIME_COLUMN_TIP = "Total amount of time between the first and last event excluding wait times in a level.";
-       private final String ELAPSED_TIME_COLUMN_TIP = "Total amount of time the CPU was used including wait times(I/O, etc.) at that level.";
+       private final String LEVEL_COLUMN_TIP = Messages.StatisticsView_LevelColumnTip;
+       private final String EVENTS_COUNT_COLUMN_TIP = Messages.StatisticsView_NbEventsTip;
+       private final String CPU_TIME_COLUMN_TIP = Messages.StatisticsView_CPUTimeTip;
+       private final String CUMULATIVE_CPU_TIME_COLUMN_TIP = Messages.StatisticsView_CumCPUTimeTip;
+       private final String ELAPSED_TIME_COLUMN_TIP = Messages.StatisticsView_ElapsedTimeTip;
 
        // Level for which statistics should not be displayed.
-       private Set<String> folderLevels = new HashSet<String>(Arrays
-                       .asList(new String[] { "Event Types", "Modes", "Submodes", "CPUs",
-                                       "Processes", "Functions" }));
+       private Set<String> folderLevels = new HashSet<String>(Arrays.asList(
+               new String[] { "Event Types", "Modes", "Submodes", "CPUs", "Processes", "Functions" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
 
        // Levels for which sub-levels should not contain time-related statistics.
-       private Set<String> levelsWithEmptyTime = new HashSet<String>(Arrays
-                       .asList(new String[] { "Event Types" }));
+       private Set<String> levelsWithEmptyTime = new HashSet<String>(Arrays.asList(
+               new String[] { "Event Types" })); //$NON-NLS-1$
 
-       private DecimalFormat decimalFormat = new DecimalFormat("0.#########");
+       private DecimalFormat decimalFormat = new DecimalFormat("0.#########"); //$NON-NLS-1$
        private Cursor fwaitCursor = null;
 
        private static final Long STATS_INPUT_CHANGED_REFRESH = 5000L;
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/messages.properties
new file mode 100644 (file)
index 0000000..aafff50
--- /dev/null
@@ -0,0 +1,10 @@
+StatisticsView_CPUTimeColumn=CPU Time
+StatisticsView_CPUTimeTip=Total amount of time the CPU was used excluding wait times(I/O, etc.) at that level.
+StatisticsView_CumCPUTimeColumn=Cumulative CPU Time
+StatisticsView_CumCPUTimeTip=Total amount of time between the first and last event excluding wait times in a level.
+StatisticsView_ElapsedTimeColumn=Elapsed Time
+StatisticsView_ElapsedTimeTip=Total amount of time the CPU was used including wait times(I/O, etc.) at that level.
+StatisticsView_LevelColumn=Level
+StatisticsView_LevelColumnTip=Level at which statistics apply.
+StatisticsView_NbEventsColumn=Number of Events
+StatisticsView_NbEventsTip=Total amount of events that are tied to given resource.
index fd003be99b8395442b221f694c165e0b57b4e0bd..fc173c585d24ea1166162f15d8a525c9e1bd8d98 100644 (file)
@@ -28,327 +28,389 @@ import org.eclipse.linuxtools.lttng.state.model.LttngTraceState;
  * <h4>Class that process the LTTng kernel events.</h4>
  */
 public class KernelStatisticsData extends StatisticsData {
-       /**
-        * <h4>Header for the mode categories.</h4>
-        */
-       private static final String HEADER_CPUS = "CPUs";
-       /**
-        * <h4>Header for the event types categories.</h4>
-        */
-       private static final String HEADER_EVENT_TYPES = "Event Types";
-       /**
-        * <h4>Header for the function categories.</h4>
-        */
-       private static final String HEADER_FUNCTIONS = "Functions";
-       /**
-        * <h4>Header for the mode categories.</h4>
-        */
-       private static final String HEADER_MODES = "Modes";
-       /**
-        * <h4>Header for the processes categories.</h4>
-        */
-       private static final String HEADER_PROCESSES = "Processes";
-       /**
-        * <h4>Header for the submode categories.</h4>
-        */
-       private static final String HEADER_SUBMODES ="Submodes";
-       /**
-        * <h4>Indicate that it's a value.</h4>
-        * <p>Used when checking the possible child node for a node.</p>
-        * <p>It differentiate a category of a value by being appended to a value.</p>
-        */
-       private static final String NODE = "z";
-       private static final String ROOT_NODE_KEY = mergeString(ROOT.get(0), NODE);
-       /**
-        * <h4>Constructor.</h4>
-        * @param traceName
-        */
-       public KernelStatisticsData(String traceName) {
-               super();
-               Map<String, Set<String>> keys = getKeys();
-               
-               ////////////// Adding category sets
-               keys.put(HEADER_PROCESSES, new HashSet<String>());
-               keys.put(HEADER_MODES, new HashSet<String>());
-               keys.put(HEADER_CPUS, new HashSet<String>(4)); // Over 4 CPUs is not common
-               keys.put(HEADER_SUBMODES, new HashSet<String>());
-               keys.put(HEADER_EVENT_TYPES, new HashSet<String>());
-               keys.put(HEADER_FUNCTIONS, new HashSet<String>(4)); // Seems to be always one.
-               
-               ///////////// Adding value sets
-               // Under a trace
-               Set<String> temp = new HashSet<String>(8);
-               temp.add(HEADER_PROCESSES);
-               temp.add(HEADER_MODES);
-               temp.add(HEADER_CPUS);
-               temp.add(HEADER_EVENT_TYPES);
-               keys.put(ROOT_NODE_KEY, temp);
-               // Under a process
-               temp = new HashSet<String>(4);
-               temp.add(HEADER_MODES);
-               temp.add(HEADER_CPUS);
-               temp.add(HEADER_EVENT_TYPES);
-               keys.put(mergeString(HEADER_PROCESSES,NODE), temp);
-               // Under a CPUs : Functions is a special case
-               temp = new HashSet<String>(4);
-               temp.add(HEADER_MODES);
-               temp.add(HEADER_EVENT_TYPES);
-               keys.put(mergeString(HEADER_CPUS,NODE), temp);
-               // Under a functions
-               temp = new HashSet<String>(4);
-               temp.add(HEADER_MODES);
-               temp.add(HEADER_EVENT_TYPES);
-               keys.put(mergeString(HEADER_FUNCTIONS,NODE), temp);
-               // Under a mode
-               temp = new HashSet<String>(4);
-               temp.add(HEADER_SUBMODES);
-               temp.add(HEADER_EVENT_TYPES);
-               keys.put(mergeString(HEADER_MODES,NODE), temp);
-               // Under a submodes
-               temp = new HashSet<String>(2);
-               temp.add(HEADER_EVENT_TYPES);
-               keys.put(mergeString(HEADER_SUBMODES,NODE), temp);
-               // Under an event type
-               temp = new HashSet<String>(16);
-               keys.put(mergeString(HEADER_EVENT_TYPES,NODE),temp);
-               
-               ////////////// CREATE root
-               keys.put(ROOT.get(0), new HashSet<String>(2)); // 1 trace at the time
-               getOrCreate(ROOT);
-       }
-       /*
-        * (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData#endTraceset(org.eclipse.linuxtools.lttng.event.LttngEvent, org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
-        */
-       @Override
-       public void endTraceset(LttngEvent event, LttngTraceState traceState) {
-               // TODO Should we uncomment the rest?
-               // It include in the cpu time the time between the last event of each cpu and the time of the last global event.
-               // Because we know that there won't be a change of mode or process between those time.
-               /*if(last_ == null)
-                       return;
-               
-               LttngProcessState process = traceState.getRunning_process().get(0L);
-               System.out.println(process.getState().getChange_LttTime());
-               for(long cpu : traceState.getRunning_process().keySet()) {
-                       LttngEventType newType = new LttngEventType(last_.getType().getTracefileName(), cpu, last_.getType().getMarkerName(), last_.getType().getLabels());
-                       last_.setType(newType);
-                       increase(last_, traceState,
-                                       Values.CPU_TIME | Values.CUMULATIVE_CPU_TIME | Values.ELAPSED_TIME | Values.STATE_CUMULATIVE_CPU_TIME);
-                       // TODO Are all those values required?
-               }*/
-       }
+    /**
+     * <h4>Header for the mode categories.</h4>
+     */
+    private static final String HEADER_CPUS = Messages.KernelStatisticsData_CPUs;
+    /**
+     * <h4>Header for the event types categories.</h4>
+     */
+    private static final String HEADER_EVENT_TYPES = Messages.KernelStatisticsData_EventTypes;
+    /**
+     * <h4>Header for the function categories.</h4>
+     */
+    private static final String HEADER_FUNCTIONS = Messages.KernelStatisticsData_Functions;
+    /**
+     * <h4>Header for the mode categories.</h4>
+     */
+    private static final String HEADER_MODES = Messages.KernelStatisticsData_Modes;
+    /**
+     * <h4>Header for the processes categories.</h4>
+     */
+    private static final String HEADER_PROCESSES = Messages.KernelStatisticsData_Processes;
+    /**
+     * <h4>Header for the submode categories.</h4>
+     */
+    private static final String HEADER_SUBMODES = Messages.KernelStatisticsData_SubModes;
+    /**
+     * <h4>Indicate that it's a value.</h4>
+     * <p>
+     * Used when checking the possible child node for a node.
+     * </p>
+     * <p>
+     * It differentiate a category of a value by being appended to a value.
+     * </p>
+     */
+    private static final String NODE = "z"; //$NON-NLS-1$
+    private static final String ROOT_NODE_KEY = mergeString(ROOT.get(0), NODE);
+
+    /**
+     * <h4>Constructor.</h4>
+     * 
+     * @param traceName
+     */
+    public KernelStatisticsData(String traceName) {
+       super();
+       Map<String, Set<String>> keys = getKeys();
+
+       // //////////// Adding category sets
+       keys.put(HEADER_PROCESSES, new HashSet<String>());
+       keys.put(HEADER_MODES, new HashSet<String>());
+       keys.put(HEADER_CPUS, new HashSet<String>(4)); // Over 4 CPUs is not
+                                                      // common
+       keys.put(HEADER_SUBMODES, new HashSet<String>());
+       keys.put(HEADER_EVENT_TYPES, new HashSet<String>());
+       keys.put(HEADER_FUNCTIONS, new HashSet<String>(4)); // Seems to be
+                                                           // always one.
+
+       // /////////// Adding value sets
+       // Under a trace
+       Set<String> temp = new HashSet<String>(8);
+       temp.add(HEADER_PROCESSES);
+       temp.add(HEADER_MODES);
+       temp.add(HEADER_CPUS);
+       temp.add(HEADER_EVENT_TYPES);
+       keys.put(ROOT_NODE_KEY, temp);
+       // Under a process
+       temp = new HashSet<String>(4);
+       temp.add(HEADER_MODES);
+       temp.add(HEADER_CPUS);
+       temp.add(HEADER_EVENT_TYPES);
+       keys.put(mergeString(HEADER_PROCESSES, NODE), temp);
+       // Under a CPUs : Functions is a special case
+       temp = new HashSet<String>(4);
+       temp.add(HEADER_MODES);
+       temp.add(HEADER_EVENT_TYPES);
+       keys.put(mergeString(HEADER_CPUS, NODE), temp);
+       // Under a functions
+       temp = new HashSet<String>(4);
+       temp.add(HEADER_MODES);
+       temp.add(HEADER_EVENT_TYPES);
+       keys.put(mergeString(HEADER_FUNCTIONS, NODE), temp);
+       // Under a mode
+       temp = new HashSet<String>(4);
+       temp.add(HEADER_SUBMODES);
+       temp.add(HEADER_EVENT_TYPES);
+       keys.put(mergeString(HEADER_MODES, NODE), temp);
+       // Under a submodes
+       temp = new HashSet<String>(2);
+       temp.add(HEADER_EVENT_TYPES);
+       keys.put(mergeString(HEADER_SUBMODES, NODE), temp);
+       // Under an event type
+       temp = new HashSet<String>(16);
+       keys.put(mergeString(HEADER_EVENT_TYPES, NODE), temp);
+
+       // //////////// CREATE root
+       keys.put(ROOT.get(0), new HashSet<String>(2)); // 1 trace at the time
+       getOrCreate(ROOT);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
+     * #endTraceset(org.eclipse.linuxtools.lttng.event.LttngEvent,
+     * org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
+     */
+    @Override
+    public void endTraceset(LttngEvent event, LttngTraceState traceState) {
+       // TODO Should we uncomment the rest?
+       // It include in the cpu time the time between the last event of each
+       // cpu and the time of the last global event.
+       // Because we know that there won't be a change of mode or process
+       // between those time.
        /*
-        * (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData#getChildren(org.eclipse.linuxtools.lttng.ui.views.statistics.model.FixedArray)
-        */
-       @Override
-       public Collection<StatisticsTreeNode> getChildren(final FixedArray<String> path) {
-               LinkedList<StatisticsTreeNode> result = new LinkedList<StatisticsTreeNode>();
-               
-               if(path.size() % 2 == 0) { // if we are at a Category
-                       StatisticsTreeNode current = null;
-                       for(String value : getKeys().get(path.get(path.size() - 1))) {
-                               current = get(path.append(value));
-                               if(current != null && current.getValue().nbEvents != 0)
-                                       result.add(current);
-                       }
-               }
-               else if(path.size() == 1) { // Special case.
-                       if(path.equals(ROOT))   // Asking for the root.
-                               for(String value : getKeys().get(ROOT.get(0)))
-                                       result.add(getOrCreate(new FixedArray<String>(value)));
-                       else    // Get value under the root
-                               for (String value : getKeys().get(ROOT_NODE_KEY))
-                                       result.add(getOrCreate(path.append(value)));
-               }
-               else {// If we are at a value
-                       for(String value : getKeys().get(mergeString(path.get(path.size() -2),NODE))) // Search the parent name + NODE
-                               result.add(getOrCreate(path.append(value)));
-                       
-                       if(path.size() == 5 && path.get(3).equals(HEADER_CPUS)) // Special the Functions is just there. We want the fourth element but it start at 0. So #3
-                               result.add(getOrCreate(path.append(HEADER_FUNCTIONS)));
-               }
-               
-               return result;
-       }
-       /**
-        * <h4>Get the standard paths for an event.</h4>
-        * @param event Event to get the path for.
-        * @param traceState State of the trace for this event.
-        * @return Array of FixedArray representing the paths.
+        * if(last_ == null) return;
+        * 
+        * LttngProcessState process = traceState.getRunning_process().get(0L);
+        * System.out.println(process.getState().getChange_LttTime()); for(long
+        * cpu : traceState.getRunning_process().keySet()) { LttngEventType
+        * newType = new LttngEventType(last_.getType().getTracefileName(), cpu,
+        * last_.getType().getMarkerName(), last_.getType().getLabels());
+        * last_.setType(newType); increase(last_, traceState, Values.CPU_TIME |
+        * Values.CUMULATIVE_CPU_TIME | Values.ELAPSED_TIME |
+        * Values.STATE_CUMULATIVE_CPU_TIME); // TODO Are all those values
+        * required? }
         */
-       @SuppressWarnings({ "rawtypes", "unchecked" })
-       private FixedArray<String>[] getNormalPaths(LttngEvent event, LttngTraceState traceState) {
-               String trace = traceState.getContext().getTraceId();
-               Long cpu = event.getCpuId();
-               String cpus = String.valueOf(cpu); 
-               LttngProcessState process = traceState.getRunning_process().get(cpu);
-               String processName = getProcessName(process);   
-               String mode = process.getState().getExec_mode().getInName();
-               String submode = process.getState().getExec_submode();
-               String function = process.getCurrent_function().toString();
-               
-               FixedArray[] paths = {
-                               new FixedArray<String>(trace),
-                               new FixedArray<String>(trace,HEADER_MODES,mode),
-                               new FixedArray<String>(trace,HEADER_MODES,mode,HEADER_SUBMODES,submode),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_CPUS,cpus),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_CPUS,cpus,HEADER_FUNCTIONS,function),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_CPUS,cpus,HEADER_FUNCTIONS,function, HEADER_MODES, mode),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_CPUS,cpus,HEADER_FUNCTIONS,function, HEADER_MODES, mode, HEADER_SUBMODES, submode),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_CPUS,cpus,HEADER_MODES,mode),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_CPUS,cpus,HEADER_MODES,mode,HEADER_SUBMODES,submode),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_MODES,mode),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_MODES,mode,HEADER_SUBMODES,submode),
-                               new FixedArray<String>(trace,HEADER_CPUS,cpus),
-                               new FixedArray<String>(trace,HEADER_CPUS,cpus,HEADER_MODES,mode),
-                               new FixedArray<String>(trace,HEADER_CPUS,cpus,HEADER_MODES,mode,HEADER_SUBMODES,submode),
-                       };
-               
-               return paths;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
+     * #getChildren
+     * (org.eclipse.linuxtools.lttng.ui.views.statistics.model.FixedArray)
+     */
+    @Override
+    public Collection<StatisticsTreeNode> getChildren(final FixedArray<String> path) {
+       LinkedList<StatisticsTreeNode> result = new LinkedList<StatisticsTreeNode>();
+
+       if (path.size() % 2 == 0) { // if we are at a Category
+           StatisticsTreeNode current = null;
+           for (String value : getKeys().get(path.get(path.size() - 1))) {
+               current = get(path.append(value));
+               if (current != null && current.getValue().nbEvents != 0)
+                   result.add(current);
+           }
+       } else if (path.size() == 1) { // Special case.
+           if (path.equals(ROOT)) // Asking for the root.
+               for (String value : getKeys().get(ROOT.get(0)))
+                   result.add(getOrCreate(new FixedArray<String>(value)));
+           else
+               // Get value under the root
+               for (String value : getKeys().get(ROOT_NODE_KEY))
+                   result.add(getOrCreate(path.append(value)));
+       } else {// If we are at a value
+           for (String value : getKeys().get(mergeString(path.get(path.size() - 2), NODE)))
+               // Search the parent name + NODE
+               result.add(getOrCreate(path.append(value)));
+
+           if (path.size() == 5 && path.get(3).equals(HEADER_CPUS)) // Special
+                                                                    // the
+                                                                    // Functions
+                                                                    // is just
+                                                                    // there.
+                                                                    // We want
+                                                                    // the
+                                                                    // fourth
+                                                                    // element
+                                                                    // but it
+                                                                    // start at
+                                                                    // 0. So #3
+               result.add(getOrCreate(path.append(HEADER_FUNCTIONS)));
        }
-       /**
-        * <h4>Get the event types paths.</h4>
-        * @param event Event to get the path for.
-        * @param traceState State of the trace for this event.
-        * @return Array of FixedArray representing the paths.
-        */
-       @SuppressWarnings({ "rawtypes", "unchecked" })
-       private FixedArray<String>[] getTypePaths(LttngEvent event, LttngTraceState traceState) {
-               String trace = traceState.getContext().getTraceId();
-               Long cpu = event.getCpuId();
-               String cpus = String.valueOf(cpu); 
-               LttngProcessState process = traceState.getRunning_process().get(cpu);
-               String processName = getProcessName(process);
-               String mode = process.getState().getExec_mode().getInName();
-               String submode = process.getState().getExec_submode();
-               String function = process.getCurrent_function().toString();
-               //String type = event.getType().getTypeId(); // Add too much informations
-               String type = event.getMarkerName();
-                               
-               FixedArray[] paths = {
-                               new FixedArray<String>(trace,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_MODES,mode,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_MODES,mode,HEADER_SUBMODES,submode,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_CPUS,cpus,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_CPUS,cpus,HEADER_FUNCTIONS,function,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_CPUS,cpus,HEADER_FUNCTIONS,function, HEADER_MODES, mode,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_CPUS,cpus,HEADER_FUNCTIONS,function, HEADER_MODES, mode, HEADER_SUBMODES, submode,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_CPUS,cpus,HEADER_MODES,mode,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_CPUS,cpus,HEADER_MODES,mode,HEADER_SUBMODES,submode,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_MODES,mode,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_PROCESSES,processName,HEADER_MODES,mode,HEADER_SUBMODES,submode,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_CPUS,cpus,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_CPUS,cpus,HEADER_MODES,mode,HEADER_EVENT_TYPES,type),
-                               new FixedArray<String>(trace,HEADER_CPUS,cpus,HEADER_MODES,mode,HEADER_SUBMODES,submode,HEADER_EVENT_TYPES,type),
-                       };
-               
-               return paths;
+
+       return result;
+    }
+
+    /**
+     * <h4>Get the standard paths for an event.</h4>
+     * 
+     * @param event
+     *            Event to get the path for.
+     * @param traceState
+     *            State of the trace for this event.
+     * @return Array of FixedArray representing the paths.
+     */
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    private FixedArray<String>[] getNormalPaths(LttngEvent event, LttngTraceState traceState) {
+       String trace = traceState.getContext().getTraceId();
+       Long cpu = event.getCpuId();
+       String cpus = String.valueOf(cpu);
+       LttngProcessState process = traceState.getRunning_process().get(cpu);
+       String processName = getProcessName(process);
+       String mode = process.getState().getExec_mode().getInName();
+       String submode = process.getState().getExec_submode();
+       String function = process.getCurrent_function().toString();
+
+       FixedArray[] paths = { new FixedArray<String>(trace), new FixedArray<String>(trace, HEADER_MODES, mode), new FixedArray<String>(trace, HEADER_MODES, mode, HEADER_SUBMODES, submode),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName), new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_FUNCTIONS, function),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_FUNCTIONS, function, HEADER_MODES, mode),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_FUNCTIONS, function, HEADER_MODES, mode, HEADER_SUBMODES, submode),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_MODES, mode),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_MODES, mode, HEADER_SUBMODES, submode),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_MODES, mode),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_MODES, mode, HEADER_SUBMODES, submode), new FixedArray<String>(trace, HEADER_CPUS, cpus),
+               new FixedArray<String>(trace, HEADER_CPUS, cpus, HEADER_MODES, mode), new FixedArray<String>(trace, HEADER_CPUS, cpus, HEADER_MODES, mode, HEADER_SUBMODES, submode), };
+
+       return paths;
+    }
+
+    /**
+     * <h4>Get the event types paths.</h4>
+     * 
+     * @param event
+     *            Event to get the path for.
+     * @param traceState
+     *            State of the trace for this event.
+     * @return Array of FixedArray representing the paths.
+     */
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    private FixedArray<String>[] getTypePaths(LttngEvent event, LttngTraceState traceState) {
+       String trace = traceState.getContext().getTraceId();
+       Long cpu = event.getCpuId();
+       String cpus = String.valueOf(cpu);
+       LttngProcessState process = traceState.getRunning_process().get(cpu);
+       String processName = getProcessName(process);
+       String mode = process.getState().getExec_mode().getInName();
+       String submode = process.getState().getExec_submode();
+       String function = process.getCurrent_function().toString();
+       // String type = event.getType().getTypeId(); // Add too much
+       // informations
+       String type = event.getMarkerName();
+
+       FixedArray[] paths = { new FixedArray<String>(trace, HEADER_EVENT_TYPES, type), new FixedArray<String>(trace, HEADER_MODES, mode, HEADER_EVENT_TYPES, type),
+               new FixedArray<String>(trace, HEADER_MODES, mode, HEADER_SUBMODES, submode, HEADER_EVENT_TYPES, type),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_EVENT_TYPES, type),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_EVENT_TYPES, type),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_FUNCTIONS, function, HEADER_EVENT_TYPES, type),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_FUNCTIONS, function, HEADER_MODES, mode, HEADER_EVENT_TYPES, type),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_FUNCTIONS, function, HEADER_MODES, mode, HEADER_SUBMODES, submode, HEADER_EVENT_TYPES, type),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_MODES, mode, HEADER_EVENT_TYPES, type),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_MODES, mode, HEADER_SUBMODES, submode, HEADER_EVENT_TYPES, type),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_MODES, mode, HEADER_EVENT_TYPES, type),
+               new FixedArray<String>(trace, HEADER_PROCESSES, processName, HEADER_MODES, mode, HEADER_SUBMODES, submode, HEADER_EVENT_TYPES, type),
+               new FixedArray<String>(trace, HEADER_CPUS, cpus, HEADER_EVENT_TYPES, type), new FixedArray<String>(trace, HEADER_CPUS, cpus, HEADER_MODES, mode, HEADER_EVENT_TYPES, type),
+               new FixedArray<String>(trace, HEADER_CPUS, cpus, HEADER_MODES, mode, HEADER_SUBMODES, submode, HEADER_EVENT_TYPES, type), };
+
+       return paths;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
+     * #process_exit(org.eclipse.linuxtools.lttng.event.LttngEvent,
+     * org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
+     */
+    @Override
+    public void process_exit(LttngEvent event, LttngTraceState traceState) {
+       FixedArray<String>[] paths = getNormalPaths(event, traceState);
+       Long cpu = event.getCpuId();
+       LttngProcessState process = traceState.getRunning_process().get(cpu);
+
+       for (FixedArray<String> path : paths) {
+           StatisticsTreeNode node = getOrCreate(path);
+
+           if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+               node.getValue().cpuTime += event.getTimestamp().getValue() - process.getState().getChange_LttTime();
+           }
        }
-       /*
-        * (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData#process_exit(org.eclipse.linuxtools.lttng.event.LttngEvent, org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
-        */
-       @Override
-       public void process_exit(LttngEvent event, LttngTraceState traceState) {
-               FixedArray<String>[] paths = getNormalPaths(event,traceState);
-               Long cpu = event.getCpuId();    
-               LttngProcessState process = traceState.getRunning_process().get(cpu);
-               
-               for(FixedArray<String> path : paths) {
-                       StatisticsTreeNode node = getOrCreate(path);
-                               
-                       if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                               node.getValue().cpuTime += event.getTimestamp().getValue() - process.getState().getChange_LttTime();
-                       }
+
+       // TODO Unstacks cumulative CPU time
+       // TODO Elapsed time?
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
+     * #increase(org.eclipse.linuxtools.lttng.event.LttngEvent,
+     * org.eclipse.linuxtools.lttng.state.model.LttngTraceState, int)
+     */
+    @Override
+    public void increase(LttngEvent event, LttngTraceState traceState, int values) {
+       FixedArray<String>[] paths = getNormalPaths(event, traceState);
+       Long cpu = event.getCpuId();
+       LttngProcessState process = traceState.getRunning_process().get(cpu);
+
+       for (FixedArray<String> path : paths) {
+           StatisticsTreeNode node = getOrCreate(path);
+
+           if ((values & Values.CPU_TIME) != 0) {
+               // TODO Uncomment if the event after process_exit need to be
+               // count.
+               if ((process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) /*
+                                                                                              * ||
+                                                                                              * process
+                                                                                              * .
+                                                                                              * getState
+                                                                                              * (
+                                                                                              * )
+                                                                                              * .
+                                                                                              * getProc_status
+                                                                                              * (
+                                                                                              * )
+                                                                                              * .
+                                                                                              * equals
+                                                                                              * (
+                                                                                              * ProcessStatus
+                                                                                              * .
+                                                                                              * LTTV_STATE_EXIT
+                                                                                              * )
+                                                                                              */) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+                   node.getValue().cpuTime += event.getTimestamp().getValue() - process.getState().getChange_LttTime();
                }
-               
-               // TODO Unstacks cumulative CPU time
-               // TODO Elapsed time?
-       }
-       /*
-        * (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData#increase(org.eclipse.linuxtools.lttng.event.LttngEvent, org.eclipse.linuxtools.lttng.state.model.LttngTraceState, int)
-        */
-       @Override
-       public void increase(LttngEvent event, LttngTraceState traceState, int values) {
-               FixedArray<String>[] paths = getNormalPaths(event, traceState);
-               Long cpu = event.getCpuId();    
-               LttngProcessState process = traceState.getRunning_process().get(cpu);
-               
-               for(FixedArray<String> path : paths)
-               {
-                       StatisticsTreeNode node = getOrCreate(path);
-                               
-                       if((values & Values.CPU_TIME) != 0) {
-                               // TODO Uncomment if the event after process_exit need to be count.
-                               if ((process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) /*|| process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_EXIT)*/) &&
-                                               !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                                       node.getValue().cpuTime += event.getTimestamp().getValue() - process.getState().getChange_LttTime();
-                               }
-                       }
-                       if((values & Values.CUMULATIVE_CPU_TIME) != 0) {
-                               if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                                       long cumulativeCpuTime = process.getState().getCum_cpu_time();
-                                       long delta = event.getTimestamp().getValue() - process.getState().getEntry_LttTime();
-                                       process.getState().setCum_cpu_time(cumulativeCpuTime + delta);
-                                       node.getValue().cumulativeCpuTime += process.getState().getCum_cpu_time();
-                               }
-                               else if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) &&
-                                               !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                                       long cumulativeCpuTime = process.getState().getCum_cpu_time();
-                                       long delta = event.getTimestamp().getValue() - process.getState().getChange_LttTime();
-                                       process.getState().setCum_cpu_time(cumulativeCpuTime + delta);
-                                       node.getValue().cumulativeCpuTime += process.getState().getCum_cpu_time();
-                               }
-                       }
-                       if((values & Values.ELAPSED_TIME) != 0) {
-                               if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                                       node.getValue().elapsedTime += event.getTimestamp().getValue()
-                                               - process.getState().getEntry_LttTime();
-                               }
-                       }
-                       if((values & Values.STATE_CUMULATIVE_CPU_TIME) != 0) {
-                               if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) &&
-                                               !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                                       long cumulativeCpuTime = process.getState().getCum_cpu_time();
-                                       long delta = event.getTimestamp().getValue() - process.getState().getChange_LttTime();
-                                       process.getState().setCum_cpu_time(cumulativeCpuTime + delta);
-                               }
-                       }
+           }
+           if ((values & Values.CUMULATIVE_CPU_TIME) != 0) {
+               if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+                   long cumulativeCpuTime = process.getState().getCum_cpu_time();
+                   long delta = event.getTimestamp().getValue() - process.getState().getEntry_LttTime();
+                   process.getState().setCum_cpu_time(cumulativeCpuTime + delta);
+                   node.getValue().cumulativeCpuTime += process.getState().getCum_cpu_time();
+               } else if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+                   long cumulativeCpuTime = process.getState().getCum_cpu_time();
+                   long delta = event.getTimestamp().getValue() - process.getState().getChange_LttTime();
+                   process.getState().setCum_cpu_time(cumulativeCpuTime + delta);
+                   node.getValue().cumulativeCpuTime += process.getState().getCum_cpu_time();
                }
-       }
-       /*
-        * (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData#registerEvent(org.eclipse.linuxtools.lttng.event.LttngEvent, org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
-        */
-       @Override
-       public void registerEvent(LttngEvent event, LttngTraceState traceState) {
-               FixedArray<String>[] paths = getNormalPaths(event, traceState);
-               for(FixedArray<String> path : paths)
-                       ++(getOrCreate(path).getValue().nbEvents);
-               
-               paths = getTypePaths(event, traceState);
-               for(FixedArray<String> path : paths)
-                       ++(getOrCreate(path).getValue().nbEvents);
-               
-               //last_ = event; // TODO Used by endTraceset
-       }
-       /*
-        * (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData#registerName(org.eclipse.linuxtools.lttng.ui.views.statistics.model.FixedArray)
-        */
-       @Override
-       protected void registerName(final FixedArray<String> path) {
-               if(path.size() == 1) {
-                       if(!path.equals(ROOT))
-                               getKeys().get(ROOT.get(0)).add(path.get(0));
+           }
+           if ((values & Values.ELAPSED_TIME) != 0) {
+               if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+                   node.getValue().elapsedTime += event.getTimestamp().getValue() - process.getState().getEntry_LttTime();
                }
-               else if(path.size() % 2 != 0)
-                       getKeys().get(path.get(path.size() - 2)).add(path.get(path.size() - 1));
+           }
+           if ((values & Values.STATE_CUMULATIVE_CPU_TIME) != 0) {
+               if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+                   long cumulativeCpuTime = process.getState().getCum_cpu_time();
+                   long delta = event.getTimestamp().getValue() - process.getState().getChange_LttTime();
+                   process.getState().setCum_cpu_time(cumulativeCpuTime + delta);
+               }
+           }
        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
+     * #registerEvent(org.eclipse.linuxtools.lttng.event.LttngEvent,
+     * org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
+     */
+    @Override
+    public void registerEvent(LttngEvent event, LttngTraceState traceState) {
+       FixedArray<String>[] paths = getNormalPaths(event, traceState);
+       for (FixedArray<String> path : paths)
+           ++(getOrCreate(path).getValue().nbEvents);
+
+       paths = getTypePaths(event, traceState);
+       for (FixedArray<String> path : paths)
+           ++(getOrCreate(path).getValue().nbEvents);
+
+       // last_ = event; // TODO Used by endTraceset
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
+     * #registerName
+     * (org.eclipse.linuxtools.lttng.ui.views.statistics.model.FixedArray)
+     */
+    @Override
+    protected void registerName(final FixedArray<String> path) {
+       if (path.size() == 1) {
+           if (!path.equals(ROOT))
+               getKeys().get(ROOT.get(0)).add(path.get(0));
+       } else if (path.size() % 2 != 0)
+           getKeys().get(path.get(path.size() - 2)).add(path.get(path.size() - 1));
+    }
 
 }
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/Messages.java
new file mode 100644 (file)
index 0000000..e699fa8
--- /dev/null
@@ -0,0 +1,21 @@
+package org.eclipse.linuxtools.lttng.ui.views.statistics.model;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.views.statistics.model.messages"; //$NON-NLS-1$
+    public static String KernelStatisticsData_CPUs;
+    public static String KernelStatisticsData_EventTypes;
+    public static String KernelStatisticsData_Functions;
+    public static String KernelStatisticsData_Modes;
+    public static String KernelStatisticsData_Processes;
+    public static String KernelStatisticsData_SubModes;
+    public static String StatisticsData_UnknowProcess;
+    static {
+       // initialize resource bundle
+       NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
index 0e61b3c80c115266030025db046ad92c2df45e1e..d2b6c7818c46492ebd706bfe3d13131dffd25b21 100644 (file)
@@ -23,195 +23,274 @@ import org.eclipse.linuxtools.lttng.state.model.LttngTraceState;
 
 /**
  * <h4>Base class for the statistics storage.</h4>
- * <p>It allow to implement a tree structure while avoiding the need to run through the tree each time you need to add a node at a given place.</p>
+ * <p>
+ * It allow to implement a tree structure while avoiding the need to run through
+ * the tree each time you need to add a node at a given place.
+ * </p>
  */
 public abstract class StatisticsData {
+    /**
+     * <h4>Define values that can be used like a C++ enumeration.</h4>
+     * <p>
+     * The values can be used with binary "or" and "and" to mix them.
+     * </p>
+     */
+    public static class Values {
        /**
-        * <h4>Define values that can be used like a C++ enumeration.</h4>
-        * <p>The values can be used with binary "or" and "and" to mix them.</p>
+        * <h4>Indicate the cpu time</h4>
+        * <p>
+        * The actual time the cpu as passed in this state making calculations.
+        * </p>
         */
-       public static class Values {
-               /**
-                * <h4>Indicate the cpu time</h4>
-                * <p>The actual time the cpu as passed in this state making calculations.</p>
-                */
-               public static final int CPU_TIME = 1;
-               /**
-                * <h4>Indicate the cumulative cpu time</h4>
-                * <p>Include the time the cpu as passed in this state and substate.</p>
-                * <p>Example:
-                * <ul>
-                *              <li>PID:1, Mode:USER_MODE</li>
-                *              <ul>
-                *                      <li>PID:1, Mode:SYSCALL</li>
-                *              </ul>
-                *              <li>PID:2, Mode:USER_MODE</li>
-                * </ul>
-                * </p>
-                * <p>In this example, the cumulative cpu time for "PID:1, Mode:USER_MODE" would 
-                * be equal to its cpu time plus the cpu time of "PID:1, Mode:SYSCALL".</p>
-                * TODO Validate values. Not tested in LTTv.
-                * TODO Validate description.
-                */
-               public static final int CUMULATIVE_CPU_TIME = 2;
-               /**
-                * <h4>Elapsed time</h4>
-                * <p>Description...</p>
-                * TODO Give a correct description.
-                */
-               public static final int ELAPSED_TIME = 4;
-               /**
-                * <h4>State cumulative cpu time</h4>
-                * <p>Description...</p>
-                * TODO Give a correct description.
-                */
-               public static final int STATE_CUMULATIVE_CPU_TIME = 8;
-       }
-       /**
-        * <h4>String builder used to merge string with more efficacy.</h4>
-        */
-       protected static StringBuilder fBuilder = new StringBuilder();
-       /**
-        * <h4>Identification of the root.</h4>
-        */
-       public static final FixedArray<String> ROOT = new FixedArray<String>("root"); //$NON-NLS-1$
-       /**
-        * <h4>Function to merge many string with more efficacy.</h4>
-        * @param strings Strings to merge.
-        * @return A new string containing all the strings.
-        */
-       protected synchronized static String mergeString(String...strings) {
-               fBuilder.setLength(0);
-               for(String s : strings)
-                       fBuilder.append(s);
-               return fBuilder.toString();
-       }
-       /**
-        * <h4>Define what child a node can have. </h4>
-        * <p>The management and usage of this map is done by subclass.</p>
-        * <p>HashSet are always faster than TreeSet.</p>
-        */
-       private Map<String, Set<String>> fKeys;
-       /**
-        * <h4>The nodes in the tree.</f4>
-        */
-       private HashMap<FixedArray<String>, StatisticsTreeNode> fNodes;
-       /**
-        * <h4>Constructor.</h4>
-        */
-       public StatisticsData() {
-               fNodes = new HashMap<FixedArray<String>,StatisticsTreeNode>();
-               fKeys  = new HashMap<String, Set<String>>();
-       }
+       public static final int CPU_TIME = 1;
        /**
-        * <h4>Indicate the end of the traceset</4>
-        * <p>Can be used to trigger necessary calculations.</p>
-        * @param event Event receive (May have timestamp of 0).
-        * @param traceState State of the trace at that moment.
+        * <h4>Indicate the cumulative cpu time</h4>
+        * <p>
+        * Include the time the cpu as passed in this state and substate.
+        * </p>
+        * <p>
+        * Example:
+        * <ul>
+        * <li>PID:1, Mode:USER_MODE</li>
+        * <ul>
+        * <li>PID:1, Mode:SYSCALL</li>
+        * </ul>
+        * <li>PID:2, Mode:USER_MODE</li>
+        * </ul>
+        * </p>
+        * <p>
+        * In this example, the cumulative cpu time for "PID:1, Mode:USER_MODE"
+        * would be equal to its cpu time plus the cpu time of
+        * "PID:1, Mode:SYSCALL".
+        * </p>
+        * TODO Validate values. Not tested in LTTv. TODO Validate description.
         */
-       public abstract void endTraceset(LttngEvent event, LttngTraceState traceState);
+       public static final int CUMULATIVE_CPU_TIME = 2;
        /**
-        * <h4>Get a node.</h4>
-        * @param path Path to the node.
-        * @return The node or null.
+        * <h4>Elapsed time</h4>
+        * <p>
+        * Description...
+        * </p>
+        * TODO Give a correct description.
         */
-       public StatisticsTreeNode get(final FixedArray<String> path) {
-               return fNodes.get(path);
-       }
+       public static final int ELAPSED_TIME = 4;
        /**
-        * <h4>Get the children of a node.</h4>
-        * @param path Path to the node.
-        * @return Collection containing the children.
+        * <h4>State cumulative cpu time</h4>
+        * <p>
+        * Description...
+        * </p>
+        * TODO Give a correct description.
         */
-       public abstract Collection<StatisticsTreeNode> getChildren(final FixedArray<String> path);
-       /**
-        * <h4>Get the map of existing elements of path classified by parent.</h4>
-        * @return The map.
-        */
-       protected Map<String, Set<String>> getKeys() {
-               return fKeys;
-       }
-       /**
-        * <h4>Get or create a node.</h4>
-        * @param path Path to the node.
-        * @return The node.
-        */
-       public StatisticsTreeNode getOrCreate(final FixedArray<String> path) {
-               StatisticsTreeNode current = fNodes.get(path);
-               if(current == null) {
-                       registerName(path);
-                       current = new StatisticsTreeNode(path,this);
-                       fNodes.put(path, current);
-               }
-               return current;
-       }
-       /**
-        * <h4>Get the parent of a node.</h4>
-        * @param path Path to the node.
-        * @return Parent node or null.
-        */
-       public StatisticsTreeNode getParent(final FixedArray<String> path) {
-               if(path.size() == 1) {
-                       if(path.equals(ROOT))
-                               return null;
-                       else
-                               return get(ROOT);
-               }
-                // TODO Get or GetOrCreate?
-               return get(path.subArray(0,path.size()-1));
+       public static final int STATE_CUMULATIVE_CPU_TIME = 8;
+    }
+
+    /**
+     * <h4>String builder used to merge string with more efficacy.</h4>
+     */
+    protected static StringBuilder fBuilder = new StringBuilder();
+    /**
+     * <h4>Identification of the root.</h4>
+     */
+    public static final FixedArray<String> ROOT = new FixedArray<String>("root"); //$NON-NLS-1$
+
+    /**
+     * <h4>Function to merge many string with more efficacy.</h4>
+     * 
+     * @param strings
+     *            Strings to merge.
+     * @return A new string containing all the strings.
+     */
+    protected synchronized static String mergeString(String... strings) {
+       fBuilder.setLength(0);
+       for (String s : strings)
+           fBuilder.append(s);
+       return fBuilder.toString();
+    }
+
+    /**
+     * <h4>Define what child a node can have.</h4>
+     * <p>
+     * The management and usage of this map is done by subclass.
+     * </p>
+     * <p>
+     * HashSet are always faster than TreeSet.
+     * </p>
+     */
+    private Map<String, Set<String>> fKeys;
+    /**
+     * <h4>The nodes in the tree.</f4>
+     */
+    private HashMap<FixedArray<String>, StatisticsTreeNode> fNodes;
+
+    /**
+     * <h4>Constructor.</h4>
+     */
+    public StatisticsData() {
+       fNodes = new HashMap<FixedArray<String>, StatisticsTreeNode>();
+       fKeys = new HashMap<String, Set<String>>();
+    }
+
+    /**
+     * <h4>Indicate the end of the traceset</4>
+     * <p>
+     * Can be used to trigger necessary calculations.
+     * </p>
+     * 
+     * @param event
+     *            Event receive (May have timestamp of 0).
+     * @param traceState
+     *            State of the trace at that moment.
+     */
+    public abstract void endTraceset(LttngEvent event, LttngTraceState traceState);
+
+    /**
+     * <h4>Get a node.</h4>
+     * 
+     * @param path
+     *            Path to the node.
+     * @return The node or null.
+     */
+    public StatisticsTreeNode get(final FixedArray<String> path) {
+       return fNodes.get(path);
+    }
+
+    /**
+     * <h4>Get the children of a node.</h4>
+     * 
+     * @param path
+     *            Path to the node.
+     * @return Collection containing the children.
+     */
+    public abstract Collection<StatisticsTreeNode> getChildren(final FixedArray<String> path);
+
+    /**
+     * <h4>Get the map of existing elements of path classified by parent.</h4>
+     * 
+     * @return The map.
+     */
+    protected Map<String, Set<String>> getKeys() {
+       return fKeys;
+    }
+
+    /**
+     * <h4>Get or create a node.</h4>
+     * 
+     * @param path
+     *            Path to the node.
+     * @return The node.
+     */
+    public StatisticsTreeNode getOrCreate(final FixedArray<String> path) {
+       StatisticsTreeNode current = fNodes.get(path);
+       if (current == null) {
+           registerName(path);
+           current = new StatisticsTreeNode(path, this);
+           fNodes.put(path, current);
        }
-       /**
-        * <h4>Get the name of a process.</h4>
-        * @param process The process.
-        * @return The name of the process.
-        * //TODO Adding the creation time of the process may be needed to differentiate two process.
-        */
-       protected String getProcessName(LttngProcessState process) {
-               if(process.getPid() == -1)
-                       return "Unknown process";
-               if(process.getName() == null)
-                       return mergeString("Unknown process - ", String.valueOf(process.getPid()));
-               if(process.getName().equals("")) //$NON-NLS-1$
-                       return process.getPid().toString();
-               else
-                       return mergeString(process.getName(), " - ",String.valueOf(process.getPid())); //$NON-NLS-1$
+       return current;
+    }
+
+    /**
+     * <h4>Get the parent of a node.</h4>
+     * 
+     * @param path
+     *            Path to the node.
+     * @return Parent node or null.
+     */
+    public StatisticsTreeNode getParent(final FixedArray<String> path) {
+       if (path.size() == 1) {
+           if (path.equals(ROOT))
+               return null;
+           else
+               return get(ROOT);
        }
-       /**
-        * <h4>Increase some values.</h4>
-        * <p>Values is an binary or operation on the desired values between {@link Values#CPU_TIME}, {@link Values#CUMULATIVE_CPU_TIME}, {@link Values#ELAPSED_TIME} and {@link Values#STATE_CUMULATIVE_CPU_TIME} .
-        * @param event Current event.
-        * @param traceState State of the trace at that moment.
-        * @param values Values desired.
-        */
-       public abstract void increase(LttngEvent event, LttngTraceState traceState, int values);
-       /**
-        * <h4>Register an event.</h4>
-        * <p>This method must be implemented by subclass.</p>
-        * @param event Event to process.
-        * @param traceState State of the trace at the moment of the event.
-        */
-       public abstract void registerEvent(LttngEvent event, LttngTraceState traceState);
-       /**
-        * <h4>Register that a new node was created.</h4>
-        * <p>Must make sure the {@link #getChildren(FixedArray)} on the parent node will return the newly created node.</p>
-        * @param path Path of the new node.
-        */
-       protected abstract void registerName(final FixedArray<String> path);
-       /**
-        * <h4>Reset a node.</h4>
-        * <p>Work recursively.</p>
-        * @param path Path to the node.
-        */
-       public void reset(final FixedArray<String> path) {
-               for(StatisticsTreeNode node : getChildren(path)) {
-                       reset(node.getPath());
-                       fNodes.remove(node.getPath());
-               }
+       // TODO Get or GetOrCreate?
+       return get(path.subArray(0, path.size() - 1));
+    }
+
+    /**
+     * <h4>Get the name of a process.</h4>
+     * 
+     * @param process
+     *            The process.
+     * @return The name of the process. //TODO Adding the creation time of the
+     *         process may be needed to differentiate two process.
+     */
+    protected String getProcessName(LttngProcessState process) {
+       if (process.getPid() == -1)
+           return Messages.StatisticsData_UnknowProcess;
+       if (process.getName() == null)
+           return mergeString(Messages.StatisticsData_UnknowProcess + " - ", String.valueOf(process.getPid())); //$NON-NLS-1$
+       if (process.getName().equals("")) //$NON-NLS-1$
+           return process.getPid().toString();
+       else
+           return mergeString(process.getName(), " - ", String.valueOf(process.getPid())); //$NON-NLS-1$
+    }
+
+    /**
+     * <h4>Increase some values.</h4>
+     * <p>
+     * Values is an binary or operation on the desired values between
+     * {@link Values#CPU_TIME}, {@link Values#CUMULATIVE_CPU_TIME},
+     * {@link Values#ELAPSED_TIME} and {@link Values#STATE_CUMULATIVE_CPU_TIME}
+     * .
+     * 
+     * @param event
+     *            Current event.
+     * @param traceState
+     *            State of the trace at that moment.
+     * @param values
+     *            Values desired.
+     */
+    public abstract void increase(LttngEvent event, LttngTraceState traceState, int values);
+
+    /**
+     * <h4>Register an event.</h4>
+     * <p>
+     * This method must be implemented by subclass.
+     * </p>
+     * 
+     * @param event
+     *            Event to process.
+     * @param traceState
+     *            State of the trace at the moment of the event.
+     */
+    public abstract void registerEvent(LttngEvent event, LttngTraceState traceState);
+
+    /**
+     * <h4>Register that a new node was created.</h4>
+     * <p>
+     * Must make sure the {@link #getChildren(FixedArray)} on the parent node
+     * will return the newly created node.
+     * </p>
+     * 
+     * @param path
+     *            Path of the new node.
+     */
+    protected abstract void registerName(final FixedArray<String> path);
+
+    /**
+     * <h4>Reset a node.</h4>
+     * <p>
+     * Work recursively.
+     * </p>
+     * 
+     * @param path
+     *            Path to the node.
+     */
+    public void reset(final FixedArray<String> path) {
+       for (StatisticsTreeNode node : getChildren(path)) {
+           reset(node.getPath());
+           fNodes.remove(node.getPath());
        }
-       /**
-        * Indicate that the process is finishing.
-        * @param event The event indicating the end of the process.
-        * @param traceState State of the trace at that moment.
-        */
-       public abstract void process_exit(LttngEvent event, LttngTraceState traceState);
+    }
+
+    /**
+     * Indicate that the process is finishing.
+     * 
+     * @param event
+     *            The event indicating the end of the process.
+     * @param traceState
+     *            State of the trace at that moment.
+     */
+    public abstract void process_exit(LttngEvent event, LttngTraceState traceState);
 }
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/messages.properties
new file mode 100644 (file)
index 0000000..7e88de5
--- /dev/null
@@ -0,0 +1,7 @@
+KernelStatisticsData_CPUs=CPUs
+KernelStatisticsData_EventTypes=Event Types
+KernelStatisticsData_Functions=Functions
+KernelStatisticsData_Modes=Modes
+KernelStatisticsData_Processes=Processes
+KernelStatisticsData_SubModes=Submodes
+StatisticsData_UnknowProcess=Unknown process
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/Messages.java
new file mode 100644 (file)
index 0000000..8535011
--- /dev/null
@@ -0,0 +1,18 @@
+package org.eclipse.linuxtools.lttng.ui.views.timeframe;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.views.timeframe.messages"; //$NON-NLS-1$
+    public static String TimeFrameView_CurrentTime;
+    public static String TimeFrameView_WindowEndTime;
+    public static String TimeFrameView_WindowRange;
+    public static String TimeFrameView_WindowStartTime;
+    static {
+       // initialize resource bundle
+       NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
index 373b99e3ffb9591e83b309c00ef117d483f56d69..c21a8740b9350663c6114e9e57019f2edb2813e6 100644 (file)
@@ -34,16 +34,15 @@ import org.eclipse.swt.widgets.Slider;
  * <b><u>TimeFrameView</u></b>
  * <p>
  * The TimeFrameView provides a set of spinners to monitor and set the start
- * time, end time, the current time interval and current time of the trace
- * set at the nanosecond level.
+ * time, end time, the current time interval and current time of the trace set
+ * at the nanosecond level.
  * <p>
  * It ensures that the following relations are always true:
  * <p>
  * <li>[ startTime >= start time of the trace ]
  * <li>[ endTime <= end time of the trace ]
  * <li>[ startTime <= currentTime <= endTime ]
- * <li>[ interval == (endTime - startTime) ]
- * </li>
+ * <li>[ interval == (endTime - startTime) ]</li>
  * <p>
  * It provides a slider to rapidly set the current time within the time range
  * (i.e. between startTime and endTime).
@@ -58,25 +57,25 @@ public class TimeFrameView extends TmfView {
 
     public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.timeframe"; //$NON-NLS-1$
 
-    // ========================================================================
+    // ------------------------------------------------------------------------
     // TimeFrameView
-    // ========================================================================
+    // ------------------------------------------------------------------------
 
     // The event log timestamp characteristics
     private TmfTimestamp fTraceStartTime = new TmfTimestamp();
-    private TmfTimestamp fTraceEndTime   = new TmfTimestamp();
+    private TmfTimestamp fTraceEndTime = new TmfTimestamp();
+
+    private TmfTimestamp fCurrentTime = new TmfTimestamp();
 
-    private TmfTimestamp fCurrentTime   = new TmfTimestamp();
-    
     private TmfTimeRange fTraceTimeRange = new TmfTimeRange(fTraceStartTime, fTraceEndTime);
-    private TmfTimeRange fTraceSpan      = new TmfTimeRange(fTraceStartTime, fTraceEndTime);
+    private TmfTimeRange fTraceSpan = new TmfTimeRange(fTraceStartTime, fTraceEndTime);
     private byte fScale = 0;
 
     // Labels
-    private static final String START_TIME_LABEL   = "Window Start Time";
-    private static final String END_TIME_LABEL     = "Window End Time";
-    private static final String TIME_RANGE_LABEL   = "Window Range";
-    private static final String CURRENT_TIME_LABEL = "Current Time";
+    private static final String START_TIME_LABEL   = Messages.TimeFrameView_WindowStartTime;
+    private static final String END_TIME_LABEL     = Messages.TimeFrameView_WindowEndTime;
+    private static final String TIME_RANGE_LABEL   = Messages.TimeFrameView_WindowRange;
+    private static final String CURRENT_TIME_LABEL = Messages.TimeFrameView_CurrentTime;
 
     private static final int SLIDER_RANGE = 10000;
 
@@ -90,147 +89,156 @@ public class TimeFrameView extends TmfView {
 
     // The current experiment
     TmfExperiment<LttngEvent> fExperiment = null;
-       // notify external listeners may not be needed if the update originated
-       // externally
-       private boolean fupdateExternalListeners = true;
 
+    // notify external listeners may not be needed if the update originated externally
+    private boolean fupdateExternalListeners = true;
 
+    // ------------------------------------------------------------------------
+    // Constructor
+    // ------------------------------------------------------------------------
+    
     /**
      * Constructor
      */
     public TimeFrameView() {
-       super("TimeFrameView");
+       super("TimeFrameView"); //$NON-NLS-1$
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
+     * .Composite)
      */
-       @Override
-       public void createPartControl(Composite parent) {
+    @Override
+    public void createPartControl(Composite parent) {
 
-        // Set the view layout
-        GridLayout layout = new GridLayout(4, true);
-        parent.setLayout(layout);
+       // Set the view layout
+       GridLayout layout = new GridLayout(4, true);
+       parent.setLayout(layout);
 
-        fStartGroup   = new SpinnerGroup(this, parent, START_TIME_LABEL,   fTraceTimeRange, fTraceStartTime);
-        fEndGroup     = new SpinnerGroup(this, parent, END_TIME_LABEL,     fTraceTimeRange, fTraceEndTime);
-        fRangeGroup   = new SpinnerGroup(this, parent, TIME_RANGE_LABEL,   fTraceTimeRange, fTraceEndTime);
-        fCurrentGroup = new SpinnerGroup(this, parent, CURRENT_TIME_LABEL, fTraceTimeRange, fTraceStartTime);
+       fStartGroup = new SpinnerGroup(this, parent, START_TIME_LABEL, fTraceTimeRange, fTraceStartTime);
+       fEndGroup = new SpinnerGroup(this, parent, END_TIME_LABEL, fTraceTimeRange, fTraceEndTime);
+       fRangeGroup = new SpinnerGroup(this, parent, TIME_RANGE_LABEL, fTraceTimeRange, fTraceEndTime);
+       fCurrentGroup = new SpinnerGroup(this, parent, CURRENT_TIME_LABEL, fTraceTimeRange, fTraceStartTime);
 
-        // Create the slider
-        createSlider(parent);
+       // Create the slider
+       createSlider(parent);
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
      */
-       @Override
-       public void setFocus() {
-        // TODO Auto-generated method stub
+    @Override
+    public void setFocus() {
+       // TODO Auto-generated method stub
     }
 
-    // ========================================================================
+    // ------------------------------------------------------------------------
     // Operators
-    // ========================================================================
+    // ------------------------------------------------------------------------
 
     /**
      * One of the spinners has been updated. Synchronize the other widgets.
      */
     public void synchTimeFrameWidgets(SpinnerGroup trigger) {
-               boolean trangeUpdated = false;
-
-        // Collect the data
-        TmfTimestamp startTime   = fStartGroup.getCurrentTime();
-        TmfTimestamp endTime     = fEndGroup.getCurrentTime();
-        TmfTimestamp timeRange   = fRangeGroup.getCurrentTime();
-        TmfTimestamp currentTime = fCurrentGroup.getCurrentTime();
-
-        // If startTime was set beyond endTime, adjust endTime and interval
-        if (trigger == fStartGroup) {
-            if (startTime.compareTo(endTime, false) > 0) {
-                endTime = startTime;
-                               trangeUpdated = true;
-            }
-        }
-
-        // If endTime was set beyond startTime, adjust startTime and interval
-        if (trigger == fEndGroup) {
-            if (endTime.compareTo(startTime, false) < 0) {
-                startTime = endTime;
-                               trangeUpdated = true;
-            }
-        }
-
-        // If timeRange was set, adjust endTime
-        if (trigger == fRangeGroup) {
-            long start = startTime.getValue();
-            long span  = timeRange.getValue();
-            TmfTimestamp ts = new TmfTimestamp(start + span, startTime.getScale(), 0);
-            if (ts.compareTo(fTraceEndTime, false) > 0) {
-                ts = fTraceEndTime.synchronize(fTraceEndTime.getValue(), startTime.getScale());
-            }
-            endTime = ts;
-                       trangeUpdated = true;
-        }
-
-        // Compute the new time range
-        TmfTimeRange subrange = new TmfTimeRange(startTime, endTime);
-        byte scale = startTime.getScale();
-        TmfTimestamp interval = new TmfTimestamp(startTime.getAdjustment(endTime, scale), scale, 0);
-
-        // Update the spinner groups
-        fStartGroup.setContent(fTraceTimeRange, startTime);
-        fEndGroup.setContent(fTraceTimeRange, endTime);
-        fRangeGroup.setContent(fTraceSpan, interval);
-        fCurrentGroup.setContent(subrange, currentTime);
-
-        updateSlider(subrange, currentTime);
-               // Notify other views, only if the update originated from this view
-               if (fupdateExternalListeners) {
-                       if (!fCurrentTime.equals(currentTime)) {
-                               fCurrentTime = currentTime;
-                               broadcast(new TmfTimeSynchSignal(this, currentTime));
-                       }
-
-                       // Notify the views if the time range has been impacted
-                       if (trangeUpdated) {
-                               TmfTimeRange trange = new TmfTimeRange(startTime, endTime);
-                               broadcast(new TmfRangeSynchSignal(this, trange, currentTime));
-                       }
-        }
+       boolean trangeUpdated = false;
+
+       // Collect the data
+       TmfTimestamp startTime = fStartGroup.getCurrentTime();
+       TmfTimestamp endTime = fEndGroup.getCurrentTime();
+       TmfTimestamp timeRange = fRangeGroup.getCurrentTime();
+       TmfTimestamp currentTime = fCurrentGroup.getCurrentTime();
+
+       // If startTime was set beyond endTime, adjust endTime and interval
+       if (trigger == fStartGroup) {
+           if (startTime.compareTo(endTime, false) > 0) {
+               endTime = startTime;
+               trangeUpdated = true;
+           }
+       }
+
+       // If endTime was set beyond startTime, adjust startTime and interval
+       if (trigger == fEndGroup) {
+           if (endTime.compareTo(startTime, false) < 0) {
+               startTime = endTime;
+               trangeUpdated = true;
+           }
+       }
+
+       // If timeRange was set, adjust endTime
+       if (trigger == fRangeGroup) {
+           long start = startTime.getValue();
+           long span = timeRange.getValue();
+           TmfTimestamp ts = new TmfTimestamp(start + span, startTime.getScale(), 0);
+           if (ts.compareTo(fTraceEndTime, false) > 0) {
+               ts = fTraceEndTime.synchronize(fTraceEndTime.getValue(), startTime.getScale());
+           }
+           endTime = ts;
+           trangeUpdated = true;
+       }
+
+       // Compute the new time range
+       TmfTimeRange subrange = new TmfTimeRange(startTime, endTime);
+       byte scale = startTime.getScale();
+       TmfTimestamp interval = new TmfTimestamp(startTime.getAdjustment(endTime, scale), scale, 0);
+
+       // Update the spinner groups
+       fStartGroup.setContent(fTraceTimeRange, startTime);
+       fEndGroup.setContent(fTraceTimeRange, endTime);
+       fRangeGroup.setContent(fTraceSpan, interval);
+       fCurrentGroup.setContent(subrange, currentTime);
+
+       updateSlider(subrange, currentTime);
+       // Notify other views, only if the update originated from this view
+       if (fupdateExternalListeners) {
+           if (!fCurrentTime.equals(currentTime)) {
+               fCurrentTime = currentTime;
+               broadcast(new TmfTimeSynchSignal(this, currentTime));
+           }
+
+           // Notify the views if the time range has been impacted
+           if (trangeUpdated) {
+               TmfTimeRange trange = new TmfTimeRange(startTime, endTime);
+               broadcast(new TmfRangeSynchSignal(this, trange, currentTime));
+           }
+       }
     }
 
-    // ========================================================================
+    // ------------------------------------------------------------------------
     // Slider Handling
-    // ========================================================================
+    // ------------------------------------------------------------------------
 
     /**
      * @param parent
      */
     private void createSlider(Composite parent) {
-        fSlider = new Slider(parent, SWT.SMOOTH | SWT.FILL);
-        fSlider.setMinimum(0);
-        fSlider.setMaximum(SLIDER_RANGE + fSlider.getThumb());
-        fSlider.setIncrement(SLIDER_RANGE / 100);
-        fSlider.setPageIncrement(SLIDER_RANGE / 10);
-        fSlider.setSelection(0);
-
-        GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false);
-        gridData.horizontalAlignment = SWT.FILL;
-        gridData.horizontalSpan = 4;
-        fSlider.setLayoutData(gridData);
-
-        fSlider.addListener(SWT.Selection, new Listener() {
-               @Override
-                       public void handleEvent(Event event) {
-                               int ratio = fSlider.getSelection();
-                               TmfTimestamp span = fCurrentGroup.getSpan();
-                               long value = span.getValue() * ratio / SLIDER_RANGE;
-                               TmfTimestamp start = fCurrentGroup.getStartTime();
-                               TmfTimestamp current = new TmfTimestamp(start.getValue() + value, start.getScale(), 0);
-                               fCurrentGroup.setValue(current);
-                       }
-        });
+       fSlider = new Slider(parent, SWT.SMOOTH | SWT.FILL);
+       fSlider.setMinimum(0);
+       fSlider.setMaximum(SLIDER_RANGE + fSlider.getThumb());
+       fSlider.setIncrement(SLIDER_RANGE / 100);
+       fSlider.setPageIncrement(SLIDER_RANGE / 10);
+       fSlider.setSelection(0);
+
+       GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false);
+       gridData.horizontalAlignment = SWT.FILL;
+       gridData.horizontalSpan = 4;
+       fSlider.setLayoutData(gridData);
+
+       fSlider.addListener(SWT.Selection, new Listener() {
+           @Override
+           public void handleEvent(Event event) {
+               int ratio = fSlider.getSelection();
+               TmfTimestamp span = fCurrentGroup.getSpan();
+               long value = span.getValue() * ratio / SLIDER_RANGE;
+               TmfTimestamp start = fCurrentGroup.getStartTime();
+               TmfTimestamp current = new TmfTimestamp(start.getValue() + value, start.getScale(), 0);
+               fCurrentGroup.setValue(current);
+           }
+       });
 
     }
 
@@ -240,70 +248,73 @@ public class TimeFrameView extends TmfView {
      */
     private void updateSlider(TmfTimeRange range, TmfTimestamp timestamp) {
 
-       // Ignore update if disposed
-       if (fSlider.isDisposed()) return;
-       
-        // Determine the new relative position
-       byte scale = range.getEndTime().getScale();
-        long total    = range.getStartTime().getAdjustment(range.getEndTime(), scale);
-        long relative = range.getStartTime().getAdjustment(timestamp, scale);
-
-        // Set the slider value
-        final long position = (total > 0) ? (relative * SLIDER_RANGE / total) : 0;
-
-        // Update the slider on the UI thread
-        long current = fSlider.getSelection();
-        if (position != current) {
-               fSlider.getDisplay().asyncExec(new Runnable() {
-                       @Override
-                               public void run() {
-                               fSlider.setSelection((int) position);
-                       }
-               });
-        }
+       // Ignore update if disposed
+       if (fSlider.isDisposed())
+           return;
+
+       // Determine the new relative position
+       byte scale = range.getEndTime().getScale();
+       long total = range.getStartTime().getAdjustment(range.getEndTime(), scale);
+       long relative = range.getStartTime().getAdjustment(timestamp, scale);
+
+       // Set the slider value
+       final long position = (total > 0) ? (relative * SLIDER_RANGE / total) : 0;
+
+       // Update the slider on the UI thread
+       long current = fSlider.getSelection();
+       if (position != current) {
+           fSlider.getDisplay().asyncExec(new Runnable() {
+               @Override
+               public void run() {
+                   fSlider.setSelection((int) position);
+               }
+           });
+       }
     }
 
-       /* (non-Javadoc)
-        * @see java.lang.Object#toString()
-        */
-       @Override
-       @SuppressWarnings("nls")
-       public String toString() {
-               return "[TimeFrameView]";
-       }
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    @SuppressWarnings("nls")
+    public String toString() {
+       return "[TimeFrameView]";
+    }
 
-    // ========================================================================
-    // TMF Signal Handling
-    // ========================================================================
+    // ------------------------------------------------------------------------
+    // Signal Handling
+    // ------------------------------------------------------------------------
 
-       /**
+    /**
      * @param signal
      */
     @SuppressWarnings("unchecked")
     @TmfSignalHandler
     public void experimentSelected(TmfExperimentSelectedSignal<LttngEvent> signal) {
 
-        // Update the trace reference
-        fExperiment = (TmfExperiment<LttngEvent>) signal.getExperiment();
+       // Update the trace reference
+       fExperiment = (TmfExperiment<LttngEvent>) signal.getExperiment();
 
-        // Update the time frame
-        fTraceTimeRange = fExperiment.getTimeRange();
-        fTraceStartTime = fTraceTimeRange.getStartTime();
-        fTraceEndTime   = fTraceTimeRange.getEndTime();
-        fScale          = fTraceStartTime.getScale();
+       // Update the time frame
+       fTraceTimeRange = fExperiment.getTimeRange();
+       fTraceStartTime = fTraceTimeRange.getStartTime();
+       fTraceEndTime = fTraceTimeRange.getEndTime();
+       fScale = fTraceStartTime.getScale();
 
-        // Update the widgets
-        fStartGroup.setContent(fTraceTimeRange, fTraceStartTime);
-        fEndGroup.setContent(fTraceTimeRange, fTraceEndTime);
-        fCurrentGroup.setContent(fTraceTimeRange, fTraceStartTime);
+       // Update the widgets
+       fStartGroup.setContent(fTraceTimeRange, fTraceStartTime);
+       fEndGroup.setContent(fTraceTimeRange, fTraceEndTime);
+       fCurrentGroup.setContent(fTraceTimeRange, fTraceStartTime);
 
-        fCurrentTime = fTraceStartTime;
+       fCurrentTime = fTraceStartTime;
 
-        TmfTimestamp delta = new TmfTimestamp(fTraceStartTime.getAdjustment(fTraceEndTime, fScale), fScale, 0);
-        fTraceSpan = new TmfTimeRange(new TmfTimestamp(0, fScale, 0), delta);
-//        fRangeGroup.setContent(fTraceSpan, delta);
-        TmfTimestamp start = new TmfTimestamp(1, (byte) -1, 0);
-        fRangeGroup.setContent(fTraceSpan, start);
+       TmfTimestamp delta = new TmfTimestamp(fTraceStartTime.getAdjustment(fTraceEndTime, fScale), fScale, 0);
+       fTraceSpan = new TmfTimeRange(new TmfTimestamp(0, fScale, 0), delta);
+       // fRangeGroup.setContent(fTraceSpan, delta);
+       TmfTimestamp start = new TmfTimestamp(1, (byte) -1, 0);
+       fRangeGroup.setContent(fTraceSpan, start);
     }
 
     /**
@@ -312,76 +323,73 @@ public class TimeFrameView extends TmfView {
     @TmfSignalHandler
     public void experimentUpdated(TmfExperimentUpdatedSignal signal) {
 
-        // Update the time frame
-//      fTraceTimeRange = signal.getTrace().getTimeRange();
-               fTraceTimeRange = signal.getExperiment().getTimeRange();
-        fTraceStartTime = fTraceTimeRange.getStartTime();
-        fTraceEndTime   = fTraceTimeRange.getEndTime();
-        fScale          = fTraceStartTime.getScale();
-
-        // Update the widgets
-        fStartGroup.setContent(fTraceTimeRange, fStartGroup.getCurrentTime());
-        fEndGroup.setContent(fTraceTimeRange, fTraceEndTime);
-        fCurrentGroup.setContent(fTraceTimeRange, fCurrentGroup.getCurrentTime());
-
-        TmfTimestamp delta = new TmfTimestamp(fTraceStartTime.getAdjustment(fTraceEndTime, fScale), fScale, 0);
-        fTraceSpan = new TmfTimeRange(new TmfTimestamp(0, fScale, 0), delta);
-        fRangeGroup.setContent(fTraceSpan, delta);
+       // Update the time frame
+       // fTraceTimeRange = signal.getTrace().getTimeRange();
+       fTraceTimeRange = signal.getExperiment().getTimeRange();
+       fTraceStartTime = fTraceTimeRange.getStartTime();
+       fTraceEndTime = fTraceTimeRange.getEndTime();
+       fScale = fTraceStartTime.getScale();
+
+       // Update the widgets
+       fStartGroup.setContent(fTraceTimeRange, fStartGroup.getCurrentTime());
+       fEndGroup.setContent(fTraceTimeRange, fTraceEndTime);
+       fCurrentGroup.setContent(fTraceTimeRange, fCurrentGroup.getCurrentTime());
+
+       TmfTimestamp delta = new TmfTimestamp(fTraceStartTime.getAdjustment(fTraceEndTime, fScale), fScale, 0);
+       fTraceSpan = new TmfTimeRange(new TmfTimestamp(0, fScale, 0), delta);
+       fRangeGroup.setContent(fTraceSpan, delta);
     }
 
-       /**
-        * @param signal
-        */
-       @TmfSignalHandler
-       public void currentTimeRangeUpdated(TmfRangeSynchSignal signal) {
-               if (signal.getSource() != this) {
-                       // Update the time frame
-                       TmfTimeRange selTimeRange = signal.getCurrentRange();
-                       TmfTimestamp selStart = selTimeRange.getStartTime().synchronize(0,
-                                       fScale);
-                       TmfTimestamp selEnd = selTimeRange.getEndTime().synchronize(0,
-                                       fScale);
-
-                       fupdateExternalListeners = false;
-                       // Update the widgets and prevent broadcast notifications to
-                       // the views which have been notified already.
-                       {
-                               fStartGroup.setContent(fTraceTimeRange, selStart);
-                               fEndGroup.setContent(fTraceTimeRange, selEnd);
-
-                               TmfTimestamp delta = new TmfTimestamp(selStart.getAdjustment(
-                                               selEnd, fScale), fScale, 0);
-
-                               fRangeGroup.setContent(fTraceSpan, delta);
-                       }
-
-                       // restore the external notification flag
-                       fupdateExternalListeners = true;
+    /**
+     * @param signal
+     */
+    @TmfSignalHandler
+    public void currentTimeRangeUpdated(TmfRangeSynchSignal signal) {
+       if (signal.getSource() != this) {
+           // Update the time frame
+           TmfTimeRange selTimeRange = signal.getCurrentRange();
+           TmfTimestamp selStart = selTimeRange.getStartTime().synchronize(0, fScale);
+           TmfTimestamp selEnd = selTimeRange.getEndTime().synchronize(0, fScale);
+
+           fupdateExternalListeners = false;
+           // Update the widgets and prevent broadcast notifications to
+           // the views which have been notified already.
+           {
+               fStartGroup.setContent(fTraceTimeRange, selStart);
+               fEndGroup.setContent(fTraceTimeRange, selEnd);
+
+               TmfTimestamp delta = new TmfTimestamp(selStart.getAdjustment(selEnd, fScale), fScale, 0);
+
+               fRangeGroup.setContent(fTraceSpan, delta);
+           }
+
+           // restore the external notification flag
+           fupdateExternalListeners = true;
 
-               }
        }
+    }
 
     /**
      * @param signal
      */
     @TmfSignalHandler
     public void currentTimeUpdated(TmfTimeSynchSignal signal) {
-       if (signal.getSource() != this) {
-                       // prevent loop to external notifications
-                       fupdateExternalListeners = false;
-            fCurrentTime = signal.getCurrentTime().synchronize(0, fStartGroup.getCurrentTime().getScale());
-            if (fStartGroup.getCurrentTime().compareTo(fCurrentTime, false) > 0) {
-               fStartGroup.setContent(new TmfTimeRange(fCurrentTime, fEndGroup.getCurrentTime()), fCurrentTime);
-            }
-            if (fEndGroup.getCurrentTime().compareTo(fCurrentTime, false) < 0) {
-               fEndGroup.setContent(new TmfTimeRange(fStartGroup.getCurrentTime(), fCurrentTime), fCurrentTime);
-            }
-            fCurrentGroup.setContent(null, fCurrentTime);
-            updateSlider(fCurrentGroup.getTimeRange(), fCurrentTime);
-
-                       // Enable external notifications
-                       fupdateExternalListeners = true;
-       }
+       if (signal.getSource() != this) {
+           // prevent loop to external notifications
+           fupdateExternalListeners = false;
+           fCurrentTime = signal.getCurrentTime().synchronize(0, fStartGroup.getCurrentTime().getScale());
+           if (fStartGroup.getCurrentTime().compareTo(fCurrentTime, false) > 0) {
+               fStartGroup.setContent(new TmfTimeRange(fCurrentTime, fEndGroup.getCurrentTime()), fCurrentTime);
+           }
+           if (fEndGroup.getCurrentTime().compareTo(fCurrentTime, false) < 0) {
+               fEndGroup.setContent(new TmfTimeRange(fStartGroup.getCurrentTime(), fCurrentTime), fCurrentTime);
+           }
+           fCurrentGroup.setContent(null, fCurrentTime);
+           updateSlider(fCurrentGroup.getTimeRange(), fCurrentTime);
+
+           // Enable external notifications
+           fupdateExternalListeners = true;
+       }
     }
 
 }
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/messages.properties
new file mode 100644 (file)
index 0000000..c070425
--- /dev/null
@@ -0,0 +1,4 @@
+TimeFrameView_CurrentTime=Current Time
+TimeFrameView_WindowEndTime=Window End Time
+TimeFrameView_WindowRange=Window Range
+TimeFrameView_WindowStartTime=Window Start Time
This page took 0.079894 seconds and 5 git commands to generate.