From 6ac5654db62a138703356d3d9f6074228ac01ae6 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Thu, 29 Mar 2018 12:44:34 +0300 Subject: Bug 533053 - Remove redundant type arguments in o.e.ui.console And remove useless non-javadoc see tags. Change-Id: I0205fa4506bd2d869923c56b286806a5f89503c1 Signed-off-by: Alexander Kurtakov --- .../.settings/org.eclipse.jdt.core.prefs | 16 +++++- .../src/org/eclipse/ui/console/IOConsole.java | 10 +--- .../src/org/eclipse/ui/console/TextConsole.java | 5 +- .../org/eclipse/ui/console/TextConsolePage.java | 59 ++++----------------- .../org/eclipse/ui/console/TextConsoleViewer.java | 4 +- .../internal/console/ConsoleDocumentAdapter.java | 46 +---------------- .../ui/internal/console/ConsoleManager.java | 51 +++++------------- .../ui/internal/console/ConsolePatternMatcher.java | 19 +------ .../eclipse/ui/internal/console/ConsoleView.java | 29 +++++------ .../ui/internal/console/IOConsolePartitioner.java | 60 +++------------------- 10 files changed, 64 insertions(+), 235 deletions(-) diff --git a/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs index 8f1fe1b71..03a7213cd 100644 --- a/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs @@ -11,8 +11,11 @@ org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate @@ -24,6 +27,7 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.APILeak=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore @@ -35,7 +39,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod= org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=error org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning @@ -74,19 +78,21 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=error org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore @@ -96,12 +102,16 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore @@ -110,6 +120,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedImport=error org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning @@ -122,6 +133,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java index b07d283b6..cc4a386d9 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -144,9 +144,6 @@ public class IOConsole extends TextConsole { this(name, null, imageDescriptor); } - /* (non-Javadoc) - * @see org.eclipse.ui.console.IConsole#createPage(org.eclipse.ui.console.IConsoleView) - */ @Override public IPageBookViewPage createPage(IConsoleView view) { return new IOConsolePage(this, view); @@ -281,9 +278,6 @@ public class IOConsole extends TextConsole { } } - /* (non-Javadoc) - * @see org.eclipse.ui.console.TextConsole#clearConsole() - */ @Override public void clearConsole() { if (partitioner != null) { @@ -301,7 +295,7 @@ public class IOConsole extends TextConsole { //make a copy of the open streams and close them all //a copy is needed as close the streams results in a callback that //removes the streams from the openStreams collection (bug 152794) - List list = new ArrayList(openStreams); + List list = new ArrayList<>(openStreams); for (Closeable closable : list) { try { closable.close(); diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java index 9b7ac7046..8aaa63554 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java @@ -99,7 +99,7 @@ public abstract class TextConsole extends AbstractConsole { /** * Map of client defined attributes */ - private HashMap fAttributes = new HashMap(); + private HashMap fAttributes = new HashMap<>(); private IConsoleManager fConsoleManager = ConsolePlugin.getDefault().getConsoleManager(); private ScopedPreferenceStore store; @@ -134,9 +134,6 @@ public abstract class TextConsole extends AbstractConsole { fTabWidth = IConsoleConstants.DEFAULT_TAB_SIZE; } - /* (non-Javadoc) - * @see org.eclipse.ui.console.IConsole#createPage(org.eclipse.ui.console.IConsoleView) - */ @Override public IPageBookViewPage createPage(IConsoleView view) { return new TextConsolePage(this, view); diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java index df08b019c..6f07915e7 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java @@ -17,13 +17,7 @@ import java.util.HashMap; import java.util.Map; import java.util.ResourceBundle; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Widget; - import org.eclipse.core.runtime.IAdaptable; - import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; @@ -31,17 +25,19 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.SelectionChangedEvent; - import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IFindReplaceTarget; import org.eclipse.jface.text.ITextListener; import org.eclipse.jface.text.ITextOperationTarget; import org.eclipse.jface.text.TextEvent; - +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Widget; import org.eclipse.ui.IActionBars; import org.eclipse.ui.ISharedImages; import org.eclipse.ui.IWorkbenchActionConstants; @@ -56,7 +52,6 @@ import org.eclipse.ui.internal.console.FollowHyperlinkAction; import org.eclipse.ui.internal.console.IConsoleHelpContextIds; import org.eclipse.ui.part.IPageBookViewPage; import org.eclipse.ui.part.IPageSite; - import org.eclipse.ui.texteditor.FindReplaceAction; import org.eclipse.ui.texteditor.IUpdate; @@ -80,8 +75,8 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen private IConsoleView fConsoleView; private TextConsoleViewer fViewer; private MenuManager fMenuManager; - protected Map fGlobalActions = new HashMap(); - protected ArrayList fSelectionActions = new ArrayList(); + protected Map fGlobalActions = new HashMap<>(); + protected ArrayList fSelectionActions = new ArrayList<>(); protected ClearOutputAction fClearOutputAction; // text selection listener, used to update selection dependent actions on selection changes @@ -131,19 +126,11 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen return new TextConsoleViewer(parent, fConsole, fConsoleView); } - /* - * (non-Javadoc) - * @see org.eclipse.ui.part.IPageBookViewPage#getSite() - */ @Override public IPageSite getSite() { return fSite; } - /* - * (non-Javadoc) - * @see org.eclipse.ui.part.IPageBookViewPage#init(org.eclipse.ui.part.IPageSite) - */ @Override public void init(IPageSite pageSite) throws PartInitException { fSite = pageSite; @@ -158,10 +145,6 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen } } - /* - * (non-Javadoc) - * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite) - */ @Override public void createControl(Composite parent) { fViewer = createViewer(parent); @@ -195,10 +178,6 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen fViewer.addTextListener(textListener); } - /* - * (non-Javadoc) - * @see org.eclipse.ui.part.IPage#dispose() - */ @Override public void dispose() { fConsole.removePropertyChangeListener(this); @@ -216,26 +195,15 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen fViewer = null; } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.part.IPage#getControl() - */ @Override public Control getControl() { return fViewer != null ? fViewer.getControl() : null; } - /* (non-Javadoc) - * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars) - */ @Override public void setActionBars(IActionBars actionBars) { } - /* (non-Javadoc) - * @see org.eclipse.ui.part.IPage#setFocus() - */ @Override public void setFocus() { if (fViewer != null) { @@ -243,10 +211,6 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen } } - /* - * (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ @Override public void propertyChange(PropertyChangeEvent event) { if (fViewer != null) { @@ -331,9 +295,6 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen actionBars.setGlobalActionHandler(actionID, action); } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ @SuppressWarnings("unchecked") @Override public T getAdapter(Class required) { diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java index 9991f3519..ea849d651 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java @@ -385,7 +385,7 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener public void lineGetStyle(LineStyleEvent event) { IDocument document = getDocument(); if (document != null && document.getLength() > 0) { - ArrayList ranges = new ArrayList(); + ArrayList ranges = new ArrayList<>(); int offset = event.lineOffset; int length = event.lineText.length(); @@ -501,7 +501,7 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener } } - List list = new ArrayList(); + List list = new ArrayList<>(); int index = left - 1; if (index >= 0) { position = positions[index]; diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java index 564074ac7..73c78b01d 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -47,7 +47,7 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen public ConsoleDocumentAdapter(int width) { - textChangeListeners = new ArrayList(); + textChangeListeners = new ArrayList<>(); consoleWidth = width; } @@ -122,9 +122,6 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen regionCount++; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocumentAdapter#setDocument(org.eclipse.jface.text.IDocument) - */ @Override public void setDocument(IDocument doc) { if (document != null) { @@ -139,9 +136,6 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen } } - /* (non-Javadoc) - * @see org.eclipse.swt.custom.StyledTextContent#addTextChangeListener(org.eclipse.swt.custom.TextChangeListener) - */ @Override public synchronized void addTextChangeListener(TextChangeListener listener) { Assert.isNotNull(listener); @@ -150,9 +144,6 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen } } - /* (non-Javadoc) - * @see org.eclipse.swt.custom.StyledTextContent#removeTextChangeListener(org.eclipse.swt.custom.TextChangeListener) - */ @Override public synchronized void removeTextChangeListener(TextChangeListener listener) { if(textChangeListeners != null) { @@ -161,17 +152,11 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen } } - /* (non-Javadoc) - * @see org.eclipse.swt.custom.StyledTextContent#getCharCount() - */ @Override public int getCharCount() { return document.getLength(); } - /* (non-Javadoc) - * @see org.eclipse.swt.custom.StyledTextContent#getLine(int) - */ @Override public String getLine(int lineIndex) { try { @@ -186,9 +171,6 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen return ""; //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.swt.custom.StyledTextContent#getLineAtOffset(int) - */ @Override public int getLineAtOffset(int offset) { if (offset == 0 || regionCount <= 1) { @@ -221,33 +203,21 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen return midIndex; } - /* (non-Javadoc) - * @see org.eclipse.swt.custom.StyledTextContent#getLineCount() - */ @Override public int getLineCount() { return regionCount; } - /* (non-Javadoc) - * @see org.eclipse.swt.custom.StyledTextContent#getLineDelimiter() - */ @Override public String getLineDelimiter() { return System.getProperty("line.separator"); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.swt.custom.StyledTextContent#getOffsetAtLine(int) - */ @Override public int getOffsetAtLine(int lineIndex) { return offsets[lineIndex]; } - /* (non-Javadoc) - * @see org.eclipse.swt.custom.StyledTextContent#getTextRange(int, int) - */ @Override public String getTextRange(int start, int length) { try { @@ -257,9 +227,6 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen return null; } - /* (non-Javadoc) - * @see org.eclipse.swt.custom.StyledTextContent#replaceTextRange(int, int, java.lang.String) - */ @Override public void replaceTextRange(int start, int replaceLength, String text) { try { @@ -268,9 +235,6 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen } } - /* (non-Javadoc) - * @see org.eclipse.swt.custom.StyledTextContent#setText(java.lang.String) - */ @Override public synchronized void setText(String text) { TextChangedEvent changeEvent = new TextChangedEvent(this); @@ -279,9 +243,6 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen } } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent) - */ @Override public synchronized void documentAboutToBeChanged(DocumentEvent event) { if (document == null) { @@ -372,9 +333,6 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent) - */ @Override public synchronized void documentChanged(DocumentEvent event) { if (document == null) { diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java index faaac740b..fafed20a3 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -63,7 +63,7 @@ public class ConsoleManager implements IConsoleManager { /** * List of registered consoles */ - private List fConsoles = new ArrayList(10); + private List fConsoles = new ArrayList<>(10); // change notification constants @@ -76,14 +76,14 @@ public class ConsoleManager implements IConsoleManager { private List fConsoleFactoryExtensions; - private List fConsoleViews = new ArrayList(); + private List fConsoleViews = new ArrayList<>(); private boolean fWarnQueued = false; private RepaintJob fRepaintJob = new RepaintJob(); private class RepaintJob extends WorkbenchJob { - private Set list = new HashSet(); + private Set list = new HashSet<>(); public RepaintJob() { super("schedule redraw() of viewers"); //$NON-NLS-1$ @@ -138,18 +138,12 @@ public class ConsoleManager implements IConsoleManager { private int fType; private IConsole[] fChanged; - /* (non-Javadoc) - * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable) - */ @Override public void handleException(Throwable exception) { IStatus status = new Status(IStatus.ERROR, ConsolePlugin.getUniqueIdentifier(), IConsoleConstants.INTERNAL_ERROR, ConsoleMessages.ConsoleManager_0, exception); ConsolePlugin.log(status); } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.ISafeRunnable#run() - */ @Override public void run() throws Exception { switch (fType) { @@ -196,9 +190,6 @@ public class ConsoleManager implements IConsoleManager { } } - /* (non-Javadoc) - * @see org.eclipse.ui.console.IConsoleManager#addConsoleListener(org.eclipse.ui.console.IConsoleListener) - */ @Override public void addConsoleListener(IConsoleListener listener) { if (fListeners == null) { @@ -207,9 +198,6 @@ public class ConsoleManager implements IConsoleManager { fListeners.add(listener); } - /* (non-Javadoc) - * @see org.eclipse.ui.console.IConsoleManager#removeConsoleListener(org.eclipse.ui.console.IConsoleListener) - */ @Override public void removeConsoleListener(IConsoleListener listener) { if (fListeners != null) { @@ -217,12 +205,9 @@ public class ConsoleManager implements IConsoleManager { } } - /* (non-Javadoc) - * @see org.eclipse.ui.console.IConsoleManager#addConsoles(org.eclipse.ui.console.IConsole[]) - */ @Override public void addConsoles(IConsole[] consoles) { - List added = new ArrayList(consoles.length); + List added = new ArrayList<>(consoles.length); synchronized (fConsoles) { for (int i = 0; i < consoles.length; i++) { IConsole console = consoles[i]; @@ -241,12 +226,9 @@ public class ConsoleManager implements IConsoleManager { } } - /* (non-Javadoc) - * @see org.eclipse.ui.console.IConsoleManager#removeConsoles(org.eclipse.ui.console.IConsole[]) - */ @Override public void removeConsoles(IConsole[] consoles) { - List removed = new ArrayList(consoles.length); + List removed = new ArrayList<>(consoles.length); synchronized (fConsoles) { for (int i = 0; i < consoles.length; i++) { IConsole console = consoles[i]; @@ -260,9 +242,6 @@ public class ConsoleManager implements IConsoleManager { } } - /* (non-Javadoc) - * @see org.eclipse.ui.console.IConsoleManager#getConsoles() - */ @Override public IConsole[] getConsoles() { synchronized (fConsoles) { @@ -282,7 +261,7 @@ public class ConsoleManager implements IConsoleManager { private class ShowConsoleViewJob extends WorkbenchJob { - private Set queue = new LinkedHashSet(); + private Set queue = new LinkedHashSet<>(); ShowConsoleViewJob() { super("Show Console View"); //$NON-NLS-1$ @@ -380,9 +359,6 @@ public class ConsoleManager implements IConsoleManager { return bringToTop; } - /* (non-Javadoc) - * @see org.eclipse.ui.console.IConsoleManager#warnOfContentChange(org.eclipse.ui.console.IConsole) - */ @Override public void warnOfContentChange(final IConsole console) { if (!fWarnQueued) { @@ -409,13 +385,10 @@ public class ConsoleManager implements IConsoleManager { } } - /* (non-Javadoc) - * @see org.eclipse.ui.console.IConsoleManager#getPatternMatchListenerDelegates(org.eclipse.ui.console.IConsole) - */ @Override public IPatternMatchListener[] createPatternMatchListeners(IConsole console) { if (fPatternMatchListeners == null) { - fPatternMatchListeners = new ArrayList(); + fPatternMatchListeners = new ArrayList<>(); IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(ConsolePlugin.getUniqueIdentifier(), IConsoleConstants.EXTENSION_POINT_CONSOLE_PATTERN_MATCH_LISTENERS); IConfigurationElement[] elements = extensionPoint.getConfigurationElements(); for (int i = 0; i < elements.length; i++) { @@ -424,7 +397,7 @@ public class ConsoleManager implements IConsoleManager { fPatternMatchListeners.add(extension); } } - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); for (Iterator i = fPatternMatchListeners.iterator(); i.hasNext();) { PatternMatchListenerExtension extension = i.next(); try { @@ -456,7 +429,7 @@ public class ConsoleManager implements IConsoleManager { */ public IConsolePageParticipant[] getPageParticipants(IConsole console) { if(fPageParticipants == null) { - fPageParticipants = new ArrayList(); + fPageParticipants = new ArrayList<>(); IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(ConsolePlugin.getUniqueIdentifier(), IConsoleConstants.EXTENSION_POINT_CONSOLE_PAGE_PARTICIPANTS); IConfigurationElement[] elements = extensionPoint.getConfigurationElements(); for(int i = 0; i < elements.length; i++) { @@ -465,7 +438,7 @@ public class ConsoleManager implements IConsoleManager { fPageParticipants.add(extension); } } - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); for (Iterator i = fPageParticipants.iterator(); i.hasNext();) { ConsolePageParticipantExtension extension = i.next(); try { @@ -484,7 +457,7 @@ public class ConsoleManager implements IConsoleManager { */ public ConsoleFactoryExtension[] getConsoleFactoryExtensions() { if (fConsoleFactoryExtensions == null) { - fConsoleFactoryExtensions = new ArrayList(); + fConsoleFactoryExtensions = new ArrayList<>(); IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(ConsolePlugin.getUniqueIdentifier(), IConsoleConstants.EXTENSION_POINT_CONSOLE_FACTORIES); IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements(); for (int i = 0; i < configurationElements.length; i++) { diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java index 5344e375a..101736bec 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,7 +36,7 @@ public class ConsolePatternMatcher implements IDocumentListener { /** * Collection of compiled pattern match listeners */ - private ArrayList fPatterns = new ArrayList(); + private ArrayList fPatterns = new ArrayList<>(); private TextConsole fConsole; @@ -56,11 +56,6 @@ public class ConsolePatternMatcher implements IDocumentListener { setRule(fConsole.getSchedulingRule()); } - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) - */ @Override protected IStatus run(IProgressMonitor monitor) { IDocument doc = fConsole.getDocument(); @@ -265,20 +260,10 @@ public class ConsolePatternMatcher implements IDocumentListener { } } - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent) - */ @Override public void documentAboutToBeChanged(DocumentEvent event) { } - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent) - */ @Override public void documentChanged(DocumentEvent event) { if (event.fLength > 0) { diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java index 6f4af49a2..a69f1ed96 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java @@ -17,20 +17,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.ToolBar; -import org.eclipse.swt.widgets.ToolItem; - import org.eclipse.core.runtime.ISafeRunnable; import org.eclipse.core.runtime.ListenerList; import org.eclipse.core.runtime.SafeRunner; - import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IToolBarManager; @@ -40,7 +29,15 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.IBasicPropertyConstants; - +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; import org.eclipse.ui.IPartListener2; import org.eclipse.ui.IViewReference; import org.eclipse.ui.IViewSite; @@ -80,7 +77,7 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL /** * Stack of consoles in MRU order */ - private List fStack = new ArrayList(); + private List fStack = new ArrayList<>(); /** * The console being displayed, or null if none @@ -445,9 +442,9 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL */ public ConsoleView() { super(); - fConsoleToPart = new HashMap(); - fPartToConsole = new HashMap(); - fConsoleToPageParticipants = new HashMap>(); + fConsoleToPart = new HashMap<>(); + fPartToConsole = new HashMap<>(); + fConsoleToPageParticipants = new HashMap<>(); ConsoleManager consoleManager = (ConsoleManager) ConsolePlugin.getDefault().getConsoleManager(); consoleManager.registerConsoleView(this); diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java index d1555bad4..f71fab026 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -109,18 +109,14 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum return document; } - /* - * (non-Javadoc) - * @see org.eclipse.jface.text.IDocumentPartitioner#connect(org.eclipse.jface.text.IDocument) - */ @Override public void connect(IDocument doc) { document = doc; document.setDocumentPartitioner(this); lld = document.getLegalLineDelimiters(); - partitions = new ArrayList(); - pendingPartitions = new ArrayList(); - inputPartitions = new ArrayList(); + partitions = new ArrayList<>(); + pendingPartitions = new ArrayList<>(); + inputPartitions = new ArrayList<>(); queueJob = new QueueProcessingJob(); queueJob.setSystem(true); queueJob.setPriority(Job.INTERACTIVE); @@ -158,10 +154,6 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum queueJob.schedule(); //ensure that all pending partitions are processed. } - /* - * (non-Javadoc) - * @see org.eclipse.jface.text.IDocumentPartitioner#disconnect() - */ @Override public void disconnect() { synchronized (overflowLock) { @@ -175,45 +167,25 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum } } - /* - * (non-Javadoc) - * @see org.eclipse.jface.text.IDocumentPartitioner#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent) - */ @Override public void documentAboutToBeChanged(DocumentEvent event) { } - /* - * (non-Javadoc) - * @see org.eclipse.jface.text.IDocumentPartitioner#documentChanged(org.eclipse.jface.text.DocumentEvent) - */ @Override public boolean documentChanged(DocumentEvent event) { return documentChanged2(event) != null; } - /* - * (non-Javadoc) - * @see org.eclipse.jface.text.IDocumentPartitioner#getLegalContentTypes() - */ @Override public String[] getLegalContentTypes() { return new String[] { IOConsolePartition.OUTPUT_PARTITION_TYPE, IOConsolePartition.INPUT_PARTITION_TYPE }; } - /* - * (non-Javadoc) - * @see org.eclipse.jface.text.IDocumentPartitioner#getContentType(int) - */ @Override public String getContentType(int offset) { return getPartition(offset).getType(); } - /* - * (non-Javadoc) - * @see org.eclipse.jface.text.IDocumentPartitioner#computePartitioning(int, int) - */ @Override public ITypedRegion[] computePartitioning(int offset, int length) { int rangeEnd = offset + length; @@ -248,7 +220,7 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum } - List list = new ArrayList(); + List list = new ArrayList<>(); int index = left - 1; if (index >= 0) { position= partitions.get(index); @@ -272,11 +244,6 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum return list.toArray(new IOConsolePartition[list.size()]); } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.text.IDocumentPartitioner#getPartition(int) - */ @Override public ITypedRegion getPartition(int offset) { for (int i = 0; i < partitions.size(); i++) { @@ -327,11 +294,6 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum } } - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.IDocumentPartitionerExtension#documentChanged2(org.eclipse.jface.text.DocumentEvent) - */ @Override public IRegion documentChanged2(DocumentEvent event) { if (document == null) { @@ -521,10 +483,6 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum super("IOConsole Updater"); //$NON-NLS-1$ } - /* - * (non-Javadoc) - * @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor) - */ @Override public IStatus runInUIThread(IProgressMonitor monitor) { processQueue(); @@ -547,7 +505,7 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum void processQueue() { synchronized (overflowLock) { - ArrayList pendingCopy = new ArrayList(); + ArrayList pendingCopy = new ArrayList<>(); StringBuffer buffer = null; boolean consoleClosed = false; synchronized(pendingPartitions) { @@ -673,17 +631,11 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum } } - /* (non-Javadoc) - * @see org.eclipse.ui.console.IConsoleDocumentPartitioner#isReadOnly(int) - */ @Override public boolean isReadOnly(int offset) { return ((IOConsolePartition)getPartition(offset)).isReadOnly(); } - /* (non-Javadoc) - * @see org.eclipse.ui.console.IConsoleDocumentPartitioner#computeStyleRange(int, int) - */ @Override public StyleRange[] getStyleRanges(int offset, int length) { if (!connected) { -- cgit v1.2.3