From 507b1336fb237092ac81b047139e42677e5b61ac Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Tue, 17 Dec 2013 18:08:56 -0500 Subject: [PATCH] tmf: Switch tmf.ui to Java 7 + fix warnings Change-Id: I1fd5700aa5f37e6c279752374ab6c1bcf2633d20 Signed-off-by: Alexandre Montplaisir Reviewed-on: https://git.eclipse.org/r/19929 Tested-by: Hudson CI Reviewed-by: Matthew Khouzam IP-Clean: Matthew Khouzam --- org.eclipse.linuxtools.tmf.ui/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 10 +- .../META-INF/MANIFEST.MF | 2 +- .../tmf/ui/commands/ExportToTextJob.java | 16 +- .../tmf/ui/parsers/custom/CustomEvent.java | 6 +- .../ui/parsers/custom/CustomEventsTable.java | 2 +- .../tmf/ui/parsers/custom/CustomTxtTrace.java | 2 +- .../custom/CustomTxtTraceDefinition.java | 20 +- .../custom/CustomXmlTraceDefinition.java | 18 +- .../CustomTxtParserInputWizardPage.java | 297 +++++++++--------- .../CustomTxtParserOutputWizardPage.java | 16 +- .../CustomXmlParserInputWizardPage.java | 15 +- .../CustomXmlParserOutputWizardPage.java | 16 +- ...teExperimentSupplementaryFilesHandler.java | 4 +- .../project/handlers/RenameTraceHandler.java | 2 +- .../SelectTraceTypeContributionItem.java | 8 +- .../handlers/SelectTraceTypeHandler.java | 2 +- .../handlers/SynchronizeTracesHandler.java | 4 +- .../AbstractTracePackageOperation.java | 4 +- .../AbstractTracePackageWizardPage.java | 2 +- .../ExportTracePackageHandler.java | 2 +- ...portTracePackageSelectTraceWizardPage.java | 2 +- .../ExportTracePackageWizard.java | 2 +- .../ExportTracePackageWizardPage.java | 6 +- .../ImportTracePackageWizardPage.java | 2 +- .../TracePackageExportOperation.java | 4 +- .../TracePackageExtractManifestOperation.java | 14 +- .../TracePackageImportOperation.java | 6 +- .../ui/project/model/TmfAnalysisElement.java | 2 +- .../project/model/TmfExperimentElement.java | 4 +- .../model/TmfNavigatorContentProvider.java | 22 +- .../project/model/TmfProjectModelElement.java | 2 +- .../ui/project/model/TmfProjectRegistry.java | 2 +- .../tmf/ui/project/model/TmfTraceElement.java | 10 +- .../tmf/ui/project/model/TmfTraceFolder.java | 2 +- .../tmf/ui/project/model/TmfTraceType.java | 30 +- .../model/TraceFolderContentProvider.java | 2 +- .../tmf/ui/project/model/TraceUtils.java | 2 +- .../wizards/SelectTracesWizardPage.java | 4 +- .../importtrace/BatchImportTraceWizard.java | 28 +- .../ImportTraceContentProvider.java | 8 +- .../ImportTraceWizardPageOptions.java | 2 +- .../ImportTraceWizardScanPage.java | 2 +- .../ImportTraceWizardSelectTraceTypePage.java | 2 +- .../importtrace/TraceTypeContentProvider.java | 4 +- .../events/TmfEventPropertySource.java | 8 +- .../tmf/ui/viewers/events/TmfEventsCache.java | 2 +- .../tmf/ui/viewers/events/TmfEventsTable.java | 8 +- .../model/TmfBaseColumnDataProvider.java | 4 +- .../model/TmfStatisticsTreeManager.java | 2 +- .../model/TmfStatisticsTreeNode.java | 2 +- .../ui/views/callstack/CallStackEntry.java | 2 +- .../tmf/ui/views/callstack/CallStackView.java | 16 +- .../views/callstack/FunctionNameMapper.java | 20 +- .../ui/views/colors/ColorSettingsManager.java | 2 +- .../tmf/ui/views/colors/ColorSettingsXML.java | 4 +- .../tmf/ui/views/colors/ColorsView.java | 4 +- .../filter/FilterTreeContentProvider.java | 4 +- .../tmf/ui/views/filter/FilterViewer.java | 4 +- .../statesystem/TmfStateSystemExplorer.java | 4 +- .../timechart/TimeChartAnalysisEntry.java | 2 +- .../TimeChartDecorationProvider.java | 2 +- .../tmf/ui/views/timechart/TimeChartView.java | 6 +- .../timegraph/AbstractTimeGraphView.java | 8 +- .../tmf/ui/views/uml2sd/SDWidget.java | 6 +- .../uml2sd/SDWidgetSelectionProvider.java | 2 +- .../ui/views/uml2sd/TimeCompressionBar.java | 4 +- .../tmf/ui/views/uml2sd/core/BasicFrame.java | 4 +- .../tmf/ui/views/uml2sd/core/Frame.java | 4 +- .../tmf/ui/views/uml2sd/core/GraphNode.java | 16 +- .../tmf/ui/views/uml2sd/core/Lifeline.java | 2 +- .../tmf/ui/views/uml2sd/dialogs/Criteria.java | 2 +- .../uml2sd/dialogs/FilterListDialog.java | 4 +- .../uml2sd/dialogs/SearchFilterDialog.java | 2 +- .../uml2sd/handlers/KeyBindingsManager.java | 4 +- .../ui/views/uml2sd/load/LoadersManager.java | 6 +- .../uml2sd/loader/TmfUml2SDSyncLoader.java | 22 +- .../views/uml2sd/preferences/SDViewPref.java | 8 +- .../widgets/rawviewer/TmfRawEventViewer.java | 2 +- .../ui/widgets/tabsview/TmfViewerFolder.java | 2 +- .../ui/widgets/timegraph/TimeGraphCombo.java | 14 +- .../TimeGraphPresentationProvider.java | 2 +- .../ui/widgets/timegraph/TimeGraphViewer.java | 6 +- .../dialogs/TimeGraphFilterDialog.java | 4 +- .../ui/widgets/timegraph/model/TimeEvent.java | 2 +- .../timegraph/model/TimeGraphEntry.java | 14 +- .../timegraph/widgets/TimeGraphControl.java | 26 +- .../timegraph/widgets/TimeGraphSelection.java | 2 +- 88 files changed, 426 insertions(+), 452 deletions(-) diff --git a/org.eclipse.linuxtools.tmf.ui/.classpath b/org.eclipse.linuxtools.tmf.ui/.classpath index ad32c83a78..098194ca4b 100644 --- a/org.eclipse.linuxtools.tmf.ui/.classpath +++ b/org.eclipse.linuxtools.tmf.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/org.eclipse.linuxtools.tmf.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.linuxtools.tmf.ui/.settings/org.eclipse.jdt.core.prefs index c2490783bd..4681145948 100644 --- a/org.eclipse.linuxtools.tmf.ui/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.linuxtools.tmf.ui/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF index 0bd681838a..f87297d72a 100644 --- a/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF @@ -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, diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/commands/ExportToTextJob.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/commands/ExportToTextJob.java index 29c251d1d0..a3672a2a58 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/commands/ExportToTextJob.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/commands/ExportToTextJob.java @@ -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) { - } } } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEvent.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEvent.java index 391395556e..fcbc803f17 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEvent.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEvent.java @@ -70,7 +70,7 @@ public class CustomEvent extends TmfEvent { */ public CustomEvent(CustomTraceDefinition definition) { fDefinition = definition; - fData = new HashMap(); + 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(); + 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(); + fData = new HashMap<>(); /* Set our overridden fields */ customEventTimestamp = timestamp; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEventsTable.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEventsTable.java index db36d21db6..c9ecfa1acf 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEventsTable.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEventsTable.java @@ -55,7 +55,7 @@ public class CustomEventsTable extends TmfEventsTable { if (fDefinition == null) { return; } - List columnData = new LinkedList(); + List columnData = new LinkedList<>(); for (OutputColumn outputColumn : fDefinition.outputs) { ColumnData column = new ColumnData(outputColumn.name, 0, SWT.LEFT); columnData.add(column); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtTrace.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtTrace.java index 028844c6ad..b9b569eb8d 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtTrace.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtTrace.java @@ -236,7 +236,7 @@ public class CustomTxtTrace extends TmfTrace implements ITmfEventParser, ITmfPer CustomTxtEvent event = parseFirstLine(context); - final HashMap countMap = new HashMap(); + final HashMap countMap = new HashMap<>(); InputLine currentInput = null; if (context.inputLine.childrenInputs != null && context.inputLine.childrenInputs.size() > 0) { currentInput = context.inputLine.childrenInputs.get(0); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtTraceDefinition.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtTraceDefinition.java index 1216812fae..7decee4ecb 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtTraceDefinition.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtTraceDefinition.java @@ -191,7 +191,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition { */ public void addChild(InputLine input) { if (childrenInputs == null) { - childrenInputs = new ArrayList(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(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 getNextInputs(Map countMap) { - List nextInputs = new ArrayList(); + List 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 defList = new ArrayList(); + ArrayList 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) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomXmlTraceDefinition.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomXmlTraceDefinition.java index b8b440e99a..4d73eaf54b 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomXmlTraceDefinition.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomXmlTraceDefinition.java @@ -175,7 +175,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition { */ public void addAttribute(InputAttribute attribute) { if (attributes == null) { - attributes = new ArrayList(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(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 defList = new ArrayList(); + ArrayList 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) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java index bc906a138f..059906a45f 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java @@ -538,7 +538,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage { * @return The list of input names */ public List getInputNames() { - List inputs = new ArrayList(); + List 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 getInputNames(InputLine inputLine) { - List inputs = new ArrayList(); + List 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 data = new HashMap(); - 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 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(); - timeStampFormat = null; - updatePreviewLine(rootInputLine, matcher, data, rawPos, rootLineMatches); - if (rootLineMatches == 1) { - firstEntryTimeStamp = data.get(CustomTraceDefinition.TAG_TIMESTAMP); - firstEntryTimeStampInputFormat = timeStampFormat; - } - HashMap countMap = new HashMap(); - 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 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 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 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 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 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 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 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 inputs = new ArrayList(); + private List 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(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(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserOutputWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserOutputWizardPage.java index c01cd1d992..420741a0ab 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserOutputWizardPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserOutputWizardPage.java @@ -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 outputs = new ArrayList(); + private List 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 outputColumns = new ArrayList(numColumns); + final List outputColumns = new ArrayList<>(numColumns); numColumns = 0; for (int i = 0; i < outputs.size(); i++) { final Output output = outputs.get(i); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserInputWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserInputWizardPage.java index 0d7c7ac1ef..51ff540e73 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserInputWizardPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserInputWizardPage.java @@ -640,7 +640,7 @@ public class CustomXmlParserInputWizardPage extends WizardPage { * @return The input names for this element */ public List getInputNames(InputElement inputElement) { - List inputs = new ArrayList(); + List 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 attributes = new ArrayList(); - private List childElements = new ArrayList(); + private List attributes = new ArrayList<>(); + private List 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(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 elementNames = new ArrayList(); + ArrayList elementNames = new ArrayList<>(); while (currentElement != null) { elementNames.add(currentElement.elementName); currentElement = currentElement.parentElement; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserOutputWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserOutputWizardPage.java index 025d2ab875..8239d637a2 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserOutputWizardPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserOutputWizardPage.java @@ -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 outputs = new ArrayList(); + private List 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 outputColumns = new ArrayList(numColumns); + final List outputColumns = new ArrayList<>(numColumns); numColumns = 0; for (int i = 0; i < outputs.size(); i++) { final Output output = outputs.get(i); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java index 1c985ca0f3..cd7f91080b 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java @@ -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 resourcesList = new ArrayList(); + List 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 traceMap = new HashMap(); + HashMap traceMap = new HashMap<>(); for (TmfTraceElement aTrace : experiment.getTraces()) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/RenameTraceHandler.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/RenameTraceHandler.java index 84b5078e1c..b180b896f7 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/RenameTraceHandler.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/RenameTraceHandler.java @@ -133,7 +133,7 @@ public class RenameTraceHandler extends AbstractHandler { return null; } - List removeOps = new ArrayList(); + List removeOps = new ArrayList<>(); TmfExperimentFolder experimentFolder = newTrace.getProject().getExperimentsFolder(); for (final ITmfProjectModelElement experiment : experimentFolder.getChildren()) { for (final ITmfProjectModelElement trace : experiment.getChildren()) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectTraceTypeContributionItem.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectTraceTypeContributionItem.java index 0296fb1093..9328c96bc4 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectTraceTypeContributionItem.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectTraceTypeContributionItem.java @@ -61,7 +61,7 @@ public class SelectTraceTypeContributionItem extends CompoundContributionItem { @Override protected IContributionItem[] getContributionItems() { - Set selectedTraceTypes = new HashSet(); + Set 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 list = new LinkedList(); + List list = new LinkedList<>(); - Map categoriesMap = new HashMap(); + Map 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 params; - params = new HashMap(); + params = new HashMap<>(); params.put(BUNDLE_PARAMETER, traceBundle); params.put(TYPE_PARAMETER, traceTypeId); params.put(ICON_PARAMETER, traceIcon); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectTraceTypeHandler.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectTraceTypeHandler.java index 0ec2059435..e4497e871d 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectTraceTypeHandler.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectTraceTypeHandler.java @@ -117,7 +117,7 @@ public class SelectTraceTypeHandler extends AbstractHandler { if (window == null) { return null; } - List statuses = new ArrayList(); + List statuses = new ArrayList<>(); boolean ok = true; for (Object element : fSelection.toList()) { TmfTraceElement trace = (TmfTraceElement) element; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java index ea98f53dee..8475d7723c 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java @@ -87,8 +87,8 @@ public class SynchronizeTracesHandler extends AbstractHandler { // Make sure selection contains only traces fSelection = null; - final ArrayList tl = new ArrayList(); - final ArrayList uiexperiment = new ArrayList(); + final ArrayList tl = new ArrayList<>(); + final ArrayList uiexperiment = new ArrayList<>(); if (selection instanceof TreeSelection) { fSelection = (TreeSelection) selection; Iterator iterator = fSelection.iterator(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageOperation.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageOperation.java index ee13ca5167..18e85feb1b 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageOperation.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageOperation.java @@ -218,7 +218,7 @@ abstract public class AbstractTracePackageOperation { @Override public Enumeration entries() { - Vector v = new Vector(); + Vector 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 entries() { - Vector v = new Vector(); + Vector v = new Vector<>(); for (Enumeration e = fZipFile.entries(); e.hasMoreElements();) { v.add(new ZipAchiveEntry((ZipEntry) e.nextElement())); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageWizardPage.java index e8d3d08369..c30d201e85 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageWizardPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageWizardPage.java @@ -481,7 +481,7 @@ abstract public class AbstractTracePackageWizardPage extends WizardPage { } private static String[] addToHistory(String[] history, String newEntry) { - ArrayList l = new ArrayList(Arrays.asList(history)); + ArrayList l = new ArrayList<>(Arrays.asList(history)); addToHistory(l, newEntry); String[] r = new String[l.size()]; l.toArray(r); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageHandler.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageHandler.java index e6674d8bc1..1257967bba 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageHandler.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageHandler.java @@ -48,7 +48,7 @@ public class ExportTracePackageHandler extends AbstractHandler { ISelection currentSelection = HandlerUtil.getCurrentSelection(event); IStructuredSelection sec = StructuredSelection.EMPTY; - List selectedTraces = new ArrayList(); + List selectedTraces = new ArrayList<>(); if (currentSelection instanceof IStructuredSelection) { sec = (IStructuredSelection) currentSelection; Object[] selectedElements = sec.toArray(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageSelectTraceWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageSelectTraceWizardPage.java index ead9438820..055468490a 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageSelectTraceWizardPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageSelectTraceWizardPage.java @@ -184,7 +184,7 @@ public class ExportTracePackageSelectTraceWizardPage extends WizardPage { private ArrayList getCheckedTraces() { TableItem[] items = fTraceTable.getItems(); - ArrayList traces = new ArrayList(); + ArrayList traces = new ArrayList<>(); for (TableItem item : items) { if (item.getChecked()) { TmfTraceElement trace = (TmfTraceElement) item.getData(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageWizard.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageWizard.java index 21889161d4..6a81ae5a84 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageWizard.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageWizard.java @@ -46,7 +46,7 @@ public class ExportTracePackageWizard extends Wizard implements IExportWizard { section = workbenchSettings.addNewSection(STORE_EXPORT_TRACE_WIZARD); } setDialogSettings(section); - fSelectedTraces = new ArrayList(); + fSelectedTraces = new ArrayList<>(); } /** diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageWizardPage.java index b7e1734108..05cd4b92c6 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageWizardPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageWizardPage.java @@ -296,19 +296,19 @@ public class ExportTracePackageWizardPage extends AbstractTracePackageWizardPage @Override protected Object createElementViewerInput() { - List traceElements = new ArrayList(); + List traceElements = new ArrayList<>(); for (TmfTraceElement tmfTraceElement : fSelectedTraces) { TracePackageTraceElement traceElement = new TracePackageTraceElement(null, tmfTraceElement); // Trace files - List children = new ArrayList(); + List children = new ArrayList<>(); TracePackageFilesElement filesElement = new TracePackageFilesElement(traceElement, tmfTraceElement.getResource()); filesElement.setChecked(true); children.add(filesElement); // Supplementary files IResource[] supplementaryResources = tmfTraceElement.getSupplementaryResources(); - List suppFilesChildren = new ArrayList(); + List suppFilesChildren = new ArrayList<>(); TracePackageSupplFilesElement suppFilesElement = new TracePackageSupplFilesElement(traceElement); children.add(suppFilesElement); for (IResource res : supplementaryResources) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageWizardPage.java index 51613905aa..2c568bb2c5 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageWizardPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageWizardPage.java @@ -338,7 +338,7 @@ public class ImportTracePackageWizardPage extends AbstractTracePackageWizardPage private boolean checkForOverwrite() { TracePackageElement[] traceElements = (TracePackageElement[]) getElementViewer().getInput(); - List noImportTraces = new ArrayList(); + List noImportTraces = new ArrayList<>(); boolean noToAll = false; for (TracePackageElement packageElement : traceElements) { TracePackageTraceElement traceElement = (TracePackageTraceElement) packageElement; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExportOperation.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExportOperation.java index 23f053e789..89bf86c81f 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExportOperation.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExportOperation.java @@ -87,7 +87,7 @@ public class TracePackageExportOperation extends AbstractTracePackageOperation { fTraceExportElements = traceExportElements; fUseCompression = useCompression; fUseTar = useTar; - fResources = new HashSet(); + 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(fResources), getFileName()); + ArchiveFileExportOperation op = new ArchiveFileExportOperation(new ArrayList<>(fResources), getFileName()); op.setCreateLeadupStructure(false); op.setUseCompression(fUseCompression); op.setUseTarFormat(fUseTar); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExtractManifestOperation.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExtractManifestOperation.java index d4648cef3e..39bcb7aedf 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExtractManifestOperation.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExtractManifestOperation.java @@ -147,7 +147,7 @@ public class TracePackageExtractManifestOperation extends AbstractTracePackageOp private TracePackageElement[] generateElementsFromArchive() { ArchiveFile archiveFile = getSpecifiedArchiveFile(); Enumeration entries = archiveFile.entries(); - Set traceFileNames = new HashSet(); + Set 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 packageElements = new ArrayList(); + List 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 packageElements = new ArrayList(); + List 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 children = new ArrayList(); + List 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 suppFiles = new ArrayList(); + List 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> bookmarkAttribs = new ArrayList>(); + List> 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 attribs = new HashMap(); + Map attribs = new HashMap<>(); for (int l = 0; l < attributesMap.getLength(); ++l) { Node item = attributesMap.item(l); attribs.put(item.getNodeName(), item.getNodeValue()); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageImportOperation.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageImportOperation.java index ec3710b641..405af19093 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageImportOperation.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageImportOperation.java @@ -342,7 +342,7 @@ public class TracePackageImportOperation extends AbstractTracePackageOperation i } private IStatus importTraceFiles(TracePackageFilesElement traceFilesElement, IProgressMonitor monitor) { - List fileNames = new ArrayList(); + List 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 fileNames = new ArrayList(); + List 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 fileNames, IPath destinationContainerPath, IProgressMonitor monitor) { - List objects = new ArrayList(); + List objects = new ArrayList<>(); Enumeration entries = archiveFile.entries(); while (entries.hasMoreElements()) { ArchiveEntry entry = (ArchiveEntry) entries.nextElement(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfAnalysisElement.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfAnalysisElement.java index 559a655f46..6c8a72f184 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfAnalysisElement.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfAnalysisElement.java @@ -73,7 +73,7 @@ public class TmfAnalysisElement extends TmfProjectModelElement { * @return Array of analysis elements */ public List getAvailableOutputs() { - List list = new ArrayList(); + List list = new ArrayList<>(); IAnalysisModuleHelper helper = TmfAnalysisManager.getAnalysisModule(fAnalysisId); if (helper == null) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentElement.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentElement.java index 8580868c50..3e651c5a64 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentElement.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentElement.java @@ -117,7 +117,7 @@ public class TmfExperimentElement extends TmfWithFolderElement implements IPrope */ public List getTraces() { List children = getChildren(); - List traces = new ArrayList(); + List 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 getAvailableAnalysis() { - List list = new ArrayList(); + List list = new ArrayList<>(); /** * TODO : implement this cleanly and test it when experiment types are diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfNavigatorContentProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfNavigatorContentProvider.java index afdf7af31d..65043b654e 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfNavigatorContentProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfNavigatorContentProvider.java @@ -159,10 +159,10 @@ public class TmfNavigatorContentProvider implements IPipelinedTreeContentProvide private Object[] getProjectChildren(IProject project) { // The children structure - List children = new ArrayList(); + List children = new ArrayList<>(); // Get the children from the model - Map childrenMap = new HashMap(); + Map 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 children = new ArrayList(); + List children = new ArrayList<>(); // Get the children from the model - Map childrenMap = new HashMap(); + Map 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 children = new ArrayList(); + List children = new ArrayList<>(); // Get the children from the model - Map childrenMap = new HashMap(); + Map 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 children = new ArrayList(); + List children = new ArrayList<>(); // Get the children from the model - Map childrenMap = new HashMap(); + Map 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 children = new ArrayList(); + List 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 children = new ArrayList(); + List 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 danglingChildren) { if (parent != null) { for (ITmfProjectModelElement child : danglingChildren.values()) { - Map grandChildren = new HashMap(); + Map grandChildren = new HashMap<>(); for (ITmfProjectModelElement element : child.getChildren()) { String name = element.getResource().getName(); grandChildren.put(name, element); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfProjectModelElement.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfProjectModelElement.java index 042918b8c4..4cbd92cfcc 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfProjectModelElement.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfProjectModelElement.java @@ -78,7 +78,7 @@ public abstract class TmfProjectModelElement implements ITmfProjectModelElement, fPath = resource.getFullPath(); fLocation = resource.getLocationURI(); fParent = parent; - fChildren = new ArrayList(); + fChildren = new ArrayList<>(); ResourcesPlugin.getWorkspace().addResourceChangeListener(this); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfProjectRegistry.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfProjectRegistry.java index 94aee41340..2ebb81fb7a 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfProjectRegistry.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfProjectRegistry.java @@ -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 registry = new HashMap(); + private static Map registry = new HashMap<>(); /** * Get the project model element for a project resource diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java index b05f4f02b8..48d55be064 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java @@ -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 sfTraceTypeAttributes = new HashMap(); - private static final Map sfTraceCategories = new HashMap(); + private static final Map sfTraceTypeAttributes = new HashMap<>(); + private static final Map 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(); + 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 toRemove = new LinkedList(); + List 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 getAvailableAnalysis() { - List list = new ArrayList(); + List list = new ArrayList<>(); TraceTypeHelper helper = TmfTraceType.getInstance().getTraceType(getTraceType()); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceFolder.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceFolder.java index 4b68b71122..7d49ae01f5 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceFolder.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceFolder.java @@ -102,7 +102,7 @@ public class TmfTraceFolder extends TmfProjectModelElement implements IPropertyS */ public List getTraces() { List children = getChildren(); - List traces = new ArrayList(); + List traces = new ArrayList<>(); for (ITmfProjectModelElement child : children) { if (child instanceof TmfTraceElement) { traces.add((TmfTraceElement) child); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceType.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceType.java index 09fb06ea99..19611409ec 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceType.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceType.java @@ -137,9 +137,9 @@ public final class TmfTraceType { // The mapping of available trace type IDs to their corresponding // configuration element - private final Map fTraceTypeAttributes = new HashMap(); - private final Map fTraceCategories = new HashMap(); - private final Map fTraceTypes = new LinkedHashMap(); + private final Map fTraceTypeAttributes = new HashMap<>(); + private final Map fTraceCategories = new HashMap<>(); + private final Map 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 typeElements = new LinkedList(); + List 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 traceTypes = new ArrayList(); + List traceTypes = new ArrayList<>(); // re-populate custom trace types getCustomTraceTypes(); @@ -272,7 +272,7 @@ public final class TmfTraceType { * @since 2.0 */ public static List getCustomTraceTypes(String type) { - List traceTypes = new ArrayList(); + List 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 getCustomTraceTypes() { - List traceTypes = new ArrayList(); + List 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 getTraceCategories() { - List categoryNames = new ArrayList(); + List 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 getTraceTypes(String categoryName) { init(); - List traceNames = new ArrayList(); + List 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 isolateTraces(List selectedResources) { - List traces = new ArrayList(); + List traces = new ArrayList<>(); // Get the selection Iterator resources = selectedResources.iterator(); // Get the sorted list of unique entries - Map fileSystemObjects = new HashMap(); + Map fileSystemObjects = new HashMap<>(); while (resources.hasNext()) { File resource = (File) resources.next().getFileSystemObject(); String key = resource.getAbsolutePath(); fileSystemObjects.put(key, resource); } - List files = new ArrayList(fileSystemObjects.keySet()); + List 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 validCandidates = new ArrayList(); + List validCandidates = new ArrayList<>(); getCustomTraceTypes(); final Set traceTypes = fTraceTypes.keySet(); for (String traceType : traceTypes) { @@ -676,7 +676,7 @@ public final class TmfTraceType { } private static List reduce(List candidates) { - List retVal = new ArrayList(); + List 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 candidates, Shell shell) { - final Map names = new HashMap(); + final Map names = new HashMap<>(); Shell shellToShow = new Shell(shell); shellToShow.setText(Messages.TmfTraceType_SelectTraceType); final String candidatesToSet[] = new String[1]; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TraceFolderContentProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TraceFolderContentProvider.java index 87115b59dc..520b1bddfe 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TraceFolderContentProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TraceFolderContentProvider.java @@ -32,7 +32,7 @@ public class TraceFolderContentProvider implements IStructuredContentProvider { public Object[] getElements(Object inputElement) { if (inputElement instanceof TmfTraceFolder) { TmfTraceFolder folder = (TmfTraceFolder) inputElement; - List elements = new ArrayList(); + List elements = new ArrayList<>(); for (ITmfProjectModelElement element : folder.getChildren()) { if (element instanceof TmfTraceElement) { TmfTraceElement trace = (TmfTraceElement) element; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TraceUtils.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TraceUtils.java index 2fe7b859a1..0f30f606e4 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TraceUtils.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TraceUtils.java @@ -60,7 +60,7 @@ public class TraceUtils { */ public static List getOpenedTmfProjects() { IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - List tmfProjects = new ArrayList(); + List tmfProjects = new ArrayList<>(); for (IProject project : projects) { try { if (project.isAccessible() && project.getNature(TmfProjectNature.ID) != null) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/SelectTracesWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/SelectTracesWizardPage.java index a321f4d285..ea9536dafc 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/SelectTracesWizardPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/SelectTracesWizardPage.java @@ -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(); + 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 traces = new Vector(); + Vector traces = new Vector<>(); Object[] selection = fCheckboxTableViewer.getCheckedElements(); for (Object sel : selection) { if (sel instanceof TmfTraceElement) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/BatchImportTraceWizard.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/BatchImportTraceWizard.java index b1074d65c0..e814d8acf5 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/BatchImportTraceWizard.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/BatchImportTraceWizard.java @@ -91,19 +91,19 @@ public class BatchImportTraceWizard extends Wizard implements IImportWizard { private IWizardPage fSelectTypePage; private IWizardPage fOptions; - private final List fTraceTypesToScan = new ArrayList(); - private final Set fParentFilesToScan = new HashSet(); + private final List fTraceTypesToScan = new ArrayList<>(); + private final Set fParentFilesToScan = new HashSet<>(); private ImportTraceContentProvider fScannedTraces = new ImportTraceContentProvider(fTraceTypesToScan, fParentFilesToScan); - private final Map fResults = new HashMap(); + private final Map fResults = new HashMap<>(); private boolean fOverwrite = true; private boolean fLinked = true; private BlockingQueue fTracesToScan; - private final Set fTraces = new TreeSet(); + private final Set fTraces = new TreeSet<>(); - private Map> fParentFiles = new HashMap>(); + private Map> fParentFiles = new HashMap<>(); // Target import directory ('Traces' folder) private IFolder fTargetFolder; @@ -261,7 +261,7 @@ public class BatchImportTraceWizard extends Wizard implements IImportWizard { } } else { - List subList = new ArrayList(); + List 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 tracesToScan) { // intersection to know if there's a diff. // if there's a diff, we need to re-enque everything - List added = new ArrayList(); + List 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 added) { // Treeset is used instead of a hashset since the traces should be read // in the order they were added. - final Set filesToScan = new TreeSet(); + final Set 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 filesToScan = new TreeSet(); + final Set filesToScan = new TreeSet<>(); int workToDo = 1; for (String name : fParentFiles.keySet()) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceContentProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceContentProvider.java index 3870c4dd94..c3fb61bf50 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceContentProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceContentProvider.java @@ -35,8 +35,8 @@ import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceType; */ class ImportTraceContentProvider implements ITreeContentProvider { - private final Map fTraceTypes = new HashMap(); - private final Map> fTraceFiles = new HashMap>(); + private final Map fTraceTypes = new HashMap<>(); + private final Map> fTraceFiles = new HashMap<>(); private final List fTraceTypesToScan; private final Set fParentFilesToScan; @@ -91,7 +91,7 @@ class ImportTraceContentProvider implements ITreeContentProvider { @Override public synchronized Object[] getElements(Object inputElement) { - List candidates = new ArrayList(); + List candidates = new ArrayList<>(); for (String candidate : fTraceTypesToScan) { for (Entry entry : fTraceTypes.entrySet()) { @@ -110,7 +110,7 @@ class ImportTraceContentProvider implements ITreeContentProvider { if (parentElement instanceof String) { final Set children = fTraceFiles.get(fTraceTypes.get(parentElement)); if (children != null) { - Set candidates = new TreeSet(); + Set candidates = new TreeSet<>(); for (FileAndName child : children) { for (String parent : fParentFilesToScan) { // this is going to be slow, but less slow than UI diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardPageOptions.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardPageOptions.java index f1b6c9848c..d14812b61f 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardPageOptions.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardPageOptions.java @@ -38,7 +38,7 @@ import org.eclipse.ui.IWorkbench; public class ImportTraceWizardPageOptions extends AbstractImportTraceWizardPage { private List fProjects; - private final Map fProjectsMap = new LinkedHashMap(); + private final Map fProjectsMap = new LinkedHashMap<>(); /** * Import page that tells where the trace will go diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardScanPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardScanPage.java index 775dd15dd0..6a90e3ed5b 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardScanPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardScanPage.java @@ -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 fTracesToScan = new ArrayBlockingQueue(MAX_TRACES); + final private BlockingQueue fTracesToScan = new ArrayBlockingQueue<>(MAX_TRACES); private volatile boolean fCanRun = true; // -------------------------------------------------------------------------------- diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardSelectTraceTypePage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardSelectTraceTypePage.java index 23d2f0676e..ec558bbff4 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardSelectTraceTypePage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardSelectTraceTypePage.java @@ -126,7 +126,7 @@ public class ImportTraceWizardSelectTraceTypePage extends AbstractImportTraceWiz @Override public boolean canFlipToNextPage() { - List tracesToScan = new ArrayList(); + List tracesToScan = new ArrayList<>(); String elements[] = (String[]) fProvider.getElements(null); for (String traceFamily : elements) { final TraceTypeHelper[] children = (TraceTypeHelper[]) fProvider.getChildren(traceFamily); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/TraceTypeContentProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/TraceTypeContentProvider.java index 8303d77c35..cb13d59244 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/TraceTypeContentProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/TraceTypeContentProvider.java @@ -30,8 +30,8 @@ import org.eclipse.linuxtools.tmf.ui.project.model.TraceTypeHelper; */ public class TraceTypeContentProvider implements ITreeContentProvider { - private final List fTraceCategory = new ArrayList(); - private final Map> fTraceType = new HashMap>(); + private final List fTraceCategory = new ArrayList<>(); + private final Map> fTraceType = new HashMap<>(); /** * Default Constructor diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventPropertySource.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventPropertySource.java index 7a66fbcc6b..b1927c07c9 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventPropertySource.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventPropertySource.java @@ -123,7 +123,7 @@ public class TmfEventPropertySource implements IPropertySource { @Override public IPropertyDescriptor[] getPropertyDescriptors() { - List descriptors= new ArrayList(fContent.getFields().length); + List 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 descriptors= new ArrayList(); + List 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 descriptors = new ArrayList(); + List 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 descriptors= new ArrayList(); + List descriptors= new ArrayList<>(); /* Display basic event information */ descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_TIMESTAMP, NAME_TIMESTAMP)); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsCache.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsCache.java index 2ecb6b3ff2..9f6fee6c0a 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsCache.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsCache.java @@ -72,7 +72,7 @@ public class TmfEventsCache { private ITmfTrace fTrace; private final TmfEventsTable fTable; private ITmfFilter fFilter; - private final List fFilterIndex = new ArrayList(); // contains the event rank at each 'cache size' filtered events + private final List fFilterIndex = new ArrayList<>(); // contains the event rank at each 'cache size' filtered events /** * Constructor for the event cache diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java index 1cd957c54f..8d60d593f5 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java @@ -264,7 +264,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS private ListenerList selectionChangedListeners = new ListenerList(); // Bookmark map - private Map fBookmarksMap = new HashMap(); + private Map 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 files = new ArrayList(); + final ArrayList 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 parameters = new HashMap(); + HashMap 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 list = new ArrayList(fTable.getSelection().length); + List list = new ArrayList<>(fTable.getSelection().length); for (TableItem item : fTable.getSelection()) { if (item.getData() != null) { list.add(item.getData()); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java index 004161b813..4b3d045d48 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java @@ -74,14 +74,14 @@ public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider { /** * Level for which statistics should not be displayed. */ - protected Set fFolderLevels = new HashSet(Arrays.asList(new String[] { "Event Types" })); //$NON-NLS-1$ + protected Set 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(); + 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 diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeManager.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeManager.java index 4968a533d5..b54207c9cc 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeManager.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeManager.java @@ -31,7 +31,7 @@ public class TmfStatisticsTreeManager { /** * Contains the experiment name as the key and the traces data */ - private static final Map fTreeInstances = new HashMap(); + private static final Map fTreeInstances = new HashMap<>(); /** * Provide a statisticsTree instance per trace diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeNode.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeNode.java index 2c7f02b911..a33128b43a 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeNode.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeNode.java @@ -71,7 +71,7 @@ public class TmfStatisticsTreeNode { fTree = tree; fPath = path; fParent = parent; - fChildren = new HashMap(); + fChildren = new HashMap<>(); fValues = new TmfStatisticsValues(); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackEntry.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackEntry.java index 27d1fcbad5..b6f446b575 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackEntry.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackEntry.java @@ -37,7 +37,7 @@ public class CallStackEntry implements ITimeGraphEntry { private String fFunctionName; private long fStartTime; private long fEndTime; - private List fEventList = new ArrayList(1); + private List fEventList = new ArrayList<>(1); private List fZoomedEventList = null; /** diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackView.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackView.java index 903aae7249..828ad3b572 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackView.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackView.java @@ -147,16 +147,16 @@ public class CallStackView extends TmfView { private ITmfTrace fTrace; // The selected thread map - private final Map fSelectedThreadMap = new HashMap(); + private final Map fSelectedThreadMap = new HashMap<>(); // The time graph entry list private List fEntryList; // The trace to entry list hash map - private final Map> fEntryListMap = new HashMap>(); + private final Map> fEntryListMap = new HashMap<>(); // The trace to build thread hash map - private final Map fBuildThreadMap = new HashMap(); + private final Map fBuildThreadMap = new HashMap<>(); /** The map to map function addresses to function names */ private Map 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(); + fChildren = new ArrayList<>(); fName = name; fTraceStartTime = startTime; fTraceEndTime = endTime; @@ -784,7 +784,7 @@ public class CallStackView extends TmfView { } else { traces = new ITmfTrace[] { trace }; } - ArrayList entryList = new ArrayList(); + ArrayList 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(entryList)); + fEntryListMap.put(trace, new ArrayList<>(entryList)); } if (trace == fTrace) { refresh(); @@ -866,7 +866,7 @@ public class CallStackView extends TmfView { List eventList = null; try { List stackIntervals = ss.queryHistoryRange(entry.getQuark(), start, end - 1, resolution, monitor); - eventList = new ArrayList(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(); + fEntryList = new ArrayList<>(); } entries = fEntryList.toArray(new ITimeGraphEntry[0]); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/FunctionNameMapper.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/FunctionNameMapper.java index cf8823952b..9c56c8c817 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/FunctionNameMapper.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/FunctionNameMapper.java @@ -31,17 +31,10 @@ import org.eclipse.jdt.annotation.Nullable; class FunctionNameMapper { public static @Nullable Map mapFromNmTextFile(File mappingFile) { - Map map = new HashMap(); + Map 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()) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsManager.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsManager.java index c654ee17f4..a32caf06eb 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsManager.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsManager.java @@ -54,7 +54,7 @@ public class ColorSettingsManager { private static ColorSetting[] fColorSettings = ColorSettingsXML.load(COLOR_SETTINGS_PATH_NAME); // The listener list - private static List fListeners = new ArrayList(); + private static List fListeners = new ArrayList<>(); /** * Returns an array of color settings. diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsXML.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsXML.java index 32382d0a2b..fc9fd9bcb2 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsXML.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsXML.java @@ -163,7 +163,7 @@ public class ColorSettingsXML { // Helper class private static class ColorSettingsContentHandler extends DefaultHandler { - private List colorSettings = new ArrayList(0); + private List 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(); + colorSettings = new ArrayList<>(); } else if (localName.equals(COLOR_SETTING_TAG)) { fg = null; bg = null; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorsView.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorsView.java index 436af2d0f4..4ab20f0232 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorsView.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorsView.java @@ -159,7 +159,7 @@ public class ColorsView extends TmfView { gl.verticalSpacing = 1; fListComposite.setLayout(gl); - fColorSettings = new ArrayList(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(); + fColorSettings = new ArrayList<>(); fSelectedRow = null; } } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterTreeContentProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterTreeContentProvider.java index df038d4aa8..326e43dcca 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterTreeContentProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterTreeContentProvider.java @@ -39,7 +39,7 @@ public class FilterTreeContentProvider implements ITreeContentProvider { @Override public Object[] getElements(Object inputElement) { if (inputElement instanceof ITmfFilterTreeNode) { - ArrayList result = new ArrayList(); + ArrayList 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 result = new ArrayList(); + ArrayList result = new ArrayList<>(); for (int i = 0; i < ((ITmfFilterTreeNode) parentElement).getChildrenCount(); i++) { result.add(((ITmfFilterTreeNode) parentElement).getChild(i)); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java index c5bab071d2..c3701cb2ca 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java @@ -333,7 +333,7 @@ class FilterViewer extends Composite { } protected String[] getFieldsList(ITmfFilterTreeNode node) { - ArrayList fieldsList = new ArrayList(); + ArrayList fieldsList = new ArrayList<>(); ITmfFilterTreeNode curNode = node; while (curNode != null) { if (curNode instanceof TmfFilterEventTypeNode) { @@ -548,7 +548,7 @@ class FilterViewer extends Composite { } protected Map getEventsTypeMap() { - Map eventsTypeMap = new LinkedHashMap(); + Map 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$ diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java index 625058754e..b10a235d22 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java @@ -173,9 +173,9 @@ public class TmfStateSystemExplorer extends TmfView { * sub-tree in the UI thread. */ Map modules = currentTrace.getAnalysisModules(ITmfStateSystemAnalysisModule.class); - final Map sss = new HashMap(); + final Map sss = new HashMap<>(); final Map> fullStates = - new LinkedHashMap>(); + new LinkedHashMap<>(); for (Entry entry : modules.entrySet()) { /* * FIXME: For now, this view is a way to execute and display diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartAnalysisEntry.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartAnalysisEntry.java index ae1bb7636a..627e62ecd8 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartAnalysisEntry.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartAnalysisEntry.java @@ -39,7 +39,7 @@ public class TimeChartAnalysisEntry implements ITimeGraphEntry { TimeChartAnalysisEntry(ITmfTrace trace, int modelSize) { fTrace = trace; - fTraceEvents = new Vector(modelSize); + fTraceEvents = new Vector<>(modelSize); } /** diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartDecorationProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartDecorationProvider.java index 7e0f50bd8c..7978eaabcf 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartDecorationProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartDecorationProvider.java @@ -32,7 +32,7 @@ import org.eclipse.linuxtools.tmf.core.filter.ITmfFilter; public class TimeChartDecorationProvider { private final IFile fBookmarksFile; - private final Set fBookmarksSet = new HashSet(); + private final Set fBookmarksSet = new HashSet<>(); private ITmfFilter fFilterFilter; private ITmfFilter fSearchFilter; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartView.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartView.java index 899b686258..0d9edf9891 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartView.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartView.java @@ -78,9 +78,9 @@ public class TimeChartView extends TmfView implements ITimeGraphRangeListener, I private final int fDisplayWidth; private TimeGraphViewer fViewer; - private final ArrayList fTimeAnalysisEntries = new ArrayList(); - private final Map fDecorationProviders = new HashMap(); - private final ArrayList fDecorateThreads = new ArrayList(); + private final ArrayList fTimeAnalysisEntries = new ArrayList<>(); + private final Map fDecorationProviders = new HashMap<>(); + private final ArrayList fDecorateThreads = new ArrayList<>(); private long fStartTime = 0; private long fStopTime = Long.MAX_VALUE; private boolean fRefreshBusy = false; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java index 99b8d4c19a..3769b46977 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java @@ -101,10 +101,10 @@ public abstract class AbstractTimeGraphView extends TmfView { private List fEntryList; /** The trace to entry list hash map */ - private final Map> fEntryListMap = new HashMap>(); + private final Map> fEntryListMap = new HashMap<>(); /* The trace to build thread hash map */ - private final Map fBuildThreadMap = new HashMap(); + private final Map fBuildThreadMap = new HashMap<>(); /** The start time */ private long fStartTime; @@ -972,7 +972,7 @@ public abstract class AbstractTimeGraphView extends TmfView { */ protected List getLinkList(long startTime, long endTime, long resolution, IProgressMonitor monitor) { - return new ArrayList(); + 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(); + fEntryList = new ArrayList<>(); } entries = fEntryList.toArray(new ITimeGraphEntry[0]); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java index 88da544011..b41887bf18 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java @@ -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(); + 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(); + 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(); + fPrevList = new ArrayList<>(); fPrevList.addAll(getSelection()); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidgetSelectionProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidgetSelectionProvider.java index dcb2cd4008..adc1181c97 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidgetSelectionProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidgetSelectionProvider.java @@ -52,7 +52,7 @@ public class SDWidgetSelectionProvider implements ISelectionProvider { * Standard constructor */ protected SDWidgetSelectionProvider() { - fListenerList = new ArrayList(); + fListenerList = new ArrayList<>(); } // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/TimeCompressionBar.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/TimeCompressionBar.java index 4cdd4febae..8a073ccb26 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/TimeCompressionBar.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/TimeCompressionBar.java @@ -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(); + 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(); + fNodeList = new ArrayList<>(); int messageArraysStep = 1; if ((Metrics.getMessageFontHeigth() + Metrics.MESSAGES_NAME_SPACING * 2) * fZoomValue < Metrics.MESSAGE_SIGNIFICANT_VSPACING + 1) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicFrame.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicFrame.java index de9bbd7be2..c5b1acd170 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicFrame.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicFrame.java @@ -555,11 +555,11 @@ public class BasicFrame extends GraphNode { */ protected List buildTimeArray() { if (!hasChildren()) { - return new ArrayList(); + return new ArrayList<>(); } Iterator it = getForwardSortMap().keySet().iterator(); - List timeArray = new ArrayList(); + List timeArray = new ArrayList<>(); while (it.hasNext()) { String nodeType = it.next(); List list = getNodeMap().get(nodeType); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java index 6c54fde7ef..0c653a5ca7 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java @@ -687,7 +687,7 @@ public class Frame extends BasicFrame { protected List buildTimeArray() { if (!hasChildren()) { - return new ArrayList(); + return new ArrayList<>(); } List 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(); + fExecutionOccurrencesWithTime = new ArrayList<>(); } fExecutionOccurrencesWithTime.add(f); event = eo.getEndOccurrence(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java index 998a51152b..0f24282739 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java @@ -115,12 +115,12 @@ public abstract class GraphNode { */ public void addNode(GraphNode nodeToAdd) { if (!fHasChilden) { - fNodes = new HashMap>(2); - fForwardNodes = new HashMap>(2); - fBackwardNodes = new HashMap>(2); - fIndexes = new HashMap(2); - fBackwardSort = new HashMap(2); - fForwardSort = new HashMap(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(); + fNodeList = new ArrayList<>(); } fNodeList.add(nodeToAdd); @@ -401,7 +401,7 @@ public abstract class GraphNode { * @return the list of nodes */ public List getNodeList(GraphNode from, GraphNode to) { - List result = new ArrayList(); + List result = new ArrayList<>(); if (from != null) { result.add(from); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Lifeline.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Lifeline.java index 35677712ab..ff77a30ec7 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Lifeline.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Lifeline.java @@ -274,7 +274,7 @@ public class Lifeline extends GraphNode { if (hasChildren()) { return getNodeMap().get(BasicExecutionOccurrence.EXEC_OCC_TAG); } - return new ArrayList(); + return new ArrayList<>(); } @Override diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/Criteria.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/Criteria.java index f65b9e23ca..affcd6294e 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/Criteria.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/Criteria.java @@ -325,7 +325,7 @@ public class Criteria { * @return graph node summary */ public String getGraphNodeSummary(ISDFilterProvider provider, String loaderClassName) { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); if (provider != null) { if (isLifeLineSelected()) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/FilterListDialog.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/FilterListDialog.java index e71838e86e..6a1f4128bd 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/FilterListDialog.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/FilterListDialog.java @@ -290,7 +290,7 @@ public class FilterListDialog extends Dialog { @Override public void okPressed() { if (fTable.getItemCount() > 0) { - fFilters = new ArrayList(); + 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 globalFilters = new ArrayList(); + List globalFilters = new ArrayList<>(); if (settings != null) { try { size = settings.getInt(FILTERS_LIST_SIZE); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/SearchFilterDialog.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/SearchFilterDialog.java index e484207ed4..49bb51690a 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/SearchFilterDialog.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/SearchFilterDialog.java @@ -296,7 +296,7 @@ public class SearchFilterDialog extends Dialog { fCriteria.save(section); if (fCriteria.getExpression().length() > 0) { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); for (int i = 0; i < fExpressionList.length; i++) { list.add(fExpressionList[i]); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/handlers/KeyBindingsManager.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/handlers/KeyBindingsManager.java index 58c88d51d4..067bd120cd 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/handlers/KeyBindingsManager.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/handlers/KeyBindingsManager.java @@ -49,11 +49,11 @@ public class KeyBindingsManager { /** * The list of view names. */ - private Set fViews = new HashSet(); + private Set fViews = new HashSet<>(); /** * The list of activations Activations to store */ - private List fHandlerActivations = new ArrayList(); + private List fHandlerActivations = new ArrayList<>(); /** * The action reference for moving to a message in view. */ diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java index 86fab0a55a..6efc65ab6f 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java @@ -64,11 +64,11 @@ public class LoadersManager { /** * Map for caching information (view ID to loader class) */ - private Map fViewLoaderMap = new HashMap(); + private Map fViewLoaderMap = new HashMap<>(); /** * Map for caching information (view ID to list of configuration elements) */ - private Map> fViewLoadersList = new HashMap>(); + private Map> fViewLoadersList = new HashMap<>(); // ------------------------------------------------------------------------ // Constructor @@ -310,7 +310,7 @@ public class LoadersManager { return list; } - ArrayList ret = new ArrayList(); + ArrayList ret = new ArrayList<>(); IExtensionPoint iep = Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID, LOADER_TAG); if (iep == null) { return ret; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java index 3c7c2d2eaa..c862498839 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java @@ -152,13 +152,13 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader, /** * The list of sequence diagram events of current page. */ - protected List fEvents = new ArrayList(); + protected List 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 fCheckPoints = new ArrayList(MAX_NUM_OF_MSG); + protected List 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 fFindResults = new ArrayList(); + protected List 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 fSdEvents = new ArrayList(MAX_NUM_OF_MSG); + private final List 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(); + 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 msgs = new ArrayList(); + ArrayList 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(); + fFilterCriteria = new ArrayList<>(); } else { List list = filters; - fFilterCriteria = new ArrayList(list); + fFilterCriteria = new ArrayList<>(list); } fillCurrentPage(fEvents); @@ -862,7 +862,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader, fLock.lock(); try { - fEvents = new ArrayList(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 nodeToLifelineMap = new HashMap(); + Map 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 fSdEvent = new ArrayList(); + private final List fSdEvent = new ArrayList<>(); @Override public void handleData(ITmfEvent event) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/preferences/SDViewPref.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/preferences/SDViewPref.java index f1007e6edb..bc720fba29 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/preferences/SDViewPref.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/preferences/SDViewPref.java @@ -138,10 +138,10 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener { fPrefStore.setDefault(PREF_USE_GRADIENT, true); fPrefStore.setDefault(PREF_TOOLTIP, true); - fFontPref = new Hashtable(); - fForeColorPref = new Hashtable(); - fBackColorPref = new Hashtable(); - fTextColorPref = new Hashtable(); + 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)) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/rawviewer/TmfRawEventViewer.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/rawviewer/TmfRawEventViewer.java index 84960c55c5..93a93eda81 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/rawviewer/TmfRawEventViewer.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/rawviewer/TmfRawEventViewer.java @@ -80,7 +80,7 @@ public class TmfRawEventViewer extends Composite implements ControlListener, Sel private Font fFixedFont; private Slider fSlider; - private final List fLines = new ArrayList(); + private final List fLines = new ArrayList<>(); private boolean fActualRanks = false; private int fTopLineIndex; private int fLastTopLineIndex; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/tabsview/TmfViewerFolder.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/tabsview/TmfViewerFolder.java index 20048067d0..753d783dd5 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/tabsview/TmfViewerFolder.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/tabsview/TmfViewerFolder.java @@ -67,7 +67,7 @@ public class TmfViewerFolder extends Composite { super(parent, style); setLayout(new FillLayout()); - fViewers = new HashMap(); + fViewers = new HashMap<>(); initFolder(); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphCombo.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphCombo.java index f19cd1d23c..f537442eb6 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphCombo.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphCombo.java @@ -93,10 +93,10 @@ public class TimeGraphCombo extends Composite { private List fTopInput; /** The selection listener map */ - private final Map fSelectionListenerMap = new HashMap(); + private final Map fSelectionListenerMap = new HashMap<>(); /** The map of viewer filters */ - private final Map fViewerFilterMap = new HashMap(); + private final Map 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 nonFilteredElements = new ArrayList(allElements); + ArrayList 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 null if none */ public void setInput(ITimeGraphEntry[] input) { - fTopInput = new ArrayList(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 getVisibleExpandedItems(Tree tree) { - ArrayList items = new ArrayList(); + ArrayList items = new ArrayList<>(); for (TreeItem item : tree.getItems()) { if (item.getData() == FILLER) { break; @@ -1007,7 +1007,7 @@ public class TimeGraphCombo extends Composite { } private List getVisibleExpandedItems(TreeItem treeItem) { - ArrayList items = new ArrayList(); + ArrayList 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 listAllInputs(List inputs) { - ArrayList items = new ArrayList(); + ArrayList items = new ArrayList<>(); for (ITimeGraphEntry entry : inputs) { items.add(entry); if (entry.hasChildren()) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphPresentationProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphPresentationProvider.java index 93c4c49430..05d11bbb46 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphPresentationProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphPresentationProvider.java @@ -39,7 +39,7 @@ public class TimeGraphPresentationProvider implements ITimeGraphPresentationProv private final String fStateTypeName; // The list of listeners for graph color changes - private final List fListeners = new ArrayList(); + private final List fListeners = new ArrayList<>(); // ------------------------------------------------------------------------ // Constants diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphViewer.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphViewer.java index ead804c876..c341faee8f 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphViewer.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphViewer.java @@ -97,9 +97,9 @@ public class TimeGraphViewer implements ITimeDataProvider2, SelectionListener { private TimeGraphColorScheme fColorScheme; private ITimeGraphPresentationProvider fTimeGraphProvider; - private List fSelectionListeners = new ArrayList(); - private List fTimeListeners = new ArrayList(); - private List fRangeListeners = new ArrayList(); + private List fSelectionListeners = new ArrayList<>(); + private List fTimeListeners = new ArrayList<>(); + private List fRangeListeners = new ArrayList<>(); // Time format, using Epoch reference, Relative time format(default) or // Number diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/dialogs/TimeGraphFilterDialog.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/dialogs/TimeGraphFilterDialog.java index 214938373b..b2b1c8d3a8 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/dialogs/TimeGraphFilterDialog.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/dialogs/TimeGraphFilterDialog.java @@ -107,7 +107,7 @@ public class TimeGraphFilterDialog extends SelectionStatusDialog { */ public TimeGraphFilterDialog(Shell parent) { super(parent); - setResult(new ArrayList(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(); + fFilters = new ArrayList<>(); } fFilters.add(filter); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeEvent.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeEvent.java index cf47461162..7dc8ba571d 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeEvent.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeEvent.java @@ -121,7 +121,7 @@ public class TimeEvent implements ITimeEvent2 { */ @Override public Pair split(long time) { - Pair pair = new Pair(); + Pair pair = new Pair<>(); if (time > fTime) { pair.setFirst(new TimeEvent(fEntry, fTime, Math.min(fDuration, time - fTime), fValue)); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java index cd4242bcf6..995828634d 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java @@ -28,14 +28,14 @@ public class TimeGraphEntry implements ITimeGraphEntry { private TimeGraphEntry fParent = null; /** List of child entries */ - private final List fChildren = new ArrayList(); + private final List fChildren = new ArrayList<>(); /** Name of this entry (text to show) */ private String fName; private long fStartTime = -1; private long fEndTime = -1; - private List fEventList = new ArrayList(); - private List fZoomedEventList = new ArrayList(); + private List fEventList = new ArrayList<>(); + private List fZoomedEventList = new ArrayList<>(); /** * Constructor @@ -156,9 +156,9 @@ public class TimeGraphEntry implements ITimeGraphEntry { */ public void setEventList(List eventList) { if (eventList != null) { - fEventList = new ArrayList(eventList); + fEventList = new ArrayList<>(eventList); } else { - fEventList = new ArrayList(); + fEventList = new ArrayList<>(); } } @@ -170,9 +170,9 @@ public class TimeGraphEntry implements ITimeGraphEntry { */ public void setZoomedEventList(List eventList) { if (eventList != null) { - fZoomedEventList = new ArrayList(eventList); + fZoomedEventList = new ArrayList<>(eventList); } else { - fZoomedEventList = new ArrayList(); + fZoomedEventList = new ArrayList<>(); } } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java index bd7fc41dcf..11b27b2675 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java @@ -131,15 +131,15 @@ public class TimeGraphControl extends TimeGraphBaseControl private ITimeGraphPresentationProvider fTimeGraphProvider = null; private ItemData fItemData = null; private List fSelectionListeners; - private final List fSelectionChangedListeners = new ArrayList(); - private final List fTreeListeners = new ArrayList(); - private final List fTimeGraphEntryMenuListeners = new ArrayList(); - private final List fTimeEventMenuListeners = new ArrayList(); + private final List fSelectionChangedListeners = new ArrayList<>(); + private final List fTreeListeners = new ArrayList<>(); + private final List fTimeGraphEntryMenuListeners = new ArrayList<>(); + private final List 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 fFilters = new ArrayList(); + private final List 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(); + fSelectionListeners = new ArrayList<>(); } fSelectionListeners.add(listener); } @@ -1162,7 +1162,7 @@ public class TimeGraphControl extends TimeGraphBaseControl * @return The expanded elements */ public ITimeGraphEntry[] getExpandedElements() { - ArrayList elements = new ArrayList(); + ArrayList 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 fLinks = new ArrayList(); + private List fLinks = new ArrayList<>(); private boolean fTraceFilter[] = new boolean[0]; - private final ArrayList fFilteredOut = new ArrayList(); + private final ArrayList fFilteredOut = new ArrayList<>(); public ItemData() { } @@ -2474,7 +2474,7 @@ public class TimeGraphControl extends TimeGraphBaseControl } public void refreshData() { - List itemList = new ArrayList(); + List 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 expandedItemList = new ArrayList(); + List 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(); + 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(); + this.fChildren = new ArrayList<>(); } @Override diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphSelection.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphSelection.java index 6e9fd39c62..c42129fb56 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphSelection.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphSelection.java @@ -29,7 +29,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; */ public class TimeGraphSelection implements IStructuredSelection { - private List list = new ArrayList(); + private List list = new ArrayList<>(); /** * Default constructor -- 2.34.1