diff options
Diffstat (limited to 'org.eclipse.jface.text/src/org/eclipse/jface/internal')
9 files changed, 54 insertions, 122 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/StickyHoverManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/StickyHoverManager.java index 921dc012ce2..e1a3e44f482 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/StickyHoverManager.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/StickyHoverManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 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 @@ -193,13 +193,8 @@ public class StickyHoverManager extends InformationControlReplacer implements IW public void focusLost(FocusEvent e) { if (DEBUG) System.out.println("StickyHoverManager.Closer.focusLost(): " + e); //$NON-NLS-1$ Display d= fSubjectControl.getDisplay(); - d.asyncExec(new Runnable() { - // Without the asyncExec, mouse clicks to the workbench window are swallowed. - @Override - public void run() { - hideInformationControl(); - } - }); + // Without the asyncExec, mouse clicks to the workbench window are swallowed. + d.asyncExec(() -> hideInformationControl()); } @Override diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java index 0dd8a590058..c4f1fa8d04d 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,10 +18,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.SWTError; import org.eclipse.swt.browser.Browser; import org.eclipse.swt.browser.LocationListener; -import org.eclipse.swt.browser.OpenWindowListener; import org.eclipse.swt.browser.ProgressAdapter; import org.eclipse.swt.browser.ProgressEvent; -import org.eclipse.swt.browser.WindowEvent; import org.eclipse.swt.custom.StyleRange; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; @@ -226,13 +224,8 @@ public class BrowserInformationControl extends AbstractInformationControl implem fCompleted= true; } }); - - fBrowser.addOpenWindowListener(new OpenWindowListener() { - @Override - public void open(WindowEvent event) { - event.required= true; // Cancel opening of new windows - } - }); + // Cancel opening of new windows + fBrowser.addOpenWindowListener(event -> event.required= true); // Replace browser's built-in context menu with none fBrowser.setMenu(new Menu(getShell(), SWT.NONE)); @@ -344,12 +337,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem final Display display= shell.getDisplay(); // Make sure the display wakes from sleep after timeout: - display.timerExec(100, new Runnable() { - @Override - public void run() { - fCompleted= true; - } - }); + display.timerExec(100, () -> fCompleted= true); while (!fCompleted) { // Drive the event loop to process the events required to load the browser widget's contents: diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java index c04e83112c1..d1acb320592 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.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 @@ -49,12 +49,9 @@ public class HTMLPrinter { final Display display= Display.getDefault(); if (display != null && !display.isDisposed()) { try { - display.asyncExec(new Runnable() { - @Override - public void run() { - cacheColors(display); - installColorUpdater(display); - } + display.asyncExec(() -> { + cacheColors(display); + installColorUpdater(display); }); } catch (SWTError err) { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=45294 diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/AdditionalInfoController2.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/AdditionalInfoController2.java index 48bb8b5720d..1caabdc10ae 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/AdditionalInfoController2.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/AdditionalInfoController2.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -159,12 +159,9 @@ class AdditionalInfoController2 extends AbstractInformationControlManager implem } if (fProposalTable != null && !fProposalTable.isDisposed()) { - fProposalTable.getDisplay().asyncExec(new Runnable() { - @Override - public void run() { - if (!fIsReset) - showInformation(); - } + fProposalTable.getDisplay().asyncExec(() -> { + if (!fIsReset) + showInformation(); }); } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistant2.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistant2.java index 6741ba96afa..b1e9ea2f2ab 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistant2.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistant2.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 @@ -45,7 +45,6 @@ import org.eclipse.jface.util.OpenStrategy; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.DefaultInformationControl; import org.eclipse.jface.text.IEventConsumer; -import org.eclipse.jface.text.IInformationControl; import org.eclipse.jface.text.IInformationControlCreator; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.ITextViewerExtension; @@ -168,12 +167,9 @@ public class ContentAssistant2 implements IContentAssistant, IContentAssistantEx if (control != null) { Display d= control.getDisplay(); if (d != null) { - d.asyncExec(new Runnable() { - @Override - public void run() { - if (!hasFocus()) - hide(); - } + d.asyncExec(() -> { + if (!hasFocus()) + hide(); }); } } @@ -308,14 +304,11 @@ public class ContentAssistant2 implements IContentAssistant, IContentAssistantEx Display d= control.getDisplay(); if (d != null) { try { - d.syncExec(new Runnable() { - @Override - public void run() { - if (showStyle == SHOW_PROPOSALS) - fProposalPopup.showProposals(true); - else if (showStyle == SHOW_CONTEXT_INFO) - fContextInfoPopup.showContextProposals(true); - } + d.syncExec(() -> { + if (showStyle == SHOW_PROPOSALS) + fProposalPopup.showProposals(true); + else if (showStyle == SHOW_CONTEXT_INFO) + fContextInfoPopup.showContextProposals(true); }); } catch (SWTError e) { } @@ -728,12 +721,7 @@ public class ContentAssistant2 implements IContentAssistant, IContentAssistantEx * @return an <code>IInformationControlCreator</code> to be used to display context information */ private IInformationControlCreator getInformationControlCreator() { - return new IInformationControlCreator() { - @Override - public IInformationControl createInformationControl(Shell parent) { - return new DefaultInformationControl(parent, false); - } - }; + return parent -> new DefaultInformationControl(parent, false); } /** diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContextInformationPopup2.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContextInformationPopup2.java index 0632c2d8ff3..164e34f1b0f 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContextInformationPopup2.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContextInformationPopup2.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 @@ -106,30 +106,27 @@ class ContextInformationPopup2 implements IContentAssistListener2 { */ public String showContextProposals(final boolean autoActivated) { final StyledText styledText= fViewer.getTextWidget(); - BusyIndicator.showWhile(styledText.getDisplay(), new Runnable() { - @Override - public void run() { + BusyIndicator.showWhile(styledText.getDisplay(), () -> { - int position= fViewer.getSelectedRange().x; + int position= fViewer.getSelectedRange().x; - IContextInformation[] contexts= computeContextInformation(position); - int count = (contexts == null ? 0 : contexts.length); - if (count == 1) { + IContextInformation[] contexts= computeContextInformation(position); + int count= (contexts == null ? 0 : contexts.length); + if (count == 1) { - // Show context information directly - internalShowContextInfo(contexts[0], position); + // Show context information directly + internalShowContextInfo(contexts[0], position); - } else if (count > 0) { - // Precise context must be selected + } else if (count > 0) { + // Precise context must be selected - if (fLineDelimiter == null) - fLineDelimiter= styledText.getLineDelimiter(); + if (fLineDelimiter == null) + fLineDelimiter= styledText.getLineDelimiter(); - createContextSelector(); - setContexts(contexts); - displayContextSelector(); - hideContextInfoPopup(); - } + createContextSelector(); + setContexts(contexts); + displayContextSelector(); + hideContextInfoPopup(); } }); @@ -145,12 +142,9 @@ class ContextInformationPopup2 implements IContentAssistListener2 { */ public void showContextInformation(final IContextInformation info, final int position) { Control control= fViewer.getTextWidget(); - BusyIndicator.showWhile(control.getDisplay(), new Runnable() { - @Override - public void run() { - internalShowContextInfo(info, position); - hideContextSelector(); - } + BusyIndicator.showWhile(control.getDisplay(), () -> { + internalShowContextInfo(info, position); + hideContextSelector(); }); } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/PopupCloser2.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/PopupCloser2.java index a8cb2bfb54f..71971044b94 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/PopupCloser2.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/PopupCloser2.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 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 @@ -97,12 +97,9 @@ class PopupCloser2 extends ShellAdapter implements FocusListener, SelectionListe public void focusLost(final FocusEvent e) { fScrollbarClicked= false; Display d= fTable.getDisplay(); - d.asyncExec(new Runnable() { - @Override - public void run() { - if (Helper2.okToUse(fTable) && !fTable.isFocusControl() && !fScrollbarClicked && fContentAssistant != null) - fContentAssistant.popupFocusLost(e); - } + d.asyncExec(() -> { + if (Helper2.okToUse(fTable) && !fTable.isFocusControl() && !fScrollbarClicked && fContentAssistant != null) + fContentAssistant.popupFocusLost(e); }); } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java index 5321b82822e..046e4d30727 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2016 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -21,8 +21,6 @@ import java.util.Map.Entry; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseMoveListener; import org.eclipse.swt.events.MouseTrackListener; @@ -740,12 +738,7 @@ public final class RevisionPainter { fControl.addMouseMoveListener(fMouseHandler); fControl.addListener(SWT.MouseUp, fMouseHandler); fControl.addListener(SWT.MouseDown, fMouseHandler); - fControl.addDisposeListener(new DisposeListener() { - @Override - public void widgetDisposed(DisposeEvent e) { - handleDispose(); - } - }); + fControl.addDisposeListener(e -> handleDispose()); fRevisionSelectionProvider.install(fViewer); } @@ -1351,12 +1344,7 @@ public final class RevisionPainter { if (isConnected() && !fControl.isDisposed()) { Display d= fControl.getDisplay(); if (d != null) { - d.asyncExec(new Runnable() { - @Override - public void run() { - redraw(); - } - }); + d.asyncExec(() -> redraw()); } } } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/source/DiffPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/source/DiffPainter.java index 73c52f65db6..7d0aac0668f 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/source/DiffPainter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/source/DiffPainter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2016 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -12,8 +12,6 @@ package org.eclipse.jface.internal.text.source; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.RGB; @@ -196,12 +194,7 @@ public final class DiffPainter { if (fControl == null) return; - fControl.addDisposeListener(new DisposeListener() { - @Override - public void widgetDisposed(DisposeEvent e) { - handleDispose(); - } - }); + fControl.addDisposeListener(e -> handleDispose()); } /** @@ -381,12 +374,7 @@ public final class DiffPainter { if (isConnected() && !fControl.isDisposed()) { Display d= fControl.getDisplay(); if (d != null) { - d.asyncExec(new Runnable() { - @Override - public void run() { - redraw(); - } - }); + d.asyncExec(() -> redraw()); } } } |