Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-07-18 15:39:57 +0000
committerAlexander Kurtakov2018-07-18 15:44:15 +0000
commite73a322d845e119eda68a22dbd59e2fce44acfe4 (patch)
tree6e08756d48c1d6eee415f378047a342d6da2ead7 /org.eclipse.ui.editors
parentef3fedaa1552b42f3f0d8b2e64334e6cce484353 (diff)
downloadeclipse.platform.text-e73a322d845e119eda68a22dbd59e2fce44acfe4.tar.gz
eclipse.platform.text-e73a322d845e119eda68a22dbd59e2fce44acfe4.tar.xz
eclipse.platform.text-e73a322d845e119eda68a22dbd59e2fce44acfe4.zip
Lambda conversions.
Converting Runnable to lambda and whatever the quick fix picked in the file too. Change-Id: I0cbd8ef4a7cab89dced199b44a5be3b32b6f8195 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.ui.editors')
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/DefaultEncodingSupport.java55
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java15
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java82
-rwxr-xr-xorg.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java48
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java9
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java93
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java25
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SharedTextColors.java9
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java48
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java23
10 files changed, 150 insertions, 257 deletions
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/DefaultEncodingSupport.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/DefaultEncodingSupport.java
index 146c202d52d..4fa93c9ce19 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/DefaultEncodingSupport.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/DefaultEncodingSupport.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,7 +28,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.core.runtime.IStatus;
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.core.runtime.preferences.InstanceScope;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -75,32 +74,25 @@ public class DefaultEncodingSupport implements IEncodingSupport {
IEclipsePreferences prefs= InstanceScope.INSTANCE.getNode(ResourcesPlugin.PI_RESOURCES);
- fPreferenceChangeListener= new IPreferenceChangeListener() {
- @Override
- public void preferenceChange(PreferenceChangeEvent event) {
- if (ResourcesPlugin.PREF_ENCODING.equals(event.getKey())) {
- Runnable runnable= new Runnable() {
- @Override
- public void run() {
- setEncoding(null, false); // null means: use default
- }
- };
- if (Display.getCurrent() != null)
- runnable.run();
- else {
- // Post runnable into UI thread
- Shell shell;
- if (fTextEditor != null)
- shell= fTextEditor.getSite().getShell();
- else
- shell= getActiveWorkbenchShell();
- Display display;
- if (shell != null)
- display= shell.getDisplay();
- else
- display= Display.getDefault();
- display.asyncExec(runnable);
- }
+ fPreferenceChangeListener= event -> {
+ if (ResourcesPlugin.PREF_ENCODING.equals(event.getKey())) {
+ // null means: use default
+ Runnable runnable= () -> setEncoding(null, false);
+ if (Display.getCurrent() != null)
+ runnable.run();
+ else {
+ // Post runnable into UI thread
+ Shell shell;
+ if (fTextEditor != null)
+ shell= fTextEditor.getSite().getShell();
+ else
+ shell= getActiveWorkbenchShell();
+ Display display;
+ if (shell != null)
+ display= shell.getDisplay();
+ else
+ display= Display.getDefault();
+ display.asyncExec(runnable);
}
}
};
@@ -143,12 +135,7 @@ public class DefaultEncodingSupport implements IEncodingSupport {
if (apply) {
provider.setEncoding(input, encoding);
Runnable encodingSetter=
- new Runnable() {
- @Override
- public void run() {
- fTextEditor.doRevertToSaved();
- }
- };
+ () -> fTextEditor.doRevertToSaved();
Display display= fTextEditor.getSite().getShell().getDisplay();
if (display != null && !display.isDisposed())
BusyIndicator.showWhile(display, encodingSetter);
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java
index 172ebd9362c..84d216d6561 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -312,14 +312,11 @@ public class LastSaveReferenceProvider implements IQuickDiffReferenceProvider, I
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=66686 and
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=56871
- Runnable runnable= new Runnable() {
- @Override
- public void run() {
- synchronized (fLock) {
- if (fDocumentProvider == provider)
- // addElementStateListener adds at most once - no problem to call repeatedly
- provider.addElementStateListener(LastSaveReferenceProvider.this);
- }
+ Runnable runnable= () -> {
+ synchronized (fLock) {
+ if (fDocumentProvider == provider)
+ // addElementStateListener adds at most once - no problem to call repeatedly
+ provider.addElementStateListener(LastSaveReferenceProvider.this);
}
};
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java
index 70601ed1290..def0032d726 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java
@@ -42,10 +42,8 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TableViewer;
@@ -297,12 +295,7 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock {
fIsNextPreviousTargetCheckBox.setLayoutData(gd);
- fAnnotationTypeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- handleAnnotationListSelection();
- }
- });
+ fAnnotationTypeViewer.addSelectionChangedListener(event -> handleAnnotationListSelection());
fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
@Override
@@ -390,34 +383,30 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock {
}
});
- fDecorationViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- String[] decoration= (String[]) fDecorationViewer.getStructuredSelection().getFirstElement();
- ListItem item= getSelectedItem();
+ fDecorationViewer.addSelectionChangedListener(event -> {
+ String[] decoration= (String[]) fDecorationViewer.getStructuredSelection().getFirstElement();
+ ListItem item= getSelectedItem();
- if (fShowInTextCheckBox.getSelection()) {
- if (HIGHLIGHT.equals(decoration)) {
- fStore.setValue(item.highlightKey, true);
- if (item.textKey != null) {
- fStore.setValue(item.textKey, false);
- if (item.textStyleKey != null)
- fStore.setValue(item.textStyleKey, AnnotationPreference.STYLE_NONE);
- }
- } else {
- if (item.highlightKey != null)
- fStore.setValue(item.highlightKey, false);
- if (item.textKey != null) {
- fStore.setValue(item.textKey, true);
- if (item.textStyleKey != null)
- fStore.setValue(item.textStyleKey, decoration[1]);
- }
+ if (fShowInTextCheckBox.getSelection()) {
+ if (HIGHLIGHT.equals(decoration)) {
+ fStore.setValue(item.highlightKey, true);
+ if (item.textKey != null) {
+ fStore.setValue(item.textKey, false);
+ if (item.textStyleKey != null)
+ fStore.setValue(item.textStyleKey, AnnotationPreference.STYLE_NONE);
+ }
+ } else {
+ if (item.highlightKey != null)
+ fStore.setValue(item.highlightKey, false);
+ if (item.textKey != null) {
+ fStore.setValue(item.textKey, true);
+ if (item.textStyleKey != null)
+ fStore.setValue(item.textStyleKey, decoration[1]);
}
}
-
- fAnnotationTypeViewer.refresh(item);
}
+
+ fAnnotationTypeViewer.refresh(item);
});
composite.layout();
@@ -450,12 +439,9 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock {
final ListItem element= fListModel[i];
if (data.equals(element.label)) {
final Control control= fAnnotationTypeViewer.getControl();
- control.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- control.setFocus();
- fAnnotationTypeViewer.setSelection(new StructuredSelection(element), true);
- }
+ control.getDisplay().asyncExec(() -> {
+ control.setFocus();
+ fAnnotationTypeViewer.setSelection(new StructuredSelection(element), true);
});
return;
}
@@ -515,12 +501,9 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock {
public void initialize() {
fAnnotationTypeViewer.setInput(fListModel);
- fAnnotationTypeViewer.getControl().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fAnnotationTypeViewer != null && !fAnnotationTypeViewer.getControl().isDisposed()) {
- fAnnotationTypeViewer.setSelection(new StructuredSelection(fListModel[0]));
- }
+ fAnnotationTypeViewer.getControl().getDisplay().asyncExec(() -> {
+ if (fAnnotationTypeViewer != null && !fAnnotationTypeViewer.getControl().isDisposed()) {
+ fAnnotationTypeViewer.setSelection(new StructuredSelection(fListModel[0]));
}
});
@@ -544,15 +527,12 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock {
}
}
- Comparator<ListItem> comparator= new Comparator<ListItem>() {
- @Override
- public int compare(ListItem o1, ListItem o2) {
- String label1= o1.label;
- String label2= o2.label;
+ Comparator<ListItem> comparator= (o1, o2) -> {
+ String label1= o1.label;
+ String label2= o2.label;
- return Collator.getInstance().compare(label1, label2);
+ return Collator.getInstance().compare(label1, label2);
- }
};
Collections.sort(listModelItems, comparator);
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java
index 01f65231dae..5d62ef6b692 100755
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java
@@ -42,10 +42,8 @@ import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TableViewer;
@@ -295,12 +293,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
createDependency(fShowInTextCheckBox, new Control[] {label, foregroundColorButton});
- fAnnotationTypeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- handleAnnotationListSelection();
- }
- });
+ fAnnotationTypeViewer.addSelectionChangedListener(event -> handleAnnotationListSelection());
fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
@Override
@@ -342,23 +335,19 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
}
});
- fDecorationViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ fDecorationViewer.addSelectionChangedListener(event -> {
+ String[] decoration= (String[]) fDecorationViewer.getStructuredSelection().getFirstElement();
+ ListItem item= getSelectedItem();
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- String[] decoration= (String[]) fDecorationViewer.getStructuredSelection().getFirstElement();
- ListItem item= getSelectedItem();
-
- if (fShowInTextCheckBox.getSelection()) {
- if (HIGHLIGHT.equals(decoration)) {
- getPreferenceStore().setValue(item.highlightKey, true);
- getPreferenceStore().setValue(item.textKey, false);
- getPreferenceStore().setValue(item.textStyleKey, AnnotationPreference.STYLE_NONE);
- } else {
- getPreferenceStore().setValue(item.highlightKey, false);
- getPreferenceStore().setValue(item.textKey, true);
- getPreferenceStore().setValue(item.textStyleKey, decoration[1]);
- }
+ if (fShowInTextCheckBox.getSelection()) {
+ if (HIGHLIGHT.equals(decoration)) {
+ getPreferenceStore().setValue(item.highlightKey, true);
+ getPreferenceStore().setValue(item.textKey, false);
+ getPreferenceStore().setValue(item.textStyleKey, AnnotationPreference.STYLE_NONE);
+ } else {
+ getPreferenceStore().setValue(item.highlightKey, false);
+ getPreferenceStore().setValue(item.textKey, true);
+ getPreferenceStore().setValue(item.textStyleKey, decoration[1]);
}
}
});
@@ -444,13 +433,10 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
initializeFields();
fAnnotationTypeViewer.setInput(fListModel);
- fAnnotationTypeViewer.getControl().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fAnnotationTypeViewer != null && !fAnnotationTypeViewer.getControl().isDisposed()) {
- fAnnotationTypeViewer.setSelection(new StructuredSelection(fListModel[0]));
- initializeFields();
- }
+ fAnnotationTypeViewer.getControl().getDisplay().asyncExec(() -> {
+ if (fAnnotationTypeViewer != null && !fAnnotationTypeViewer.getControl().isDisposed()) {
+ fAnnotationTypeViewer.setSelection(new StructuredSelection(fListModel[0]));
+ initializeFields();
}
});
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java
index 4da7156e725..52343501068 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -401,12 +401,7 @@ class QuickDiffConfigurationBlock implements IPreferenceConfigurationBlock {
String label= fQuickDiffProviderListModel[i][1];
fQuickDiffProviderCombo.add(label);
}
- fQuickDiffProviderCombo.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- updateProviderList();
- }
- });
+ fQuickDiffProviderCombo.getDisplay().asyncExec(() -> updateProviderList());
initializeFields();
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
index eaf450a3524..32bf4a64f8c 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
@@ -167,16 +167,13 @@ class SelectResourcesBlock implements ICheckStateListener, ISelectionChangedList
public void checkStateChanged(final CheckStateChangedEvent event) {
//Potentially long operation - show a busy cursor
- BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
- @Override
- public void run() {
- if (event.getCheckable().equals(treeViewer))
- treeItemChecked(event.getElement(), event.getChecked());
- else
- listItemChecked(event.getElement(), event.getChecked(), true);
+ BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), () -> {
+ if (event.getCheckable().equals(treeViewer))
+ treeItemChecked(event.getElement(), event.getChecked());
+ else
+ listItemChecked(event.getElement(), event.getChecked(), true);
- notifyCheckStateChangeListeners(event);
- }
+ notifyCheckStateChangeListeners(event);
});
}
@@ -292,37 +289,34 @@ class SelectResourcesBlock implements ICheckStateListener, ISelectionChangedList
* @param element the element to be expanded
*/
private void expandTreeElement(final Object element) {
- BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
- @Override
- public void run() {
-
- // First see if the children need to be given their checked
- // state at all. If they've
- // already been realized then this won't be necessary
- if (expandedTreeNodes.contains(element))
- checkNewTreeElements(treeContentProvider.getChildren(element));
- else {
-
- expandedTreeNodes.add(element);
- if (whiteCheckedTreeItems.contains(element)) {
- //If this is the first expansion and this is a white
- // checked node then check the children
- Object[] children= treeContentProvider.getChildren(element);
- for (int i= 0; i < children.length; ++i) {
- if (!whiteCheckedTreeItems.contains(children[i])) {
- Object child= children[i];
- setWhiteChecked(child, true);
- treeViewer.setChecked(child, true);
- checkedStateStore.put(child, new ArrayList<>());
- }
+ BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), () -> {
+
+ // First see if the children need to be given their checked
+ // state at all. If they've
+ // already been realized then this won't be necessary
+ if (expandedTreeNodes.contains(element))
+ checkNewTreeElements(treeContentProvider.getChildren(element));
+ else {
+
+ expandedTreeNodes.add(element);
+ if (whiteCheckedTreeItems.contains(element)) {
+ //If this is the first expansion and this is a white
+ // checked node then check the children
+ Object[] children= treeContentProvider.getChildren(element);
+ for (int i= 0; i < children.length; ++i) {
+ if (!whiteCheckedTreeItems.contains(children[i])) {
+ Object child= children[i];
+ setWhiteChecked(child, true);
+ treeViewer.setChecked(child, true);
+ checkedStateStore.put(child, new ArrayList<>());
}
-
- //Now be sure to select the list of items too
- setListForWhiteSelection(element);
}
- }
+ //Now be sure to select the list of items too
+ setListForWhiteSelection(element);
+ }
}
+
});
}
@@ -589,12 +583,9 @@ class SelectResourcesBlock implements ICheckStateListener, ISelectionChangedList
if (!(expandedTreeNodes.contains(treeElement)) && whiteCheckedTreeItems.contains(treeElement)) {
//Potentially long operation - show a busy cursor
- BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
- @Override
- public void run() {
- setListForWhiteSelection(treeElement);
- listViewer.setAllChecked(true);
- }
+ BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), () -> {
+ setListForWhiteSelection(treeElement);
+ listViewer.setAllChecked(true);
});
} else {
@@ -680,23 +671,17 @@ class SelectResourcesBlock implements ICheckStateListener, ISelectionChangedList
return;
//Potentially long operation - show a busy cursor
- BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
- @Override
- public void run() {
- setTreeChecked(root, selection);
- listViewer.setAllChecked(selection);
- }
+ BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), () -> {
+ setTreeChecked(root, selection);
+ listViewer.setAllChecked(selection);
});
}
public void refresh() {
//Potentially long operation - show a busy cursor
- BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
- @Override
- public void run() {
- treeViewer.refresh();
- populateListViewer(currentTreeSelection);
- }
+ BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), () -> {
+ treeViewer.refresh();
+ populateListViewer(currentTreeSelection);
});
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java
index 7a3db4da6ed..2afde75bff8 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -41,8 +41,6 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.ui.dialogs.TypeFilteringDialog;
@@ -112,12 +110,7 @@ class SelectResourcesDialog extends Dialog {
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fResourceGroup= new SelectResourcesBlock(composite, ResourcesPlugin.getWorkspace().getRoot(), getResourceProvider(IResource.FOLDER | IResource.PROJECT), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(), getResourceProvider(IResource.FILE), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(), SWT.NONE, useHeightHint(parent));
- fResourceGroup.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- updateSelectionCount();
- }
- });
+ fResourceGroup.addCheckStateListener(event -> updateSelectionCount());
fCountIndication= new Label(composite, SWT.LEFT);
fCountIndication.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -245,22 +238,12 @@ class SelectResourcesDialog extends Dialog {
private void filterSelection() {
- final IFilter filter= new IFilter() {
- @Override
- public boolean accept(IResource resource) {
- return hasAcceptedFileType(resource);
- }
- };
+ final IFilter filter= resource -> hasAcceptedFileType(resource);
List<Object> list= fResourceGroup.getAllWhiteCheckedItems();
final IResource[] resources= list.toArray(new IResource[list.size()]);
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- setSelection(resources, filter);
- }
- };
+ Runnable runnable= () -> setSelection(resources, filter);
BusyIndicator.showWhile(getShell().getDisplay(), runnable);
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SharedTextColors.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SharedTextColors.java
index fabb852146e..e1accfb99f2 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SharedTextColors.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SharedTextColors.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -48,12 +48,7 @@ class SharedTextColors implements ISharedTextColors {
if (colorTable == null) {
colorTable= new HashMap<>(10);
fDisplayTable.put(display, colorTable);
- display.disposeExec(new Runnable() {
- @Override
- public void run() {
- dispose(display);
- }
- });
+ display.disposeExec(() -> dispose(display));
}
Color color= colorTable.get(rgb);
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java
index 987373fcc0c..3553573c565 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java
@@ -19,8 +19,6 @@ import java.util.Map;
import java.util.Set;
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.events.SelectionListener;
@@ -620,18 +618,14 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
textControl.setToolTipText(preference.getDescription());
if (domain != null) {
- textControl.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- String value= textControl.getText();
- IStatus status= domain.validate(value);
- if (!status.matches(IStatus.ERROR)) {
- fDialogOverlayStore.setValue(preference.getKey(), value);
- setErrorMessage(null);
- }
- else {
- setErrorMessage(NLSUtility.format(TextEditorMessages.TextEditorDefaultsPreferencePage_showWhitespaceCharactersDialogInvalidInput, value));
- }
+ textControl.addModifyListener(e -> {
+ String value= textControl.getText();
+ IStatus status= domain.validate(value);
+ if (!status.matches(IStatus.ERROR)) {
+ fDialogOverlayStore.setValue(preference.getKey(), value);
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(NLSUtility.format(TextEditorMessages.TextEditorDefaultsPreferencePage_showWhitespaceCharactersDialogInvalidInput, value));
}
});
}
@@ -1044,13 +1038,10 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
for (int i= 0; i < fAppearanceColorListModel.length; i++)
fAppearanceColorList.add(fAppearanceColorListModel[i][0]);
- fAppearanceColorList.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) {
- fAppearanceColorList.select(0);
- handleAppearanceColorListSelection();
- }
+ fAppearanceColorList.getDisplay().asyncExec(() -> {
+ if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) {
+ fAppearanceColorList.select(0);
+ handleAppearanceColorListSelection();
}
});
}
@@ -1301,15 +1292,12 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
textControl.setToolTipText(preference.getDescription());
if (domain != null) {
- textControl.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- String value= textControl.getText();
- IStatus status= domain.validate(value);
- if (!status.matches(IStatus.ERROR))
- fOverlayStore.setValue(preference.getKey(), value);
- updateStatus(domain);
- }
+ textControl.addModifyListener(e -> {
+ String value= textControl.getText();
+ IStatus status= domain.validate(value);
+ if (!status.matches(IStatus.ERROR))
+ fOverlayStore.setValue(preference.getKey(), value);
+ updateStatus(domain);
});
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java
index 5fcf71bddf6..68e6bfeddfa 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -95,18 +95,15 @@ public class MarkerAnnotation extends SimpleMarkerAnnotation implements IQuickFi
protected static Map<ImageDescriptor, Image> getImageRegistry(Display display) {
if (fgImageRegistry == null) {
fgImageRegistry= new HashMap<>();
- display.disposeExec(new Runnable() {
- @Override
- public void run() {
- if (fgImageRegistry != null) {
- Map<ImageDescriptor, Image> map= fgImageRegistry;
- fgImageRegistry= null;
- Iterator<Image> e= map.values().iterator();
- while (e.hasNext()) {
- Image image= e.next();
- if (!image.isDisposed())
- image.dispose();
- }
+ display.disposeExec(() -> {
+ if (fgImageRegistry != null) {
+ Map<ImageDescriptor, Image> map= fgImageRegistry;
+ fgImageRegistry= null;
+ Iterator<Image> e= map.values().iterator();
+ while (e.hasNext()) {
+ Image image= e.next();
+ if (!image.isDisposed())
+ image.dispose();
}
}
});

Back to the top