tmf: Simple warning fixes in tmf.ui and tests
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 14 Jun 2012 22:49:55 +0000 (18:49 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 18 Jun 2012 19:53:23 +0000 (15:53 -0400)
Remove unecessary casts: makes the code more readable

Mark methods static wherever possible: potential memory savings

Remove unecessary else clauses: Makes it easier for the compiler
to optimize branching.

and other small things.

Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
82 files changed:
org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java
org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java
org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/load/LoadersManagerTest.java
org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDSignalValidator.java
org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestFacility.java
org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/tests/uml2sd/load/TestLoaders.java
org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/TraceModelImplFactory.java
org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/views/TsfTraceAnalysisView.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/dialogs/ManageCustomParsersDialog.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTraceDefinition.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtEvent.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtTraceDefinition.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomXmlTrace.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomXmlTraceDefinition.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserInputWizardPage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteTraceSupplementaryFilesHandler.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DropAdapterAssistant.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/OpenExperimentHandler.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/OpenTraceHandler.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/RenameTraceHandler.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectTraceTypeContributionItem.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectTraceTypeHandler.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/editors/EventsViewEditor.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/editors/TmfEventsEditor.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfNavigatorContentProvider.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfNavigatorLabelProvider.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/ImportTraceWizard.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/ImportTraceWizardPage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewTmfProjectWizard.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/RenameExperimentDialog.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/SelectTracesWizardPage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorsView.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramView.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartAnalysisEntry.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartAnalysisProvider.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartView.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/DrawableToolTip.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/NGC.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidgetSelectionProvider.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/TimeCompressionBar.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/AsyncMessage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BaseMessage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicExecutionOccurrence.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicFrame.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/ExecutionOccurrence.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/HotSpot.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Lifeline.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/Criteria.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/FilterCriteria.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/FilterListDialog.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/SDPrintDialogUI.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/SearchFilterDialog.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/drawings/impl/ImageImpl.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/handlers/MoveSDUp.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/preferences/SDViewPref.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/preferences/SDViewerPage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/util/SortAsyncForBackward.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/util/SortAsyncMessageComparator.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/util/SortSyncMessageComparator.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/util/TimeEventComparator.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/rawviewer/TmfRawEventViewer.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphCombo.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphColorScheme.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphScale.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphTooltipHandler.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/virtualtable/TmfVirtualTable.java

index e3508f00a87efd4fe7bce6de6f6baa866760e7c8..0b7ea2996539e695179fea0f894a691025c24456 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2011 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation
  *   Bernd Hufmann - Fixed header and warnings
@@ -39,13 +39,13 @@ public class TmfBaseColumnDataProviderTest extends TestCase {
     // ------------------------------------------------------------------------
     private final static String LEVEL_COLUMN = org.eclipse.linuxtools.tmf.ui.views.statistics.Messages.TmfStatisticsView_LevelColumn;
     private final static String EVENTS_COUNT_COLUMN = org.eclipse.linuxtools.tmf.ui.views.statistics.Messages.TmfStatisticsView_NbEventsColumn;
-    
+
     private TmfBaseColumnDataProvider provider;
 
     private String fTestName;
 
     private final String fContext = "UnitTest";
-    
+
     private final String fTypeId1 = "Some type1";
     private final String fTypeId2 = "Some type2";
 
@@ -128,7 +128,7 @@ public class TmfBaseColumnDataProviderTest extends TestCase {
             assertNotNull("getColumnData", columnData);
             assertNotNull("getColumnData", columnData.getHeader());
             assertNotNull("getColumnData", columnData.getTooltip());
-            
+
             // Testing labelProvider
             ColumnLabelProvider labelProvider = columnData.getLabelProvider();
             if (columnData.getHeader().compareTo(LEVEL_COLUMN) == 0) {
@@ -155,7 +155,7 @@ public class TmfBaseColumnDataProviderTest extends TestCase {
                 assertNull("getColumnData", percentProvider);
             } else if (columnData.getHeader().compareTo(EVENTS_COUNT_COLUMN) == 0) {
                 double percentage = (double) treeNode1.getValue().nbEvents / parentNode.getValue().nbEvents;
-                assertEquals("getColumnData", (double) percentage, (double) percentProvider.getPercentage(treeNode1));
+                assertEquals("getColumnData", percentage, percentProvider.getPercentage(treeNode1));
             }
         }
     }
index e44ce0fe229b3bd7147a0c7a665a5c09b6efda19..7ead7b038a1d86033843dd9a05ca9c129544e64f 100755 (executable)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2011 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Mathieu Denis (mathieu.denis@polymtl.ca)  - Initial design and implementation
  *******************************************************************************/
@@ -84,9 +84,8 @@ public class TmfBaseColumnDataTest extends TestCase {
 
                 if (parent == null) {
                     return 0;
-                } else {
-                    return (double) node.getValue().nbEvents / parent.getValue().nbEvents;
                 }
+                return (double) node.getValue().nbEvents / parent.getValue().nbEvents;
             }
         };
 
index 89a7a6aa50461714afdd15860cc116538c615547..70905c0dc0e1a5214dbdbc62be4d78eec44fa8d9 100644 (file)
@@ -4,8 +4,8 @@
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * Bernd Hufmann - Initial API and implementation
  **********************************************************************/
 package org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.load;
@@ -26,7 +26,7 @@ public class LoadersManagerTest extends TestCase {
     private final static String SDVIEW_WITH_MULTIPLE_LOADER = "org.eclipse.linuxtools.tmf.ui.tests.testSDView2Loaders"; //$NON-NLS-1$
     private final static String TEST_LOADER_CLASS_NAME = "org.eclipse.linuxtools.tmf.ui.tests.uml2sd.load.TestLoaders"; //$NON-NLS-1$
     private final static String TMF_UML2SD_LOADER_CLASS_NAME = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.loader.TmfUml2SDSyncLoader"; //$NON-NLS-1$
-    
+
     private static final String LOADER_TAG = "uml2SDLoader"; //$NON-NLS-1$
     private static final String LOADER_PREFIX = LOADER_TAG + "."; //$NON-NLS-1$
 
@@ -47,9 +47,9 @@ public class LoadersManagerTest extends TestCase {
         try {
 
             /*
-             * Test creation of a loader (one per SD view)  
+             * Test creation of a loader (one per SD view)
              */
-            
+
             // Open view
             // Note this will create the default loader!
             view = (SDView)PlatformUI.getWorkbench()
@@ -59,18 +59,18 @@ public class LoadersManagerTest extends TestCase {
 
             IUml2SDLoader defaultLoader = LoadersManager.getInstance().getCurrentLoader(SDVIEW_WITH_ONE_LOADER, view);
             assertNotNull("testLoaderManager", defaultLoader);
-            
+
             // Test createLoader where loader doesn't exist
             assertNull("testLoaderManager", LoadersManager.getInstance().createLoader("blabla", view));
 
-            // Test createLoader 
+            // Test createLoader
             IUml2SDLoader loader = LoadersManager.getInstance().createLoader(TEST_LOADER_CLASS_NAME, view);
 
             assertNotNull("testLoaderManager", loader);
-            assertEquals("testLoaderManager", "Test Loader", loader.getTitleString()); 
+            assertEquals("testLoaderManager", "Test Loader", loader.getTitleString());
             assertEquals("testLoaderManager", loader, LoadersManager.getInstance().getCurrentLoader(SDVIEW_WITH_ONE_LOADER));
-            
-            // compare loader and default loader. Even if they are the same class, they are different instances 
+
+            // compare loader and default loader. Even if they are the same class, they are different instances
             assertFalse("testLoaderManager", loader==defaultLoader);
 
             // test getCurrentLoader(viewId, view)
@@ -88,7 +88,7 @@ public class LoadersManagerTest extends TestCase {
 
             // Well, this is the only way test which loader is set
             assertEquals("testLoaderManager", "Sequence Diagram - First Page", view.getFrame().getName());
-            
+
             // Test view == null
             assertNull("testLoaderManager", LoadersManager.getInstance().createLoader(TEST_LOADER_CLASS_NAME, null));
 
@@ -96,7 +96,7 @@ public class LoadersManagerTest extends TestCase {
             PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().hideView(view);
 
             /*
-             * Test creation of loaders with re-uses the same SD view  
+             * Test creation of loaders with re-uses the same SD view
              */
 
             // test that view restores the previous associated loader
@@ -113,24 +113,24 @@ public class LoadersManagerTest extends TestCase {
 
             loader = LoadersManager.getInstance().getCurrentLoader(SDVIEW_WITH_MULTIPLE_LOADER, view);
             assertNotNull("testLoaderManager", loader);
-            assertEquals("testLoaderManager", "Test Loader", loader.getTitleString()); 
+            assertEquals("testLoaderManager", "Test Loader", loader.getTitleString());
             assertEquals("testLoaderManager", loader, LoadersManager.getInstance().getCurrentLoader(SDVIEW_WITH_MULTIPLE_LOADER));
 
-            // Test createLoader for loader with class name TMF_UML2SD_LOADER_CLASS_NAME 
+            // Test createLoader for loader with class name TMF_UML2SD_LOADER_CLASS_NAME
             loader = LoadersManager.getInstance().createLoader(TMF_UML2SD_LOADER_CLASS_NAME, view);
 
             assertNotNull("testLoaderManager", loader);
-            assertEquals("testLoaderManager", "Component Interactions", loader.getTitleString()); 
+            assertEquals("testLoaderManager", "Component Interactions", loader.getTitleString());
             assertEquals("testLoaderManager", loader, LoadersManager.getInstance().getCurrentLoader(SDVIEW_WITH_MULTIPLE_LOADER));
 
             // Verify if the correct loader is stored in the preferences as the current loader for this view
             assertEquals("testLoaderManager", TMF_UML2SD_LOADER_CLASS_NAME, getSavedLoader(SDVIEW_WITH_MULTIPLE_LOADER));
 
-            // Test createLoader for loader with class name TEST_LOADER_CLASS_NAME 
+            // Test createLoader for loader with class name TEST_LOADER_CLASS_NAME
             loader = LoadersManager.getInstance().createLoader(TEST_LOADER_CLASS_NAME, view);
 
             assertNotNull("testLoaderManager", loader);
-            assertEquals("testLoaderManager", "Test Loader", loader.getTitleString()); 
+            assertEquals("testLoaderManager", "Test Loader", loader.getTitleString());
             assertEquals("testLoaderManager", loader, LoadersManager.getInstance().getCurrentLoader(SDVIEW_WITH_MULTIPLE_LOADER));
 
             // Verify if the correct loader is stored in the preferences as the current loader for this view
@@ -150,7 +150,7 @@ public class LoadersManagerTest extends TestCase {
     }
 
     @SuppressWarnings("unused")
-    private void delay(long waitTimeMillis) {
+    private static void delay(long waitTimeMillis) {
         Display display = Display.getCurrent();
         if (display != null) {
             long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
@@ -169,7 +169,7 @@ public class LoadersManagerTest extends TestCase {
         }
     }
 
-    private String getSavedLoader(String viewId) {
+    private static String getSavedLoader(String viewId) {
         IPreferenceStore p = Activator.getDefault().getPreferenceStore();
         return p.getString(LOADER_PREFIX + viewId);
     }
index 08c59df64e38463e4ee574eae3782b4d7cedac8c..c35e6f28e2e364771f5121ed5c09f753a69dad5f 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2011, 2012 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
  *******************************************************************************/
@@ -21,10 +21,10 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfStartSynchSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
 
 /**
- *  Class to implement that certain signals are sent as well as are sent with correct content. 
+ *  Class to implement that certain signals are sent as well as are sent with correct content.
  */
 public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignalValidator {
-    
+
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
@@ -44,13 +44,13 @@ public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignal
     // ------------------------------------------------------------------------
     public Uml2SDSignalValidator() {
     }
-    
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
     @TmfSignalHandler
     public void synchToTime(TmfTimeSynchSignal signal) {
-        // Set results so that it can be validated in the test case 
+        // Set results so that it can be validated in the test case
         setSignalReceived(true);
         setSourceError(getSource() != signal.getSource());
         setCurrentTimeError(!getCurrentTime().equals(signal.getCurrentTime()));
@@ -58,19 +58,19 @@ public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignal
 
     @TmfSignalHandler
     public void synchToTimeRange(TmfRangeSynchSignal signal) {
-        // Set results so that it can be validated in the test case 
+        // Set results so that it can be validated in the test case
         setSignalReceived(true);
         setSourceError(getSource() != signal.getSource());
         setCurrentTimeError(!getCurrentTime().equals(signal.getCurrentTime()));
         setRangeError(!getCurrentRange().equals(signal.getCurrentRange()));
     }
-    
+
     @TmfSignalHandler
     public void startSynch(TmfStartSynchSignal signal) {
         fSignalDepth++;
-        // make sure that the signal which is send by the loader class is not handled by the loader class 
+        // make sure that the signal which is send by the loader class is not handled by the loader class
         // after receiving it. i.e. it must not trigger a another signal
-        
+
         // Set results so that it can be validated in the test case
         setSignalError(fSignalDepth > 1);
     }
@@ -79,7 +79,7 @@ public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignal
     public void endSynch(TmfEndSynchSignal signal) {
         fSignalDepth = fSignalDepth > 0 ? fSignalDepth - 1 : 0;
     }
-    
+
     @Override
     public boolean isSignalReceived() {
         return fIsSignalReceived;
@@ -123,8 +123,8 @@ public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignal
     @Override
     public boolean isSignalError() {
         return fIsSignalError;
-    }    
-    
+    }
+
     @Override
     public void setSignalError(boolean fIsSignalError) {
         this.fIsSignalError = fIsSignalError;
@@ -139,7 +139,7 @@ public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignal
     public void setSource(Object source) {
         fSource = source;
     }
-    
+
     @Override
     public TmfTimestamp getCurrentTime() {
         return fCurrentTimestamp;
@@ -159,5 +159,5 @@ public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignal
     public void setCurrentRange(TmfTimeRange currentRange) {
         fCurrentTimeRange = currentRange == null ? null : new TmfTimeRange(currentRange);
     }
-};
+}
 
index d49139b2624617426916f84503be440095b0d260..2821a55dca52aebb306908f176d56ed489be2351 100644 (file)
@@ -262,7 +262,7 @@ public class Uml2SDTestFacility {
      * @param page number to set
      */
     public void setPage(final int page) {
-        fLoader.pageNumberChanged(page);;
+        fLoader.pageNumberChanged(page);
         fLoader.waitForCompletion();
         delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
     }
index 1d26422b5b8a8554357391019eaaabdd421bd16b..d399c88a76261761f50cf075f223ffa0ab3d8e16 100644 (file)
@@ -151,7 +151,7 @@ public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterPro
                 }
             }
 
-            for (int i = 0; i < testFrame.lifeLinesCount(); i++)
+            for (int i = 0; i < testFrame.lifeLinesCount(); i++) {
                 if (i > 0) {
                     ExecutionOccurrence occ = new ExecutionOccurrence();
                     occ.setStartOccurrence(testFrame.getSyncMessage(i).getEventOccurrence() + 1);
@@ -159,6 +159,7 @@ public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterPro
                     testFrame.getLifeline(i).addExecution(occ);
                     occ.setName("******************* Execution Occurance TEST ****************");
                 }
+            }
 
             Stop s = new Stop();
             s.setLifeline(testFrame.getLifeline(1));
@@ -204,7 +205,7 @@ public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterPro
                 occ.setEndOccurrence(testFrame.getSyncMessageReturn(i - 1).getEventOccurrence());
                 testFrame.getLifeline(0).addExecution(occ);
             }
-        } 
+        }
         v.setFrame(testFrame);
     }
 
@@ -216,28 +217,33 @@ public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterPro
     public boolean find(Criteria toSearch) {
         Frame frame = v.getFrame();
 
-        if (frame == null)
+        if (frame == null) {
             return false;
+        }
         if (findResults == null || findCriteria == null || !findCriteria.compareTo(toSearch)) {
             findResults = new ArrayList<GraphNode>();
             findCriteria = toSearch;
             if (findCriteria.isLifeLineSelected()) {
                 for (int i = 0; i < frame.lifeLinesCount(); i++) {
-                    if (findCriteria.matches(frame.getLifeline(i).getName()))
+                    if (findCriteria.matches(frame.getLifeline(i).getName())) {
                         findResults.add(frame.getLifeline(i));
+                    }
                 }
 
             }
             ArrayList<GraphNode> msgs = new ArrayList<GraphNode>();
             if (findCriteria.isSyncMessageSelected()) {
                 for (int i = 0; i < frame.syncMessageCount(); i++) {
-                    if (findCriteria.matches(frame.getSyncMessage(i).getName()))
+                    if (findCriteria.matches(frame.getSyncMessage(i).getName())) {
                         msgs.add(frame.getSyncMessage(i));
+                    }
                 }
 
-                for (int i = 0; i < frame.syncMessageReturnCount(); i++)
-                    if (findCriteria.matches(frame.getSyncMessageReturn(i).getName()))
+                for (int i = 0; i < frame.syncMessageReturnCount(); i++) {
+                    if (findCriteria.matches(frame.getSyncMessageReturn(i).getName())) {
                         msgs.add(frame.getSyncMessageReturn(i));
+                    }
+                }
 
             }
             // if(msgs.size() > 0) {
@@ -248,13 +254,17 @@ public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterPro
 
             msgs = new ArrayList<GraphNode>();
             if (findCriteria.isAsyncMessageSelected()) {
-                for (int i = 0; i < frame.asyncMessageCount(); i++)
-                    if (findCriteria.matches(frame.getAsyncMessage(i).getName()))
+                for (int i = 0; i < frame.asyncMessageCount(); i++) {
+                    if (findCriteria.matches(frame.getAsyncMessage(i).getName())) {
                         msgs.add(frame.getAsyncMessage(i));
+                    }
+                }
 
-                for (int i = 0; i < frame.asyncMessageReturnCount(); i++)
-                    if (findCriteria.matches(frame.getAsyncMessageReturn(i).getName()))
+                for (int i = 0; i < frame.asyncMessageReturnCount(); i++) {
+                    if (findCriteria.matches(frame.getAsyncMessageReturn(i).getName())) {
                         msgs.add(frame.getAsyncMessageReturn(i));
+                    }
+                }
 
             }
             // if(msgs.size() > 0) {
@@ -265,22 +275,21 @@ public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterPro
 
             @SuppressWarnings("rawtypes")
             List selection = v.getSDWidget().getSelection();
-            if (selection != null && selection.size() == 1)
+            if (selection != null && selection.size() == 1) {
                 currentFindIndex = findResults.indexOf(selection.get(0)) + 1;
-            else
+            } else {
                 currentFindIndex = 0;
+            }
         } else {
             currentFindIndex++;
         }
         if (findResults.size() > currentFindIndex) {
-            GraphNode current = (GraphNode) findResults.get(currentFindIndex);
+            GraphNode current = findResults.get(currentFindIndex);
             v.getSDWidget().moveTo(current);
             return true;
-        } else {
-            // return notFoundYet(findCriteria); // search in other page
-            return false;
         }
-        // return false;
+        // return notFoundYet(findCriteria); // search in other page
+        return false;
     }
 
     @Override
@@ -348,11 +357,12 @@ public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterPro
                 }
             }
 
-            for (int i = 0; i < frame.syncMessageReturnCount(); i++)
+            for (int i = 0; i < frame.syncMessageReturnCount(); i++) {
                 if (filterCriteria.getCriteria().matches(frame.getSyncMessageReturn(i).getName())) {
                     frame.getSyncMessageReturn(i).setVisible(false);
                     found = true;
                 }
+            }
         }
 
         v.getSDWidget().redraw();
@@ -446,8 +456,9 @@ public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterPro
 
         @Override
         public void dispose() {
-            if (img != null)
+            if (img != null) {
                 img.dispose();
+            }
         }
 
     }
@@ -456,7 +467,7 @@ public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterPro
     public void firstPage() {
         page = 0;
         createFrame();
-        
+
     }
 
     @Override
index 1d296e042899a75d1e566065e2ddcbe4289daeb0..a1289ed4d05edfc69e8603fd4e65d7b684854928 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************\r
  * Copyright (c) 2009, 2010 Ericsson\r
- * \r
+ *\r
  * All rights reserved. This program and the accompanying materials are\r
  * made available under the terms of the Eclipse Public License v1.0 which\r
  * accompanies this distribution, and is available at\r
  * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
  * Contributors:\r
  *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation\r
  *******************************************************************************/\r
@@ -20,9 +20,9 @@ public class TraceModelImplFactory {
        // Data\r
        // ========================================================================\r
        private int count = 0;\r
-       private TraceStrings[] traceNames;\r
+       private final TraceStrings[] traceNames;\r
        private static final long msTons = 1000000;\r
-       private Long timeRef = new Date().getTime() * msTons;\r
+       private final Long timeRef = new Date().getTime() * msTons;\r
 \r
        // ========================================================================\r
        // Constructor\r
@@ -47,7 +47,7 @@ public class TraceModelImplFactory {
                }\r
                return traceArr;\r
        }\r
-       \r
+\r
        /**\r
         * 5000 Events per Trace.\r
         * @param number\r
@@ -67,13 +67,13 @@ public class TraceModelImplFactory {
                return traceArr;\r
        }\r
 \r
-       private void create5000Events(TraceImpl trace) {\r
+       private static void create5000Events(TraceImpl trace) {\r
                EventImpl event;\r
                Long eventTime;\r
                int numEvents = 5000;\r
                long sTime = trace.getStartTime();\r
                long eTime = trace.getEndTime();\r
-               long duration = (long) ((eTime - sTime)/numEvents);\r
+               long duration = (eTime - sTime)/numEvents;\r
                for (int i = 0; i < numEvents; i++) {\r
                        eventTime = sTime + (i * duration);\r
                        // eventTime = timeRef + (5 * (count % 4) + (5 * (int) (i/2) ));\r
@@ -94,7 +94,7 @@ public class TraceModelImplFactory {
                long duration = 0;\r
                for (int i = 0; i < numEvents; i++) {\r
                        eventTime = timeRef + msTons * i + (5 * msTons * count) + (5 * i);\r
-                       duration = msTons + i * msTons + (long) ((i % 4));\r
+                       duration = msTons + i * msTons + ((i % 4));\r
 //                     duration = i  + (long) ((i % 4));\r
                        event = new EventImpl(eventTime, trace, getEventType(i));\r
                        event.setDuration(duration);\r
@@ -102,39 +102,54 @@ public class TraceModelImplFactory {
                }\r
        }\r
 \r
-       private EventImpl.Type getEventType(int val) {\r
-               if (EventImpl.Type.ALARM.ordinal() == val)\r
-                       return EventImpl.Type.ALARM;\r
-               if (EventImpl.Type.ERROR.ordinal() == val)\r
-                       return EventImpl.Type.ERROR;\r
-               if (EventImpl.Type.EVENT.ordinal() == val)\r
-                       return EventImpl.Type.EVENT;\r
-               if (EventImpl.Type.INFORMATION.ordinal() == val)\r
-                       return EventImpl.Type.INFORMATION;\r
-               if (EventImpl.Type.TIMEADJUSTMENT.ordinal() == val)\r
-                       return EventImpl.Type.TIMEADJUSTMENT;\r
-               if (EventImpl.Type.WARNING.ordinal() == val)\r
-                       return EventImpl.Type.WARNING;\r
-               if (EventImpl.Type.INFO1.ordinal() == val)\r
-                       return EventImpl.Type.INFO1;\r
-               if (EventImpl.Type.INFO2.ordinal() == val)\r
-                       return EventImpl.Type.INFO2;\r
-               if (EventImpl.Type.INFO3.ordinal() == val)\r
-                       return EventImpl.Type.INFO3;\r
-               if (EventImpl.Type.INFO4.ordinal() == val)\r
-                       return EventImpl.Type.INFO4;\r
-               if (EventImpl.Type.INFO5.ordinal() == val)\r
-                       return EventImpl.Type.INFO5;\r
-               if (EventImpl.Type.INFO6.ordinal() == val)\r
-                       return EventImpl.Type.INFO6;\r
-               if (EventImpl.Type.INFO7.ordinal() == val)\r
-                       return EventImpl.Type.INFO7;\r
-               if (EventImpl.Type.INFO8.ordinal() == val)\r
-                       return EventImpl.Type.INFO8;\r
-               if (EventImpl.Type.INFO9.ordinal() == val)\r
-                       return EventImpl.Type.INFO9;\r
-               return EventImpl.Type.UNKNOWN;\r
-       }\r
+    private static EventImpl.Type getEventType(int val) {\r
+        if (EventImpl.Type.ALARM.ordinal() == val) {\r
+            return EventImpl.Type.ALARM;\r
+        }\r
+        if (EventImpl.Type.ERROR.ordinal() == val) {\r
+            return EventImpl.Type.ERROR;\r
+        }\r
+        if (EventImpl.Type.EVENT.ordinal() == val) {\r
+            return EventImpl.Type.EVENT;\r
+        }\r
+        if (EventImpl.Type.INFORMATION.ordinal() == val) {\r
+            return EventImpl.Type.INFORMATION;\r
+        }\r
+        if (EventImpl.Type.TIMEADJUSTMENT.ordinal() == val) {\r
+            return EventImpl.Type.TIMEADJUSTMENT;\r
+        }\r
+        if (EventImpl.Type.WARNING.ordinal() == val) {\r
+            return EventImpl.Type.WARNING;\r
+        }\r
+        if (EventImpl.Type.INFO1.ordinal() == val) {\r
+            return EventImpl.Type.INFO1;\r
+        }\r
+        if (EventImpl.Type.INFO2.ordinal() == val) {\r
+            return EventImpl.Type.INFO2;\r
+        }\r
+        if (EventImpl.Type.INFO3.ordinal() == val) {\r
+            return EventImpl.Type.INFO3;\r
+        }\r
+        if (EventImpl.Type.INFO4.ordinal() == val) {\r
+            return EventImpl.Type.INFO4;\r
+        }\r
+        if (EventImpl.Type.INFO5.ordinal() == val) {\r
+            return EventImpl.Type.INFO5;\r
+        }\r
+        if (EventImpl.Type.INFO6.ordinal() == val) {\r
+            return EventImpl.Type.INFO6;\r
+        }\r
+        if (EventImpl.Type.INFO7.ordinal() == val) {\r
+            return EventImpl.Type.INFO7;\r
+        }\r
+        if (EventImpl.Type.INFO8.ordinal() == val) {\r
+            return EventImpl.Type.INFO8;\r
+        }\r
+        if (EventImpl.Type.INFO9.ordinal() == val) {\r
+            return EventImpl.Type.INFO9;\r
+        }\r
+        return EventImpl.Type.UNKNOWN;\r
+    }\r
 \r
        private void loadTraceNameStrings() {\r
                traceNames[0] = new TraceStrings();\r
@@ -176,7 +191,7 @@ public class TraceModelImplFactory {
                traceNames[9] = new TraceStrings();\r
                traceNames[9].name = "TE Log - TATA BSC14";\r
                traceNames[9].classNmme = "Board 14, SPO";\r
-               \r
+\r
                traceNames[10] = new TraceStrings();\r
                traceNames[10].name = "INFO 1";\r
                traceNames[10].classNmme = "All Boards";\r
@@ -196,7 +211,7 @@ public class TraceModelImplFactory {
                traceNames[14] = new TraceStrings();\r
                traceNames[14].name = "MISC2";\r
                traceNames[14].classNmme = "Board 11";\r
-               \r
+\r
                traceNames[15] = new TraceStrings();\r
                traceNames[15].name = "MISC3";\r
                traceNames[15].classNmme = "Board 23";\r
index 1f7851a956cf0ecd3f7f0921bb191a400568f0a4..a42c3dfc3dad0d08499ec334c0fbfcc3fbf24e2d 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
  *******************************************************************************/
@@ -26,7 +26,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
 import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.LabelProvider;
@@ -98,7 +97,7 @@ public class TsfTraceAnalysisView extends ViewPart implements
         */
 
        class TreeObject implements IAdaptable {
-               private String name;
+               private final String name;
                private TreeParent parent;
 
                public TreeObject(String name) {
@@ -130,7 +129,7 @@ public class TsfTraceAnalysisView extends ViewPart implements
        }
 
        class TreeParent extends TreeObject {
-               private ArrayList<TreeObject> children;
+               private final ArrayList<TreeObject> children;
 
                public TreeParent(String name) {
                        super(name);
@@ -157,8 +156,7 @@ public class TsfTraceAnalysisView extends ViewPart implements
                }
        }
 
-       class ViewContentProvider implements IStructuredContentProvider,
-                       ITreeContentProvider {
+       class ViewContentProvider implements ITreeContentProvider {
                private TreeParent invisibleRoot;
 
                @Override
@@ -172,8 +170,9 @@ public class TsfTraceAnalysisView extends ViewPart implements
                @Override
                public Object[] getElements(Object parent) {
                        if (parent.equals(getViewSite())) {
-                               if (invisibleRoot == null)
-                                       initialize();
+                               if (invisibleRoot == null) {
+                    initialize();
+                }
                                return getChildren(invisibleRoot);
                        }
                        return getChildren(parent);
@@ -197,8 +196,9 @@ public class TsfTraceAnalysisView extends ViewPart implements
 
                @Override
                public boolean hasChildren(Object parent) {
-                       if (parent instanceof TreeParent)
-                               return ((TreeParent) parent).hasChildren();
+                       if (parent instanceof TreeParent) {
+                return ((TreeParent) parent).hasChildren();
+            }
                        return false;
                }
 
@@ -238,8 +238,9 @@ public class TsfTraceAnalysisView extends ViewPart implements
                @Override
                public Image getImage(Object obj) {
                        String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
-                       if (obj instanceof TreeParent)
-                               imageKey = ISharedImages.IMG_OBJ_FOLDER;
+                       if (obj instanceof TreeParent) {
+                imageKey = ISharedImages.IMG_OBJ_FOLDER;
+            }
                        return PlatformUI.getWorkbench().getSharedImages().getImage(
                                        imageKey);
                }
@@ -347,10 +348,11 @@ public class TsfTraceAnalysisView extends ViewPart implements
 
        private TimeGraphViewer getActiveTsfCtrl() {
                TimeGraphViewer inFocusViewer = null;
-               if (tsfviewer.isInFocus())
-                       inFocusViewer = tsfviewer;
-               else if (tsfviewer2.isInFocus())
-                       inFocusViewer = tsfviewer2;
+               if (tsfviewer.isInFocus()) {
+            inFocusViewer = tsfviewer;
+        } else if (tsfviewer2.isInFocus()) {
+            inFocusViewer = tsfviewer2;
+        }
                return inFocusViewer;
        }
 
@@ -616,38 +618,36 @@ public class TsfTraceAnalysisView extends ViewPart implements
 
     @Override
        public void timeRangeUpdated(TimeGraphRangeUpdateEvent event) {
-           if (event == null) 
-               return;
-               Object source = event.getSource();
-               if (source == null || !(source instanceof TimeGraphViewer)) {
-                       return;
-               }
-
-               if (event instanceof TimeGraphRangeUpdateEvent) {
-                       TimeGraphRangeUpdateEvent rEvent = (TimeGraphRangeUpdateEvent) event;
-                       TimeGraphViewer rViewer = (TimeGraphViewer) event
-                                       .getSource();
-                       TimeGraphViewer synchViewer = null;
-                       // Synchronize viewer selections if Enabled,
-                       // make sure the selection does not go in loops
-                       if (tsfviewer == rViewer) {
-                               synchViewer = tsfviewer2;
-                       } else {
-                               synchViewer = tsfviewer;
-                       }
+        if (event == null) {
+            return;
+        }
+        Object source = event.getSource();
+        if (source == null || !(source instanceof TimeGraphViewer)) {
+            return;
+        }
 
+        TimeGraphRangeUpdateEvent rEvent = event;
+        TimeGraphViewer rViewer = (TimeGraphViewer) event
+                .getSource();
+        TimeGraphViewer synchViewer = null;
+        // Synchronize viewer selections if Enabled,
+        // make sure the selection does not go in loops
+        if (tsfviewer == rViewer) {
+            synchViewer = tsfviewer2;
+        } else {
+            synchViewer = tsfviewer;
+        }
 
-                       synchViewer.setSelectVisTimeWindow(rEvent.getStartTime(), rEvent
-                                       .getEndTime(), source);
-               }
-       }
+        synchViewer.setSelectVisTimeWindow(rEvent.getStartTime(), rEvent
+                .getEndTime(), source);
+    }
 
        /**
         * Obtains the remainder fraction on unit Seconds of the entered value in
         * nanoseconds. e.g. input: 1241207054171080214 ns The number of seconds can
         * be obtain by removing the last 9 digits: 1241207054 the fractional
         * portion of seconds, expressed in ns is: 171080214
-        * 
+        *
         * @param v
         * @return
         */
index 4031257d3892d87c30130e958aa7c10cd7635160..fb80cfe12b101842ed00828dd42f406851e438c9 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************\r
  * Copyright (c) 2010 Ericsson\r
- * \r
+ *\r
  * All rights reserved. This program and the accompanying materials are\r
  * made available under the terms of the Eclipse Public License v1.0 which\r
  * accompanies this distribution, and is available at\r
  * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
  * Contributors:\r
  *   Patrick Tasse - Initial API and implementation\r
  *******************************************************************************/\r
@@ -15,9 +15,10 @@ package org.eclipse.linuxtools.internal.tmf.ui.dialogs;
 import org.eclipse.jface.dialogs.Dialog;\r
 import org.eclipse.jface.dialogs.IDialogConstants;\r
 import org.eclipse.jface.dialogs.MessageDialog;\r
+import org.eclipse.jface.window.Window;\r
 import org.eclipse.jface.wizard.WizardDialog;\r
-import org.eclipse.linuxtools.internal.tmf.ui.Messages;\r
 import org.eclipse.linuxtools.internal.tmf.ui.Activator;\r
+import org.eclipse.linuxtools.internal.tmf.ui.Messages;\r
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTraceDefinition;\r
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition;\r
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTraceDefinition;\r
@@ -50,7 +51,7 @@ public class ManageCustomParsersDialog extends Dialog {
     Button deleteButton;\r
     Button importButton;\r
     Button exportButton;\r
-    \r
+\r
     public ManageCustomParsersDialog(Shell parent) {\r
         super(parent);\r
         setShellStyle(SWT.RESIZE | SWT.MAX | getShellStyle());\r
@@ -63,7 +64,7 @@ public class ManageCustomParsersDialog extends Dialog {
     protected Control createDialogArea(Composite parent) {\r
         getShell().setText(Messages.ManageCustomParsersDialog_DialogHeader);\r
         getShell().setImage(image);\r
-        \r
+\r
         Composite composite = (Composite) super.createDialogArea(parent);\r
         composite.setLayout(new GridLayout(2, false));\r
 \r
@@ -73,13 +74,13 @@ public class ManageCustomParsersDialog extends Dialog {
         lcgl.marginHeight = 0;\r
         lcgl.marginWidth = 0;\r
         listContainer.setLayout(lcgl);\r
-        \r
+\r
         Composite radioContainer = new Composite(listContainer, SWT.NONE);\r
         GridLayout rcgl = new GridLayout(2, true);\r
         rcgl.marginHeight = 0;\r
         rcgl.marginWidth = 0;\r
         radioContainer.setLayout(rcgl);\r
-        \r
+\r
         txtButton = new Button(radioContainer, SWT.RADIO);\r
         txtButton.setText(Messages.ManageCustomParsersDialog_TextButtonLabel);\r
         txtButton.setSelection(true);\r
@@ -90,7 +91,7 @@ public class ManageCustomParsersDialog extends Dialog {
                        public void widgetSelected(SelectionEvent e) {\r
                 fillParserList();\r
             }});\r
-        \r
+\r
         xmlButton = new Button(radioContainer, SWT.RADIO);\r
         xmlButton.setText("XML"); //$NON-NLS-1$\r
         xmlButton.addSelectionListener(new SelectionListener(){\r
@@ -100,7 +101,7 @@ public class ManageCustomParsersDialog extends Dialog {
                        public void widgetSelected(SelectionEvent e) {\r
                 fillParserList();\r
             }});\r
-        \r
+\r
         parserList = new List(listContainer, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);\r
         parserList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));\r
         parserList.addSelectionListener(new SelectionListener(){\r
@@ -118,7 +119,7 @@ public class ManageCustomParsersDialog extends Dialog {
                     exportButton.setEnabled(true);\r
                 }\r
             }});\r
-        \r
+\r
         Composite buttonContainer = new Composite(composite, SWT.NULL);\r
         buttonContainer.setLayout(new GridLayout());\r
         buttonContainer.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false));\r
@@ -139,12 +140,12 @@ public class ManageCustomParsersDialog extends Dialog {
                 }\r
                 if (dialog != null) {\r
                     dialog.open();\r
-                    if (dialog.getReturnCode() == Dialog.OK) {\r
+                    if (dialog.getReturnCode() == Window.OK) {\r
                         fillParserList();\r
                     }\r
                 }\r
             }});\r
-        \r
+\r
         editButton = new Button(buttonContainer, SWT.PUSH);\r
         editButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));\r
         editButton.setText(Messages.ManageCustomParsersDialog_EditButtonLabel);\r
@@ -164,7 +165,7 @@ public class ManageCustomParsersDialog extends Dialog {
                 }\r
                 if (dialog != null) {\r
                     dialog.open();\r
-                    if (dialog.getReturnCode() == Dialog.OK) {\r
+                    if (dialog.getReturnCode() == Window.OK) {\r
                         fillParserList();\r
                     }\r
                 }\r
@@ -194,7 +195,7 @@ public class ManageCustomParsersDialog extends Dialog {
             }});\r
 \r
         new Label(buttonContainer, SWT.NONE); // filler\r
-        \r
+\r
         importButton = new Button(buttonContainer, SWT.PUSH);\r
         importButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));\r
         importButton.setText(Messages.ManageCustomParsersDialog_ImportButtonLabel);\r
index 012076f87bac198a38e07bf9cc90716691c36ee4..539d0e1caa8d26b0a030e57e6c6571360aa084b3 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************\r
  * Copyright (c) 2010 Ericsson\r
- * \r
+ *\r
  * All rights reserved. This program and the accompanying materials are\r
  * made available under the terms of the Eclipse Public License v1.0 which\r
  * accompanies this distribution, and is available at\r
  * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
  * Contributors:\r
  *   Patrick Tasse - Initial API and implementation\r
  *******************************************************************************/\r
@@ -28,15 +28,15 @@ public abstract class CustomTraceDefinition {
     public static final String TAG_TIMESTAMP = Messages.CustomTraceDefinition_timestampTag;\r
     public static final String TAG_MESSAGE = Messages.CustomTraceDefinition_messageTag;\r
     public static final String TAG_OTHER = Messages.CustomTraceDefinition_otherTag;\r
-    \r
+\r
     public String definitionName;\r
     public List<OutputColumn> outputs;\r
     public String timeStampOutputFormat;\r
-    \r
+\r
     public static class OutputColumn {\r
         public String name;\r
 \r
-        public OutputColumn() {};\r
+        public OutputColumn() {}\r
 \r
         public OutputColumn(String name) {\r
             this.name = name;\r
@@ -52,7 +52,7 @@ public abstract class CustomTraceDefinition {
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat(timeStampOutputFormat);\r
         return simpleDateFormat.format(timestamp.getValue());\r
     }\r
-    \r
+\r
     public abstract void save();\r
     public abstract void save(String path);\r
 }\r
index d59c233ba8e2f4eea3147b39c315cee797b6da08..745a449266bfe49dae6b428ccdaf501010fe8a52 100644 (file)
@@ -54,19 +54,19 @@ public class CustomTxtEvent extends CustomEvent {
                     continue;\r
                 }\r
                 String name = column.name;\r
-                if (column.action == CustomTxtTraceDefinition.ACTION_SET) {\r
+                if (column.action == CustomTraceDefinition.ACTION_SET) {\r
                     fData.put(name, value);\r
-                    if (name.equals(CustomTxtTraceDefinition.TAG_TIMESTAMP)) {\r
+                    if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                         fData.put(TIMESTAMP_INPUT_FORMAT_KEY, column.format);\r
                     }\r
-                } else if (column.action == CustomTxtTraceDefinition.ACTION_APPEND) {\r
+                } else if (column.action == CustomTraceDefinition.ACTION_APPEND) {\r
                     String s = fData.get(name);\r
                     if (s != null) {\r
                         fData.put(name, s + value);\r
                     } else {\r
                         fData.put(name, value);\r
                     }\r
-                    if (name.equals(CustomTxtTraceDefinition.TAG_TIMESTAMP)) {\r
+                    if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                         String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);\r
                         if (timeStampInputFormat != null) {\r
                             fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + column.format);\r
@@ -74,14 +74,14 @@ public class CustomTxtEvent extends CustomEvent {
                             fData.put(TIMESTAMP_INPUT_FORMAT_KEY, column.format);\r
                         }\r
                     }\r
-                } else if (column.action == CustomTxtTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {\r
+                } else if (column.action == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {\r
                     String s = fData.get(name);\r
                     if (s != null) {\r
                         fData.put(name, s + " | " + value); //$NON-NLS-1$\r
                     } else {\r
                         fData.put(name, value);\r
                     }\r
-                    if (name.equals(CustomTxtTraceDefinition.TAG_TIMESTAMP)) {\r
+                    if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                         String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);\r
                         if (timeStampInputFormat != null) {\r
                             fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + " | " + column.format); //$NON-NLS-1$\r
index 52fdbdcf7b2707091d042ecd17ac56a27f79ef8f..8c19d20fc8f69a3669f871501539832021313922 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************\r
  * Copyright (c) 2010 Ericsson\r
- * \r
+ *\r
  * All rights reserved. This program and the accompanying materials are\r
  * made available under the terms of the Eclipse Public License v1.0 which\r
  * accompanies this distribution, and is available at\r
  * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
  * Contributors:\r
  *   Patrick Tasse - Initial API and implementation\r
  *******************************************************************************/\r
@@ -35,8 +35,8 @@ import javax.xml.transform.TransformerFactoryConfigurationError;
 import javax.xml.transform.dom.DOMSource;\r
 import javax.xml.transform.stream.StreamResult;\r
 \r
-import org.eclipse.linuxtools.internal.tmf.ui.Messages;\r
 import org.eclipse.linuxtools.internal.tmf.ui.Activator;\r
+import org.eclipse.linuxtools.internal.tmf.ui.Messages;\r
 import org.w3c.dom.Document;\r
 import org.w3c.dom.Element;\r
 import org.w3c.dom.Node;\r
@@ -66,20 +66,20 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
     private static final String ACTION_ATTRIBUTE = Messages.CustomTxtTraceDefinition_action;\r
     private static final String FORMAT_ATTRIBUTE = Messages.CustomTxtTraceDefinition_format;\r
     private static final String OUTPUT_COLUMN_ELEMENT = Messages.CustomTxtTraceDefinition_outputColumn;\r
-    \r
+\r
     public List<InputLine> inputs;\r
 \r
     public CustomTxtTraceDefinition() {\r
         this("", new ArrayList<InputLine>(0), new ArrayList<OutputColumn>(0), ""); //$NON-NLS-1$ //$NON-NLS-2$\r
-    };\r
-    \r
+    }\r
+\r
     public CustomTxtTraceDefinition(String logtype, List<InputLine> inputs, List<OutputColumn> outputs, String timeStampOutputFormat) {\r
         this.definitionName = logtype;\r
         this.inputs = inputs;\r
         this.outputs = outputs;\r
         this.timeStampOutputFormat = timeStampOutputFormat;\r
     }\r
-    \r
+\r
     public static class InputLine {\r
         public List<InputData> columns;\r
         public Cardinality cardinality;\r
@@ -89,31 +89,31 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
         public int level;\r
         public InputLine nextInput;\r
         public List<InputLine> childrenInputs;\r
-        \r
-        public InputLine() {};\r
-        \r
+\r
+        public InputLine() {}\r
+\r
         public InputLine(Cardinality cardinality, String regex, List<InputData> columns) {\r
             this.cardinality = cardinality;\r
             this.regex = regex;\r
             this.columns = columns;\r
         }\r
-        \r
+\r
         public void setRegex(String regex) {\r
             this.regex = regex;\r
             this.pattern = null;\r
         }\r
-        \r
+\r
         public String getRegex() {\r
             return regex;\r
         }\r
-        \r
+\r
         public Pattern getPattern() throws PatternSyntaxException {\r
             if (pattern == null) {\r
                 pattern = Pattern.compile(regex);\r
             }\r
             return pattern;\r
         }\r
-        \r
+\r
         public void addChild(InputLine input) {\r
             if (childrenInputs == null) {\r
                 childrenInputs = new ArrayList<InputLine>(1);\r
@@ -166,7 +166,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
             }\r
             columns.add(column);\r
         }\r
-        \r
+\r
         public List<InputLine> getNextInputs(Map<InputLine, Integer> countMap) {\r
             List<InputLine> nextInputs = new ArrayList<InputLine>();\r
             InputLine next = nextInput;\r
@@ -189,11 +189,11 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
             }\r
             return nextInputs;\r
         }\r
-        \r
+\r
         public int getMinCount() {\r
             return cardinality.min;\r
         }\r
-        \r
+\r
         public int getMaxCount() {\r
             return cardinality.max;\r
         }\r
@@ -202,22 +202,22 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
         public String toString() {\r
             return regex + " " + cardinality; //$NON-NLS-1$\r
         }\r
-        \r
+\r
     }\r
 \r
     public static class InputData {\r
         public String name;\r
         public int action;\r
         public String format;\r
-        \r
-        public InputData() {};\r
-        \r
+\r
+        public InputData() {}\r
+\r
         public InputData(String name, int action, String format) {\r
             this.name = name;\r
             this.action = action;\r
             this.format = format;\r
         }\r
-        \r
+\r
         public InputData(String name, int action) {\r
             this.name = name;\r
             this.action = action;\r
@@ -229,11 +229,11 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
         public final static Cardinality ONE = new Cardinality(1, 1);\r
         public final static Cardinality ONE_OR_MORE = new Cardinality(1, INF);\r
         public final static Cardinality ZERO_OR_ONE = new Cardinality(0, 1);\r
-        public final static Cardinality ZERO_OR_MORE = new Cardinality(0, INF); \r
-        \r
-        private int min;\r
-        private int max;\r
-        \r
+        public final static Cardinality ZERO_OR_MORE = new Cardinality(0, INF);\r
+\r
+        private final int min;\r
+        private final int max;\r
+\r
         public Cardinality(int min, int max) {\r
             this.min = min;\r
             this.max = max;\r
@@ -267,23 +267,25 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
             if (obj == null) {\r
                 return false;\r
             }\r
-            if (!(obj instanceof Cardinality)) return false;\r
+            if (!(obj instanceof Cardinality)) {\r
+                return false;\r
+            }\r
             Cardinality other = (Cardinality) obj;\r
             return (this.min == other.min && this.max == other.max);\r
         }\r
     }\r
-    \r
+\r
     @Override\r
        public void save() {\r
         save(CUSTOM_TXT_TRACE_DEFINITIONS_PATH_NAME);\r
     }\r
-    \r
+\r
     @Override\r
        public void save(String path) {\r
         try {\r
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\r
             DocumentBuilder db = dbf.newDocumentBuilder();\r
-            \r
+\r
             // The following allows xml parsing without access to the dtd\r
             EntityResolver resolver = new EntityResolver () {\r
                @Override\r
@@ -305,7 +307,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
                 public void fatalError(SAXParseException saxparseexception) throws SAXException {\r
                     throw saxparseexception;\r
                 }});\r
-            \r
+\r
             Document doc = null;\r
             File file = new File(path);\r
             if (file.canRead()) {\r
@@ -320,7 +322,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
             }\r
 \r
             Element root = doc.getDocumentElement();\r
-            \r
+\r
             NodeList nodeList = root.getChildNodes();\r
             for (int i = 0; i < nodeList.getLength(); i++) {\r
                 Node node = nodeList.item(i);\r
@@ -333,7 +335,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
             Element definitionElement = doc.createElement(DEFINITION_ELEMENT);\r
             root.appendChild(definitionElement);\r
             definitionElement.setAttribute(NAME_ATTRIBUTE, definitionName);\r
-            \r
+\r
             Element formatElement = doc.createElement(TIME_STAMP_OUTPUT_FORMAT_ELEMENT);\r
             definitionElement.appendChild(formatElement);\r
             formatElement.appendChild(doc.createTextNode(timeStampOutputFormat));\r
@@ -351,7 +353,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
                     outputColumnElement.setAttribute(NAME_ATTRIBUTE, output.name);\r
                 }\r
             }\r
-            \r
+\r
             Transformer transformer = TransformerFactory.newInstance().newTransformer();\r
             transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$\r
 \r
@@ -360,7 +362,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
             DOMSource source = new DOMSource(doc);\r
             transformer.transform(source, result);\r
             String xmlString = result.getWriter().toString();\r
-            \r
+\r
             FileWriter writer = new FileWriter(file);\r
             writer.write(xmlString);\r
             writer.close();\r
@@ -381,12 +383,12 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
 \r
     private Element createInputLineElement(InputLine inputLine, Document doc) {\r
         Element inputLineElement = doc.createElement(INPUT_LINE_ELEMENT);\r
-        \r
+\r
         Element cardinalityElement = doc.createElement(CARDINALITY_ELEMENT);\r
         inputLineElement.appendChild(cardinalityElement);\r
         cardinalityElement.setAttribute(MIN_ATTRIBUTE, Integer.toString(inputLine.cardinality.min));\r
         cardinalityElement.setAttribute(MAX_ATTRIBUTE, Integer.toString(inputLine.cardinality.max));\r
-        \r
+\r
         Element regexElement = doc.createElement(REGEX_ELEMENT);\r
         inputLineElement.appendChild(regexElement);\r
         regexElement.appendChild(doc.createTextNode(inputLine.regex));\r
@@ -402,20 +404,20 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
                 }\r
             }\r
         }\r
-        \r
+\r
         if (inputLine.childrenInputs != null) {\r
             for (InputLine childInputLine : inputLine.childrenInputs) {\r
                 inputLineElement.appendChild(createInputLineElement(childInputLine, doc));\r
             }\r
         }\r
-        \r
+\r
         return inputLineElement;\r
     }\r
-    \r
+\r
     public static CustomTxtTraceDefinition[] loadAll() {\r
         return loadAll(CUSTOM_TXT_TRACE_DEFINITIONS_PATH_NAME);\r
     }\r
-    \r
+\r
     public static CustomTxtTraceDefinition[] loadAll(String path) {\r
         try {\r
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\r
@@ -529,13 +531,15 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
         }\r
         return null;\r
     }\r
-    \r
+\r
     public static CustomTxtTraceDefinition extractDefinition(Element definitionElement) {\r
         CustomTxtTraceDefinition def = new CustomTxtTraceDefinition();\r
-        \r
+\r
         def.definitionName = definitionElement.getAttribute(NAME_ATTRIBUTE);\r
-        if (def.definitionName == null) return null;\r
-        \r
+        if (def.definitionName == null) {\r
+            return null;\r
+        }\r
+\r
         NodeList nodeList = definitionElement.getChildNodes();\r
         for (int i = 0; i < nodeList.getLength(); i++) {\r
             Node node = nodeList.item(i);\r
@@ -593,7 +597,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
         }\r
         return inputLine;\r
     }\r
-    \r
+\r
     public static void delete(String definitionName) {\r
         try {\r
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\r
@@ -638,7 +642,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
                     root.removeChild(node);\r
                 }\r
             }\r
-            \r
+\r
             Transformer transformer = TransformerFactory.newInstance().newTransformer();\r
             transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$\r
 \r
@@ -647,7 +651,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
             DOMSource source = new DOMSource(doc);\r
             transformer.transform(source, result);\r
             String xmlString = result.getWriter().toString();\r
-            \r
+\r
             FileWriter writer = new FileWriter(file);\r
             writer.write(xmlString);\r
             writer.close();\r
index e9ffee766505ee2c8d344c3777ea21c3b6b0e586..fb13a4c0cf707143a6a2f29fc7651a04db3f1c33 100644 (file)
@@ -225,7 +225,7 @@ public class CustomXmlTrace extends TmfTrace<CustomXmlEvent> implements ITmfEven
             }\r
         } catch (final IOException e) {\r
             Activator.getDefault().logError("Error parsing event. File: " + getPath(), e); //$NON-NLS-1$\r
-            \r
+\r
         }\r
         context.setLocation(NULL_LOCATION);\r
         return event;\r
@@ -306,7 +306,8 @@ public class CustomXmlTrace extends TmfTrace<CustomXmlEvent> implements ITmfEven
         }\r
     }\r
 \r
-    private void readQuote(final StringBuffer buffer, final RandomAccessFile raFile, final char eq) {\r
+    private static void readQuote(final StringBuffer buffer,\r
+            final RandomAccessFile raFile, final char eq) {\r
         try {\r
             int i;\r
             while ((i = raFile.read()) != -1) {\r
@@ -323,7 +324,8 @@ public class CustomXmlTrace extends TmfTrace<CustomXmlEvent> implements ITmfEven
         }\r
     }\r
 \r
-    private void readComment(final StringBuffer buffer, final RandomAccessFile raFile) {\r
+    private static void readComment(final StringBuffer buffer,\r
+            final RandomAccessFile raFile) {\r
         try {\r
             int numRead = 0;\r
             int i;\r
index 6e3dd5f05006f38e20fdfdbc23373c1798226e23..aa22b3ec33a022c552c0479862bfb31705be4933 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************\r
  * Copyright (c) 2010 Ericsson\r
- * \r
+ *\r
  * All rights reserved. This program and the accompanying materials are\r
  * made available under the terms of the Eclipse Public License v1.0 which\r
  * accompanies this distribution, and is available at\r
  * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
  * Contributors:\r
  *   Patrick Tasse - Initial API and implementation\r
  *******************************************************************************/\r
@@ -32,8 +32,8 @@ import javax.xml.transform.TransformerFactoryConfigurationError;
 import javax.xml.transform.dom.DOMSource;\r
 import javax.xml.transform.stream.StreamResult;\r
 \r
-import org.eclipse.linuxtools.internal.tmf.ui.Messages;\r
 import org.eclipse.linuxtools.internal.tmf.ui.Activator;\r
+import org.eclipse.linuxtools.internal.tmf.ui.Messages;\r
 import org.w3c.dom.Document;\r
 import org.w3c.dom.Element;\r
 import org.w3c.dom.Node;\r
@@ -63,12 +63,12 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
     private static final String ACTION_ATTRIBUTE = Messages.CustomXmlTraceDefinition_action;\r
     private static final String FORMAT_ATTRIBUTE = Messages.CustomXmlTraceDefinition_format;\r
     private static final String OUTPUT_COLUMN_ELEMENT = Messages.CustomXmlTraceDefinition_outputColumn;\r
-    \r
+\r
     public InputElement rootInputElement;\r
 \r
     public CustomXmlTraceDefinition() {\r
         this("", null, new ArrayList<OutputColumn>(), ""); //$NON-NLS-1$ //$NON-NLS-2$\r
-    };\r
+    }\r
 \r
     public CustomXmlTraceDefinition(String logtype, InputElement rootElement, List<OutputColumn> outputs, String timeStampOutputFormat) {\r
         this.definitionName = logtype;\r
@@ -87,9 +87,9 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
         public InputElement parentElement;\r
         public InputElement nextElement;\r
         public List<InputElement> childElements;\r
-        \r
-        public InputElement() {};\r
-        \r
+\r
+        public InputElement() {}\r
+\r
         public InputElement(String elementName, boolean logEntry, String inputName, int inputAction, String inputFormat, List<InputAttribute> attributes) {\r
             this.elementName = elementName;\r
             this.logEntry = logEntry;\r
@@ -98,7 +98,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
             this.inputFormat = inputFormat;\r
             this.attributes = attributes;\r
         }\r
-        \r
+\r
         public void addAttribute(InputAttribute attribute) {\r
             if (attributes == null) {\r
                 attributes = new ArrayList<InputAttribute>(1);\r
@@ -157,9 +157,9 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
         public String inputName;\r
         public int inputAction;\r
         public String inputFormat;\r
-        \r
-        public InputAttribute() {};\r
-        \r
+\r
+        public InputAttribute() {}\r
+\r
         public InputAttribute(String attributeName, String inputName, int inputAction, String inputFormat) {\r
             this.attributeName = attributeName;\r
             this.inputName = inputName;\r
@@ -172,13 +172,13 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
     public void save() {\r
         save(CUSTOM_XML_TRACE_DEFINITIONS_PATH_NAME);\r
     }\r
-    \r
+\r
        @Override\r
     public void save(String path) {\r
         try {\r
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\r
             DocumentBuilder db = dbf.newDocumentBuilder();\r
-            \r
+\r
             // The following allows xml parsing without access to the dtd\r
             EntityResolver resolver = new EntityResolver () {\r
                 @Override\r
@@ -200,7 +200,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
                                public void fatalError(SAXParseException saxparseexception) throws SAXException {\r
                     throw saxparseexception;\r
                 }});\r
-            \r
+\r
             Document doc = null;\r
             File file = new File(path);\r
             if (file.canRead()) {\r
@@ -215,7 +215,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
             }\r
 \r
             Element root = doc.getDocumentElement();\r
-            \r
+\r
             NodeList nodeList = root.getChildNodes();\r
             for (int i = 0; i < nodeList.getLength(); i++) {\r
                 Node node = nodeList.item(i);\r
@@ -228,7 +228,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
             Element definitionElement = doc.createElement(DEFINITION_ELEMENT);\r
             root.appendChild(definitionElement);\r
             definitionElement.setAttribute(NAME_ATTRIBUTE, definitionName);\r
-            \r
+\r
             Element formatElement = doc.createElement(TIME_STAMP_OUTPUT_FORMAT_ELEMENT);\r
             definitionElement.appendChild(formatElement);\r
             formatElement.appendChild(doc.createTextNode(timeStampOutputFormat));\r
@@ -244,7 +244,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
                     outputColumnElement.setAttribute(NAME_ATTRIBUTE, output.name);\r
                 }\r
             }\r
-            \r
+\r
             Transformer transformer = TransformerFactory.newInstance().newTransformer();\r
             transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$\r
 \r
@@ -253,7 +253,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
             DOMSource source = new DOMSource(doc);\r
             transformer.transform(source, result);\r
             String xmlString = result.getWriter().toString();\r
-            \r
+\r
             FileWriter writer = new FileWriter(file);\r
             writer.write(xmlString);\r
             writer.close();\r
@@ -271,11 +271,11 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
             Activator.getDefault().logError("Error saving CustomXmlTraceDefinition: path=" + path, e); //$NON-NLS-1$\r
         }\r
     }\r
-    \r
+\r
     private Element createInputElementElement(InputElement inputElement, Document doc) {\r
         Element inputElementElement = doc.createElement(INPUT_ELEMENT_ELEMENT);\r
         inputElementElement.setAttribute(NAME_ATTRIBUTE, inputElement.elementName);\r
-        \r
+\r
         if (inputElement.logEntry) {\r
             inputElementElement.setAttribute(LOG_ENTRY_ATTRIBUTE, Boolean.toString(inputElement.logEntry));\r
         }\r
@@ -304,20 +304,20 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
                 }\r
             }\r
         }\r
-        \r
+\r
         if (inputElement.childElements != null) {\r
             for (InputElement childInputElement : inputElement.childElements) {\r
                 inputElementElement.appendChild(createInputElementElement(childInputElement, doc));\r
             }\r
         }\r
-        \r
+\r
         return inputElementElement;\r
     }\r
-    \r
+\r
     public static CustomXmlTraceDefinition[] loadAll() {\r
         return loadAll(CUSTOM_XML_TRACE_DEFINITIONS_PATH_NAME);\r
     }\r
-    \r
+\r
     public static CustomXmlTraceDefinition[] loadAll(String path) {\r
         try {\r
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\r
@@ -431,13 +431,15 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
         }\r
         return null;\r
     }\r
-    \r
+\r
     public static CustomXmlTraceDefinition extractDefinition(Element definitionElement) {\r
         CustomXmlTraceDefinition def = new CustomXmlTraceDefinition();\r
-        \r
+\r
         def.definitionName = definitionElement.getAttribute(NAME_ATTRIBUTE);\r
-        if (def.definitionName == null) return null;\r
-        \r
+        if (def.definitionName == null) {\r
+            return null;\r
+        }\r
+\r
         NodeList nodeList = definitionElement.getChildNodes();\r
         for (int i = 0; i < nodeList.getLength(); i++) {\r
             Node node = nodeList.item(i);\r
@@ -503,7 +505,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
         }\r
         return inputElement;\r
     }\r
-    \r
+\r
     public static void delete(String definitionName) {\r
         try {\r
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\r
@@ -548,7 +550,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
                     root.removeChild(node);\r
                 }\r
             }\r
-            \r
+\r
             Transformer transformer = TransformerFactory.newInstance().newTransformer();\r
             transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$\r
 \r
@@ -557,7 +559,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
             DOMSource source = new DOMSource(doc);\r
             transformer.transform(source, result);\r
             String xmlString = result.getWriter().toString();\r
-            \r
+\r
             FileWriter writer = new FileWriter(file);\r
             writer.write(xmlString);\r
             writer.close();\r
index 636255ce3536fdb38f050fa10a4b9e31277acab7..e84e37d4caa8df0dba30ef7609c9668a7dab89c3 100644 (file)
@@ -29,8 +29,9 @@ import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeViewer;\r
 import org.eclipse.jface.viewers.Viewer;\r
 import org.eclipse.jface.wizard.WizardPage;\r
-import org.eclipse.linuxtools.internal.tmf.ui.Messages;\r
 import org.eclipse.linuxtools.internal.tmf.ui.Activator;\r
+import org.eclipse.linuxtools.internal.tmf.ui.Messages;\r
+import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTraceDefinition;\r
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition;\r
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.Cardinality;\r
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputData;\r
@@ -91,7 +92,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
     private static final Color COLOR_TEXT_BACKGROUND = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);\r
     private static final Color COLOR_WIDGET_BACKGROUND = Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);\r
 \r
-    private ISelection selection;\r
+    private final ISelection selection;\r
     private CustomTxtTraceDefinition definition;\r
     private String editDefinitionName;\r
     private String defaultDescription;\r
@@ -113,7 +114,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
     // variables used recursively through line traversal\r
     private String timeStampFormat;\r
     private boolean timestampFound;\r
-    \r
+\r
     protected CustomTxtParserInputWizardPage(ISelection selection, CustomTxtTraceDefinition definition) {\r
         super("CustomParserWizardPage"); //$NON-NLS-1$\r
         if (definition == null) {\r
@@ -137,23 +138,23 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         container.setLayout(new GridLayout());\r
 \r
         updateListener = new UpdateListener();\r
-        \r
+\r
         Composite headerComposite = new Composite(container, SWT.FILL);\r
         GridLayout headerLayout = new GridLayout(5, false);\r
         headerLayout.marginHeight = 0;\r
         headerLayout.marginWidth = 0;\r
         headerComposite.setLayout(headerLayout);\r
         headerComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
-        \r
+\r
         Label logtypeLabel = new Label(headerComposite, SWT.NULL);\r
         logtypeLabel.setText(Messages.CustomTxtParserInputWizardPage_logType);\r
-        \r
+\r
         logtypeText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE);\r
         logtypeText.setLayoutData(new GridData(120, SWT.DEFAULT));\r
-        \r
+\r
         Label timestampFormatLabel = new Label(headerComposite, SWT.NULL);\r
         timestampFormatLabel.setText(Messages.CustomTxtParserInputWizardPage_timestampFormat);\r
-        \r
+\r
         timestampOutputFormatText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE);\r
         timestampOutputFormatText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
         timestampOutputFormatText.setText(DEFAULT_TIMESTAMP_FORMAT);\r
@@ -167,11 +168,11 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 openHelpShell(SIMPLE_DATE_FORMAT_URL);\r
             }\r
         });\r
-        \r
+\r
         Label timestampPreviewLabel = new Label(headerComposite, SWT.NULL);\r
         timestampPreviewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 3, 1));\r
         timestampPreviewLabel.setText(Messages.CustomTxtParserInputWizardPage_preview);\r
-        \r
+\r
         timestampPreviewText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);\r
         timestampPreviewText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));\r
         timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noMatchingTimestamp);\r
@@ -181,14 +182,16 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         buttonBarLayout.marginHeight = 0;\r
         buttonBarLayout.marginWidth = 0;\r
         buttonBar.setLayout(buttonBarLayout);\r
-        \r
+\r
         Button removeButton = new Button(buttonBar, SWT.PUSH);\r
         removeButton.setImage(deleteImage);\r
         removeButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_removeLine);\r
         removeButton.addSelectionListener(new SelectionAdapter() {\r
                @Override\r
             public void widgetSelected(SelectionEvent e) {\r
-                if (treeViewer.getSelection().isEmpty() || selectedLine == null) return;\r
+                if (treeViewer.getSelection().isEmpty() || selectedLine == null) {\r
+                    return;\r
+                }\r
                 removeLine();\r
                 InputLine inputLine = (InputLine) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();\r
                 if (inputLine.parentInput == null) {\r
@@ -253,7 +256,9 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         moveUpButton.addSelectionListener(new SelectionAdapter() {\r
                @Override\r
             public void widgetSelected(SelectionEvent e) {\r
-                if (treeViewer.getSelection().isEmpty()) return;\r
+                if (treeViewer.getSelection().isEmpty()) {\r
+                    return;\r
+                }\r
                 InputLine inputLine = (InputLine) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();\r
                 if (inputLine.parentInput == null) {\r
                     for (int i = 1; i < definition.inputs.size(); i++) {\r
@@ -276,7 +281,9 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         moveDownButton.addSelectionListener(new SelectionAdapter() {\r
                @Override\r
             public void widgetSelected(SelectionEvent e) {\r
-                if (treeViewer.getSelection().isEmpty()) return;\r
+                if (treeViewer.getSelection().isEmpty()) {\r
+                    return;\r
+                }\r
                 InputLine inputLine = (InputLine) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();\r
                 if (inputLine.parentInput == null) {\r
                     for (int i = 0; i < definition.inputs.size() - 1; i++) {\r
@@ -293,7 +300,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 updatePreviews();\r
             }\r
         });\r
-        \r
+\r
         SashForm vSash = new SashForm(container, SWT.VERTICAL);\r
         vSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));\r
         vSash.setBackground(vSash.getDisplay().getSystemColor(SWT.COLOR_GRAY));\r
@@ -311,15 +318,15 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         treeScrolledComposite.setContent(treeContainer);\r
         treeScrolledComposite.setExpandHorizontal(true);\r
         treeScrolledComposite.setExpandVertical(true);\r
-        \r
+\r
         treeViewer = new TreeViewer(treeContainer, SWT.SINGLE | SWT.BORDER);\r
         treeViewer.setContentProvider(new InputLineTreeNodeContentProvider());\r
         treeViewer.setLabelProvider(new InputLineTreeLabelProvider());\r
         treeViewer.addSelectionChangedListener(new InputLineTreeSelectionChangedListener());\r
         treeContainer.layout();\r
-        \r
+\r
         treeScrolledComposite.setMinSize(treeContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, treeContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);\r
-        \r
+\r
         lineScrolledComposite = new ScrolledComposite(hSash, SWT.V_SCROLL);\r
         lineScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));\r
         lineContainer = new Composite(lineScrolledComposite, SWT.NONE);\r
@@ -334,19 +341,19 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         if (definition == null) {\r
             definition = new CustomTxtTraceDefinition();\r
             definition.inputs.add(new InputLine(Cardinality.ZERO_OR_MORE, DEFAULT_REGEX,\r
-                    Arrays.asList(new InputData(CustomTxtTraceDefinition.TAG_MESSAGE, CustomTxtTraceDefinition.ACTION_SET))));\r
+                    Arrays.asList(new InputData(CustomTraceDefinition.TAG_MESSAGE, CustomTraceDefinition.ACTION_SET))));\r
         }\r
         loadDefinition(definition);\r
         treeViewer.expandAll();\r
         lineContainer.layout();\r
-        \r
+\r
         logtypeText.addModifyListener(updateListener);\r
         timestampOutputFormatText.addModifyListener(updateListener);\r
-        \r
+\r
         lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-1);\r
 \r
         hSash.setWeights(new int[] {1, 2});\r
-        \r
+\r
         Composite sashBottom = new Composite(vSash, SWT.NONE);\r
         GridLayout sashBottomLayout = new GridLayout(3, false);\r
         sashBottomLayout.marginHeight = 0;\r
@@ -366,7 +373,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 updatePreviews(true);\r
             }\r
         });\r
-        \r
+\r
         Button legendButton = new Button(sashBottom, SWT.PUSH);\r
         legendButton.setImage(helpImage);\r
         legendButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_previewLegend);\r
@@ -377,7 +384,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 openLegend();\r
             }\r
         });\r
-        \r
+\r
         inputText = new StyledText(sashBottom, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);\r
         if (fixedFont == null) {\r
             if (System.getProperty("os.name").contains("Windows")) { //$NON-NLS-1$  //$NON-NLS-2$\r
@@ -395,9 +402,9 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         inputText.addModifyListener(updateListener);\r
 \r
         vSash.setWeights(new int[] {hSash.computeSize(SWT.DEFAULT, SWT.DEFAULT).y, sashBottom.computeSize(SWT.DEFAULT, SWT.DEFAULT).y});\r
-        \r
+\r
         setControl(container);\r
-        \r
+\r
         validate();\r
         updatePreviews();\r
     }\r
@@ -412,7 +419,9 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
        @Override\r
         public Object[] getChildren(Object parentElement) {\r
             InputLine inputLine = (InputLine) parentElement;\r
-            if (inputLine.childrenInputs == null) return new InputLine[0];\r
+            if (inputLine.childrenInputs == null) {\r
+                return new InputLine[0];\r
+            }\r
             return inputLine.childrenInputs.toArray();\r
         }\r
 \r
@@ -436,7 +445,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             return inputLine.parentInput;\r
         }\r
     }\r
-    \r
+\r
     private class InputLineTreeLabelProvider extends ColumnLabelProvider {\r
 \r
         @Override\r
@@ -449,9 +458,8 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             InputLine inputLine = (InputLine) element;\r
             if (inputLine.parentInput == null) {\r
                 return "Root Line " + getName(inputLine) + " " + inputLine.cardinality.toString() + " : " + inputLine.getRegex(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-            } else {\r
-                return "Line " + getName(inputLine) + " " + inputLine.cardinality.toString() + " : " + inputLine.getRegex(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
             }\r
+            return "Line " + getName(inputLine) + " " + inputLine.cardinality.toString() + " : " + inputLine.getRegex(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
         }\r
     }\r
 \r
@@ -473,7 +481,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             }\r
         }\r
     }\r
-    \r
+\r
     /* (non-Javadoc)\r
      * @see org.eclipse.jface.dialogs.DialogPage#dispose()\r
      */\r
@@ -514,7 +522,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }\r
         return inputs;\r
     }\r
-    \r
+\r
     public List<String> getInputNames(InputLine inputLine) {\r
         List<String> inputs = new ArrayList<String>();\r
         if (inputLine.columns != null) {\r
@@ -536,7 +544,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }\r
         return inputs;\r
     }\r
-    \r
+\r
     private void removeLine() {\r
         selectedLine.dispose();\r
         selectedLine = null;\r
@@ -575,7 +583,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }\r
         return ""; //$NON-NLS-1$\r
     }\r
-    \r
+\r
     private void updatePreviews() {\r
         updatePreviews(false);\r
     }\r
@@ -586,7 +594,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             return;\r
         }\r
         inputText.setStyleRanges(new StyleRange[] {});\r
-        \r
+\r
         Scanner scanner = new Scanner(inputText.getText());\r
         scanner.useDelimiter("\n"); //$NON-NLS-1$\r
         int rawPos = 0;\r
@@ -594,21 +602,21 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         if ((skip = scanner.findWithinHorizon("\\A\n+", 0)) != null) { //$NON-NLS-1$\r
             rawPos += skip.length();\r
         }\r
-        \r
+\r
         timeStampFormat = null;\r
         if (selectedLine != null) {\r
             for (InputGroup input : selectedLine.inputs) {\r
                 input.previewText.setText(Messages.CustomTxtParserInputWizardPage_noMathcingLine);\r
             }\r
         }\r
-        \r
+\r
         Map<String, String> data = new HashMap<String, String>();\r
         int rootLineMatches = 0;\r
         String firstEntryTimeStamp = null;\r
         String firstEntryTimeStampInputFormat = null;\r
         String log = null;\r
-    event: \r
-        while (log != null || scanner.hasNext()) {\r
+    event:\r
+        while (scanner.hasNext()) {\r
             if (rootLineMatches > 0 && !updateAll) {\r
                 break;\r
             }\r
@@ -632,7 +640,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                     timeStampFormat = null;\r
                     updatePreviewLine(rootInputLine, matcher, data, rawPos, rootLineMatches);\r
                     if (rootLineMatches == 1) {\r
-                        firstEntryTimeStamp = data.get(CustomTxtTraceDefinition.TAG_TIMESTAMP);\r
+                        firstEntryTimeStamp = data.get(CustomTraceDefinition.TAG_TIMESTAMP);\r
                         firstEntryTimeStampInputFormat = timeStampFormat;\r
                     }\r
                     HashMap<InputLine, Integer> countMap = new HashMap<InputLine, Integer>();\r
@@ -753,14 +761,14 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }\r
         scanner.close();\r
         if (rootLineMatches == 1) {\r
-            firstEntryTimeStamp = data.get(CustomTxtTraceDefinition.TAG_TIMESTAMP);\r
+            firstEntryTimeStamp = data.get(CustomTraceDefinition.TAG_TIMESTAMP);\r
             firstEntryTimeStampInputFormat = timeStampFormat;\r
         }\r
         if (firstEntryTimeStamp == null) {\r
             timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noTimestampGroup);\r
             if (selectedLine != null) {\r
                 for (InputGroup group : selectedLine.inputs) {\r
-                    if (group.tagCombo.getText().equals(CustomTxtTraceDefinition.TAG_TIMESTAMP)) {\r
+                    if (group.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                         timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noMatchingTimestamp);\r
                         break;\r
                     }\r
@@ -801,33 +809,33 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 if (value.length() == 0) {\r
                     continue;\r
                 }\r
-                if (input.action == CustomTxtTraceDefinition.ACTION_SET) {\r
+                if (input.action == CustomTraceDefinition.ACTION_SET) {\r
                     data.put(input.name, value);\r
-                    if (input.name.equals(CustomTxtTraceDefinition.TAG_TIMESTAMP)) {\r
+                    if (input.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                         timeStampFormat = input.format;\r
                     }\r
-                } else if (input.action == CustomTxtTraceDefinition.ACTION_APPEND) {\r
+                } else if (input.action == CustomTraceDefinition.ACTION_APPEND) {\r
                     String s = data.get(input.name);\r
                     if (s != null) {\r
                         data.put(input.name, s + value);\r
                     } else {\r
                         data.put(input.name, value);\r
                     }\r
-                    if (input.name.equals(CustomTxtTraceDefinition.TAG_TIMESTAMP)) {\r
+                    if (input.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                         if (timeStampFormat != null) {\r
                             timeStampFormat += input.format;\r
                         } else {\r
                             timeStampFormat = input.format;\r
                         }\r
                     }\r
-                } else if (input.action == CustomTxtTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {\r
+                } else if (input.action == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {\r
                     String s = data.get(input.name);\r
                     if (s != null) {\r
                         data.put(input.name, s + " | " + value); //$NON-NLS-1$\r
                     } else {\r
                         data.put(input.name, value);\r
                     }\r
-                    if (input.name.equals(CustomTxtTraceDefinition.TAG_TIMESTAMP)) {\r
+                    if (input.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                         if (timeStampFormat != null) {\r
                             timeStampFormat += " | " + input.format; //$NON-NLS-1$\r
                         } else {\r
@@ -856,7 +864,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             }\r
         }\r
     }\r
-    \r
+\r
     private void openHelpShell(String url) {\r
         if (helpBrowser != null && !helpBrowser.isDisposed()) {\r
             helpBrowser.getShell().setActive();\r
@@ -895,8 +903,8 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         int line5start = line4start + line4.length();\r
         String line5 = Messages.CustomTxtParserInputWizardPage_nonMatchingLine;\r
         int line6start = line5start + line5.length();\r
-        String line6 = Messages.CustomTxtParserInputWizardPage_matchingRootLine + CG + " " + UCG + " " + UT + " \n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ \r
\r
+        String line6 = Messages.CustomTxtParserInputWizardPage_matchingRootLine + CG + " " + UCG + " " + UT + " \n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
+\r
         final Shell legendShell = new Shell(getShell(), SWT.DIALOG_TRIM);\r
         legendShell.setLayout(new FillLayout());\r
         StyledText legendText = new StyledText(legendShell, SWT.MULTI);\r
@@ -940,7 +948,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }\r
 \r
     }\r
-    \r
+\r
     private class Line {\r
         private static final String INFINITY_STRING = "\u221E"; //$NON-NLS-1$\r
         InputLine inputLine;\r
@@ -957,39 +965,39 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         List<InputGroup> inputs = new ArrayList<InputGroup>();\r
         Button addGroupButton;\r
         Label addGroupLabel;\r
-        \r
+\r
         public Line(Composite parent, String name, InputLine inputLine) {\r
             this.inputLine = inputLine;\r
-            \r
+\r
             group = new Group(parent, SWT.NONE);\r
             group.setText(name);\r
             group.setLayout(new GridLayout(2, false));\r
             group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
-            \r
+\r
             labelComposite = new Composite(group, SWT.FILL);\r
             GridLayout labelLayout = new GridLayout(1, false);\r
             labelLayout.marginWidth = 0;\r
             labelLayout.marginHeight = 0;\r
             labelComposite.setLayout(labelLayout);\r
             labelComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));\r
-            \r
+\r
             Label label = new Label(labelComposite, SWT.NULL);\r
             label.setText(Messages.CustomTxtParserInputWizardPage_regularExpression);\r
-            \r
+\r
             Composite regexContainer = new Composite(group, SWT.NONE);\r
             GridLayout regexLayout = new GridLayout(2, false);\r
             regexLayout.marginHeight = 0;\r
             regexLayout.marginWidth = 0;\r
             regexContainer.setLayout(regexLayout);\r
             regexContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
-            \r
+\r
             regexText = new Text(regexContainer, SWT.BORDER | SWT.SINGLE);\r
             GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);\r
             gd.widthHint = 0;\r
             regexText.setLayoutData(gd);\r
             regexText.setText(inputLine.getRegex());\r
             regexText.addModifyListener(updateListener);\r
-            \r
+\r
             Button regexHelpButton = new Button(regexContainer, SWT.PUSH);\r
             regexHelpButton.setImage(helpImage);\r
             regexHelpButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_regularExpressionHelp);\r
@@ -999,11 +1007,11 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                     openHelpShell(PATTERN_URL);\r
                 }\r
             });\r
-            \r
+\r
             label = new Label(group, SWT.NONE);\r
             label.setText(Messages.CustomTxtParserInputWizardPage_cardinality);\r
             label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));\r
-            \r
+\r
             cardinalityContainer = new Composite(group, SWT.NONE);\r
             GridLayout cardinalityLayout = new GridLayout(6, false);\r
             cardinalityLayout.marginHeight = 0;\r
@@ -1043,23 +1051,23 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                     validate();\r
                     updatePreviews();\r
                 }});\r
-            \r
+\r
             cardinalityMinLabel = new Label(cardinalityContainer, SWT.NONE);\r
             cardinalityMinLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));\r
             cardinalityMinLabel.setText(Messages.CustomTxtParserInputWizardPage_min);\r
             cardinalityMinLabel.setVisible(false);\r
-            \r
+\r
             cardinalityMinText = new Text(cardinalityContainer, SWT.BORDER | SWT.SINGLE);\r
             gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);\r
             gd.widthHint = 20;\r
             cardinalityMinText.setLayoutData(gd);\r
             cardinalityMinText.setVisible(false);\r
-            \r
+\r
             cardinalityMaxLabel = new Label(cardinalityContainer, SWT.NONE);\r
             cardinalityMaxLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));\r
             cardinalityMaxLabel.setText(Messages.CustomTxtParserInputWizardPage_max);\r
             cardinalityMaxLabel.setVisible(false);\r
-            \r
+\r
             cardinalityMaxText = new Text(cardinalityContainer, SWT.BORDER | SWT.SINGLE);\r
             gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);\r
             gd.widthHint = 20;\r
@@ -1099,7 +1107,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 }\r
                 infiniteButton.setVisible(true);\r
             }\r
-            \r
+\r
             VerifyListener digitsListener = new VerifyListener() {\r
                @Override\r
                 public void verifyText(VerifyEvent e) {\r
@@ -1117,7 +1125,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                         }\r
                     }\r
                 }};\r
-                \r
+\r
             cardinalityMinText.addModifyListener(updateListener);\r
             cardinalityMaxText.addModifyListener(updateListener);\r
             cardinalityMinText.addVerifyListener(digitsListener);\r
@@ -1126,14 +1134,14 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             if (inputLine.columns != null) {\r
                 for (InputData inputData : inputLine.columns) {\r
                     InputGroup inputGroup = new InputGroup(group, this, inputs.size()+1);\r
-                    if (inputData.name.equals(CustomTxtTraceDefinition.TAG_TIMESTAMP)) {\r
+                    if (inputData.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                         inputGroup.tagCombo.select(0);\r
                         inputGroup.tagText.setText(inputData.format);\r
                         inputGroup.tagLabel.setText(Messages.CustomTxtParserInputWizardPage_format);\r
                         inputGroup.tagLabel.setVisible(true);\r
                         inputGroup.tagText.setVisible(true);\r
                         inputGroup.tagText.addModifyListener(updateListener);\r
-                    } else if (inputData.name.equals(CustomTxtTraceDefinition.TAG_MESSAGE)) {\r
+                    } else if (inputData.name.equals(CustomTraceDefinition.TAG_MESSAGE)) {\r
                         inputGroup.tagCombo.select(1);\r
                     } else {\r
                         inputGroup.tagCombo.select(2);\r
@@ -1147,7 +1155,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                     inputs.add(inputGroup);\r
                 }\r
             }\r
-            \r
+\r
             createAddGroupButton();\r
         }\r
 \r
@@ -1169,7 +1177,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                     updatePreviews();\r
                 }\r
             });\r
-            \r
+\r
             addGroupLabel = new Label(group, SWT.NULL);\r
             addGroupLabel.setText(Messages.CustomTxtParserInputWizardPage_newGroup);\r
         }\r
@@ -1178,7 +1186,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             addGroupButton.dispose();\r
             addGroupLabel.dispose();\r
         }\r
-        \r
+\r
         private void removeInput(int inputNumber) {\r
             if (--inputNumber < inputs.size()) {\r
                 inputs.remove(inputNumber).dispose();\r
@@ -1190,16 +1198,16 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 group.getParent().layout();\r
             }\r
         }\r
-        \r
+\r
 //        private void setName(String name) {\r
 //            this.name = name;\r
 //            group.setText("Line " + name);\r
 //        }\r
-        \r
+\r
         private void dispose() {\r
             group.dispose();\r
         }\r
-        \r
+\r
         private void extractInputs() {\r
             inputLine.setRegex(selectedLine.regexText.getText());\r
             switch (cardinalityCombo.getSelectionIndex()) {\r
@@ -1241,11 +1249,11 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             for (int i = 0; i < inputs.size(); i++) {\r
                 InputGroup group = inputs.get(i);\r
                 InputData inputData = new InputData();\r
-                if (group.tagCombo.getText().equals(CustomTxtTraceDefinition.TAG_OTHER)) {\r
+                if (group.tagCombo.getText().equals(CustomTraceDefinition.TAG_OTHER)) {\r
                     inputData.name = group.tagText.getText().trim();\r
                 } else {\r
                     inputData.name = group.tagCombo.getText();\r
-                    if (group.tagCombo.getText().equals(CustomTxtTraceDefinition.TAG_TIMESTAMP)) {\r
+                    if (group.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                         inputData.format = group.tagText.getText().trim();\r
                     }\r
                 }\r
@@ -1258,7 +1266,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
     private class InputGroup {\r
         Line line;\r
         int inputNumber;\r
-        \r
+\r
         // children of parent (must be disposed)\r
         Composite labelComposite;\r
         Composite tagComposite;\r
@@ -1267,24 +1275,24 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 \r
         // children of labelComposite\r
         Label inputLabel;\r
-        \r
+\r
         // children of tagComposite\r
         Combo tagCombo;\r
         Label tagLabel;\r
         Text tagText;\r
         Combo actionCombo;\r
-        \r
+\r
         public InputGroup(Composite parent, Line line, int inputNumber) {\r
             this.line = line;\r
             this.inputNumber = inputNumber;\r
-            \r
+\r
             labelComposite = new Composite(parent, SWT.FILL);\r
             GridLayout labelLayout = new GridLayout(2, false);\r
             labelLayout.marginWidth = 0;\r
             labelLayout.marginHeight = 0;\r
             labelComposite.setLayout(labelLayout);\r
             labelComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));\r
-            \r
+\r
             Button deleteButton = new Button(labelComposite, SWT.PUSH);\r
             deleteButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));\r
             deleteButton.setImage(deleteImage);\r
@@ -1297,7 +1305,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                     updatePreviews();\r
                 }\r
             });\r
-            \r
+\r
             inputLabel = new Label(labelComposite, SWT.NULL);\r
             inputLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));\r
             inputLabel.setText(Messages.CustomTxtParserInputWizardPage_group + inputNumber + ":"); //$NON-NLS-1$\r
@@ -1308,11 +1316,11 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             tagLayout.marginHeight = 0;\r
             tagComposite.setLayout(tagLayout);\r
             tagComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
-            \r
+\r
             tagCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);\r
-            tagCombo.setItems(new String[] {CustomTxtTraceDefinition.TAG_TIMESTAMP,\r
-                                            CustomTxtTraceDefinition.TAG_MESSAGE,\r
-                                            CustomTxtTraceDefinition.TAG_OTHER});\r
+            tagCombo.setItems(new String[] {CustomTraceDefinition.TAG_TIMESTAMP,\r
+                                            CustomTraceDefinition.TAG_MESSAGE,\r
+                                            CustomTraceDefinition.TAG_OTHER});\r
             tagCombo.select(1);\r
             tagCombo.addSelectionListener(new SelectionListener(){\r
                @Override\r
@@ -1341,31 +1349,33 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                         tagLabel.setVisible(false);\r
                         tagText.setVisible(false);\r
                         break;\r
+                    default:\r
+                        break;\r
                     }\r
                     tagComposite.layout();\r
                     validate();\r
                     updatePreviews();\r
                 }});\r
-            \r
+\r
             tagLabel = new Label(tagComposite, SWT.NULL);\r
             tagLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));\r
             tagLabel.setVisible(false);\r
-            \r
+\r
             tagText = new Text(tagComposite, SWT.BORDER | SWT.SINGLE);\r
             GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);\r
             gd.widthHint = 0;\r
             tagText.setLayoutData(gd);\r
             tagText.setVisible(false);\r
-            \r
+\r
             actionCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);\r
             actionCombo.setItems(new String[] {Messages.CustomTxtParserInputWizardPage_set, Messages.CustomTxtParserInputWizardPage_append, Messages.CustomTxtParserInputWizardPage_appendWith});\r
             actionCombo.select(0);\r
             actionCombo.addSelectionListener(updateListener);\r
-            \r
+\r
             previewLabel = new Label(parent, SWT.NULL);\r
             previewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));\r
             previewLabel.setText(Messages.CustomTxtParserInputWizardPage_preview);\r
-            \r
+\r
             previewText = new Text(parent, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);\r
             gd = new GridData(SWT.FILL, SWT.CENTER, true, false);\r
             gd.widthHint = 0;\r
@@ -1373,14 +1383,14 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             previewText.setText(Messages.CustomTxtParserInputWizardPage_noMatch);\r
             previewText.setBackground(COLOR_WIDGET_BACKGROUND);\r
         }\r
-        \r
+\r
         private void dispose() {\r
             labelComposite.dispose();\r
             tagComposite.dispose();\r
             previewLabel.dispose();\r
             previewText.dispose();\r
         }\r
-        \r
+\r
         private void setInputNumber(int inputNumber) {\r
             this.inputNumber = inputNumber;\r
             inputLabel.setText(Messages.CustomTxtParserInputWizardPage_group + inputNumber + ":"); //$NON-NLS-1$\r
@@ -1392,14 +1402,14 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 \r
         definition.definitionName = logtypeText.getText().trim();\r
         definition.timeStampOutputFormat = timestampOutputFormatText.getText().trim();\r
-        \r
+\r
         if (selectedLine != null) {\r
             selectedLine.extractInputs();\r
             treeViewer.refresh();\r
         }\r
-        \r
+\r
         StringBuffer errors = new StringBuffer();\r
-        \r
+\r
         if (definition.definitionName.length() == 0) {\r
             errors.append("Enter a name for the new log type. "); //$NON-NLS-1$\r
             logtypeText.setBackground(COLOR_LIGHT_RED);\r
@@ -1415,10 +1425,10 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 }\r
             }\r
         }\r
-        \r
+\r
         timestampFound = false;\r
         for (int i = 0; i < definition.inputs.size(); i++) {\r
-            \r
+\r
             InputLine inputLine = definition.inputs.get(i);\r
             String name = Integer.toString(i+1);\r
             errors.append(validateLine(inputLine, name));\r
@@ -1436,7 +1446,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                     timestampOutputFormatText.setBackground(COLOR_LIGHT_RED);\r
                 }\r
             }\r
-            \r
+\r
         } else {\r
             timestampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND);\r
 //            timestampPreviewText.setBackground(COLOR_WIDGET_BACKGROUND);\r
@@ -1457,53 +1467,83 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
     public StringBuffer validateLine(InputLine inputLine, String name) {\r
         StringBuffer errors = new StringBuffer();\r
         Line line = null;\r
-        if (selectedLine != null && selectedLine.inputLine.equals(inputLine)) line = selectedLine;\r
+        if (selectedLine != null && selectedLine.inputLine.equals(inputLine)) {\r
+            line = selectedLine;\r
+        }\r
         try {\r
             Pattern.compile(inputLine.getRegex());\r
-            if (line != null) line.regexText.setBackground(COLOR_TEXT_BACKGROUND);\r
+            if (line != null) {\r
+                line.regexText.setBackground(COLOR_TEXT_BACKGROUND);\r
+            }\r
         } catch (PatternSyntaxException e) {\r
             errors.append("Enter a valid regular expression (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$\r
-            if (line != null) line.regexText.setBackground(COLOR_LIGHT_RED);\r
+            if (line != null) {\r
+                line.regexText.setBackground(COLOR_LIGHT_RED);\r
+            }\r
         }\r
         if (inputLine.getMinCount() == -1) {\r
             errors.append("Enter a minimum value for cardinality (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$\r
-            if (line != null) line.cardinalityMinText.setBackground(COLOR_LIGHT_RED);\r
+            if (line != null) {\r
+                line.cardinalityMinText.setBackground(COLOR_LIGHT_RED);\r
+            }\r
         } else {\r
-            if (line != null) line.cardinalityMinText.setBackground(COLOR_TEXT_BACKGROUND);\r
+            if (line != null) {\r
+                line.cardinalityMinText.setBackground(COLOR_TEXT_BACKGROUND);\r
+            }\r
         }\r
         if (inputLine.getMaxCount() == -1) {\r
             errors.append("Enter a maximum value for cardinality (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$\r
-            if (line != null) line.cardinalityMaxText.setBackground(COLOR_LIGHT_RED);\r
+            if (line != null) {\r
+                line.cardinalityMaxText.setBackground(COLOR_LIGHT_RED);\r
+            }\r
         } else if (inputLine.getMinCount() > inputLine.getMaxCount()) {\r
             errors.append("Enter correct (min <= max) values for cardinality (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$\r
-            if (line != null) line.cardinalityMinText.setBackground(COLOR_LIGHT_RED);\r
-            if (line != null) line.cardinalityMaxText.setBackground(COLOR_LIGHT_RED);\r
+            if (line != null) {\r
+                line.cardinalityMinText.setBackground(COLOR_LIGHT_RED);\r
+            }\r
+            if (line != null) {\r
+                line.cardinalityMaxText.setBackground(COLOR_LIGHT_RED);\r
+            }\r
         } else {\r
-            if (line != null) line.cardinalityMaxText.setBackground(COLOR_TEXT_BACKGROUND);\r
+            if (line != null) {\r
+                line.cardinalityMaxText.setBackground(COLOR_TEXT_BACKGROUND);\r
+            }\r
         }\r
         for (int i = 0; inputLine.columns != null && i < inputLine.columns.size(); i++) {\r
             InputData inputData = inputLine.columns.get(i);\r
             InputGroup group = null;\r
-            if (line != null) group = line.inputs.get(i);\r
-            if (inputData.name.equals(CustomTxtTraceDefinition.TAG_TIMESTAMP)) {\r
+            if (line != null) {\r
+                group = line.inputs.get(i);\r
+            }\r
+            if (inputData.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                 timestampFound = true;\r
                 if (inputData.format.length() == 0) {\r
                     errors.append("Enter the input format for the Time Stamp (Line "+name+" Group "+(i+1)+"). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-                    if (group != null) group.tagText.setBackground(COLOR_LIGHT_RED);\r
+                    if (group != null) {\r
+                        group.tagText.setBackground(COLOR_LIGHT_RED);\r
+                    }\r
                 } else {\r
                     try {\r
                         new SimpleDateFormat(inputData.format);\r
-                        if (group != null) group.tagText.setBackground(COLOR_TEXT_BACKGROUND);\r
+                        if (group != null) {\r
+                            group.tagText.setBackground(COLOR_TEXT_BACKGROUND);\r
+                        }\r
                     } catch (IllegalArgumentException e) {\r
                         errors.append("Enter a valid input format for the Time Stamp (Line "+name+" Group "+(i+1)+"). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-                        if (group != null) group.tagText.setBackground(COLOR_LIGHT_RED);\r
+                        if (group != null) {\r
+                            group.tagText.setBackground(COLOR_LIGHT_RED);\r
+                        }\r
                     }\r
                 }\r
             } else if (inputData.name.length() == 0) {\r
                 errors.append("Enter a name for the data group (Line "+name+" Group "+(i+1)+"). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-                if (group != null) group.tagText.setBackground(COLOR_LIGHT_RED);\r
+                if (group != null) {\r
+                    group.tagText.setBackground(COLOR_LIGHT_RED);\r
+                }\r
             } else {\r
-                if (group != null) group.tagText.setBackground(COLOR_TEXT_BACKGROUND);\r
+                if (group != null) {\r
+                    group.tagText.setBackground(COLOR_TEXT_BACKGROUND);\r
+                }\r
             }\r
         }\r
         for (int i = 0; inputLine.childrenInputs != null && i < inputLine.childrenInputs.size(); i++) {\r
@@ -1511,7 +1551,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }\r
         return errors;\r
     }\r
-    \r
+\r
     public CustomTxtTraceDefinition getDefinition() {\r
         return definition;\r
     }\r
index 57f1da4090ac2f316efb1d2d008dc0077639ed87..11c6eb1c19629800b7620e5d8aaa57bd2731f584 100644 (file)
@@ -17,6 +17,7 @@ import javax.xml.parsers.ParserConfigurationException;
 \r
 import org.eclipse.core.resources.IFile;\r
 import org.eclipse.core.runtime.CoreException;\r
+import org.eclipse.jface.viewers.AbstractTreeViewer;\r
 import org.eclipse.jface.viewers.ColumnLabelProvider;\r
 import org.eclipse.jface.viewers.ISelection;\r
 import org.eclipse.jface.viewers.ISelectionChangedListener;\r
@@ -27,8 +28,9 @@ import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeViewer;\r
 import org.eclipse.jface.viewers.Viewer;\r
 import org.eclipse.jface.wizard.WizardPage;\r
-import org.eclipse.linuxtools.internal.tmf.ui.Messages;\r
 import org.eclipse.linuxtools.internal.tmf.ui.Activator;\r
+import org.eclipse.linuxtools.internal.tmf.ui.Messages;\r
+import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTraceDefinition;\r
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTrace;\r
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTraceDefinition;\r
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTraceDefinition.InputAttribute;\r
@@ -301,8 +303,9 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
         removeButton.addSelectionListener(new SelectionAdapter() {\r
             @Override\r
             public void widgetSelected(SelectionEvent e) {\r
-                if (treeViewer.getSelection().isEmpty() || selectedElement == null)\r
+                if (treeViewer.getSelection().isEmpty() || selectedElement == null) {\r
                     return;\r
+                }\r
                 removeElement();\r
                 InputElement inputElement = (InputElement) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();\r
                 if (inputElement == definition.rootInputElement) {\r
@@ -364,10 +367,9 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                     InputElement previousInputElement = (InputElement) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();\r
                     if (previousInputElement == definition.rootInputElement) {\r
                         return;\r
-                    } else {\r
-                        previousInputElement.addNext(inputElement);\r
-                        inputElement.elementName = getChildNameSuggestion(inputElement.parentElement);\r
                     }\r
+                    previousInputElement.addNext(inputElement);\r
+                    inputElement.elementName = getChildNameSuggestion(inputElement.parentElement);\r
                 }\r
                 treeViewer.refresh();\r
                 treeViewer.setSelection(new StructuredSelection(inputElement), true);\r
@@ -397,7 +399,7 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                 }\r
                 treeViewer.refresh();\r
                 treeViewer.setSelection(new StructuredSelection(inputElement), true);\r
-                treeViewer.expandToLevel(inputElement, TreeViewer.ALL_LEVELS);\r
+                treeViewer.expandToLevel(inputElement, AbstractTreeViewer.ALL_LEVELS);\r
             }\r
         });\r
 \r
@@ -407,14 +409,14 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
         moveUpButton.addSelectionListener(new SelectionAdapter() {\r
             @Override\r
             public void widgetSelected(SelectionEvent e) {\r
-                if (treeViewer.getSelection().isEmpty())\r
+                if (treeViewer.getSelection().isEmpty()) {\r
                     return;\r
+                }\r
                 InputElement inputElement = (InputElement) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();\r
                 if (inputElement == definition.rootInputElement) {\r
                     return;\r
-                } else {\r
-                    inputElement.moveUp();\r
                 }\r
+                inputElement.moveUp();\r
                 treeViewer.refresh();\r
                 validate();\r
                 updatePreviews();\r
@@ -427,14 +429,14 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
         moveDownButton.addSelectionListener(new SelectionAdapter() {\r
             @Override\r
             public void widgetSelected(SelectionEvent e) {\r
-                if (treeViewer.getSelection().isEmpty())\r
+                if (treeViewer.getSelection().isEmpty()) {\r
                     return;\r
+                }\r
                 InputElement inputElement = (InputElement) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();\r
                 if (inputElement == definition.rootInputElement) {\r
                     return;\r
-                } else {\r
-                    inputElement.moveDown();\r
                 }\r
+                inputElement.moveDown();\r
                 treeViewer.refresh();\r
                 validate();\r
                 updatePreviews();\r
@@ -447,20 +449,18 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
             String attributeName = getAttributeNameSuggestion(inputElement);\r
             if (attributeName.length() == 0) {\r
                 break;\r
-            } else {\r
-                InputAttribute attribute = new InputAttribute(attributeName, attributeName, 0, ""); //$NON-NLS-1$\r
-                inputElement.addAttribute(attribute);\r
             }\r
+            InputAttribute attribute = new InputAttribute(attributeName, attributeName, 0, ""); //$NON-NLS-1$\r
+            inputElement.addAttribute(attribute);\r
         }\r
         while (true) {\r
             String childName = getChildNameSuggestion(inputElement);\r
             if (childName.length() == 0) {\r
                 break;\r
-            } else {\r
-                InputElement childElement = new InputElement(childName, false, CustomXmlTraceDefinition.TAG_IGNORE, 0, "", null); //$NON-NLS-1$\r
-                inputElement.addChild(childElement);\r
-                feelingLucky(childElement);\r
             }\r
+            InputElement childElement = new InputElement(childName, false, CustomXmlTraceDefinition.TAG_IGNORE, 0, "", null); //$NON-NLS-1$\r
+            inputElement.addChild(childElement);\r
+            feelingLucky(childElement);\r
         }\r
     }\r
 \r
@@ -471,16 +471,16 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
             CustomXmlTraceDefinition def = (CustomXmlTraceDefinition) inputElement;\r
             if (def.rootInputElement != null) {\r
                 return new Object[] { def.rootInputElement };\r
-            } else {\r
-                return new Object[0];\r
             }\r
+            return new Object[0];\r
         }\r
 \r
         @Override\r
         public Object[] getChildren(Object parentElement) {\r
             InputElement inputElement = (InputElement) parentElement;\r
-            if (inputElement.childElements == null)\r
+            if (inputElement.childElements == null) {\r
                 return new InputElement[0];\r
+            }\r
             return inputElement.childElements.toArray();\r
         }\r
 \r
@@ -562,7 +562,7 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
 \r
     /*\r
      * (non-Javadoc)\r
-     * \r
+     *\r
      * @see org.eclipse.jface.dialogs.DialogPage#dispose()\r
      */\r
     @Override\r
@@ -599,7 +599,7 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
 \r
     /*\r
      * (non-Javadoc)\r
-     * \r
+     *\r
      * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)\r
      */\r
     @Override\r
@@ -908,8 +908,8 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                 tagComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
 \r
                 tagCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);\r
-                tagCombo.setItems(new String[] { CustomXmlTraceDefinition.TAG_IGNORE, CustomXmlTraceDefinition.TAG_TIMESTAMP,\r
-                        CustomXmlTraceDefinition.TAG_MESSAGE, CustomXmlTraceDefinition.TAG_OTHER });\r
+                tagCombo.setItems(new String[] { CustomXmlTraceDefinition.TAG_IGNORE, CustomTraceDefinition.TAG_TIMESTAMP,\r
+                        CustomTraceDefinition.TAG_MESSAGE, CustomTraceDefinition.TAG_OTHER });\r
                 tagCombo.setVisibleItemCount(tagCombo.getItemCount());\r
                 tagCombo.addSelectionListener(new SelectionListener() {\r
                     @Override\r
@@ -920,33 +920,35 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                     public void widgetSelected(SelectionEvent e) {\r
                         tagText.removeModifyListener(updateListener);\r
                         switch (tagCombo.getSelectionIndex()) {\r
-                            case 0: // Ignore\r
-                                tagLabel.setVisible(false);\r
-                                tagText.setVisible(false);\r
-                                actionCombo.setVisible(false);\r
-                                break;\r
-                            case 1: // Time Stamp\r
-                                tagLabel.setText(Messages.CustomXmlParserInputWizardPage_format);\r
-                                tagLabel.setVisible(true);\r
-                                tagText.setVisible(true);\r
-                                tagText.addModifyListener(updateListener);\r
-                                actionCombo.setVisible(true);\r
-                                break;\r
-                            case 2: // Message\r
-                                tagLabel.setVisible(false);\r
-                                tagText.setVisible(false);\r
-                                actionCombo.setVisible(true);\r
-                                break;\r
-                            case 3: // Other\r
-                                tagLabel.setText(Messages.CustomXmlParserInputWizardPage_tagName);\r
-                                tagLabel.setVisible(true);\r
-                                if (tagText.getText().trim().length() == 0) {\r
-                                    tagText.setText(elementNameText.getText().trim());\r
-                                }\r
-                                tagText.setVisible(true);\r
-                                tagText.addModifyListener(updateListener);\r
-                                actionCombo.setVisible(true);\r
-                                break;\r
+                        case 0: // Ignore\r
+                            tagLabel.setVisible(false);\r
+                            tagText.setVisible(false);\r
+                            actionCombo.setVisible(false);\r
+                            break;\r
+                        case 1: // Time Stamp\r
+                            tagLabel.setText(Messages.CustomXmlParserInputWizardPage_format);\r
+                            tagLabel.setVisible(true);\r
+                            tagText.setVisible(true);\r
+                            tagText.addModifyListener(updateListener);\r
+                            actionCombo.setVisible(true);\r
+                            break;\r
+                        case 2: // Message\r
+                            tagLabel.setVisible(false);\r
+                            tagText.setVisible(false);\r
+                            actionCombo.setVisible(true);\r
+                            break;\r
+                        case 3: // Other\r
+                            tagLabel.setText(Messages.CustomXmlParserInputWizardPage_tagName);\r
+                            tagLabel.setVisible(true);\r
+                            if (tagText.getText().trim().length() == 0) {\r
+                                tagText.setText(elementNameText.getText().trim());\r
+                            }\r
+                            tagText.setVisible(true);\r
+                            tagText.addModifyListener(updateListener);\r
+                            actionCombo.setVisible(true);\r
+                            break;\r
+                        default:\r
+                            break;\r
                         }\r
                         tagComposite.layout();\r
                         validate();\r
@@ -973,12 +975,12 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                     tagLabel.setVisible(false);\r
                     tagText.setVisible(false);\r
                     actionCombo.setVisible(false);\r
-                } else if (inputElement.inputName.equals(CustomXmlTraceDefinition.TAG_TIMESTAMP)) {\r
+                } else if (inputElement.inputName.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                     tagCombo.select(1);\r
                     tagLabel.setText(Messages.CustomXmlParserInputWizardPage_format);\r
                     tagText.setText(inputElement.inputFormat);\r
                     tagText.addModifyListener(updateListener);\r
-                } else if (inputElement.inputName.equals(CustomXmlTraceDefinition.TAG_MESSAGE)) {\r
+                } else if (inputElement.inputName.equals(CustomTraceDefinition.TAG_MESSAGE)) {\r
                     tagCombo.select(2);\r
                     tagLabel.setVisible(false);\r
                     tagText.setVisible(false);\r
@@ -1016,13 +1018,13 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                                                                 // log entry\r
                         }\r
                     }\r
-                    if (tagCombo.getText().equals(CustomXmlTraceDefinition.TAG_TIMESTAMP) && logEntriesCount <= 1) {\r
+                    if (tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP) && logEntriesCount <= 1) {\r
                         String value = previewText.getText().trim();\r
                         if (value.length() != 0) {\r
-                            if (actionCombo.getSelectionIndex() == CustomXmlTraceDefinition.ACTION_SET) {\r
+                            if (actionCombo.getSelectionIndex() == CustomTraceDefinition.ACTION_SET) {\r
                                 timeStampValue = value;\r
                                 timeStampFormat = tagText.getText().trim();\r
-                            } else if (actionCombo.getSelectionIndex() == CustomXmlTraceDefinition.ACTION_APPEND) {\r
+                            } else if (actionCombo.getSelectionIndex() == CustomTraceDefinition.ACTION_APPEND) {\r
                                 if (timeStampValue != null) {\r
                                     timeStampValue += value;\r
                                     timeStampFormat += tagText.getText().trim();\r
@@ -1030,7 +1032,7 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                                     timeStampValue = value;\r
                                     timeStampFormat = tagText.getText().trim();\r
                                 }\r
-                            } else if (actionCombo.getSelectionIndex() == CustomXmlTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {\r
+                            } else if (actionCombo.getSelectionIndex() == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {\r
                                 if (timeStampValue != null) {\r
                                     timeStampValue += " | " + value; //$NON-NLS-1$\r
                                     timeStampFormat += " | " + tagText.getText().trim(); //$NON-NLS-1$\r
@@ -1048,11 +1050,11 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                     String value = element.getAttribute(attribute.attributeNameText.getText().trim());\r
                     if (value.length() != 0) {\r
                         attribute.previewText.setText(value);\r
-                        if (attribute.tagCombo.getText().equals(CustomXmlTraceDefinition.TAG_TIMESTAMP) && logEntriesCount <= 1) {\r
-                            if (attribute.actionCombo.getSelectionIndex() == CustomXmlTraceDefinition.ACTION_SET) {\r
+                        if (attribute.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP) && logEntriesCount <= 1) {\r
+                            if (attribute.actionCombo.getSelectionIndex() == CustomTraceDefinition.ACTION_SET) {\r
                                 timeStampValue = value;\r
                                 timeStampFormat = attribute.tagText.getText().trim();\r
-                            } else if (attribute.actionCombo.getSelectionIndex() == CustomXmlTraceDefinition.ACTION_APPEND) {\r
+                            } else if (attribute.actionCombo.getSelectionIndex() == CustomTraceDefinition.ACTION_APPEND) {\r
                                 if (timeStampValue != null) {\r
                                     timeStampValue += value;\r
                                     timeStampFormat += attribute.tagText.getText().trim();\r
@@ -1060,7 +1062,7 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                                     timeStampValue = value;\r
                                     timeStampFormat = attribute.tagText.getText().trim();\r
                                 }\r
-                            } else if (attribute.actionCombo.getSelectionIndex() == CustomXmlTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {\r
+                            } else if (attribute.actionCombo.getSelectionIndex() == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {\r
                                 if (timeStampValue != null) {\r
                                     timeStampValue += " | " + value; //$NON-NLS-1$\r
                                     timeStampFormat += " | " + attribute.tagText.getText().trim(); //$NON-NLS-1$\r
@@ -1146,11 +1148,11 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
             inputElement.elementName = elementNameText.getText().trim();\r
             if (inputElement.parentElement != null) {\r
                 inputElement.logEntry = logEntryButton.getSelection();\r
-                if (tagCombo.getText().equals(CustomXmlTraceDefinition.TAG_OTHER)) {\r
+                if (tagCombo.getText().equals(CustomTraceDefinition.TAG_OTHER)) {\r
                     inputElement.inputName = tagText.getText().trim();\r
                 } else {\r
                     inputElement.inputName = tagCombo.getText();\r
-                    if (tagCombo.getText().equals(CustomXmlTraceDefinition.TAG_TIMESTAMP)) {\r
+                    if (tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                         inputElement.inputFormat = tagText.getText().trim();\r
                     }\r
                 }\r
@@ -1161,11 +1163,11 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                 Attribute attribute = attributes.get(i);\r
                 InputAttribute inputAttribute = new InputAttribute();\r
                 inputAttribute.attributeName = attribute.attributeNameText.getText().trim();\r
-                if (attribute.tagCombo.getText().equals(CustomXmlTraceDefinition.TAG_OTHER)) {\r
+                if (attribute.tagCombo.getText().equals(CustomTraceDefinition.TAG_OTHER)) {\r
                     inputAttribute.inputName = attribute.tagText.getText().trim();\r
                 } else {\r
                     inputAttribute.inputName = attribute.tagCombo.getText();\r
-                    if (attribute.tagCombo.getText().equals(CustomXmlTraceDefinition.TAG_TIMESTAMP)) {\r
+                    if (attribute.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                         inputAttribute.inputFormat = attribute.tagText.getText().trim();\r
                     }\r
                 }\r
@@ -1261,8 +1263,8 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
             tagComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
 \r
             tagCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);\r
-            tagCombo.setItems(new String[] { CustomXmlTraceDefinition.TAG_TIMESTAMP, CustomXmlTraceDefinition.TAG_MESSAGE,\r
-                    CustomXmlTraceDefinition.TAG_OTHER });\r
+            tagCombo.setItems(new String[] { CustomTraceDefinition.TAG_TIMESTAMP, CustomTraceDefinition.TAG_MESSAGE,\r
+                    CustomTraceDefinition.TAG_OTHER });\r
             tagCombo.select(2); // Other\r
             tagCombo.addSelectionListener(new SelectionListener() {\r
                 @Override\r
@@ -1273,25 +1275,27 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                 public void widgetSelected(SelectionEvent e) {\r
                     tagText.removeModifyListener(updateListener);\r
                     switch (tagCombo.getSelectionIndex()) {\r
-                        case 0: // Time Stamp\r
-                            tagLabel.setText(Messages.CustomXmlParserInputWizardPage_format);\r
-                            tagLabel.setVisible(true);\r
-                            tagText.setVisible(true);\r
-                            tagText.addModifyListener(updateListener);\r
-                            break;\r
-                        case 1: // Message\r
-                            tagLabel.setVisible(false);\r
-                            tagText.setVisible(false);\r
-                            break;\r
-                        case 2: // Other\r
-                            tagLabel.setText(Messages.CustomXmlParserInputWizardPage_tagName);\r
-                            tagLabel.setVisible(true);\r
-                            if (tagText.getText().trim().length() == 0) {\r
-                                tagText.setText(attributeNameText.getText().trim());\r
-                            }\r
-                            tagText.setVisible(true);\r
-                            tagText.addModifyListener(updateListener);\r
-                            break;\r
+                    case 0: // Time Stamp\r
+                        tagLabel.setText(Messages.CustomXmlParserInputWizardPage_format);\r
+                        tagLabel.setVisible(true);\r
+                        tagText.setVisible(true);\r
+                        tagText.addModifyListener(updateListener);\r
+                        break;\r
+                    case 1: // Message\r
+                        tagLabel.setVisible(false);\r
+                        tagText.setVisible(false);\r
+                        break;\r
+                    case 2: // Other\r
+                        tagLabel.setText(Messages.CustomXmlParserInputWizardPage_tagName);\r
+                        tagLabel.setVisible(true);\r
+                        if (tagText.getText().trim().length() == 0) {\r
+                            tagText.setText(attributeNameText.getText().trim());\r
+                        }\r
+                        tagText.setVisible(true);\r
+                        tagText.addModifyListener(updateListener);\r
+                        break;\r
+                    default:\r
+                        break;\r
                     }\r
                     tagComposite.layout();\r
                     validate();\r
@@ -1314,12 +1318,12 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
             actionCombo.select(inputAttribute.inputAction);\r
             actionCombo.addSelectionListener(updateListener);\r
 \r
-            if (inputAttribute.inputName.equals(CustomXmlTraceDefinition.TAG_TIMESTAMP)) {\r
+            if (inputAttribute.inputName.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                 tagCombo.select(0);\r
                 tagLabel.setText(Messages.CustomXmlParserInputWizardPage_format);\r
                 tagText.setText(inputAttribute.inputFormat);\r
                 tagText.addModifyListener(updateListener);\r
-            } else if (inputAttribute.inputName.equals(CustomXmlTraceDefinition.TAG_MESSAGE)) {\r
+            } else if (inputAttribute.inputName.equals(CustomTraceDefinition.TAG_MESSAGE)) {\r
                 tagCombo.select(1);\r
                 tagLabel.setVisible(false);\r
                 tagText.setVisible(false);\r
@@ -1507,48 +1511,56 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
     public StringBuffer validateElement(InputElement inputElement) {\r
         StringBuffer errors = new StringBuffer();\r
         ElementNode elementNode = null;\r
-        if (selectedElement != null && selectedElement.inputElement.equals(inputElement))\r
+        if (selectedElement != null && selectedElement.inputElement.equals(inputElement)) {\r
             elementNode = selectedElement;\r
+        }\r
         if (inputElement == definition.rootInputElement) {\r
             if (inputElement.elementName.length() == 0) {\r
                 errors.append(Messages.CustomXmlParserInputWizardPage_missingDocumentElementError);\r
-                if (elementNode != null)\r
+                if (elementNode != null) {\r
                     elementNode.elementNameText.setBackground(COLOR_LIGHT_RED);\r
+                }\r
             } else {\r
-                if (elementNode != null)\r
+                if (elementNode != null) {\r
                     elementNode.elementNameText.setBackground(COLOR_TEXT_BACKGROUND);\r
+                }\r
             }\r
         }\r
         if (inputElement != definition.rootInputElement) {\r
             if (inputElement.logEntry) {\r
                 logEntryFound = true;\r
             }\r
-            if (inputElement.inputName.equals(CustomXmlTraceDefinition.TAG_TIMESTAMP)) {\r
+            if (inputElement.inputName.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                 timeStampFound = true;\r
                 if (inputElement.inputFormat.length() == 0) {\r
                     errors.append(Messages.CustomXmlParserInputWizardPage_timestampFormatPrompt\r
                             + " (" + Messages.CustomXmlParserInputWizardPage_timestampElementPrompt + " " + getName(inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-                    if (elementNode != null)\r
+                    if (elementNode != null) {\r
                         elementNode.tagText.setBackground(COLOR_LIGHT_RED);\r
+                    }\r
                 } else {\r
                     try {\r
                         new SimpleDateFormat(inputElement.inputFormat);\r
-                        if (elementNode != null)\r
+                        if (elementNode != null) {\r
                             elementNode.tagText.setBackground(COLOR_TEXT_BACKGROUND);\r
+                        }\r
                     } catch (IllegalArgumentException e) {\r
                         errors.append(Messages.CustomXmlParserInputWizardPage_invalidTimestampFmtError\r
                                 + " (" + Messages.CustomXmlParserInputWizardPage_timestampElementPrompt + " " + getName(inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-                        if (elementNode != null)\r
+                        if (elementNode != null) {\r
                             elementNode.tagText.setBackground(COLOR_LIGHT_RED);\r
+                        }\r
                     }\r
                 }\r
             } else if (inputElement.inputName.length() == 0) {\r
                 errors.append(Messages.CustomXmlParserInputWizardPage_missingInputElementNameError);\r
-                if (elementNode != null)\r
+                if (elementNode != null) {\r
                     elementNode.tagText.setBackground(COLOR_LIGHT_RED);\r
+                }\r
             } else {\r
-                if (elementNode != null)\r
+                if (elementNode != null) {\r
                     elementNode.tagText.setBackground(COLOR_TEXT_BACKGROUND);\r
+                }\r
             }\r
         }\r
         if (inputElement.attributes != null) {\r
@@ -1572,62 +1584,73 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                 if (attribute.attributeName.length() == 0) {\r
                     errors.append(Messages.CustomXmlParserInputWizardPage_missingAttribute\r
                             + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(inputElement) + ": ?). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-                    if (elementNode != null)\r
+                    if (elementNode != null) {\r
                         elementNode.attributes.get(i).attributeNameText.setBackground(COLOR_LIGHT_RED);\r
+                    }\r
                 } else if (duplicate) {\r
                     errors.append(Messages.CustomXmlParserInputWizardPage_duplicateAttributeError\r
                             + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(attribute, inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-                    if (elementNode != null)\r
+                    if (elementNode != null) {\r
                         elementNode.attributes.get(i).attributeNameText.setBackground(COLOR_LIGHT_RED);\r
+                    }\r
                 }\r
-                if (attribute.inputName.equals(CustomXmlTraceDefinition.TAG_TIMESTAMP)) {\r
+                if (attribute.inputName.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
                     timeStampFound = true;\r
                     if (attribute.inputFormat.length() == 0) {\r
                         errors.append(Messages.CustomXmlParserInputWizardPage_missingTimestampInFmtError\r
                                 + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(attribute, inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-                        if (elementNode != null)\r
+                        if (elementNode != null) {\r
                             elementNode.attributes.get(i).tagText.setBackground(COLOR_LIGHT_RED);\r
+                        }\r
                     } else {\r
                         try {\r
                             new SimpleDateFormat(attribute.inputFormat);\r
-                            if (elementNode != null)\r
+                            if (elementNode != null) {\r
                                 elementNode.attributes.get(i).tagText.setBackground(COLOR_TEXT_BACKGROUND);\r
+                            }\r
                         } catch (IllegalArgumentException e) {\r
                             errors.append(Messages.CustomXmlParserInputWizardPage_invalidTimestampInFmtError\r
                                     + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(attribute, inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-                            if (elementNode != null)\r
+                            if (elementNode != null) {\r
                                 elementNode.attributes.get(i).tagText.setBackground(COLOR_LIGHT_RED);\r
+                            }\r
                         }\r
                     }\r
                 } else if (attribute.inputName.length() == 0) {\r
                     errors.append(Messages.CustomXmlParserInputWizardPage_missingDataGroupNameError\r
                             + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(attribute, inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-                    if (elementNode != null)\r
+                    if (elementNode != null) {\r
                         elementNode.attributes.get(i).tagText.setBackground(COLOR_LIGHT_RED);\r
+                    }\r
                 } else {\r
-                    if (elementNode != null)\r
+                    if (elementNode != null) {\r
                         elementNode.attributes.get(i).tagText.setBackground(COLOR_TEXT_BACKGROUND);\r
+                    }\r
                 }\r
             }\r
         }\r
         if (inputElement.childElements != null) {\r
             for (InputElement child : inputElement.childElements) {\r
                 ElementNode childElementNode = null;\r
-                if (selectedElement != null && selectedElement.inputElement.equals(child))\r
+                if (selectedElement != null && selectedElement.inputElement.equals(child)) {\r
                     childElementNode = selectedElement;\r
-                if (childElementNode != null)\r
+                }\r
+                if (childElementNode != null) {\r
                     childElementNode.elementNameText.setBackground(COLOR_TEXT_BACKGROUND);\r
+                }\r
             }\r
             for (int i = 0; i < inputElement.childElements.size(); i++) {\r
                 InputElement child = inputElement.childElements.get(i);\r
                 ElementNode childElementNode = null;\r
-                if (selectedElement != null && selectedElement.inputElement.equals(child))\r
+                if (selectedElement != null && selectedElement.inputElement.equals(child)) {\r
                     childElementNode = selectedElement;\r
+                }\r
                 if (child.elementName.length() == 0) {\r
                     errors.append(Messages.CustomXmlParserInputWizardPage_missingElementNameError\r
                             + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(child) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-                    if (childElementNode != null)\r
+                    if (childElementNode != null) {\r
                         childElementNode.elementNameText.setBackground(COLOR_LIGHT_RED);\r
+                    }\r
                 } else {\r
                     boolean duplicate = false;\r
                     for (int j = i + 1; j < inputElement.childElements.size(); j++) {\r
@@ -1635,17 +1658,20 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                         if (otherChild.elementName.equals(child.elementName)) {\r
                             duplicate = true;\r
                             ElementNode otherChildElementNode = null;\r
-                            if (selectedElement != null && selectedElement.inputElement.equals(otherChild))\r
+                            if (selectedElement != null && selectedElement.inputElement.equals(otherChild)) {\r
                                 otherChildElementNode = selectedElement;\r
-                            if (otherChildElementNode != null)\r
+                            }\r
+                            if (otherChildElementNode != null) {\r
                                 otherChildElementNode.elementNameText.setBackground(COLOR_LIGHT_RED);\r
+                            }\r
                         }\r
                     }\r
                     if (duplicate) {\r
                         errors.append(Messages.CustomXmlParserInputWizardPage_duplicateElementNameError\r
                                 + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(child) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-                        if (childElementNode != null)\r
+                        if (childElementNode != null) {\r
                             childElementNode.elementNameText.setBackground(COLOR_LIGHT_RED);\r
+                        }\r
                     }\r
                 }\r
 \r
index 245aa07e004eba4f90e098e5cc532d4087b23da5..906ce4ba9da233b3654320f2353745d7e78f722a 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010, 2011 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -71,7 +71,7 @@ public class DeleteExperimentSupplementaryFilesHandler extends AbstractHandler {
             // There should be only one item selected as per the plugin.xml
             Object element = sel.getFirstElement();
             List<IResource> resourcesList = new ArrayList<IResource>();
-            
+
             if (element instanceof TmfExperimentElement) {
 
                 TmfExperimentElement trace = (TmfExperimentElement) element;
@@ -87,7 +87,7 @@ public class DeleteExperimentSupplementaryFilesHandler extends AbstractHandler {
                 }
 
                 SelectSupplementaryResourcesDialog dialog = new SelectSupplementaryResourcesDialog(window.getShell(), resourcesList.toArray(new IResource[resourcesList.size()]));
-                
+
                 if (dialog.open() != Window.OK) {
                     return null;
                 }
@@ -105,9 +105,7 @@ public class DeleteExperimentSupplementaryFilesHandler extends AbstractHandler {
                 IResource resource = trace.getProject().getResource();
                 if (resource != null) {
                     try {
-                        if (resource != null) {
-                            resource.refreshLocal(IResource.DEPTH_INFINITE, null);
-                        }
+                        resource.refreshLocal(IResource.DEPTH_INFINITE, null);
                     } catch (CoreException e) {
                         Activator.getDefault().logError("Error refreshing resource " + resource, e); //$NON-NLS-1$
                     }
index b18b6dc14a42bd20176f0982aa1921b0d913c338..89bc5da5e7b5318b40d110a3d22667e878271d9c 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010, 2011 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -45,8 +45,9 @@ public class DeleteTraceSupplementaryFilesHandler extends AbstractHandler {
 
         // Check if we are closing down
         IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-        if (window == null)
+        if (window == null) {
             return null;
+        }
 
         // Get the selection
         IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
@@ -70,7 +71,7 @@ public class DeleteTraceSupplementaryFilesHandler extends AbstractHandler {
 
                 // Delete the selected resources
                 IResource[] resources = trace.getSupplementaryResources();
-                
+
                 SelectSupplementaryResourcesDialog dialog = new SelectSupplementaryResourcesDialog(window.getShell(), resources);
                 if (dialog.open() != Window.OK) {
                     return null;
@@ -83,9 +84,7 @@ public class DeleteTraceSupplementaryFilesHandler extends AbstractHandler {
 
                 if (resource != null) {
                     try {
-                        if (resource != null) {
-                            resource.refreshLocal(IResource.DEPTH_INFINITE, null);
-                        }
+                        resource.refreshLocal(IResource.DEPTH_INFINITE, null);
                     } catch (CoreException e) {
                         Activator.getDefault().logError("Error refreshing resource " + resource, e); //$NON-NLS-1$
                     }
index 3eca229f02382640ac7277d66d47c8bf895ef5aa..41986434adfa0e6ab6ae5c61e05fb73159227a44 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
 * Copyright (c) 2012 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Patrick Tasse - Initial API and implementation
  *******************************************************************************/
@@ -190,18 +190,19 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
         return (ok ? Status.OK_STATUS : Status.CANCEL_STATUS);
     }
 
-    
+
     /**
      * Drop a trace by copying a resource in a target experiment
-     * 
+     *
      * @param sourceTrace the source trace element to copy
      * @param targetExperiment the target experiment
      * @return true if successful
      */
-    private boolean drop(TmfTraceElement sourceTrace, TmfExperimentElement targetExperiment) {
-        
+    private static boolean drop(TmfTraceElement sourceTrace,
+            TmfExperimentElement targetExperiment) {
+
         IResource sourceResource = sourceTrace.getResource();
-        
+
         if (drop(sourceResource, targetExperiment)) {
             IFolder destinationSupplementaryFolder = targetExperiment.getTraceSupplementaryFolder(sourceResource.getName());
             if (!destinationSupplementaryFolder.exists()) {
@@ -211,15 +212,16 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
         }
         return false;
     }
-    
+
     /**
      * Drop a trace by copying a resource in a target experiment
-     * 
+     *
      * @param sourceResource the source resource
      * @param targetExperiment the target experiment
      * @return true if successful
      */
-    private boolean drop(IResource sourceResource, TmfExperimentElement targetExperiment) {
+    private static boolean drop(IResource sourceResource,
+            TmfExperimentElement targetExperiment) {
         boolean doit = true;
 
         //Use local variable to avoid parameter assignment
@@ -267,12 +269,12 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
 
     /**
      * Drop a trace by copying it's a trace element in a trace folder
-     * 
+     *
      * @param sourceTrace the source trace
      * @param traceFolder the target trace folder
      * @return true if successful
      */
-    private boolean drop(TmfTraceElement sourceTrace, TmfTraceFolder traceFolder) {
+    private static boolean drop(TmfTraceElement sourceTrace, TmfTraceFolder traceFolder) {
         IResource sourceResource = sourceTrace.getResource();
         if (drop(sourceResource, traceFolder)) {
             IFolder destinationSupplementaryFolder = traceFolder.getTraceSupplementaryFolder(sourceResource.getName());
@@ -284,12 +286,12 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
 
     /**
      * Drop a trace by copying a resource in a trace folder
-     * 
+     *
      * @param sourceResource the source resource
      * @param traceFolder the target trace folder
      * @return true if successful
      */
-    private boolean drop(IResource sourceResource, TmfTraceFolder traceFolder) {
+    private static boolean drop(IResource sourceResource, TmfTraceFolder traceFolder) {
         boolean doit = true;
 
         for (TmfTraceElement trace : traceFolder.getTraces()) {
@@ -311,17 +313,17 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
         }
         return false;
     }
-    
+
     /**
      * Drop a trace by importing a path in a target experiment
-     * 
+     *
      * @param path the source path
      * @param targetExperiment the target experiment
      * @return true if successful
      */
-    private boolean drop(Path path, TmfExperimentElement targetExperiment) {
+    private static boolean drop(Path path, TmfExperimentElement targetExperiment) {
         boolean doit = true;
-        
+
         // Use local variable to avoid parameter assignment
         Path pathToUse = path;
 
@@ -362,12 +364,12 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
 
     /**
      * Drop a trace by importing a path in a trace folder
-     * 
+     *
      * @param path the source path
      * @param traceFolder the target trace folder
      * @return true if successful
      */
-    private boolean drop(Path path, TmfTraceFolder traceFolder) {
+    private static boolean drop(Path path, TmfTraceFolder traceFolder) {
         boolean doit = true;
         for (TmfTraceElement trace : traceFolder.getTraces()) {
             if (trace.getName().equals(path.lastSegment())) {
@@ -384,11 +386,11 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
 
     /**
      * Import a trace to the trace folder
-     * 
+     *
      * @param resource the trace folder resource
      * @param path the path to the trace to import
      */
-    private void importTrace(IFolder resource, Path path) {
+    private static void importTrace(IFolder resource, Path path) {
         IPath containerPath = resource.getFullPath();
         File file = new File(path.toString());
         File source = file.getParentFile();
@@ -414,15 +416,15 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
         } catch (InterruptedException e) {
             displayException(e);
         }
-    } 
+    }
 
     /**
      * Create a link to the actual trace and set the trace type
-     * 
+     *
      * @param parentFolder the parent folder
      * @param resource the resource
      */
-    private void createLink(IFolder parentFolder, IResource resource) {
+    private static void createLink(IFolder parentFolder, IResource resource) {
         IPath location = resource.getLocation();
         IWorkspace workspace = ResourcesPlugin.getWorkspace();
         try {
@@ -443,7 +445,7 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
                 }
             } else {
                 IFile file = parentFolder.getFile(resource.getName());
-                
+
                 if (workspace.validateLinkLocation(file, location).isOK()) {
                     file.createLink(location, IResource.REPLACE, null);
                     setProperties(file, bundleName, traceType, iconUrl, supplFolder);
@@ -459,7 +461,7 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
     /**
      * Cleanup bookmarks file in copied trace
      */
-    private void cleanupBookmarks(IPath path) {
+    private static void cleanupBookmarks(IPath path) {
         IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(path);
         if (folder.exists()) {
             try {
@@ -476,15 +478,17 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
 
     /**
      * Set the trace persistent properties
-     * 
+     *
      * @param resource the trace resource
      * @param bundleName the bundle name
      * @param traceType the trace type
      * @param iconUrl the icon URL
-     * @param supplFolder the directory of the directory for supplementary information or null to ignore the property 
+     * @param supplFolder the directory of the directory for supplementary information or null to ignore the property
      * @throws CoreException
      */
-    private void setProperties(IResource resource, String bundleName, String traceType, String iconUrl, String supplFolder) throws CoreException {
+    private static void setProperties(IResource resource, String bundleName,
+            String traceType, String iconUrl, String supplFolder)
+            throws CoreException {
         resource.setPersistentProperty(TmfCommonConstants.TRACEBUNDLE, bundleName);
         resource.setPersistentProperty(TmfCommonConstants.TRACETYPE, traceType);
         resource.setPersistentProperty(TmfCommonConstants.TRACEICON, iconUrl);
@@ -493,10 +497,10 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
 
     /**
      * Display an exception in a message box
-     * 
+     *
      * @param e the exception
      */
-    private void displayException(Exception e) {
+    private static void displayException(Exception e) {
         MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
         mb.setText(e.getClass().getName());
         mb.setMessage(e.getMessage());
index c86afae79cc106e8e6344a1d1c4fbb5f2103e82f..0abc69dbe9d0f5261017d7cbc1758dd3bcdd556b 100644 (file)
@@ -207,7 +207,7 @@ public class OpenExperimentHandler extends AbstractHandler {
         return null;
     }
 
-    private void displayErrorMsg(final String errorMsg) {
+    private static void displayErrorMsg(final String errorMsg) {
         final MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
         mb.setText(Messages.OpenExperimentHandler_Title);
         mb.setMessage(errorMsg);
index d5c26bd89a671e2e77c9ad0f238ad35d850bd943..0b4ac7f69b14f8885602e64aed9a19c301d51f2e 100644 (file)
@@ -74,15 +74,17 @@ public class OpenTraceHandler extends AbstractHandler {
 
         // Check if we are closing down
         final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-        if (window == null)
+        if (window == null) {
             return false;
+        }
 
         // Get the selection
         final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
         final IWorkbenchPart part = page.getActivePart();
         final ISelectionProvider selectionProvider = part.getSite().getSelectionProvider();
-        if (selectionProvider == null)
+        if (selectionProvider == null) {
             return false;
+        }
         final ISelection selection = selectionProvider.getSelection();
 
         // Make sure there is only one selection and that it is a trace
@@ -91,8 +93,9 @@ public class OpenTraceHandler extends AbstractHandler {
             final TreeSelection sel = (TreeSelection) selection;
             // There should be only one item selected as per the plugin.xml
             final Object element = sel.getFirstElement();
-            if (element instanceof TmfTraceElement)
+            if (element instanceof TmfTraceElement) {
                 fTrace = (TmfTraceElement) element;
+            }
         }
 
         // We only enable opening from the Traces folder for now
@@ -109,12 +112,14 @@ public class OpenTraceHandler extends AbstractHandler {
 
         // Check if we are closing down
         final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-        if (window == null)
+        if (window == null) {
             return null;
+        }
 
         // Check that the trace is valid
-        if (fTrace == null)
+        if (fTrace == null) {
             return null;
+        }
 
         // If trace is under an experiment, use the original trace from the traces folder
         fTrace = fTrace.getElementUnderTraceFolder();
@@ -139,9 +144,9 @@ public class OpenTraceHandler extends AbstractHandler {
 
         final IResource resource = fTrace.getResource();
         IFile file = null;
-        if (resource instanceof IFile)
+        if (resource instanceof IFile) {
             file = (IFile) resource;
-        else if (resource instanceof IFolder)
+        } else if (resource instanceof IFolder) {
             try {
                 final IFile bookmarksFile = fTrace.getProject().getTracesFolder().getResource().getFile(BOOKMARKS_HIDDEN_FILE);
                 if (!bookmarksFile.exists()) {
@@ -152,18 +157,21 @@ public class OpenTraceHandler extends AbstractHandler {
 
                 final IFolder folder = (IFolder) resource;
                 file = folder.getFile(fTrace.getName() + '_');
-                if (!file.exists())
+                if (!file.exists()) {
                     file.createLink(bookmarksFile.getLocation(), IResource.REPLACE, null);
+                }
                 file.setHidden(true);
-                if (usesEditor)
+                if (usesEditor) {
                     file.setPersistentProperty(TmfCommonConstants.TRACETYPE, fTrace.getTraceType());
-                else
+                } else {
                     file.setPersistentProperty(TmfCommonConstants.TRACETYPE, TmfTrace.class.getCanonicalName());
+                }
             } catch (final CoreException e) {
                 Activator.getDefault().logError("Error opening trace " + fTrace.getName(), e); //$NON-NLS-1$
             }
+        }
 
-        if (usesEditor)
+        if (usesEditor) {
             try {
                 final IEditorInput editorInput = new TmfEditorInput(file, trace);
                 final IWorkbench wb = PlatformUI.getWorkbench();
@@ -175,13 +183,14 @@ public class OpenTraceHandler extends AbstractHandler {
                     activePage.activate(editor);
                 } else {
                     activePage.openEditor(editorInput, editorId);
-                    if (resource instanceof IFile)
+                    if (resource instanceof IFile) {
                         IDE.setDefaultEditor((IFile) resource, editorId);
+                    }
                 }
             } catch (final PartInitException e) {
                 Activator.getDefault().logError("Error opening trace " + fTrace.getName(), e); //$NON-NLS-1$
             }
-        else {
+        else {
             // Create the experiment
             final ITmfTrace[] traces = new ITmfTrace[] { trace };
             final TmfExperiment experiment = new TmfExperiment(traceEvent.getClass(), fTrace.getName(), traces, trace.getCacheSize());
@@ -194,7 +203,7 @@ public class OpenTraceHandler extends AbstractHandler {
         return null;
     }
 
-    private void displayErrorMsg(final String errorMsg) {
+    private static void displayErrorMsg(final String errorMsg) {
         final MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
         mb.setText(Messages.OpenTraceHandler_Title);
         mb.setMessage(errorMsg);
index cfcafe0d97020ba1504b9c1d321411608c22e23b..17c16e8b61515d0ed074ceac699a0bdf130a6e25 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010, 2011 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -52,7 +52,7 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation;
 public class RenameTraceHandler extends AbstractHandler {
 
        private TmfTraceElement fTrace = null;
-       
+
        // ------------------------------------------------------------------------
     // isEnabled
     // ------------------------------------------------------------------------
@@ -62,15 +62,17 @@ public class RenameTraceHandler extends AbstractHandler {
 
         // Check if we are closing down
         IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-        if (window == null)
+        if (window == null) {
             return false;
+        }
 
         // Get the selection
         IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
         IWorkbenchPart part = page.getActivePart();
         ISelectionProvider selectionProvider = part.getSite().getSelectionProvider();
-        if (selectionProvider == null)
+        if (selectionProvider == null) {
             return false;
+        }
         ISelection selection = selectionProvider.getSelection();
 
         // Make sure there is only selection and that it is an experiment
@@ -96,8 +98,9 @@ public class RenameTraceHandler extends AbstractHandler {
 
         // Check if we are closing down
         IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-        if (window == null)
+        if (window == null) {
             return null;
+        }
 
         // If trace is under an experiment, use the original trace from the traces folder
         fTrace = fTrace.getElementUnderTraceFolder();
@@ -107,8 +110,9 @@ public class RenameTraceHandler extends AbstractHandler {
         TmfTraceFolder traceFolder = (TmfTraceFolder) fTrace.getParent();
         TmfTraceElement oldTrace = fTrace;
         RenameTraceDialog dialog = new RenameTraceDialog(shell, fTrace);
-        if (dialog.open() != Window.OK)
+        if (dialog.open() != Window.OK) {
             return null;
+        }
 
         // Locate the new trace object
         TmfTraceElement newTrace = null;
@@ -122,8 +126,9 @@ public class RenameTraceHandler extends AbstractHandler {
                 }
             }
         }
-        if (newTrace == null)
+        if (newTrace == null) {
             return null;
+        }
 
         List<WorkspaceModifyOperation> removeOps = new ArrayList<WorkspaceModifyOperation>();
         TmfExperimentFolder experimentFolder = newTrace.getProject().getExperimentsFolder();
@@ -132,7 +137,7 @@ public class RenameTraceHandler extends AbstractHandler {
                 if (trace.equals(oldTrace)) {
                     // Create a link to the renamed trace
                     createTraceLink(newTrace, experiment);
-                    
+
                     // Queue the removal of the old trace link
                     removeOps.add(new WorkspaceModifyOperation() {
                         @Override
@@ -154,11 +159,12 @@ public class RenameTraceHandler extends AbstractHandler {
             } catch (RuntimeException exception) {
             }
         }
-        
+
         return null;
     }
 
-    private void createTraceLink(TmfTraceElement trace, final ITmfProjectModelElement experiment) {
+    private static void createTraceLink(TmfTraceElement trace,
+            final ITmfProjectModelElement experiment) {
         try {
             IResource resource = trace.getResource();
             IPath location = resource.getLocation();
index e8095698bcfba202bf5837a7d187deaae210f8d7..7adb4c201d190dd486976d57655f6f50bc8cbefb 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2011 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Patrick Tasse - Initial API and implementation
  *******************************************************************************/
@@ -129,11 +129,12 @@ public class SelectTraceTypeContributionItem extends CompoundContributionItem {
         return list.toArray(new IContributionItem[list.size()]);
     }
 
-    private void addContributionItem(List<IContributionItem> list,
-            String traceBundle, String traceTypeId, String traceIcon, String label, boolean selected,
+    private static void addContributionItem(List<IContributionItem> list,
+            String traceBundle, String traceTypeId, String traceIcon,
+            String label, boolean selected,
             MenuManager subMenu) {
         Map<String, String> params;
-        
+
         params = new HashMap<String, String>();
         params.put(BUNDLE_PARAMETER, traceBundle);
         params.put(TYPE_PARAMETER, traceTypeId);
index b77f207e8333534abd840235c508665c208996e9..aea2f9b9b1fe4eb8ac37a60657855c4acf0d4bf8 100644 (file)
@@ -136,7 +136,9 @@ public class SelectTraceTypeHandler extends AbstractHandler {
         return null;
     }
 
-    private boolean propagateProperties(TmfTraceElement trace, String bundleName, String traceType, String iconUrl) throws CoreException {
+    private static boolean propagateProperties(TmfTraceElement trace,
+            String bundleName, String traceType, String iconUrl)
+            throws CoreException {
 
         IResource svResource = trace.getResource();
         String svBundleName = svResource.getPersistentProperty(TmfCommonConstants.TRACEBUNDLE);
@@ -172,13 +174,14 @@ public class SelectTraceTypeHandler extends AbstractHandler {
         return true;
     }
 
-    private void setProperties(IResource resource, String bundleName, String traceType, String iconUrl) throws CoreException {
+    private static void setProperties(IResource resource, String bundleName,
+            String traceType, String iconUrl) throws CoreException {
         resource.setPersistentProperty(TmfCommonConstants.TRACEBUNDLE, bundleName);
         resource.setPersistentProperty(TmfCommonConstants.TRACETYPE, traceType);
         resource.setPersistentProperty(TmfCommonConstants.TRACEICON, iconUrl);
     }
 
-    private boolean validateTraceType(TmfTraceElement trace) {
+    private static boolean validateTraceType(TmfTraceElement trace) {
         IProject project = trace.getProject().getResource();
         ITmfTrace<?> tmfTrace = null;
         try {
index c747dc1bb96cf5680b0fd7cc18871de4eb0895c2..a57993860132b1b4579b7f1dea8c5deb2c168b5d 100644 (file)
@@ -95,8 +95,9 @@ public class EventsViewEditor extends TmfEditor {
             fTrace = ((TmfEditorInput) input).getTrace();
         } else if (input instanceof IFileEditorInput) {
             fFile = ((IFileEditorInput) input).getFile();
-            if (fFile == null)
+            if (fFile == null) {
                 throw new PartInitException("Invalid IFileEditorInput: " + input); //$NON-NLS-1$
+            }
             final TmfExperiment currentExperiment = TmfExperiment.getCurrentExperiment();
             if ((currentExperiment != null) && fFile.equals(currentExperiment.getBookmarksFile())) {
                 fTrace = currentExperiment;
@@ -106,15 +107,17 @@ public class EventsViewEditor extends TmfEditor {
             }
             try {
                 final String traceTypeId = fFile.getPersistentProperty(TmfCommonConstants.TRACETYPE);
-                if (traceTypeId == null)
+                if (traceTypeId == null) {
                     throw new PartInitException(Messages.OpenTraceHandler_NoTraceType);
+                }
                 if (traceTypeId.equals(TmfExperiment.class.getCanonicalName())) {
                     // Special case: experiment bookmark resource
                     final TmfNavigatorContentProvider ncp = new TmfNavigatorContentProvider();
                     ncp.getChildren(fFile.getProject()); // force the model to be populated
                     final TmfProjectElement project = TmfProjectRegistry.getProject(fFile.getProject());
-                    if (project == null)
+                    if (project == null) {
                         throw new PartInitException(Messages.OpenExperimentHandler_NoTraceType);
+                    }
                     for (final ITmfProjectModelElement projectElement : project.getExperimentsFolder().getChildren()) {
                         final String traceName = fFile.getParent().getName();
                         if (projectElement.getName().equals(traceName)) {
@@ -129,8 +132,9 @@ public class EventsViewEditor extends TmfEditor {
                                 final ITmfTrace trace = traceElement.instantiateTrace();
                                 final ITmfEvent traceEvent = traceElement.instantiateEvent();
                                 if ((trace == null) || (traceEvent == null)) {
-                                    for (int j = 0; j < i; j++)
+                                    for (int j = 0; j < i; j++) {
                                         traces[j].dispose();
+                                    }
                                     throw new PartInitException(Messages.OpenExperimentHandler_NoTraceType);
                                 }
                                 try {
@@ -160,8 +164,9 @@ public class EventsViewEditor extends TmfEditor {
                             // Instantiate the experiment trace
                             final ITmfTrace trace = traceElement.instantiateTrace();
                             final ITmfEvent traceEvent = traceElement.instantiateEvent();
-                            if ((trace == null) || (traceEvent == null))
+                            if ((trace == null) || (traceEvent == null)) {
                                 throw new PartInitException(Messages.OpenTraceHandler_NoTraceType);
+                            }
                             try {
                                 trace.initTrace(traceElement.getResource(), traceElement.getLocation().getPath(), traceEvent.getClass());
                             } catch (final TmfTraceException e) {
@@ -179,14 +184,15 @@ public class EventsViewEditor extends TmfEditor {
                     final TmfNavigatorContentProvider ncp = new TmfNavigatorContentProvider();
                     ncp.getChildren(fFile.getProject()); // force the model to be populated
                     final TmfProjectElement project = TmfProjectRegistry.getProject(fFile.getProject());
-                    for (final ITmfProjectModelElement projectElement : project.getTracesFolder().getChildren())
+                    for (final ITmfProjectModelElement projectElement : project.getTracesFolder().getChildren()) {
                         if (projectElement.getResource().equals(fFile)) {
                             final TmfTraceElement traceElement = (TmfTraceElement) projectElement;
                             // Instantiate the experiment trace
                             final ITmfTrace trace = traceElement.instantiateTrace();
                             final ITmfEvent traceEvent = traceElement.instantiateEvent();
-                            if ((trace == null) || (traceEvent == null))
+                            if ((trace == null) || (traceEvent == null)) {
                                 throw new PartInitException(Messages.OpenTraceHandler_NoTraceType);
+                            }
                             try {
                                 trace.initTrace(traceElement.getResource(), traceElement.getLocation().getPath(), traceEvent.getClass());
                             } catch (final TmfTraceException e) {
@@ -199,6 +205,7 @@ public class EventsViewEditor extends TmfEditor {
                             TmfSignalManager.dispatchSignal(new TmfExperimentSelectedSignal(this, experiment));
                             break;
                         }
+                    }
                 }
             } catch (final InvalidRegistryObjectException e) {
                 Activator.getDefault().logError("Error initializing EventsViewEditor", e); //$NON-NLS-1$
@@ -206,10 +213,13 @@ public class EventsViewEditor extends TmfEditor {
                 Activator.getDefault().logError("Error initializing EventsViewEditor", e); //$NON-NLS-1$
             }
             input = new TmfEditorInput(fFile, fTrace);
-        } else
+        } else {
             throw new PartInitException("Invalid IEditorInput: " + input.getClass()); //$NON-NLS-1$
+        }
         if (fTrace == null)
+         {
             throw new PartInitException("Invalid IEditorInput: " + fFile.getName()); //$NON-NLS-1$
+        }
         super.setSite(site);
         super.setInput(input);
     }
@@ -253,14 +263,16 @@ public class EventsViewEditor extends TmfEditor {
                 final EditorPart editorPart = EventsViewEditor.this;
                 final IWorkbenchPage page = editorPart.getEditorSite().getPage();
                 page.closeEditor(editorPart, false);
-                if (page.getEditorReferences().length == 0)
+                if (page.getEditorReferences().length == 0) {
                     page.setEditorAreaVisible(fEditorAreaVisible);
+                }
                 try {
                     final IViewPart viewPart = page.showView(TmfEventsView.ID);
                     if (fGotoMarker != null) {
                         final IGotoMarker adapter = (IGotoMarker) viewPart.getAdapter(IGotoMarker.class);
-                        if (adapter != null)
+                        if (adapter != null) {
                             adapter.gotoMarker(fGotoMarker);
+                        }
                     }
                 } catch (final PartInitException e) {
                     Activator.getDefault().logError("Error setting focus", e); //$NON-NLS-1$
@@ -275,13 +287,14 @@ public class EventsViewEditor extends TmfEditor {
     @SuppressWarnings("rawtypes")
     @Override
     public Object getAdapter(final Class adapter) {
-        if (IGotoMarker.class.equals(adapter))
+        if (IGotoMarker.class.equals(adapter)) {
             return new IGotoMarker() {
             @Override
             public void gotoMarker(final IMarker marker) {
                 fGotoMarker = marker;
             }
         };
+        }
         return super.getAdapter(adapter);
     }
 
index 5de7b94cca806501550e61ec849ca916574151cd..c0567eab38e4dd547d706e8b005e18505fcace7d 100644 (file)
@@ -355,15 +355,20 @@ public class TmfEventsEditor extends TmfEditor implements ITmfTraceEditor, IReus
     }\r
 \r
     /**\r
-     * Get the events table for an experiment.\r
-     * If all traces in the experiment are of the same type,\r
-     * use the extension point specified event table\r
-     * @param experiment the experiment\r
-     * @param parent the parent Composite\r
-     * @param cacheSize the event table cache size\r
+     * Get the events table for an experiment. If all traces in the experiment\r
+     * are of the same type, use the extension point specified event table\r
+     *\r
+     * @param experiment\r
+     *            the experiment\r
+     * @param parent\r
+     *            the parent Composite\r
+     * @param cacheSize\r
+     *            the event table cache size\r
      * @return an events table of the appropriate type\r
      */\r
-    private TmfEventsTable getExperimentEventsTable(final TmfExperiment<?> experiment, final Composite parent, final int cacheSize) {\r
+    private static TmfEventsTable getExperimentEventsTable(\r
+            final TmfExperiment<?> experiment, final Composite parent,\r
+            final int cacheSize) {\r
         TmfEventsTable eventsTable = null;\r
         String commonTraceType = null;\r
         try {\r
index fa5f22bc119ce33d57d2c84da4f1d63d40e391cd..cf0b65c8e8c0c92701e889b63bc51b656d9cb78e 100644 (file)
@@ -368,7 +368,8 @@ public class TmfNavigatorContentProvider implements IPipelinedTreeContentProvide
      * @param children
      *            the current children
      */
-    private void customizeTmfElements(Object[] elements, Set<Object> children) {
+    private static void customizeTmfElements(Object[] elements,
+            Set<Object> children) {
         if (elements != null && children != null) {
             for (Object element : elements) {
                 if (element instanceof ITmfProjectModelElement) {
index 6c837b731b5b2afc1925ac4a93ae428574a2d75c..951b15de52e3a71a8bcbfbd48db9aa748b2c0cac 100644 (file)
@@ -69,7 +69,7 @@ public class TmfNavigatorLabelProvider implements ICommonLabelProvider {
         fExperimentIcon = loadIcon(bundle, fExperimentIconFile);
     }
 
-    private Image loadIcon(Bundle bundle, String url) {
+    private static Image loadIcon(Bundle bundle, String url) {
         Activator plugin = Activator.getDefault();
         String key = bundle.getSymbolicName() + "/" + url; //$NON-NLS-1$
         Image icon = plugin.getImageRegistry().get(key);
index e868b74580f607a1d11928ffdb34481e58cd76d3..69175d9dc65d11bc662de0e994fd6b305c2c8a69 100644 (file)
@@ -43,7 +43,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor;
  * Implementation of trace model element representing a trace. It provides methods to instantiate
  * <code>ITmfTrace</code> and <code>ITmfEvent</code> as well as editor ID from the trace type
  * extension definition.
- * 
+ *
  * @version 1.0
  * @author Francois Chouinard
  */
@@ -124,7 +124,7 @@ public class TmfTraceElement extends TmfProjectModelElement implements IActionFi
     // Constructors
     // ------------------------------------------------------------------------
     /**
-     * Constructor. 
+     * Constructor.
      * Creates trace model element under the trace folder.
      * @param name The name of trace
      * @param trace The trace resource.
@@ -134,7 +134,7 @@ public class TmfTraceElement extends TmfProjectModelElement implements IActionFi
         this(name, trace, (TmfProjectModelElement) parent);
     }
     /**
-     * Constructor. 
+     * Constructor.
      * Creates trace model element under the experiment folder.
      * @param name The name of trace
      * @param trace The trace resource.
@@ -162,7 +162,7 @@ public class TmfTraceElement extends TmfProjectModelElement implements IActionFi
     }
 
     /**
-     * Refreshes the trace type filed by reading the trace type persistent property of the resource 
+     * Refreshes the trace type filed by reading the trace type persistent property of the resource
      * referenece.
      */
     public void refreshTraceType() {
@@ -174,8 +174,8 @@ public class TmfTraceElement extends TmfProjectModelElement implements IActionFi
     }
 
     /**
-     * Instantiate a <code>ITmfTrace</code> object based on the trace type and the corresponding extension. 
-     * 
+     * Instantiate a <code>ITmfTrace</code> object based on the trace type and the corresponding extension.
+     *
      * @return the <code>ITmfTrace</code> or <code>null</code> for an error
      */
     public ITmfTrace<?> instantiateTrace() {
@@ -210,8 +210,8 @@ public class TmfTraceElement extends TmfProjectModelElement implements IActionFi
     }
 
     /**
-     * Instantiate a <code>ITmfEvent</code> object based on the trace type and the corresponding extension. 
-     * 
+     * Instantiate a <code>ITmfEvent</code> object based on the trace type and the corresponding extension.
+     *
      * @return the <code>ITmfEvent</code> or <code>null</code> for an error
      */
     public ITmfEvent instantiateEvent() {
@@ -513,7 +513,7 @@ public class TmfTraceElement extends TmfProjectModelElement implements IActionFi
         return null;
     }
 
-    private String getCategory(IConfigurationElement ce) {
+    private static String getCategory(IConfigurationElement ce) {
         String categoryId = ce.getAttribute(TmfTraceType.CATEGORY_ATTR);
         if (categoryId != null) {
             IConfigurationElement category = sfTraceCategories.get(categoryId);
index f3416fe40723b51efc037d839383db257c0d7cb5..6e938e6a941f16f7c774b731d47b18ba310e90e8 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2010, 2011, 2012 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -22,6 +22,7 @@ import org.eclipse.linuxtools.internal.tmf.ui.Activator;
 import org.eclipse.ui.IImportWizard;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
 
 /**
  * The import trace wizard implementation.
@@ -81,7 +82,7 @@ public class ImportTraceWizard extends Wizard implements IImportWizard {
         }
 
         setWindowTitle(Messages.ImportTraceWizard_DialogTitle);
-        setDefaultPageImageDescriptor(Activator.imageDescriptorFromPlugin(PLUGIN_ID, ICON_PATH));
+        setDefaultPageImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, ICON_PATH));
         setNeedsProgressMonitor(true);
     }
 
@@ -95,7 +96,7 @@ public class ImportTraceWizard extends Wizard implements IImportWizard {
         fTraceImportWizardPage = new ImportTraceWizardPage(fWorkbench, fSelection);
         addPage(fTraceImportWizardPage);
     }
-    
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.jface.wizard.Wizard#performFinish()
index c8380a13e12c759a6eacc816102c907b72bee94e..219605786fe2f650e60beb287ccd785ddeeecb43 100644 (file)
@@ -291,7 +291,7 @@ public class ImportTraceWizardPage extends WizardResourceImportPage {
         };
     }
 
-    private void populateChildren(FileSystemElement parent) {
+    private static void populateChildren(FileSystemElement parent) {
         // Do not re-populate if the job was done already...
         FileSystemStructureProvider provider = FileSystemStructureProvider.INSTANCE;
         if (parent.getFolders().size() == 0 && parent.getFiles().size() == 0) {
@@ -454,7 +454,7 @@ public class ImportTraceWizardPage extends WizardResourceImportPage {
         return getSourceDirectory(directoryNameField.getText());
     }
 
-    private File getSourceDirectory(String path) {
+    private static File getSourceDirectory(String path) {
         File sourceDirectory = new File(getSourceDirectoryName(path));
         if (!sourceDirectory.exists() || !sourceDirectory.isDirectory()) {
             return null;
@@ -463,7 +463,7 @@ public class ImportTraceWizardPage extends WizardResourceImportPage {
         return sourceDirectory;
     }
 
-    private String getSourceDirectoryName(String sourceName) {
+    private static String getSourceDirectoryName(String sourceName) {
         IPath result = new Path(sourceName.trim());
         if (result.getDevice() != null && result.segmentCount() == 0) {
             result = result.addTrailingSeparator();
@@ -537,7 +537,8 @@ public class ImportTraceWizardPage extends WizardResourceImportPage {
         return results[0];
     }
 
-    private FileSystemElement createRootElement(Object fileSystemObject, IImportStructureProvider provider) {
+    private static FileSystemElement createRootElement(Object fileSystemObject,
+            IImportStructureProvider provider) {
 
         boolean isContainer = provider.isFolder(fileSystemObject);
         String elementLabel = provider.getLabel(fileSystemObject);
index f4eefa0d5cba514cc5de24ce6a2348e1c3a9c948..c7781b9b89ff11991124c97bac6693d1db8efc03 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2011 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -93,7 +93,7 @@ public class NewTmfProjectWizard extends Wizard implements INewWizard, IExecutab
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.eclipse.jface.wizard.Wizard#addPages()
      */
     @Override
@@ -106,7 +106,7 @@ public class NewTmfProjectWizard extends Wizard implements INewWizard, IExecutab
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.eclipse.jface.wizard.Wizard#performCancel()
      */
     @Override
@@ -116,7 +116,7 @@ public class NewTmfProjectWizard extends Wizard implements INewWizard, IExecutab
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.eclipse.jface.wizard.Wizard#performFinish()
      */
     @Override
@@ -128,7 +128,8 @@ public class NewTmfProjectWizard extends Wizard implements INewWizard, IExecutab
         return true;
     }
 
-    private IProject createProject(String projectName, URI projectLocation, IProgressMonitor monitor) {
+    private static IProject createProject(String projectName,
+            URI projectLocation, IProgressMonitor monitor) {
 
         IWorkspace workspace = ResourcesPlugin.getWorkspace();
         IWorkspaceRoot root = workspace.getRoot();
@@ -137,35 +138,40 @@ public class NewTmfProjectWizard extends Wizard implements INewWizard, IExecutab
         try {
             if (!project.exists()) {
                 IProjectDescription description = workspace.newProjectDescription(project.getName());
-                if (projectLocation != null)
+                if (projectLocation != null) {
                     description.setLocationURI(projectLocation);
+                }
                 project.create(description, monitor);
             }
 
-            if (!project.isOpen())
+            if (!project.isOpen()) {
                 project.open(monitor);
+            }
 
             IProjectDescription description = project.getDescription();
             description.setNatureIds(new String[] { TmfProjectNature.ID });
             project.setDescription(description, null);
 
             IFolder folder = project.getFolder(TmfTraceFolder.TRACE_FOLDER_NAME);
-            if (!folder.exists())
+            if (!folder.exists()) {
                 folder.create(true, true, null);
+            }
 
             folder = project.getFolder(TmfExperimentFolder.EXPER_FOLDER_NAME);
-            if (!folder.exists())
+            if (!folder.exists()) {
                 folder.create(true, true, null);
+            }
 
             // create folder for supplementary tracing files
             folder = project.getFolder(TmfCommonConstants.TRACE_SUPPLEMENATARY_FOLDER_NAME);
 
-            if (!folder.exists())
+            if (!folder.exists()) {
                 folder.create(true, true, null);
+            }
 
             return project;
         } catch (CoreException e) {
-            Activator.getDefault().logError("Error creating TMF project " + project.getName(), e); //$NON-NLS-1$            
+            Activator.getDefault().logError("Error creating TMF project " + project.getName(), e); //$NON-NLS-1$
         }
         return null;
     }
index 64cdeff85a6c7c2fb7927011b9e85b3b6942d023..046ab245c81d1a5e330bcfa07f84083fcbfa6c92 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2011, 2012 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Francois Chouinard - Copied and adapted from NewFolderDialog
  *******************************************************************************/
@@ -50,7 +50,7 @@ import org.eclipse.ui.dialogs.SelectionStatusDialog;
 
 /**
  * Implementation of a dialog box to rename an experiment.
- * <p> 
+ * <p>
  * @version 1.0
  * @author Francois Chouinard
  */
@@ -62,8 +62,8 @@ public class RenameExperimentDialog extends SelectionStatusDialog {
 
        private final TmfExperimentElement fExperiment;
        private Text fNewExperimentName;
-    private IContainer fExperimentFolder;
-    private TmfProjectElement fProject;
+    private final IContainer fExperimentFolder;
+    private final TmfProjectElement fProject;
 
     // ------------------------------------------------------------------------
     // Constructor
@@ -143,7 +143,7 @@ public class RenameExperimentDialog extends SelectionStatusDialog {
     }
 
     private void validateNewExperimentName() {
-        
+
        String name = fNewExperimentName.getText();
         IWorkspace workspace = fExperimentFolder.getWorkspace();
         IStatus nameStatus = workspace.validateName(name, IResource.FOLDER);
@@ -152,12 +152,12 @@ public class RenameExperimentDialog extends SelectionStatusDialog {
                updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_EmptyNameError, null));
                return;
         }
-        
+
         if (!nameStatus.isOK()) {
                updateStatus(nameStatus);
                return;
         }
-        
+
         IPath path = new Path(name);
         if (fExperimentFolder.getFolder(path).exists() || fExperimentFolder.getFile(path).exists()) {
             updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_ExistingNameError, null));
@@ -187,7 +187,7 @@ public class RenameExperimentDialog extends SelectionStatusDialog {
         super.create();
         getButton(IDialogConstants.OK_ID).setEnabled(false);
     }
-    
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed()
@@ -219,7 +219,7 @@ public class RenameExperimentDialog extends SelectionStatusDialog {
                     if (monitor.isCanceled()) {
                         throw new OperationCanceledException();
                     }
-                    IFolder folder = (IFolder) fExperiment.getResource();
+                    IFolder folder = fExperiment.getResource();
                     IFile bookmarksFile = folder.getFile(fExperiment.getName() + '_');
                     IFile newBookmarksFile = folder.getFile(newName + '_');
                     if (bookmarksFile.exists()) {
index 4e70547fc1c4a1128c69bd277fc651828041387e..6ab6c9502a9a48eef5c7dc023fff47fd0b4b2fea 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010, 2011, 2012 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -47,7 +47,7 @@ import org.eclipse.swt.widgets.TableColumn;
 /**
  * Implementation of a wizard page for selecting trace for an experiment.
  * <p>
- * 
+ *
  * @version 1.0
  * @author Francois Chouinard
  */
@@ -178,14 +178,15 @@ public class SelectTracesWizardPage extends WizardPage {
     /**
      * Create a link to the actual trace and set the trace type
      */
-    private void createLink(IFolder experiment, TmfTraceElement trace, IResource resource, IPath location) {
+    private static void createLink(IFolder experiment, TmfTraceElement trace,
+            IResource resource, IPath location) {
         IWorkspace workspace = ResourcesPlugin.getWorkspace();
         try {
             Map<QualifiedName, String> properties = trace.getResource().getPersistentProperties();
             String bundleName = properties.get(TmfCommonConstants.TRACEBUNDLE);
             String traceType = properties.get(TmfCommonConstants.TRACETYPE);
             String iconUrl = properties.get(TmfCommonConstants.TRACEICON);
-            
+
             if (resource instanceof IFolder) {
                 IFolder folder = experiment.getFolder(trace.getName());
                 if (workspace.validateLinkLocation(folder, location).isOK()) {
@@ -209,7 +210,8 @@ public class SelectTracesWizardPage extends WizardPage {
         }
     }
 
-    private void setProperties(IResource resource, String bundleName, String traceType, String iconUrl) throws CoreException {
+    private static void setProperties(IResource resource, String bundleName,
+            String traceType, String iconUrl) throws CoreException {
         resource.setPersistentProperty(TmfCommonConstants.TRACEBUNDLE, bundleName);
         resource.setPersistentProperty(TmfCommonConstants.TRACETYPE, traceType);
         resource.setPersistentProperty(TmfCommonConstants.TRACEICON, iconUrl);
@@ -222,8 +224,9 @@ public class SelectTracesWizardPage extends WizardPage {
         Vector<TmfTraceElement> traces = new Vector<TmfTraceElement>();
         Object[] selection = fCheckboxTableViewer.getCheckedElements();
         for (Object sel : selection) {
-            if (sel instanceof TmfTraceElement)
+            if (sel instanceof TmfTraceElement) {
                 traces.add((TmfTraceElement) sel);
+            }
         }
         TmfTraceElement[] result = new TmfTraceElement[traces.size()];
         traces.toArray(result);
index 63920847e04e57190ec6bbd8a3296a4cfd0e72a3..8708ac187f660f171f1f5e290585c012f0ae53d0 100644 (file)
@@ -38,12 +38,12 @@ import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;\r
 import org.eclipse.jface.action.MenuManager;\r
 import org.eclipse.jface.action.Separator;\r
-import org.eclipse.jface.dialogs.Dialog;\r
 import org.eclipse.jface.dialogs.InputDialog;\r
 import org.eclipse.jface.dialogs.MessageDialog;\r
 import org.eclipse.jface.resource.FontDescriptor;\r
 import org.eclipse.jface.resource.JFaceResources;\r
 import org.eclipse.jface.resource.LocalResourceManager;\r
+import org.eclipse.jface.window.Window;\r
 import org.eclipse.linuxtools.internal.tmf.ui.Activator;\r
 import org.eclipse.linuxtools.internal.tmf.ui.Messages;\r
 import org.eclipse.linuxtools.tmf.core.component.ITmfDataProvider;\r
@@ -1603,7 +1603,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker,
                 final InputDialog dialog = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),\r
                         Messages.TmfEventsTable_AddBookmarkDialogTitle, Messages.TmfEventsTable_AddBookmarkDialogText,\r
                         defaultMessage.toString(), null);\r
-                if (dialog.open() == Dialog.OK) {\r
+                if (dialog.open() == Window.OK) {\r
                     final String message = dialog.getValue();\r
                     try {\r
                         final IMarker bookmark = bookmarksFile.createMarker(IMarker.BOOKMARK);\r
@@ -1879,7 +1879,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker,
      *\r
      * @param e the exception\r
      */\r
-    private void displayException(final Exception e) {\r
+    private static void displayException(final Exception e) {\r
         final MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());\r
         mb.setText(e.getClass().getName());\r
         mb.setMessage(e.getMessage());\r
index e366e3be1d73bb07aefc79b289f96f18bcd4de5c..59d936f4483f190254eb66e006ce30de7270a282 100644 (file)
@@ -20,9 +20,9 @@ import java.util.List;
 import org.eclipse.jface.action.Action;\r
 import org.eclipse.jface.action.IToolBarManager;\r
 import org.eclipse.jface.action.Separator;\r
-import org.eclipse.jface.dialogs.Dialog;\r
 import org.eclipse.jface.dialogs.MessageDialog;\r
 import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.eclipse.jface.window.Window;\r
 import org.eclipse.linuxtools.internal.tmf.ui.Activator;\r
 import org.eclipse.linuxtools.internal.tmf.ui.Messages;\r
 import org.eclipse.linuxtools.tmf.ui.views.TmfView;\r
@@ -530,7 +530,7 @@ public class ColorsView extends TmfView {
                     FilterDialog dialog = new FilterDialog(fShell);\r
                     dialog.setFilter(colorSetting.getFilter());\r
                     dialog.open();\r
-                    if (dialog.getReturnCode() == Dialog.OK) {\r
+                    if (dialog.getReturnCode() == Window.OK) {\r
                         if (dialog.getFilter() != null) {\r
                             colorSetting.setFilter(dialog.getFilter());\r
                             filterText.setText(dialog.getFilter().toString());\r
index 48d11d15757eccad2f37279c5c38066e100a3384..ec41e4807751ae5cd9c5d7b5aab9b88149dfb57e 100644 (file)
@@ -255,7 +255,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
         fTimeRangeEndText.setLayoutData(gridData);
     }
 
-    private Font adjustFont(final Composite composite) {
+    private static Font adjustFont(final Composite composite) {
         // Reduce font size for a more pleasing rendering
         final int fontSizeAdjustment = -2;
         final Font font = composite.getFont();
@@ -550,7 +550,8 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
         }
     }
 
-    private void drawDelimiter(final GC imageGC, final Color color, final int height, final int index) {
+    private static void drawDelimiter(final GC imageGC, final Color color,
+            final int height, final int index) {
         imageGC.setBackground(color);
         final int dash = height / 4;
         imageGC.fillRectangle(index, 0 * dash, 1, dash - 1);
index d5dcae72326f8607874df8e6a8e805bc02df1d59..6ad857d434eb2c9aa58f9dcb85d4261ae67cf14d 100644 (file)
@@ -48,7 +48,7 @@ import org.eclipse.swt.widgets.Composite;
  * <li>the window span (size of the time window of the smaller histogram).
  * </ul>
  * The histograms x-axis show their respective time range.
- * 
+ *
  * @version 1.0
  * @author Francois Chouinard
  */
@@ -267,7 +267,7 @@ public class HistogramView extends TmfView {
 
     /**
      * Returns the time range of the current selected window (base on default time scale).
-     * 
+     *
      * @return the time range of current selected window.
      */
     public TmfTimeRange getTimeRange() {
@@ -370,10 +370,10 @@ public class HistogramView extends TmfView {
     }
 
     /**
-     * Handles experiment range updated signal. Extends histogram according to the new time range. If a 
+     * Handles experiment range updated signal. Extends histogram according to the new time range. If a
      * HistogramRequest is already ongoing, it will be cancelled and a new request with the new range
      * will be issued.
-     * 
+     *
      * @param signal the experiment range updated signal
      */
     @TmfSignalHandler
@@ -423,7 +423,7 @@ public class HistogramView extends TmfView {
     /**
      * Handles the current time updated signal. Sets the current time in the time range
      * histogram as well as the full histogram.
-     * 
+     *
      * @param signal the signal to process
      */
     @TmfSignalHandler
index 9f40de8aabc30c0cb91ee602407a520de3652cd5..48e6ecb92aa30903af2258481d9494cddea5bb11 100755 (executable)
@@ -22,7 +22,6 @@ import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerComparator;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
 import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
 import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
 import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
@@ -545,7 +544,7 @@ public class TmfStatisticsView extends TmfView {
                     modelIncomplete(experiment.getName());
                 }
             };
-            ((TmfExperiment<ITmfEvent>) experiment).sendRequest((ITmfDataRequest<ITmfEvent>) fRequest);
+            ((TmfExperiment<ITmfEvent>) experiment).sendRequest(fRequest);
             waitCursor(true);
         }
     }
index c62df8a373f1653cf9391e14f5c56980c42d1113..79efa68d189a3180c555b6e5325b8ba92d10811b 100755 (executable)
@@ -147,9 +147,8 @@ public abstract class AbsTmfStatisticsTree {
         if (path.size() == 1) {
             if (path.equals(ROOT)) {
                 return null;
-            } else {
-                return get(ROOT);
             }
+            return get(ROOT);
         }
         return get(path.subArray(0, path.size() - 1));
     }
index 62b8888e06c8550033cf92bd5a50ad23f006c4ef..d0dc21e729da296fc029bd9cc88feea3cac54955 100755 (executable)
@@ -77,9 +77,8 @@ public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
                 TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) element;
                 if (fFolderLevels.contains(node.getKey())) {
                     return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
-                } else {
-                    return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
                 }
+                return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
             }
         }, new ViewerComparator() {
             @Override
@@ -97,9 +96,8 @@ public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
                 TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) element;
                 if (!fFolderLevels.contains(node.getKey())) {
                     return Long.toString(node.getValue().nbEvents);
-                } else {
-                    return ""; //$NON-NLS-1$
                 }
+                return ""; //$NON-NLS-1$
             }
         }, new ViewerComparator() {
             @Override
@@ -120,9 +118,8 @@ public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
 
                 if (parent == null) {
                     return 0;
-                } else {
-                    return (double) node.getValue().nbEvents / parent.getValue().nbEvents;
                 }
+                return (double) node.getValue().nbEvents / parent.getValue().nbEvents;
             }
         }));
     }
index c27c6d2c397b5520c761c764a684a84d4fde95ad..b6559c5b3df9655b89cd257540dc70b393a85831 100644 (file)
@@ -109,9 +109,8 @@ public class TimeChartAnalysisEntry implements ITimeGraphEntry {
                 if (nestedIterator != null) {\r
                     if (nestedIterator.hasNext()) {\r
                         return true;\r
-                    } else {\r
-                        nestedIterator = null;\r
                     }\r
+                    nestedIterator = null;\r
                 }\r
                 long time = (lastTime == -1) ? fStartTime : lastTime;\r
                 int index = (fReferenceTime == -1) ? 0 : (int) ((time - fReferenceTime) >> fPower);\r
@@ -123,10 +122,9 @@ public class TimeChartAnalysisEntry implements ITimeGraphEntry {
                                 lastTime = event.getTime() + event.getDuration();\r
                                 next = event;\r
                                 return true;\r
-                            } else {\r
-                                nestedIterator = event.getItemizedEntry().getTimeEventsIterator(fIteratorStartTime, fIteratorStopTime, fIteratorMaxDuration);\r
-                                return nestedIterator.hasNext();\r
                             }\r
+                            nestedIterator = event.getItemizedEntry().getTimeEventsIterator(fIteratorStartTime, fIteratorStopTime, fIteratorMaxDuration);\r
+                            return nestedIterator.hasNext();\r
                         }\r
                     }\r
                 }\r
@@ -189,7 +187,7 @@ public class TimeChartAnalysisEntry implements ITimeGraphEntry {
                 index = (int) ((time - fReferenceTime) >> fPower);\r
                 fTraceEvents.setSize((int) index + 1);\r
             }\r
-            TimeChartEvent event = (TimeChartEvent) fTraceEvents.get((int) index);\r
+            TimeChartEvent event = fTraceEvents.get((int) index);\r
             if (event == null) {\r
                 fTraceEvents.set((int) index, (TimeChartEvent) timeEvent);\r
             } else {\r
@@ -220,7 +218,7 @@ public class TimeChartAnalysisEntry implements ITimeGraphEntry {
             TimeChartEvent event = fTraceEvents.get(i);\r
             if (event != null) {\r
                 index = (int) ((event.getTime() - fReferenceTime) >> fPower);\r
-                TimeChartEvent mergedEvent = (TimeChartEvent) fTraceEvents.get(index);\r
+                TimeChartEvent mergedEvent = fTraceEvents.get(index);\r
                 if (mergedEvent == null) {\r
                     fTraceEvents.set(index, event);\r
                 } else {\r
index 9efa9c166887edfa788ffaa2a182d5edd397c189..2af8116ebeaa2060f2a84713ae712e36127bb1c5 100644 (file)
@@ -82,7 +82,7 @@ public class TimeChartAnalysisProvider extends TimeGraphPresentationProvider {
         }\r
     }\r
 \r
-    private void drawBookmark(Rectangle r, GC gc) {\r
+    private static void drawBookmark(Rectangle r, GC gc) {\r
         gc.setForeground(BOOKMARK_OUTER_COLOR);\r
         gc.drawLine(r.x - 1, r.y - 2, r.x - 1, r.y + 2);\r
         gc.drawLine(r.x + 1, r.y - 2, r.x + 1, r.y + 2);\r
@@ -95,7 +95,7 @@ public class TimeChartAnalysisProvider extends TimeGraphPresentationProvider {
         gc.drawPoint(r.x + 1, r.y + 3);\r
     }\r
 \r
-    private void drawSearchMatch(Rectangle r, GC gc) {\r
+    private static void drawSearchMatch(Rectangle r, GC gc) {\r
         gc.setForeground(SEARCH_MATCH_COLOR);\r
         gc.drawPoint(r.x, r.y + r.height);\r
         gc.drawLine(r.x - 1, r.y + r.height + 1, r.x + 1, r.y + r.height + 1);\r
index 460aa416e311679ba940066b2636cda5f04ec2bd..69e2899bd18a5c11e507e8badb3ce0b6b726afd5 100644 (file)
@@ -226,9 +226,8 @@ public class TimeChartView extends TmfView implements ITimeGraphRangeListener,
             if (fRefreshBusy) {\r
                 fRefreshPending = true;\r
                 return;\r
-            } else {\r
-                fRefreshBusy = true;\r
             }\r
+            fRefreshBusy = true;\r
         }\r
         // Perform the refresh on the UI thread\r
         Display.getDefault().asyncExec(new Runnable() {\r
@@ -255,9 +254,8 @@ public class TimeChartView extends TmfView implements ITimeGraphRangeListener,
             if (fRedrawBusy) {\r
                 fRedrawPending = true;\r
                 return;\r
-            } else {\r
-                fRedrawBusy = true;\r
             }\r
+            fRedrawBusy = true;\r
         }\r
         final boolean reset = resetTimeIntervals;\r
         // Perform the refresh on the UI thread\r
index fd6650b6a7043d19a761466043f70f5e5a4ebab2..f2f93bf6d129f0bd7a69ebee89f5b5c85078f0db 100755 (executable)
@@ -1,13 +1,13 @@
 /**********************************************************************
  * Copyright (c) 2005, 2008 IBM Corporation and others.
  * Copyright (c) 2011, 2012 Ericsson.
- * 
+ *
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * IBM - Initial API and implementation
  * Bernd Hufmann - Updated for TMF
  **********************************************************************/
@@ -15,7 +15,6 @@ package org.eclipse.linuxtools.tmf.ui.views.uml2sd;
 
 import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDMessages;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.PaintEvent;
@@ -34,7 +33,7 @@ import org.eclipse.swt.widgets.Shell;
  * below, a scale to visually locate the value in a time range (usually the minimum an maximum elapsed time in the whole
  * diagram)
  * </p>
- * 
+ *
  * @version 1.0
  * @author sveyrier
  */
@@ -77,7 +76,7 @@ public class DrawableToolTip implements PaintListener {
      */
     private static int fScaleLength = 100;
     /**
-     * The text to display 
+     * The text to display
      */
     protected String fMessage;
     /**
@@ -91,7 +90,7 @@ public class DrawableToolTip implements PaintListener {
 
     /**
      * Creates a drawable tool tip instance.
-     * 
+     *
      * @param parent The parent composite.
      */
     public DrawableToolTip(Composite parent) {
@@ -120,7 +119,7 @@ public class DrawableToolTip implements PaintListener {
     // ------------------------------------------------------------------------
     /**
      * Returns the message to display.
-     * 
+     *
      * @return the message to display.
      */
     public String getText() {
@@ -129,7 +128,7 @@ public class DrawableToolTip implements PaintListener {
 
     /**
      * Returns teh current time to display.
-     * 
+     *
      * @return the current time to display
      */
     public String getAccessibleText() {
@@ -138,7 +137,7 @@ public class DrawableToolTip implements PaintListener {
 
     /**
      * Returns the horizontal margin.
-     * 
+     *
      * @return the horizontal margin.
      */
     protected static int getHorizontalMargin() {
@@ -147,7 +146,7 @@ public class DrawableToolTip implements PaintListener {
 
     /**
      * Sets the horizontal margin.
-     * 
+     *
      * @param margin The margin to set.
      */
     protected static void setHorizontalMargin(int margin) {
@@ -156,7 +155,7 @@ public class DrawableToolTip implements PaintListener {
 
     /**
      * Returns the vertical margin.
-     * 
+     *
      * @return the vertical margin.
      */
     protected static int getVerticalMargin() {
@@ -165,7 +164,7 @@ public class DrawableToolTip implements PaintListener {
 
     /**
      * Sets the vertical margin.
-     * 
+     *
      * @param margin The margin to set.
      */
     protected static void setVerticalMargin(int margin) {
@@ -174,7 +173,7 @@ public class DrawableToolTip implements PaintListener {
 
     /**
      * Returns the text scale margin.
-     * 
+     *
      * @return the text scale margin.
      */
     protected static int getTextScaleMargin() {
@@ -191,7 +190,7 @@ public class DrawableToolTip implements PaintListener {
 
     /**
      * Returns the scale length.
-     * 
+     *
      * @return the scale length.
      */
     protected static int getScaleLength() {
@@ -200,17 +199,17 @@ public class DrawableToolTip implements PaintListener {
 
     /**
      * Sets the scale length.
-     * 
+     *
      * @param scaleLength The scale length to set.
      */
     protected static void setScaleLength(int scaleLength) {
         fScaleLength = scaleLength;
     }
-    
+
     /**
      * Display the tooltip using the given time range(min,max) the current value and the time unit The tooltip will stay
      * on screen until it is told otherwise
-     * 
+     *
      * @param value the current in the scale
      * @param min the scale min
      * @param max the scale max
@@ -237,10 +236,11 @@ public class DrawableToolTip implements PaintListener {
      * Disposes the system resource used by this kind of toolTips (a colors array essentially)
      */
     public void dispose() {
-        for (int i = 0; i < fColors.length; i++)
+        for (int i = 0; i < fColors.length; i++) {
             fColors[i].dispose();
+        }
     }
-    
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.swt.events.PaintListener#paintControl(org.eclipse.swt.events.PaintEvent)
@@ -258,13 +258,13 @@ public class DrawableToolTip implements PaintListener {
         int step = fScaleLength / 10;
 
         // double gr = (max - min) / 10;
-        ITmfTimestamp minMaxdelta = (TmfTimestamp) fMinMaxRange.getEndTime().getDelta(fMinMaxRange.getStartTime());
+        ITmfTimestamp minMaxdelta = fMinMaxRange.getEndTime().getDelta(fMinMaxRange.getStartTime());
         double gr = (minMaxdelta.getValue()) / (double) 10;
 
         // double delta = currentValue-min;
-        ITmfTimestamp delta = (TmfTimestamp) fCurrentValue.getDelta(fMinMaxRange.getStartTime());
+        ITmfTimestamp delta = fCurrentValue.getDelta(fMinMaxRange.getStartTime());
         long absDelta = Math.abs(delta.getValue());
-        
+
         int colIndex = 0;
         if (gr != 0) {
             // colIndex = Math.round((float)(Math.log(1+delta)/gr));
index dd924fef6c508d3c8027a5345ce04a58dbdfb338..7297b17ad3d3070562aa7446e23654709a801f7d 100755 (executable)
@@ -1,13 +1,13 @@
 /**********************************************************************
  * Copyright (c) 2005, 2008 IBM Corporation and others.
  * Copyright (c) 2011, 2012 Ericsson.
- * 
+ *
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * IBM - Initial API and implementation
  * Bernd Hufmann - Updated for TMF
  **********************************************************************/
@@ -33,8 +33,8 @@ import org.eclipse.swt.widgets.Display;
  * <p>
  * This class implements the graphical context for the sequence diagram widgets.
  * </p>
- * 
- * @version 1.0 
+ *
+ * @version 1.0
  * @author sveyrier
  */
 public class NGC implements IGC {
@@ -42,7 +42,7 @@ public class NGC implements IGC {
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
-    
+
     /**
      * The graphical context.
      */
@@ -76,15 +76,15 @@ public class NGC implements IGC {
      */
     protected int fVisibleX;
     /**
-     * The current yx value (view visible height - visible screen bounds) 
+     * The current yx value (view visible height - visible screen bounds)
      */
     protected int yx;
     /**
-     * The current xx value (view visible width - visible screen bounds) 
+     * The current xx value (view visible width - visible screen bounds)
      */
     protected int xx;
     /**
-     * <code>true</code> to draw with focus else <code>false</code>. 
+     * <code>true</code> to draw with focus else <code>false</code>.
      */
     protected boolean fDrawWithFocus = false;
 
@@ -92,15 +92,15 @@ public class NGC implements IGC {
      * The static visible screen bounds.
      */
     private static int fVisibleScreenBounds = 0;
-    
-    
+
+
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
 
     /**
      * Default constructor.
-     * 
+     *
      * @param scrollView A sequence diagram view reference.
      * @param gc A graphical context.
      */
@@ -187,7 +187,7 @@ public class NGC implements IGC {
 
     /**
      * Get code for drawings  at given x and y position.
-     * 
+     *
      * @param x The x position
      * @param y The y position.
      * @return A code for top, bottom, right and left
@@ -203,7 +203,7 @@ public class NGC implements IGC {
         } else if (y < fVisibleY) {
             c |= 0x02; // bottom
         }
-        
+
         if (x > xx) {
             c |= 0x04; // right
         } else if (x < fVisibleX) {
@@ -218,11 +218,11 @@ public class NGC implements IGC {
      */
     @Override
     public void drawLine(int x1, int y1, int x2, int y2) {
-        int localX1 = x1; 
-        int localY1 = y1; 
+        int localX1 = x1;
+        int localY1 = y1;
         int localX2 = x2;
         int localY2 = y2;
-        
+
         localX1 = Math.round(localX1 * fView.fZoomValue);
         localY1 = Math.round(localY1 * fView.fZoomValue);
         localX2 = Math.round(localX2 * fView.fZoomValue);
@@ -288,7 +288,7 @@ public class NGC implements IGC {
         int localY = y;
         int localWidth = width;
         int localHeight = height;
-                
+
         localX = Math.round(localX * fView.fZoomValue);
         // Workaround to avoid problems for some special cases (not very nice)
         if (localY != getContentsY()) {
@@ -321,7 +321,7 @@ public class NGC implements IGC {
         }
         fContext.drawRectangle(localX, localY, localWidth, localHeight);
     }
-    
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#drawFocus(int, int, int, int)
@@ -373,10 +373,11 @@ public class NGC implements IGC {
             i++;
             localPoint[i] = fView.contentsToViewY(Math.round(points[i] * fView.fZoomValue));
         }
-        
-        if (validatePolygonHeight(localPoint) <= 0)
+
+        if (validatePolygonHeight(localPoint) <= 0) {
             return;
-        
+        }
+
         fContext.fillPolygon(localPoint);
     }
 
@@ -393,7 +394,7 @@ public class NGC implements IGC {
             i++;
             localPoint[i] = fView.contentsToViewY(Math.round(points[i] * fView.fZoomValue));
         }
-        
+
         if (validatePolygonHeight(localPoint) <= 0) {
             return;
         }
@@ -455,7 +456,7 @@ public class NGC implements IGC {
         int localY = y;
         int localWidth = width;
         int localHeight = height;
-        
+
         localX = Math.round(localX * fView.fZoomValue);
         localY = Math.round(localY * fView.fZoomValue);
         localWidth = Math.round(localWidth * fView.fZoomValue);
@@ -493,14 +494,14 @@ public class NGC implements IGC {
         setForeground(tempColor);
     }
 
-    
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#textExtent(java.lang.String)
      */
     @Override
     public int textExtent(String name) {
-        return ((Point) (fContext.textExtent(name))).x;
+        return fContext.textExtent(name).x;
     }
 
     /*
@@ -511,7 +512,7 @@ public class NGC implements IGC {
     public void drawText(String string, int x, int y, boolean isTrans) {
         int localX = x;
         int localY = y;
-        
+
         localX = Math.round(localX * fView.fZoomValue);
         localY = Math.round(localY * fView.fZoomValue);
         fContext.drawText(string, fView.contentsToViewX(localX), fView.contentsToViewY(localY), isTrans);
@@ -549,7 +550,7 @@ public class NGC implements IGC {
         int localY = y;
         int localWidth = width;
         int localHeight = height;
-        
+
         localX = Math.round(localX * fView.fZoomValue);
         localY = Math.round(localY * fView.fZoomValue);
         localWidth = Math.round(localWidth * fView.fZoomValue);
@@ -653,7 +654,7 @@ public class NGC implements IGC {
 
     /**
      * Method to draw a text in rectangle. (Linux GTK Workaround)
-     * 
+     *
      * @param string The text to draw.
      * @param x The x position.
      * @param y The y position.
@@ -695,7 +696,7 @@ public class NGC implements IGC {
         if (tx.y > localHeight) {
             return;
         }
-        
+
         // Adjust height and y
         if (y < -fVisibleScreenBounds) {
             localHeight = localHeight + y + fVisibleScreenBounds;
@@ -706,7 +707,7 @@ public class NGC implements IGC {
         } else if (localHeight + y > fView.getVisibleHeight() + fVisibleScreenBounds) {
             localHeight = fView.getVisibleHeight() + fVisibleScreenBounds - y;
         }
-        
+
         if (tx.x <= localWidth) {
             localDrawText(name, x + 1 + (localWidth - tx.x) / 2, y + 1 + (localHeight - tx.y) / 2, trans);
         } else {
@@ -738,7 +739,7 @@ public class NGC implements IGC {
         int localY = yValue;
         int localWidth = width;
         int localHeight = height;
-        
+
         localX = Math.round(localX * fView.fZoomValue);
         localY = Math.round(localY * fView.fZoomValue);
         localWidth = Math.round(localWidth * fView.fZoomValue);
@@ -776,7 +777,7 @@ public class NGC implements IGC {
     public void drawImage(IImage image, int xValue, int yValue, int maxWith, int maxHeight) {
         int localX = xValue;
         int localY = yValue;
-        
+
         Image img = null;
         if (image != null && image.getImage() instanceof Image) {
             img = (Image) image.getImage();
@@ -884,7 +885,7 @@ public class NGC implements IGC {
 
     /**
      * Returns the current font height.
-     * 
+     *
      * @return the current font height.
      */
     protected int getCurrentFontHeight() {
@@ -929,7 +930,7 @@ public class NGC implements IGC {
     public float getZoom() {
         if (fView != null) {
             return fView.fZoomValue;
-        } 
+        }
         return 1;
     }
 
@@ -977,10 +978,10 @@ public class NGC implements IGC {
     public void setDrawTextWithFocusStyle(boolean focus) {
         fDrawWithFocus = focus;
     }
-    
+
     /**
      * Returns the screen bounds.
-     * 
+     *
      * @return the screen bounds.
      */
     protected static int getVscreenBounds() {
@@ -989,20 +990,20 @@ public class NGC implements IGC {
 
     /**
      * Sets the visible screen bounds.
-     * 
+     *
      * @param vBounds the screen bounds.
      */
     protected static void setVscreenBounds(int vBounds) {
         fVisibleScreenBounds = vBounds;
     }
-    
+
     // ------------------------------------------------------------------------
     // Helper methods
     // ------------------------------------------------------------------------
-    
+
     /**
      * Validates the polygon height
-     * 
+     *
      * @param localPoint array of points
      * @return height
      */
@@ -1011,7 +1012,7 @@ public class NGC implements IGC {
         int max = 0;
         int min = Integer.MAX_VALUE;
         while (i < localPoint.length) {
-            max = Math.abs(localPoint[i]) > Math.abs(max) ? localPoint[i] : max; 
+            max = Math.abs(localPoint[i]) > Math.abs(max) ? localPoint[i] : max;
             min = Math.abs(localPoint[i]) < Math.abs(min) ? localPoint[i] : min;
             i+=2;
         }
index d3b6b0f5331b070aed80a3a37df34b817d1d2812..082047942d1c16e78e240bd9e53e1ba49ef2e650 100755 (executable)
@@ -56,7 +56,6 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDCollapseP
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDExtendedActionBarProvider;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDFilterProvider;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDFindProvider;
-import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDGraphNodeSupporter;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDPagingProvider;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDPropertiesProvider;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader;
@@ -982,9 +981,7 @@ public class SDView extends ViewPart {
         if (getSDWidget() != null) {
             return getSDWidget().getFrame();
         }
-        else {
-            return null;
-        }
+        return null;
     }
 
     /**
@@ -1003,10 +1000,9 @@ public class SDView extends ViewPart {
         if ((loader != null)) {// &&( LoadersManager.getLoadersManager().getViewer(l)==this)){
             loader.setViewer(this);
             return false;
-        } else {
-            loadBlank();
-            return true;
         }
+        loadBlank();
+        return true;
     }
 
     /**
index a834327a963fe170020edd13a1973ec226671b1f..19d1a0c38865f35a0b20484fb3eac53a4f265fb0 100755 (executable)
@@ -515,7 +515,7 @@ public class SDWidget extends ScrollView implements SelectionListener,
         for (int i = 0; i < list.size(); i++) {
             if (!fSelectedNodeList.contains(list.get(i))) {
                 fSelectedNodeList.add(list.get(i));
-                ((GraphNode) list.get(i)).setSelected(true);
+                list.get(i).setSelected(true);
             }
         }
         StructuredSelection selection = new StructuredSelection(fSelectedNodeList);
@@ -543,8 +543,8 @@ public class SDWidget extends ScrollView implements SelectionListener,
     public void removeSelection(List<GraphNode> list) {
         fSelectedNodeList.removeAll(list);
         for (int i = 0; i < list.size(); i++) {
-            ((GraphNode) list.get(i)).setSelected(false);
-            ((GraphNode) list.get(i)).setFocused(false);
+            list.get(i).setSelected(false);
+            list.get(i).setFocused(false);
         }
         StructuredSelection selection = new StructuredSelection(fSelectedNodeList);
         fSelProvider.setSelection(selection);
@@ -555,8 +555,8 @@ public class SDWidget extends ScrollView implements SelectionListener,
      */
     public void clearSelection() {
         for (int i = 0; i < fSelectedNodeList.size(); i++) {
-            ((GraphNode) fSelectedNodeList.get(i)).setSelected(false);
-            ((GraphNode) fSelectedNodeList.get(i)).setFocused(false);
+            fSelectedNodeList.get(i).setSelected(false);
+            fSelectedNodeList.get(i).setFocused(false);
         }
         fCurrentGraphNode = null;
         fSelectedNodeList.clear();
@@ -700,7 +700,7 @@ public class SDWidget extends ScrollView implements SelectionListener,
             fOverView = new Image(getDisplay(), rect.width, rect.height);
             GC gcim = new GC(fOverView);
             NGC context = new NGC(this, gcim);
-            context.setBackground(SDViewPref.getInstance().getBackGroundColor(SDViewPref.PREF_FRAME));
+            context.setBackground(SDViewPref.getInstance().getBackGroundColor(ISDPreferences.PREF_FRAME));
             fFrame.draw(context);
             setContentsPos(backX, backY);
             gcim.dispose();
@@ -984,16 +984,16 @@ public class SDWidget extends ScrollView implements SelectionListener,
 
         // Set the metrics to use for lifeline text and message text
         // using the Graphical Context
-        Metrics.setLifelineFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_LIFELINE)));
-        Metrics.setLifelineFontWidth(context.getFontWidth(SDViewPref.getInstance().getFont(SDViewPref.PREF_LIFELINE)));
+        Metrics.setLifelineFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_LIFELINE)));
+        Metrics.setLifelineFontWidth(context.getFontWidth(SDViewPref.getInstance().getFont(ISDPreferences.PREF_LIFELINE)));
         Metrics.setLifelineWidth(SDViewPref.getInstance().getLifelineWidth());
         Metrics.setFrameFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_FRAME_NAME)));
         Metrics.setLifelineHeaderFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_LIFELINE_HEADER)));
 
-        int syncMessFontH = context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_SYNC_MESS));
-        int syncMessRetFontH = context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_SYNC_MESS_RET));
-        int asyncMessFontH = context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_ASYNC_MESS));
-        int asyncMessRetFontH = context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_ASYNC_MESS_RET));
+        int syncMessFontH = context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_SYNC_MESS));
+        int syncMessRetFontH = context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_SYNC_MESS_RET));
+        int asyncMessFontH = context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_ASYNC_MESS));
+        int asyncMessRetFontH = context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_ASYNC_MESS_RET));
 
         int messageFontHeight = 0;
         if (syncMessFontH > syncMessRetFontH) {
@@ -1008,7 +1008,7 @@ public class SDWidget extends ScrollView implements SelectionListener,
             messageFontHeight = asyncMessRetFontH;
         }
         Metrics.setMessageFontHeight(messageFontHeight);
-        context.setFont(SDViewPref.getInstance().getFont(SDViewPref.PREF_LIFELINE));
+        context.setFont(SDViewPref.getInstance().getFont(ISDPreferences.PREF_LIFELINE));
 
         int width = Math.round((fFrame.getWidth() + 2 * Metrics.FRAME_H_MARGIN) * fZoomValue);
         int height = Math.round((fFrame.getHeight() + 2 * Metrics.FRAME_V_MARGIN) * fZoomValue);
@@ -1144,7 +1144,7 @@ public class SDWidget extends ScrollView implements SelectionListener,
         fFrame.draw(context);
 
         fZoomValue = pageNumFontZoom;
-        context.setFont(SDViewPref.getInstance().getFont(SDViewPref.PREF_LIFELINE));
+        context.setFont(SDViewPref.getInstance().getFont(ISDPreferences.PREF_LIFELINE));
         String currentPageNum = String.valueOf(pageNum);
         int ii = context.textExtent(currentPageNum);
         int jj = context.getCurrentFontHeight();
@@ -1178,9 +1178,8 @@ public class SDWidget extends ScrollView implements SelectionListener,
             for (int i = 0; i < child.length; i++) {
                 if (child[i].isFocusControl()) {
                     return true;
-                } else {
-                    checkFocusOnChilds(child[i]);
                 }
+                checkFocusOnChilds(child[i]);
             }
         }
         return false;
@@ -1312,16 +1311,16 @@ public class SDWidget extends ScrollView implements SelectionListener,
 
         // Set the metrics to use for lifeline text and message text
         // using the Graphical Context
-        Metrics.setLifelineFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_LIFELINE)));
-        Metrics.setLifelineFontWidth(context.getFontWidth(SDViewPref.getInstance().getFont(SDViewPref.PREF_LIFELINE)));
+        Metrics.setLifelineFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_LIFELINE)));
+        Metrics.setLifelineFontWidth(context.getFontWidth(SDViewPref.getInstance().getFont(ISDPreferences.PREF_LIFELINE)));
         Metrics.setLifelineWidth(SDViewPref.getInstance().getLifelineWidth());
         Metrics.setFrameFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_FRAME_NAME)));
         Metrics.setLifelineHeaderFontHeight(context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_LIFELINE_HEADER)));
 
-        int syncMessFontH = context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_SYNC_MESS));
-        int syncMessRetFontH = context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_SYNC_MESS_RET));
-        int asyncMessFontH = context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_ASYNC_MESS));
-        int asyncMessRetFontH = context.getFontHeight(SDViewPref.getInstance().getFont(SDViewPref.PREF_ASYNC_MESS_RET));
+        int syncMessFontH = context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_SYNC_MESS));
+        int syncMessRetFontH = context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_SYNC_MESS_RET));
+        int asyncMessFontH = context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_ASYNC_MESS));
+        int asyncMessRetFontH = context.getFontHeight(SDViewPref.getInstance().getFont(ISDPreferences.PREF_ASYNC_MESS_RET));
 
         int messageFontHeight = 0;
         if (syncMessFontH > syncMessRetFontH) {
@@ -1336,7 +1335,7 @@ public class SDWidget extends ScrollView implements SelectionListener,
             messageFontHeight = asyncMessRetFontH;
         }
         Metrics.setMessageFontHeight(messageFontHeight);
-        context.setFont(SDViewPref.getInstance().getFont(SDViewPref.PREF_LIFELINE));
+        context.setFont(SDViewPref.getInstance().getFont(ISDPreferences.PREF_LIFELINE));
 
         int width = (int) ((fFrame.getWidth() + 2 * Metrics.FRAME_H_MARGIN) * fZoomValue);
         int height = (int) ((fFrame.getHeight() + 2 * Metrics.FRAME_V_MARGIN) * fZoomValue);
@@ -1352,7 +1351,7 @@ public class SDWidget extends ScrollView implements SelectionListener,
 
         fFrame.draw(context);
         if (fDragAndDrop != null) {
-            Lifeline node = (Lifeline) fDragAndDrop;
+            Lifeline node = fDragAndDrop;
             boolean isSelected = fDragAndDrop.isSelected();
             boolean hasFocus = fDragAndDrop.hasFocus();
             node.setSelected(false);
@@ -1505,9 +1504,8 @@ public class SDWidget extends ScrollView implements SelectionListener,
         for (int i = 0; i < child.length; i++) {
             if (child[i].isFocusControl()) {
                 return true;
-            } else {
-                checkFocusOnChilds(child[i]);
             }
+            checkFocusOnChilds(child[i]);
         }
         return false;
     }
@@ -1718,20 +1716,20 @@ public class SDWidget extends ScrollView implements SelectionListener,
                 int rx = Math.round(node.getX() * fZoomValue);
                 if (rx <= event.x && Math.round(rx + (node.getWidth() * fZoomValue)) >= event.x) {
                     if ((fCollapseProvider != null) && (fDragAndDrop != node)) {
-                        fCollapseProvider.collapseTwoLifelines((Lifeline) fDragAndDrop, node);
+                        fCollapseProvider.collapseTwoLifelines(fDragAndDrop, node);
                     }
                 } else if (rx < event.x) {
-                    fFrame.insertLifelineAfter((Lifeline) fDragAndDrop, node);
+                    fFrame.insertLifelineAfter(fDragAndDrop, node);
                     if (node.getIndex() < fFrame.lifeLinesCount()) {
-                        Lifeline temp[] = { (Lifeline) fDragAndDrop, fFrame.getLifeline(node.getIndex()) };
+                        Lifeline temp[] = { fDragAndDrop, fFrame.getLifeline(node.getIndex()) };
                         fReorderList.add(temp);
                     } else {
-                        Lifeline temp[] = { (Lifeline) fDragAndDrop, null };
+                        Lifeline temp[] = { fDragAndDrop, null };
                         fReorderList.add(temp);
                     }
                 } else {
-                    fFrame.insertLifelineBefore((Lifeline) fDragAndDrop, node);
-                    Lifeline temp[] = { (Lifeline) fDragAndDrop, node };
+                    fFrame.insertLifelineBefore(fDragAndDrop, node);
+                    Lifeline temp[] = { fDragAndDrop, node };
                     fReorderList.add(temp);
                 }
             }
@@ -1883,10 +1881,9 @@ public class SDWidget extends ScrollView implements SelectionListener,
             gc.fillRectangle(0, 0, getVisibleWidth(), getVisibleHeight());
             gc.dispose();
             return;
-        } else {
-//            Frame.setUserPref(SDViewPref.getInstance());
-            SDViewPref.getInstance();
         }
+        // Frame.setUserPref(SDViewPref.getInstance());
+        SDViewPref.getInstance();
 
         Rectangle area = getClientArea();
         Image dbuffer = getDrawBuffer();
@@ -2012,7 +2009,7 @@ public class SDWidget extends ScrollView implements SelectionListener,
             fOverView = new Image(getDisplay(), r.width, r.height);
             GC gcim = new GC(fOverView);
             NGC context = new NGC(this, gcim);
-            context.setBackground(SDViewPref.getInstance().getBackGroundColor(SDViewPref.PREF_FRAME));
+            context.setBackground(SDViewPref.getInstance().getBackGroundColor(ISDPreferences.PREF_FRAME));
             fFrame.draw(context);
             setContentsPos(backX, backY);
             gcim.dispose();
index 3c5c0e986c3bedfbc0c3b8433929343fba77370b..4e13af903d2f8a633e092476a810e7f7c0cbf7fe 100755 (executable)
@@ -85,7 +85,7 @@ public class SDWidgetSelectionProvider implements ISelectionProvider {
     public void setSelection(ISelection selection) {
         fCurrentSelection = selection;
         for (int i = 0; i < fListenerList.size(); i++) {
-            ISelectionChangedListener list = (ISelectionChangedListener) fListenerList.get(i);
+            ISelectionChangedListener list = fListenerList.get(i);
             list.selectionChanged(new SelectionChangedEvent(this, fCurrentSelection));
         }
     }
index c629dfd8805e65cf32f717af96cc04c61e9c4eb3..79763f1df0273884233fcdaad78e0861c743ca85 100755 (executable)
@@ -317,7 +317,7 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
         for (int i = firstVisible; i < fFrame.syncMessageCount(); i = i + messageArraysStep) {
             SyncMessage m = fFrame.getSyncMessage(i);
             if (m.hasTimeInfo()) {
-                SDTimeEvent t = new SDTimeEvent(m.getStartTime(), m.getEventOccurrence(), (ITimeRange) m);
+                SDTimeEvent t = new SDTimeEvent(m.getStartTime(), m.getEventOccurrence(), m);
                 fNodeList.add(t);
                 if (m.getY() * fZoomValue > getContentsY() + getVisibleHeight()) {
                     break;
@@ -332,7 +332,7 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
         for (int i = firstVisible; i < fFrame.syncMessageReturnCount(); i = i + messageArraysStep) {
             SyncMessage m = fFrame.getSyncMessageReturn(i);
             if (m.hasTimeInfo()) {
-                SDTimeEvent t = new SDTimeEvent(m.getStartTime(), m.getEventOccurrence(), (ITimeRange) m);
+                SDTimeEvent t = new SDTimeEvent(m.getStartTime(), m.getEventOccurrence(), m);
                 fNodeList.add(t);
                 if (m.getY() * fZoomValue > getContentsY() + getVisibleHeight()) {
                     break;
@@ -347,9 +347,9 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
         for (int i = firstVisible; i < fFrame.asyncMessageCount(); i = i + messageArraysStep) {
             AsyncMessage m = fFrame.getAsyncMessage(i);
             if (m.hasTimeInfo()) {
-                SDTimeEvent t = new SDTimeEvent(m.getStartTime(), m.getStartOccurrence(), (ITimeRange) m);
+                SDTimeEvent t = new SDTimeEvent(m.getStartTime(), m.getStartOccurrence(), m);
                 fNodeList.add(t);
-                t = new SDTimeEvent(m.getEndTime(), m.getEndOccurrence(), (ITimeRange) m);
+                t = new SDTimeEvent(m.getEndTime(), m.getEndOccurrence(), m);
                 fNodeList.add(t);
                 if (m.getY() * fZoomValue > getContentsY() + getVisibleHeight()) {
                     break;
@@ -364,9 +364,9 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
         for (int i = firstVisible; i < fFrame.asyncMessageReturnCount(); i = i + messageArraysStep) {
             AsyncMessageReturn m = fFrame.getAsyncMessageReturn(i);
             if (m.hasTimeInfo()) {
-                SDTimeEvent t = new SDTimeEvent(m.getStartTime(), m.getStartOccurrence(), (ITimeRange) m);
+                SDTimeEvent t = new SDTimeEvent(m.getStartTime(), m.getStartOccurrence(), m);
                 fNodeList.add(t);
-                t = new SDTimeEvent(m.getEndTime(), m.getEndOccurrence(), (ITimeRange) m);
+                t = new SDTimeEvent(m.getEndTime(), m.getEndOccurrence(), m);
                 fNodeList.add(t);
                 if (m.getY() * fZoomValue > getContentsY() + getVisibleHeight()) {
                     break;
@@ -392,8 +392,8 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
         }
         gcim = new GC(dbuffer);
         for (int i = 0; i < fNodeList.size() - 1; i++) {
-            SDTimeEvent m1 = (SDTimeEvent) fNodeList.get(i);
-            SDTimeEvent m2 = (SDTimeEvent) fNodeList.get(i + 1);
+            SDTimeEvent m1 = fNodeList.get(i);
+            SDTimeEvent m2 = fNodeList.get(i + 1);
 
             if ((SDViewPref.getInstance().excludeExternalTime()) && ((m1.getGraphNode() instanceof BaseMessage) && (m2.getGraphNode() instanceof BaseMessage))) {
                 BaseMessage mes1 = (BaseMessage) m1.getGraphNode();
@@ -493,9 +493,8 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
             for (int i = 0; i < child.length; i++) {
                 if (child[i].isFocusControl()) {
                     return true;
-                } else {
-                    checkFocusOnChilds(child[i]);
                 }
+                checkFocusOnChilds(child[i]);
             }
         }
         return false;
@@ -511,9 +510,8 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
         for (int i = 0; i < child.length; i++) {
             if (child[i].isFocusControl()) {
                 return true;
-            } else {
-                checkFocusOnChilds(child[i]);
             }
+            checkFocusOnChilds(child[i]);
         }
         return false;
     }
@@ -551,8 +549,8 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
         if (fFrame != null) {
             setFocus(0);
             for (int i = 0; i < fNodeList.size() - 1; i++) {
-                SDTimeEvent m1 = (SDTimeEvent) fNodeList.get(i);
-                SDTimeEvent m2 = (SDTimeEvent) fNodeList.get(i + 1);
+                SDTimeEvent m1 = fNodeList.get(i);
+                SDTimeEvent m2 = fNodeList.get(i + 1);
 
                 if ((SDViewPref.getInstance().excludeExternalTime()) && ((m1.getGraphNode() instanceof BaseMessage) && (m2.getGraphNode() instanceof BaseMessage))) {
                     BaseMessage mes1 = (BaseMessage) m1.getGraphNode();
@@ -719,7 +717,7 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
             colIndex = 0;
         }
         for (int j = 0; j < fListenerList.size(); j++) {
-            ITimeCompressionListener list = (ITimeCompressionListener) fListenerList.get(j);
+            ITimeCompressionListener list = fListenerList.get(j);
             if (localMes1.getEndLifeline() != null) {
                 list.deltaSelected(localMes1.getEndLifeline(), event1, event2 - event1, fColors[colIndex]);
             } else if (localMes2.getStartLifeline() != null) {
@@ -825,8 +823,8 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
         }
         if ((fFrame != null) && (fNextNodeY == 0)) {
             for (int i = 0; i < fNodeList.size() - 1 && i < 1; i++) {
-                SDTimeEvent m1 = (SDTimeEvent) fNodeList.get(i);
-                SDTimeEvent m2 = (SDTimeEvent) fNodeList.get(i + 1);
+                SDTimeEvent m1 = fNodeList.get(i);
+                SDTimeEvent m2 = fNodeList.get(i + 1);
                 if ((SDViewPref.getInstance().excludeExternalTime()) && ((m1.getGraphNode() instanceof BaseMessage) && (m2.getGraphNode() instanceof BaseMessage))) {
                     BaseMessage mes1 = (BaseMessage) m1.getGraphNode();
                     BaseMessage mes2 = (BaseMessage) m2.getGraphNode();
@@ -870,7 +868,7 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
 
         if (fLifeline != null) {
             for (int j = 0; j < fListenerList.size(); j++) {
-                ITimeCompressionListener list = (ITimeCompressionListener) fListenerList.get(j);
+                ITimeCompressionListener list = fListenerList.get(j);
                 list.deltaSelected(fLifeline, fLifelineStart, fLifelineNumEvents, fLifelineColor);
             }
         }
@@ -906,8 +904,8 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
         boolean done = false;
         if (fFrame != null) {
             for (int i = 0; i < fNodeList.size() - 1; i++) {
-                SDTimeEvent m1 = (SDTimeEvent) fNodeList.get(i);
-                SDTimeEvent m2 = (SDTimeEvent) fNodeList.get(i + 1);
+                SDTimeEvent m1 = fNodeList.get(i);
+                SDTimeEvent m2 = fNodeList.get(i + 1);
                 if ((SDViewPref.getInstance().excludeExternalTime()) && ((m1.getGraphNode() instanceof BaseMessage) && (m2.getGraphNode() instanceof BaseMessage))) {
                     BaseMessage mes1 = (BaseMessage) m1.getGraphNode();
                     BaseMessage mes2 = (BaseMessage) m2.getGraphNode();
@@ -1007,16 +1005,15 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
                         }
                     }
                     for (int j = 0; j < fListenerList.size(); j++) {
-                        ITimeCompressionListener list = (ITimeCompressionListener) fListenerList.get(j);
+                        ITimeCompressionListener list = fListenerList.get(j);
                         list.deltaSelected(fLifeline, fLifelineStart, fLifelineNumEvents, fLifelineColor);
                     }
                     break;
-                } else {
-                    lastM1 = m1;
-                    lastM2 = m2;
-                    lastY1 = m1Y;
-                    lastY2 = m2Y;
                 }
+                lastM1 = m1;
+                lastM2 = m2;
+                lastY1 = m1Y;
+                lastY2 = m2Y;
             }
         }
     }
@@ -1032,8 +1029,8 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
         if (fFrame != null) {
             setFocus(0);
             for (int i = 0; i < fNodeList.size() - 1; i++) {
-                SDTimeEvent m1 = (SDTimeEvent) fNodeList.get(i);
-                SDTimeEvent m2 = (SDTimeEvent) fNodeList.get(i + 1);
+                SDTimeEvent m1 = fNodeList.get(i);
+                SDTimeEvent m2 = fNodeList.get(i + 1);
 
                 if ((SDViewPref.getInstance().excludeExternalTime()) && ((m1.getGraphNode() instanceof BaseMessage) && (m2.getGraphNode() instanceof BaseMessage))) {
                     BaseMessage mes1 = (BaseMessage) m1.getGraphNode();
index 02feebb8733f13aa3aac4672e9898e8686f8975b..beaf711cc4688633e274241e2da529bd30c6ea3f 100755 (executable)
@@ -299,11 +299,11 @@ public class AsyncMessage extends BaseMessage implements ITimeRange {
         int messageMaxWidth = Metrics.swimmingLaneWidth() - Metrics.EXECUTION_OCCURRENCE_WIDTH;
         int nameWidth = getName().length() * Metrics.getAverageCharWidth();
         if (getName().length() * Metrics.getAverageCharWidth() > messageMaxWidth) {
-            if (Frame.contains(getX(), getY() - Metrics.MESSAGES_NAME_SPACING - Metrics.getMessageFontHeigth(), messageMaxWidth, Metrics.getMessageFontHeigth(), x, y)) {
+            if (GraphNode.contains(getX(), getY() - Metrics.MESSAGES_NAME_SPACING - Metrics.getMessageFontHeigth(), messageMaxWidth, Metrics.getMessageFontHeigth(), x, y)) {
                 return true;
             }
         } else {
-            if (Frame.contains(getX() + (messageMaxWidth - nameWidth) / 2, getY() + getHeight() / 2 - Metrics.MESSAGES_NAME_SPACING - Metrics.getMessageFontHeigth(), nameWidth, Metrics.getMessageFontHeigth(), x, y)) {
+            if (GraphNode.contains(getX() + (messageMaxWidth - nameWidth) / 2, getY() + getHeight() / 2 - Metrics.MESSAGES_NAME_SPACING - Metrics.getMessageFontHeigth(), nameWidth, Metrics.getMessageFontHeigth(), x, y)) {
                 return true;
             }
         }
index 7e91071a47c97d1b6a2996f82361fc5a7038327b..79745a643fb17b56f4fabe84faa8b50a004c6f2b 100755 (executable)
@@ -1,13 +1,13 @@
 /**********************************************************************
  * Copyright (c) 2005, 2008 IBM Corporation and others.
  * Copyright (c) 2011, 2012 Ericsson.
- * 
+ *
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * IBM - Initial API and implementation
  * Bernd Hufmann - Updated for TMF
  **********************************************************************/
@@ -26,13 +26,13 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
  * representations (like asynchronous syncMessages) will be responsible to define the missing second eventOccurrence
  * property.<br>
  * <br>
- * 
+ *
  * @see Lifeline Lifeline for more event occurence details
  * @version 1.0
  * @author sveyrier
  */
 public abstract class BaseMessage extends GraphNode {
-    
+
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
@@ -45,7 +45,7 @@ public abstract class BaseMessage extends GraphNode {
      */
     protected Lifeline fEndLifeline = null;
     /**
-     * The visiblitiy flag. 
+     * The visiblitiy flag.
      */
     protected boolean fVisible = true;
 
@@ -79,20 +79,19 @@ public abstract class BaseMessage extends GraphNode {
              */
             return fEndLifeline.getY() + fEndLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEndEventOccurrence;
 
-        } else {
-            /*
-             * UML2 lost message kind
-             */
-            if (fStartLifeline != null) {
-                return fStartLifeline.getY() + fStartLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEndEventOccurrence;
-            }
+        }
+        /*
+         * UML2 lost message kind
+         */
+        if (fStartLifeline != null) {
+            return fStartLifeline.getY() + fStartLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEndEventOccurrence;
+        }
 
-            /*
-             * UML2 found message kind
-             */
-            if (fEndLifeline != null) {
-                return fEndLifeline.getY() + fEndLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEndEventOccurrence;
-            }
+        /*
+         * UML2 found message kind
+         */
+        if (fEndLifeline != null) {
+            return fEndLifeline.getY() + fEndLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEndEventOccurrence;
         }
         // return 0 by default
         return 0;
@@ -127,7 +126,7 @@ public abstract class BaseMessage extends GraphNode {
      * <br>
      * This method is typically used to faster execute none graphical operation like tooltip lookup.<br>
      * <br>
-     * 
+     *
      * @param quick true to get an approximative value<br>
      *            false to get the exact x value<br>
      * @return the graph node x coordinate
@@ -172,7 +171,7 @@ public abstract class BaseMessage extends GraphNode {
      * <br>
      * This method is typically used to faster execute none graphical operation like tooltip lookup.<br>
      * <br>
-     * 
+     *
      * @param quick true to get an approximative value<br>
      *            false to get the exact x value
      * @return the graph node width
@@ -238,7 +237,7 @@ public abstract class BaseMessage extends GraphNode {
 
     /**
      * Sets the visibility value.
-     * 
+     *
      * @param value The visibility to set.
      */
     public void setVisible(boolean value) {
@@ -246,7 +245,7 @@ public abstract class BaseMessage extends GraphNode {
     }
 
     /**
-     * @return the visibility value. 
+     * @return the visibility value.
      */
     public boolean isVisible() {
         return fVisible;
@@ -254,7 +253,7 @@ public abstract class BaseMessage extends GraphNode {
 
     /**
      * Set the lifeline from which this message has been sent.
-     * 
+     *
      * @param lifeline - the message sender
      */
     public void setStartLifeline(Lifeline lifeline) {
@@ -263,7 +262,7 @@ public abstract class BaseMessage extends GraphNode {
 
     /**
      * Returns the lifeline from which this message has been sent.
-     * 
+     *
      * @return the message sender
      */
     public Lifeline getStartLifeline() {
@@ -272,7 +271,7 @@ public abstract class BaseMessage extends GraphNode {
 
     /**
      * Returns the lifeline which has received this message.
-     * 
+     *
      * @return the message receiver
      */
     public Lifeline getEndLifeline() {
@@ -281,7 +280,7 @@ public abstract class BaseMessage extends GraphNode {
 
     /**
      * Set the lifeline which has receive this message.
-     * 
+     *
      * @param lifeline the message receiver
      */
     public void setEndLifeline(Lifeline lifeline) {
@@ -290,7 +289,7 @@ public abstract class BaseMessage extends GraphNode {
 
     /**
      * Set the event occurrence when this message occurs.<br>
-     * 
+     *
      * @param occurrence the event occurrence to assign to this message.<br>
      * @see Lifeline Lifeline for more event occurence details
      */
@@ -300,7 +299,7 @@ public abstract class BaseMessage extends GraphNode {
 
     /**
      * Returns the event occurence when is message occurs.<br>
-     * 
+     *
      * @return the event occurrence assigned to this message.<br>
      * @see Lifeline Lifeline for more event occurence details
      */
@@ -313,7 +312,7 @@ public abstract class BaseMessage extends GraphNode {
      * WARNING: this method will return a valid result only for execution occurrences which are visible in the View.<br>
      * As consequence this method is only used for drawing purpose, especially to determine the exact message x
      * coordinate and width.<br>
-     * 
+     *
      * @see BaseMessage#getX(boolean)
      * @param event the event occurrence to test
      * @return true if occurs on a execution occurrence owned by the sending lifeine, false otherwise
@@ -345,7 +344,7 @@ public abstract class BaseMessage extends GraphNode {
      * WARNING: this method will return a valid result only for execution occurrences which are visible in the View.<br>
      * As consequence this method is only used for drawing purpose, especially to determine the exact message x
      * coordinate and width.<br>
-     * 
+     *
      * @see BaseMessage#getX(boolean)
      * @param event the event occurrence to test
      * @return true if occurs on a execution occurrence owned by the receiving lifeline, false otherwise
@@ -391,35 +390,35 @@ public abstract class BaseMessage extends GraphNode {
              * rectangle width is negative.
              */
             if (getName().length() * Metrics.getAverageCharWidth() > Metrics.swimmingLaneWidth() - Metrics.EXECUTION_OCCURRENCE_WIDTH / 2 + -Metrics.INTERNAL_MESSAGE_WIDTH) {
-                if (Frame.contains(x + Metrics.INTERNAL_MESSAGE_WIDTH + 10, y, Metrics.swimmingLaneWidth() - Metrics.EXECUTION_OCCURRENCE_WIDTH / 2 + -Metrics.INTERNAL_MESSAGE_WIDTH, Metrics.getMessageFontHeigth(), xValue, yValue)) {
+                if (GraphNode.contains(x + Metrics.INTERNAL_MESSAGE_WIDTH + 10, y, Metrics.swimmingLaneWidth() - Metrics.EXECUTION_OCCURRENCE_WIDTH / 2 + -Metrics.INTERNAL_MESSAGE_WIDTH, Metrics.getMessageFontHeigth(), xValue, yValue)) {
                     return true;
                 }
             } else {
-                if (Frame.contains(x + Metrics.INTERNAL_MESSAGE_WIDTH + 10, y, getName().length() * Metrics.getAverageCharWidth(), Metrics.getMessageFontHeigth(), xValue, yValue)) {
+                if (GraphNode.contains(x + Metrics.INTERNAL_MESSAGE_WIDTH + 10, y, getName().length() * Metrics.getAverageCharWidth(), Metrics.getMessageFontHeigth(), xValue, yValue)) {
                     return true;
                 }
             }
 
             // Test if the point is in part 1 of the self message
             // see: "private void drawMessage (NGC context)" method for self message drawing schema
-            if (Frame.contains(x, y - Metrics.MESSAGE_SELECTION_TOLERANCE / 2, Metrics.INTERNAL_MESSAGE_WIDTH / 2, Metrics.MESSAGE_SELECTION_TOLERANCE, xValue, yValue)) {
+            if (GraphNode.contains(x, y - Metrics.MESSAGE_SELECTION_TOLERANCE / 2, Metrics.INTERNAL_MESSAGE_WIDTH / 2, Metrics.MESSAGE_SELECTION_TOLERANCE, xValue, yValue)) {
                 return true;
             }
 
             // Test if the point is in part 3 of the self message
-            if (Frame.contains(x + Metrics.INTERNAL_MESSAGE_WIDTH - Metrics.MESSAGE_SELECTION_TOLERANCE / 2, y, Metrics.MESSAGE_SELECTION_TOLERANCE, height + Metrics.SYNC_INTERNAL_MESSAGE_HEIGHT, xValue, yValue)) {
+            if (GraphNode.contains(x + Metrics.INTERNAL_MESSAGE_WIDTH - Metrics.MESSAGE_SELECTION_TOLERANCE / 2, y, Metrics.MESSAGE_SELECTION_TOLERANCE, height + Metrics.SYNC_INTERNAL_MESSAGE_HEIGHT, xValue, yValue)) {
                 return true;
             }
 
             // Test if the point is in part 5 of the self message
-            if (Frame.contains(x, y + height - Metrics.MESSAGE_SELECTION_TOLERANCE / 2 + Metrics.SYNC_INTERNAL_MESSAGE_HEIGHT, Metrics.INTERNAL_MESSAGE_WIDTH / 2, Metrics.MESSAGE_SELECTION_TOLERANCE, xValue, yValue)) {
+            if (GraphNode.contains(x, y + height - Metrics.MESSAGE_SELECTION_TOLERANCE / 2 + Metrics.SYNC_INTERNAL_MESSAGE_HEIGHT, Metrics.INTERNAL_MESSAGE_WIDTH / 2, Metrics.MESSAGE_SELECTION_TOLERANCE, xValue, yValue)) {
                 return true;
             }
 
             // false otherwise
             return false;
         }
-        if (Frame.contains(x, y - tempHeight, width, tempHeight, xValue, yValue)) {
+        if (GraphNode.contains(x, y - tempHeight, width, tempHeight, xValue, yValue)) {
             return true;
         }
         // false otherwise
@@ -428,7 +427,7 @@ public abstract class BaseMessage extends GraphNode {
 
     /**
      * Method to draw the message using the graphical context.
-     * 
+     *
      * @param context A graphical context to draw in.
      */
     protected void drawMessage(IGC context) {
@@ -628,7 +627,7 @@ public abstract class BaseMessage extends GraphNode {
             }
         }
     }
-    
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNodee#draw(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC)
@@ -638,7 +637,7 @@ public abstract class BaseMessage extends GraphNode {
         if (!isVisible()) {
             return;
         }
-        
+
         // Draw it selected?*/
         if (isSelected()) {
             ISDPreferences pref = SDViewPref.getInstance();
@@ -670,10 +669,10 @@ public abstract class BaseMessage extends GraphNode {
     /**
      * Determine if two messages are identical. This default implementation considers that overlapping messages with
      * same coordinates are identical.
-     * 
+     *
      * @param message - the message to compare with
      * @return true if identical false otherwise
-     * 
+     *
      * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#isSameAs(org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode)
      */
     @Override
@@ -689,7 +688,7 @@ public abstract class BaseMessage extends GraphNode {
 
     /**
      * Method drawRot.
-     * 
+     *
      * @param x A x coordinate
      * @param y A y coordinate
      * @param w A width
index 87ad83cc4da22cca9d4d64855cccb6fad7957cad..55a4e243fbeff71a0e107d8c189b91b6defe8b16 100755 (executable)
@@ -1,13 +1,13 @@
 /**********************************************************************
  * Copyright (c) 2005, 2006 IBM Corporation and others.
  * Copyright (c) 2011, 2012 Ericsson.
- * 
+ *
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * IBM - Initial API and implementation
  * Bernd Hufmann - Updated for TMF
  **********************************************************************/
@@ -21,11 +21,11 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
 /**
  * BasicExecutionOccurrence is the UML2 execution occurrence graphical representation. It is attached to one Lifeline,
  * the event occurrence "duration" along the lifeline is defined by two event occurrences
- * 
+ *
  * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Lifeline Lifeline for more event occurence details
- * @version 1.0 
+ * @version 1.0
  * @author sveyrier
- * 
+ *
  */
 public class BasicExecutionOccurrence extends GraphNode {
 
@@ -42,7 +42,7 @@ public class BasicExecutionOccurrence extends GraphNode {
     // ------------------------------------------------------------------------
 
     /**
-     * The corresponding lifeline. 
+     * The corresponding lifeline.
      */
     protected Lifeline fLifeline = null;
 
@@ -119,7 +119,7 @@ public class BasicExecutionOccurrence extends GraphNode {
         int width = getWidth();
         int height = getHeight();
 
-        if (Frame.contains(x, y, width, height, xValue, yValue)) {
+        if (GraphNode.contains(x, y, width, height, xValue, yValue)) {
             return true;
         }
 
@@ -137,14 +137,13 @@ public class BasicExecutionOccurrence extends GraphNode {
     public String getName() {
         if (super.getName() == null || super.getName().equals("")) { //$NON-NLS-1$
             return fLifeline.getToolTipText();
-        } else {
-            return super.getName();
         }
+        return super.getName();
     }
 
     /**
      * Set the lifeline on which the execution occurrence appears.
-     * 
+     *
      * @param theLifeline - the parent lifeline
      */
     public void setLifeline(Lifeline theLifeline) {
@@ -153,7 +152,7 @@ public class BasicExecutionOccurrence extends GraphNode {
 
     /**
      * Get the lifeline on which the execution occurrence appears.
-     * 
+     *
      * @return - the parent lifeline
      */
     public Lifeline getLifeline() {
@@ -162,7 +161,7 @@ public class BasicExecutionOccurrence extends GraphNode {
 
     /**
      * Get the execution start event occurrence
-     * 
+     *
      * @return the start event occurrence to set
      */
     @Override
@@ -172,7 +171,7 @@ public class BasicExecutionOccurrence extends GraphNode {
 
     /**
      * Set the execution end event occurrence
-     * 
+     *
      * @return the end event occurrence to set
      */
     @Override
@@ -182,7 +181,7 @@ public class BasicExecutionOccurrence extends GraphNode {
 
     /**
      * Set the execution start event occurrence
-     * 
+     *
      * @param occurrence the start event occurrence to set
      */
     public void setStartOccurrence(int occurrence) {
@@ -191,7 +190,7 @@ public class BasicExecutionOccurrence extends GraphNode {
 
     /**
      * Set the execution end event occurrence
-     * 
+     *
      * @param occurrence the end event occurrence to set
      */
     public void setEndOccurrence(int occurrence) {
@@ -212,7 +211,7 @@ public class BasicExecutionOccurrence extends GraphNode {
         IColor tempStrokeColor = null;
 
         ISDPreferences pref = SDViewPref.getInstance();
-        
+
         // The execution occurrence is selected
         // if the owning lifeline is selected
         if (fLifeline.isSelected() || isSelected()) {
@@ -242,7 +241,7 @@ public class BasicExecutionOccurrence extends GraphNode {
 
     /**
      * Rewrite this method in your extension in order to support customized fill colors
-     * 
+     *
      * @param context
      * @return IColor
      */
@@ -261,7 +260,7 @@ public class BasicExecutionOccurrence extends GraphNode {
 
     /**
      * Rewrite this method in your extension in order to support customized stroke colors
-     * 
+     *
      * @param context
      * @return IColor
      */
index 3001373c0e0c55f7d1c3134d84ff5ad717d9eba1..47ba4d0d544bcd1c38397d0d598975ac80360e53 100755 (executable)
@@ -201,9 +201,8 @@ public class BasicFrame extends GraphNode {
     public int getWidth() {
         if (fHorizontalIndex == 0) {
             return 3 * Metrics.swimmingLaneWidth() + Metrics.LIFELINE_H_MAGIN * 2 - Metrics.FRAME_H_MARGIN - Metrics.LIFELINE_SPACING / 2;
-        } else {
-            return fHorizontalIndex * Metrics.swimmingLaneWidth() + Metrics.LIFELINE_H_MAGIN * 2 + 1 - Metrics.LIFELINE_SPACING;
         }
+        return fHorizontalIndex * Metrics.swimmingLaneWidth() + Metrics.LIFELINE_H_MAGIN * 2 + 1 - Metrics.LIFELINE_SPACING;
     }
 
     /*
@@ -243,7 +242,7 @@ public class BasicFrame extends GraphNode {
             return null;
         }
         for (int i = fromIndex; i < list.size(); i++) {
-            GraphNode node = (GraphNode) list.get(i);
+            GraphNode node = list.get(i);
             // only lifeline list is x ordered
             // Stop browsing the list if the node is outside the visible area
             // all others nodes will be not visible
@@ -467,7 +466,7 @@ public class BasicFrame extends GraphNode {
             return;
         }
         for (int i = 0; i < timeArray.size(); i++) {
-            SDTimeEvent m = (SDTimeEvent) timeArray.get(i);
+            SDTimeEvent m = timeArray.get(i);
 
             if (m.getTime().compareTo(fMaxSDTime, true) > 0) {
                 fMaxSDTime = m.getTime();
@@ -510,8 +509,8 @@ public class BasicFrame extends GraphNode {
             return;
         }
         for (int i = 0; i < timeArray.size() - 1; i++) {
-            SDTimeEvent m1 = (SDTimeEvent) timeArray.get(i);
-            SDTimeEvent m2 = (SDTimeEvent) timeArray.get(i + 1);
+            SDTimeEvent m1 = timeArray.get(i);
+            SDTimeEvent m2 = timeArray.get(i + 1);
 
             updateMinMax(m1, m2);
         }
@@ -557,15 +556,15 @@ public class BasicFrame extends GraphNode {
         List<SDTimeEvent> timeArray = new ArrayList<SDTimeEvent>();
         while (it.hasNext()) {
             String nodeType = it.next();
-            List<GraphNode> list = (List<GraphNode>) fNodes.get(nodeType);
+            List<GraphNode> list = fNodes.get(nodeType);
             for (int i = 0; i < list.size(); i++) {
                 Object timedNode = list.get(i);
                 if ((timedNode instanceof ITimeRange) && ((ITimeRange) timedNode).hasTimeInfo()) {
-                    int event = ((GraphNode) list.get(i)).getStartOccurrence();
+                    int event = list.get(i).getStartOccurrence();
                     ITmfTimestamp time = ((ITimeRange) list.get(i)).getStartTime();
                     SDTimeEvent f = new SDTimeEvent(time, event, (ITimeRange) list.get(i));
                     timeArray.add(f);
-                    if (event != ((GraphNode) list.get(i)).getEndOccurrence()) {
+                    if (event != list.get(i).getEndOccurrence()) {
                         event = ((AsyncMessage) list.get(i)).getEndOccurrence();
                         time = ((ITimeRange) list.get(i)).getEndTime();
                         f = new SDTimeEvent(time, event, (ITimeRange) list.get(i));
index d63f62359cfebe1aae41b0130ba3b5068bc7c1b3..1373c3af8db1a64859bc7753fbdc88975b8793f9 100755 (executable)
@@ -1,13 +1,13 @@
 /**********************************************************************
  * Copyright (c) 2005, 2006 IBM Corporation and others.
  * Copyright (c) 2011, 2012 Ericsson.
- * 
+ *
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * IBM - Initial API and implementation
  * Bernd Hufmann - Updated for TMF
  **********************************************************************/
@@ -23,11 +23,11 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
 /**
  * ExecutionOccurrence is the UML2 execution occurrence graphical representation. It is a BasicExecutionOccurrence on
  * which you can customize fill and/or.
- * 
+ *
  * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Lifeline Lifeline for more event occurence details
- * @version 1.0 
+ * @version 1.0
  * @author sveyrier
- * 
+ *
  */
 public class ExecutionOccurrence extends BasicExecutionOccurrence implements ITimeRange {
 
@@ -35,7 +35,7 @@ public class ExecutionOccurrence extends BasicExecutionOccurrence implements ITi
     // Attributes
     // ------------------------------------------------------------------------
     /**
-     * Set the red, green and blue value of the optional color to be used for filling the execution occurrence. 
+     * Set the red, green and blue value of the optional color to be used for filling the execution occurrence.
      */
     protected int[] fFillRGB;
     /**
@@ -51,7 +51,7 @@ public class ExecutionOccurrence extends BasicExecutionOccurrence implements ITi
      */
     protected IImage fEllipsesImage;
     /**
-     *  The start time stamp. 
+     *  The start time stamp.
      */
     protected ITmfTimestamp fStartTime;
     /**
@@ -59,7 +59,7 @@ public class ExecutionOccurrence extends BasicExecutionOccurrence implements ITi
      */
     protected ITmfTimestamp fEndTime;
     /**
-     * Flag to indicate whether time information is available or not. 
+     * Flag to indicate whether time information is available or not.
      */
     protected boolean fHasTimeInfo;
 
@@ -83,7 +83,7 @@ public class ExecutionOccurrence extends BasicExecutionOccurrence implements ITi
 
     /**
      * Set the red, green and blue value of the optional color to be used for filling the execution occurrence.
-     * 
+     *
      * @param red A value for red.
      * @param green A green value for green.
      * @param blue A value blue.
@@ -97,7 +97,7 @@ public class ExecutionOccurrence extends BasicExecutionOccurrence implements ITi
 
     /**
      * Set the red, green and blue value of the optional color to be used for drawing the execution occurrence
-     * 
+     *
      * @param red A value for red.
      * @param green A green value for green.
      * @param blue A value blue.
@@ -111,7 +111,7 @@ public class ExecutionOccurrence extends BasicExecutionOccurrence implements ITi
 
     /**
      * Set the corresponding image.
-     * 
+     *
      * @param image A image to set.
      */
     public void setImage(IImage image) {
@@ -120,7 +120,7 @@ public class ExecutionOccurrence extends BasicExecutionOccurrence implements ITi
 
     /**
      * Set the top ellipses image.
-     * 
+     *
      * @param image A image to set.
      */
     public void setTopEllipsesImage(IImage image) {
@@ -129,7 +129,7 @@ public class ExecutionOccurrence extends BasicExecutionOccurrence implements ITi
 
     /**
      * Set the time when the execution occurrence starts.
-     * 
+     *
      * @param time the time when the execution occurrence starts
      */
     public void setStartTime(ITmfTimestamp time) {
@@ -142,7 +142,7 @@ public class ExecutionOccurrence extends BasicExecutionOccurrence implements ITi
 
     /**
      * Set the time when the execution occurrence ends.
-     * 
+     *
      * @param time the time when the execution occurrence ends
      */
     public void setEndTime(ITmfTimestamp time) {
@@ -216,9 +216,8 @@ public class ExecutionOccurrence extends BasicExecutionOccurrence implements ITi
                 context.setBackground(tempFillColor);
             }
             return tempFillColor;
-        } else {
-            return super.setUnselectedFillColor(context);
         }
+        return super.setUnselectedFillColor(context);
     }
 
     /*
@@ -231,8 +230,7 @@ public class ExecutionOccurrence extends BasicExecutionOccurrence implements ITi
             IColor tempStrokeColor = context.createColor(fStrokeRGB[0], fStrokeRGB[1], fStrokeRGB[2]);
             context.setForeground(tempStrokeColor);
             return tempStrokeColor;
-        } else {
-            return super.setUnselectedStrokeColor(context);
         }
+        return super.setUnselectedStrokeColor(context);
     }
 }
index 2fbaa08468a6216b2b2418a52fac4bc04379296e..dbe4cdd09b8d185a4ab8ab4f191095a48a5bdd90 100755 (executable)
@@ -81,7 +81,7 @@ public class Frame extends BasicFrame {
         if (!fHasChilden) {
             return null;
         }
-        return (List<GraphNode>) fNodes.get(Lifeline.LIFELINE_TAG);
+        return fNodes.get(Lifeline.LIFELINE_TAG);
     }
 
     /**
@@ -120,7 +120,7 @@ public class Frame extends BasicFrame {
         if (!fHasChilden) {
             return null;
         }
-        return (List<GraphNode>) fNodes.get(SyncMessage.SYNC_MESS_TAG);
+        return fNodes.get(SyncMessage.SYNC_MESS_TAG);
     }
 
     /**
@@ -158,7 +158,7 @@ public class Frame extends BasicFrame {
         if (!fHasChilden) {
             return null;
         }
-        return (List<GraphNode>) fNodes.get(AsyncMessage.ASYNC_MESS_TAG);
+        return fNodes.get(AsyncMessage.ASYNC_MESS_TAG);
     }
 
     /**
@@ -196,7 +196,7 @@ public class Frame extends BasicFrame {
         if (!fHasChilden) {
             return null;
         }
-        return (List<GraphNode>) fNodes.get(SyncMessageReturn.SYNC_MESS_RET_TAG);
+        return fNodes.get(SyncMessageReturn.SYNC_MESS_RET_TAG);
     }
 
     /**
@@ -234,7 +234,7 @@ public class Frame extends BasicFrame {
         if (!fHasChilden) {
             return null;
         }
-        return (List<GraphNode>) fNodes.get(AsyncMessageReturn.ASYNC_MESS_RET_TAG);
+        return fNodes.get(AsyncMessageReturn.ASYNC_MESS_RET_TAG);
     }
 
     /**
@@ -294,7 +294,7 @@ public class Frame extends BasicFrame {
         if (!fHasChilden) {
             return 0;
         } else if (fIndexes.get(Lifeline.LIFELINE_TAG) != null) {
-            return ((Integer) fIndexes.get(Lifeline.LIFELINE_TAG)).intValue();
+            return fIndexes.get(Lifeline.LIFELINE_TAG).intValue();
         }
         return 0;
     }
@@ -308,7 +308,7 @@ public class Frame extends BasicFrame {
         if (!fHasChilden) {
             return 0;
         } else if (fIndexes.get(SyncMessage.SYNC_MESS_TAG) != null) {
-            return ((Integer) fIndexes.get(SyncMessage.SYNC_MESS_TAG)).intValue();
+            return fIndexes.get(SyncMessage.SYNC_MESS_TAG).intValue();
         }
         return 0;
     }
@@ -322,7 +322,7 @@ public class Frame extends BasicFrame {
         if (!fHasChilden) {
             return 0;
         } else if (fIndexes.get(SyncMessageReturn.SYNC_MESS_RET_TAG) != null) {
-            return ((Integer) fIndexes.get(SyncMessageReturn.SYNC_MESS_RET_TAG)).intValue();
+            return fIndexes.get(SyncMessageReturn.SYNC_MESS_RET_TAG).intValue();
         }
         return 0;
     }
@@ -336,7 +336,7 @@ public class Frame extends BasicFrame {
         if (!fHasChilden) {
             return 0;
         } else if (fIndexes.get(AsyncMessage.ASYNC_MESS_TAG) != null) {
-            return ((Integer) fIndexes.get(AsyncMessage.ASYNC_MESS_TAG)).intValue();
+            return fIndexes.get(AsyncMessage.ASYNC_MESS_TAG).intValue();
         }
         return 0;
     }
@@ -350,7 +350,7 @@ public class Frame extends BasicFrame {
         if (!fHasChilden) {
             return 0;
         } else if (fIndexes.get(AsyncMessageReturn.ASYNC_MESS_RET_TAG) != null) {
-            return ((Integer) fIndexes.get(AsyncMessageReturn.ASYNC_MESS_RET_TAG)).intValue();
+            return fIndexes.get(AsyncMessageReturn.ASYNC_MESS_RET_TAG).intValue();
         }
         return 0;
     }
@@ -529,8 +529,8 @@ public class Frame extends BasicFrame {
             return;
         }
         for (int i = 0; i < timeArray.size() - 1; i++) {
-            SDTimeEvent m1 = (SDTimeEvent) timeArray.get(i);
-            SDTimeEvent m2 = (SDTimeEvent) timeArray.get(i + 1);
+            SDTimeEvent m1 = timeArray.get(i);
+            SDTimeEvent m2 = timeArray.get(i + 1);
             if (SDViewPref.getInstance().excludeExternalTime() && ((m1.getGraphNode() instanceof BaseMessage) && (m2.getGraphNode() instanceof BaseMessage))) {
                 BaseMessage mes1 = (BaseMessage) m1.getGraphNode();
                 BaseMessage mes2 = (BaseMessage) m2.getGraphNode();
@@ -563,17 +563,17 @@ public class Frame extends BasicFrame {
             bounds[0] = null;
             bounds[1] = null;
             for (int i = 0; i < timeArray.size(); i++) {
-                SDTimeEvent m = (SDTimeEvent) timeArray.get(i);
+                SDTimeEvent m = timeArray.get(i);
                 if (m.getTime().compareTo(dateToFind, true) > 0) {
                     bounds[1] = m.getGraphNode();
                     if (i > 0) {
-                        bounds[0] = ((SDTimeEvent) timeArray.get(i - 1)).getGraphNode();
+                        bounds[0] = timeArray.get(i - 1).getGraphNode();
                         return true;
                     }
                     return false;
                 }
             }
-            bounds[0] = ((SDTimeEvent) timeArray.get(timeArray.size() - 1)).getGraphNode();
+            bounds[0] = timeArray.get(timeArray.size() - 1).getGraphNode();
         }
         return false;
     }
@@ -671,9 +671,9 @@ public class Frame extends BasicFrame {
         if (fIndexes.size() == 0) {
             return;
         }
-        int lifeLineDrawIndex = ((Integer) fIndexes.get(Lifeline.LIFELINE_TAG)).intValue();
-        for (int i = lifeLineDrawIndex; i < ((List<GraphNode>) fNodes.get(Lifeline.LIFELINE_TAG)).size(); i = i + lifelineArryStep) {
-            Lifeline toDraw = (Lifeline) ((List<GraphNode>) fNodes.get(Lifeline.LIFELINE_TAG)).get(i);
+        int lifeLineDrawIndex = fIndexes.get(Lifeline.LIFELINE_TAG).intValue();
+        for (int i = lifeLineDrawIndex; i < fNodes.get(Lifeline.LIFELINE_TAG).size(); i = i + lifelineArryStep) {
+            Lifeline toDraw = (Lifeline) fNodes.get(Lifeline.LIFELINE_TAG).get(i);
             if (toDraw.getX() - Metrics.LIFELINE_SPACING / 2 > context.getContentsX() + context.getVisibleWidth()) {
                 break;
             }
@@ -723,8 +723,8 @@ public class Frame extends BasicFrame {
         List<SDTimeEvent> timeArray = super.buildTimeArray();
         fExecutionOccurrencesWithTime = null;
         if (getLifelines() != null) {
-            for (int i = 0; i < ((List<GraphNode>) fNodes.get(Lifeline.LIFELINE_TAG)).size(); i++) {
-                Lifeline lifeline = (Lifeline) ((List<GraphNode>) fNodes.get(Lifeline.LIFELINE_TAG)).get(i);
+            for (int i = 0; i < fNodes.get(Lifeline.LIFELINE_TAG).size(); i++) {
+                Lifeline lifeline = (Lifeline) fNodes.get(Lifeline.LIFELINE_TAG).get(i);
                 if (lifeline.hasTimeInfo() && lifeline.getExecutions() != null) {
                     for (Iterator<GraphNode> j = lifeline.getExecutions().iterator(); j.hasNext();) {
                         GraphNode o = j.next();
@@ -782,7 +782,7 @@ public class Frame extends BasicFrame {
                 event = message.getEventOccurrence();
             }
             for (int i = 0; i < list.size(); i++) {
-                GraphNode node = (GraphNode) list.get(i);
+                GraphNode node = list.get(i);
                 if (node instanceof SyncMessage) {
                     SyncMessage syncNode = (SyncMessage) node;
                     if ((syncNode.getEventOccurrence() > event) && (syncNode.getStartLifeline() == lifeline) && !syncNode.isSameAs(message)) {
@@ -805,7 +805,7 @@ public class Frame extends BasicFrame {
                 }
             }
             for (int i = list.size() - 1; i >= 0; i--) {
-                GraphNode node = (GraphNode) list.get(i);
+                GraphNode node = list.get(i);
                 if (node instanceof SyncMessage) {
                     SyncMessage syncNode = (SyncMessage) node;
                     if ((syncNode.getEventOccurrence() < event) && (syncNode.getStartLifeline() == lifeline) && !syncNode.isSameAs(message)) {
@@ -842,7 +842,7 @@ public class Frame extends BasicFrame {
                 event = message.getEventOccurrence();
             }
             for (int i = 0; i < list.size(); i++) {
-                GraphNode node = (GraphNode) list.get(i);
+                GraphNode node = list.get(i);
                 if (node instanceof SyncMessage) {
                     SyncMessage syncNode = (SyncMessage) node;
                     if ((syncNode.getEventOccurrence() > event) && (syncNode.getEndLifeline() == lifeline) && !syncNode.isSameAs(message)) {
@@ -865,7 +865,7 @@ public class Frame extends BasicFrame {
                 }
             }
             for (int i = list.size() - 1; i >= 0; i--) {
-                GraphNode node = (GraphNode) list.get(i);
+                GraphNode node = list.get(i);
                 if (node instanceof SyncMessage) {
                     SyncMessage syncNode = (SyncMessage) node;
                     if ((syncNode.getEventOccurrence() < event) && (syncNode.getEndLifeline() == lifeline) && !syncNode.isSameAs(message)) {
@@ -917,9 +917,8 @@ public class Frame extends BasicFrame {
         if ((node1 != null) && (node2 != null)) {
             if (distanceFromEvent(node1, event) < distanceFromEvent(node2, event)) {
                 return node1;
-            } else {
-                return node2;
             }
+            return node2;
         } else if (node1 != null) {
             return node1;
         } else if (node2 != null) {
@@ -939,10 +938,10 @@ public class Frame extends BasicFrame {
         GraphNode result = null;
         Lifeline lifeline = null;
         if (startMessage != null) {
-            event = ((BaseMessage) startMessage).getEventOccurrence();
-            lifeline = ((BaseMessage) startMessage).getEndLifeline();
+            event = startMessage.getEventOccurrence();
+            lifeline = startMessage.getEndLifeline();
             if (lifeline == null) {
-                lifeline = ((BaseMessage) startMessage).getStartLifeline();
+                lifeline = startMessage.getStartLifeline();
             }
         }
         if (lifeline == null) {
@@ -969,10 +968,10 @@ public class Frame extends BasicFrame {
         GraphNode result = null;
         Lifeline lifeline = null;
         if (startMessage != null) {
-            event = ((BaseMessage) startMessage).getEventOccurrence();
-            lifeline = ((BaseMessage) startMessage).getStartLifeline();
+            event = startMessage.getEventOccurrence();
+            lifeline = startMessage.getStartLifeline();
             if (lifeline == null) {
-                lifeline = ((BaseMessage) startMessage).getEndLifeline();
+                lifeline = startMessage.getEndLifeline();
             }
         }
         if (lifeline == null) {
@@ -998,7 +997,7 @@ public class Frame extends BasicFrame {
     public GraphNode getNextLifelineMessage(Lifeline lifeline, BaseMessage startMessage) {
         int event = 0;
         if (startMessage != null) {
-            event = ((BaseMessage) startMessage).getEventOccurrence();
+            event = startMessage.getEventOccurrence();
         }
         if (lifeline == null) {
             return null;
index 1ee3911e18bdf978f86c0528f37f5d33843815b7..95ae7b3e7e73121acbb77fd3108f4783cf0a8373 100755 (executable)
@@ -141,15 +141,15 @@ public abstract class GraphNode {
             }
         }
 
-        List<GraphNode> fNodeList = (List<GraphNode>) fForwardNodes.get(nodeToAdd.getArrayId());
+        List<GraphNode> fNodeList = fForwardNodes.get(nodeToAdd.getArrayId());
         List<GraphNode> bNodeList = null;
         if (fBackwardNodes != null) {
-            bNodeList = (List<GraphNode>) fBackwardNodes.get(nodeToAdd.getArrayId());
+            bNodeList = fBackwardNodes.get(nodeToAdd.getArrayId());
         }
         if (fNodeList != null && fNodeList.size() > 0) {
             // check if the nodes are added y ordered
             // if not, tag the list to sort it later (during draw)
-            GraphNode node = (GraphNode) fNodeList.get(fNodeList.size() - 1);
+            GraphNode node = fNodeList.get(fNodeList.size() - 1);
             Comparator<GraphNode> fcomp = nodeToAdd.getComparator();
             Comparator<GraphNode> bcomp = nodeToAdd.getBackComparator();
             if ((fcomp != null) && (fcomp.compare(node, nodeToAdd) > 0)) {
@@ -376,8 +376,8 @@ public abstract class GraphNode {
         GraphNode node = null;
         while (it.hasNext()) {
             Object nodeType = it.next();
-            List<GraphNode> list = (List<GraphNode>) fNodes.get(nodeType);
-            int index = ((Integer) fIndexes.get(nodeType)).intValue();
+            List<GraphNode> list = fNodes.get(nodeType);
+            int index = fIndexes.get(nodeType).intValue();
             node = getNodeFromListAt(x, y, list, index);
             if (toReturn == null) {
                 toReturn = node;
@@ -430,12 +430,12 @@ public abstract class GraphNode {
         Iterator<String> it = fNodes.keySet().iterator();
         while (it.hasNext()) {
             Object nodeType = it.next();
-            List<GraphNode> nodesList = (List<GraphNode>) fNodes.get(nodeType);
+            List<GraphNode> nodesList = fNodes.get(nodeType);
             if (nodesList == null || nodesList.isEmpty()) {
                 return null;
             }
             for (int i = 0; i < nodesList.size(); i++) {
-                GraphNode node = (GraphNode) nodesList.get(i);
+                GraphNode node = nodesList.get(i);
                 int nw = node.getWidth();
                 int nh = node.getHeight();
                 int nx = node.getX();
@@ -469,7 +469,7 @@ public abstract class GraphNode {
             return null;
         }
         for (int i = fromIndex; i < list.size(); i++) {
-            GraphNode node = (GraphNode) list.get(i);
+            GraphNode node = list.get(i);
             if (node.contains(x, y)) {
                 return node;
             }
@@ -517,12 +517,12 @@ public abstract class GraphNode {
         while (it.hasNext()) {
             String nodeType = it.next();
             int direction = 1;
-            int drawIndex = ((Integer) fIndexes.get(nodeType)).intValue();
+            int drawIndex = fIndexes.get(nodeType).intValue();
             /*
              * if (x==0) { drawIndex = 0; indexes.put(nodeType,new Integer(drawIndex)); }
              */
-            if ((fNodes.get(nodeType) != null) && (((List<GraphNode>) fNodes.get(nodeType)).size() > 1)) {
-                if (((GraphNode) ((List<GraphNode>) fNodes.get(nodeType)).get(drawIndex)).positiveDistanceToPoint(x, y)) {
+            if ((fNodes.get(nodeType) != null) && (fNodes.get(nodeType).size() > 1)) {
+                if (fNodes.get(nodeType).get(drawIndex).positiveDistanceToPoint(x, y)) {
                     direction = -1;
                 }
 
@@ -531,24 +531,24 @@ public abstract class GraphNode {
                 }
 
                 if ((direction == -1) && (fBackwardNodes.get(nodeType) != null)) {
-                    GraphNode currentNode = (GraphNode) ((List<GraphNode>) fNodes.get(nodeType)).get(drawIndex);
-                    drawIndex = Arrays.binarySearch(((List<GraphNode>) fBackwardNodes.get(nodeType)).toArray(new GraphNode[((List<GraphNode>) fBackwardNodes.get(nodeType)).size()]),
-                            ((List<GraphNode>) fNodes.get(nodeType)).get(drawIndex), currentNode.getBackComparator());
-                    fNodes.put(nodeType, (List<GraphNode>) fBackwardNodes.get(nodeType));
+                    GraphNode currentNode = fNodes.get(nodeType).get(drawIndex);
+                    drawIndex = Arrays.binarySearch(fBackwardNodes.get(nodeType).toArray(new GraphNode[fBackwardNodes.get(nodeType).size()]),
+                            fNodes.get(nodeType).get(drawIndex), currentNode.getBackComparator());
+                    fNodes.put(nodeType, fBackwardNodes.get(nodeType));
                     if (drawIndex < 0) {
                         drawIndex = 0;
                         direction = 1;
                     } else {
-                        fNodes.put(nodeType, (List<GraphNode>) fBackwardNodes.get(nodeType));
+                        fNodes.put(nodeType, fBackwardNodes.get(nodeType));
                     }
                 }
                 GraphNode prev = null;
 
-                for (int i = drawIndex; i < ((List<GraphNode>) fNodes.get(nodeType)).size() && i >= 0; i = i + direction) {
+                for (int i = drawIndex; i < fNodes.get(nodeType).size() && i >= 0; i = i + direction) {
                     drawIndex = i;
                     fIndexes.put(nodeType, Integer.valueOf(i));
 
-                    GraphNode currentNode = (GraphNode) ((List<GraphNode>) fNodes.get(nodeType)).get(i);
+                    GraphNode currentNode = fNodes.get(nodeType).get(i);
 
                     if (prev == null) {
                         prev = currentNode;
@@ -562,15 +562,15 @@ public abstract class GraphNode {
                         sort = fBackwardSort;
                     }
 
-                    if (i < ((List<GraphNode>) fNodes.get(nodeType)).size() - 1) {
-                        GraphNode next = (GraphNode) ((List<GraphNode>) fNodes.get(nodeType)).get(i + 1);
+                    if (i < fNodes.get(nodeType).size() - 1) {
+                        GraphNode next = fNodes.get(nodeType).get(i + 1);
 
                         if ((comp != null) && (comp.compare(currentNode, next) > 0)) {
                             sort.put(nodeType, Boolean.TRUE);
                         }
                     }
                     if (direction == 1) {
-                        if (((GraphNode) ((List<GraphNode>) fNodes.get(nodeType)).get(i)).positiveDistanceToPoint(x, y)) {
+                        if (fNodes.get(nodeType).get(i).positiveDistanceToPoint(x, y)) {
                             break;
                         }
                     } else {
@@ -594,10 +594,10 @@ public abstract class GraphNode {
                 fNodes.put(nodeType, fForwardNodes.get(nodeType));
                 if ((fBackwardNodes.get(nodeType) != null) && (direction == -1)) {
                     // nodes.put(nodeType,fnodes.get(nodeType));
-                    int index = ((Integer) fIndexes.get(nodeType)).intValue();
-                    List<GraphNode> list = (List<GraphNode>) fNodes.get(nodeType);
-                    List<GraphNode> backList = (List<GraphNode>) fBackwardNodes.get(nodeType);
-                    GraphNode currentNode = (GraphNode) (backList.get(index));
+                    int index = fIndexes.get(nodeType).intValue();
+                    List<GraphNode> list = fNodes.get(nodeType);
+                    List<GraphNode> backList = fBackwardNodes.get(nodeType);
+                    GraphNode currentNode = (backList.get(index));
                     if (index > 0) {
                         index = Arrays.binarySearch(list.toArray(new GraphNode[list.size()]), backList.get(index), currentNode.getComparator());
                         if (index < 0) {
@@ -607,8 +607,8 @@ public abstract class GraphNode {
                     }
                 }
 
-                for (int i = drawIndex; i < ((List<GraphNode>) fNodes.get(nodeType)).size() && i >= 0; i++) {
-                    GraphNode toDraw = (GraphNode) ((List<GraphNode>) fNodes.get(nodeType)).get(i);
+                for (int i = drawIndex; i < fNodes.get(nodeType).size() && i >= 0; i++) {
+                    GraphNode toDraw = fNodes.get(nodeType).get(i);
                     toDraw.updateIndex(x, y, width, height);
                     if (!toDraw.isVisible(x, y, width, height)) {
                         break;
@@ -643,10 +643,10 @@ public abstract class GraphNode {
         Iterator<String> it = fForwardSort.keySet().iterator();
         while (it.hasNext()) {
             String nodeType = it.next();
-            boolean sort = ((Boolean) fForwardSort.get(nodeType)).booleanValue();
+            boolean sort = fForwardSort.get(nodeType).booleanValue();
             if (sort) {
-                GraphNode[] temp = ((List<GraphNode>) fForwardNodes.get(nodeType)).toArray(new GraphNode[((List<GraphNode>)fForwardNodes.get(nodeType)).size()]);
-                GraphNode node = (GraphNode) ((List<GraphNode>) fNodes.get(nodeType)).get(0);
+                GraphNode[] temp = fForwardNodes.get(nodeType).toArray(new GraphNode[fForwardNodes.get(nodeType).size()]);
+                GraphNode node = fNodes.get(nodeType).get(0);
                 Arrays.sort(temp, node.getComparator());
                 fForwardSort.put(nodeType, Boolean.FALSE);
                 fNodes.put(nodeType, Arrays.asList(temp));
@@ -660,10 +660,10 @@ public abstract class GraphNode {
         Iterator<String> it2 = fBackwardSort.keySet().iterator();
         while (it2.hasNext()) {
             String nodeType = it2.next();
-            boolean sort = ((Boolean) fBackwardSort.get(nodeType)).booleanValue();
+            boolean sort = fBackwardSort.get(nodeType).booleanValue();
             if (sort) {
-                GraphNode[] temp = ((List<GraphNode>) fBackwardNodes.get(nodeType)).toArray(new GraphNode[((List<GraphNode>) fBackwardNodes.get(nodeType)).size()]);
-                GraphNode node = (GraphNode) ((List<GraphNode>) fNodes.get(nodeType)).get(0);
+                GraphNode[] temp = fBackwardNodes.get(nodeType).toArray(new GraphNode[fBackwardNodes.get(nodeType).size()]);
+                GraphNode node = fNodes.get(nodeType).get(0);
                 Arrays.sort(temp, node.getBackComparator());
                 fBackwardSort.put(nodeType, Boolean.FALSE);
                 fBackwardNodes.put(nodeType, Arrays.asList(temp));
@@ -687,10 +687,10 @@ public abstract class GraphNode {
         while (it3.hasNext()) {
             count = 0;
             Object nodeType = it3.next();
-            GraphNode node = (GraphNode) ((List<GraphNode>) fNodes.get(nodeType)).get(0);
+            GraphNode node = fNodes.get(nodeType).get(0);
             context.setFont(SDViewPref.getInstance().getFont(node.fPrefId));
-            int index = ((Integer) fIndexes.get(nodeType)).intValue();
-            count = drawNodes(context, (List<GraphNode>) fNodes.get(nodeType), index, arrayStep);
+            int index = fIndexes.get(nodeType).intValue();
+            count = drawNodes(context, fNodes.get(nodeType), index, arrayStep);
             if (TmfUiTracer.isDisplayTraced()) {
                 TmfUiTracer.traceDisplay(count + " " + nodeType + " drawn, starting from index " + index + "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             }
@@ -721,13 +721,13 @@ public abstract class GraphNode {
             return 0;
         }
 
-        GraphNode node = (GraphNode) list.get(0);
+        GraphNode node = list.get(0);
         context.setFont(SDViewPref.getInstance().getFont(node.fPrefId));
         Comparator<GraphNode> comparator = node.getComparator();
         for (int i = startIndex; i < list.size(); i = i + step) {
-            GraphNode toDraw = (GraphNode) list.get(i);
+            GraphNode toDraw = list.get(i);
             if (i < list.size() - 1) {
-                GraphNode next = (GraphNode) list.get(i + 1);
+                GraphNode next = list.get(i + 1);
                 if ((comparator != null) && (comparator.compare(toDraw, next) > 0)) {
                     fForwardSort.put(next.getArrayId(), Boolean.TRUE);
                 }
index db099e50d3024cf5c99d180a4b77323b2fb39558..20a30043e19c386fd154e0f1204252e984809d69 100755 (executable)
@@ -1,13 +1,13 @@
 /**********************************************************************
  * Copyright (c) 2005, 2006 IBM Corporation and others.
  * Copyright (c) 2011, 2012 Ericsson.
- * 
+ *
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * IBM - Initial API and implementation
  * Bernd Hufmann - Updated for TMF
  **********************************************************************/
@@ -20,7 +20,7 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
 
 /**
  * Class to add a hot spot marker.
- * 
+ *
  * @version 1.0
  * @author sveyrier
  */
@@ -52,7 +52,7 @@ public class HotSpot extends GraphNode {
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
-    
+
     /**
      * Default constructor
      */
@@ -66,7 +66,7 @@ public class HotSpot extends GraphNode {
 
     /**
      * Set the marker image.
-     * 
+     *
      * @param img A image to set
      */
     public void setImage(IImage img) {
@@ -123,7 +123,7 @@ public class HotSpot extends GraphNode {
 
     /**
      * Set the lifeline on which the execution occurrence appears.
-     * 
+     *
      * @param occ the parent lifeline
      */
     public void setExecution(BasicExecutionOccurrence occ) {
@@ -133,7 +133,7 @@ public class HotSpot extends GraphNode {
 
     /**
      * Get the lifeline on which the execution occurrence appears.
-     * 
+     *
      * @return - the parent lifeline
      */
     public BasicExecutionOccurrence getExecOcc() {
@@ -141,8 +141,8 @@ public class HotSpot extends GraphNode {
     }
 
     /**
-     * Returns the occurrence number. 
-     * 
+     * Returns the occurrence number.
+     *
      * @return the occurrence number.
      */
     public int getOccurrence() {
@@ -151,7 +151,7 @@ public class HotSpot extends GraphNode {
 
     /**
      * Set the occurrence number.
-     * 
+     *
      * @param occ A number to set.
      */
     public void setOccurrence(int occ) {
@@ -208,7 +208,7 @@ public class HotSpot extends GraphNode {
         int width = getWidth();
         int height = getHeight();
 
-        if (Frame.contains(x, y, width, height, xValue, yValue)) {
+        if (GraphNode.contains(x, y, width, height, xValue, yValue)) {
             return true;
         }
         return false;
index 22c1f1aa82b4129039df43248a6becc70261fb76..7384e2165c06c220e3bd92290a61f2e619143181 100755 (executable)
@@ -1,13 +1,13 @@
 /**********************************************************************
  * Copyright (c) 2005, 2008 IBM Corporation and others.
  * Copyright (c) 2011, 2012 Ericsson.
- * 
+ *
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * IBM - Initial API and implementation
  * Bernd Hufmann - Updated for TMF
  **********************************************************************/
@@ -29,10 +29,10 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
  * Event occurrence define the drawing order of graph node along a lifeline. In this lifeline implementation, event
  * occurrences are just integer index. The event occurrences with the same value on different lifelines will correspond
  * the same y coordinate value.
- * 
+ *
  * @version 1.0
  * @author sveyrier
- * 
+ *
  */
 public class Lifeline extends GraphNode {
     // ------------------------------------------------------------------------
@@ -120,7 +120,7 @@ public class Lifeline extends GraphNode {
 
     /**
      * Set the lifeline category for this lifeline.
-     * 
+     *
      * @param arrayIndex the index of the category to use
      * @see Frame#setLifelineCategories(LifelineCategories[])
      */
@@ -131,7 +131,7 @@ public class Lifeline extends GraphNode {
     /**
      * Returns the tooltip text for the lifeline. It is the combination between the category name(if any) and the
      * lifeline name
-     * 
+     *
      * @return the tooltip text
      */
     public String getToolTipText() {
@@ -139,18 +139,15 @@ public class Lifeline extends GraphNode {
             LifelineCategories[] categories = fFrame.getLifelineCategories();
             if (fCategory < categories.length) {
                 return categories[fCategory].getName() + " " + getName(); //$NON-NLS-1$
-            } else {
-                return ""; //$NON-NLS-1$
             }
-        } else {
-            return ""; //$NON-NLS-1$
         }
+        return ""; //$NON-NLS-1$
     }
 
     /**
      * Returns the index of the first visible Execution Occurrence in the execution occurrence array.<br>
      * Execution Occurrences are Y ordered in this array
-     * 
+     *
      * @return the first visible Execution Occurrence
      */
     public int getExecOccurrenceDrawIndex() {
@@ -158,14 +155,14 @@ public class Lifeline extends GraphNode {
             return 0;
         }
         if (fIndexes.get(BasicExecutionOccurrence.EXEC_OCC_TAG) != null) {
-            return ((Integer) fIndexes.get(BasicExecutionOccurrence.EXEC_OCC_TAG)).intValue();
+            return fIndexes.get(BasicExecutionOccurrence.EXEC_OCC_TAG).intValue();
         }
         return 0;
     }
 
     /**
      * Set the frame on which this lifeline must be drawn
-     * 
+     *
      * @param parentFrame
      */
     protected void setFrame(Frame parentFrame) {
@@ -180,7 +177,7 @@ public class Lifeline extends GraphNode {
 
     /**
      * Returns the frame which this lifeline is drawn
-     * 
+     *
      * @return the Frame
      */
     protected Frame getFrame() {
@@ -189,7 +186,7 @@ public class Lifeline extends GraphNode {
 
     /**
      * Set the lifeline position index in the containing frame
-     * 
+     *
      * @param index the lifeline X position
      */
     protected void setIndex(int index) {
@@ -198,7 +195,7 @@ public class Lifeline extends GraphNode {
 
     /**
      * Returns the lifeline position in de the containing frame
-     * 
+     *
      * @return the X position
      */
     public int getIndex() {
@@ -210,7 +207,7 @@ public class Lifeline extends GraphNode {
      * greater event created on this lifeline are still valid and usable. This also need to inform the frame of the
      * operation mostly to store in the frame the greater event found in the diagram (used to determine the frame
      * height)
-     * 
+     *
      * @param eventOcc the new current event occurrence
      */
     public void setCurrentEventOccurrence(int eventOcc) {
@@ -222,7 +219,7 @@ public class Lifeline extends GraphNode {
 
     /**
      * Returns the last created event occurrence along the lifeline.
-     * 
+     *
      * @return the current event occurrence
      */
     public int getEventOccurrence() {
@@ -231,7 +228,7 @@ public class Lifeline extends GraphNode {
 
     /**
      * Creates a new event occurrence along the lifeline.
-     * 
+     *
      * @return the new created event occurrence
      */
     public int getNewEventOccurrence() {
@@ -242,7 +239,7 @@ public class Lifeline extends GraphNode {
     /**
      * Adds the execution occurrence given in parameter to the lifeline.<br>
      * A Execution occurrence is never drawn in the frame instead it is added to a lifeline
-     * 
+     *
      * @param exec the execution occurrence to add
      */
     public void addExecution(BasicExecutionOccurrence exec) {
@@ -266,7 +263,7 @@ public class Lifeline extends GraphNode {
 
     /**
      * Returns true if at least one execution occurrence has time info.
-     * 
+     *
      * @return true if at least one execution occurrence has time info
      */
     public boolean hasTimeInfo() {
@@ -275,12 +272,12 @@ public class Lifeline extends GraphNode {
 
     /**
      * Returns the list of execution occurrence on this lifeline.
-     * 
+     *
      * @return the execution occurrence list
      */
     public List<GraphNode> getExecutions() {
         if (fHasChilden) {
-            return (List<GraphNode>) fNodes.get(BasicExecutionOccurrence.EXEC_OCC_TAG);
+            return fNodes.get(BasicExecutionOccurrence.EXEC_OCC_TAG);
         }
         return new ArrayList<GraphNode>();
     }
@@ -299,10 +296,10 @@ public class Lifeline extends GraphNode {
         if (fFrame == null) {
             return false;
         }
-        if (Frame.contains(x, y, width, height, xValue, yValue)) {
+        if (GraphNode.contains(x, y, width, height, xValue, yValue)) {
             return true;
         }
-        if (Frame.contains(x + Metrics.getLifelineWidth() / 2 - Metrics.EXECUTION_OCCURRENCE_WIDTH / 2, y + height, Metrics.EXECUTION_OCCURRENCE_WIDTH, (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fFrame.getMaxEventOccurrence()
+        if (GraphNode.contains(x + Metrics.getLifelineWidth() / 2 - Metrics.EXECUTION_OCCURRENCE_WIDTH / 2, y + height, Metrics.EXECUTION_OCCURRENCE_WIDTH, (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fFrame.getMaxEventOccurrence()
                 + Metrics.LIFELINE_VB_MAGIN - 4, xValue, yValue)) {
             return true;
         }
@@ -312,11 +309,11 @@ public class Lifeline extends GraphNode {
 
         if (hMargin >= 2) {
             if (fFrame.getVisibleAreaY() < y - height - hMargin) {
-                if (Frame.contains(x - Metrics.LIFELINE_SPACING / 2 + 1, y - height - hMargin, Metrics.swimmingLaneWidth() - 2, height + 1, xValue, yValue)) {
+                if (GraphNode.contains(x - Metrics.LIFELINE_SPACING / 2 + 1, y - height - hMargin, Metrics.swimmingLaneWidth() - 2, height + 1, xValue, yValue)) {
                     return true;
                 }
             } else {
-                if (Frame.contains(x - Metrics.LIFELINE_SPACING / 2 + 1, fFrame.getVisibleAreaY(), Metrics.swimmingLaneWidth() - 2, height, xValue, yValue)) {
+                if (GraphNode.contains(x - Metrics.LIFELINE_SPACING / 2 + 1, fFrame.getVisibleAreaY(), Metrics.swimmingLaneWidth() - 2, height, xValue, yValue)) {
                     return true;
                 }
             }
@@ -329,7 +326,7 @@ public class Lifeline extends GraphNode {
 
     /**
      * Returns the lifeline visibility for the given visible area
-     * 
+     *
      * @param vx The x coordinate of the visible area
      * @param vy The y coordinate of the visible area
      * @param vwidth The width of the visible area
@@ -347,8 +344,8 @@ public class Lifeline extends GraphNode {
     }
 
     /**
-     * Draws the name within the graphical context. 
-     * 
+     * Draws the name within the graphical context.
+     *
      * @param context The graphical context.
      */
     protected void drawName(IGC context) {
@@ -380,15 +377,15 @@ public class Lifeline extends GraphNode {
 
     /**
      * Force the lifeline to be drawn at the given coordinate
-     * 
+     *
      * @param context - the context to draw into
      * @param x - the x coordinate
      * @param y - the y coordinate
      */
     public void draw(IGC context, int x, int y) {
-        
+
         ISDPreferences pref = SDViewPref.getInstance();
-        
+
         // Set the draw color depending if the lifeline must be selected or not
         context.setLineWidth(Metrics.NORMAL_LINE_WIDTH);
         if (isSelected()) {
@@ -474,7 +471,7 @@ public class Lifeline extends GraphNode {
 
     /**
      * Draws the select execution occurrence region using the given color
-     * 
+     *
      * @param context the graphical context
      * @param startEvent the region start
      * @param nbEvent the region height
@@ -515,8 +512,9 @@ public class Lifeline extends GraphNode {
      */
     @Override
     public boolean positiveDistanceToPoint(int x, int y) {
-        if (getX() > x - Metrics.swimmingLaneWidth())
+        if (getX() > x - Metrics.swimmingLaneWidth()) {
             return true;
+        }
         return false;
     }
 
@@ -538,7 +536,7 @@ public class Lifeline extends GraphNode {
             return null;
         }
         for (int i = getExecOccurrenceDrawIndex(); i < getExecutions().size(); i++) {
-            GraphNode node = (GraphNode) getExecutions().get(i);
+            GraphNode node = getExecutions().get(i);
             if (node.getHeight() < 0) {
                 if (node.getY() + node.getHeight() > vy + vh) {
                     break;
index 621851d80f2b504a562f7f67bb35a37d2f552283..a9ae4c181dc29906f27d41976457795e55e2fdd3 100755 (executable)
@@ -370,7 +370,7 @@ public class Criteria {
         StringBuffer ret = new StringBuffer();
         String prefix = "["; //$NON-NLS-1$
         for (Iterator<String> i = list.iterator(); i.hasNext();) {
-            String s = (String) i.next();
+            String s = i.next();
             ret.append(prefix);
             ret.append(s);
             prefix = " " + SDMessages._34 + " "; //$NON-NLS-1$ //$NON-NLS-2$
index e95a88aa3cd90754c94a9c534217780536c37983..0bbb26c86be35b572f23349ad475fdb99a73e49a 100755 (executable)
@@ -1,13 +1,13 @@
 /**********************************************************************
  * Copyright (c) 2005, 2008 IBM Corporation and others.
  * Copyright (c) 2011, 2012 Ericsson.
- * 
+ *
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * IBM - Initial API and implementation
  * Bernd Hufmann - Updated for TMF
  **********************************************************************/
@@ -20,10 +20,10 @@ import org.eclipse.jface.dialogs.DialogSettings;
 
 /**
  * A filter criteria is a criteria that can be activated or not, positive or not.
- * 
+ *
  * @version 1.0
  * @author sveyrier
- * 
+ *
  */
 public class FilterCriteria {
 
@@ -35,11 +35,11 @@ public class FilterCriteria {
      */
     protected static final String ACTIVE = "active"; //$NON-NLS-1$
     /**
-     * The property value for positive filter. 
+     * The property value for positive filter.
      */
     protected static final String POSITIVE = "positive"; //$NON-NLS-1$
     /**
-     * The filter loader class name property. 
+     * The filter loader class name property.
      */
     protected static final String LOADERCLASSNAME = "loaderClassName"; //$NON-NLS-1$
 
@@ -47,7 +47,7 @@ public class FilterCriteria {
     // Attributes
     // ------------------------------------------------------------------------
     /**
-     * The criteria reference.  
+     * The criteria reference.
      */
     protected Criteria fCriteria;
     /**
@@ -68,9 +68,9 @@ public class FilterCriteria {
     // ------------------------------------------------------------------------
     /**
      * Standard constructor
-     * 
+     *
      * @param criteria A criteria reference
-     * @param isActive <code>true</code> if filter criteria is active else <code>false</code> 
+     * @param isActive <code>true</code> if filter criteria is active else <code>false</code>
      * @param isPositive  <code>true</code> for positive filter else <code>false</code>
      */
     public FilterCriteria(Criteria criteria, boolean isActive, boolean isPositive) {
@@ -79,9 +79,9 @@ public class FilterCriteria {
 
     /**
      * Constructor
-     * 
+     *
      * @param criteria A criteria reference
-     * @param isActive <code>true</code> if filter criteria is active else <code>false</code> 
+     * @param isActive <code>true</code> if filter criteria is active else <code>false</code>
      * @param isPositive  <code>true</code> for positive filter else <code>false</code>
      * @param loaderClassName A loader class name
      */
@@ -140,7 +140,7 @@ public class FilterCriteria {
 
     /**
      * Returns the criteria reference.
-     * 
+     *
      * @return the criteria reference
      */
     public Criteria getCriteria() {
@@ -149,7 +149,7 @@ public class FilterCriteria {
 
     /**
      * Sets the active flag.
-     * 
+     *
      * @param isActive A active value.
      */
     public void setActive(boolean isActive) {
@@ -158,7 +158,7 @@ public class FilterCriteria {
 
     /**
      * Returns whether filter criteria is active or not.
-     * 
+     *
      * @return whether filter criteria is active or not.
      */
     public boolean isActive() {
@@ -167,7 +167,7 @@ public class FilterCriteria {
 
     /**
      * Sets filter is for positive filtering or not.
-     * 
+     *
      * @param isPositive The value to set.
      */
     public void setPositive(boolean isPositive) {
@@ -176,7 +176,7 @@ public class FilterCriteria {
 
     /**
      * Returns whether the filter si for positive filtering or not.
-     * 
+     *
      * @return Returns the positive.
      */
     public boolean isPositive() {
@@ -185,7 +185,7 @@ public class FilterCriteria {
 
     /**
      * Sets the loader class name for this filter.
-     * 
+     *
      * @param loaderClassName The loader class name to set
      */
     public void setLoaderClassName(String loaderClassName) {
@@ -194,7 +194,7 @@ public class FilterCriteria {
 
     /**
      * Returns the class loader name.
-     * 
+     *
      * @return the class loader name.
      */
     public String getLoaderClassName() {
@@ -203,7 +203,7 @@ public class FilterCriteria {
 
     /**
      * Finds a filter criteria within a  list of criteria.
-     * 
+     *
      * @param what The filter to find
      * @param list A list of filter criteria
      * @return The found filter criteria or null
@@ -212,7 +212,7 @@ public class FilterCriteria {
         if (what != null && list != null) {
             try {
                 for (Iterator<FilterCriteria> i = list.iterator(); i.hasNext();) {
-                    FilterCriteria fc = (FilterCriteria) i.next();
+                    FilterCriteria fc = i.next();
                     if (what.compareTo(fc)) {
                         return fc;
                     }
@@ -226,7 +226,7 @@ public class FilterCriteria {
 
     /**
      * Compares this filter criteria with a given criteria.
-     * 
+     *
      * @param to The filter criteria to compare.
      * @return usual comparison result (< 0, 0, > 0)
      */
@@ -244,7 +244,7 @@ public class FilterCriteria {
 
     /**
      * Saves current criteria attributes in the dialog settings.
-     *  
+     *
      * @param settings The dialog settings
      */
     public void save(DialogSettings settings) {
@@ -262,7 +262,7 @@ public class FilterCriteria {
 
     /**
      * Loads the criteria with values of the dialog settings.
-     * 
+     *
      * @param settings The dialog settings
      */
     public void load(DialogSettings settings) {
index 376a3ce6405b76f6305dad5a178a7edcb6049722..08bac589d63264950d189f16e9afb4b6852dd925 100755 (executable)
@@ -1,13 +1,13 @@
 /**********************************************************************
  * Copyright (c) 2005, 2008 IBM Corporation and others.
  * Copyright (c) 2011, 2012 Ericsson.
- * 
+ *
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * IBM - Initial API and implementation
  * Bernd Hufmann - Updated for TMF
  **********************************************************************/
@@ -39,7 +39,7 @@ import org.eclipse.ui.IViewPart;
 /**
  * This is the filters list dialog.<br>
  * It is associated to an SDView and to a ISDFilterProvider.<br>
- * 
+ *
  * @version 1.0
  * @author sveyrier
  */
@@ -96,7 +96,7 @@ public class FilterListDialog extends Dialog {
 
     /**
      * Standard constructor
-     * 
+     *
      * @param view The view reference
      * @param loader The filter provider implementation
      */
@@ -114,9 +114,9 @@ public class FilterListDialog extends Dialog {
     // ------------------------------------------------------------------------
     /**
      * Adds a criteria to the table
-     * 
+     *
      * @param criteria A criteria to add
-     * @param checked A flag whether criteria is checked (selected) or not 
+     * @param checked A flag whether criteria is checked (selected) or not
      * @param positive A flag whether criteria is for positive filter or not
      * @param loaderClassName A loader class name for the filters
      */
@@ -127,7 +127,7 @@ public class FilterListDialog extends Dialog {
 
     /**
      * Replaces a selected criteria with a new criteria.
-     * 
+     *
      * @param newCriteria A new criteria.
      */
     protected void replaceSelectedCriteria(Criteria newCriteria) {
@@ -195,7 +195,7 @@ public class FilterListDialog extends Dialog {
         });
         if (fFilters != null) {
             for (Iterator<FilterCriteria> i = fFilters.iterator(); i.hasNext();) {
-                FilterCriteria filterCriteria = (FilterCriteria) i.next();
+                FilterCriteria filterCriteria = i.next();
                 addCriteria(filterCriteria.getCriteria(), filterCriteria.isActive(), filterCriteria.isPositive(), filterCriteria.getLoaderClassName());
             }
         }
@@ -249,7 +249,7 @@ public class FilterListDialog extends Dialog {
             public void widgetDefaultSelected(SelectionEvent e) {
                 // Nothing to do
             }
-            
+
             /*
              * (non-Javadoc)
              * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
@@ -298,7 +298,7 @@ public class FilterListDialog extends Dialog {
 
     /**
      * Opens the filter dialog box with given parameter.
-     * 
+     *
      * @param criteria The criteria reference to pass
      * @param action to distinguish between "Update" and "Create"
      * @return the criteria that has been updated or created
@@ -354,7 +354,7 @@ public class FilterListDialog extends Dialog {
 
     /**
      * Sets the list of filters.
-     * 
+     *
      * @param filters The list of filters to set.
      */
     public void setFilters(List<FilterCriteria> filters) {
@@ -363,7 +363,7 @@ public class FilterListDialog extends Dialog {
 
     /**
      * Returns the filters list after editing.
-     * 
+     *
      * @return the filters list after editing
      */
     public List<FilterCriteria> getFilters() {
@@ -376,14 +376,14 @@ public class FilterListDialog extends Dialog {
     protected void loadFiltersCriteria() {
         List<FilterCriteria> globalFilters = getGlobalFilters();
         for (Iterator<FilterCriteria> i = globalFilters.iterator(); i.hasNext();) {
-            FilterCriteria filterCriteria = (FilterCriteria) i.next();
+            FilterCriteria filterCriteria = i.next();
             addCriteria(filterCriteria.getCriteria(), filterCriteria.isActive(), filterCriteria.isPositive(), filterCriteria.getLoaderClassName());
         }
     }
 
     /**
      * Returns the global filters which are saved in the dialog settings..
-     * 
+     *
      * @return the saved global filters
      */
     public static List<FilterCriteria> getGlobalFilters() {
@@ -416,7 +416,7 @@ public class FilterListDialog extends Dialog {
 
     /**
      * Saves the filter criteria in the dialog settings.
-     * 
+     *
      * @param globalFilters A list of filters to save.
      */
     public static void saveFiltersCriteria(List<FilterCriteria> globalFilters) {
@@ -436,11 +436,11 @@ public class FilterListDialog extends Dialog {
         FilterCriteria criteria;
 
         for (int j = 0; j < globalFilters.size(); j++) {
-            if (!(globalFilters.get(j) instanceof FilterCriteria)) {
+            if (globalFilters.get(j) == null) {
                 return;
             }
 
-            criteria = (FilterCriteria) globalFilters.get(j);
+            criteria = globalFilters.get(j);
             DialogSettings subSection = (DialogSettings) section.getSection(FILTERS_LIST_CRITERIA + j);
 
             if (subSection == null) {
@@ -449,7 +449,7 @@ public class FilterListDialog extends Dialog {
             criteria.save(subSection);
         }
     }
-    
+
     /**
      * Deactivates the saved global filters.
      */
@@ -490,9 +490,9 @@ public class FilterListDialog extends Dialog {
 
         /**
          * Constructor
-         * 
+         *
          * @param parent The parent table
-         * @param isActive <code>true</code> if filter criteria is active else <code>false</code> 
+         * @param isActive <code>true</code> if filter criteria is active else <code>false</code>
          * @param isPositive <code>true</code> for positive filter else <code>false</code>
          * @param loaderClassName The loader class name
          */
@@ -506,9 +506,9 @@ public class FilterListDialog extends Dialog {
 
         /**
          * Constructor
-         * 
+         *
          * @param parent The parent table
-         * @param isActive <code>true</code> if filter criteria is active else <code>false</code> 
+         * @param isActive <code>true</code> if filter criteria is active else <code>false</code>
          * @param isPositive <code>true</code> for positive filter else <code>false</code>
          * @param loaderClassName The loader class name
          * @param index The table item index
@@ -522,7 +522,7 @@ public class FilterListDialog extends Dialog {
 
         /**
          * Sets the criteria.
-         * 
+         *
          * @param criteria The criteria to set
          */
         public void setCriteria(Criteria criteria) {
@@ -540,7 +540,7 @@ public class FilterListDialog extends Dialog {
 
         /**
          * Returns whether positive filtering is active or not.
-         * 
+         *
          * @return <code>true</code> for positive filter else <code>false</code>
          */
         public boolean isPositive() {
@@ -549,7 +549,7 @@ public class FilterListDialog extends Dialog {
 
         /**
          * Returns the loader class name.
-         * 
+         *
          * @return the loader class name
          */
         public String getLoaderClassName() {
index 8eca2b14760a1226aa9f99391c7df0aafe5e168a..f0be212f6411844d0cc82630d4fa31052911de1f 100755 (executable)
@@ -255,7 +255,7 @@ public class SDPrintDialogUI {
             if (fSdView.getContentsHeight() > fSdView.getContentsHeight()) {
                 return (int) (fSdView.getVisibleHeight() / (float) fTest / fSdView.fZoomValue);
             }
-            return (int) (super.getContentsHeight());
+            return super.getContentsHeight();
         }
 
         /*
@@ -267,7 +267,7 @@ public class SDPrintDialogUI {
             if (fSdView.getVisibleWidth() > fSdView.getContentsWidth()) {
                 return (int) (fSdView.getVisibleWidth() / (float) fTest / fSdView.fZoomValue);
             }
-            return (int) (super.getContentsWidth());
+            return super.getContentsWidth();
         }
 
         /*
@@ -1139,20 +1139,20 @@ public class SDPrintDialogUI {
                 Printer printer = new Printer(fPrinterData);
                 if (fSetHPagesNumber.getSelection()) {
                     fNbPages = Integer.valueOf(fHorPagesNum.getText()).intValue();
-                    float z1 = (float) fSdView.getContentsWidth() / (cw);
+                    float z1 = fSdView.getContentsWidth() / cw;
                     float z2 = printer.getClientArea().width / ((float) fSdView.getContentsWidth() / fNbPages);
 
                     fStepY = printer.getClientArea().height / z1 / z2;
                     fStepX = cw / fNbPages;
                 } else if (fSetVPagesNumber.getSelection()) {
                     fNbPages = Integer.valueOf(fVertPagesNum.getText()).intValue();
-                    float z1 = (float) fSdView.getContentsHeight() / (ch);
+                    float z1 = fSdView.getContentsHeight() / ch;
                     float z2 = printer.getClientArea().height / ((float) fSdView.getContentsHeight() / fNbPages);
                     fStepX = printer.getClientArea().width / z1 / z2;
                     fStepY = ch / fNbPages;
                 } else {
                     float z1 = fSdView.getContentsWidth() / (cw);
-                    fStepX = ((float) fSdView.getVisibleWidth() / z1);
+                    fStepX = fSdView.getVisibleWidth() / z1;
                     fNbPages = Math.round(cw / fStepX);
                     if (fNbPages == 0) {
                         fNbPages = 1;
@@ -1160,7 +1160,7 @@ public class SDPrintDialogUI {
                     int pw = printer.getClientArea().width;
                     int ph = printer.getClientArea().height;
                     float z2 = pw / ((float) fSdView.getContentsWidth() / fNbPages);
-                    fStepY = ((float) ph / z1 / z2);
+                    fStepY = ph / z1 / z2;
                 }
             }
         } catch (NumberFormatException e) {
@@ -1235,7 +1235,7 @@ public class SDPrintDialogUI {
             if (fStepX != 0) {
                 row = (int) (cw / fStepX);
                 if (fSetHPagesNumber.getSelection()) {
-                    row = Math.round((float) cw / fStepX);
+                    row = Math.round(cw / fStepX);
                 } else if ((cw % fStepX != 0)) {
                     row++;
                 }
@@ -1257,7 +1257,7 @@ public class SDPrintDialogUI {
             if (fStepY != 0) {
                 line = (int) (ch / fStepY);
                 if (fSetVPagesNumber.getSelection()) {
-                    line = Math.round((float) ch / fStepY);
+                    line = Math.round(ch / fStepY);
                 } else if (ch % fStepY != 0) {
                     line++;
                 }
index 3c8d54e6d881bf724783c048ff8619dc115568f3..33bcaf760e06a7e0d78944b2cb69d6adf0364391 100755 (executable)
@@ -312,7 +312,7 @@ public class SearchFilterDialog extends Dialog {
             int size = Math.min(list.size(), MAX_EXPRESSION_LIST);
             String[] temp = new String[size];
             for (int i = 0; i < size; i++) {
-                temp[i] = (String) list.get(i);
+                temp[i] = list.get(i);
             }
             fExpressionList = temp;
             settings.put(EXPRESSION_LIST, fExpressionList);
index b132808834b6cc0150bddf675caf09c93e45dfd4..f1cbcbffd836d15f025585aab15cf1156576a9f1 100755 (executable)
@@ -1,13 +1,13 @@
 /**********************************************************************
  * Copyright (c) 2005, 2008 IBM Corporation and others.
  * Copyright (c) 2011, 2012 Ericsson.
- * 
+ *
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * IBM - Initial API and implementation
  * Bernd Hufmann - Updated for TMF
  **********************************************************************/
@@ -23,17 +23,17 @@ import org.eclipse.swt.graphics.Image;
 
 /**
  * Default implementation of the IImage interface.
- * 
+ *
  * @version 1.0
  * @author sveyrier
- * 
+ *
  */
 public class ImageImpl implements IImage {
 
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
-   
+
     /**
      * The image reference
      */
@@ -44,7 +44,7 @@ public class ImageImpl implements IImage {
     // ------------------------------------------------------------------------
     /**
      * Default constructor.
-     * 
+     *
      * @param file A file name of image file.
      */
     public ImageImpl(String file) {
@@ -53,7 +53,7 @@ public class ImageImpl implements IImage {
 
     /**
      * Copy constructor
-     * 
+     *
      * @param image THe image to copy
      */
     public ImageImpl(Image image) {
@@ -65,7 +65,7 @@ public class ImageImpl implements IImage {
     // ------------------------------------------------------------------------
     /**
      * Returns Image object from file name.
-     * 
+     *
      * @param name File name of image file
      * @return image object or <code>null</code>
      */
@@ -95,11 +95,11 @@ public class ImageImpl implements IImage {
 
     /**
      * Returns Image object from file name.
-     * 
+     *
      * @param name File name of image file
      * @return image object or <code>null</code>
      */
-    private Image createResourceImage(String name) {
+    private static Image createResourceImage(String name) {
         try {
             URL BASIC_URL = new URL("platform", "localhost", "plugin");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             URL url = new URL(BASIC_URL, "plugin/org.eclipse.linuxtools.tmf.ui/icons/" + name);//$NON-NLS-1$
index 3cb3bbfa79d667e209bcc6606c4e5156d5f71314..a0613c6d5d1b5856682d67f1d9e4da011c24cf5a 100755 (executable)
@@ -61,7 +61,7 @@ public class MoveSDUp extends Action {
         super();
         setId(ID);
         setActionDefinitionId(ID);
-        fView = ((SDView) view);
+        fView = view;
     }
 
     // ------------------------------------------------------------------------
@@ -76,7 +76,7 @@ public class MoveSDUp extends Action {
         if (fView == null) {
             return;
         }
-        SDWidget viewer = ((SDView) fView).getSDWidget();
+        SDWidget viewer = fView.getSDWidget();
 
         if (viewer != null) {
             viewer.scrollBy(0, -viewer.getVisibleHeight());
index 415cb44dfb9886ace40aebbc06e24ba8d9f9e65d..447a9c8bbe1348cc0d9748c0d69d20741c80765c 100755 (executable)
@@ -132,7 +132,7 @@ public class LoadersManager {
      * @param viewId the id of the view
      */
     public void resetLoader(String viewId) {
-        IUml2SDLoader loader = (IUml2SDLoader) fViewLoaderMap.get(viewId);
+        IUml2SDLoader loader = fViewLoaderMap.get(viewId);
         if (loader != null) {
             loader.dispose();
         }
@@ -168,7 +168,7 @@ public class LoadersManager {
         try {
             // Search the view corresponding to the viewId
             if (sdView == null) {
-                IViewReference viewref = (IViewReference) persp.findViewReference(viewId);
+                IViewReference viewref = persp.findViewReference(viewId);
                 if (viewref != null) {
                     sdView = (SDView) viewref.getView(false);
                 }
@@ -237,7 +237,7 @@ public class LoadersManager {
                 try {
                     // Search view corresponding to the viewId
                     SDView sdview = null;
-                    IViewReference viewref = (IViewReference) persp.findViewReference(id);
+                    IViewReference viewref = persp.findViewReference(id);
                     if (viewref != null) {
                         sdview = (SDView) viewref.getView(false);
                     }
@@ -293,7 +293,7 @@ public class LoadersManager {
      * @return List of extension point configuration elements.
      */
     private List<IConfigurationElement> getLoaderConfigurationElements(String viewId) {
-        List<IConfigurationElement> list = (List<IConfigurationElement>) fViewLoadersList.get(viewId);
+        List<IConfigurationElement> list = fViewLoadersList.get(viewId);
         if (list != null) {
             return list;
         }
@@ -329,11 +329,12 @@ public class LoadersManager {
      * @param loaderElements  The list of loader configuration elements
      * @return Extension point configuration element
      */
-    private IConfigurationElement getLoaderConfigurationElement(String loaderClassName, List<IConfigurationElement> loaderElements) {
+    private static IConfigurationElement getLoaderConfigurationElement(
+            String loaderClassName, List<IConfigurationElement> loaderElements) {
         if (loaderClassName != null && loaderClassName.length() > 0) {
             // Find configuration element corresponding to the saved loader
             for (Iterator<IConfigurationElement> i = loaderElements.iterator(); i.hasNext();) {
-                IConfigurationElement ce = (IConfigurationElement) i.next();
+                IConfigurationElement ce = i.next();
                 if (ce.getAttribute("class").equals(loaderClassName)) { //$NON-NLS-1$
                     return ce;
                 }
@@ -349,10 +350,11 @@ public class LoadersManager {
      * @param loaderElements The list of loader configuration elements
      * @return The default extension point configuration element.
      */
-    private IConfigurationElement getDefaultLoader(List<IConfigurationElement> loaderElements) {
+    private static IConfigurationElement getDefaultLoader(
+            List<IConfigurationElement> loaderElements) {
         // Look for a default loader
         for (Iterator<IConfigurationElement> i = loaderElements.iterator(); i.hasNext();) {
-            IConfigurationElement ce = (IConfigurationElement) i.next();
+            IConfigurationElement ce = i.next();
             if (Boolean.valueOf(ce.getAttribute("default")).booleanValue()) { //$NON-NLS-1$
                 return ce;
             }
index c78c6c59c6cf9caf22823e055c18bea6c0239129..d1aae15bc0c1d957f026e3b346994c9f3f6d5bba 100644 (file)
@@ -549,6 +549,8 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
             return Messages.TmfUml2SDSyncLoader_CategoryLifeline;
          case ISDGraphNodeSupporter.SYNCMESSAGE:
              return Messages.TmfUml2SDSyncLoader_CategoryMessage;
+        default:
+            break;
         }
         return ""; //$NON-NLS-1$
     }
@@ -621,11 +623,10 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
                 GraphNode current = fFindResults.get(fCurrentFindIndex);
                 fView.getSDWidget().moveTo(current);
                 return true;
-            } else {
-                fFindResults = null;
-                fCurrentFindIndex =0;
-                return findInNextPages(fFindCriteria); // search in other page
             }
+            fFindResults = null;
+            fCurrentFindIndex =0;
+            return findInNextPages(fFindCriteria); // search in other page
         } finally {
             fLock.unlock();
         }
@@ -1314,7 +1315,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
                 }
                 else {
                     // String was not found
-                    status = new Status(Status.WARNING, Activator.PLUGIN_ID, Messages.TmfUml2SDSyncLoader_SearchNotFound);
+                    status = new Status(IStatus.WARNING, Activator.PLUGIN_ID, Messages.TmfUml2SDSyncLoader_SearchNotFound);
                 }
                 setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
             }
index 83b79d41b72faf76ebf16dd500b462a96863ee0a..19ef55dbef1a8c6f80cd66df7db944750b5e07a7 100755 (executable)
@@ -246,7 +246,7 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
     @Override
     public IColor getForeGroundColor(String prefName) {
         if ((fForeColorPref.get(prefName + FORE_COLOR_POSTFIX) != null) && (fForeColorPref.get(prefName + FORE_COLOR_POSTFIX) instanceof ColorImpl)) {
-            return (IColor) fForeColorPref.get(prefName + FORE_COLOR_POSTFIX);
+            return fForeColorPref.get(prefName + FORE_COLOR_POSTFIX);
         }
         return ColorImpl.getSystemColor(SWT.COLOR_BLACK);
     }
@@ -258,7 +258,7 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
     @Override
     public IColor getBackGroundColor(String prefName) {
         if ((fBackColorPref.get(prefName + BACK_COLOR_POSTFIX) != null) && (fBackColorPref.get(prefName + BACK_COLOR_POSTFIX) instanceof ColorImpl)) {
-            return (IColor) fBackColorPref.get(prefName + BACK_COLOR_POSTFIX);
+            return fBackColorPref.get(prefName + BACK_COLOR_POSTFIX);
         }
         return ColorImpl.getSystemColor(SWT.COLOR_WHITE);
     }
@@ -270,7 +270,7 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
     @Override
     public IColor getFontColor(String prefName) {
         if ((fTextColorPref.get(prefName + TEXT_COLOR_POSTFIX) != null) && (fTextColorPref.get(prefName + TEXT_COLOR_POSTFIX) instanceof ColorImpl)) {
-            return (IColor) fTextColorPref.get(prefName + TEXT_COLOR_POSTFIX);
+            return fTextColorPref.get(prefName + TEXT_COLOR_POSTFIX);
         }
         return ColorImpl.getSystemColor(SWT.COLOR_BLACK);
     }
@@ -305,8 +305,8 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
      */
     @Override
     public IFont getFont(String prefName) {
-        if ((fFontPref.get(prefName) != null) && (fFontPref.get(prefName) instanceof IFont)) {
-            return (IFont) fFontPref.get(prefName);
+        if (fFontPref.get(prefName) != null) {
+            return fFontPref.get(prefName);
         }
         return FontImpl.getSystemFont();
     }
@@ -375,32 +375,32 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
 
         for (int i = 0; i < FONT_LIST.length; i++) {
             FontData fontData = PreferenceConverter.getFontData(fPrefStore, FONT_LIST[i]);
-            if ((fFontPref.get(FONT_LIST[i]) != null) && (fFontPref.get(FONT_LIST[i]) instanceof IFont)) {
-                ((IFont) fFontPref.get(FONT_LIST[i])).dispose();
+            if (fFontPref.get(FONT_LIST[i]) != null) {
+                fFontPref.get(FONT_LIST[i]).dispose();
             }
             fFontPref.put(FONT_LIST[i], new FontImpl(display, fontData));
         }
 
         for (int i = 0; i < PREF_BACK_COLOR_LIST.length; i++) {
             RGB rgb = PreferenceConverter.getColor(fPrefStore, PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX);
-            if ((fBackColorPref.get(PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX) != null) && (fBackColorPref.get(PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX) instanceof IColor)) {
-                ((IColor) fBackColorPref.get(PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX)).dispose();
+            if (fBackColorPref.get(PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX) != null) {
+                fBackColorPref.get(PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX).dispose();
             }
             fBackColorPref.put(PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX, new ColorImpl(display, rgb.red, rgb.green, rgb.blue));
         }
 
         for (int i = 0; i < PREF_FORE_COLOR_LIST.length; i++) {
             RGB rgb = PreferenceConverter.getColor(fPrefStore, PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX);
-            if ((fForeColorPref.get(PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX) != null) && (fForeColorPref.get(PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX) instanceof IColor)) {
-                ((IColor) fForeColorPref.get(PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX)).dispose();
+            if (fForeColorPref.get(PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX) != null) {
+                fForeColorPref.get(PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX).dispose();
             }
             fForeColorPref.put(PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX, new ColorImpl(display, rgb.red, rgb.green, rgb.blue));
         }
 
         for (int i = 0; i < PREF_TEXT_COLOR_LIST.length; i++) {
             RGB rgb = PreferenceConverter.getColor(fPrefStore, PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX);
-            if ((fTextColorPref.get(PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX) != null) && (fTextColorPref.get(PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX) instanceof IColor)) {
-                ((IColor) fTextColorPref.get(PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX)).dispose();
+            if (fTextColorPref.get(PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX) != null) {
+                fTextColorPref.get(PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX).dispose();
             }
             fTextColorPref.put(PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX, new ColorImpl(display, rgb.red, rgb.green, rgb.blue));
         }
index 8ab0833e1ff52bbfa075e24f003afd983e2bc02c..ad4a84188f4ba509b0602fda17e62de5177178aa 100755 (executable)
@@ -1,13 +1,13 @@
 /**********************************************************************
  * Copyright (c) 2005, 2008 IBM Corporation and others.
  * Copyright (c) 2011, 2012 Ericsson.
- * 
+ *
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * IBM - Initial API and implementation
  * Bernd Hufmann - Updated for TMF
  **********************************************************************/
@@ -37,7 +37,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
 
 /**
  * The Sequence Diagram preferences page implementation.
- * 
+ *
  * @version 1.0
  * @author sveyrier
  */
@@ -50,7 +50,7 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference
      * Temporary preferences tag
      */
     protected static final String TEMP_TAG = SDViewPref.TEMP_TAG;
-    
+
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
@@ -121,21 +121,21 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference
         page.setLayoutData(pageLayoutdata);
         page.setLayout(pageLayout);
 
-        fTooltip = new BooleanFieldEditor(SDViewPref.PREF_TOOLTIP, SDMessages._97, page);
+        fTooltip = new BooleanFieldEditor(ISDPreferences.PREF_TOOLTIP, SDMessages._97, page);
         fTooltip.setPreferenceStore(fPreferences.getPreferenceStore());
         fTooltip.load();
 
         // link font with zoom pref
-        fLink = new BooleanFieldEditor(SDViewPref.PREF_LINK_FONT, SDMessages._82, page);
+        fLink = new BooleanFieldEditor(ISDPreferences.PREF_LINK_FONT, SDMessages._82, page);
         fLink.setPreferenceStore(fPreferences.getPreferenceStore());
         fLink.load();
 
-        fNoExternalTime = new BooleanFieldEditor(SDViewPref.PREF_EXCLUDE_EXTERNAL_TIME, SDMessages._83, page);
+        fNoExternalTime = new BooleanFieldEditor(ISDPreferences.PREF_EXCLUDE_EXTERNAL_TIME, SDMessages._83, page);
         fNoExternalTime.setPreferenceStore(fPreferences.getPreferenceStore());
         fNoExternalTime.load();
 
         // use gradient color pref
-        fUseGrad = new BooleanFieldEditor(SDViewPref.PREF_USE_GRADIENT, SDMessages._84, page);
+        fUseGrad = new BooleanFieldEditor(ISDPreferences.PREF_USE_GRADIENT, SDMessages._84, page);
         fUseGrad.setPreferenceStore(fPreferences.getPreferenceStore());
         fUseGrad.load();
 
@@ -150,7 +150,7 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference
         prefPage.setLayout(prefPageLayout);
 
         // swimLane width pref
-        fLifelineWidth = new IntegerFieldEditor(SDViewPref.PREF_LIFELINE_WIDTH, SDMessages._80, prefPage);
+        fLifelineWidth = new IntegerFieldEditor(ISDPreferences.PREF_LIFELINE_WIDTH, SDMessages._80, prefPage);
         fLifelineWidth.setPreferenceStore(fPreferences.getPreferenceStore());
         fLifelineWidth.setValidRange(119, 500);
         fLifelineWidth.load();
@@ -246,7 +246,7 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference
         performApply();
         return true;
     }
-    
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
@@ -335,7 +335,7 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference
         fTextColor.store();
 
         String[] fontList = SDViewPref.getFontList();
-        
+
         // set the FontFieldEditor for the new selected graphNode font
         fFont.setPreferenceName(fontList[fClassItemList.getSelectionIndex()] + TEMP_TAG);
         fFont.load();
@@ -350,21 +350,21 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference
         fTextColor.load();
 
         // No Background for message graphNodes
-        if ((fontList[fClassItemList.getSelectionIndex()].equals(SDViewPref.PREF_SYNC_MESS)) || (fontList[fClassItemList.getSelectionIndex()].equals(SDViewPref.PREF_SYNC_MESS_RET))
-                || (fontList[fClassItemList.getSelectionIndex()].equals(SDViewPref.PREF_ASYNC_MESS)) || (fontList[fClassItemList.getSelectionIndex()].equals(SDViewPref.PREF_ASYNC_MESS_RET))) {
+        if ((fontList[fClassItemList.getSelectionIndex()].equals(ISDPreferences.PREF_SYNC_MESS)) || (fontList[fClassItemList.getSelectionIndex()].equals(ISDPreferences.PREF_SYNC_MESS_RET))
+                || (fontList[fClassItemList.getSelectionIndex()].equals(ISDPreferences.PREF_ASYNC_MESS)) || (fontList[fClassItemList.getSelectionIndex()].equals(ISDPreferences.PREF_ASYNC_MESS_RET))) {
             fBackGroundColor.setEnabled(false, fButtonArea);
         } else {
             fBackGroundColor.setEnabled(true, fButtonArea);
         }
 
         // No font used for execution occurrence and global frame
-        if ((fontList[fClassItemList.getSelectionIndex()].equals(SDViewPref.PREF_EXEC)) || (fontList[fClassItemList.getSelectionIndex()].equals(SDViewPref.PREF_FRAME))) {
+        if ((fontList[fClassItemList.getSelectionIndex()].equals(ISDPreferences.PREF_EXEC)) || (fontList[fClassItemList.getSelectionIndex()].equals(ISDPreferences.PREF_FRAME))) {
             fTextColor.setEnabled(false, fButtonArea);
         } else {
             fTextColor.setEnabled(true, fButtonArea);
         }
 
-        if (fontList[fClassItemList.getSelectionIndex()].equals(SDViewPref.PREF_FRAME)) {
+        if (fontList[fClassItemList.getSelectionIndex()].equals(ISDPreferences.PREF_FRAME)) {
             fFont.setEnabled(false, fButtonArea);
         } else {
             fFont.setEnabled(true, fButtonArea);
index 12e31d5b6850948b29ea975eaeec49c7bd2fdfc4..6dafc92f1a5158b95de1965134f0b6d53b2f6682 100755 (executable)
@@ -1,13 +1,13 @@
 /**********************************************************************
  * Copyright (c) 2005, 2006 IBM Corporation and others.
  * Copyright (c) 2011, 2012 Ericsson.
- * 
+ *
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * IBM - Initial API and implementation
  * Bernd Hufmann - Updated for TMF
  **********************************************************************/
@@ -20,19 +20,19 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.AsyncMessage;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
 
 /**
- * Asynchronous message comparator. 
- * 
+ * Asynchronous message comparator.
+ *
  * Compares two asyncMessages only taking into account the event occurrence when their
  * appear.<br>
- * 
+ *
  * Used to order the AsyncMessage list insuring that the previous node has both of his ends smaller than the current node
- * 
+ *
  * @version 1.0
  * @author sveyrier
- * 
+ *
  */
 public class SortAsyncForBackward implements Comparator<GraphNode>, Serializable {
-    
+
     // ------------------------------------------------------------------------
     // Constants
     // ------------------------------------------------------------------------
@@ -94,9 +94,8 @@ public class SortAsyncForBackward implements Comparator<GraphNode>, Serializable
             } else {
                 return -1;
             }
-        } else {
-            return 0;
         }
+        return 0;
     }
 
 }
index 3a52094c1978da5e8f19dc922e0c1b4d425f15cf..4b788c262e6cc69c0e98203bfd6f74cb0d0cac93 100755 (executable)
@@ -1,13 +1,13 @@
 /**********************************************************************
  * Copyright (c) 2005, 2006 IBM Corporation and others.
  * Copyright (c) 2011, 2012 Ericsson.
- * 
+ *
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  * IBM - Initial API and implementation
  * Bernd Hufmann - Updated for TMF
  **********************************************************************/
@@ -22,12 +22,12 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
 /**
  * Asynchronous message comparator Compare two AsyncMessages only taking into account the event occurrence when their
  * appear.<br>
- * 
+ *
  * Used to order the AsyncMessage list insuring that next node has one of his ends greater than the current node
- * 
+ *
  * @version 1.0
  * @author sveyrier
- * 
+ *
  */
 public class SortAsyncMessageComparator implements Comparator<GraphNode>, Serializable {
 
@@ -91,9 +91,8 @@ public class SortAsyncMessageComparator implements Comparator<GraphNode>, Serial
             } else {
                 return -1;
             }
-        } else {
-            return 0;
         }
+        return 0;
     }
 
 }
index 2747936308d70a14f686ef10fc8130bd6a00bb82..72f9aa72bd64d20d4ffe29068701dc1b8006985e 100755 (executable)
@@ -58,8 +58,7 @@ public class SortSyncMessageComparator implements Comparator<GraphNode>, Seriali
             } else {
                 return -1;
             }
-        } else {
-            return 0;
         }
+        return 0;
     }
 }
index 860531d201fd7ac2ff1b391d4fefcdaede21dfdd..e9e9ac4f97b3cb6a0dd000ca9fd072b5ad4515ec 100755 (executable)
@@ -45,8 +45,8 @@ public class TimeEventComparator implements Comparator<SDTimeEvent>, Serializabl
      */
     @Override
     public int compare(SDTimeEvent arg0, SDTimeEvent arg1) {
-        SDTimeEvent t1 = (SDTimeEvent) arg0;
-        SDTimeEvent t2 = (SDTimeEvent) arg1;
+        SDTimeEvent t1 = arg0;
+        SDTimeEvent t2 = arg1;
         if (t1.getEvent() > t2.getEvent()) {
             return 1;
         }
index e6ff77486d7a87a74282f69434837407ba1fbb91..2ee72aee175ca1c51b8bcac721eff04d63e0c099 100644 (file)
@@ -57,7 +57,7 @@ import org.eclipse.swt.widgets.Slider;
  * of visible lines in the StyledText control is set to fill the viewer display area.\r
  * An underlying data model is used to store a cache of event raw text line data.\r
  * The slider is ratio-based.\r
- * \r
+ *\r
  * @version 1.0\r
  * @author Patrick Tasse\r
  */\r
@@ -604,9 +604,8 @@ public class TmfRawEventViewer extends Composite implements ControlListener, Sel
        private int getPreviousCaretOffset(int time) {\r
            if (fStoredCaretPosition[0].time == time) {\r
                return fStoredCaretPosition[1].caretOffset;\r
-           } else {\r
-               return fStoredCaretPosition[0].caretOffset;\r
            }\r
+        return fStoredCaretPosition[0].caretOffset;\r
        }\r
 \r
        private void updateHighlightedRank() {\r
@@ -741,6 +740,8 @@ public class TmfRawEventViewer extends Composite implements ControlListener, Sel
                 }\r
                 break;\r
             }\r
+            default:\r
+                break;\r
         }\r
         //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));\r
         if (e.detail != SWT.NONE) {\r
@@ -917,6 +918,8 @@ public class TmfRawEventViewer extends Composite implements ControlListener, Sel
                 }\r
                 break;\r
             }\r
+            default:\r
+                break;\r
         }\r
         //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));\r
         updateHighlightedRank();\r
index 3cf854b64a6b62d4d33d5534c23f9ec585f19240..733d2800fa230e22428737f0d93c79add4a3b373 100644 (file)
@@ -128,27 +128,24 @@ public class TimeGraphCombo extends Composite {
         public Object[] getChildren(Object parentElement) {\r
             if (parentElement instanceof ITimeGraphEntry) {\r
                 return contentProvider.getChildren(parentElement);\r
-            } else {\r
-                return new Object[0];\r
             }\r
+            return new Object[0];\r
         }\r
 \r
         @Override\r
         public Object getParent(Object element) {\r
             if (element instanceof ITimeGraphEntry) {\r
                 return contentProvider.getParent(element);\r
-            } else {\r
-                return null;\r
             }\r
+            return null;\r
         }\r
 \r
         @Override\r
         public boolean hasChildren(Object element) {\r
             if (element instanceof ITimeGraphEntry) {\r
                 return contentProvider.hasChildren(element);\r
-            } else {\r
-                return false;\r
             }\r
+            return false;\r
         }\r
     }\r
 \r
@@ -177,9 +174,8 @@ public class TimeGraphCombo extends Composite {
         public boolean isLabelProperty(Object element, String property) {\r
             if (element instanceof ITimeGraphEntry) {\r
                 return labelProvider.isLabelProperty(element, property);\r
-            } else {\r
-                return false;\r
             }\r
+            return false;\r
         }\r
 \r
         @Override\r
@@ -191,18 +187,16 @@ public class TimeGraphCombo extends Composite {
         public Image getColumnImage(Object element, int columnIndex) {\r
             if (element instanceof ITimeGraphEntry) {\r
                 return labelProvider.getColumnImage(element, columnIndex);\r
-            } else {\r
-                return null;\r
             }\r
+            return null;\r
         }\r
 \r
         @Override\r
         public String getColumnText(Object element, int columnIndex) {\r
             if (element instanceof ITimeGraphEntry) {\r
                 return labelProvider.getColumnText(element, columnIndex);\r
-            } else {\r
-                return null;\r
             }\r
+            return null;\r
         }\r
 \r
     }\r
index b0f66740c07258f053facbc95563f40bef95fc8a..d8061804b2ff2bdcfe61dc9117d241a45dfaf0e0 100644 (file)
@@ -361,15 +361,14 @@ public class TimeGraphColorScheme {
                 return getColor(BACKGROUND_NAME_SEL_NOFOCUS);\r
             }\r
             return getColor(BACKGROUND_NAME);\r
-        } else {\r
-            if (selected && focused) {\r
-                return getColor(BACKGROUND_SEL);\r
-            }\r
-            if (selected) {\r
-                return getColor(BACKGROUND_SEL_NOFOCUS);\r
-            }\r
-            return getColor(BACKGROUND);\r
         }\r
+        if (selected && focused) {\r
+            return getColor(BACKGROUND_SEL);\r
+        }\r
+        if (selected) {\r
+            return getColor(BACKGROUND_SEL_NOFOCUS);\r
+        }\r
+        return getColor(BACKGROUND);\r
     }\r
 \r
     /**\r
index 4d57e765148f027710ea3bfef6d5c9a23b2e774a..dd11e43218fa2b7f19e727ae6d02fb30ba1bc321 100644 (file)
@@ -358,7 +358,7 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
         boolean changed = false;\r
         if (idx < 0) {\r
             for (idx = 0; idx < _data._expandedItems.length; idx++) {\r
-                if (((Item) _data._expandedItems[idx])._selected) {\r
+                if (_data._expandedItems[idx]._selected) {\r
                     break;\r
                 }\r
             }\r
@@ -577,17 +577,17 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
         boolean changed = false;\r
         int lastSelection = -1;\r
         for (int i = 0; i < _data._expandedItems.length; i++) {\r
-            Item item = (Item) _data._expandedItems[i];\r
+            Item item = _data._expandedItems[i];\r
             if (item._selected) {\r
                 lastSelection = i;\r
                 if ((1 == n) && (i < _data._expandedItems.length - 1)) {\r
                     item._selected = false;\r
-                    item = (Item) _data._expandedItems[i + 1];\r
+                    item = _data._expandedItems[i + 1];\r
                     item._selected = true;\r
                     changed = true;\r
                 } else if ((-1 == n) && (i > 0)) {\r
                     item._selected = false;\r
-                    item = (Item) _data._expandedItems[i - 1];\r
+                    item = _data._expandedItems[i - 1];\r
                     item._selected = true;\r
                     changed = true;\r
                 }\r
@@ -596,7 +596,7 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
         }\r
 \r
         if (lastSelection < 0 && _data._expandedItems.length > 0) {\r
-            Item item = (Item) _data._expandedItems[0];\r
+            Item item = _data._expandedItems[0];\r
             item._selected = true;\r
             changed = true;\r
         }\r
@@ -704,9 +704,9 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
         } // to allow getting out of single point interval\r
         long newInterval;\r
         if (zoomIn) {\r
-            newInterval = Math.max(Math.round((double) interval * 0.8), _timeProvider.getMinTimeInterval());\r
+            newInterval = Math.max(Math.round(interval * 0.8), _timeProvider.getMinTimeInterval());\r
         } else {\r
-            newInterval = (long) Math.ceil((double) interval * 1.25);\r
+            newInterval = (long) Math.ceil(interval * 1.25);\r
         }\r
         long center = time0 + Math.round(((double) (xPos - nameSpace) / timeSpace * interval));\r
         long newTime0 = center - Math.round((double) newInterval * (center - time0) / interval);\r
@@ -747,7 +747,7 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
 \r
         long m = _timeProvider.getMinTimeInterval();\r
         if ((time1 - time0) < m) {\r
-            time0 = selTime - (long) ((selTime - _time0) * m / _range);\r
+            time0 = selTime - (selTime - _time0) * m / _range;\r
             time1 = time0 + m;\r
         }\r
 \r
@@ -798,7 +798,7 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
     public int getSelectedIndex() {\r
         int idx = -1;\r
         for (int i = 0; i < _data._expandedItems.length; i++) {\r
-            Item item = (Item) _data._expandedItems[i];\r
+            Item item = _data._expandedItems[i];\r
             if (item._selected) {\r
                 idx = i;\r
                 break;\r
@@ -810,7 +810,7 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
     boolean toggle(int idx) {\r
         boolean toggled = false;\r
         if (idx >= 0 && idx < _data._expandedItems.length) {\r
-            Item item = (Item) _data._expandedItems[idx];\r
+            Item item = _data._expandedItems[idx];\r
             if (item._hasChildren) {\r
                 item._expanded = !item._expanded;\r
                 _data.updateExpandedItems();\r
@@ -853,9 +853,8 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
         int nameWidth = _timeProvider.getNameSpace();\r
         if (x > nameWidth - w && x < nameWidth + w) {\r
             return true;\r
-        } else {\r
-            return false;\r
         }\r
+        return false;\r
     }\r
 \r
     ITimeGraphEntry getEntry(Point pt) {\r
@@ -890,13 +889,13 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
         boolean changed = false;\r
         if (addSelection) {\r
             if (idx >= 0 && idx < _data._expandedItems.length) {\r
-                Item item = (Item) _data._expandedItems[idx];\r
+                Item item = _data._expandedItems[idx];\r
                 changed = (item._selected == false);\r
                 item._selected = true;\r
             }\r
         } else {\r
             for (int i = 0; i < _data._expandedItems.length; i++) {\r
-                Item item = (Item) _data._expandedItems[i];\r
+                Item item = _data._expandedItems[i];\r
                 if ((i == idx && !item._selected) || (idx == -1 && item._selected)) {\r
                     changed = true;\r
                 }\r
@@ -1049,7 +1048,7 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
         long time1 = _timeProvider.getTime1();\r
         long selectedTime = _timeProvider.getSelectedTime();\r
         double pixelsPerNanoSec = (bounds.width - nameSpace <= RIGHT_MARGIN) ? 0 : (double) (bounds.width - nameSpace - RIGHT_MARGIN) / (time1 - time0);\r
-        int x = bounds.x + nameSpace + (int) ((double) (selectedTime - time0) * pixelsPerNanoSec);\r
+        int x = bounds.x + nameSpace + (int) ((selectedTime - time0) * pixelsPerNanoSec);\r
         if (x >= nameSpace && x < bounds.x + bounds.width) {\r
             gc.setForeground(_colors.getColor(TimeGraphColorScheme.SELECTED_TIME));\r
             gc.drawLine(x, bounds.y, x, bounds.y + bounds.height);\r
@@ -1084,7 +1083,7 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
     public void drawItems(Rectangle bounds, ITimeDataProvider timeProvider,\r
             Item[] items, int topIndex, int nameSpace, GC gc) {\r
         for (int i = topIndex; i < items.length; i++) {\r
-            Item item = (Item) items[i];\r
+            Item item = items[i];\r
             drawItem(item, bounds, timeProvider, i, nameSpace, gc);\r
         }\r
         fTimeGraphProvider.postDrawControl(bounds, gc);\r
@@ -1911,7 +1910,7 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
             if (idx < 0 || idx >= _expandedItems.length) {\r
                 return;\r
             }\r
-            Item item = (Item) _expandedItems[idx];\r
+            Item item = _expandedItems[idx];\r
             if (item._hasChildren && !item._expanded) {\r
                 item._expanded = true;\r
                 updateExpandedItems();\r
index 9abc7d2ff2801f3d83e235085b8fef1efb9547d2..f25db8c5ef4bd06e6ac0e3fd5554d1538bb97bc8 100644 (file)
@@ -18,7 +18,6 @@ package org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets;
 import java.text.SimpleDateFormat;\r
 import java.util.Calendar;\r
 import java.util.Date;\r
-import java.util.GregorianCalendar;\r
 \r
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets.Utils.Resolution;\r
 import org.eclipse.swt.SWT;\r
@@ -69,7 +68,7 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
     private static final double LOG10_3 = Math.log10(3);\r
     private static final double LOG10_5 = Math.log10(5);\r
 \r
-    private static final Calendar GREGORIAN_CALENDAR = GregorianCalendar.getInstance();\r
+    private static final Calendar GREGORIAN_CALENDAR = Calendar.getInstance();\r
 \r
     private ITimeDataProvider _timeProvider;\r
     private int _dragState = 0;\r
@@ -109,7 +108,7 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
     }\r
 \r
     private void calcTimeDelta(int width, double pixelsPerNanoSec) {\r
-        double minDelta = (double) ((pixelsPerNanoSec == 0) ? YEAR_IN_NS : width / pixelsPerNanoSec);\r
+        double minDelta = (pixelsPerNanoSec == 0) ? YEAR_IN_NS : width / pixelsPerNanoSec;\r
         long unit = 1;\r
         if (_timeProvider != null && _timeProvider.isCalendarFormat()) {\r
             if (minDelta > 6 * MONTH_IN_NS) {\r
@@ -135,7 +134,7 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
                 return;\r
             }\r
         }\r
-        double log = Math.log10((double) minDelta / unit);\r
+        double log = Math.log10(minDelta / unit);\r
         long pow10 = (long) log;\r
         double remainder = log - pow10;\r
         if (remainder < LOG10_1) {\r
@@ -266,7 +265,7 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
         }\r
 \r
         // draw selected time\r
-        int x = _rect0.x + (int) ((double)(selectedTime - time0) * pixelsPerNanoSec);\r
+        int x = _rect0.x + (int) ((selectedTime - time0) * pixelsPerNanoSec);\r
         if (x >= _rect0.x && x < _rect0.x + _rect0.width) {\r
             gc.setForeground(_colors.getColor(TimeGraphColorScheme.SELECTED_TIME));\r
             gc.drawLine(x, _rect0.y + _rect0.height - 6, x, _rect0.y\r
@@ -620,7 +619,7 @@ class TimeDrawAbsYear extends TimeDraw {
 \r
     @Override\r
     public void draw(GC gc, long time, Rectangle rect) {\r
-        String stime = syearformat.format(new Date((long) (time / 1000000)));\r
+        String stime = syearformat.format(new Date(time / 1000000));\r
         Utils.drawText(gc, stime, rect, true);\r
     }\r
 \r
@@ -635,7 +634,7 @@ class TimeDrawAbsMonth extends TimeDraw {
 \r
     @Override\r
     public void draw(GC gc, long time, Rectangle rect) {\r
-        String stime = smonthformat.format(new Date((long) (time / 1000000)));\r
+        String stime = smonthformat.format(new Date(time / 1000000));\r
         Utils.drawText(gc, stime, rect, true);\r
     }\r
 \r
@@ -650,13 +649,13 @@ class TimeDrawAbsDay extends TimeDraw {
 \r
     @Override\r
     public void draw(GC gc, long time, Rectangle rect) {\r
-        String stime = sdayformat.format(new Date((long) (time / 1000000)));\r
+        String stime = sdayformat.format(new Date(time / 1000000));\r
         Utils.drawText(gc, stime, rect, true);\r
     }\r
 \r
     @Override\r
     public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
-        String header = sdayformatheader.format(new Date((long) (time / 1000000)));\r
+        String header = sdayformatheader.format(new Date(time / 1000000));\r
         int headerwidth = gc.stringExtent(header).x + 4;\r
         if (headerwidth <= rect.width) {\r
             rect.x += (rect.width - headerwidth);\r
@@ -675,13 +674,13 @@ class TimeDrawAbsHrs extends TimeDraw {
 \r
     @Override\r
     public void draw(GC gc, long time, Rectangle rect) {\r
-        String stime = shrsformat.format(new Date((long) (time / 1000000)));\r
+        String stime = shrsformat.format(new Date(time / 1000000));\r
         Utils.drawText(gc, stime, rect, true);\r
     }\r
 \r
     @Override\r
     public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
-        String header = shrsformatheader.format(new Date((long) (time / 1000000)));\r
+        String header = shrsformatheader.format(new Date(time / 1000000));\r
         int headerwidth = gc.stringExtent(header).x + 4;\r
         if (headerwidth <= rect.width) {\r
             rect.x += (rect.width - headerwidth);\r
@@ -700,13 +699,13 @@ class TimeDrawAbsMin extends TimeDraw {
 \r
     @Override\r
     public void draw(GC gc, long time, Rectangle rect) {\r
-        String stime = sminformat.format(new Date((long) (time / 1000000)));\r
+        String stime = sminformat.format(new Date(time / 1000000));\r
         Utils.drawText(gc, stime, rect, true);\r
     }\r
 \r
     @Override\r
     public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
-        String header = sminformatheader.format(new Date((long) (time / 1000000)));\r
+        String header = sminformatheader.format(new Date(time / 1000000));\r
         int headerwidth = gc.stringExtent(header).x + 4;\r
         if (headerwidth <= rect.width) {\r
             rect.x += (rect.width - headerwidth);\r
@@ -726,13 +725,13 @@ class TimeDrawAbsSec extends TimeDraw {
 \r
     @Override\r
     public void draw(GC gc, long time, Rectangle rect) {\r
-        String stime = stimeformat.format(new Date((long) (time / 1000000)));\r
+        String stime = stimeformat.format(new Date(time / 1000000));\r
         Utils.drawText(gc, stime, rect, true);\r
     }\r
 \r
     @Override\r
     public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
-        String header = stimeformatheader.format(new Date((long) (time / 1000000)));\r
+        String header = stimeformatheader.format(new Date(time / 1000000));\r
         int headerwidth = gc.stringExtent(header).x + 4;\r
         if (headerwidth <= rect.width) {\r
             rect.x += (rect.width - headerwidth);\r
@@ -751,7 +750,7 @@ class TimeDrawAbsMillisec extends TimeDraw {
 \r
     @Override\r
     public void draw(GC gc, long time, Rectangle rect) {\r
-        String stime = stimeformat.format(new Date((long) (time / 1000000)));\r
+        String stime = stimeformat.format(new Date(time / 1000000));\r
         String ns = Utils.formatNs(time, Resolution.MILLISEC);\r
 \r
         Utils.drawText(gc, stime + "." + ns, rect, true); //$NON-NLS-1$\r
@@ -759,7 +758,7 @@ class TimeDrawAbsMillisec extends TimeDraw {
 \r
     @Override\r
     public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
-        String header = stimeformatheader.format(new Date((long) (time / 1000000)));\r
+        String header = stimeformatheader.format(new Date(time / 1000000));\r
         int headerwidth = gc.stringExtent(header).x + 4;\r
         if (headerwidth <= rect.width) {\r
             rect.x += (rect.width - headerwidth);\r
@@ -778,14 +777,14 @@ class TimeDrawAbsMicroSec extends TimeDraw {
 \r
     @Override\r
     public void draw(GC gc, long time, Rectangle rect) {\r
-        String stime = stimeformat.format(new Date((long) (time / 1000000)));\r
+        String stime = stimeformat.format(new Date(time / 1000000));\r
         String micr = Utils.formatNs(time, Resolution.MICROSEC);\r
         Utils.drawText(gc, stime + "." + micr, rect, true); //$NON-NLS-1$\r
     }\r
 \r
     @Override\r
     public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
-        String header = stimeformatheader.format(new Date((long) (time / 1000000)));\r
+        String header = stimeformatheader.format(new Date(time / 1000000));\r
         int headerwidth = gc.stringExtent(header).x + 4;\r
         if (headerwidth <= rect.width) {\r
             rect.x += (rect.width - headerwidth);\r
@@ -804,14 +803,14 @@ class TimeDrawAbsNanoSec extends TimeDraw {
 \r
     @Override\r
     public void draw(GC gc, long time, Rectangle rect) {\r
-        String stime = stimeformat.format(new Date((long) (time / 1000000)));\r
+        String stime = stimeformat.format(new Date(time / 1000000));\r
         String ns = Utils.formatNs(time, Resolution.NANOSEC);\r
         Utils.drawText(gc, stime + "." + ns, rect, true); //$NON-NLS-1$\r
     }\r
 \r
     @Override\r
     public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
-        String header = stimeformatheader.format(new Date((long) (time / 1000000)));\r
+        String header = stimeformatheader.format(new Date(time / 1000000));\r
         int headerwidth = gc.stringExtent(header).x + 4;\r
         if (headerwidth <= rect.width) {\r
             rect.x += (rect.width - headerwidth);\r
index 0664b719566b2d9f75499c715059f465742f4457..97168988bb8f50b9aef0987cee7c3ac2ceb8806e 100644 (file)
@@ -160,7 +160,7 @@ public class TimeGraphTooltipHandler {
                     Map<String, String> eventAddOns = _utilImp.getEventHoverToolTipInfo(threadEvent);\r
                     if (eventAddOns != null) {\r
                         for (Iterator<String> iter = eventAddOns.keySet().iterator(); iter.hasNext();) {\r
-                            String message = (String) iter.next();\r
+                            String message = iter.next();\r
                             addItem(message, eventAddOns.get(message));\r
                         }\r
                     }\r
@@ -169,15 +169,13 @@ public class TimeGraphTooltipHandler {
                     long eventDuration = -1;\r
                     long eventEndTime = -1;\r
 \r
-                    if (threadEvent != null) {\r
-                        eventStartTime = threadEvent.getTime();\r
-                        eventDuration = threadEvent.getDuration();\r
-                        if (eventDuration < 0 && nextEvent != null) {\r
-                            eventEndTime = nextEvent.getTime();\r
-                            eventDuration = eventEndTime - eventStartTime;\r
-                        } else {\r
-                            eventEndTime = eventStartTime + eventDuration;\r
-                        }\r
+                    eventStartTime = threadEvent.getTime();\r
+                    eventDuration = threadEvent.getDuration();\r
+                    if (eventDuration < 0 && nextEvent != null) {\r
+                        eventEndTime = nextEvent.getTime();\r
+                        eventDuration = eventEndTime - eventStartTime;\r
+                    } else {\r
+                        eventEndTime = eventStartTime + eventDuration;\r
                     }\r
 \r
                     // TODO: Check if we need "format"\r
@@ -249,7 +247,7 @@ public class TimeGraphTooltipHandler {
         });\r
     }\r
 \r
-    private void setHoverLocation(Shell shell, Point position) {\r
+    private static void setHoverLocation(Shell shell, Point position) {\r
         Rectangle displayBounds = shell.getDisplay().getBounds();\r
         Rectangle shellBounds = shell.getBounds();\r
         shellBounds.x = Math.max(Math.min(position.x, displayBounds.width\r
index f4895ca77fbf50c03f8480876c132d2440999cab..7fb86d1a789ab28045c2a73139b98c85b6b94342 100644 (file)
@@ -422,9 +422,8 @@ public class Utils {
         Iterator<ITimeEvent> iterator = entry.getTimeEventsIterator();\r
         if (iterator != null && iterator.hasNext()) {\r
             return iterator.next();\r
-        } else {\r
-            return null;\r
         }\r
+        return null;\r
     }\r
 \r
     /**\r
@@ -450,7 +449,7 @@ public class Utils {
         ITimeEvent prevEvent = null;\r
 \r
         while (iterator.hasNext()) {\r
-            nextEvent = (ITimeEvent) iterator.next();\r
+            nextEvent = iterator.next();\r
             long nextStartTime = nextEvent.getTime();\r
 \r
             if (nextStartTime > time) {\r
@@ -466,15 +465,13 @@ public class Utils {
         if (n == -1) { //previous\r
             if (currEvent != null && currEvent.getTime() + currEvent.getDuration() >= time) {\r
                 return prevEvent;\r
-            } else {\r
-                return currEvent;\r
             }\r
+            return currEvent;\r
         } else if (n == 0) { //current\r
             if (currEvent != null && currEvent.getTime() + currEvent.getDuration() >= time) {\r
                 return currEvent;\r
-            } else {\r
-                return null;\r
             }\r
+            return null;\r
         } else if (n == 1) { //next\r
             return nextEvent;\r
         } else if (n == 2) { //current or previous when in empty space\r
@@ -540,7 +537,6 @@ public class Utils {
      *            expects.\r
      * @return The mangled string of types\r
      */\r
-    @SuppressWarnings("nls")\r
     static public String getTypeSignature(String type) {\r
         int dim = 0;\r
         for (int j = 0; j < type.length(); j++) {\r
@@ -557,27 +553,27 @@ public class Utils {
          {\r
             sig.append("[");                 //$NON-NLS-1$\r
         }\r
-        if (type.equals("boolean")) {\r
-            sig.append("Z");                 //$NON-NLS-1$\r
-        } else if (type.equals("byte")) {\r
-            sig.append("B");                 //$NON-NLS-1$\r
-        } else if (type.equals("char")) {\r
-            sig.append("C");                 //$NON-NLS-1$\r
-        } else if (type.equals("short")) {\r
-            sig.append("S");                 //$NON-NLS-1$\r
-        } else if (type.equals("int")) {\r
-            sig.append("I");                 //$NON-NLS-1$\r
-        } else if (type.equals("long")) {\r
-            sig.append("J");                 //$NON-NLS-1$\r
-        } else if (type.equals("float")) {\r
-            sig.append("F");                 //$NON-NLS-1$\r
-        } else if (type.equals("double")) {\r
-            sig.append("D");                 //$NON-NLS-1$\r
-        } else if (type.equals("void")) {\r
-            sig.append("V");                 //$NON-NLS-1$\r
+        if (type.equals("boolean")) { //$NON-NLS-1$\r
+            sig.append('Z');\r
+        } else if (type.equals("byte")) { //$NON-NLS-1$\r
+            sig.append('B');\r
+        } else if (type.equals("char")) { //$NON-NLS-1$\r
+            sig.append('C');\r
+        } else if (type.equals("short")) { //$NON-NLS-1$\r
+            sig.append('S');\r
+        } else if (type.equals("int")) { //$NON-NLS-1$\r
+            sig.append('I');\r
+        } else if (type.equals("long")) { //$NON-NLS-1$\r
+            sig.append('J');\r
+        } else if (type.equals("float")) { //$NON-NLS-1$\r
+            sig.append('F');\r
+        } else if (type.equals("double")) { //$NON-NLS-1$\r
+            sig.append('D');\r
+        } else if (type.equals("void")) { //$NON-NLS-1$\r
+            sig.append('V');\r
         }\r
         else {\r
-            sig.append("L").append(type.replace('.', '/')).append(";"); //$NON-NLS-1$ //$NON-NLS-2$\r
+            sig.append('L').append(type.replace('.', '/')).append(';');\r
         }\r
         return sig.toString();\r
     }\r
index 47b8caafcb1fb38ecafdb9289837e3aa1f519c7b..61ebda9fbb393dcefd506e9154038dd69b3572d7 100644 (file)
@@ -219,6 +219,8 @@ public class TmfVirtualTable extends Composite {
                 case SWT.MouseWheel:
                     shell.dispose ();
                     break;
+                default:
+                    break;
                 }
             }
         };
@@ -251,35 +253,36 @@ public class TmfVirtualTable extends Composite {
                                 }
                                 if (tooltipProvider == null) {
                                     return;
-                                } else {
-                                    String tooltipText = tooltipProvider.getTooltip(i, item.getData());
-                                    if (tooltipText == null) {
-                                        return;
-                                    }
-                                    tip = new Shell(fTable.getShell(), SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
-                                    tip.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-                                    FillLayout layout = new FillLayout();
-                                    layout.marginWidth = 2;
-                                    tip.setLayout(layout);
-                                    label = new Label(tip, SWT.WRAP);
-                                    label.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
-                                    label.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-                                    label.setData(TOOLTIP_DATA_KEY, item);
-                                    label.setText(tooltipText);
-
-                                    label.addListener(SWT.MouseExit, labelListener);
-                                    label.addListener(SWT.MouseDown, labelListener);
-                                    label.addListener(SWT.MouseWheel, labelListener);
-                                    Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-                                    Point pt = fTable.toDisplay(bounds.x, bounds.y);
-                                    tip.setBounds(pt.x, pt.y, size.x, size.y);
-                                    tip.setVisible(true);
                                 }
-                                break;
+                                String tooltipText = tooltipProvider.getTooltip(i, item.getData());
+                                if (tooltipText == null) {
+                                    return;
+                                }
+                                tip = new Shell(fTable.getShell(), SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
+                                tip.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+                                FillLayout layout = new FillLayout();
+                                layout.marginWidth = 2;
+                                tip.setLayout(layout);
+                                label = new Label(tip, SWT.WRAP);
+                                label.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
+                                label.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+                                label.setData(TOOLTIP_DATA_KEY, item);
+                                label.setText(tooltipText);
+
+                                label.addListener(SWT.MouseExit, labelListener);
+                                label.addListener(SWT.MouseDown, labelListener);
+                                label.addListener(SWT.MouseWheel, labelListener);
+                                Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+                                Point pt = fTable.toDisplay(bounds.x, bounds.y);
+                                tip.setBounds(pt.x, pt.y, size.x, size.y);
+                                tip.setVisible(true);
                             }
                         }
                     }
+                    break;
                 }
+                default:
+                    break;
                 }
             }
         };
@@ -580,6 +583,8 @@ public class TmfVirtualTable extends Composite {
                     refreshTable();
                     break;
                 }
+                default:
+                    break;
                 }
             }
         });
@@ -763,9 +768,8 @@ public class TmfVirtualTable extends Composite {
         int index = fTable.indexOf(ti);
         if (index < fFrozenRowCount) {
             return index;
-        } else {
-            return (index - fFrozenRowCount) + getTopIndex();
         }
+        return (index - fFrozenRowCount) + getTopIndex();
     }
 
     /**
@@ -935,9 +939,8 @@ public class TmfVirtualTable extends Composite {
         }
         if (index < fFrozenRowCount) {
             return index;
-        } else {
-            return (index - fFrozenRowCount) + getTopIndex();
         }
+        return (index - fFrozenRowCount) + getTopIndex();
     }
 
     /**
This page took 0.29023 seconds and 5 git commands to generate.