diff options
author | Lars Vogel | 2019-09-16 16:39:27 +0000 |
---|---|---|
committer | Karsten Thoms | 2019-09-26 21:25:09 +0000 |
commit | 41004c3736c509f6d2a2c0f90bca66126054c21f (patch) | |
tree | 1d3e73b07ebaa8169d5ff211b27c96b340ebe35e | |
parent | 5311e8a046a70d00b226d68607b57ada2e1b5273 (diff) | |
download | eclipse.platform.team-41004c3736c509f6d2a2c0f90bca66126054c21f.tar.gz eclipse.platform.team-41004c3736c509f6d2a2c0f90bca66126054c21f.tar.xz eclipse.platform.team-41004c3736c509f6d2a2c0f90bca66126054c21f.zip |
Use Multi-catch in org.eclipse.compareI20191002-0100I20191001-1800I20190930-1800I20190929-1800I20190928-1800I20190928-0515I20190928-0205I20190928-0000I20190927-1800I20190927-1530
Change-Id: I1c113ee473ad351959bf74e1340085ac2f1fa007
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Also-by: Karsten Thoms <karsten.thoms@itemis.de>
9 files changed, 14 insertions, 44 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java index d8c155ac8..0d5ff3fa2 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java @@ -1467,9 +1467,7 @@ public abstract class CompareEditorInput extends PlatformObject implements IEdit } }); return true; - } catch (InterruptedException x) { - // Ignore - } catch (OperationCanceledException x) { + } catch (InterruptedException | OperationCanceledException x) { // Ignore } catch (InvocationTargetException x) { ErrorDialog.openError(fComposite.getShell(), CompareMessages.CompareDialog_error_title, null, diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java index 735ce130a..7da9a8eed 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java @@ -521,9 +521,7 @@ public class CompareEditor extends EditorPart try { operation.run(progressMonitor); firePropertyChange(PROP_DIRTY); - } catch (InterruptedException x) { - // NeedWork - } catch (OperationCanceledException x) { + } catch (InterruptedException | OperationCanceledException x) { // NeedWork } catch (InvocationTargetException x) { String title= Utilities.getString("CompareEditor.saveError.title"); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java index a26bfe772..eb2f655b2 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java @@ -1278,9 +1278,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin { return ITypedElement.UNKNOWN_TYPE; } return ITypedElement.TEXT_TYPE; - } catch (CoreException ex) { - // be silent and return UNKNOWN_TYPE - } catch (IOException ex) { + } catch (CoreException | IOException ex) { // be silent and return UNKNOWN_TYPE } finally { if (is != null) { diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java index 0bbfb7251..b6612c7b1 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java @@ -212,9 +212,7 @@ public class EditionAction extends BaseCompareAction { try { String text= Utilities.readString(sa); document.replace(0, document.getLength(), text); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } catch (BadLocationException e) { + } catch (CoreException | BadLocationException e) { throw new InvocationTargetException(e); } } diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/StreamMergerDescriptor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/StreamMergerDescriptor.java index 2f38f2a4f..c76f8d3b0 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/StreamMergerDescriptor.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/StreamMergerDescriptor.java @@ -38,11 +38,7 @@ class StreamMergerDescriptor { public IStreamMerger createStreamMerger() { try { return (IStreamMerger) fElement.createExecutableExtension(CLASS_ATTRIBUTE); - } catch (CoreException ex) { - //ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.createSorter.title"), SearchMessages.getString("Search.Error.createSorter.message")); //$NON-NLS-2$ //$NON-NLS-1$ - return null; - } catch (ClassCastException ex) { - //ExceptionHandler.displayMessageDialog(ex, SearchMessages.getString("Search.Error.createSorter.title"), SearchMessages.getString("Search.Error.createSorter.message")); //$NON-NLS-2$ //$NON-NLS-1$ + } catch (CoreException | ClassCastException ex) { return null; } } diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java index 23b03854a..a702c1ec2 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java @@ -72,10 +72,7 @@ public class Worker implements IRunnableWithProgress { try { performNextTask(progress); progress.checkCanceled(); - } catch (OperationCanceledException e) { - // Only cancel all the work if the outer monitor is canceled. - progress.checkCanceled(); - } catch (InterruptedException e) { + } catch (OperationCanceledException | InterruptedException e) { // Only cancel all the work if the outer monitor is canceled. progress.checkCanceled(); } catch (InvocationTargetException e) { diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java index 0453443ff..475fb97e6 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java @@ -284,11 +284,7 @@ public class InputPatchPage extends WizardPage { patchFileURL), getContainer()); if (contents != null) reader = new StringReader(contents); - } catch (MalformedURLException e) { - // ignore as we tested it with modify listener on combo - } catch (InvocationTargetException e) { // ignore - } catch (OperationCanceledException e) { // ignore - } catch (InterruptedException e) { // ignore + } catch (MalformedURLException | InvocationTargetException | OperationCanceledException | InterruptedException e) { // ignore } } fPatchSource= PatchMessages.InputPatchPage_URL_title; diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java index 4f72a8034..b3a969ce8 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java @@ -136,8 +136,7 @@ public class PreviewPatchPage2 extends WizardPage { // Initialize the input try { fInput.run(null); - } catch (InterruptedException e) {//ignore - } catch (InvocationTargetException e) {//ignore + } catch (InterruptedException | InvocationTargetException e) {//ignore } Label label = new Label(composite, SWT.NONE); @@ -300,8 +299,7 @@ public class PreviewPatchPage2 extends WizardPage { } monitor.done(); }); - } catch (InvocationTargetException e) { //ignore - } catch (InterruptedException e) { //ignore + } catch (InvocationTargetException | InterruptedException e) { //ignore } } }; @@ -326,8 +324,7 @@ public class PreviewPatchPage2 extends WizardPage { } monitor.done(); }); - } catch (InvocationTargetException e) { //ignore - } catch (InterruptedException e) { //ignore + } catch (InvocationTargetException | InterruptedException e) { //ignore } } @@ -657,9 +654,7 @@ public class PreviewPatchPage2 extends WizardPage { PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> result[0]= patcher.guessFuzzFactor(monitor) ); - } catch (InvocationTargetException ex) { - // NeedWork - } catch (InterruptedException ex) { + } catch (InvocationTargetException | InterruptedException ex) { // NeedWork } return result[0]; diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java index 28fad0147..aa694c5ca 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java @@ -118,9 +118,7 @@ public class DocumentRangeNode fRange= new Position(start, length); try { fBaseDocument.addPosition(RANGE_CATEGORY, fRange); - } catch (BadPositionCategoryException ex) { - CompareUIPlugin.log(ex); - } catch (BadLocationException ex) { + } catch (BadPositionCategoryException | BadLocationException ex) { CompareUIPlugin.log(ex); } } @@ -222,9 +220,7 @@ public class DocumentRangeNode fBaseDocument.addPosition(RANGE_CATEGORY, p); fAppendPosition= p; } - } catch (BadPositionCategoryException ex) { - // silently ignored - } catch (BadLocationException ex) { + } catch (BadPositionCategoryException | BadLocationException ex) { // silently ignored } } @@ -244,9 +240,7 @@ public class DocumentRangeNode fBaseDocument.addPosition(RANGE_CATEGORY, p); fAppendPosition= p; return fAppendPosition; - } catch (BadPositionCategoryException ex) { - // silently ignored - } catch (BadLocationException ex) { + } catch (BadPositionCategoryException | BadLocationException ex) { // silently ignored } } |