Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2019-12-19 20:04:17 +0000
committerLars Vogel2020-01-17 06:16:39 +0000
commitff29989bb1381eb910796e0f1bf96239554f964f (patch)
tree298c69e2479803ee1429e59a54cdd054eb986eb7
parent49bd6fef4f88b2e3c8128998bb428c61e696a710 (diff)
downloadeclipse.platform.text-I20200120-0355.tar.gz
eclipse.platform.text-I20200120-0355.tar.xz
eclipse.platform.text-I20200120-0355.zip
Using the batch cleanup operation via Source -> Cleanup -> "Use lambdas where possible" from standard JDT. Change-Id: I609127e1d7267230c8741a155b81e4b004d7ee15 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/ContainerCreator.java73
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/FileBufferOperationRunner.java7
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java19
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationHover.java17
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionRulerColumn.java32
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java7
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/contentassist/ComboContentAssistSubjectAdapter.java20
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/contentassist/TextContentAssistSubjectAdapter.java17
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java7
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/PropagatingFontFieldEditor.java11
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerHoverManager.java28
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java16
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/MultipleHyperlinkPresenter.java22
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/AbstractRulerColumn.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineChangeHover.java9
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateStore.java28
-rw-r--r--org.eclipse.search.tests/src/org/eclipse/search/core/tests/TestSearchResult.java36
-rw-r--r--org.eclipse.search.tests/src/org/eclipse/search/tests/ResourceHelper.java29
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/InternalSearchUI.java28
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java9
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java18
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java7
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java16
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/PositionTracker.java63
-rw-r--r--org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java70
-rw-r--r--org.eclipse.text/src/org/eclipse/text/templates/TemplateStoreCore.java28
-rw-r--r--org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/FileDocumentProviderTest.java46
-rw-r--r--org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java9
-rw-r--r--org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/TextFileDocumentProviderTest.java27
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java15
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java16
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ConvertLineDelimitersAction.java7
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java10
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RemoveTrailingWhitespaceHandler.java7
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationColumn.java24
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/LineNumberColumn.java89
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/PropertyEventDispatcher.java7
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java7
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/TextChangeHover.java21
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java30
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java7
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java7
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java10
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java10
-rw-r--r--org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/AutoEditStrategyRegistry.java9
-rw-r--r--org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CharacterPairMatcherRegistry.java9
-rw-r--r--org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ContentAssistProcessorRegistry.java9
-rw-r--r--org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/GenericEditorPlugin.java12
-rw-r--r--org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/PresentationReconcilerRegistry.java9
-rw-r--r--org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/QuickAssistProcessorRegistry.java9
-rw-r--r--org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/hover/TextHoverRegistry.java9
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java78
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RetargetTextEditorAction.java33
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java7
54 files changed, 358 insertions, 800 deletions
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/ContainerCreator.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/ContainerCreator.java
index 2f8026cb5..a8245fce5 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/ContainerCreator.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/ContainerCreator.java
@@ -68,47 +68,44 @@ public class ContainerCreator {
* either the project or folders for the given container fails
*/
public IContainer createContainer(IProgressMonitor progressMonitor) throws CoreException {
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- SubMonitor subMonitor = SubMonitor.convert(monitor, FileBuffersMessages.ContainerCreator_task_creatingContainer, fContainerFullPath.segmentCount());
- if (fContainer != null)
- return;
-
- // Does the container exist already?
- IWorkspaceRoot root= fWorkspace.getRoot();
- IResource found= root.findMember(fContainerFullPath);
- if (found instanceof IContainer) {
- fContainer= (IContainer) found;
- return;
- } else if (found != null) {
- // fContainerFullPath specifies a file as directory
- throw new CoreException(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, NLSUtility.format(FileBuffersMessages.ContainerCreator_destinationMustBeAContainer, fContainerFullPath), null));
- }
+ IWorkspaceRunnable runnable= monitor -> {
+ SubMonitor subMonitor = SubMonitor.convert(monitor, FileBuffersMessages.ContainerCreator_task_creatingContainer, fContainerFullPath.segmentCount());
+ if (fContainer != null)
+ return;
+
+ // Does the container exist already?
+ IWorkspaceRoot root= fWorkspace.getRoot();
+ IResource found= root.findMember(fContainerFullPath);
+ if (found instanceof IContainer) {
+ fContainer= (IContainer) found;
+ return;
+ } else if (found != null) {
+ // fContainerFullPath specifies a file as directory
+ throw new CoreException(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, NLSUtility.format(FileBuffersMessages.ContainerCreator_destinationMustBeAContainer, fContainerFullPath), null));
+ }
- // Create the containers for the given path
- fContainer= root;
- for (int i = 0; i < fContainerFullPath.segmentCount(); i++) {
- String currentSegment = fContainerFullPath.segment(i);
- IResource resource = fContainer.findMember(currentSegment);
- if (resource != null) {
- if (resource instanceof IContainer) {
- fContainer= (IContainer) resource;
- subMonitor.split(1);
- } else {
- // fContainerFullPath specifies a file as directory
- throw new CoreException(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, NLSUtility.format(FileBuffersMessages.ContainerCreator_destinationMustBeAContainer, resource.getFullPath()), null));
- }
+ // Create the containers for the given path
+ fContainer= root;
+ for (int i = 0; i < fContainerFullPath.segmentCount(); i++) {
+ String currentSegment = fContainerFullPath.segment(i);
+ IResource resource = fContainer.findMember(currentSegment);
+ if (resource != null) {
+ if (resource instanceof IContainer) {
+ fContainer= (IContainer) resource;
+ subMonitor.split(1);
+ } else {
+ // fContainerFullPath specifies a file as directory
+ throw new CoreException(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, NLSUtility.format(FileBuffersMessages.ContainerCreator_destinationMustBeAContainer, resource.getFullPath()), null));
+ }
+ }
+ else {
+ if (i == 0) {
+ IProject projectHandle= createProjectHandle(root, currentSegment);
+ fContainer= createProject(projectHandle, subMonitor.split(1));
}
else {
- if (i == 0) {
- IProject projectHandle= createProjectHandle(root, currentSegment);
- fContainer= createProject(projectHandle, subMonitor.split(1));
- }
- else {
- IFolder folderHandle= createFolderHandle(fContainer, currentSegment);
- fContainer= createFolder(folderHandle, subMonitor.split(1));
- }
+ IFolder folderHandle= createFolderHandle(fContainer, currentSegment);
+ fContainer= createFolder(folderHandle, subMonitor.split(1));
}
}
}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/FileBufferOperationRunner.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/FileBufferOperationRunner.java
index cc06fd0c0..999b636e4 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/FileBufferOperationRunner.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/FileBufferOperationRunner.java
@@ -50,12 +50,7 @@ public class FileBufferOperationRunner extends GenericFileBufferOperationRunner
@Override
protected void commit(final IFileBuffer[] fileBuffers, final IProgressMonitor progressMonitor) throws CoreException {
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- doCommit(fileBuffers, progressMonitor);
- }
- };
+ IWorkspaceRunnable runnable= monitor -> doCommit(fileBuffers, progressMonitor);
ResourcesPlugin.getWorkspace().run(runnable, computeCommitRule(fileBuffers), IWorkspace.AVOID_UPDATE, progressMonitor);
}
}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java
index bc141bc19..0e74e44c6 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java
@@ -221,17 +221,14 @@ public class ResourceTextFileBufferManager extends TextFileBufferManager {
@Override
public void validateState(final IFileBuffer[] fileBuffers, IProgressMonitor monitor, final Object computationContext) throws CoreException {
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor progressMonitor) throws CoreException {
- IFileBuffer[] toValidate= findFileBuffersToValidate(fileBuffers);
- validationStateAboutToBeChanged(toValidate);
- try {
- IStatus status= validateEdit(toValidate, computationContext);
- validationStateChanged(toValidate, true, status);
- } catch (RuntimeException x) {
- validationStateChangedFailed(toValidate);
- }
+ IWorkspaceRunnable runnable= progressMonitor -> {
+ IFileBuffer[] toValidate= findFileBuffersToValidate(fileBuffers);
+ validationStateAboutToBeChanged(toValidate);
+ try {
+ IStatus status= validateEdit(toValidate, computationContext);
+ validationStateChanged(toValidate, true, status);
+ } catch (RuntimeException x) {
+ validationStateChangedFailed(toValidate);
}
};
ResourcesPlugin.getWorkspace().run(runnable, computeValidateStateRule(fileBuffers), IWorkspace.AVOID_UPDATE, monitor);
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationHover.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationHover.java
index 538582c74..92763f069 100644
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationHover.java
+++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationHover.java
@@ -15,13 +15,10 @@ package org.eclipse.jface.text.source.projection;
import java.util.Iterator;
-import org.eclipse.swt.widgets.Shell;
-
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Position;
@@ -158,12 +155,7 @@ class ProjectionAnnotationHover implements IAnnotationHover, IAnnotationHoverExt
@Override
public IInformationControlCreator getHoverControlCreator() {
if (fInformationControlCreator == null) {
- fInformationControlCreator= new IInformationControlCreator() {
- @Override
- public IInformationControl createInformationControl(Shell parent) {
- return new SourceViewerInformationControl(parent, false, JFaceResources.TEXT_FONT, null);
- }
- };
+ fInformationControlCreator= parent -> new SourceViewerInformationControl(parent, false, JFaceResources.TEXT_FONT, null);
}
return fInformationControlCreator;
}
@@ -171,12 +163,7 @@ class ProjectionAnnotationHover implements IAnnotationHover, IAnnotationHoverExt
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
if (fInformationPresenterControlCreator == null) {
- fInformationPresenterControlCreator= new IInformationControlCreator() {
- @Override
- public IInformationControl createInformationControl(Shell parent) {
- return new SourceViewerInformationControl(parent, true, JFaceResources.TEXT_FONT, null);
- }
- };
+ fInformationPresenterControlCreator= parent -> new SourceViewerInformationControl(parent, true, JFaceResources.TEXT_FONT, null);
}
return fInformationPresenterControlCreator;
}
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionRulerColumn.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionRulerColumn.java
index f1db464af..e77981dde 100644
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionRulerColumn.java
+++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionRulerColumn.java
@@ -16,7 +16,6 @@ package org.eclipse.jface.text.source.projection;
import java.util.Iterator;
import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
@@ -214,25 +213,22 @@ class ProjectionRulerColumn extends AnnotationRulerColumn {
});
// install mouse move listener
- control.addMouseMoveListener(new MouseMoveListener() {
- @Override
- public void mouseMove(MouseEvent e) {
- boolean redraw= false;
- ProjectionAnnotation annotation= findAnnotation(toDocumentLineNumber(e.y), false);
- if (annotation != fCurrentAnnotation) {
- if (fCurrentAnnotation != null) {
- fCurrentAnnotation.setRangeIndication(false);
- redraw= true;
- }
- fCurrentAnnotation= annotation;
- if (fCurrentAnnotation != null && !fCurrentAnnotation.isCollapsed()) {
- fCurrentAnnotation.setRangeIndication(true);
- redraw= true;
- }
+ control.addMouseMoveListener(e -> {
+ boolean redraw= false;
+ ProjectionAnnotation annotation= findAnnotation(toDocumentLineNumber(e.y), false);
+ if (annotation != fCurrentAnnotation) {
+ if (fCurrentAnnotation != null) {
+ fCurrentAnnotation.setRangeIndication(false);
+ redraw= true;
+ }
+ fCurrentAnnotation= annotation;
+ if (fCurrentAnnotation != null && !fCurrentAnnotation.isCollapsed()) {
+ fCurrentAnnotation.setRangeIndication(true);
+ redraw= true;
}
- if (redraw)
- redraw();
}
+ if (redraw)
+ redraw();
});
return control;
}
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java
index dbd758413..17696de2b 100644
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java
+++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java
@@ -384,12 +384,7 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
- return new IInformationControlCreator() {
- @Override
- public IInformationControl createInformationControl(Shell parent) {
- return new SourceViewerInformationControl(parent, true, fSymbolicFontName, null);
- }
- };
+ return parent -> new SourceViewerInformationControl(parent, true, fSymbolicFontName, null);
}
@Override
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/ComboContentAssistSubjectAdapter.java b/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/ComboContentAssistSubjectAdapter.java
index cb41b99dc..65c7a2476 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/ComboContentAssistSubjectAdapter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/ComboContentAssistSubjectAdapter.java
@@ -16,7 +16,6 @@ package org.eclipse.jface.contentassist;
import java.util.HashMap;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -24,7 +23,6 @@ import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.core.runtime.Assert;
@@ -66,12 +64,7 @@ public class ComboContentAssistSubjectAdapter extends AbstractControlContentAssi
private InternalDocument() {
super(fCombo.getText());
- fModifyListener= new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- set(fCombo.getText());
- }
- };
+ fModifyListener= e -> set(fCombo.getText());
fCombo.addModifyListener(fModifyListener);
}
@@ -165,16 +158,7 @@ public class ComboContentAssistSubjectAdapter extends AbstractControlContentAssi
@Override
public boolean addSelectionListener(final SelectionListener selectionListener) {
fCombo.addSelectionListener(selectionListener);
- Listener listener= new Listener() {
- /*
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- @Override
- public void handleEvent(Event e) {
- selectionListener.widgetSelected(new SelectionEvent(e));
-
- }
- };
+ Listener listener= e -> selectionListener.widgetSelected(new SelectionEvent(e));
fCombo.addListener(SWT.Modify, listener);
fModifyListeners.put(selectionListener, listener);
return true;
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/TextContentAssistSubjectAdapter.java b/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/TextContentAssistSubjectAdapter.java
index eda351611..87e5405a4 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/TextContentAssistSubjectAdapter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/TextContentAssistSubjectAdapter.java
@@ -16,13 +16,11 @@ package org.eclipse.jface.contentassist;
import java.util.HashMap;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
@@ -56,12 +54,7 @@ public class TextContentAssistSubjectAdapter extends AbstractControlContentAssis
private InternalDocument() {
super(fText.getText());
- fModifyListener= new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- set(fText.getText());
- }
- };
+ fModifyListener= e -> set(fText.getText());
fText.addModifyListener(fModifyListener);
}
@@ -148,13 +141,7 @@ public class TextContentAssistSubjectAdapter extends AbstractControlContentAssis
@Override
public boolean addSelectionListener(final SelectionListener selectionListener) {
fText.addSelectionListener(selectionListener);
- Listener listener= new Listener() {
- @Override
- public void handleEvent(Event e) {
- selectionListener.widgetSelected(new SelectionEvent(e));
-
- }
- };
+ Listener listener= e -> selectionListener.widgetSelected(new SelectionEvent(e));
fText.addListener(SWT.Modify, listener);
fModifyListeners.put(selectionListener, listener);
return true;
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java
index f583c8459..835cd0db5 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java
@@ -411,12 +411,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
- return new IInformationControlCreator() {
- @Override
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent, (ToolBarManager) null, fPresenter);
- }
- };
+ return parent -> new DefaultInformationControl(parent, (ToolBarManager) null, fPresenter);
}
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/PropagatingFontFieldEditor.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/PropagatingFontFieldEditor.java
index eab8130a6..fbd6eee78 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/PropagatingFontFieldEditor.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/PropagatingFontFieldEditor.java
@@ -22,8 +22,6 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.jface.preference.FontFieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
/**
@@ -118,12 +116,9 @@ public class PropagatingFontFieldEditor extends FontFieldEditor {
* @param targetKey the key to be used in the target preference store
*/
public static void startPropagate(final IPreferenceStore source, final String sourceKey, final IPreferenceStore target, final String targetKey) {
- source.addPropertyChangeListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (sourceKey.equals(event.getProperty()))
- propagateFont(source, sourceKey, target, targetKey);
- }
+ source.addPropertyChangeListener(event -> {
+ if (sourceKey.equals(event.getProperty()))
+ propagateFont(source, sourceKey, target, targetKey);
});
propagateFont(source, sourceKey, target, targetKey);
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerHoverManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerHoverManager.java
index c991486d0..314357815 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerHoverManager.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerHoverManager.java
@@ -15,7 +15,6 @@ package org.eclipse.jface.text;
import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
@@ -87,30 +86,17 @@ class TextViewerHoverManager extends AbstractHoverInformationControlManager impl
public TextViewerHoverManager(TextViewer textViewer, IInformationControlCreator creator) {
super(creator);
fTextViewer= textViewer;
- fStopper= new ITextListener() {
- @Override
- public void textChanged(TextEvent event) {
- synchronized (fMutex) {
- if (fThread != null) {
- fThread.interrupt();
- fThread= null;
- }
+ fStopper= event -> {
+ synchronized (fMutex) {
+ if (fThread != null) {
+ fThread.interrupt();
+ fThread= null;
}
}
};
- fViewportListener= new IViewportListener() {
- @Override
- public void viewportChanged(int verticalOffset) {
- fProcessMouseHoverEvent= false;
- }
- };
+ fViewportListener= verticalOffset -> fProcessMouseHoverEvent= false;
fTextViewer.addViewportListener(fViewportListener);
- fMouseMoveListener= new MouseMoveListener() {
- @Override
- public void mouseMove(MouseEvent event) {
- fProcessMouseHoverEvent= true;
- }
- };
+ fMouseMoveListener= event -> fProcessMouseHoverEvent= true;
fTextViewer.getTextWidget().addMouseMoveListener(fMouseMoveListener);
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java
index 3395dc513..30b06d89c 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java
@@ -35,7 +35,6 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jface.contentassist.IContentAssistSubjectControl;
@@ -348,15 +347,12 @@ class AsyncCompletionProposalPopup extends CompletionProposalPopup {
for (IContentAssistProcessor processor : processors) {
futures.add(CompletableFuture.supplyAsync(() -> {
AtomicReference<List<ICompletionProposal>> result= new AtomicReference<>();
- SafeRunner.run(new ISafeRunnable() {
- @Override
- public void run() throws Exception {
- ICompletionProposal[] proposals= processor.computeCompletionProposals(fViewer, invocationOffset);
- if (proposals == null) {
- result.set(Collections.emptyList());
- } else {
- result.set(Arrays.asList(proposals));
- }
+ SafeRunner.run(() -> {
+ ICompletionProposal[] proposals= processor.computeCompletionProposals(fViewer, invocationOffset);
+ if (proposals == null) {
+ result.set(Collections.emptyList());
+ } else {
+ result.set(Arrays.asList(proposals));
}
});
List<ICompletionProposal> proposals= result.get();
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/MultipleHyperlinkPresenter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/MultipleHyperlinkPresenter.java
index 26769755c..e0a72f1ba 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/MultipleHyperlinkPresenter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/MultipleHyperlinkPresenter.java
@@ -24,8 +24,6 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
@@ -330,12 +328,9 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter implem
}
});
- fTable.addTraverseListener(new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent e) {
- if (e.keyCode == SWT.ESC) {
- fManager.hideInformationControl();
- }
+ fTable.addTraverseListener(e -> {
+ if (e.keyCode == SWT.ESC) {
+ fManager.hideInformationControl();
}
});
}
@@ -385,13 +380,10 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter implem
@Override
public IInformationControlCreator getHoverControlCreator() {
- return new IInformationControlCreator() {
- @Override
- public IInformationControl createInformationControl(Shell parent) {
- Color foregroundColor= fTextViewer.getTextWidget().getForeground();
- Color backgroundColor= fTextViewer.getTextWidget().getBackground();
- return new LinkListInformationControl(parent, fManager, foregroundColor, backgroundColor);
- }
+ return parent -> {
+ Color foregroundColor= fTextViewer.getTextWidget().getForeground();
+ Color backgroundColor= fTextViewer.getTextWidget().getBackground();
+ return new LinkListInformationControl(parent, fManager, foregroundColor, backgroundColor);
};
}
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AbstractRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AbstractRulerColumn.java
index c53ef7348..7c0bd445c 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AbstractRulerColumn.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AbstractRulerColumn.java
@@ -19,7 +19,6 @@ import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
@@ -197,12 +196,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
fCanvas.setBackground(getDefaultBackground());
fCanvas.setFont(getFont());
- fCanvas.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent event) {
- AbstractRulerColumn.this.paintControl(event);
- }
- });
+ fCanvas.addPaintListener(event -> AbstractRulerColumn.this.paintControl(event));
fCanvas.addMouseListener(fMouseHandler);
fCanvas.addMouseMoveListener(fMouseHandler);
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineChangeHover.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineChangeHover.java
index 780929a44..e922e4560 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineChangeHover.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineChangeHover.java
@@ -17,13 +17,11 @@ import java.util.LinkedList;
import java.util.List;
import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.information.IInformationProviderExtension2;
@@ -313,11 +311,6 @@ public class LineChangeHover implements IAnnotationHover, IAnnotationHoverExtens
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
- return new IInformationControlCreator() {
- @Override
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent, (ToolBarManager)null, null);
- }
- };
+ return parent -> new DefaultInformationControl(parent, (ToolBarManager)null, null);
}
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateStore.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateStore.java
index c96ef3502..d3ab1c049 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateStore.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateStore.java
@@ -29,7 +29,6 @@ import org.eclipse.text.templates.TemplateStoreCore;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
/**
* A collection of templates. Clients may instantiate this class. In order to
@@ -111,21 +110,18 @@ public class TemplateStore extends TemplateStoreCore {
@Override
public final void startListeningForPreferenceChanges() {
if (fPropertyListener == null) {
- fPropertyListener= new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- /*
- * Don't load if we are in the process of saving ourselves. We are in sync anyway after the
- * save operation, and clients may trigger reloading by listening to preference store
- * updates.
- */
- if (!fIgnorePreferenceStoreChanges && getKey().equals(event.getProperty()))
- try {
- load();
- } catch (IOException x) {
- handleException(x);
- }
- }
+ fPropertyListener= event -> {
+ /*
+ * Don't load if we are in the process of saving ourselves. We are in sync anyway after the
+ * save operation, and clients may trigger reloading by listening to preference store
+ * updates.
+ */
+ if (!fIgnorePreferenceStoreChanges && getKey().equals(event.getProperty()))
+ try {
+ load();
+ } catch (IOException x) {
+ handleException(x);
+ }
};
fPreferenceStore.addPropertyChangeListener(fPropertyListener);
}
diff --git a/org.eclipse.search.tests/src/org/eclipse/search/core/tests/TestSearchResult.java b/org.eclipse.search.tests/src/org/eclipse/search/core/tests/TestSearchResult.java
index 04d172d74..3e88db490 100644
--- a/org.eclipse.search.tests/src/org/eclipse/search/core/tests/TestSearchResult.java
+++ b/org.eclipse.search.tests/src/org/eclipse/search/core/tests/TestSearchResult.java
@@ -21,8 +21,6 @@ import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.ISearchResultListener;
-import org.eclipse.search.ui.SearchResultEvent;
import org.eclipse.search.ui.text.AbstractTextSearchResult;
import org.eclipse.search.ui.text.Match;
import org.eclipse.search.ui.text.MatchEvent;
@@ -180,16 +178,13 @@ public class TestSearchResult {
ISearchQuery query= new NullQuery();
AbstractTextSearchResult result= (AbstractTextSearchResult) query.getSearchResult();
- result.addListener(new ISearchResultListener() {
- @Override
- public void searchResultChanged(SearchResultEvent e) {
- if (e instanceof MatchEvent) {
- MatchEvent evt= (MatchEvent) e;
- if (evt.getKind() == MatchEvent.ADDED) {
- wasAdded[0]= true;
- } else {
- wasRemoved[0]= true;
- }
+ result.addListener(e -> {
+ if (e instanceof MatchEvent) {
+ MatchEvent evt= (MatchEvent) e;
+ if (evt.getKind() == MatchEvent.ADDED) {
+ wasAdded[0]= true;
+ } else {
+ wasRemoved[0]= true;
}
}
});
@@ -224,16 +219,13 @@ public class TestSearchResult {
ISearchQuery query= new NullQuery();
AbstractTextSearchResult result= (AbstractTextSearchResult) query.getSearchResult();
- result.addListener(new ISearchResultListener() {
- @Override
- public void searchResultChanged(SearchResultEvent e) {
- if (e instanceof MatchEvent) {
- MatchEvent evt= (MatchEvent) e;
- if (evt.getKind() == MatchEvent.ADDED) {
- wasAdded[0]= true;
- } else {
- wasRemoved[0]= true;
- }
+ result.addListener(e -> {
+ if (e instanceof MatchEvent) {
+ MatchEvent evt= (MatchEvent) e;
+ if (evt.getKind() == MatchEvent.ADDED) {
+ wasAdded[0]= true;
+ } else {
+ wasRemoved[0]= true;
}
}
});
diff --git a/org.eclipse.search.tests/src/org/eclipse/search/tests/ResourceHelper.java b/org.eclipse.search.tests/src/org/eclipse/search/tests/ResourceHelper.java
index f025c4b21..017dab974 100644
--- a/org.eclipse.search.tests/src/org/eclipse/search/tests/ResourceHelper.java
+++ b/org.eclipse.search.tests/src/org/eclipse/search/tests/ResourceHelper.java
@@ -70,23 +70,20 @@ public class ResourceHelper {
}
public static void delete(final IResource resource) throws CoreException {
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- for (int i= 0; i < MAX_RETRY; i++) {
+ IWorkspaceRunnable runnable= monitor -> {
+ for (int i= 0; i < MAX_RETRY; i++) {
+ try {
+ resource.delete(true, null);
+ i= MAX_RETRY;
+ } catch (CoreException e) {
+ if (i == MAX_RETRY - 1) {
+ SearchTestPlugin.getDefault().getLog().log(e.getStatus());
+ throw e;
+ }
+ System.gc(); // help windows to really close file locks
try {
- resource.delete(true, null);
- i= MAX_RETRY;
- } catch (CoreException e) {
- if (i == MAX_RETRY - 1) {
- SearchTestPlugin.getDefault().getLog().log(e.getStatus());
- throw e;
- }
- System.gc(); // help windows to really close file locks
- try {
- Thread.sleep(1000); // sleep a second
- } catch (InterruptedException e1) {
- }
+ Thread.sleep(1000); // sleep a second
+ } catch (InterruptedException e1) {
}
}
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/InternalSearchUI.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/InternalSearchUI.java
index a2b138398..3008e6b18 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/InternalSearchUI.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/InternalSearchUI.java
@@ -27,7 +27,6 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PlatformUI;
@@ -218,23 +217,20 @@ public class InternalSearchUI {
private IStatus doRunSearchInForeground(final SearchJobRecord rec, IRunnableContext context) {
try {
- context.run(true, true, new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- searchJobStarted(rec);
- try {
- IStatus status= rec.query.run(monitor);
- if (status.matches(IStatus.CANCEL)) {
- throw new InterruptedException();
- }
- if (!status.isOK()) {
- throw new InvocationTargetException(new CoreException(status));
- }
- } catch (OperationCanceledException e) {
+ context.run(true, true, monitor -> {
+ searchJobStarted(rec);
+ try {
+ IStatus status= rec.query.run(monitor);
+ if (status.matches(IStatus.CANCEL)) {
throw new InterruptedException();
- } finally {
- searchJobFinished(rec);
}
+ if (!status.isOK()) {
+ throw new InvocationTargetException(new CoreException(status));
+ }
+ } catch (OperationCanceledException e) {
+ throw new InterruptedException();
+ } finally {
+ searchJobFinished(rec);
}
});
} catch (InvocationTargetException e) {
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java
index 52dd18db6..c2dc9a247 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java
@@ -14,8 +14,6 @@
package org.eclipse.search2.internal.ui;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
@@ -220,12 +218,7 @@ public class MatchFilterSelectionDialog extends StatusDialog {
}
});
- fLimitElementsField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- performLimitTextModified();
- }
- });
+ fLimitElementsField.addModifyListener(e -> performLimitTextModified());
fLimitElementsCheckbox.setSelection(fLimitElementCount != -1);
fLimitElementsField.setText(String.valueOf(fLastLimit));
fLimitElementsField.setEnabled(fLimitElementsCheckbox.getSelection());
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java
index 6ee61f883..391139900 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java
@@ -21,8 +21,6 @@ import java.util.List;
import com.ibm.icu.text.MessageFormat;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
@@ -49,10 +47,8 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.window.Window;
@@ -122,12 +118,7 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
fHistorySizeTextField= new Text(ancestor, SWT.BORDER | SWT.RIGHT);
fHistorySizeTextField.setTextLimit(2);
fHistorySizeTextField.setText(String.valueOf(fHistorySize));
- fHistorySizeTextField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- validateDialogState();
- }
- });
+ fHistorySizeTextField.addModifyListener(e -> validateDialogState());
GridData gridData= new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
gridData.widthHint= convertWidthInCharsToPixels(6);
@@ -332,12 +323,7 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
fRemoveButton.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
SWTUtil.setButtonDimensionHint(fRemoveButton);
- fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- validateDialogState();
- }
- });
+ fViewer.addSelectionChangedListener(event -> validateDialogState());
fLink= new Link(parent, SWT.NONE);
configureHistoryLink();
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java
index 43610e777..0533f9212 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java
@@ -785,12 +785,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
if (superAdapter != null)
return (T) superAdapter;
if (adapter == IShowInSource.class) {
- return (T) new IShowInSource() {
- @Override
- public ShowInContext getShowInContext() {
- return new ShowInContext(null, getSelectionProvider().getSelection());
- }
- };
+ return (T) (IShowInSource) () -> new ShowInContext(null, getSelectionProvider().getSelection());
}
return null;
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java
index 0e793486d..bda8a0b83 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java
@@ -17,7 +17,6 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
@@ -47,15 +46,12 @@ public class MarkerHighlighter extends Highlighter {
@Override
public void addHighlights(final Match[] matches) {
try {
- SearchPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- for (Match match : matches) {
- IMarker marker;
- marker = createMarker(match);
- if (marker != null)
- fMatchesToAnnotations.put(match, marker);
- }
+ SearchPlugin.getWorkspace().run((IWorkspaceRunnable) monitor -> {
+ for (Match match : matches) {
+ IMarker marker;
+ marker = createMarker(match);
+ if (marker != null)
+ fMatchesToAnnotations.put(match, marker);
}
}, fFile, IWorkspace.AVOID_UPDATE, null);
} catch (CoreException e) {
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/PositionTracker.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/PositionTracker.java
index b8853901c..05ecf2354 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/PositionTracker.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/PositionTracker.java
@@ -282,12 +282,9 @@ public class PositionTracker implements IQueryListener, ISearchResultListener, I
@Override
public void bufferDisposed(IFileBuffer buffer) {
final int[] trackCount= new int[1];
- doForExistingMatchesIn(buffer, new IFileBufferMatchOperation() {
- @Override
- public void run(ITextFileBuffer textBuffer, Match match) {
- trackCount[0]++;
- untrackPosition(textBuffer, match);
- }
+ doForExistingMatchesIn(buffer, (textBuffer, match) -> {
+ trackCount[0]++;
+ untrackPosition(textBuffer, match);
});
}
@@ -299,14 +296,11 @@ public class PositionTracker implements IQueryListener, ISearchResultListener, I
@Override
public void bufferContentReplaced(IFileBuffer buffer) {
final int[] trackCount= new int[1];
- doForExistingMatchesIn(buffer, new IFileBufferMatchOperation() {
- @Override
- public void run(ITextFileBuffer textBuffer, Match match) {
- trackCount[0]++;
- AbstractTextSearchResult result= fMatchesToSearchResults.get(match);
- untrackPosition(textBuffer, match);
- trackPosition(result, textBuffer, match);
- }
+ doForExistingMatchesIn(buffer, (textBuffer, match) -> {
+ trackCount[0]++;
+ AbstractTextSearchResult result= fMatchesToSearchResults.get(match);
+ untrackPosition(textBuffer, match);
+ trackPosition(result, textBuffer, match);
});
}
@@ -320,30 +314,27 @@ public class PositionTracker implements IQueryListener, ISearchResultListener, I
if (isDirty)
return;
final int[] trackCount= new int[1];
- doForExistingMatchesIn(buffer, new IFileBufferMatchOperation() {
- @Override
- public void run(ITextFileBuffer textBuffer, Match match) {
- trackCount[0]++;
- Position pos= fMatchesToPositions.get(match);
- if (pos != null) {
- if (pos.isDeleted()) {
- AbstractTextSearchResult result= fMatchesToSearchResults.get(match);
- // might be that the containing element has been removed.
- if (result != null) {
- result.removeMatch(match);
- }
- untrackPosition(textBuffer, match);
- } else {
- if (match.getBaseUnit() == Match.UNIT_LINE) {
- try {
- pos= convertToLinePosition(pos, textBuffer.getDocument());
- } catch (BadLocationException e) {
- SearchPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, SearchPlugin.getID(), 0, e.getLocalizedMessage(), e));
- }
+ doForExistingMatchesIn(buffer, (textBuffer, match) -> {
+ trackCount[0]++;
+ Position pos= fMatchesToPositions.get(match);
+ if (pos != null) {
+ if (pos.isDeleted()) {
+ AbstractTextSearchResult result= fMatchesToSearchResults.get(match);
+ // might be that the containing element has been removed.
+ if (result != null) {
+ result.removeMatch(match);
+ }
+ untrackPosition(textBuffer, match);
+ } else {
+ if (match.getBaseUnit() == Match.UNIT_LINE) {
+ try {
+ pos= convertToLinePosition(pos, textBuffer.getDocument());
+ } catch (BadLocationException e) {
+ SearchPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, SearchPlugin.getID(), 0, e.getLocalizedMessage(), e));
}
- match.setOffset(pos.getOffset());
- match.setLength(pos.getLength());
}
+ match.setOffset(pos.getOffset());
+ match.setLength(pos.getLength());
}
}
});
diff --git a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java
index d7b74e0eb..bc3d86874 100644
--- a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java
+++ b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java
@@ -38,7 +38,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.LegacyActionTools;
import org.eclipse.jface.action.MenuManager;
@@ -49,13 +48,9 @@ import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ILazyContentProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StyledCellLabelProvider;
import org.eclipse.jface.viewers.StyledString;
@@ -75,16 +70,12 @@ import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
@@ -581,13 +572,10 @@ public class QuickSearchDialog extends SelectionStatusDialog {
header.setLayout(layout);
headerLabel = new Label(header, SWT.NONE);
- headerLabel.addTraverseListener(new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
- e.detail = SWT.TRAVERSE_NONE;
- pattern.setFocus();
- }
+ headerLabel.addTraverseListener(e -> {
+ if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
+ e.detail = SWT.TRAVERSE_NONE;
+ pattern.setFocus();
}
});
@@ -627,13 +615,10 @@ public class QuickSearchDialog extends SelectionStatusDialog {
listLabel
.setText(WorkbenchMessages.FilteredItemsSelectionDialog_listLabel);
- listLabel.addTraverseListener(new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
- e.detail = SWT.TRAVERSE_NONE;
- list.getTable().setFocus();
- }
+ listLabel.addTraverseListener(e -> {
+ if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
+ e.detail = SWT.TRAVERSE_NONE;
+ list.getTable().setFocus();
}
});
@@ -731,12 +716,7 @@ public class QuickSearchDialog extends SelectionStatusDialog {
contextMenuManager = new MenuManager();
contextMenuManager.setRemoveAllWhenShown(true);
- contextMenuManager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- fillContextMenu(manager);
- }
- });
+ contextMenuManager.addMenuListener(manager -> fillContextMenu(manager));
final Table table = list.getTable();
Menu menu= contextMenuManager.createContextMenu(table);
@@ -752,12 +732,7 @@ public class QuickSearchDialog extends SelectionStatusDialog {
protected Control createDialogArea(Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
- dialogArea.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- QuickSearchDialog.this.dispose();
- }
- });
+ dialogArea.addDisposeListener(e -> QuickSearchDialog.this.dispose());
Composite content = createNestedComposite(dialogArea, 1, false);
GridData gd = new GridData(GridData.FILL_BOTH);
@@ -858,21 +833,13 @@ public class QuickSearchDialog extends SelectionStatusDialog {
}
});
- list.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- StructuredSelection selection = (StructuredSelection) event
- .getSelection();
- handleSelected(selection);
- }
+ list.addSelectionChangedListener(event -> {
+ StructuredSelection selection = (StructuredSelection) event
+ .getSelection();
+ handleSelected(selection);
});
- list.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClick();
- }
- });
+ list.addDoubleClickListener(event -> handleDoubleClick());
list.getTable().addKeyListener(new KeyAdapter() {
@Override
@@ -956,12 +923,7 @@ public class QuickSearchDialog extends SelectionStatusDialog {
details = new StyledText(parent, SWT.MULTI+SWT.READ_ONLY+SWT.BORDER+SWT.H_SCROLL+SWT.V_SCROLL);
details.setFont(JFaceResources.getFont(TEXT_FONT));
- list.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- refreshDetails();
- }
- });
+ list.addSelectionChangedListener(event -> refreshDetails());
details.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
diff --git a/org.eclipse.text/src/org/eclipse/text/templates/TemplateStoreCore.java b/org.eclipse.text/src/org/eclipse/text/templates/TemplateStoreCore.java
index 0ae02e68e..4376a0de7 100644
--- a/org.eclipse.text/src/org/eclipse/text/templates/TemplateStoreCore.java
+++ b/org.eclipse.text/src/org/eclipse/text/templates/TemplateStoreCore.java
@@ -25,7 +25,6 @@ import org.osgi.service.prefs.BackingStoreException;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.text.templates.ContextTypeRegistry;
import org.eclipse.text.templates.TemplatePersistenceData;
@@ -123,21 +122,18 @@ public class TemplateStoreCore {
*/
public void startListeningForPreferenceChanges() {
if (fPropertyListener == null) {
- fPropertyListener= new IPreferenceChangeListener() {
- @Override
- public void preferenceChange(PreferenceChangeEvent event) {
- /*
- * Don't load if we are in the process of saving ourselves. We are in sync anyway after the
- * save operation, and clients may trigger reloading by listening to preference store
- * updates.
- */
- if (!fIgnorePreferenceStoreChanges && fKey.equals(event.getKey()))
- try {
- load();
- } catch (IOException x) {
- handleException(x);
- }
- }
+ fPropertyListener= event -> {
+ /*
+ * Don't load if we are in the process of saving ourselves. We are in sync anyway after the
+ * save operation, and clients may trigger reloading by listening to preference store
+ * updates.
+ */
+ if (!fIgnorePreferenceStoreChanges && fKey.equals(event.getKey()))
+ try {
+ load();
+ } catch (IOException x) {
+ handleException(x);
+ }
};
fPreferenceStore.addPreferenceChangeListener(fPropertyListener);
}
diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/FileDocumentProviderTest.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/FileDocumentProviderTest.java
index 91531f44a..8d4505a41 100644
--- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/FileDocumentProviderTest.java
+++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/FileDocumentProviderTest.java
@@ -157,12 +157,9 @@ public class FileDocumentProviderTest {
// Put an UI event in the queue which will stop the workspace lock job
// after a delay so that we can verify the UI events are still
// dispatched after the call to refreshFile() below
- Display.getCurrent().timerExec(500, new Runnable() {
- @Override
- public void run() {
- stopLockingFlag.set(true);
- System.out.println("UI event dispatched, lock removed");
- }
+ Display.getCurrent().timerExec(500, () -> {
+ stopLockingFlag.set(true);
+ System.out.println("UI event dispatched, lock removed");
});
// Original code will lock UI thread here because it will try to acquire
@@ -189,12 +186,9 @@ public class FileDocumentProviderTest {
// Put an UI event in the queue which will stop the workspace lock job
// after a delay so that we can verify the UI events are still
// dispatched after the call to refreshFile() below
- Display.getCurrent().timerExec(500, new Runnable() {
- @Override
- public void run() {
- stopLockingFlag.set(true);
- System.out.println("UI event dispatched, lock removed");
- }
+ Display.getCurrent().timerExec(500, () -> {
+ stopLockingFlag.set(true);
+ System.out.println("UI event dispatched, lock removed");
});
// Original code will lock UI thread here because it will try to acquire
@@ -218,12 +212,9 @@ public class FileDocumentProviderTest {
// Put an UI event in the queue which will stop the workspace lock job
// after a delay
- Display.getCurrent().timerExec(600, new Runnable() {
- @Override
- public void run() {
- stopLockingFlag.set(true);
- System.out.println("UI event dispatched, lock removed");
- }
+ Display.getCurrent().timerExec(600, () -> {
+ stopLockingFlag.set(true);
+ System.out.println("UI event dispatched, lock removed");
});
// Original code will lock UI thread here because it will try to acquire
@@ -355,18 +346,15 @@ class LockJob extends WorkspaceJob {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor pm) throws CoreException {
- try {
- run2();
- } catch (Exception e) {
- // Re-throw as OperationCanceledException, which will be
- // caught and re-thrown as InterruptedException below.
- throw new OperationCanceledException(e.getMessage());
- }
- // CoreException and OperationCanceledException are propagated
+ IWorkspaceRunnable workspaceRunnable = pm -> {
+ try {
+ run2();
+ } catch (Exception e) {
+ // Re-throw as OperationCanceledException, which will be
+ // caught and re-thrown as InterruptedException below.
+ throw new OperationCanceledException(e.getMessage());
}
+ // CoreException and OperationCanceledException are propagated
};
ResourcesPlugin.getWorkspace().run(workspaceRunnable,
resource, IResource.NONE, monitor);
diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java
index 8832678dd..8277314c2 100644
--- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java
+++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java
@@ -31,7 +31,6 @@ import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -90,13 +89,7 @@ public class MarkerAnnotationOrderTest {
final ArrayList<IStatus> list= new ArrayList<>(2);
Bundle bundle= Platform.getBundle(EditorsUI.PLUGIN_ID);
ILog log= Platform.getLog(bundle);
- log.addLogListener(new ILogListener() {
-
- @Override
- public void logging(IStatus status, String plugin) {
- list.add(status);
- }
- });
+ log.addLogListener((status, plugin) -> list.add(status));
TestMarkerAnnotationModel t1= new TestMarkerAnnotationModel();
Position position= new Position(0);
diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/TextFileDocumentProviderTest.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/TextFileDocumentProviderTest.java
index dde68474e..e0e775700 100644
--- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/TextFileDocumentProviderTest.java
+++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/TextFileDocumentProviderTest.java
@@ -142,12 +142,9 @@ public class TextFileDocumentProviderTest {
// Put an UI event in the queue which will stop the workspace lock job
// after a delay so that we can verify the UI events are still
// dispatched after the call to refreshFile() below
- Display.getCurrent().timerExec(500, new Runnable() {
- @Override
- public void run() {
- stopLockingFlag.set(true);
- System.out.println("UI event dispatched, lock removed");
- }
+ Display.getCurrent().timerExec(500, () -> {
+ stopLockingFlag.set(true);
+ System.out.println("UI event dispatched, lock removed");
});
// Original code will lock UI thread here because it will try to acquire
@@ -176,12 +173,9 @@ public class TextFileDocumentProviderTest {
// Put an UI event in the queue which will stop the workspace lock job
// after a delay so that we can verify the UI events are still
// dispatched after the call to refreshFile() below
- Display.getCurrent().timerExec(500, new Runnable() {
- @Override
- public void run() {
- stopLockingFlag.set(true);
- System.out.println("UI event dispatched, lock removed");
- }
+ Display.getCurrent().timerExec(500, () -> {
+ stopLockingFlag.set(true);
+ System.out.println("UI event dispatched, lock removed");
});
// Original code will lock UI thread here because it will try to acquire
@@ -206,12 +200,9 @@ public class TextFileDocumentProviderTest {
// Put an UI event in the queue which will stop the workspace lock job
// after a delay
- Display.getCurrent().timerExec(600, new Runnable() {
- @Override
- public void run() {
- stopLockingFlag.set(true);
- System.out.println("UI event dispatched, lock removed");
- }
+ Display.getCurrent().timerExec(600, () -> {
+ stopLockingFlag.set(true);
+ System.out.println("UI event dispatched, lock removed");
});
// Original code will lock UI thread here because it will try to acquire
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java
index 7ef3e03c3..376c789f3 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java
@@ -24,7 +24,6 @@ import org.eclipse.core.runtime.content.IContentDescription;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
@@ -265,12 +264,7 @@ public class EncodingActionGroup extends ActionGroup {
String title= TextEditorMessages.Editor_ConvertEncoding_Custom_dialog_title;
String message= TextEditorMessages.Editor_ConvertEncoding_Custom_dialog_message;
- IInputValidator inputValidator = new IInputValidator() {
- @Override
- public String isValid(String newText) {
- return (newText == null || newText.isEmpty()) ? " " : null; //$NON-NLS-1$
- }
- };
+ IInputValidator inputValidator = newText -> (newText == null || newText.isEmpty()) ? " " : null;
String initialValue= encodingSupport.getEncoding();
if (initialValue == null)
@@ -356,12 +350,7 @@ public class EncodingActionGroup extends ActionGroup {
IMenuManager editMenu= menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (editMenu != null && !fRetargetActions.isEmpty()) {
MenuManager subMenu= new MenuManager(TextEditorMessages.Editor_ConvertEncoding_submenu_label);
- subMenu.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- update();
- }
- });
+ subMenu.addMenuListener(manager -> update());
Iterator<RetargetTextEditorAction> e= fRetargetActions.iterator();
subMenu.add(e.next());
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java
index 3c752f036..658044fbf 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java
@@ -21,7 +21,6 @@ import java.util.StringTokenizer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
@@ -31,7 +30,6 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.DefaultTextHover;
-import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.ITextHoverExtension;
@@ -390,12 +388,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
* @since 3.3
*/
private IInformationControlCreator getQuickAssistAssistantInformationControlCreator() {
- return new IInformationControlCreator() {
- @Override
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent, EditorsPlugin.getAdditionalInfoAffordanceString());
- }
- };
+ return parent -> new DefaultInformationControl(parent, EditorsPlugin.getAdditionalInfoAffordanceString());
}
/**
@@ -441,12 +434,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
@Override
public IInformationControlCreator getHoverControlCreator() {
- return new IInformationControlCreator() {
- @Override
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString());
- }
- };
+ return parent -> new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString());
}
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ConvertLineDelimitersAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ConvertLineDelimitersAction.java
index 1d99fd2b1..63dbd47d8 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ConvertLineDelimitersAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ConvertLineDelimitersAction.java
@@ -90,12 +90,7 @@ public class ConvertLineDelimitersAction extends FileBufferOperationAction {
return filterUnacceptableFiles(files);
}
- final IFilter filter= new IFilter() {
- @Override
- public boolean accept(IResource resource) {
- return resource != null && isAcceptableLocation(resource.getFullPath());
- }
- };
+ final IFilter filter= resource -> resource != null && isAcceptableLocation(resource.getFullPath());
SelectResourcesDialog dialog= new SelectResourcesDialog(getShell(), getDialogTitle(), TextEditorMessages.ConvertLineDelimitersAction_dialog_description, filter) {
@Override
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java
index 5cf2119d4..c3e48f543 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java
@@ -23,7 +23,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.text.source.ISharedTextColors;
@@ -205,12 +204,9 @@ public class EditorsPlugin extends AbstractUIPlugin {
super.start(context);
if (PlatformUI.isWorkbenchRunning()) {
- fThemeListener= new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (IThemeManager.CHANGE_CURRENT_THEME.equals(event.getProperty()))
- EditorsPluginPreferenceInitializer.setThemeBasedPreferences(getPreferenceStore(), true);
- }
+ fThemeListener= event -> {
+ if (IThemeManager.CHANGE_CURRENT_THEME.equals(event.getProperty()))
+ EditorsPluginPreferenceInitializer.setThemeBasedPreferences(getPreferenceStore(), true);
};
PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(fThemeListener);
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RemoveTrailingWhitespaceHandler.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RemoveTrailingWhitespaceHandler.java
index 1962c0cbd..99b279ad3 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RemoveTrailingWhitespaceHandler.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RemoveTrailingWhitespaceHandler.java
@@ -65,12 +65,7 @@ public class RemoveTrailingWhitespaceHandler extends FileBufferOperationHandler
if (containsOnlyFiles(resources))
return files;
- final IFilter filter= new IFilter() {
- @Override
- public boolean accept(IResource resource) {
- return resource != null && isAcceptableLocation(resource.getFullPath());
- }
- };
+ final IFilter filter= resource -> resource != null && isAcceptableLocation(resource.getFullPath());
SelectResourcesDialog dialog= new SelectResourcesDialog(getShell(), TextEditorMessages.RemoveTrailingWhitespaceHandler_dialog_title, TextEditorMessages.RemoveTrailingWhitespaceHandler_dialog_description, filter);
dialog.setInput(resources);
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationColumn.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationColumn.java
index ba70bcc94..7de33bf4c 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationColumn.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationColumn.java
@@ -23,7 +23,6 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationRulerColumn;
@@ -128,19 +127,16 @@ public class AnnotationColumn extends AbstractContributedRulerColumn implements
column.addAnnotationType(Annotation.TYPE_UNKNOWN);
// link to preference store
- fPropertyListener= new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- String property= event.getProperty();
- AnnotationPreference annotationPreference= getVerticalRulerAnnotationPreference(property);
- if (annotationPreference != null && property.equals(annotationPreference.getVerticalRulerPreferenceKey())) {
- Object type= annotationPreference.getAnnotationType();
- if (getPreferenceStore().getBoolean(property))
- column.addAnnotationType(type);
- else
- column.removeAnnotationType(type);
- column.redraw();
- }
+ fPropertyListener= event -> {
+ String property= event.getProperty();
+ AnnotationPreference annotationPreference= getVerticalRulerAnnotationPreference(property);
+ if (annotationPreference != null && property.equals(annotationPreference.getVerticalRulerPreferenceKey())) {
+ Object type= annotationPreference.getAnnotationType();
+ if (getPreferenceStore().getBoolean(property))
+ column.addAnnotationType(type);
+ else
+ column.removeAnnotationType(type);
+ column.redraw();
}
};
store.addPropertyChangeListener(fPropertyListener);
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/LineNumberColumn.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/LineNumberColumn.java
index 0f2b24c8e..74afbe2a0 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/LineNumberColumn.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/LineNumberColumn.java
@@ -29,7 +29,6 @@ import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.window.Window;
@@ -241,91 +240,45 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
// listen to changes
fDispatcher= new PropertyEventDispatcher(store);
- fDispatcher.addPropertyChangeListener(FG_COLOR_KEY, new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- updateForegroundColor(store, fDelegate);
- fDelegate.redraw();
- }
+ fDispatcher.addPropertyChangeListener(FG_COLOR_KEY, event -> {
+ updateForegroundColor(store, fDelegate);
+ fDelegate.redraw();
});
- IPropertyChangeListener backgroundHandler= new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- updateBackgroundColor(store, fDelegate);
- fDelegate.redraw();
- }
+ IPropertyChangeListener backgroundHandler= event -> {
+ updateBackgroundColor(store, fDelegate);
+ fDelegate.redraw();
};
fDispatcher.addPropertyChangeListener(BG_COLOR_KEY, backgroundHandler);
fDispatcher.addPropertyChangeListener(USE_DEFAULT_BG_KEY, backgroundHandler);
- fDispatcher.addPropertyChangeListener(LINE_NUMBER_KEY, new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- // only handle quick diff on/off information, but not ruler visibility (handled by AbstractDecoratedTextEditor)
- updateLineNumbersVisibility(fDelegate);
- }
- });
+ fDispatcher.addPropertyChangeListener(LINE_NUMBER_KEY, event -> updateLineNumbersVisibility(fDelegate));
- fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE, new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- updateCharacterMode(store, fDelegate);
- }
- });
+ fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE, event -> updateCharacterMode(store, fDelegate));
- fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_RENDERING_MODE, new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- updateRevisionRenderingMode(store, fDelegate);
- }
- });
+ fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_RENDERING_MODE, event -> updateRevisionRenderingMode(store, fDelegate));
- fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_AUTHOR, new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- updateRevisionAuthorVisibility(store, fDelegate);
- }
- });
+ fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_AUTHOR, event -> updateRevisionAuthorVisibility(store, fDelegate));
- fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_REVISION, new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- updateRevisionIdVisibility(store, fDelegate);
- }
- });
+ fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_REVISION, event -> updateRevisionIdVisibility(store, fDelegate));
- fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON, new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- updateQuickDiffVisibility(fDelegate);
- }
- });
+ fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON, event -> updateQuickDiffVisibility(fDelegate));
if (changedPref != null) {
- fDispatcher.addPropertyChangeListener(changedPref.getColorPreferenceKey(), new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- updateChangedColor(changedPref, store, fDelegate);
- fDelegate.redraw();
- }
+ fDispatcher.addPropertyChangeListener(changedPref.getColorPreferenceKey(), event -> {
+ updateChangedColor(changedPref, store, fDelegate);
+ fDelegate.redraw();
});
}
if (addedPref != null) {
- fDispatcher.addPropertyChangeListener(addedPref.getColorPreferenceKey(), new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- updateAddedColor(addedPref, store, fDelegate);
- fDelegate.redraw();
- }
+ fDispatcher.addPropertyChangeListener(addedPref.getColorPreferenceKey(), event -> {
+ updateAddedColor(addedPref, store, fDelegate);
+ fDelegate.redraw();
});
}
if (deletedPref != null) {
- fDispatcher.addPropertyChangeListener(deletedPref.getColorPreferenceKey(), new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- updateDeletedColor(deletedPref, store, fDelegate);
- fDelegate.redraw();
- }
+ fDispatcher.addPropertyChangeListener(deletedPref.getColorPreferenceKey(), event -> {
+ updateDeletedColor(deletedPref, store, fDelegate);
+ fDelegate.redraw();
});
}
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/PropertyEventDispatcher.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/PropertyEventDispatcher.java
index 856a0eceb..d096f2d69 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/PropertyEventDispatcher.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/PropertyEventDispatcher.java
@@ -28,12 +28,7 @@ public final class PropertyEventDispatcher {
private final Map<Object, Object> fHandlerMap= new HashMap<>();
private final Map<Object, Object> fReverseMap= new HashMap<>();
private final IPreferenceStore fStore;
- private final IPropertyChangeListener fListener= new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- firePropertyChange(event);
- }
- };
+ private final IPropertyChangeListener fListener= event -> firePropertyChange(event);
public PropertyEventDispatcher(IPreferenceStore store) {
Assert.isLegal(store != null);
fStore= store;
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java
index 645b72b2e..521ba4e01 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java
@@ -449,12 +449,7 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
- return new IInformationControlCreator() {
- @Override
- public IInformationControl createInformationControl(Shell parent) {
- return new SourceViewerInformationControl(parent, true, fSymbolicFontName, null);
- }
- };
+ return parent -> new SourceViewerInformationControl(parent, true, fSymbolicFontName, null);
}
@Override
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/TextChangeHover.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/TextChangeHover.java
index 12d4c8459..0c314ccc2 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/TextChangeHover.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/TextChangeHover.java
@@ -13,11 +13,8 @@
*******************************************************************************/
package org.eclipse.ui.internal.texteditor;
-import org.eclipse.swt.widgets.Shell;
-
import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.source.ILineRange;
import org.eclipse.jface.text.source.ISourceViewer;
@@ -50,24 +47,16 @@ public class TextChangeHover extends LineChangeHover {
@Override
public IInformationControlCreator getHoverControlCreator() {
- return new IInformationControlCreator() {
- @Override
- public IInformationControl createInformationControl(Shell parent) {
- SourceViewerInformationControl control= new SourceViewerInformationControl(parent, false, JFaceResources.TEXT_FONT, EditorsUI.getTooltipAffordanceString());
- control.setHorizontalScrollPixel(fLastScrollIndex);
- return control;
- }
+ return parent -> {
+ SourceViewerInformationControl control= new SourceViewerInformationControl(parent, false, JFaceResources.TEXT_FONT, EditorsUI.getTooltipAffordanceString());
+ control.setHorizontalScrollPixel(fLastScrollIndex);
+ return control;
};
}
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
- return new IInformationControlCreator() {
- @Override
- public IInformationControl createInformationControl(Shell parent) {
- return new SourceViewerInformationControl(parent, true, JFaceResources.TEXT_FONT, null);
- }
- };
+ return parent -> new SourceViewerInformationControl(parent, true, JFaceResources.TEXT_FONT, null);
}
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java
index 2e8b1e694..7ecc2afba 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java
@@ -510,16 +510,13 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
@Override
protected IMenuListener createContextMenuListener() {
final IMenuListener superListener= super.createContextMenuListener();
- return new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager menu) {
- if (!getOverviewRulerContextMenuId().equals(menu.getId())) {
- superListener.menuAboutToShow(menu);
- return;
- }
- setFocus();
- overviewRulerContextMenuAboutToShow(menu);
+ return menu -> {
+ if (!getOverviewRulerContextMenuId().equals(menu.getId())) {
+ superListener.menuAboutToShow(menu);
+ return;
}
+ setFocus();
+ overviewRulerContextMenuAboutToShow(menu);
};
}
@@ -1409,15 +1406,12 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
return (T) getAnnotationAccess();
if (adapter == IShowInSource.class) {
- return (T) new IShowInSource() {
- @Override
- public ShowInContext getShowInContext() {
- ISelection selection= null;
- ISelectionProvider selectionProvider= getSelectionProvider();
- if (selectionProvider != null)
- selection= selectionProvider.getSelection();
- return new ShowInContext(getEditorInput(), selection);
- }
+ return (T) (IShowInSource) () -> {
+ ISelection selection= null;
+ ISelectionProvider selectionProvider= getSelectionProvider();
+ if (selectionProvider != null)
+ selection= selectionProvider.getSelection();
+ return new ShowInContext(getEditorInput(), selection);
};
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java
index 2161baf3f..b5713bedc 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java
@@ -179,12 +179,7 @@ public class AddMarkerAction extends TextEditorAction {
String proposal= (o instanceof String) ? (String) o : ""; //$NON-NLS-1$
String title= getString(fBundle, fPrefix + "dialog.title", fPrefix + "dialog.title"); //$NON-NLS-2$ //$NON-NLS-1$
String message= getString(fBundle, fPrefix + "dialog.message", fPrefix + "dialog.message"); //$NON-NLS-2$ //$NON-NLS-1$
- IInputValidator inputValidator= new IInputValidator() {
- @Override
- public String isValid(String newText) {
- return (newText == null || newText.trim().isEmpty()) ? " " : null; //$NON-NLS-1$
- }
- };
+ IInputValidator inputValidator= newText -> (newText == null || newText.trim().isEmpty()) ? " " : null;
InputDialog dialog= new InputDialog(getTextEditor().getSite().getShell(), title, message, proposal, inputValidator);
String label= null;
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java
index cee667144..df4adce01 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java
@@ -406,12 +406,7 @@ public class MarkerRulerAction extends ResourceAction implements IUpdate {
String title= getString(fBundle, fPrefix + "add.dialog.title", fPrefix + "add.dialog.title"); //$NON-NLS-2$ //$NON-NLS-1$
String message= getString(fBundle, fPrefix + "add.dialog.message", fPrefix + "add.dialog.message"); //$NON-NLS-2$ //$NON-NLS-1$
String addButtonText= getString(fBundle, fPrefix + "add.dialog.addbutton", fPrefix + "add.dialog.addbutton"); //$NON-NLS-1$ //$NON-NLS-2$
- IInputValidator inputValidator= new IInputValidator() {
- @Override
- public String isValid(String newText) {
- return (newText == null || newText.trim().isEmpty()) ? " " : null; //$NON-NLS-1$
- }
- };
+ IInputValidator inputValidator= newText -> (newText == null || newText.trim().isEmpty()) ? " " : null;
AddBookmarkDialog dialog= new AddBookmarkDialog(fTextEditor.getSite().getShell(), title, message, proposal, inputValidator, addButtonText);
String label= null;
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java
index ed5f3a96d..e23343c57 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java
@@ -25,7 +25,6 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.resources.IMarker;
@@ -382,12 +381,9 @@ public final class MarkerUtilities {
*/
public static void createMarker(final IResource resource, final Map<String, Object> attributes, final String markerType) throws CoreException {
- IWorkspaceRunnable r= new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- IMarker marker= resource.createMarker(markerType);
- marker.setAttributes(attributes);
- }
+ IWorkspaceRunnable r= monitor -> {
+ IMarker marker= resource.createMarker(markerType);
+ marker.setAttributes(attributes);
};
resource.getWorkspace().run(r, null,IWorkspace.AVOID_UPDATE, null);
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java
index b97ada48f..6db4b6824 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java
@@ -18,7 +18,6 @@ import java.util.Iterator;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IMarkerDelta;
@@ -179,12 +178,9 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel
@Override
protected void deleteMarkers(final IMarker[] markers) throws CoreException {
- fWorkspace.run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- for (IMarker marker : markers) {
- marker.delete();
- }
+ fWorkspace.run((IWorkspaceRunnable) monitor -> {
+ for (IMarker marker : markers) {
+ marker.delete();
}
}, null, IWorkspace.AVOID_UPDATE, null);
}
diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/AutoEditStrategyRegistry.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/AutoEditStrategyRegistry.java
index a68e467ed..702aae2d8 100644
--- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/AutoEditStrategyRegistry.java
+++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/AutoEditStrategyRegistry.java
@@ -21,8 +21,6 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IRegistryChangeEvent;
-import org.eclipse.core.runtime.IRegistryChangeListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -49,12 +47,7 @@ public class AutoEditStrategyRegistry {
* Creates the registry and binds it to the extension point.
*/
public AutoEditStrategyRegistry() {
- Platform.getExtensionRegistry().addRegistryChangeListener(new IRegistryChangeListener() {
- @Override
- public void registryChanged(IRegistryChangeEvent event) {
- outOfSync = true;
- }
- }, EXTENSION_POINT_ID);
+ Platform.getExtensionRegistry().addRegistryChangeListener(event -> outOfSync = true, EXTENSION_POINT_ID);
}
/**
diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CharacterPairMatcherRegistry.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CharacterPairMatcherRegistry.java
index b0e4ec3a0..aa812826b 100644
--- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CharacterPairMatcherRegistry.java
+++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CharacterPairMatcherRegistry.java
@@ -18,8 +18,6 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IRegistryChangeEvent;
-import org.eclipse.core.runtime.IRegistryChangeListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -46,12 +44,7 @@ public class CharacterPairMatcherRegistry {
* Creates the registry and binds it to the extension point.
*/
public CharacterPairMatcherRegistry() {
- Platform.getExtensionRegistry().addRegistryChangeListener(new IRegistryChangeListener() {
- @Override
- public void registryChanged(IRegistryChangeEvent event) {
- outOfSync = true;
- }
- }, EXTENSION_POINT_ID);
+ Platform.getExtensionRegistry().addRegistryChangeListener(event -> outOfSync = true, EXTENSION_POINT_ID);
}
/**
diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ContentAssistProcessorRegistry.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ContentAssistProcessorRegistry.java
index 38f8f8696..3592fb820 100644
--- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ContentAssistProcessorRegistry.java
+++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ContentAssistProcessorRegistry.java
@@ -23,8 +23,6 @@ import java.util.stream.Collectors;
import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IRegistryChangeEvent;
-import org.eclipse.core.runtime.IRegistryChangeListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -137,12 +135,7 @@ public class ContentAssistProcessorRegistry {
* Creates the registry and binds it to the extension point.
*/
public ContentAssistProcessorRegistry() {
- Platform.getExtensionRegistry().addRegistryChangeListener(new IRegistryChangeListener() {
- @Override
- public void registryChanged(IRegistryChangeEvent event) {
- outOfSync = true;
- }
- }, EXTENSION_POINT_ID);
+ Platform.getExtensionRegistry().addRegistryChangeListener(event -> outOfSync = true, EXTENSION_POINT_ID);
}
/**
diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/GenericEditorPlugin.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/GenericEditorPlugin.java
index 6f1829389..a3130c721 100644
--- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/GenericEditorPlugin.java
+++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/GenericEditorPlugin.java
@@ -22,7 +22,6 @@ import org.eclipse.jface.text.quickassist.IQuickAssistProcessor;
import org.eclipse.jface.text.reconciler.IReconciler;
import org.eclipse.jface.text.source.ICharacterPairMatcher;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.genericeditor.hover.TextHoverRegistry;
import org.eclipse.ui.internal.genericeditor.preferences.GenericEditorPluginPreferenceInitializer;
@@ -59,13 +58,10 @@ public class GenericEditorPlugin extends AbstractUIPlugin {
super.start(context);
if (PlatformUI.isWorkbenchRunning()) {
- themeListener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (IThemeManager.CHANGE_CURRENT_THEME.equals(event.getProperty()))
- GenericEditorPluginPreferenceInitializer
- .setThemeBasedPreferences(GenericEditorPreferenceConstants.getPreferenceStore(), true);
- }
+ themeListener = event -> {
+ if (IThemeManager.CHANGE_CURRENT_THEME.equals(event.getProperty()))
+ GenericEditorPluginPreferenceInitializer
+ .setThemeBasedPreferences(GenericEditorPreferenceConstants.getPreferenceStore(), true);
};
PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(themeListener);
}
diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/PresentationReconcilerRegistry.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/PresentationReconcilerRegistry.java
index b88137f89..317d354e6 100644
--- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/PresentationReconcilerRegistry.java
+++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/PresentationReconcilerRegistry.java
@@ -21,8 +21,6 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IRegistryChangeEvent;
-import org.eclipse.core.runtime.IRegistryChangeListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -48,12 +46,7 @@ public class PresentationReconcilerRegistry {
* Creates the registry and binds it to the extension point.
*/
public PresentationReconcilerRegistry() {
- Platform.getExtensionRegistry().addRegistryChangeListener(new IRegistryChangeListener() {
- @Override
- public void registryChanged(IRegistryChangeEvent event) {
- outOfSync = true;
- }
- }, EXTENSION_POINT_ID);
+ Platform.getExtensionRegistry().addRegistryChangeListener(event -> outOfSync = true, EXTENSION_POINT_ID);
}
/**
diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/QuickAssistProcessorRegistry.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/QuickAssistProcessorRegistry.java
index 8c7a4ed77..66b7ded8b 100644
--- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/QuickAssistProcessorRegistry.java
+++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/QuickAssistProcessorRegistry.java
@@ -21,8 +21,6 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IRegistryChangeEvent;
-import org.eclipse.core.runtime.IRegistryChangeListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -41,12 +39,7 @@ public class QuickAssistProcessorRegistry {
* Creates the registry and binds it to the extension point.
*/
public QuickAssistProcessorRegistry() {
- Platform.getExtensionRegistry().addRegistryChangeListener(new IRegistryChangeListener() {
- @Override
- public void registryChanged(IRegistryChangeEvent event) {
- outOfSync = true;
- }
- }, EXTENSION_POINT_ID);
+ Platform.getExtensionRegistry().addRegistryChangeListener(event -> outOfSync = true, EXTENSION_POINT_ID);
}
/**
diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/hover/TextHoverRegistry.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/hover/TextHoverRegistry.java
index c024e1ecf..1d30371d8 100644
--- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/hover/TextHoverRegistry.java
+++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/hover/TextHoverRegistry.java
@@ -24,8 +24,6 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IRegistryChangeEvent;
-import org.eclipse.core.runtime.IRegistryChangeListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -88,12 +86,7 @@ public final class TextHoverRegistry {
}
public TextHoverRegistry(IPreferenceStore preferenceStore) {
- Platform.getExtensionRegistry().addRegistryChangeListener(new IRegistryChangeListener() {
- @Override
- public void registryChanged(IRegistryChangeEvent event) {
- outOfSync = true;
- }
- }, EXTENSION_POINT_ID);
+ Platform.getExtensionRegistry().addRegistryChangeListener(event -> outOfSync = true, EXTENSION_POINT_ID);
}
public List<ITextHover> getAvailableHovers(ISourceViewer sourceViewer, ITextEditor editor, Set<IContentType> contentTypes) {
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
index 6b65bafd2..82178e05e 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
@@ -35,8 +35,6 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
@@ -445,45 +443,42 @@ class FindReplaceDialog extends Dialog {
Composite statusBar= createStatusAndCloseButton(panel);
setGridData(statusBar, SWT.FILL, true, SWT.BOTTOM, false);
- panel.addTraverseListener(new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_RETURN) {
- if (!Util.isMac()) {
- Control controlWithFocus= getShell().getDisplay().getFocusControl();
- if (controlWithFocus != null && (controlWithFocus.getStyle() & SWT.PUSH) == SWT.PUSH)
- return;
- }
- Event event= new Event();
- event.type= SWT.Selection;
- event.stateMask= e.stateMask;
- fFindNextButton.notifyListeners(SWT.Selection, event);
- e.doit= false;
+ panel.addTraverseListener(e -> {
+ if (e.detail == SWT.TRAVERSE_RETURN) {
+ if (!Util.isMac()) {
+ Control controlWithFocus= getShell().getDisplay().getFocusControl();
+ if (controlWithFocus != null && (controlWithFocus.getStyle() & SWT.PUSH) == SWT.PUSH)
+ return;
}
- else if (e.detail == SWT.TRAVERSE_MNEMONIC) {
- Character mnemonic= Character.valueOf(Character.toLowerCase(e.character));
- if (fMnemonicButtonMap.containsKey(mnemonic)) {
- Button button= fMnemonicButtonMap.get(mnemonic);
- if ((fFindField.isFocusControl() || fReplaceField.isFocusControl() || (button.getStyle() & SWT.PUSH) != 0)
- && button.isEnabled()) {
- Event event= new Event();
- event.type= SWT.Selection;
- event.stateMask= e.stateMask;
- if ((button.getStyle() & SWT.RADIO) != 0) {
- Composite buttonParent= button.getParent();
- if (buttonParent != null) {
- Control[] children= buttonParent.getChildren();
- for (int i= 0; i < children.length; i++)
- ((Button)children[i]).setSelection(false);
- }
- button.setSelection(true);
- } else {
- button.setSelection(!button.getSelection());
+ Event event1= new Event();
+ event1.type= SWT.Selection;
+ event1.stateMask= e.stateMask;
+ fFindNextButton.notifyListeners(SWT.Selection, event1);
+ e.doit= false;
+ }
+ else if (e.detail == SWT.TRAVERSE_MNEMONIC) {
+ Character mnemonic= Character.valueOf(Character.toLowerCase(e.character));
+ if (fMnemonicButtonMap.containsKey(mnemonic)) {
+ Button button= fMnemonicButtonMap.get(mnemonic);
+ if ((fFindField.isFocusControl() || fReplaceField.isFocusControl() || (button.getStyle() & SWT.PUSH) != 0)
+ && button.isEnabled()) {
+ Event event2= new Event();
+ event2.type= SWT.Selection;
+ event2.stateMask= e.stateMask;
+ if ((button.getStyle() & SWT.RADIO) != 0) {
+ Composite buttonParent= button.getParent();
+ if (buttonParent != null) {
+ Control[] children= buttonParent.getChildren();
+ for (int i= 0; i < children.length; i++)
+ ((Button)children[i]).setSelection(false);
}
- button.notifyListeners(SWT.Selection, event);
- e.detail= SWT.TRAVERSE_NONE;
- e.doit= true;
+ button.setSelection(true);
+ } else {
+ button.setSelection(!button.getSelection());
}
+ button.notifyListeners(SWT.Selection, event2);
+ e.detail= SWT.TRAVERSE_NONE;
+ e.doit= true;
}
}
}
@@ -661,12 +656,7 @@ class FindReplaceDialog extends Dialog {
*/
private Composite createInputPanel(Composite parent) {
- ModifyListener listener= new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- updateButtonState();
- }
- };
+ ModifyListener listener= e -> updateButtonState();
Composite panel= new Composite(parent, SWT.NULL);
GridLayout layout= new GridLayout();
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RetargetTextEditorAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RetargetTextEditorAction.java
index 1359ef945..66e1d1386 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RetargetTextEditorAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RetargetTextEditorAction.java
@@ -18,7 +18,6 @@ package org.eclipse.ui.texteditor;
import java.util.ResourceBundle;
-import org.eclipse.swt.events.HelpEvent;
import org.eclipse.swt.events.HelpListener;
import org.eclipse.jface.action.IAction;
@@ -46,12 +45,7 @@ public final class RetargetTextEditorAction extends ResourceAction {
*/
private HelpListener fLocalHelpListener;
/** The listener to pick up changes of the target action. */
- private IPropertyChangeListener fListener= new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- update(event);
- }
- };
+ private IPropertyChangeListener fListener= event -> update(event);
/**
* Creates a new action. The action configures its initial visual
@@ -204,21 +198,18 @@ public final class RetargetTextEditorAction extends ResourceAction {
* @since 2.1
*/
private void installHelpListener() {
- super.setHelpListener(new HelpListener() {
- @Override
- public void helpRequested(HelpEvent e) {
- HelpListener listener= null;
- if (fAction != null) {
- // if we have a handler, see if it has a help listener
- listener= fAction.getHelpListener();
- if (listener == null)
- // use our own help listener
- listener= fLocalHelpListener;
- }
- if (listener != null)
- // pass on the event
- listener.helpRequested(e);
+ super.setHelpListener(e -> {
+ HelpListener listener= null;
+ if (fAction != null) {
+ // if we have a handler, see if it has a help listener
+ listener= fAction.getHelpListener();
+ if (listener == null)
+ // use our own help listener
+ listener= fLocalHelpListener;
}
+ if (listener != null)
+ // pass on the event
+ listener.helpRequested(e);
});
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java
index e2e0e89c2..96e219f81 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java
@@ -262,12 +262,7 @@ public class SourceViewerDecorationSupport {
fPreferenceStore= store;
if (fPreferenceStore != null) {
- fPropertyChangeListener= new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- handlePreferenceStoreChanged(event);
- }
- };
+ fPropertyChangeListener= event -> handlePreferenceStoreChanged(event);
fPreferenceStore.addPropertyChangeListener(fPropertyChangeListener);
}

Back to the top