tmf: Switch tmf.ui to Java 7 + fix warnings
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 17 Dec 2013 23:08:56 +0000 (18:08 -0500)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 19 Dec 2013 01:03:34 +0000 (20:03 -0500)
Change-Id: I1fd5700aa5f37e6c279752374ab6c1bcf2633d20
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/19929
Tested-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com>

88 files changed:
org.eclipse.linuxtools.tmf.ui/.classpath
org.eclipse.linuxtools.tmf.ui/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/commands/ExportToTextJob.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEvent.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEventsTable.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtTrace.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/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/CustomTxtParserOutputWizardPage.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/parsers/wizards/CustomXmlParserOutputWizardPage.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/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/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageOperation.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageWizardPage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageHandler.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageSelectTraceWizardPage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageWizard.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageWizardPage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageWizardPage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExportOperation.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExtractManifestOperation.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageImportOperation.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfAnalysisElement.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentElement.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/TmfProjectModelElement.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfProjectRegistry.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/model/TmfTraceFolder.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceType.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TraceFolderContentProvider.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TraceUtils.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/project/wizards/importtrace/BatchImportTraceWizard.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceContentProvider.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardPageOptions.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardScanPage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardSelectTraceTypePage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/TraceTypeContentProvider.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventPropertySource.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsCache.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/viewers/statistics/model/TmfBaseColumnDataProvider.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeManager.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeNode.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackEntry.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackView.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/FunctionNameMapper.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsManager.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsXML.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/filter/FilterTreeContentProvider.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.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/TimeChartDecorationProvider.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/timegraph/AbstractTimeGraphView.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/BasicFrame.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/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/FilterListDialog.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/handlers/KeyBindingsManager.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/widgets/rawviewer/TmfRawEventViewer.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/tabsview/TmfViewerFolder.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/TimeGraphPresentationProvider.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphViewer.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/dialogs/TimeGraphFilterDialog.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeEvent.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeGraphEntry.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/TimeGraphSelection.java

index ad32c83a7885b8953a938b41df3b4fd4fe1aae01..098194ca4b7d8f45177f94e735506ae3a26b5c94 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="output" path="bin"/>
index c2490783bdbcd7f34f1208e15f191a98ec192f70..4681145948cba6ac1c8a94bda8f731e5e79a6e87 100644 (file)
@@ -6,9 +6,9 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
 org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
 org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -24,7 +24,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
 org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
 org.eclipse.jdt.core.compiler.problem.emptyStatement=error
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
 org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
 org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
 org.eclipse.jdt.core.compiler.problem.fieldHiding=error
@@ -75,7 +75,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
 org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
 org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
 org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
 org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
 org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
 org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
@@ -110,7 +110,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
 org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
 org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
index 0bd681838a56981279098e77bb76a101c895751a..f87297d72a0b154b0f4d7205262a70cef91e7e8f 100644 (file)
@@ -7,7 +7,7 @@ Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.tmf.ui;singleton:=true
 Bundle-Activator: org.eclipse.linuxtools.internal.tmf.ui.Activator
 Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Require-Bundle: org.eclipse.core.expressions,
  org.eclipse.core.resources,
  org.eclipse.core.runtime,
index 29c251d1d0c9464348da20fd51b09da05346ee7e..a3672a2a58b0c1b94c9e6f03d5c04a977ed5ca0c 100644 (file)
@@ -78,16 +78,7 @@ public class ExportToTextJob extends Job {
     }
 
     private IStatus saveImpl(IProgressMonitor monitor) {
-        final BufferedWriter bw;
-        try {
-            bw = new BufferedWriter(new FileWriter(destination));
-        } catch (IOException ex) {
-            Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID,
-                    MessageFormat.format(Messages.ExportToTextJob_Unable_to_export_trace, destination),
-                    ex);
-            return status;
-        }
-        try {
+        try (final BufferedWriter bw = new BufferedWriter(new FileWriter(destination));) {
             if (fHeader != null) {
                 bw.write(fHeader);
                 bw.append('\n');
@@ -98,11 +89,6 @@ public class ExportToTextJob extends Job {
                     MessageFormat.format(Messages.ExportToTextJob_Unable_to_export_trace, destination),
                     ex);
             return status;
-        } finally {
-            try {
-                bw.close();
-            } catch (IOException e) {
-            }
         }
     }
 
index 391395556eb2fae7108964991554d9d322a2ed3d..fcbc803f1764db2874716eca995438a939fa92b9 100644 (file)
@@ -70,7 +70,7 @@ public class CustomEvent extends TmfEvent {
      */
     public CustomEvent(CustomTraceDefinition definition) {
         fDefinition = definition;
-        fData = new HashMap<String, String>();
+        fData = new HashMap<>();
     }
 
     /**
@@ -84,7 +84,7 @@ public class CustomEvent extends TmfEvent {
     public CustomEvent(CustomTraceDefinition definition, TmfEvent other) {
         super(other);
         fDefinition = definition;
-        fData = new HashMap<String, String>();
+        fData = new HashMap<>();
 
         /* Set our overridden fields */
         customEventTimestamp = other.getTimestamp();
@@ -114,7 +114,7 @@ public class CustomEvent extends TmfEvent {
         /* Do not use upstream's fields for stuff we override */
         super(parentTrace, null, source, null, null, reference);
         fDefinition = definition;
-        fData = new HashMap<String, String>();
+        fData = new HashMap<>();
 
         /* Set our overridden fields */
         customEventTimestamp = timestamp;
index db36d21db605a815fd3856792d64ac9dbb8714a1..c9ecfa1acf94837a9dfd37e36d13b298870bf69d 100644 (file)
@@ -55,7 +55,7 @@ public class CustomEventsTable extends TmfEventsTable {
         if (fDefinition == null) {
             return;
         }
-        List<ColumnData> columnData = new LinkedList<ColumnData>();
+        List<ColumnData> columnData = new LinkedList<>();
         for (OutputColumn outputColumn : fDefinition.outputs) {
             ColumnData column = new ColumnData(outputColumn.name, 0, SWT.LEFT);
             columnData.add(column);
index 028844c6ad7d1560b73fdab418e20a9289a7f05f..b9b569eb8dc8ce3922680b3546b79bdf0186f2da 100644 (file)
@@ -236,7 +236,7 @@ public class CustomTxtTrace extends TmfTrace implements ITmfEventParser, ITmfPer
 
         CustomTxtEvent event = parseFirstLine(context);
 
-        final HashMap<InputLine, Integer> countMap = new HashMap<InputLine, Integer>();
+        final HashMap<InputLine, Integer> countMap = new HashMap<>();
         InputLine currentInput = null;
         if (context.inputLine.childrenInputs != null && context.inputLine.childrenInputs.size() > 0) {
             currentInput = context.inputLine.childrenInputs.get(0);
index 1216812fae6aaf44b4bc6ee95e37ffab2474980f..7decee4ecbd730457ea7d1a1582ca17b83e7e468 100644 (file)
@@ -191,7 +191,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
          */
         public void addChild(InputLine input) {
             if (childrenInputs == null) {
-                childrenInputs = new ArrayList<InputLine>(1);
+                childrenInputs = new ArrayList<>(1);
             } else if (childrenInputs.size() > 0) {
                 InputLine last = childrenInputs.get(childrenInputs.size() - 1);
                 last.nextInput = input;
@@ -255,7 +255,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
          */
         public void addColumn(InputData column) {
             if (columns == null) {
-                columns = new ArrayList<InputData>(1);
+                columns = new ArrayList<>(1);
             }
             columns.add(column);
         }
@@ -268,7 +268,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
          * @return The next list of lines.
          */
         public List<InputLine> getNextInputs(Map<InputLine, Integer> countMap) {
-            List<InputLine> nextInputs = new ArrayList<InputLine>();
+            List<InputLine> nextInputs = new ArrayList<>();
             InputLine next = nextInput;
             while (next != null) {
                 nextInputs.add(next);
@@ -515,9 +515,9 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
             transformer.transform(source, result);
             String xmlString = result.getWriter().toString();
 
-            FileWriter writer = new FileWriter(file);
-            writer.write(xmlString);
-            writer.close();
+            try (FileWriter writer = new FileWriter(file);) {
+                writer.write(xmlString);
+            }
         } catch (ParserConfigurationException e) {
             Activator.getDefault().logError("Error saving CustomTxtTraceDefinition: path=" + path, e); //$NON-NLS-1$
         } catch (TransformerConfigurationException e) {
@@ -623,7 +623,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
                 return new CustomTxtTraceDefinition[0];
             }
 
-            ArrayList<CustomTxtTraceDefinition> defList = new ArrayList<CustomTxtTraceDefinition>();
+            ArrayList<CustomTxtTraceDefinition> defList = new ArrayList<>();
             NodeList nodeList = root.getChildNodes();
             for (int i = 0; i < nodeList.getLength(); i++) {
                 Node node = nodeList.item(i);
@@ -845,9 +845,9 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
             transformer.transform(source, result);
             String xmlString = result.getWriter().toString();
 
-            FileWriter writer = new FileWriter(file);
-            writer.write(xmlString);
-            writer.close();
+            try (FileWriter writer = new FileWriter(file);) {
+                writer.write(xmlString);
+            }
         } catch (ParserConfigurationException e) {
             Activator.getDefault().logError("Error deleting CustomTxtTraceDefinition: definitionName=" + definitionName, e); //$NON-NLS-1$
         } catch (SAXException e) {
index b8b440e99a82686f75e3e7fa37667b53744f4050..4d73eaf54b9d98501fbc16710c3cb9838d1dd4cf 100644 (file)
@@ -175,7 +175,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
          */
         public void addAttribute(InputAttribute attribute) {
             if (attributes == null) {
-                attributes = new ArrayList<InputAttribute>(1);
+                attributes = new ArrayList<>(1);
             }
             attributes.add(attribute);
         }
@@ -188,7 +188,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
          */
         public void addChild(InputElement input) {
             if (childElements == null) {
-                childElements = new ArrayList<InputElement>(1);
+                childElements = new ArrayList<>(1);
             } else if (childElements.size() > 0) {
                 InputElement last = childElements.get(childElements.size() - 1);
                 last.nextElement = input;
@@ -376,9 +376,9 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
             transformer.transform(source, result);
             String xmlString = result.getWriter().toString();
 
-            FileWriter writer = new FileWriter(file);
-            writer.write(xmlString);
-            writer.close();
+            try (FileWriter writer = new FileWriter(file);) {
+                writer.write(xmlString);
+            }
         } catch (ParserConfigurationException e) {
             Activator.getDefault().logError("Error saving CustomXmlTraceDefinition: path=" + path, e); //$NON-NLS-1$
         } catch (TransformerConfigurationException e) {
@@ -493,7 +493,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
                 return new CustomXmlTraceDefinition[0];
             }
 
-            ArrayList<CustomXmlTraceDefinition> defList = new ArrayList<CustomXmlTraceDefinition>();
+            ArrayList<CustomXmlTraceDefinition> defList = new ArrayList<>();
             NodeList nodeList = root.getChildNodes();
             for (int i = 0; i < nodeList.getLength(); i++) {
                 Node node = nodeList.item(i);
@@ -723,9 +723,9 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
             transformer.transform(source, result);
             String xmlString = result.getWriter().toString();
 
-            FileWriter writer = new FileWriter(file);
-            writer.write(xmlString);
-            writer.close();
+            try (FileWriter writer = new FileWriter(file);) {
+                writer.write(xmlString);
+            }
         } catch (ParserConfigurationException e) {
             Activator.getDefault().logError("Error deleteing CustomXmlTraceDefinition: definitionName=" + definitionName, e); //$NON-NLS-1$
         } catch (SAXException e) {
index bc906a138f19150f7e4329fbacdb4cf33dfe5c10..059906a45f38a50c6ba60f73561a6682779e8f91 100644 (file)
@@ -538,7 +538,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
      * @return The list of input names
      */
     public List<String> getInputNames() {
-        List<String> inputs = new ArrayList<String>();
+        List<String> inputs = new ArrayList<>();
         for (InputLine inputLine : definition.inputs) {
             for (String inputName : getInputNames(inputLine)) {
                 if (!inputs.contains(inputName)) {
@@ -557,7 +557,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
      * @return The list of input names
      */
     public List<String> getInputNames(InputLine inputLine) {
-        List<String> inputs = new ArrayList<String>();
+        List<String> inputs = new ArrayList<>();
         if (inputLine.columns != null) {
             for (InputData inputData : inputLine.columns) {
                 String inputName = inputData.name;
@@ -628,103 +628,137 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }
         inputText.setStyleRanges(new StyleRange[] {});
 
-        Scanner scanner = new Scanner(inputText.getText());
-        scanner.useDelimiter("\n"); //$NON-NLS-1$
-        int rawPos = 0;
-        // skip starting delimiters
-        String skip = scanner.findWithinHorizon("\\A\n+", 0); //$NON-NLS-1$
-        if (skip != null) {
-            rawPos += skip.length();
-        }
+        try (Scanner scanner = new Scanner(inputText.getText());) {
+            scanner.useDelimiter("\n"); //$NON-NLS-1$
 
-        timeStampFormat = null;
-        if (selectedLine != null) {
-            for (InputGroup input : selectedLine.inputs) {
-                input.previewText.setText(Messages.CustomTxtParserInputWizardPage_noMathcingLine);
+            int rawPos = 0;
+            // skip starting delimiters
+            String skip = scanner.findWithinHorizon("\\A\n+", 0); //$NON-NLS-1$
+            if (skip != null) {
+                rawPos += skip.length();
             }
-        }
 
-        Map<String, String> data = new HashMap<String, String>();
-        int rootLineMatches = 0;
-        String firstEntryTimeStamp = null;
-        String firstEntryTimeStampInputFormat = null;
-        String log = null;
-    event:
-        while (scanner.hasNext()) {
-            if (rootLineMatches > 0 && !updateAll) {
-                break;
-            }
-            if (log == null) {
-                log = scanner.next();
+            timeStampFormat = null;
+            if (selectedLine != null) {
+                for (InputGroup input : selectedLine.inputs) {
+                    input.previewText.setText(Messages.CustomTxtParserInputWizardPage_noMathcingLine);
+                }
             }
-            int length = log.length();
-            for (InputLine rootInputLine : definition.inputs) {
-                Pattern pattern;
-                try {
-                    pattern = rootInputLine.getPattern();
-                } catch (PatternSyntaxException e) {
-                    continue;
+
+            Map<String, String> data = new HashMap<>();
+            int rootLineMatches = 0;
+            String firstEntryTimeStamp = null;
+            String firstEntryTimeStampInputFormat = null;
+            String log = null;
+            event: while (scanner.hasNext()) {
+                if (rootLineMatches > 0 && !updateAll) {
+                    break;
                 }
-                Matcher matcher = pattern.matcher(log);
-                if (matcher.find()) {
-                    rootLineMatches++;
-                    inputText.setStyleRange(new StyleRange(rawPos, length,
-                            COLOR_BLACK, COLOR_YELLOW, SWT.ITALIC));
-                    data = new HashMap<String, String>();
-                    timeStampFormat = null;
-                    updatePreviewLine(rootInputLine, matcher, data, rawPos, rootLineMatches);
-                    if (rootLineMatches == 1) {
-                        firstEntryTimeStamp = data.get(CustomTraceDefinition.TAG_TIMESTAMP);
-                        firstEntryTimeStampInputFormat = timeStampFormat;
-                    }
-                    HashMap<InputLine, Integer> countMap = new HashMap<InputLine, Integer>();
-                    InputLine currentInput = null;
-                    if (rootInputLine.childrenInputs != null && rootInputLine.childrenInputs.size() > 0) {
-                        currentInput = rootInputLine.childrenInputs.get(0);
-                        countMap.put(currentInput, 0);
+                if (log == null) {
+                    log = scanner.next();
+                }
+                int length = log.length();
+                for (InputLine rootInputLine : definition.inputs) {
+                    Pattern pattern;
+                    try {
+                        pattern = rootInputLine.getPattern();
+                    } catch (PatternSyntaxException e) {
+                        continue;
                     }
-                    rawPos += length + 1; // +1 for \n
-                    while (scanner.hasNext()) {
-                        log = scanner.next();
-                        length = log.length();
-                        boolean processed = false;
-                        if (currentInput == null) {
-                            for (InputLine input : definition.inputs) {
-                                matcher = input.getPattern().matcher(log);
-                                if (matcher.find()) {
-                                    continue event;
+                    Matcher matcher = pattern.matcher(log);
+                    if (matcher.find()) {
+                        rootLineMatches++;
+                        inputText.setStyleRange(new StyleRange(rawPos, length,
+                                COLOR_BLACK, COLOR_YELLOW, SWT.ITALIC));
+                        data = new HashMap<>();
+                        timeStampFormat = null;
+                        updatePreviewLine(rootInputLine, matcher, data, rawPos, rootLineMatches);
+                        if (rootLineMatches == 1) {
+                            firstEntryTimeStamp = data.get(CustomTraceDefinition.TAG_TIMESTAMP);
+                            firstEntryTimeStampInputFormat = timeStampFormat;
+                        }
+                        HashMap<InputLine, Integer> countMap = new HashMap<>();
+                        InputLine currentInput = null;
+                        if (rootInputLine.childrenInputs != null && rootInputLine.childrenInputs.size() > 0) {
+                            currentInput = rootInputLine.childrenInputs.get(0);
+                            countMap.put(currentInput, 0);
+                        }
+                        rawPos += length + 1; // +1 for \n
+                        while (scanner.hasNext()) {
+                            log = scanner.next();
+                            length = log.length();
+                            boolean processed = false;
+                            if (currentInput == null) {
+                                for (InputLine input : definition.inputs) {
+                                    matcher = input.getPattern().matcher(log);
+                                    if (matcher.find()) {
+                                        continue event;
+                                    }
                                 }
-                            }
-                        } else {
-                            if (countMap.get(currentInput) >= currentInput.getMinCount()) {
-                                List<InputLine> nextInputs = currentInput.getNextInputs(countMap);
-                                if (nextInputs.size() == 0 || nextInputs.get(nextInputs.size() - 1).getMinCount() == 0) {
-                                    for (InputLine input : definition.inputs) {
+                            } else {
+                                if (countMap.get(currentInput) >= currentInput.getMinCount()) {
+                                    List<InputLine> nextInputs = currentInput.getNextInputs(countMap);
+                                    if (nextInputs.size() == 0 || nextInputs.get(nextInputs.size() - 1).getMinCount() == 0) {
+                                        for (InputLine input : definition.inputs) {
+                                            matcher = input.getPattern().matcher(log);
+                                            if (matcher.find()) {
+                                                continue event;
+                                            }
+                                        }
+                                    }
+                                    for (InputLine input : nextInputs) {
                                         matcher = input.getPattern().matcher(log);
                                         if (matcher.find()) {
-                                            continue event;
+                                            inputText.setStyleRange(new StyleRange(rawPos, length,
+                                                    COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
+                                            currentInput = input;
+                                            updatePreviewLine(currentInput, matcher, data, rawPos, rootLineMatches);
+                                            if (countMap.get(currentInput) == null) {
+                                                countMap.put(currentInput, 1);
+                                            } else {
+                                                countMap.put(currentInput, countMap.get(currentInput) + 1);
+                                            }
+                                            Iterator<InputLine> iter = countMap.keySet().iterator();
+                                            while (iter.hasNext()) {
+                                                InputLine inputLine = iter.next();
+                                                if (inputLine.level > currentInput.level) {
+                                                    iter.remove();
+                                                }
+                                            }
+                                            if (currentInput.childrenInputs != null && currentInput.childrenInputs.size() > 0) {
+                                                currentInput = currentInput.childrenInputs.get(0);
+                                                countMap.put(currentInput, 0);
+                                            } else {
+                                                if (countMap.get(currentInput) >= currentInput.getMaxCount()) {
+                                                    if (currentInput.getNextInputs(countMap).size() > 0) {
+                                                        currentInput = currentInput.getNextInputs(countMap).get(0);
+                                                        if (countMap.get(currentInput) == null) {
+                                                            countMap.put(currentInput, 0);
+                                                        }
+                                                        iter = countMap.keySet().iterator();
+                                                        while (iter.hasNext()) {
+                                                            InputLine inputLine = iter.next();
+                                                            if (inputLine.level > currentInput.level) {
+                                                                iter.remove();
+                                                            }
+                                                        }
+                                                    } else {
+                                                        currentInput = null;
+                                                    }
+                                                }
+                                            }
+                                            processed = true;
+                                            break;
                                         }
                                     }
                                 }
-                                for (InputLine input : nextInputs) {
-                                    matcher = input.getPattern().matcher(log);
+                                if (!processed && currentInput != null) {
+                                    matcher = currentInput.getPattern().matcher(log);
                                     if (matcher.find()) {
                                         inputText.setStyleRange(new StyleRange(rawPos, length,
                                                 COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
-                                        currentInput = input;
                                         updatePreviewLine(currentInput, matcher, data, rawPos, rootLineMatches);
-                                        if (countMap.get(currentInput) == null) {
-                                            countMap.put(currentInput, 1);
-                                        } else {
-                                            countMap.put(currentInput, countMap.get(currentInput) + 1);
-                                        }
-                                        Iterator<InputLine> iter = countMap.keySet().iterator();
-                                        while (iter.hasNext()) {
-                                            InputLine inputLine = iter.next();
-                                            if (inputLine.level > currentInput.level) {
-                                                iter.remove();
-                                            }
-                                        }
+                                        countMap.put(currentInput, countMap.get(currentInput) + 1);
                                         if (currentInput.childrenInputs != null && currentInput.childrenInputs.size() > 0) {
                                             currentInput = currentInput.childrenInputs.get(0);
                                             countMap.put(currentInput, 0);
@@ -735,7 +769,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                                                     if (countMap.get(currentInput) == null) {
                                                         countMap.put(currentInput, 0);
                                                     }
-                                                    iter = countMap.keySet().iterator();
+                                                    Iterator<InputLine> iter = countMap.keySet().iterator();
                                                     while (iter.hasNext()) {
                                                         InputLine inputLine = iter.next();
                                                         if (inputLine.level > currentInput.level) {
@@ -747,79 +781,46 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                                                 }
                                             }
                                         }
-                                        processed = true;
-                                        break;
-                                    }
-                                }
-                            }
-                            if (!processed && currentInput != null) {
-                                matcher = currentInput.getPattern().matcher(log);
-                                if (matcher.find()) {
-                                    inputText.setStyleRange(new StyleRange(rawPos, length,
-                                            COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
-                                    updatePreviewLine(currentInput, matcher, data, rawPos, rootLineMatches);
-                                    countMap.put(currentInput, countMap.get(currentInput) + 1);
-                                    if (currentInput.childrenInputs != null && currentInput.childrenInputs.size() > 0) {
-                                        currentInput = currentInput.childrenInputs.get(0);
-                                        countMap.put(currentInput, 0);
-                                    } else {
-                                        if (countMap.get(currentInput) >= currentInput.getMaxCount()) {
-                                            if (currentInput.getNextInputs(countMap).size() > 0) {
-                                                currentInput = currentInput.getNextInputs(countMap).get(0);
-                                                if (countMap.get(currentInput) == null) {
-                                                    countMap.put(currentInput, 0);
-                                                }
-                                                Iterator<InputLine> iter = countMap.keySet().iterator();
-                                                while (iter.hasNext()) {
-                                                    InputLine inputLine = iter.next();
-                                                    if (inputLine.level > currentInput.level) {
-                                                        iter.remove();
-                                                    }
-                                                }
-                                            } else {
-                                                currentInput = null;
-                                            }
-                                        }
                                     }
                                 }
                             }
+                            rawPos += length + 1; // +1 for \n
                         }
-                        rawPos += length + 1; // +1 for \n
-                    }
 
-                    break;
-                }
-            }
-            rawPos += length + 1; // +1 for \n
-            log = null;
-        }
-        scanner.close();
-        if (rootLineMatches == 1) {
-            firstEntryTimeStamp = data.get(CustomTraceDefinition.TAG_TIMESTAMP);
-            firstEntryTimeStampInputFormat = timeStampFormat;
-        }
-        if (firstEntryTimeStamp == null) {
-            timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noTimestampGroup);
-            if (selectedLine != null) {
-                for (InputGroup group : selectedLine.inputs) {
-                    if (group.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
-                        timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noMatchingTimestamp);
                         break;
                     }
                 }
+                rawPos += length + 1; // +1 for \n
+                log = null;
             }
-        } else {
-            try {
-                SimpleDateFormat dateFormat = new SimpleDateFormat(firstEntryTimeStampInputFormat);
-                Date date = dateFormat.parse(firstEntryTimeStamp);
-                dateFormat = new SimpleDateFormat(timestampOutputFormatText.getText().trim());
-                timestampPreviewText.setText(dateFormat.format(date));
-            } catch (ParseException e) {
-                timestampPreviewText.setText("*parse exception* [" + firstEntryTimeStamp + "] <> [" + firstEntryTimeStampInputFormat + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-            } catch (IllegalArgumentException e) {
-                timestampPreviewText.setText("*parse exception* [Illegal Argument]"); //$NON-NLS-1$
+
+            if (rootLineMatches == 1) {
+                firstEntryTimeStamp = data.get(CustomTraceDefinition.TAG_TIMESTAMP);
+                firstEntryTimeStampInputFormat = timeStampFormat;
             }
+            if (firstEntryTimeStamp == null) {
+                timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noTimestampGroup);
+                if (selectedLine != null) {
+                    for (InputGroup group : selectedLine.inputs) {
+                        if (group.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+                            timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noMatchingTimestamp);
+                            break;
+                        }
+                    }
+                }
+            } else {
+                try {
+                    SimpleDateFormat dateFormat = new SimpleDateFormat(firstEntryTimeStampInputFormat);
+                    Date date = dateFormat.parse(firstEntryTimeStamp);
+                    dateFormat = new SimpleDateFormat(timestampOutputFormatText.getText().trim());
+                    timestampPreviewText.setText(dateFormat.format(date));
+                } catch (ParseException e) {
+                    timestampPreviewText.setText("*parse exception* [" + firstEntryTimeStamp + "] <> [" + firstEntryTimeStampInputFormat + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+                } catch (IllegalArgumentException e) {
+                    timestampPreviewText.setText("*parse exception* [Illegal Argument]"); //$NON-NLS-1$
+                }
 
+            }
         }
     }
 
@@ -995,7 +996,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         private Label cardinalityMaxLabel;
         private Text cardinalityMaxText;
         private Button infiniteButton;
-        private List<InputGroup> inputs = new ArrayList<InputGroup>();
+        private List<InputGroup> inputs = new ArrayList<>();
         private Button addGroupButton;
         private Label addGroupLabel;
 
@@ -1276,7 +1277,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 inputLine.cardinality = Cardinality.ZERO_OR_MORE;
                 break;
             }
-            inputLine.columns = new ArrayList<InputData>(inputs.size());
+            inputLine.columns = new ArrayList<>(inputs.size());
             for (int i = 0; i < inputs.size(); i++) {
                 InputGroup grp = inputs.get(i);
                 InputData inputData = new InputData();
index c01cd1d9925f38f9583f0f71cb000f98d79f4cf2..420741a0ab47ca458249517a2a8bb3ccbe51be6e 100644 (file)
@@ -51,7 +51,7 @@ public class CustomTxtParserOutputWizardPage extends WizardPage {
     private static final Image DOWN_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/down_button.gif"); //$NON-NLS-1$
     private final CustomTxtParserWizard wizard;
     private CustomTxtTraceDefinition definition;
-    private List<Output> outputs = new ArrayList<Output>();
+    private List<Output> outputs = new ArrayList<>();
     private Composite container;
     private SashForm sash;
     private ScrolledComposite outputsScrolledComposite;
@@ -213,13 +213,15 @@ public class CustomTxtParserOutputWizardPage extends WizardPage {
     private void updatePreviewTable() {
         final int CACHE_SIZE = 50;
         definition.outputs = extractOutputs();
+        tmpFile = Activator.getDefault().getStateLocation().addTrailingSeparator().append("customwizard.tmp").toFile(); //$NON-NLS-1$
 
-        try {
-            tmpFile = Activator.getDefault().getStateLocation().addTrailingSeparator().append("customwizard.tmp").toFile(); //$NON-NLS-1$
-            final FileWriter writer = new FileWriter(tmpFile);
+        try (final FileWriter writer = new FileWriter(tmpFile);) {
             writer.write(wizard.inputPage.getInputText());
-            writer.close();
+        } catch (final IOException e) {
+            Activator.getDefault().logError("Error creating CustomTxtTrace. File:" + tmpFile.getAbsolutePath(), e); //$NON-NLS-1$
+        }
 
+        try {
             final CustomTxtTrace trace = new CustomTxtTrace(null, definition, tmpFile.getAbsolutePath(), CACHE_SIZE);
             trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, false);
             previewTable.dispose();
@@ -228,8 +230,6 @@ public class CustomTxtParserOutputWizardPage extends WizardPage {
             previewTable.setTrace(trace, true);
         } catch (final TmfTraceException e) {
             Activator.getDefault().logError("Error creating CustomTxtTrace. File:" + tmpFile.getAbsolutePath(), e); //$NON-NLS-1$
-        } catch (final IOException e) {
-            Activator.getDefault().logError("Error creating CustomTxtTrace. File:" + tmpFile.getAbsolutePath(), e); //$NON-NLS-1$
         }
 
         tableContainer.layout();
@@ -248,7 +248,7 @@ public class CustomTxtParserOutputWizardPage extends WizardPage {
                 numColumns++;
             }
         }
-        final List<OutputColumn> outputColumns = new ArrayList<OutputColumn>(numColumns);
+        final List<OutputColumn> outputColumns = new ArrayList<>(numColumns);
         numColumns = 0;
         for (int i = 0; i < outputs.size(); i++) {
             final Output output = outputs.get(i);
index 0d7c7ac1efb6cd418ffe259363ad3bca4aa140a6..51ff540e73e1d2c2c54d047eb311f99aa694e5af 100644 (file)
@@ -640,7 +640,7 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
      * @return The input names for this element
      */
     public List<String> getInputNames(InputElement inputElement) {
-        List<String> inputs = new ArrayList<String>();
+        List<String> inputs = new ArrayList<>();
         if (inputElement.inputName != null && !inputElement.inputName.equals(CustomXmlTraceDefinition.TAG_IGNORE)) {
             String inputName = inputElement.inputName;
             if (!inputs.contains(inputName)) {
@@ -690,16 +690,13 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
             }
         }
         if (inputStream != null) {
-            BufferedReader reader = null;
-            try {
-                reader = new BufferedReader(new InputStreamReader(inputStream));
+            try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));) {
                 StringBuilder sb = new StringBuilder();
                 String line = null;
                 while ((line = reader.readLine()) != null) {
                     sb.append(line + "\n"); //$NON-NLS-1$
                 }
                 parseXmlInput(sb.toString());
-                reader.close();
                 return sb.toString();
             } catch (IOException e) {
                 return ""; //$NON-NLS-1$
@@ -845,8 +842,8 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
     private class ElementNode {
         private final InputElement inputElement;
         private final Group group;
-        private List<Attribute> attributes = new ArrayList<Attribute>();
-        private List<ElementNode> childElements = new ArrayList<ElementNode>();
+        private List<Attribute> attributes = new ArrayList<>();
+        private List<ElementNode> childElements = new ArrayList<>();
         private Text elementNameText;
         private Composite tagComposite;
         private Combo tagCombo;
@@ -1179,7 +1176,7 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
                 }
                 inputElement.inputAction = actionCombo.getSelectionIndex();
             }
-            inputElement.attributes = new ArrayList<InputAttribute>(attributes.size());
+            inputElement.attributes = new ArrayList<>(attributes.size());
             for (int i = 0; i < attributes.size(); i++) {
                 Attribute attribute = attributes.get(i);
                 InputAttribute inputAttribute = new InputAttribute();
@@ -1376,7 +1373,7 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
             if (!documentElement.getNodeName().equals(definition.rootInputElement.elementName)) {
                 return null;
             }
-            ArrayList<String> elementNames = new ArrayList<String>();
+            ArrayList<String> elementNames = new ArrayList<>();
             while (currentElement != null) {
                 elementNames.add(currentElement.elementName);
                 currentElement = currentElement.parentElement;
index 025d2ab875c76343d197c6b4354400cb7cfdac26..8239d637a23b40209e62e84438e6531d936b7142 100644 (file)
@@ -52,7 +52,7 @@ public class CustomXmlParserOutputWizardPage extends WizardPage {
     private static final Image DOWN_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/down_button.gif"); //$NON-NLS-1$
     private final CustomXmlParserWizard wizard;
     private CustomXmlTraceDefinition definition;
-    private List<Output> outputs = new ArrayList<Output>();
+    private List<Output> outputs = new ArrayList<>();
     private Composite container;
     private SashForm sash;
     private ScrolledComposite outputsScrolledComposite;
@@ -214,13 +214,15 @@ public class CustomXmlParserOutputWizardPage extends WizardPage {
     private void updatePreviewTable() {
         final int CACHE_SIZE = 50;
         definition.outputs = extractOutputs();
+        tmpFile = Activator.getDefault().getStateLocation().addTrailingSeparator().append("customwizard.tmp").toFile(); //$NON-NLS-1$
 
-        try {
-            tmpFile = Activator.getDefault().getStateLocation().addTrailingSeparator().append("customwizard.tmp").toFile(); //$NON-NLS-1$
-            final FileWriter writer = new FileWriter(tmpFile);
+        try (final FileWriter writer = new FileWriter(tmpFile);) {
             writer.write(wizard.inputPage.getInputText());
-            writer.close();
+        } catch (final IOException e) {
+            Activator.getDefault().logError("Error creating CustomXmlTrace. File:" + tmpFile.getAbsolutePath(), e); //$NON-NLS-1$
+        }
 
+        try {
             final CustomXmlTrace trace = new CustomXmlTrace(null, definition, tmpFile.getAbsolutePath(), CACHE_SIZE);
             trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, false);
             previewTable.dispose();
@@ -229,8 +231,6 @@ public class CustomXmlParserOutputWizardPage extends WizardPage {
             previewTable.setTrace(trace, true);
         } catch (final TmfTraceException e) {
             Activator.getDefault().logError("Error creating CustomXmlTrace. File:" + tmpFile.getAbsolutePath(), e); //$NON-NLS-1$
-        } catch (final IOException e) {
-            Activator.getDefault().logError("Error creating CustomXmlTrace. File:" + tmpFile.getAbsolutePath(), e); //$NON-NLS-1$
         }
 
         tableContainer.layout();
@@ -249,7 +249,7 @@ public class CustomXmlParserOutputWizardPage extends WizardPage {
                 numColumns++;
             }
         }
-        final List<OutputColumn> outputColumns = new ArrayList<OutputColumn>(numColumns);
+        final List<OutputColumn> outputColumns = new ArrayList<>(numColumns);
         numColumns = 0;
         for (int i = 0; i < outputs.size(); i++) {
             final Output output = outputs.get(i);
index 1c985ca0f35c8fa58fac81a8c34f30a8442f85eb..cd7f91080bf7b19720d11e48ce61c5fea9c2162d 100644 (file)
@@ -74,7 +74,7 @@ public class DeleteExperimentSupplementaryFilesHandler extends AbstractHandler {
             TreeSelection sel = (TreeSelection) selection;
             // There should be only one item selected as per the plugin.xml
             Object element = sel.getFirstElement();
-            List<IResource> resourcesList = new ArrayList<IResource>();
+            List<IResource> resourcesList = new ArrayList<>();
 
             if (element instanceof TmfExperimentElement) {
 
@@ -87,7 +87,7 @@ public class DeleteExperimentSupplementaryFilesHandler extends AbstractHandler {
                 resourcesList.addAll(experimentResources);
 
                 // Map to know which trace to close for each resource
-                HashMap<IResource, TmfTraceElement> traceMap = new HashMap<IResource, TmfTraceElement>();
+                HashMap<IResource, TmfTraceElement> traceMap = new HashMap<>();
 
                 for (TmfTraceElement aTrace : experiment.getTraces()) {
 
index 84b5078e1c8075cc4e76cbc2814e7b534c994d10..b180b896f7bb16fd726fb7e002dc9c939a898cc6 100644 (file)
@@ -133,7 +133,7 @@ public class RenameTraceHandler extends AbstractHandler {
             return null;
         }
 
-        List<WorkspaceModifyOperation> removeOps = new ArrayList<WorkspaceModifyOperation>();
+        List<WorkspaceModifyOperation> removeOps = new ArrayList<>();
         TmfExperimentFolder experimentFolder = newTrace.getProject().getExperimentsFolder();
         for (final ITmfProjectModelElement experiment : experimentFolder.getChildren()) {
             for (final ITmfProjectModelElement trace : experiment.getChildren()) {
index 0296fb10934fc01bc2802e75f1698743320a58bc..9328c96bc45add5b5ea1b5a850b547bdf3251b82 100644 (file)
@@ -61,7 +61,7 @@ public class SelectTraceTypeContributionItem extends CompoundContributionItem {
     @Override
     protected IContributionItem[] getContributionItems() {
 
-        Set<String> selectedTraceTypes = new HashSet<String>();
+        Set<String> selectedTraceTypes = new HashSet<>();
         IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
         IWorkbenchPage page = window.getActivePage();
         ISelection selection = page.getSelection();
@@ -74,9 +74,9 @@ public class SelectTraceTypeContributionItem extends CompoundContributionItem {
             }
         }
 
-        List<IContributionItem> list = new LinkedList<IContributionItem>();
+        List<IContributionItem> list = new LinkedList<>();
 
-        Map<String, MenuManager> categoriesMap = new HashMap<String, MenuManager>();
+        Map<String, MenuManager> categoriesMap = new HashMap<>();
         IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(
                 TmfTraceType.TMF_TRACE_TYPE_ID);
         for (IConfigurationElement ce : config) {
@@ -147,7 +147,7 @@ public class SelectTraceTypeContributionItem extends CompoundContributionItem {
             MenuManager subMenu) {
         Map<String, String> params;
 
-        params = new HashMap<String, String>();
+        params = new HashMap<>();
         params.put(BUNDLE_PARAMETER, traceBundle);
         params.put(TYPE_PARAMETER, traceTypeId);
         params.put(ICON_PARAMETER, traceIcon);
index 0ec2059435667c2be611d666da18ed2fadd7c30c..e4497e871dbcb53dd1d22f031954d8f553283d9b 100644 (file)
@@ -117,7 +117,7 @@ public class SelectTraceTypeHandler extends AbstractHandler {
         if (window == null) {
             return null;
         }
-        List<IStatus> statuses = new ArrayList<IStatus>();
+        List<IStatus> statuses = new ArrayList<>();
         boolean ok = true;
         for (Object element : fSelection.toList()) {
             TmfTraceElement trace = (TmfTraceElement) element;
index ea98f53deedf8b343470d1ddeac9f633a7cc51c1..8475d7723c0399812f4e804f1acb177dd6134ca7 100644 (file)
@@ -87,8 +87,8 @@ public class SynchronizeTracesHandler extends AbstractHandler {
 
         // Make sure selection contains only traces
         fSelection = null;
-        final ArrayList<TmfTraceElement> tl = new ArrayList<TmfTraceElement>();
-        final ArrayList<TmfExperimentElement> uiexperiment = new ArrayList<TmfExperimentElement>();
+        final ArrayList<TmfTraceElement> tl = new ArrayList<>();
+        final ArrayList<TmfExperimentElement> uiexperiment = new ArrayList<>();
         if (selection instanceof TreeSelection) {
             fSelection = (TreeSelection) selection;
             Iterator<Object> iterator = fSelection.iterator();
index ee13ca5167af6b585a563ff778bce9cd65638d47..18e85feb1b6b129031632b5fd83cc2a4ada0de03 100644 (file)
@@ -218,7 +218,7 @@ abstract public class AbstractTracePackageOperation {
 
         @Override
         public Enumeration<? extends ArchiveEntry> entries() {
-            Vector<ArchiveEntry> v = new Vector<ArchiveEntry>();
+            Vector<ArchiveEntry> v = new Vector<>();
             for (Enumeration<?> e = fTarFile.entries(); e.hasMoreElements();) {
                 v.add(new TarArchiveEntry((TarEntry) e.nextElement()));
             }
@@ -329,7 +329,7 @@ abstract public class AbstractTracePackageOperation {
 
         @Override
         public Enumeration<? extends ArchiveEntry> entries() {
-            Vector<ArchiveEntry> v = new Vector<ArchiveEntry>();
+            Vector<ArchiveEntry> v = new Vector<>();
             for (Enumeration<?> e = fZipFile.entries(); e.hasMoreElements();) {
                 v.add(new ZipAchiveEntry((ZipEntry) e.nextElement()));
             }
index e8d3d08369f43e144ff669be022787e0c14127f8..c30d201e858fd63dacdfdddd66e78cdef5bee0eb 100644 (file)
@@ -481,7 +481,7 @@ abstract public class AbstractTracePackageWizardPage extends WizardPage {
     }
 
     private static String[] addToHistory(String[] history, String newEntry) {
-        ArrayList<String> l = new ArrayList<String>(Arrays.asList(history));
+        ArrayList<String> l = new ArrayList<>(Arrays.asList(history));
         addToHistory(l, newEntry);
         String[] r = new String[l.size()];
         l.toArray(r);
index e6674d8bc1be706c493d2b4c3b5827edda2d0e72..1257967bba5864d55d39dfda18f5a7c19813a000 100644 (file)
@@ -48,7 +48,7 @@ public class ExportTracePackageHandler extends AbstractHandler {
 
         ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
         IStructuredSelection sec = StructuredSelection.EMPTY;
-        List<TmfTraceElement> selectedTraces = new ArrayList<TmfTraceElement>();
+        List<TmfTraceElement> selectedTraces = new ArrayList<>();
         if (currentSelection instanceof IStructuredSelection) {
             sec = (IStructuredSelection) currentSelection;
             Object[] selectedElements = sec.toArray();
index ead94388200d1bf5dc25baa9bedf84fb9fb19506..055468490a7a00c8304a7968e87662eeac829113 100644 (file)
@@ -184,7 +184,7 @@ public class ExportTracePackageSelectTraceWizardPage extends WizardPage {
 
     private ArrayList<TmfTraceElement> getCheckedTraces() {
         TableItem[] items = fTraceTable.getItems();
-        ArrayList<TmfTraceElement> traces = new ArrayList<TmfTraceElement>();
+        ArrayList<TmfTraceElement> traces = new ArrayList<>();
         for (TableItem item : items) {
             if (item.getChecked()) {
                 TmfTraceElement trace = (TmfTraceElement) item.getData();
index 21889161d461c6c8e2317600c3891575b4b3c990..6a81ae5a84ef62e7e61d16d4c719f031e646437b 100644 (file)
@@ -46,7 +46,7 @@ public class ExportTracePackageWizard extends Wizard implements IExportWizard {
             section = workbenchSettings.addNewSection(STORE_EXPORT_TRACE_WIZARD);
         }
         setDialogSettings(section);
-        fSelectedTraces = new ArrayList<TmfTraceElement>();
+        fSelectedTraces = new ArrayList<>();
     }
 
     /**
index b7e17341087f33a814766ada34198a197e676667..05cd4b92c668cc2579633ef54aa4b63e9db01825 100644 (file)
@@ -296,19 +296,19 @@ public class ExportTracePackageWizardPage extends AbstractTracePackageWizardPage
 
     @Override
     protected Object createElementViewerInput() {
-        List<TracePackageTraceElement> traceElements = new ArrayList<TracePackageTraceElement>();
+        List<TracePackageTraceElement> traceElements = new ArrayList<>();
         for (TmfTraceElement tmfTraceElement : fSelectedTraces) {
             TracePackageTraceElement traceElement = new TracePackageTraceElement(null, tmfTraceElement);
 
             // Trace files
-            List<TracePackageElement> children = new ArrayList<TracePackageElement>();
+            List<TracePackageElement> children = new ArrayList<>();
             TracePackageFilesElement filesElement = new TracePackageFilesElement(traceElement, tmfTraceElement.getResource());
             filesElement.setChecked(true);
             children.add(filesElement);
 
             // Supplementary files
             IResource[] supplementaryResources = tmfTraceElement.getSupplementaryResources();
-            List<TracePackageElement> suppFilesChildren = new ArrayList<TracePackageElement>();
+            List<TracePackageElement> suppFilesChildren = new ArrayList<>();
             TracePackageSupplFilesElement suppFilesElement = new TracePackageSupplFilesElement(traceElement);
             children.add(suppFilesElement);
             for (IResource res : supplementaryResources) {
index 51613905aafd392bcfd8d135c9fb4792dbc0aa6c..2c568bb2c5c98a80be60ceb93c51d3bf0e7ecd40 100644 (file)
@@ -338,7 +338,7 @@ public class ImportTracePackageWizardPage extends AbstractTracePackageWizardPage
 
     private boolean checkForOverwrite() {
         TracePackageElement[] traceElements = (TracePackageElement[]) getElementViewer().getInput();
-        List<TracePackageTraceElement> noImportTraces = new ArrayList<TracePackageTraceElement>();
+        List<TracePackageTraceElement> noImportTraces = new ArrayList<>();
         boolean noToAll = false;
         for (TracePackageElement packageElement : traceElements) {
             TracePackageTraceElement traceElement = (TracePackageTraceElement) packageElement;
index 23f053e789986819dd638aad463f7399f5a80f12..89bf86c81fc69f16142548ca0f73482a03e11274 100644 (file)
@@ -87,7 +87,7 @@ public class TracePackageExportOperation extends AbstractTracePackageOperation {
         fTraceExportElements = traceExportElements;
         fUseCompression = useCompression;
         fUseTar = useTar;
-        fResources = new HashSet<IResource>();
+        fResources = new HashSet<>();
     }
 
     /**
@@ -285,7 +285,7 @@ public class TracePackageExportOperation extends AbstractTracePackageOperation {
     }
 
     private IStatus exportToArchive(IProgressMonitor monitor, int totalWork) throws InvocationTargetException, InterruptedException {
-        ArchiveFileExportOperation op = new ArchiveFileExportOperation(new ArrayList<IResource>(fResources), getFileName());
+        ArchiveFileExportOperation op = new ArchiveFileExportOperation(new ArrayList<>(fResources), getFileName());
         op.setCreateLeadupStructure(false);
         op.setUseCompression(fUseCompression);
         op.setUseTarFormat(fUseTar);
index d4648cef3ef66eec2bbcc2c2b9db8d4ae1b5cdf2..39bcb7aedfc1899b00d88d0e21b251e8c79aead5 100644 (file)
@@ -147,7 +147,7 @@ public class TracePackageExtractManifestOperation extends AbstractTracePackageOp
     private TracePackageElement[] generateElementsFromArchive() {
         ArchiveFile archiveFile = getSpecifiedArchiveFile();
         Enumeration<?> entries = archiveFile.entries();
-        Set<String> traceFileNames = new HashSet<String>();
+        Set<String> traceFileNames = new HashSet<>();
         while (entries.hasMoreElements()) {
             ArchiveEntry entry = (ArchiveEntry) entries.nextElement();
             String entryName = entry.getName();
@@ -157,7 +157,7 @@ public class TracePackageExtractManifestOperation extends AbstractTracePackageOp
             }
         }
 
-        List<TracePackageElement> packageElements = new ArrayList<TracePackageElement>();
+        List<TracePackageElement> packageElements = new ArrayList<>();
         for (String traceFileName : traceFileNames) {
             TracePackageTraceElement traceElement = new TracePackageTraceElement(null, traceFileName, null);
             traceElement.setChildren(new TracePackageElement[] { new TracePackageFilesElement(traceElement, traceFileName) });
@@ -196,7 +196,7 @@ public class TracePackageExtractManifestOperation extends AbstractTracePackageOp
     }
 
     private static TracePackageElement[] loadElementsFromManifest(InputStream inputStream) throws IOException, SAXException, ParserConfigurationException {
-        List<TracePackageElement> packageElements = new ArrayList<TracePackageElement>();
+        List<TracePackageElement> packageElements = new ArrayList<>();
         TracePackageElement element = null;
         Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
 
@@ -209,7 +209,7 @@ public class TracePackageExtractManifestOperation extends AbstractTracePackageOp
                 String traceType = traceElement.getAttribute(ITracePackageConstants.TRACE_TYPE_ATTRIB);
                 element = new TracePackageTraceElement(null, traceName, traceType);
 
-                List<TracePackageElement> children = new ArrayList<TracePackageElement>();
+                List<TracePackageElement> children = new ArrayList<>();
                 NodeList fileElements = traceElement.getElementsByTagName(ITracePackageConstants.TRACE_FILE_ELEMENT);
                 for (int j = 0; j < fileElements.getLength(); ++j) {
                     Node fileNode = fileElements.item(j);
@@ -223,7 +223,7 @@ public class TracePackageExtractManifestOperation extends AbstractTracePackageOp
                 TracePackageSupplFilesElement supplFilesElement = new TracePackageSupplFilesElement(element);
 
                 // Supplementary files
-                List<TracePackageSupplFileElement> suppFiles = new ArrayList<TracePackageSupplFileElement>();
+                List<TracePackageSupplFileElement> suppFiles = new ArrayList<>();
                 NodeList suppFilesElements = traceElement.getElementsByTagName(ITracePackageConstants.SUPPLEMENTARY_FILE_ELEMENT);
                 for (int j = 0; j < suppFilesElements.getLength(); ++j) {
                     Node suppFileNode = suppFilesElements.item(j);
@@ -241,7 +241,7 @@ public class TracePackageExtractManifestOperation extends AbstractTracePackageOp
                 }
 
                 // bookmarks
-                List<Map<String, String>> bookmarkAttribs = new ArrayList<Map<String, String>>();
+                List<Map<String, String>> bookmarkAttribs = new ArrayList<>();
                 NodeList bookmarksElements = traceElement.getElementsByTagName(ITracePackageConstants.BOOKMARKS_ELEMENT);
                 for (int j = 0; j < bookmarksElements.getLength(); ++j) {
                     Node bookmarksNode = bookmarksElements.item(j);
@@ -252,7 +252,7 @@ public class TracePackageExtractManifestOperation extends AbstractTracePackageOp
                             if (bookmarkNode.getNodeType() == Node.ELEMENT_NODE) {
                                 Element bookmarkElement = (Element) bookmarkNode;
                                 NamedNodeMap attributesMap = bookmarkElement.getAttributes();
-                                Map<String, String> attribs = new HashMap<String, String>();
+                                Map<String, String> attribs = new HashMap<>();
                                 for (int l = 0; l < attributesMap.getLength(); ++l) {
                                     Node item = attributesMap.item(l);
                                     attribs.put(item.getNodeName(), item.getNodeValue());
index ec3710b64161fdef06daec86bbd1ac0cf5ba47ea..405af1909308741a26faeb2380d6ee8157e82a3e 100644 (file)
@@ -342,7 +342,7 @@ public class TracePackageImportOperation extends AbstractTracePackageOperation i
     }
 
     private IStatus importTraceFiles(TracePackageFilesElement traceFilesElement, IProgressMonitor monitor) {
-        List<String> fileNames = new ArrayList<String>();
+        List<String> fileNames = new ArrayList<>();
         fileNames.add(traceFilesElement.getFileName());
         IPath containerPath = fTmfTraceFolder.getPath();
         IStatus status = importFiles(getSpecifiedArchiveFile(), fileNames, containerPath, monitor);
@@ -353,7 +353,7 @@ public class TracePackageImportOperation extends AbstractTracePackageOperation i
     }
 
     private IStatus importSupplFiles(TracePackageSupplFilesElement suppFilesElement, TracePackageTraceElement traceElement, IProgressMonitor monitor) {
-        List<String> fileNames = new ArrayList<String>();
+        List<String> fileNames = new ArrayList<>();
         for (TracePackageElement child : suppFilesElement.getChildren()) {
             TracePackageSupplFileElement supplFile = (TracePackageSupplFileElement) child;
             fileNames.add(supplFile.getText());
@@ -383,7 +383,7 @@ public class TracePackageImportOperation extends AbstractTracePackageOperation i
     }
 
     private IStatus importFiles(ArchiveFile archiveFile, List<String> fileNames, IPath destinationContainerPath, IProgressMonitor monitor) {
-        List<ArchiveProviderElement> objects = new ArrayList<ArchiveProviderElement>();
+        List<ArchiveProviderElement> objects = new ArrayList<>();
         Enumeration<?> entries = archiveFile.entries();
         while (entries.hasMoreElements()) {
             ArchiveEntry entry = (ArchiveEntry) entries.nextElement();
index 559a655f469d52eee6701734c017759766249e11..6c8a72f184b73719df013b7579ce3d9005b8eae1 100644 (file)
@@ -73,7 +73,7 @@ public class TmfAnalysisElement extends TmfProjectModelElement {
      * @return Array of analysis elements
      */
     public List<TmfAnalysisOutputElement> getAvailableOutputs() {
-        List<TmfAnalysisOutputElement> list = new ArrayList<TmfAnalysisOutputElement>();
+        List<TmfAnalysisOutputElement> list = new ArrayList<>();
 
         IAnalysisModuleHelper helper = TmfAnalysisManager.getAnalysisModule(fAnalysisId);
         if (helper == null) {
index 8580868c50de1e56993bd5d501ef8cf522185aa5..3e651c5a64cfd14152242d9fa99c6bd7443f6950 100644 (file)
@@ -117,7 +117,7 @@ public class TmfExperimentElement extends TmfWithFolderElement implements IPrope
      */
     public List<TmfTraceElement> getTraces() {
         List<ITmfProjectModelElement> children = getChildren();
-        List<TmfTraceElement> traces = new ArrayList<TmfTraceElement>();
+        List<TmfTraceElement> traces = new ArrayList<>();
         for (ITmfProjectModelElement child : children) {
             if (child instanceof TmfTraceElement) {
                 traces.add((TmfTraceElement) child);
@@ -320,7 +320,7 @@ public class TmfExperimentElement extends TmfWithFolderElement implements IPrope
      * @since 3.0
      */
     public List<TmfAnalysisElement> getAvailableAnalysis() {
-        List<TmfAnalysisElement> list = new ArrayList<TmfAnalysisElement>();
+        List<TmfAnalysisElement> list = new ArrayList<>();
 
         /**
          * TODO : implement this cleanly and test it when experiment types are
index afdf7af31d1bd3ef83f9e9a819ded45df1beb9f0..65043b654ee229650c98f90f76471adaf60dc566 100644 (file)
@@ -159,10 +159,10 @@ public class TmfNavigatorContentProvider implements IPipelinedTreeContentProvide
 
     private Object[] getProjectChildren(IProject project) {
         // The children structure
-        List<Object> children = new ArrayList<Object>();
+        List<Object> children = new ArrayList<>();
 
         // Get the children from the model
-        Map<String, ITmfProjectModelElement> childrenMap = new HashMap<String, ITmfProjectModelElement>();
+        Map<String, ITmfProjectModelElement> childrenMap = new HashMap<>();
         TmfProjectElement tmfProject = TmfProjectRegistry.getProject(project, true);
         for (ITmfProjectModelElement element : tmfProject.getChildren()) {
             if (element instanceof TmfTraceFolder) {
@@ -212,10 +212,10 @@ public class TmfNavigatorContentProvider implements IPipelinedTreeContentProvide
 
     private Object[] getTraceFolderChildren(TmfTraceFolder tmfTraceFolder) {
         // The children structure
-        List<Object> children = new ArrayList<Object>();
+        List<Object> children = new ArrayList<>();
 
         // Get the children from the model
-        Map<String, ITmfProjectModelElement> childrenMap = new HashMap<String, ITmfProjectModelElement>();
+        Map<String, ITmfProjectModelElement> childrenMap = new HashMap<>();
         for (ITmfProjectModelElement element : tmfTraceFolder.getChildren()) {
             if (element instanceof TmfTraceElement) {
                 String name = element.getResource().getName();
@@ -248,10 +248,10 @@ public class TmfNavigatorContentProvider implements IPipelinedTreeContentProvide
 
     private Object[] getExperimentFolderChildren(TmfExperimentFolder tmfExperimentFolder) {
         // The children structure
-        List<Object> children = new ArrayList<Object>();
+        List<Object> children = new ArrayList<>();
 
         // Get the children from the model
-        Map<String, ITmfProjectModelElement> childrenMap = new HashMap<String, ITmfProjectModelElement>();
+        Map<String, ITmfProjectModelElement> childrenMap = new HashMap<>();
         for (ITmfProjectModelElement element : tmfExperimentFolder.getChildren()) {
             if (element instanceof TmfExperimentElement) {
                 String name = element.getResource().getName();
@@ -287,10 +287,10 @@ public class TmfNavigatorContentProvider implements IPipelinedTreeContentProvide
 
     private Object[] getExperimentChildren(TmfExperimentElement tmfExperiment) {
         // The children structure
-        List<Object> children = new ArrayList<Object>();
+        List<Object> children = new ArrayList<>();
 
         // Get the children from the model
-        Map<String, ITmfProjectModelElement> childrenMap = new HashMap<String, ITmfProjectModelElement>();
+        Map<String, ITmfProjectModelElement> childrenMap = new HashMap<>();
         for (ITmfProjectModelElement element : tmfExperiment.getChildren()) {
             if (element instanceof TmfTraceElement) {
                 String name = element.getResource().getName();
@@ -327,7 +327,7 @@ public class TmfNavigatorContentProvider implements IPipelinedTreeContentProvide
 
     private static Object[] getTraceChildren(TmfTraceElement parentElement) {
         // The children structure
-        List<Object> children = new ArrayList<Object>();
+        List<Object> children = new ArrayList<>();
 
         for (TmfAnalysisElement analysis : parentElement.getAvailableAnalysis()) {
             children.add(analysis);
@@ -338,7 +338,7 @@ public class TmfNavigatorContentProvider implements IPipelinedTreeContentProvide
 
     private static Object[] getAnalysisChildren(TmfAnalysisElement parentElement) {
         // The children structure
-        List<Object> children = new ArrayList<Object>();
+        List<Object> children = new ArrayList<>();
 
         for (TmfAnalysisOutputElement output : parentElement.getAvailableOutputs()) {
             children.add(output);
@@ -350,7 +350,7 @@ public class TmfNavigatorContentProvider implements IPipelinedTreeContentProvide
     private void cleanupModel(ITmfProjectModelElement parent, Map<String, ITmfProjectModelElement> danglingChildren) {
         if (parent != null) {
             for (ITmfProjectModelElement child : danglingChildren.values()) {
-                Map<String, ITmfProjectModelElement> grandChildren = new HashMap<String, ITmfProjectModelElement>();
+                Map<String, ITmfProjectModelElement> grandChildren = new HashMap<>();
                 for (ITmfProjectModelElement element : child.getChildren()) {
                     String name = element.getResource().getName();
                     grandChildren.put(name, element);
index 042918b8c47ff891baae2e0826b065a86145fb7f..4cbd92cfcccd80f8801d6cc6885bdd960c924124 100644 (file)
@@ -78,7 +78,7 @@ public abstract class TmfProjectModelElement implements ITmfProjectModelElement,
         fPath = resource.getFullPath();
         fLocation = resource.getLocationURI();
         fParent = parent;
-        fChildren = new ArrayList<ITmfProjectModelElement>();
+        fChildren = new ArrayList<>();
         ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
     }
 
index 94aee413405b447247caa0be33c79817f9564ec3..2ebb81fb7a3011ffc8ba3afa5fffac00f5e960d3 100644 (file)
@@ -38,7 +38,7 @@ import org.eclipse.linuxtools.tmf.core.TmfProjectNature;
 public class TmfProjectRegistry {
 
     // The map of project resource to project model elements
-    private static Map<IProject, TmfProjectElement> registry = new HashMap<IProject, TmfProjectElement>();
+    private static Map<IProject, TmfProjectElement> registry = new HashMap<>();
 
     /**
      * Get the project model element for a project resource
index b05f4f02b8ff721900676bd6b13878a04f7095c2..48d55be064ac7d61c6f501db555e712803235f78 100644 (file)
@@ -132,8 +132,8 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
 
     // The mapping of available trace type IDs to their corresponding
     // configuration element
-    private static final Map<String, IConfigurationElement> sfTraceTypeAttributes = new HashMap<String, IConfigurationElement>();
-    private static final Map<String, IConfigurationElement> sfTraceCategories = new HashMap<String, IConfigurationElement>();
+    private static final Map<String, IConfigurationElement> sfTraceTypeAttributes = new HashMap<>();
+    private static final Map<String, IConfigurationElement> sfTraceCategories = new HashMap<>();
 
     /**
      * Initialize statically at startup by getting extensions from the platform
@@ -444,7 +444,7 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
                 }
             }
         }
-        return new HashMap<String, String>();
+        return new HashMap<>();
     }
 
     @Override
@@ -611,7 +611,7 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
 
             // Propagate the removal to traces
             for (ITmfProjectModelElement experiment : experimentFolder.getChildren()) {
-                List<ITmfProjectModelElement> toRemove = new LinkedList<ITmfProjectModelElement>();
+                List<ITmfProjectModelElement> toRemove = new LinkedList<>();
                 for (ITmfProjectModelElement child : experiment.getChildren()) {
                     if (child.getName().equals(getName())) {
                         toRemove.add(child);
@@ -665,7 +665,7 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
      * @since 3.0
      */
     public List<TmfAnalysisElement> getAvailableAnalysis() {
-        List<TmfAnalysisElement> list = new ArrayList<TmfAnalysisElement>();
+        List<TmfAnalysisElement> list = new ArrayList<>();
 
         TraceTypeHelper helper = TmfTraceType.getInstance().getTraceType(getTraceType());
 
index 4b68b711229800c343ceb2add4b070fe69e99cfc..7d49ae01f587a22b8dc157040dd5095f8a3fe42f 100644 (file)
@@ -102,7 +102,7 @@ public class TmfTraceFolder extends TmfProjectModelElement implements IPropertyS
      */
     public List<TmfTraceElement> getTraces() {
         List<ITmfProjectModelElement> children = getChildren();
-        List<TmfTraceElement> traces = new ArrayList<TmfTraceElement>();
+        List<TmfTraceElement> traces = new ArrayList<>();
         for (ITmfProjectModelElement child : children) {
             if (child instanceof TmfTraceElement) {
                 traces.add((TmfTraceElement) child);
index 09fb06ea993150ad7ba38c6c136171188ace2e6f..19611409ec76fefe0911edafce3d5a0f938a27e8 100644 (file)
@@ -137,9 +137,9 @@ public final class TmfTraceType {
 
     // The mapping of available trace type IDs to their corresponding
     // configuration element
-    private final Map<String, IConfigurationElement> fTraceTypeAttributes = new HashMap<String, IConfigurationElement>();
-    private final Map<String, IConfigurationElement> fTraceCategories = new HashMap<String, IConfigurationElement>();
-    private final Map<String, TraceTypeHelper> fTraceTypes = new LinkedHashMap<String, TraceTypeHelper>();
+    private final Map<String, IConfigurationElement> fTraceTypeAttributes = new HashMap<>();
+    private final Map<String, IConfigurationElement> fTraceCategories = new HashMap<>();
+    private final Map<String, TraceTypeHelper> fTraceTypes = new LinkedHashMap<>();
 
     private static TmfTraceType fInstance = null;
 
@@ -211,7 +211,7 @@ public final class TmfTraceType {
     public static IConfigurationElement[] getTypeElements() {
         IConfigurationElement[] elements = Platform.getExtensionRegistry()
                 .getConfigurationElementsFor(TMF_TRACE_TYPE_ID);
-        List<IConfigurationElement> typeElements = new LinkedList<IConfigurationElement>();
+        List<IConfigurationElement> typeElements = new LinkedList<>();
         for (IConfigurationElement element : elements) {
             if (element.getName().equals(TYPE_ELEM)) {
                 typeElements.add(element);
@@ -250,7 +250,7 @@ public final class TmfTraceType {
     public String[] getAvailableTraceTypes() {
 
         // Generate the list of Category:TraceType to populate the ComboBox
-        List<String> traceTypes = new ArrayList<String>();
+        List<String> traceTypes = new ArrayList<>();
 
         // re-populate custom trace types
         getCustomTraceTypes();
@@ -272,7 +272,7 @@ public final class TmfTraceType {
      * @since 2.0
      */
     public static List<String> getCustomTraceTypes(String type) {
-        List<String> traceTypes = new ArrayList<String>();
+        List<String> traceTypes = new ArrayList<>();
         if (type.equals(CUSTOM_TXT_CATEGORY)) {
             for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {
                 String traceTypeName = def.definitionName;
@@ -295,7 +295,7 @@ public final class TmfTraceType {
      * @since 2.0
      */
     public List<String> getCustomTraceTypes() {
-        List<String> traceTypes = new ArrayList<String>();
+        List<String> traceTypes = new ArrayList<>();
         // remove the customTraceTypes
         final String[] keySet = fTraceTypes.keySet().toArray(new String[0]);
         for (String key : keySet) {
@@ -391,7 +391,7 @@ public final class TmfTraceType {
      * @since 2.0
      */
     public List<String> getTraceCategories() {
-        List<String> categoryNames = new ArrayList<String>();
+        List<String> categoryNames = new ArrayList<>();
         for (String key : fTraceTypes.keySet()) {
             final String categoryName = fTraceTypes.get(key).getCategoryName();
             if (!categoryNames.contains(categoryName)) {
@@ -412,7 +412,7 @@ public final class TmfTraceType {
 
     public List<TraceTypeHelper> getTraceTypes(String categoryName) {
         init();
-        List<TraceTypeHelper> traceNames = new ArrayList<TraceTypeHelper>();
+        List<TraceTypeHelper> traceNames = new ArrayList<>();
         for (String key : fTraceTypes.keySet()) {
             final String storedCategoryName = fTraceTypes.get(key).getCategoryName();
             if (storedCategoryName.equals(categoryName)) {
@@ -430,19 +430,19 @@ public final class TmfTraceType {
 
     private static List<File> isolateTraces(List<FileSystemElement> selectedResources) {
 
-        List<File> traces = new ArrayList<File>();
+        List<File> traces = new ArrayList<>();
 
         // Get the selection
         Iterator<FileSystemElement> resources = selectedResources.iterator();
 
         // Get the sorted list of unique entries
-        Map<String, File> fileSystemObjects = new HashMap<String, File>();
+        Map<String, File> fileSystemObjects = new HashMap<>();
         while (resources.hasNext()) {
             File resource = (File) resources.next().getFileSystemObject();
             String key = resource.getAbsolutePath();
             fileSystemObjects.put(key, resource);
         }
-        List<String> files = new ArrayList<String>(fileSystemObjects.keySet());
+        List<String> files = new ArrayList<>(fileSystemObjects.keySet());
         Collections.sort(files);
 
         // After sorting, traces correspond to the unique prefixes
@@ -637,7 +637,7 @@ public final class TmfTraceType {
      * @since 2.2
      */
     public TraceTypeHelper selectTraceType(String path, Shell shell, String traceTypeHint) throws TmfTraceImportException {
-        List<TraceTypeHelper> validCandidates = new ArrayList<TraceTypeHelper>();
+        List<TraceTypeHelper> validCandidates = new ArrayList<>();
         getCustomTraceTypes();
         final Set<String> traceTypes = fTraceTypes.keySet();
         for (String traceType : traceTypes) {
@@ -676,7 +676,7 @@ public final class TmfTraceType {
     }
 
     private static List<TraceTypeHelper> reduce(List<TraceTypeHelper> candidates) {
-        List<TraceTypeHelper> retVal = new ArrayList<TraceTypeHelper>();
+        List<TraceTypeHelper> retVal = new ArrayList<>();
 
         // get all the tracetypes that are unique in that stage
         for (TraceTypeHelper trace : candidates) {
@@ -708,7 +708,7 @@ public final class TmfTraceType {
     }
 
     private TraceTypeHelper getTraceTypeToSet(List<TraceTypeHelper> candidates, Shell shell) {
-        final Map<String, String> names = new HashMap<String, String>();
+        final Map<String, String> names = new HashMap<>();
         Shell shellToShow = new Shell(shell);
         shellToShow.setText(Messages.TmfTraceType_SelectTraceType);
         final String candidatesToSet[] = new String[1];
index 87115b59dca6ede7fbf318d7be74273f7f13d6fb..520b1bddfe6047eacafc6cd4f2b0ea79d4fc1d07 100644 (file)
@@ -32,7 +32,7 @@ public class TraceFolderContentProvider implements IStructuredContentProvider {
     public Object[] getElements(Object inputElement) {
         if (inputElement instanceof TmfTraceFolder) {
             TmfTraceFolder folder = (TmfTraceFolder) inputElement;
-            List<ITmfProjectModelElement> elements = new ArrayList<ITmfProjectModelElement>();
+            List<ITmfProjectModelElement> elements = new ArrayList<>();
             for (ITmfProjectModelElement element : folder.getChildren()) {
                 if (element instanceof TmfTraceElement) {
                     TmfTraceElement trace = (TmfTraceElement) element;
index 2fe7b859a13002e7a89749726adb8de8e375119c..0f30f606e42a656a80cd58471f5968b4d427ab03 100644 (file)
@@ -60,7 +60,7 @@ public class TraceUtils {
      */
     public static List<IProject> getOpenedTmfProjects() {
         IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
-        List<IProject> tmfProjects = new ArrayList<IProject>();
+        List<IProject> tmfProjects = new ArrayList<>();
         for (IProject project : projects) {
             try {
                 if (project.isAccessible() && project.getNature(TmfProjectNature.ID) != null) {
index a321f4d285c6a2c92194f5bf0d076ad8547d4186..ea9536dafc671c2e6b517ce322f18490eb623b3c 100644 (file)
@@ -100,7 +100,7 @@ public class SelectTracesWizardPage extends WizardPage {
         tableColumn.setText(Messages.SelectTracesWizardPage_TraceColumnHeader);
 
         // Get the list of traces already part of the experiment
-        fPreviousTraces = new HashMap<String, TmfTraceElement>();
+        fPreviousTraces = new HashMap<>();
         for (ITmfProjectModelElement child : fExperiment.getChildren()) {
             if (child instanceof TmfTraceElement) {
                 TmfTraceElement trace = (TmfTraceElement) child;
@@ -173,7 +173,7 @@ public class SelectTracesWizardPage extends WizardPage {
      * Get the list of selected traces
      */
     private TmfTraceElement[] getSelection() {
-        Vector<TmfTraceElement> traces = new Vector<TmfTraceElement>();
+        Vector<TmfTraceElement> traces = new Vector<>();
         Object[] selection = fCheckboxTableViewer.getCheckedElements();
         for (Object sel : selection) {
             if (sel instanceof TmfTraceElement) {
index b1074d65c004748c6fb5c741564bf7eea7361f4e..e814d8acf5f81af59a9003b7577a021acf7326c6 100644 (file)
@@ -91,19 +91,19 @@ public class BatchImportTraceWizard extends Wizard implements IImportWizard {
     private IWizardPage fSelectTypePage;
     private IWizardPage fOptions;
 
-    private final List<String> fTraceTypesToScan = new ArrayList<String>();
-    private final Set<String> fParentFilesToScan = new HashSet<String>();
+    private final List<String> fTraceTypesToScan = new ArrayList<>();
+    private final Set<String> fParentFilesToScan = new HashSet<>();
 
     private ImportTraceContentProvider fScannedTraces = new ImportTraceContentProvider(fTraceTypesToScan, fParentFilesToScan);
 
-    private final Map<TraceValidationHelper, Boolean> fResults = new HashMap<TraceValidationHelper, Boolean>();
+    private final Map<TraceValidationHelper, Boolean> fResults = new HashMap<>();
     private boolean fOverwrite = true;
     private boolean fLinked = true;
 
     private BlockingQueue<TraceValidationHelper> fTracesToScan;
-    private final Set<FileAndName> fTraces = new TreeSet<FileAndName>();
+    private final Set<FileAndName> fTraces = new TreeSet<>();
 
-    private Map<String, Set<String>> fParentFiles = new HashMap<String, Set<String>>();
+    private Map<String, Set<String>> fParentFiles = new HashMap<>();
 
     // Target import directory ('Traces' folder)
     private IFolder fTargetFolder;
@@ -261,7 +261,7 @@ public class BatchImportTraceWizard extends Wizard implements IImportWizard {
                     }
                 }
                 else {
-                    List<File> subList = new ArrayList<File>();
+                    List<File> subList = new ArrayList<>();
                     IPath path = fTargetFolder.getFullPath();
                     File parentFile = traceToImport.getFile();
                     final boolean isFile = parentFile.isFile();
@@ -270,12 +270,12 @@ public class BatchImportTraceWizard extends Wizard implements IImportWizard {
                         if (fOverwrite || !resource.exists()) {
                             subList.add(parentFile);
                             parentFile = parentFile.getParentFile();
-                            final FileInputStream source = new FileInputStream(traceToImport.getFile());
-                            if (resource.exists()) {
-                                resource.delete(IResource.FORCE, new NullProgressMonitor());
+                            try (final FileInputStream source = new FileInputStream(traceToImport.getFile());) {
+                                if (resource.exists()) {
+                                    resource.delete(IResource.FORCE, new NullProgressMonitor());
+                                }
+                                resource.create(source, true, new NullProgressMonitor());
                             }
-                            resource.create(source, true, new NullProgressMonitor());
-                            source.close();
                             setTraceType(traceToImport);
                             success = true;
                         }
@@ -408,7 +408,7 @@ public class BatchImportTraceWizard extends Wizard implements IImportWizard {
     public void setTraceTypesToScan(List<String> tracesToScan) {
         // intersection to know if there's a diff.
         // if there's a diff, we need to re-enque everything
-        List<String> added = new ArrayList<String>();
+        List<String> added = new ArrayList<>();
         for (String traceLoc : tracesToScan) {
             if (!fTraceTypesToScan.contains(traceLoc)) {
                 added.add(traceLoc);
@@ -580,7 +580,7 @@ public class BatchImportTraceWizard extends Wizard implements IImportWizard {
     private void updateTracesToScan(final List<String> added) {
         // Treeset is used instead of a hashset since the traces should be read
         // in the order they were added.
-        final Set<String> filesToScan = new TreeSet<String>();
+        final Set<String> filesToScan = new TreeSet<>();
         for (String name : fParentFiles.keySet()) {
             filesToScan.addAll(fParentFiles.get(name));
         }
@@ -596,7 +596,7 @@ public class BatchImportTraceWizard extends Wizard implements IImportWizard {
      * I am a job. Make me work
      */
     private synchronized IStatus updateFiles(IProgressMonitor monitor, String traceToScanAbsPath) {
-        final Set<String> filesToScan = new TreeSet<String>();
+        final Set<String> filesToScan = new TreeSet<>();
 
         int workToDo = 1;
         for (String name : fParentFiles.keySet()) {
index 3870c4dd9453dbea49a4fd06634e2512f52d9b29..c3fb61bf5016b86301b4d3c50083bee540b40710 100644 (file)
@@ -35,8 +35,8 @@ import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceType;
  */
 class ImportTraceContentProvider implements ITreeContentProvider {
 
-    private final Map<String, String> fTraceTypes = new HashMap<String, String>();
-    private final Map<String, Set<FileAndName>> fTraceFiles = new HashMap<String, Set<FileAndName>>();
+    private final Map<String, String> fTraceTypes = new HashMap<>();
+    private final Map<String, Set<FileAndName>> fTraceFiles = new HashMap<>();
     private final List<String> fTraceTypesToScan;
     private final Set<String> fParentFilesToScan;
 
@@ -91,7 +91,7 @@ class ImportTraceContentProvider implements ITreeContentProvider {
 
     @Override
     public synchronized Object[] getElements(Object inputElement) {
-        List<String> candidates = new ArrayList<String>();
+        List<String> candidates = new ArrayList<>();
 
         for (String candidate : fTraceTypesToScan) {
             for (Entry<String, String> entry : fTraceTypes.entrySet()) {
@@ -110,7 +110,7 @@ class ImportTraceContentProvider implements ITreeContentProvider {
         if (parentElement instanceof String) {
             final Set<FileAndName> children = fTraceFiles.get(fTraceTypes.get(parentElement));
             if (children != null) {
-                Set<FileAndName> candidates = new TreeSet<FileAndName>();
+                Set<FileAndName> candidates = new TreeSet<>();
                 for (FileAndName child : children) {
                     for (String parent : fParentFilesToScan) {
                         // this is going to be slow, but less slow than UI
index f1b6c9848c851f1bb62dd2984482d176f1e9b852..d14812b61f51af32397fbc553dd6d88796a22168 100644 (file)
@@ -38,7 +38,7 @@ import org.eclipse.ui.IWorkbench;
 public class ImportTraceWizardPageOptions extends AbstractImportTraceWizardPage {
 
     private List fProjects;
-    private final Map<String, IProject> fProjectsMap = new LinkedHashMap<String, IProject>();
+    private final Map<String, IProject> fProjectsMap = new LinkedHashMap<>();
 
     /**
      * Import page that tells where the trace will go
index 775dd15dd0561c6cf1cb9a6360eaf24f86af323c..6a90e3ed5ba04b3b7c505c971be30d9d88630c57 100644 (file)
@@ -67,7 +67,7 @@ public class ImportTraceWizardScanPage extends AbstractImportTraceWizardPage {
     private CheckboxTreeViewer traceTypeViewer;
 
     final ScanRunnable fRunnable = new ScanRunnable("Scan job"); //$NON-NLS-1$
-    final private BlockingQueue<TraceValidationHelper> fTracesToScan = new ArrayBlockingQueue<TraceValidationHelper>(MAX_TRACES);
+    final private BlockingQueue<TraceValidationHelper> fTracesToScan = new ArrayBlockingQueue<>(MAX_TRACES);
     private volatile boolean fCanRun = true;
 
     // --------------------------------------------------------------------------------
index 23d2f0676e904e7db292a0b81643e761fd4d4100..ec558bbff47ca8a6b0884c8ce6f803429c6b76cc 100644 (file)
@@ -126,7 +126,7 @@ public class ImportTraceWizardSelectTraceTypePage extends AbstractImportTraceWiz
 
     @Override
     public boolean canFlipToNextPage() {
-        List<String> tracesToScan = new ArrayList<String>();
+        List<String> tracesToScan = new ArrayList<>();
         String elements[] = (String[]) fProvider.getElements(null);
         for (String traceFamily : elements) {
             final TraceTypeHelper[] children = (TraceTypeHelper[]) fProvider.getChildren(traceFamily);
index 8303d77c35dd08af61b550a78c6d865b8869e51e..cb13d5924483de6e8e435f6e82cc11ab5e2f365e 100644 (file)
@@ -30,8 +30,8 @@ import org.eclipse.linuxtools.tmf.ui.project.model.TraceTypeHelper;
  */
 public class TraceTypeContentProvider implements ITreeContentProvider {
 
-    private final List<String> fTraceCategory = new ArrayList<String>();
-    private final Map<String, List<TraceTypeHelper>> fTraceType = new HashMap<String, List<TraceTypeHelper>>();
+    private final List<String> fTraceCategory = new ArrayList<>();
+    private final Map<String, List<TraceTypeHelper>> fTraceType = new HashMap<>();
 
     /**
      * Default Constructor
index 7a66fbcc6b5107d82adc15aad2439291cd728823..b1927c07c973fb2f41317669654b59bbc814f8e2 100644 (file)
@@ -123,7 +123,7 @@ public class TmfEventPropertySource implements IPropertySource {
 
         @Override
         public IPropertyDescriptor[] getPropertyDescriptors() {
-            List<IPropertyDescriptor> descriptors= new ArrayList<IPropertyDescriptor>(fContent.getFields().length);
+            List<IPropertyDescriptor> descriptors= new ArrayList<>(fContent.getFields().length);
             for (ITmfEventField field : fContent.getFields()) {
                 if (field != null) {
                     descriptors.add(new ReadOnlyTextPropertyDescriptor(field, field.getName()));
@@ -181,7 +181,7 @@ public class TmfEventPropertySource implements IPropertySource {
 
         @Override
         public IPropertyDescriptor[] getPropertyDescriptors() {
-            List<IPropertyDescriptor> descriptors= new ArrayList<IPropertyDescriptor>();
+            List<IPropertyDescriptor> descriptors= new ArrayList<>();
             if (fSourceLookup.getCallsite() != null) {
                 descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_FILE_NAME, NAME_FILE_NAME));
                 descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_LINE_NUMBER, NAME_LINE_NUMBER));
@@ -235,7 +235,7 @@ public class TmfEventPropertySource implements IPropertySource {
 
         @Override
         public IPropertyDescriptor[] getPropertyDescriptors() {
-            List<IPropertyDescriptor> descriptors = new ArrayList<IPropertyDescriptor>();
+            List<IPropertyDescriptor> descriptors = new ArrayList<>();
 
             for (String customAttribute : event.listCustomAttributes()) {
                 descriptors.add(new ReadOnlyTextPropertyDescriptor(customAttribute, customAttribute));
@@ -280,7 +280,7 @@ public class TmfEventPropertySource implements IPropertySource {
 
     @Override
     public IPropertyDescriptor[] getPropertyDescriptors() {
-        List<IPropertyDescriptor> descriptors= new ArrayList<IPropertyDescriptor>();
+        List<IPropertyDescriptor> descriptors= new ArrayList<>();
 
         /* Display basic event information */
         descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_TIMESTAMP, NAME_TIMESTAMP));
index 2ecb6b3ff240f55c36d07849ac61fd96bfb5d610..9f6fee6c0a991ed8ee2b98348ab55c942e3c7feb 100644 (file)
@@ -72,7 +72,7 @@ public class TmfEventsCache {
     private ITmfTrace fTrace;
     private final TmfEventsTable fTable;
     private ITmfFilter fFilter;
-    private final List<Integer> fFilterIndex = new ArrayList<Integer>(); // contains the event rank at each 'cache size' filtered events
+    private final List<Integer> fFilterIndex = new ArrayList<>(); // contains the event rank at each 'cache size' filtered events
 
     /**
      * Constructor for the event cache
index 1cd957c54fee85877fee026a151b44403141b74d..8d60d593f5b250423ef44cc5b867f2de1080610b 100644 (file)
@@ -264,7 +264,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
     private ListenerList selectionChangedListeners = new ListenerList();
 
     // Bookmark map <Rank, MarkerId>
-    private Map<Long, Long> fBookmarksMap = new HashMap<Long, Long>();
+    private Map<Long, Long> fBookmarksMap = new HashMap<>();
     private IFile fBookmarksFile;
     private long fPendingGotoRank = -1;
 
@@ -645,7 +645,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
                     try {
                         String fileName = cs.getFileName();
                         final String trimmedPath = fileName.replaceAll("\\.\\./", ""); //$NON-NLS-1$ //$NON-NLS-2$
-                        final ArrayList<IFile> files = new ArrayList<IFile>();
+                        final ArrayList<IFile> files = new ArrayList<>();
                         ResourcesPlugin.getWorkspace().getRoot().accept(new IResourceVisitor() {
                             @Override
                             public boolean visit(IResource resource) throws CoreException {
@@ -751,7 +751,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
                 IHandlerService handlerService = (IHandlerService) activePage.getActiveEditor().getSite().getService(IHandlerService.class);
                 ICommandService cmdService = (ICommandService) activePage.getActiveEditor().getSite().getService(ICommandService.class);
                 try {
-                    HashMap<String, Object> parameters = new HashMap<String, Object>();
+                    HashMap<String, Object> parameters = new HashMap<>();
                     StringBuilder header = new StringBuilder();
                     boolean needTab = false;
                     for (TableColumn tc: fTable.getColumns()) {
@@ -2033,7 +2033,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
         if (fTable == null || fTable.isDisposed()) {
             return StructuredSelection.EMPTY;
         }
-        List<Object> list = new ArrayList<Object>(fTable.getSelection().length);
+        List<Object> list = new ArrayList<>(fTable.getSelection().length);
         for (TableItem item : fTable.getSelection()) {
             if (item.getData() != null) {
                 list.add(item.getData());
index 004161b813f656cb309b1de789b8f4ad1b0cd3ae..4b3d045d4894a81dbeb4c3f898ebacb321ae221d 100755 (executable)
@@ -74,14 +74,14 @@ public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
     /**
      * Level for which statistics should not be displayed.
      */
-    protected Set<String> fFolderLevels = new HashSet<String>(Arrays.asList(new String[] { "Event Types" })); //$NON-NLS-1$
+    protected Set<String> fFolderLevels = new HashSet<>(Arrays.asList(new String[] { "Event Types" })); //$NON-NLS-1$
 
     /**
      * Create basic columns to represent the statistics data
      */
     public TmfBaseColumnDataProvider() {
         /* List that will be used to create the table. */
-        fColumnData = new Vector<TmfBaseColumnData>();
+        fColumnData = new Vector<>();
         /* Column showing the name of the events and its level in the tree */
         fColumnData.add(new TmfBaseColumnData(LEVEL_COLUMN, 200, SWT.LEFT, LEVEL_COLUMN_TIP, new ColumnLabelProvider() {
             @Override
index 4968a533d5e5cb2159094ee353923898fcc4dbf4..b54207c9ccd7c08e338bf26579531cc435a07879 100755 (executable)
@@ -31,7 +31,7 @@ public class TmfStatisticsTreeManager {
     /**
      * Contains the experiment name as the key and the traces data
      */
-    private static final Map<String, TmfStatisticsTree> fTreeInstances = new HashMap<String, TmfStatisticsTree>();
+    private static final Map<String, TmfStatisticsTree> fTreeInstances = new HashMap<>();
 
     /**
      * Provide a statisticsTree instance per trace
index 2c7f02b911a6991184ace7d217c1babb407a8782..a33128b43abdb0e7187d7e476d862605544aed55 100755 (executable)
@@ -71,7 +71,7 @@ public class TmfStatisticsTreeNode {
         fTree = tree;
         fPath = path;
         fParent = parent;
-        fChildren = new HashMap<String, TmfStatisticsTreeNode>();
+        fChildren = new HashMap<>();
         fValues = new TmfStatisticsValues();
     }
 
index 27d1fcbad523f1399776547dbfde9d6cb0e68d1e..b6f446b575d1b56fee565afad9d6263278360348 100644 (file)
@@ -37,7 +37,7 @@ public class CallStackEntry implements ITimeGraphEntry {
     private String fFunctionName;
     private long fStartTime;
     private long fEndTime;
-    private List<ITimeEvent> fEventList = new ArrayList<ITimeEvent>(1);
+    private List<ITimeEvent> fEventList = new ArrayList<>(1);
     private List<ITimeEvent> fZoomedEventList = null;
 
     /**
index 903aae72497c0d42b50fae2a826cce7ad74ba381..828ad3b572addd4d7accca3667ba5c245f6857a8 100644 (file)
@@ -147,16 +147,16 @@ public class CallStackView extends TmfView {
     private ITmfTrace fTrace;
 
     // The selected thread map
-    private final Map<ITmfTrace, String> fSelectedThreadMap = new HashMap<ITmfTrace, String>();
+    private final Map<ITmfTrace, String> fSelectedThreadMap = new HashMap<>();
 
     // The time graph entry list
     private List<ThreadEntry> fEntryList;
 
     // The trace to entry list hash map
-    private final Map<ITmfTrace, ArrayList<ThreadEntry>> fEntryListMap = new HashMap<ITmfTrace, ArrayList<ThreadEntry>>();
+    private final Map<ITmfTrace, ArrayList<ThreadEntry>> fEntryListMap = new HashMap<>();
 
     // The trace to build thread hash map
-    private final Map<ITmfTrace, BuildThread> fBuildThreadMap = new HashMap<ITmfTrace, BuildThread>();
+    private final Map<ITmfTrace, BuildThread> fBuildThreadMap = new HashMap<>();
 
     /** The map to map function addresses to function names */
     private Map<String, String> fNameMapping;
@@ -220,7 +220,7 @@ public class CallStackView extends TmfView {
 
         public ThreadEntry(ITmfTrace trace, String name, int threadQuark, long startTime, long endTime) {
             fThreadTrace = trace;
-            fChildren = new ArrayList<CallStackEntry>();
+            fChildren = new ArrayList<>();
             fName = name;
             fTraceStartTime = startTime;
             fTraceEndTime = endTime;
@@ -784,7 +784,7 @@ public class CallStackView extends TmfView {
         } else {
             traces = new ITmfTrace[] { trace };
         }
-        ArrayList<ThreadEntry> entryList = new ArrayList<ThreadEntry>();
+        ArrayList<ThreadEntry> entryList = new ArrayList<>();
         for (ITmfTrace aTrace : traces) {
             if (monitor.isCanceled()) {
                 return;
@@ -824,7 +824,7 @@ public class CallStackView extends TmfView {
             }
         }
         synchronized (fEntryListMap) {
-            fEntryListMap.put(trace, new ArrayList<ThreadEntry>(entryList));
+            fEntryListMap.put(trace, new ArrayList<>(entryList));
         }
         if (trace == fTrace) {
             refresh();
@@ -866,7 +866,7 @@ public class CallStackView extends TmfView {
         List<ITimeEvent> eventList = null;
         try {
             List<ITmfStateInterval> stackIntervals = ss.queryHistoryRange(entry.getQuark(), start, end - 1, resolution, monitor);
-            eventList = new ArrayList<ITimeEvent>(stackIntervals.size());
+            eventList = new ArrayList<>(stackIntervals.size());
             long lastEndTime = -1;
             boolean lastIsNull = true;
             for (ITmfStateInterval statusInterval : stackIntervals) {
@@ -962,7 +962,7 @@ public class CallStackView extends TmfView {
                 synchronized (fEntryListMap) {
                     fEntryList = fEntryListMap.get(fTrace);
                     if (fEntryList == null) {
-                        fEntryList = new ArrayList<ThreadEntry>();
+                        fEntryList = new ArrayList<>();
                     }
                     entries = fEntryList.toArray(new ITimeGraphEntry[0]);
                 }
index cf8823952b3116f893e8eb3923cc505d1bdf7a51..9c56c8c817b942920a4e818dde04bc1b520cc757 100644 (file)
@@ -31,17 +31,10 @@ import org.eclipse.jdt.annotation.Nullable;
 class FunctionNameMapper {
 
     public static @Nullable Map<String, String> mapFromNmTextFile(File mappingFile) {
-        Map<String, String> map = new HashMap<String, String>();
+        Map<String, String> map = new HashMap<>();
 
-        FileReader fr;
-        try {
-            fr = new FileReader(mappingFile);
-        } catch (FileNotFoundException e) {
-            return null;
-        }
-        BufferedReader reader = new BufferedReader(fr);
-
-        try {
+        try (FileReader fr = new FileReader(mappingFile);
+                BufferedReader reader = new BufferedReader(fr);) {
             for (String line = reader.readLine(); line != null; line = reader.readLine()) {
                 String[] elems = line.split(" "); //$NON-NLS-1$
                 /* Only lines with 3 elements contain addresses */
@@ -52,13 +45,10 @@ class FunctionNameMapper {
                     map.put(address, name);
                 }
             }
-
+        } catch (FileNotFoundException e) {
+            return null;
         } catch (IOException e) {
             /* Stop reading the file at this point */
-        } finally {
-            try {
-                reader.close();
-            } catch (IOException e) {}
         }
 
         if (map.isEmpty()) {
index c654ee17f4a14746b0d10b4e5b30dd67ad66418b..a32caf06eb4151c9e8ed880efa0b17e0f7142bcf 100644 (file)
@@ -54,7 +54,7 @@ public class ColorSettingsManager {
        private static ColorSetting[] fColorSettings = ColorSettingsXML.load(COLOR_SETTINGS_PATH_NAME);
 
        // The listener list
-       private static List<IColorSettingsListener> fListeners = new ArrayList<IColorSettingsListener>();
+       private static List<IColorSettingsListener> fListeners = new ArrayList<>();
 
        /**
         * Returns an array of color settings.
index 32382d0a2b3a2287894b9d9480a8e4222645bd06..fc9fd9bcb26c6ec4af949f03976d233904efa4a2 100644 (file)
@@ -163,7 +163,7 @@ public class ColorSettingsXML {
     // Helper class
     private static class ColorSettingsContentHandler extends DefaultHandler {
 
-        private List<ColorSetting> colorSettings = new ArrayList<ColorSetting>(0);
+        private List<ColorSetting> colorSettings = new ArrayList<>(0);
         private RGB fg = new RGB(0, 0, 0);
         private RGB bg = new RGB(255, 255, 255);
         private RGB tickColor = new RGB(0, 0, 0);
@@ -174,7 +174,7 @@ public class ColorSettingsXML {
         public void startElement(String uri, String localName, String qName, Attributes attributes)
                 throws SAXException {
             if (localName.equals(COLOR_SETTINGS_TAG)) {
-                colorSettings = new ArrayList<ColorSetting>();
+                colorSettings = new ArrayList<>();
             } else if (localName.equals(COLOR_SETTING_TAG)) {
                 fg = null;
                 bg = null;
index 436af2d0f4748491189b0d6053baababc4edb365..4ab20f0232bf9736eed7ec12e7abb6e0708c22a6 100644 (file)
@@ -159,7 +159,7 @@ public class ColorsView extends TmfView {
         gl.verticalSpacing = 1;
         fListComposite.setLayout(gl);
 
-        fColorSettings = new ArrayList<ColorSetting>(Arrays.asList(ColorSettingsManager.getColorSettings()));
+        fColorSettings = new ArrayList<>(Arrays.asList(ColorSettingsManager.getColorSettings()));
         for (ColorSetting colorSetting : fColorSettings) {
             new ColorSettingRow(fListComposite, colorSetting);
         }
@@ -373,7 +373,7 @@ public class ColorsView extends TmfView {
                                     control.dispose();
                                 }
                             }
-                            fColorSettings = new ArrayList<ColorSetting>();
+                            fColorSettings = new ArrayList<>();
                             fSelectedRow = null;
                         }
                     }
index df038d4aa87d3a67499f0d2521ca15e86587dca5..326e43dcca013ba3cbbf6f58feae6f0c58005847 100644 (file)
@@ -39,7 +39,7 @@ public class FilterTreeContentProvider implements ITreeContentProvider {
     @Override
     public Object[] getElements(Object inputElement) {
         if (inputElement instanceof ITmfFilterTreeNode) {
-            ArrayList<ITmfFilterTreeNode> result = new ArrayList<ITmfFilterTreeNode>();
+            ArrayList<ITmfFilterTreeNode> result = new ArrayList<>();
             for (int i = 0; i < ((ITmfFilterTreeNode) inputElement).getChildrenCount(); i++) {
                 result.add(((ITmfFilterTreeNode) inputElement).getChild(i));
             }
@@ -51,7 +51,7 @@ public class FilterTreeContentProvider implements ITreeContentProvider {
 
     @Override
     public Object[] getChildren(Object parentElement) {
-        ArrayList<ITmfFilterTreeNode> result = new ArrayList<ITmfFilterTreeNode>();
+        ArrayList<ITmfFilterTreeNode> result = new ArrayList<>();
         for (int i = 0; i < ((ITmfFilterTreeNode) parentElement).getChildrenCount(); i++) {
             result.add(((ITmfFilterTreeNode) parentElement).getChild(i));
         }
index c5bab071d2f2b1539e579170f52a9c030411d306..c3701cb2ca989fe80bb669f7c8438bc291e58272 100644 (file)
@@ -333,7 +333,7 @@ class FilterViewer extends Composite {
         }
 
         protected String[] getFieldsList(ITmfFilterTreeNode node) {
-            ArrayList<String> fieldsList = new ArrayList<String>();
+            ArrayList<String> fieldsList = new ArrayList<>();
             ITmfFilterTreeNode curNode = node;
             while (curNode != null) {
                 if (curNode instanceof TmfFilterEventTypeNode) {
@@ -548,7 +548,7 @@ class FilterViewer extends Composite {
         }
 
         protected Map<String, Object> getEventsTypeMap() {
-            Map<String, Object> eventsTypeMap = new LinkedHashMap<String, Object>();
+            Map<String, Object> eventsTypeMap = new LinkedHashMap<>();
             for (IConfigurationElement ce : TmfTraceType.getTypeElements()) {
                 String categoryName = TmfTraceType.getCategoryName(ce.getAttribute(TmfTraceType.CATEGORY_ATTR));
                 String text = categoryName + " : " + ce.getAttribute(TmfTraceType.NAME_ATTR); //$NON-NLS-1$
index 625058754e4dbea9e82bd44a1f6ad60a71a02cb7..b10a235d2264f7b3b4ff8d7a0c9f8d1fe1dbc523 100644 (file)
@@ -173,9 +173,9 @@ public class TmfStateSystemExplorer extends TmfView {
              * sub-tree in the UI thread.
              */
             Map<String, ITmfStateSystemAnalysisModule> modules = currentTrace.getAnalysisModules(ITmfStateSystemAnalysisModule.class);
-            final Map<String, ITmfStateSystem> sss = new HashMap<String, ITmfStateSystem>();
+            final Map<String, ITmfStateSystem> sss = new HashMap<>();
             final Map<String, List<ITmfStateInterval>> fullStates =
-                    new LinkedHashMap<String, List<ITmfStateInterval>>();
+                    new LinkedHashMap<>();
             for (Entry<String, ITmfStateSystemAnalysisModule> entry : modules.entrySet()) {
                 /*
                  * FIXME: For now, this view is a way to execute and display
index ae1bb7636ac5af475d3e9a5ed1d6f4b1f395995f..627e62ecd81ed3a5ed289dd84c59f82b26836428 100644 (file)
@@ -39,7 +39,7 @@ public class TimeChartAnalysisEntry implements ITimeGraphEntry {
 
     TimeChartAnalysisEntry(ITmfTrace trace, int modelSize) {
         fTrace = trace;
-        fTraceEvents = new Vector<TimeChartEvent>(modelSize);
+        fTraceEvents = new Vector<>(modelSize);
     }
 
     /**
index 7e0f50bd8c9a42ec5677f242491dc7ea9f6e88ad..7978eaabcff6973f03ca5bc0a34403d4c7106b6d 100644 (file)
@@ -32,7 +32,7 @@ import org.eclipse.linuxtools.tmf.core.filter.ITmfFilter;
 public class TimeChartDecorationProvider {
 
        private final IFile fBookmarksFile;
-    private final Set<Long> fBookmarksSet = new HashSet<Long>();
+    private final Set<Long> fBookmarksSet = new HashSet<>();
     private ITmfFilter fFilterFilter;
     private ITmfFilter fSearchFilter;
 
index 899b6862586862adbbb826d5b84306f87af043d5..0d9edf98911a15e514870292b26cf8025eb5abb7 100644 (file)
@@ -78,9 +78,9 @@ public class TimeChartView extends TmfView implements ITimeGraphRangeListener, I
 
     private final int fDisplayWidth;
     private TimeGraphViewer fViewer;
-    private final ArrayList<TimeChartAnalysisEntry> fTimeAnalysisEntries = new ArrayList<TimeChartAnalysisEntry>();
-    private final Map<ITmfTrace, TimeChartDecorationProvider> fDecorationProviders = new HashMap<ITmfTrace, TimeChartDecorationProvider>();
-    private final ArrayList<DecorateThread> fDecorateThreads = new ArrayList<DecorateThread>();
+    private final ArrayList<TimeChartAnalysisEntry> fTimeAnalysisEntries = new ArrayList<>();
+    private final Map<ITmfTrace, TimeChartDecorationProvider> fDecorationProviders = new HashMap<>();
+    private final ArrayList<DecorateThread> fDecorateThreads = new ArrayList<>();
     private long fStartTime = 0;
     private long fStopTime = Long.MAX_VALUE;
     private boolean fRefreshBusy = false;
index 99b8d4c19a7a6a263b7dfe0d1ce42ac8281e254a..3769b469774e0ea303d2587e239cf4ff28f37e5c 100644 (file)
@@ -101,10 +101,10 @@ public abstract class AbstractTimeGraphView extends TmfView {
     private List<TimeGraphEntry> fEntryList;
 
     /** The trace to entry list hash map */
-    private final Map<ITmfTrace, List<TimeGraphEntry>> fEntryListMap = new HashMap<ITmfTrace, List<TimeGraphEntry>>();
+    private final Map<ITmfTrace, List<TimeGraphEntry>> fEntryListMap = new HashMap<>();
 
     /* The trace to build thread hash map */
-    private final Map<ITmfTrace, BuildThread> fBuildThreadMap = new HashMap<ITmfTrace, BuildThread>();
+    private final Map<ITmfTrace, BuildThread> fBuildThreadMap = new HashMap<>();
 
     /** The start time */
     private long fStartTime;
@@ -972,7 +972,7 @@ public abstract class AbstractTimeGraphView extends TmfView {
      */
     protected List<ILinkEvent> getLinkList(long startTime, long endTime,
             long resolution, IProgressMonitor monitor) {
-        return new ArrayList<ILinkEvent>();
+        return new ArrayList<>();
     }
 
 
@@ -990,7 +990,7 @@ public abstract class AbstractTimeGraphView extends TmfView {
                 synchronized (fEntryListMap) {
                     fEntryList = fEntryListMap.get(fTrace);
                     if (fEntryList == null) {
-                        fEntryList = new ArrayList<TimeGraphEntry>();
+                        fEntryList = new ArrayList<>();
                     }
                     entries = fEntryList.toArray(new ITimeGraphEntry[0]);
                 }
index 88da54401140e219a80a437f71f03bf9ca256b81..b41887bf180c27e7e25a94c5646e7d73a95229e4 100755 (executable)
@@ -258,7 +258,7 @@ public class SDWidget extends ScrollView implements SelectionListener,
     public SDWidget(Composite c, int s) {
         super(c, s | SWT.NO_BACKGROUND, true);
         setOverviewEnabled(true);
-        fSelectedNodeList = new ArrayList<GraphNode>();
+        fSelectedNodeList = new ArrayList<>();
         fSelProvider = new SDWidgetSelectionProvider();
         SDViewPref.getInstance().addPropertyChangeListener(this);
         fToolTip = new DiagramToolTip(getViewControl());
@@ -363,7 +363,7 @@ public class SDWidget extends ScrollView implements SelectionListener,
         fCollapaseCaretImg = Activator.getDefault().getImageFromPath(ITmfImageConstants.IMG_UI_ARROW_COLLAPSE_OBJ);
         fArrowUpCaretImg = Activator.getDefault().getImageFromPath(ITmfImageConstants.IMG_UI_ARROW_UP_OBJ);
 
-        fReorderList = new ArrayList<Lifeline[]>();
+        fReorderList = new ArrayList<>();
         getViewControl().addTraverseListener(new LocalTraverseListener());
 
         addTraverseListener(new LocalTraverseListener());
@@ -1405,7 +1405,7 @@ public class SDWidget extends ScrollView implements SelectionListener,
         }
         if (event.keyCode == SWT.SHIFT) {
             fShiftSelection = true;
-            fPrevList = new ArrayList<GraphNode>();
+            fPrevList = new ArrayList<>();
             fPrevList.addAll(getSelection());
         }
 
index dcb2cd40086af88e2df6f76ca6d1848d3d5ac102..adc1181c977f6f354b19692e1b6959a2f93c0d54 100755 (executable)
@@ -52,7 +52,7 @@ public class SDWidgetSelectionProvider implements ISelectionProvider {
      * Standard constructor
      */
     protected SDWidgetSelectionProvider() {
-        fListenerList = new ArrayList<ISelectionChangedListener>();
+        fListenerList = new ArrayList<>();
     }
 
     // ------------------------------------------------------------------------
index 4cdd4febaeef1f4e367b5d6e424341a9f6481fe1..8a073ccb2664c8a469f394b789d7636c03a2fabd 100755 (executable)
@@ -156,7 +156,7 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
         super(parent, s | SWT.NO_BACKGROUND, false);
         setVScrollBarMode(ScrollView.ALWAYS_OFF);
         setHScrollBarMode(ScrollView.ALWAYS_OFF);
-        fListenerList = new ArrayList<ITimeCompressionListener>();
+        fListenerList = new ArrayList<>();
         fColors = new ColorImpl[NUMBER_STEPS];
         int greenBlue = BASE_GREEN_BLUE_VALUE;
         final int step = COLOR_STEP;
@@ -276,7 +276,7 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
         if (fFrame == null) {
             return;
         }
-        fNodeList = new ArrayList<SDTimeEvent>();
+        fNodeList = new ArrayList<>();
         int messageArraysStep = 1;
 
         if ((Metrics.getMessageFontHeigth() + Metrics.MESSAGES_NAME_SPACING * 2) * fZoomValue < Metrics.MESSAGE_SIGNIFICANT_VSPACING + 1) {
index de9bbd7be25ba3198ddff0ee83d5554203d462c3..c5b1acd1706c1cec556be991615a5c25f5047174 100755 (executable)
@@ -555,11 +555,11 @@ public class BasicFrame extends GraphNode {
      */
     protected List<SDTimeEvent> buildTimeArray() {
         if (!hasChildren()) {
-            return new ArrayList<SDTimeEvent>();
+            return new ArrayList<>();
         }
 
         Iterator<String> it = getForwardSortMap().keySet().iterator();
-        List<SDTimeEvent> timeArray = new ArrayList<SDTimeEvent>();
+        List<SDTimeEvent> timeArray = new ArrayList<>();
         while (it.hasNext()) {
             String nodeType = it.next();
             List<GraphNode> list = getNodeMap().get(nodeType);
index 6c54fde7ef44eaba7d0e42e4506d9d54a1e678a7..0c653a5ca7bb25da885d8af29bd804b89653ce85 100755 (executable)
@@ -687,7 +687,7 @@ public class Frame extends BasicFrame {
     protected List<SDTimeEvent> buildTimeArray() {
 
         if (!hasChildren()) {
-            return new ArrayList<SDTimeEvent>();
+            return new ArrayList<>();
         }
 
         List<SDTimeEvent> timeArray = super.buildTimeArray();
@@ -706,7 +706,7 @@ public class Frame extends BasicFrame {
                                 SDTimeEvent f = new SDTimeEvent(time, event, eo);
                                 timeArray.add(f);
                                 if (fExecutionOccurrencesWithTime == null) {
-                                    fExecutionOccurrencesWithTime = new ArrayList<SDTimeEvent>();
+                                    fExecutionOccurrencesWithTime = new ArrayList<>();
                                 }
                                 fExecutionOccurrencesWithTime.add(f);
                                 event = eo.getEndOccurrence();
index 998a51152bd2ea277b33dc785cbd0139a4c064e8..0f24282739d6b7ab1abedc34a20e1994b5f21a4c 100755 (executable)
@@ -115,12 +115,12 @@ public abstract class GraphNode {
      */
     public void addNode(GraphNode nodeToAdd) {
         if (!fHasChilden) {
-            fNodes = new HashMap<String, List<GraphNode>>(2);
-            fForwardNodes = new HashMap<String, List<GraphNode>>(2);
-            fBackwardNodes = new HashMap<String, List<GraphNode>>(2);
-            fIndexes = new HashMap<String, Integer>(2);
-            fBackwardSort = new HashMap<String, Boolean>(2);
-            fForwardSort = new HashMap<String, Boolean>(2);
+            fNodes = new HashMap<>(2);
+            fForwardNodes = new HashMap<>(2);
+            fBackwardNodes = new HashMap<>(2);
+            fIndexes = new HashMap<>(2);
+            fBackwardSort = new HashMap<>(2);
+            fForwardSort = new HashMap<>(2);
             fHasChilden = true;
         }
 
@@ -160,7 +160,7 @@ public abstract class GraphNode {
         }
 
         if (fNodeList == null) {
-            fNodeList = new ArrayList<GraphNode>();
+            fNodeList = new ArrayList<>();
         }
 
         fNodeList.add(nodeToAdd);
@@ -401,7 +401,7 @@ public abstract class GraphNode {
      * @return the list of nodes
      */
     public List<GraphNode> getNodeList(GraphNode from, GraphNode to) {
-        List<GraphNode> result = new ArrayList<GraphNode>();
+        List<GraphNode> result = new ArrayList<>();
 
         if (from != null) {
             result.add(from);
index 35677712ab25a5288f97255e9bc2e2704cb7cb88..ff77a30ec7c820823279063b943881b294a8dc78 100755 (executable)
@@ -274,7 +274,7 @@ public class Lifeline extends GraphNode {
         if (hasChildren()) {
             return getNodeMap().get(BasicExecutionOccurrence.EXEC_OCC_TAG);
         }
-        return new ArrayList<GraphNode>();
+        return new ArrayList<>();
     }
 
     @Override
index f65b9e23ca2684436622cc59c19e022184a0f39a..affcd6294e154f7a48bd620e6846b32fd330a4c3 100755 (executable)
@@ -325,7 +325,7 @@ public class Criteria {
      * @return graph node summary
      */
     public String getGraphNodeSummary(ISDFilterProvider provider, String loaderClassName) {
-        ArrayList<String> list = new ArrayList<String>();
+        ArrayList<String> list = new ArrayList<>();
 
         if (provider != null) {
             if (isLifeLineSelected()) {
index e71838e86e09cfc010faf9994e14c635b40675a2..6a1f4128bdadeaace898ce0bed0d5e63f7a533ec 100755 (executable)
@@ -290,7 +290,7 @@ public class FilterListDialog extends Dialog {
     @Override
     public void okPressed() {
         if (fTable.getItemCount() > 0) {
-            fFilters = new ArrayList<FilterCriteria>();
+            fFilters = new ArrayList<>();
         } else {
             fFilters = null;
         }
@@ -350,7 +350,7 @@ public class FilterListDialog extends Dialog {
         int i = 0;
         DialogSettings section = null;
         int size = 0;
-        List<FilterCriteria> globalFilters = new ArrayList<FilterCriteria>();
+        List<FilterCriteria> globalFilters = new ArrayList<>();
         if (settings != null) {
             try {
                 size = settings.getInt(FILTERS_LIST_SIZE);
index e484207ed49f0d7eb6d245405797f4c03dc0bd47..49bb51690a4c825721e4802a8dfefd5651d4ac31 100755 (executable)
@@ -296,7 +296,7 @@ public class SearchFilterDialog extends Dialog {
         fCriteria.save(section);
 
         if (fCriteria.getExpression().length() > 0) {
-            ArrayList<String> list = new ArrayList<String>();
+            ArrayList<String> list = new ArrayList<>();
             for (int i = 0; i < fExpressionList.length; i++) {
                 list.add(fExpressionList[i]);
             }
index 58c88d51d47895927cdaddf374808aca0a3aa840..067bd120cd91d110d8e04c24753e1af56f558785 100644 (file)
@@ -49,11 +49,11 @@ public class KeyBindingsManager {
     /**
      * The list of view names.
      */
-    private Set<String> fViews = new HashSet<String>();
+    private Set<String> fViews = new HashSet<>();
     /**
      * The list of activations Activations to store
      */
-    private List<IHandlerActivation> fHandlerActivations = new ArrayList<IHandlerActivation>();
+    private List<IHandlerActivation> fHandlerActivations = new ArrayList<>();
     /**
      * The action reference for moving to a message in view.
      */
index 86fab0a55a350540e3aab671ea80632bd6ec655b..6efc65ab6f6c3c78d372c3f2223013e7a5c94c54 100644 (file)
@@ -64,11 +64,11 @@ public class LoadersManager {
     /**
      * Map for caching information (view ID to loader class)
      */
-    private Map<String, IUml2SDLoader> fViewLoaderMap = new HashMap<String, IUml2SDLoader>();
+    private Map<String, IUml2SDLoader> fViewLoaderMap = new HashMap<>();
     /**
      * Map for caching information (view ID to list of configuration elements)
      */
-    private Map<String, ArrayList<IConfigurationElement>> fViewLoadersList = new HashMap<String, ArrayList<IConfigurationElement>>();
+    private Map<String, ArrayList<IConfigurationElement>> fViewLoadersList = new HashMap<>();
 
     // ------------------------------------------------------------------------
     // Constructor
@@ -310,7 +310,7 @@ public class LoadersManager {
             return list;
         }
 
-        ArrayList<IConfigurationElement> ret = new ArrayList<IConfigurationElement>();
+        ArrayList<IConfigurationElement> ret = new ArrayList<>();
         IExtensionPoint iep = Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID, LOADER_TAG);
         if (iep == null) {
             return ret;
index 3c7c2d2eaa74e44c0de05c18db684f9b6571f264..c86249883915990f9ba65cbb3e407aad1e33ffda 100644 (file)
@@ -152,13 +152,13 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
     /**
      * The list of sequence diagram events of current page.
      */
-    protected List<ITmfSyncSequenceDiagramEvent> fEvents = new ArrayList<ITmfSyncSequenceDiagramEvent>();
+    protected List<ITmfSyncSequenceDiagramEvent> fEvents = new ArrayList<>();
 
     // Checkpoint and page attributes
     /**
      * The checkpoints of the whole sequence diagram trace (i.e. start time stamp of each page)
      */
-    protected List<TmfTimeRange> fCheckPoints = new ArrayList<TmfTimeRange>(MAX_NUM_OF_MSG);
+    protected List<TmfTimeRange> fCheckPoints = new ArrayList<>(MAX_NUM_OF_MSG);
     /**
      * The current page displayed.
      */
@@ -180,7 +180,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
     /**
      * List of found nodes within a page.
      */
-    protected List<GraphNode> fFindResults = new ArrayList<GraphNode>();
+    protected List<GraphNode> fFindResults = new ArrayList<>();
     /**
      * The current find criteria reference
      */
@@ -316,7 +316,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
                 private ITmfTimestamp fFirstTime = null;
                 private ITmfTimestamp fLastTime = null;
                 private int fNbSeqEvents = 0;
-                private final List<ITmfSyncSequenceDiagramEvent> fSdEvents = new ArrayList<ITmfSyncSequenceDiagramEvent>(MAX_NUM_OF_MSG);
+                private final List<ITmfSyncSequenceDiagramEvent> fSdEvents = new ArrayList<>(MAX_NUM_OF_MSG);
 
                 @Override
                 public void handleData(ITmfEvent event) {
@@ -597,7 +597,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
             }
 
             if ((fFindResults == null) || (fFindCriteria == null) || !fFindCriteria.compareTo(toSearch)) {
-                fFindResults = new CopyOnWriteArrayList<GraphNode>();
+                fFindResults = new CopyOnWriteArrayList<>();
                 fFindCriteria = toSearch;
                 if (fFindCriteria.isLifeLineSelected()) {
                     for (int i = 0; i < fFrame.lifeLinesCount(); i++) {
@@ -607,7 +607,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
                     }
                 }
 
-                ArrayList<GraphNode> msgs = new ArrayList<GraphNode>();
+                ArrayList<GraphNode> msgs = new ArrayList<>();
                 if (fFindCriteria.isSyncMessageSelected()) {
                     for (int i = 0; i < fFrame.syncMessageCount(); i++) {
                         if (fFindCriteria.matches(fFrame.getSyncMessage(i).getName())) {
@@ -655,10 +655,10 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
             cancelOngoingRequests();
 
             if (filters == null) {
-                fFilterCriteria =  new ArrayList<FilterCriteria>();
+                fFilterCriteria =  new ArrayList<>();
             } else {
                 List<FilterCriteria> list = filters;
-                fFilterCriteria =  new ArrayList<FilterCriteria>(list);
+                fFilterCriteria =  new ArrayList<>(list);
             }
 
             fillCurrentPage(fEvents);
@@ -862,7 +862,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
 
         fLock.lock();
         try {
-            fEvents = new ArrayList<ITmfSyncSequenceDiagramEvent>(events);
+            fEvents = new ArrayList<>(events);
             if (fView != null && !events.isEmpty()) {
                 fView.toggleWaitCursorAsync(true);
             }
@@ -873,7 +873,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
         final Frame frame = new Frame();
 
         if (!events.isEmpty()) {
-            Map<String, Lifeline> nodeToLifelineMap = new HashMap<String, Lifeline>();
+            Map<String, Lifeline> nodeToLifelineMap = new HashMap<>();
 
             frame.setName(Messages.TmfUml2SDSyncLoader_FrameName);
 
@@ -1076,7 +1076,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
 
         fPageRequest = new TmfEventRequest(ITmfEvent.class, window, 0,
                 ITmfEventRequest.ALL_DATA, ITmfEventRequest.ExecutionType.FOREGROUND) {
-            private final List<ITmfSyncSequenceDiagramEvent> fSdEvent = new ArrayList<ITmfSyncSequenceDiagramEvent>();
+            private final List<ITmfSyncSequenceDiagramEvent> fSdEvent = new ArrayList<>();
 
             @Override
             public void handleData(ITmfEvent event) {
index f1007e6edb2d00e776ceb87eacb3845ef01fb4e1..bc720fba29e63754829536428662016e000ed69c 100755 (executable)
@@ -138,10 +138,10 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
         fPrefStore.setDefault(PREF_USE_GRADIENT, true);
         fPrefStore.setDefault(PREF_TOOLTIP, true);
 
-        fFontPref = new Hashtable<String, IFont>();
-        fForeColorPref = new Hashtable<String, IColor>();
-        fBackColorPref = new Hashtable<String, IColor>();
-        fTextColorPref = new Hashtable<String, IColor>();
+        fFontPref = new Hashtable<>();
+        fForeColorPref = new Hashtable<>();
+        fBackColorPref = new Hashtable<>();
+        fTextColorPref = new Hashtable<>();
 
         for (int i = 0; i < FONT_LIST.length; i++) {
             if (FONT_LIST[i].equals(PREF_FRAME_NAME)) {
index 84960c55c5d5dc469f1e7a7f63dbf6b595f134f6..93a93eda817bcd4335d5ef64208eee37da3e8322 100644 (file)
@@ -80,7 +80,7 @@ public class TmfRawEventViewer extends Composite implements ControlListener, Sel
     private Font fFixedFont;
        private Slider fSlider;
 
-       private final List<LineData> fLines = new ArrayList<LineData>();
+       private final List<LineData> fLines = new ArrayList<>();
        private boolean fActualRanks = false;
        private int fTopLineIndex;
        private int fLastTopLineIndex;
index 20048067d001e545d261c4d4ff4e1df4d53eea57..753d783dd53ef8c0c73f80357e9c41aa6cbb258e 100644 (file)
@@ -67,7 +67,7 @@ public class TmfViewerFolder extends Composite {
         super(parent, style);
         setLayout(new FillLayout());
 
-        fViewers = new HashMap<String, ITmfViewer>();
+        fViewers = new HashMap<>();
         initFolder();
     }
 
index f19cd1d23c3e6e0b65d4ddfe7c8fc6431deda780..f537442eb6a6d7482c858b3ea474834f58edeacf 100644 (file)
@@ -93,10 +93,10 @@ public class TimeGraphCombo extends Composite {
     private List<? extends ITimeGraphEntry> fTopInput;
 
     /** The selection listener map */
-    private final Map<ITimeGraphSelectionListener, SelectionListenerWrapper> fSelectionListenerMap = new HashMap<ITimeGraphSelectionListener, SelectionListenerWrapper>();
+    private final Map<ITimeGraphSelectionListener, SelectionListenerWrapper> fSelectionListenerMap = new HashMap<>();
 
     /** The map of viewer filters */
-    private final Map<ViewerFilter, ViewerFilter> fViewerFilterMap = new HashMap<ViewerFilter, ViewerFilter>();
+    private final Map<ViewerFilter, ViewerFilter> fViewerFilterMap = new HashMap<>();
 
     /**
      * Flag to block the tree selection changed listener when triggered by the
@@ -703,7 +703,7 @@ public class TimeGraphCombo extends Composite {
             fFilterDialog.setMessage(Messages.TmfTimeFilterDialog_MESSAGE);
             fFilterDialog.setExpandedElements(allElements.toArray());
             if (fFilter.getFiltered() != null) {
-                ArrayList<? extends ITimeGraphEntry> nonFilteredElements = new ArrayList<ITimeGraphEntry>(allElements);
+                ArrayList<? extends ITimeGraphEntry> nonFilteredElements = new ArrayList<>(allElements);
                 nonFilteredElements.removeAll(fFilter.getFiltered());
                 fFilterDialog.setInitialElementSelections(nonFilteredElements);
             } else {
@@ -849,7 +849,7 @@ public class TimeGraphCombo extends Composite {
      * @param input the input of this time graph combo, or <code>null</code> if none
      */
     public void setInput(ITimeGraphEntry[] input) {
-        fTopInput = new ArrayList<ITimeGraphEntry>(Arrays.asList(input));
+        fTopInput = new ArrayList<>(Arrays.asList(input));
         fFilter.setFiltered(null);
         fInhibitTreeSelection = true;
         fTreeViewer.setInput(input);
@@ -993,7 +993,7 @@ public class TimeGraphCombo extends Composite {
     // ------------------------------------------------------------------------
 
     private List<TreeItem> getVisibleExpandedItems(Tree tree) {
-        ArrayList<TreeItem> items = new ArrayList<TreeItem>();
+        ArrayList<TreeItem> items = new ArrayList<>();
         for (TreeItem item : tree.getItems()) {
             if (item.getData() == FILLER) {
                 break;
@@ -1007,7 +1007,7 @@ public class TimeGraphCombo extends Composite {
     }
 
     private List<TreeItem> getVisibleExpandedItems(TreeItem treeItem) {
-        ArrayList<TreeItem> items = new ArrayList<TreeItem>();
+        ArrayList<TreeItem> items = new ArrayList<>();
         for (TreeItem item : treeItem.getItems()) {
             items.add(item);
             if (item.getExpanded()) {
@@ -1024,7 +1024,7 @@ public class TimeGraphCombo extends Composite {
      * @return All the inputs
      */
     private List<? extends ITimeGraphEntry> listAllInputs(List<? extends ITimeGraphEntry> inputs) {
-        ArrayList<ITimeGraphEntry> items = new ArrayList<ITimeGraphEntry>();
+        ArrayList<ITimeGraphEntry> items = new ArrayList<>();
         for (ITimeGraphEntry entry : inputs) {
             items.add(entry);
             if (entry.hasChildren()) {
index 93c4c4943083ddcec1d11504be6da83378417361..05d11bbb46550bf5292a3b917013fd7da5d229ce 100644 (file)
@@ -39,7 +39,7 @@ public class TimeGraphPresentationProvider implements ITimeGraphPresentationProv
     private final String fStateTypeName;
 
     // The list of listeners for graph color changes
-    private final List<ITimeGraphColorListener> fListeners = new ArrayList<ITimeGraphColorListener>();
+    private final List<ITimeGraphColorListener> fListeners = new ArrayList<>();
 
     // ------------------------------------------------------------------------
     // Constants
index ead804c87632753889352465de39570f89db760c..c341faee8f98bdcbeefd0e0259ee7e90bf149075 100644 (file)
@@ -97,9 +97,9 @@ public class TimeGraphViewer implements ITimeDataProvider2, SelectionListener {
     private TimeGraphColorScheme fColorScheme;
     private ITimeGraphPresentationProvider fTimeGraphProvider;
 
-    private List<ITimeGraphSelectionListener> fSelectionListeners = new ArrayList<ITimeGraphSelectionListener>();
-    private List<ITimeGraphTimeListener> fTimeListeners = new ArrayList<ITimeGraphTimeListener>();
-    private List<ITimeGraphRangeListener> fRangeListeners = new ArrayList<ITimeGraphRangeListener>();
+    private List<ITimeGraphSelectionListener> fSelectionListeners = new ArrayList<>();
+    private List<ITimeGraphTimeListener> fTimeListeners = new ArrayList<>();
+    private List<ITimeGraphRangeListener> fRangeListeners = new ArrayList<>();
 
     // Time format, using Epoch reference, Relative time format(default) or
     // Number
index 214938373bc08d3fcd6cc85cbddc6177df336d18..b2b1c8d3a8098a118ebf7a5e85e0bc3e8333ed39 100644 (file)
@@ -107,7 +107,7 @@ public class TimeGraphFilterDialog extends SelectionStatusDialog {
      */
     public TimeGraphFilterDialog(Shell parent) {
         super(parent);
-        setResult(new ArrayList<Object>(0));
+        setResult(new ArrayList<>(0));
         setStatusLineAboveButtons(true);
         setHelpAvailable(false);
         fExpandedElements = null;
@@ -151,7 +151,7 @@ public class TimeGraphFilterDialog extends SelectionStatusDialog {
      */
     public void addFilter(ViewerFilter filter) {
         if (fFilters == null) {
-            fFilters = new ArrayList<ViewerFilter>();
+            fFilters = new ArrayList<>();
         }
         fFilters.add(filter);
     }
index cf47461162f1e082276970fa01302ae8e09d7cf4..7dc8ba571d774c4d0365d589e260d59bfc29b41e 100644 (file)
@@ -121,7 +121,7 @@ public class TimeEvent implements ITimeEvent2 {
      */
     @Override
     public Pair<ITimeEvent, ITimeEvent> split(long time) {
-        Pair<ITimeEvent, ITimeEvent> pair = new Pair<ITimeEvent, ITimeEvent>();
+        Pair<ITimeEvent, ITimeEvent> pair = new Pair<>();
         if (time > fTime) {
             pair.setFirst(new TimeEvent(fEntry, fTime, Math.min(fDuration, time - fTime), fValue));
         }
index cd4242bcf6c373e7fd74c68d652e392123ee31d0..995828634dabf228d147f45e7395c7525cd5eab8 100644 (file)
@@ -28,14 +28,14 @@ public class TimeGraphEntry implements ITimeGraphEntry {
     private TimeGraphEntry fParent = null;
 
     /** List of child entries */
-    private final List<TimeGraphEntry> fChildren = new ArrayList<TimeGraphEntry>();
+    private final List<TimeGraphEntry> fChildren = new ArrayList<>();
 
     /** Name of this entry (text to show) */
     private String fName;
     private long fStartTime = -1;
     private long fEndTime = -1;
-    private List<ITimeEvent> fEventList = new ArrayList<ITimeEvent>();
-    private List<ITimeEvent> fZoomedEventList = new ArrayList<ITimeEvent>();
+    private List<ITimeEvent> fEventList = new ArrayList<>();
+    private List<ITimeEvent> fZoomedEventList = new ArrayList<>();
 
     /**
      * Constructor
@@ -156,9 +156,9 @@ public class TimeGraphEntry implements ITimeGraphEntry {
      */
     public void setEventList(List<ITimeEvent> eventList) {
         if (eventList != null) {
-            fEventList = new ArrayList<ITimeEvent>(eventList);
+            fEventList = new ArrayList<>(eventList);
         } else {
-            fEventList = new ArrayList<ITimeEvent>();
+            fEventList = new ArrayList<>();
         }
     }
 
@@ -170,9 +170,9 @@ public class TimeGraphEntry implements ITimeGraphEntry {
      */
     public void setZoomedEventList(List<ITimeEvent> eventList) {
         if (eventList != null) {
-            fZoomedEventList = new ArrayList<ITimeEvent>(eventList);
+            fZoomedEventList = new ArrayList<>(eventList);
         } else {
-            fZoomedEventList = new ArrayList<ITimeEvent>();
+            fZoomedEventList = new ArrayList<>();
         }
     }
 
index bd7fc41dcf3b525ff84673d814b0a0e0fa509c47..11b27b26751b200a2b9f309241fc6522b89dd1a3 100644 (file)
@@ -131,15 +131,15 @@ public class TimeGraphControl extends TimeGraphBaseControl
     private ITimeGraphPresentationProvider fTimeGraphProvider = null;
     private ItemData fItemData = null;
     private List<SelectionListener> fSelectionListeners;
-    private final List<ISelectionChangedListener> fSelectionChangedListeners = new ArrayList<ISelectionChangedListener>();
-    private final List<ITimeGraphTreeListener> fTreeListeners = new ArrayList<ITimeGraphTreeListener>();
-    private final List<MenuDetectListener> fTimeGraphEntryMenuListeners = new ArrayList<MenuDetectListener>();
-    private final List<MenuDetectListener> fTimeEventMenuListeners = new ArrayList<MenuDetectListener>();
+    private final List<ISelectionChangedListener> fSelectionChangedListeners = new ArrayList<>();
+    private final List<ITimeGraphTreeListener> fTreeListeners = new ArrayList<>();
+    private final List<MenuDetectListener> fTimeGraphEntryMenuListeners = new ArrayList<>();
+    private final List<MenuDetectListener> fTimeEventMenuListeners = new ArrayList<>();
     private final Cursor fDragCursor = Display.getDefault().getSystemCursor(SWT.CURSOR_HAND);
     private final Cursor fResizeCursor = Display.getDefault().getSystemCursor(SWT.CURSOR_IBEAM);
     private final Cursor fWaitCursor = Display.getDefault().getSystemCursor(SWT.CURSOR_WAIT);
     private final Cursor fZoomCursor = Display.getDefault().getSystemCursor(SWT.CURSOR_SIZEWE);
-    private final List<ViewerFilter> fFilters = new ArrayList<ViewerFilter>();
+    private final List<ViewerFilter> fFilters = new ArrayList<>();
     private MenuDetectEvent fPendingMenuDetectEvent = null;
     private boolean fHideArrows = false;
 
@@ -287,7 +287,7 @@ public class TimeGraphControl extends TimeGraphBaseControl
             SWT.error(SWT.ERROR_NULL_ARGUMENT);
         }
         if (null == fSelectionListeners) {
-            fSelectionListeners = new ArrayList<SelectionListener>();
+            fSelectionListeners = new ArrayList<>();
         }
         fSelectionListeners.add(listener);
     }
@@ -1162,7 +1162,7 @@ public class TimeGraphControl extends TimeGraphBaseControl
      * @return The expanded elements
      */
     public ITimeGraphEntry[] getExpandedElements() {
-        ArrayList<ITimeGraphEntry> elements = new ArrayList<ITimeGraphEntry>();
+        ArrayList<ITimeGraphEntry> elements = new ArrayList<>();
         for (Item item : fItemData.fExpandedItems) {
             elements.add(item.fTrace);
         }
@@ -2436,9 +2436,9 @@ public class TimeGraphControl extends TimeGraphBaseControl
         private Item[] fExpandedItems = new Item[0];
         private Item[] fItems = new Item[0];
         private ITimeGraphEntry fTraces[] = new ITimeGraphEntry[0];
-        private List<ILinkEvent> fLinks = new ArrayList<ILinkEvent>();
+        private List<ILinkEvent> fLinks = new ArrayList<>();
         private boolean fTraceFilter[] = new boolean[0];
-        private final ArrayList<ITimeGraphEntry> fFilteredOut = new ArrayList<ITimeGraphEntry>();
+        private final ArrayList<ITimeGraphEntry> fFilteredOut = new ArrayList<>();
 
         public ItemData() {
         }
@@ -2474,7 +2474,7 @@ public class TimeGraphControl extends TimeGraphBaseControl
         }
 
         public void refreshData() {
-            List<Item> itemList = new ArrayList<Item>();
+            List<Item> itemList = new ArrayList<>();
             fFilteredOut.clear();
             ITimeGraphEntry selection = getSelectedTrace();
             for (int i = 0; i < fTraces.length; i++) {
@@ -2514,7 +2514,7 @@ public class TimeGraphControl extends TimeGraphBaseControl
         }
 
         public void updateExpandedItems() {
-            List<Item> expandedItemList = new ArrayList<Item>();
+            List<Item> expandedItemList = new ArrayList<>();
             for (int i = 0; i < fTraces.length; i++) {
                 ITimeGraphEntry entry = fTraces[i];
                 Item item = findItem(entry);
@@ -2565,7 +2565,7 @@ public class TimeGraphControl extends TimeGraphBaseControl
             if (events != null) {
                 fLinks = events;
             } else {
-                fLinks = new ArrayList<ILinkEvent>();
+                fLinks = new ArrayList<>();
             }
         }
 
@@ -2596,7 +2596,7 @@ public class TimeGraphControl extends TimeGraphBaseControl
             this.fTrace = trace;
             this.fName = name;
             this.fLevel = level;
-            this.fChildren = new ArrayList<Item>();
+            this.fChildren = new ArrayList<>();
         }
 
         @Override
index 6e9fd39c6231adeac475eb6e59dd200c752ffc0a..c42129fb56d2f2bf53aa632f0db2148627fd72f4 100644 (file)
@@ -29,7 +29,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
  */
 public class TimeGraphSelection implements IStructuredSelection {
 
-    private List<Object> list = new ArrayList<Object>();
+    private List<Object> list = new ArrayList<>();
 
     /**
      * Default constructor
This page took 0.105093 seconds and 5 git commands to generate.