From ca3aa5de95293b1ed54074d95175d7dcad11e286 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Tue, 1 Dec 2015 13:09:03 +0200 Subject: [PATCH] autotools: Cosmetics. Various small readability improvements in autotools.ui bundle: * Remove useless comments * Remove methods merely calling super(). * Use SelectionAdapter when only one method of SelectionListener implemented * Multi-catch exceptions * Specialize return types to reduce casting after that * Remove commented code * Remove unused methods * Use String.isEmpty Change-Id: Iacda4094ee8b3bf80e1509cc3b39f55b6fcb96c9 Signed-off-by: Alexander Kurtakov --- .../ui/editors/AutoconfDocumentProvider.java | 10 -- .../autotools/ui/editors/AutoconfEditor.java | 4 - .../cdt/internal/autotools/ui/Console.java | 8 -- .../autotools/ui/ErrorParserBlock.java | 1 - .../AbstractElementListSelectionDialog.java | 11 +-- .../ui/editors/automake/AutomakeEditor.java | 5 +- .../automake/AutomakeEditorFactory.java | 4 +- .../automake/ElementListSelectionDialog.java | 7 -- .../ui/editors/automake/GNUAutomakefile.java | 4 +- .../automake/OpenDeclarationAction.java | 9 -- .../automake/SelectionStatusDialog.java | 9 -- .../autotools/ui/editors/automake/Util.java | 4 - .../AutoconfEditorPreferencePage.java | 38 ++------ .../AutomakeEditorPreferencePage.java | 26 +---- .../preferences/OverlayPreferenceStore.java | 96 ------------------- .../AutotoolsBuildPropertyPage.java | 8 +- .../ui/text/hover/AutoconfTextHover.java | 30 +----- .../wizards/AutotoolsProjectImportWizard.java | 4 +- .../ConvertToAutotoolsProjectWizard.java | 4 +- 19 files changed, 26 insertions(+), 256 deletions(-) diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentProvider.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentProvider.java index d3f07e3c65e..3ebef522561 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentProvider.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentProvider.java @@ -12,7 +12,6 @@ package org.eclipse.cdt.autotools.ui.editors; import java.util.Iterator; -import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.IDocument; import org.eclipse.ui.editors.text.TextFileDocumentProvider; @@ -25,15 +24,6 @@ public class AutoconfDocumentProvider extends TextFileDocumentProvider { disconnect(e.next()); } - @Override - public void connect(Object element) throws CoreException { - super.connect(element); - // Remove all error markers for file as we will parse - // from scratch. -// AutoconfErrorHandler h = new AutoconfErrorHandler(getDocument(element)); -// h.removeAllExistingMarkers(); - } - @Override public IDocument getDocument(Object element) { FileInfo info= getFileInfo(element); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditor.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditor.java index e794e294565..d20c2c08b86 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditor.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditor.java @@ -362,10 +362,6 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro return fHoverInfo.toString(); } - /* - * @see org.eclipse.jface.text.information.IInformationProviderExtension#getInformation2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion) - * @since 3.2 - */ @Override public Object getInformation2(ITextViewer textViewer, IRegion subject) { return fHoverInfo; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/Console.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/Console.java index ec363d5004a..5439a30b2c0 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/Console.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/Console.java @@ -26,14 +26,6 @@ public class Console implements IConsole { contextId); } -// /** -// * Constructor for ConfigureConsole. -// */ -// public CConfigureConsole() { -// fConsoleManager = AutotoolsPlugin.getDefault().getConsoleManager(); -// } -// - @Override public void start(IProject project ) { this.project = project; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ErrorParserBlock.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ErrorParserBlock.java index 1ecec7bbeb2..4cfc6dd8ee0 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ErrorParserBlock.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ErrorParserBlock.java @@ -96,7 +96,6 @@ public class ErrorParserBlock extends AbstractErrorParserBlock { } catch (CoreException e) { } useBuildInfo = true; - } else { } } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractElementListSelectionDialog.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractElementListSelectionDialog.java index b4a86849b9d..3cd9f40f6ff 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractElementListSelectionDialog.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractElementListSelectionDialog.java @@ -46,9 +46,6 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus private StatusInfo fCurrStatus; - /* - * @private - */ protected void access$superOpen() { super.open(); } @@ -107,10 +104,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus text.setLayoutData(spec); return text; } - /* - * @private - * @see Window#create(Shell) - */ + @Override public void create() { super.create(); @@ -188,9 +182,6 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus protected AbstractElementListSelectionDialog(Shell parent, ILabelProvider renderer, boolean ignoreCase, boolean multipleSelection) { this(parent, "", null, renderer, ignoreCase, multipleSelection); //$NON-NLS-1$ } - /* - * @private - */ @Override public int open() { BusyIndicator.showWhile(null, () -> access$superOpen()); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java index ebb23d05fe7..08e5323c9ef 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java @@ -50,8 +50,7 @@ public class AutomakeEditor extends MakefileEditor { } @Override - protected void doSetInput(IEditorInput newInput) throws CoreException - { + protected void doSetInput(IEditorInput newInput) throws CoreException { super.doSetInput(newInput); this.input = newInput; @@ -78,7 +77,7 @@ public class AutomakeEditor extends MakefileEditor { } public AutomakeDocumentProvider getAutomakefileDocumentProvider() { - return (AutomakeDocumentProvider) AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider(); + return AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider(); } public AutomakefileContentOutlinePage getAutomakeOutlinePage() { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditorFactory.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditorFactory.java index e799ccaca3d..3793d626d2b 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditorFactory.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditorFactory.java @@ -18,7 +18,7 @@ import org.eclipse.swt.graphics.Color; public class AutomakeEditorFactory { private IWorkingCopyManager workingCopyManager; - private IMakefileDocumentProvider automakeFileDocumentProvider; + private AutomakeDocumentProvider automakeFileDocumentProvider; private static volatile AutomakeEditorFactory factory; /** @@ -28,7 +28,7 @@ public class AutomakeEditorFactory { factory = this; } - public synchronized IMakefileDocumentProvider getAutomakefileDocumentProvider() { + public synchronized AutomakeDocumentProvider getAutomakefileDocumentProvider() { if (automakeFileDocumentProvider == null) { automakeFileDocumentProvider= new AutomakeDocumentProvider(); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ElementListSelectionDialog.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ElementListSelectionDialog.java index 5c030a933a4..ec61a88a29b 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ElementListSelectionDialog.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ElementListSelectionDialog.java @@ -11,7 +11,6 @@ *******************************************************************************/ package org.eclipse.cdt.internal.autotools.ui.editors.automake; -import java.util.Arrays; import java.util.List; import org.eclipse.jface.dialogs.IDialogConstants; @@ -80,12 +79,6 @@ public class ElementListSelectionDialog extends AbstractElementListSelectionDial public ElementListSelectionDialog(Shell parent, ILabelProvider renderer, boolean ignoreCase, boolean multipleSelection) { this(parent, "", null, renderer, ignoreCase, multipleSelection); //$NON-NLS-1$ } - public int open(Object[] elements) { - return open(Arrays.asList(elements)); - } - public int open(Object[] elements, String initialSelection) { - return open(Arrays.asList(elements), initialSelection); - } /** * Open the dialog. * @param elements The elements to show in the list diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUAutomakefile.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUAutomakefile.java index 71b083c3b7a..65ab06d1c8f 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUAutomakefile.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUAutomakefile.java @@ -174,7 +174,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile { } line = line.substring(0, pound); // If all we have left are spaces continue - if (Util.isEmptyLine(line)) { + if (line.trim().isEmpty()) { continue; } // The rest of the line maybe a valid directives. @@ -182,7 +182,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile { } // 3- Empty lines ? - if (Util.isEmptyLine(line)) { + if (line.trim().isEmpty()) { Directive empty = new EmptyLine(this); empty.setLines(startLine, endLine); if (rules != null) { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenDeclarationAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenDeclarationAction.java index 5530dcf82fd..6f2a9346e79 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenDeclarationAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenDeclarationAction.java @@ -111,13 +111,4 @@ public class OpenDeclarationAction extends TextEditorAction { } return null; } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#selectionChanged(org.eclipse.jface.text.ITextSelection) - */ - //public void selectionChanged(ITextSelection selection) { - //setEnabled(fEditor != null); - //} } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionStatusDialog.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionStatusDialog.java index f614da2fa7c..675ec4b8b46 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionStatusDialog.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionStatusDialog.java @@ -44,18 +44,12 @@ public abstract class SelectionStatusDialog extends SelectionDialog { * Compute the result and return it. */ protected abstract void computeResult(); - /* (non-Javadoc) - * Method declared in Window. - */ @Override protected void configureShell(Shell shell) { super.configureShell(shell); if (fImage != null) shell.setImage(fImage); } - /* (non-Javadoc) - * Method declared in Dialog. - */ @Override protected Control createButtonBar(Composite parent) { Composite composite= new Composite(parent, SWT.NULL); @@ -77,9 +71,6 @@ public abstract class SelectionStatusDialog extends SelectionDialog { super.createButtonBar(composite); return composite; } - /* (non-Javadoc) - * Method declared in Dialog. - */ @Override public void create() { super.create(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Util.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Util.java index 1455230a124..14b7bb9dab5 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Util.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Util.java @@ -26,10 +26,6 @@ public class Util { return (line.endsWith("\\") && !line.endsWith("\\\\")); //$NON-NLS-1$ //$NON-NLS-2$ } - public static boolean isEmptyLine(String line) { - return line.trim().length() == 0; - } - public static int indexOfComment(String line) { boolean escaped = false; for (int i = 0; i < line.length(); i++) { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutoconfEditorPreferencePage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutoconfEditorPreferencePage.java index 9e8e89fd3c9..e9762e54ad2 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutoconfEditorPreferencePage.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutoconfEditorPreferencePage.java @@ -28,8 +28,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.GridData; @@ -399,11 +399,7 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage { fHighlightingColorListViewer.addSelectionChangedListener(event -> handleSyntaxColorListSelection()); - foregroundColorButton.addSelectionListener(new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // do nothing - } + foregroundColorButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); @@ -411,11 +407,7 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage { } }); - fBoldCheckBox.addSelectionListener(new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // do nothing - } + fBoldCheckBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); @@ -423,11 +415,7 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage { } }); - fItalicCheckBox.addSelectionListener(new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // do nothing - } + fItalicCheckBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); @@ -456,16 +444,12 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage { fFoldingCheckbox.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.foldingenable")); //$NON-NLS-1$ gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING); fFoldingCheckbox.setLayoutData(gd); - fFoldingCheckbox.addSelectionListener(new SelectionListener() { + fFoldingCheckbox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean enabled= fFoldingCheckbox.getSelection(); getOverlayStore().setValue(AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_ENABLED, enabled); } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } }); return composite; @@ -489,16 +473,12 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage { fACVersionCombo.select(fACVersions.length - 1); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING); fACVersionCombo.setLayoutData(gd); - fACVersionCombo.addSelectionListener(new SelectionListener() { + fACVersionCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int index = fACVersionCombo.getSelectionIndex(); getOverlayStore().setValue(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION, fACVersionCombo.getItem(index)); } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } }); Label label= new Label(composite, SWT.LEFT); @@ -513,16 +493,12 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage { fAMVersionCombo.select(fAMVersions.length - 1); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING); fAMVersionCombo.setLayoutData(gd); - fAMVersionCombo.addSelectionListener(new SelectionListener() { + fAMVersionCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int index = fAMVersionCombo.getSelectionIndex(); getOverlayStore().setValue(AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION, fAMVersionCombo.getItem(index)); } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } }); Label label2= new Label(composite, SWT.LEFT); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutomakeEditorPreferencePage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutomakeEditorPreferencePage.java index b8cf72deecf..9b3623acbaf 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutomakeEditorPreferencePage.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutomakeEditorPreferencePage.java @@ -28,8 +28,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.GridData; @@ -338,11 +338,7 @@ public class AutomakeEditorPreferencePage extends AbstractEditorPreferencePage { fHighlightingColorListViewer.addSelectionChangedListener(event -> handleSyntaxColorListSelection()); - foregroundColorButton.addSelectionListener(new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // do nothing - } + foregroundColorButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); @@ -350,11 +346,7 @@ public class AutomakeEditorPreferencePage extends AbstractEditorPreferencePage { } }); - fBoldCheckBox.addSelectionListener(new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // do nothing - } + fBoldCheckBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); @@ -362,11 +354,7 @@ public class AutomakeEditorPreferencePage extends AbstractEditorPreferencePage { } }); - fItalicCheckBox.addSelectionListener(new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // do nothing - } + fItalicCheckBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); @@ -395,16 +383,12 @@ public class AutomakeEditorPreferencePage extends AbstractEditorPreferencePage { fFoldingCheckbox.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.foldingenable")); //$NON-NLS-1$ gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING); fFoldingCheckbox.setLayoutData(gd); - fFoldingCheckbox.addSelectionListener(new SelectionListener() { + fFoldingCheckbox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean enabled= fFoldingCheckbox.getSelection(); getOverlayStore().setValue(AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_ENABLED, enabled); } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } }); return composite; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/OverlayPreferenceStore.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/OverlayPreferenceStore.java index 670bb1869c6..94adfbb9c6e 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/OverlayPreferenceStore.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/OverlayPreferenceStore.java @@ -214,269 +214,173 @@ class OverlayPreferenceStore implements IPreferenceStore { } } - /* - * @see IPreferenceStore#addPropertyChangeListener(IPropertyChangeListener) - */ @Override public void addPropertyChangeListener(IPropertyChangeListener listener) { fStore.addPropertyChangeListener(listener); } - /* - * @see IPreferenceStore#removePropertyChangeListener(IPropertyChangeListener) - */ @Override public void removePropertyChangeListener(IPropertyChangeListener listener) { fStore.removePropertyChangeListener(listener); } - /* - * @see IPreferenceStore#firePropertyChangeEvent(String, Object, Object) - */ @Override public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) { fStore.firePropertyChangeEvent(name, oldValue, newValue); } - /* - * @see IPreferenceStore#contains(String) - */ @Override public boolean contains(String name) { return fStore.contains(name); } - /* - * @see IPreferenceStore#getBoolean(String) - */ @Override public boolean getBoolean(String name) { return fStore.getBoolean(name); } - /* - * @see IPreferenceStore#getDefaultBoolean(String) - */ @Override public boolean getDefaultBoolean(String name) { return fStore.getDefaultBoolean(name); } - /* - * @see IPreferenceStore#getDefaultDouble(String) - */ @Override public double getDefaultDouble(String name) { return fStore.getDefaultDouble(name); } - /* - * @see IPreferenceStore#getDefaultFloat(String) - */ @Override public float getDefaultFloat(String name) { return fStore.getDefaultFloat(name); } - /* - * @see IPreferenceStore#getDefaultInt(String) - */ @Override public int getDefaultInt(String name) { return fStore.getDefaultInt(name); } - /* - * @see IPreferenceStore#getDefaultLong(String) - */ @Override public long getDefaultLong(String name) { return fStore.getDefaultLong(name); } - /* - * @see IPreferenceStore#getDefaultString(String) - */ @Override public String getDefaultString(String name) { return fStore.getDefaultString(name); } - /* - * @see IPreferenceStore#getDouble(String) - */ @Override public double getDouble(String name) { return fStore.getDouble(name); } - /* - * @see IPreferenceStore#getFloat(String) - */ @Override public float getFloat(String name) { return fStore.getFloat(name); } - /* - * @see IPreferenceStore#getInt(String) - */ @Override public int getInt(String name) { return fStore.getInt(name); } - /* - * @see IPreferenceStore#getLong(String) - */ @Override public long getLong(String name) { return fStore.getLong(name); } - /* - * @see IPreferenceStore#getString(String) - */ @Override public String getString(String name) { return fStore.getString(name); } - /* - * @see IPreferenceStore#isDefault(String) - */ @Override public boolean isDefault(String name) { return fStore.isDefault(name); } - /* - * @see IPreferenceStore#needsSaving() - */ @Override public boolean needsSaving() { return fStore.needsSaving(); } - /* - * @see IPreferenceStore#putValue(String, String) - */ @Override public void putValue(String name, String value) { if (covers(name)) fStore.putValue(name, value); } - /* - * @see IPreferenceStore#setDefault(String, double) - */ @Override public void setDefault(String name, double value) { if (covers(name)) fStore.setDefault(name, value); } - /* - * @see IPreferenceStore#setDefault(String, float) - */ @Override public void setDefault(String name, float value) { if (covers(name)) fStore.setDefault(name, value); } - /* - * @see IPreferenceStore#setDefault(String, int) - */ @Override public void setDefault(String name, int value) { if (covers(name)) fStore.setDefault(name, value); } - /* - * @see IPreferenceStore#setDefault(String, long) - */ @Override public void setDefault(String name, long value) { if (covers(name)) fStore.setDefault(name, value); } - /* - * @see IPreferenceStore#setDefault(String, String) - */ @Override public void setDefault(String name, String value) { if (covers(name)) fStore.setDefault(name, value); } - /* - * @see IPreferenceStore#setDefault(String, boolean) - */ @Override public void setDefault(String name, boolean value) { if (covers(name)) fStore.setDefault(name, value); } - /* - * @see IPreferenceStore#setToDefault(String) - */ @Override public void setToDefault(String name) { fStore.setToDefault(name); } - /* - * @see IPreferenceStore#setValue(String, double) - */ @Override public void setValue(String name, double value) { if (covers(name)) fStore.setValue(name, value); } - /* - * @see IPreferenceStore#setValue(String, float) - */ @Override public void setValue(String name, float value) { if (covers(name)) fStore.setValue(name, value); } - /* - * @see IPreferenceStore#setValue(String, int) - */ @Override public void setValue(String name, int value) { if (covers(name)) fStore.setValue(name, value); } - /* - * @see IPreferenceStore#setValue(String, long) - */ @Override public void setValue(String name, long value) { if (covers(name)) fStore.setValue(name, value); } - /* - * @see IPreferenceStore#setValue(String, String) - */ @Override public void setValue(String name, String value) { if (covers(name)) fStore.setValue(name, value); } - /* - * @see IPreferenceStore#setValue(String, boolean) - */ @Override public void setValue(String name, boolean value) { if (covers(name)) diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.java index 67d84263386..28f9cd4eb02 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.java @@ -19,7 +19,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; @@ -101,18 +100,13 @@ public class AutotoolsBuildPropertyPage extends AbstractCBuildPropertyTab { gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL); fCleanMakeTarget.setLayoutData(gd); - fCleanDelete.addSelectionListener(new SelectionListener() { + fCleanDelete.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fCleanMake.setSelection(false); fCleanDelete.setSelection(true); fCleanMakeTarget.setEnabled(false); } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // do nothing - } }); fCleanMake.addSelectionListener(new SelectionAdapter() { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java index b7fab51e789..77485c4b868 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java @@ -67,7 +67,6 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; public class AutoconfTextHover implements ITextHover, ITextHoverExtension { @@ -170,23 +169,13 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension { try { DocumentBuilder builder = factory.newDocumentBuilder(); doc = builder.parse(docStream); - } catch (SAXParseException saxException) { - doc = null; - } catch (SAXException saxEx) { - doc = null; - } catch (ParserConfigurationException pce) { - doc = null; - } catch (IOException ioe) { + } catch (SAXException | ParserConfigurationException | IOException saxEx) { doc = null; } finally { if (docStream != null) docStream.close(); } - } catch (FileNotFoundException e) { - AutotoolsPlugin.log(e); - } catch (MalformedURLException e) { - AutotoolsPlugin.log(e); - } catch (URISyntaxException e) { + } catch (FileNotFoundException|MalformedURLException|URISyntaxException e) { AutotoolsPlugin.log(e); } acDocument = doc; @@ -231,23 +220,13 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension { try { DocumentBuilder builder = factory.newDocumentBuilder(); doc = builder.parse(docStream); - } catch (SAXParseException saxException) { - doc = null; - } catch (SAXException saxEx) { - doc = null; - } catch (ParserConfigurationException pce) { - doc = null; - } catch (IOException ioe) { + } catch (SAXException | ParserConfigurationException | IOException ex) { doc = null; } finally { if (docStream != null) docStream.close(); } - } catch (FileNotFoundException e) { - AutotoolsPlugin.log(e); - } catch (MalformedURLException e) { - AutotoolsPlugin.log(e); - } catch (URISyntaxException e) { + } catch (FileNotFoundException|MalformedURLException|URISyntaxException e) { AutotoolsPlugin.log(e); } amDocument = doc; @@ -496,7 +475,6 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension { } catch (BadLocationException e) { // do nothing } - // TODO Auto-generated method stub return hoverInfo; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizard.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizard.java index 6dffd9811d0..eaeb240d2db 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizard.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizard.java @@ -162,9 +162,7 @@ public class AutotoolsProjectImportWizard extends NewMakeProjFromExisting { try { getContainer().run(true, true, op); - } catch (InvocationTargetException e) { - return false; - } catch (InterruptedException e) { + } catch (InvocationTargetException | InterruptedException e) { return false; } return true; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizard.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizard.java index 3297afe78da..1cc816d03d8 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizard.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizard.java @@ -207,9 +207,7 @@ public class ConvertToAutotoolsProjectWizard extends ConversionWizard { { try { operations[k].run(monitor); - } catch(InvocationTargetException e) { - //TODO: what should we do? - } catch(InterruptedException e) { + } catch(InvocationTargetException |InterruptedException e) { //TODO: what should we do? } }