diff options
Diffstat (limited to 'org.eclipse.jface.text/src/org')
152 files changed, 1625 insertions, 1620 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/AbstractControlContentAssistSubjectAdapter.java b/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/AbstractControlContentAssistSubjectAdapter.java index 3b603a3c23f..ac1b30add70 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/AbstractControlContentAssistSubjectAdapter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/AbstractControlContentAssistSubjectAdapter.java @@ -16,9 +16,6 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.Platform; - import org.eclipse.swt.SWT; import org.eclipse.swt.custom.VerifyKeyListener; import org.eclipse.swt.events.DisposeEvent; @@ -31,13 +28,17 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.Platform; + import org.eclipse.jface.fieldassist.ControlDecoration; import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.text.IEventConsumer; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.LabelProviderChangedEvent; +import org.eclipse.jface.text.IEventConsumer; + /** * An <code>AbstractControlContentAssistSubjectAdapter</code> delegates assistance requests from a @@ -81,7 +82,7 @@ public abstract class AbstractControlContentAssistSubjectAdapter implements ICon * @since 3.3 */ private Image fCachedDefaultCueImage; - + /** * Creates a new {@link AbstractControlContentAssistSubjectAdapter}. */ @@ -331,15 +332,15 @@ public abstract class AbstractControlContentAssistSubjectAdapter implements ICon if (fCueLabelProvider != null) { fCueLabelProvider.dispose(); } - + fCueLabelProvider= labelProvider; - + if (labelProvider == null) { if (fControlDecoration != null) { fControlDecoration.dispose(); fControlDecoration= null; } - + } else { if (fControlDecoration == null) { fControlDecoration= new ControlDecoration(getControl(), (SWT.TOP | SWT.LEFT)); @@ -362,7 +363,7 @@ public abstract class AbstractControlContentAssistSubjectAdapter implements ICon fControlDecoration.setShowHover(true); fControlDecoration.setShowOnlyOnFocus(true); } - + ILabelProviderListener listener= new ILabelProviderListener() { public void labelProviderChanged(LabelProviderChangedEvent event) { fControlDecoration.setDescriptionText(labelProvider.getText(getControl())); @@ -377,10 +378,10 @@ public abstract class AbstractControlContentAssistSubjectAdapter implements ICon listener.labelProviderChanged(new LabelProviderChangedEvent(labelProvider)); } } - + /** * Returns the default cue image. - * + * * @return the default cue image * @since 3.3 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/SubjectControlContentAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/SubjectControlContentAssistant.java index 302f0de76cb..d4fd629b23b 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/SubjectControlContentAssistant.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/SubjectControlContentAssistant.java @@ -18,7 +18,7 @@ import org.eclipse.core.runtime.Assert; * Usually, clients instantiate this class and configure it before using it. * * @since 3.0 - * @deprecated As of 3.2, replaced by Platform UI's field assist support * + * @deprecated As of 3.2, replaced by Platform UI's field assist support * */ public class SubjectControlContentAssistant extends org.eclipse.jface.text.contentassist.ContentAssistant implements ISubjectControlContentAssistant { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/DelayedInputChangeListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/DelayedInputChangeListener.java index 496e5ce3ec2..09092a459b6 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/DelayedInputChangeListener.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/DelayedInputChangeListener.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -16,17 +16,17 @@ import org.eclipse.jface.text.IInputChangedListener; /** * A delayed input change listener that forwards delayed input changes to an information control replacer. - * + * * @since 3.4 */ public final class DelayedInputChangeListener implements IInputChangedListener { - + private final IDelayedInputChangeProvider fChangeProvider; private final InformationControlReplacer fInformationControlReplacer; /** * Creates a new listener. - * + * * @param changeProvider the information control with delayed input changes * @param informationControlReplacer the information control replacer, whose information control should get the new input */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InformationControlReplacer.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InformationControlReplacer.java index 3615cb5c36b..2284a6581d2 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InformationControlReplacer.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InformationControlReplacer.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -32,11 +32,11 @@ import org.eclipse.jface.text.IInformationControlExtension3; * The {@link AbstractInformationControlManager} can be configured with such a replacer by calling * <code>setInformationControlReplacer</code>. * </p> - * + * * @since 3.4 */ public class InformationControlReplacer extends AbstractInformationControlManager { - + /** * Minimal width in pixels. */ @@ -45,7 +45,7 @@ public class InformationControlReplacer extends AbstractInformationControlManage * Minimal height in pixels. */ private static final int MIN_HEIGHT= 50; - + /** * Default control creator. */ @@ -60,11 +60,11 @@ public class InformationControlReplacer extends AbstractInformationControlManage private boolean fDelayedInformationSet; private Rectangle fReplaceableArea; private Rectangle fContentBounds; - - + + /** * Creates a new information control replacer. - * + * * @param creator the default information control creator */ public InformationControlReplacer(IInformationControlCreator creator) { @@ -74,7 +74,7 @@ public class InformationControlReplacer extends AbstractInformationControlManage /** * Replace the information control. - * + * * @param informationPresenterControlCreator the information presenter control creator * @param contentBounds the bounds of the content area of the information control * @param information the information to show @@ -82,7 +82,7 @@ public class InformationControlReplacer extends AbstractInformationControlManage * @param takeFocus <code>true</code> iff the replacing information control should take focus */ public void replaceInformationControl(IInformationControlCreator informationPresenterControlCreator, Rectangle contentBounds, Object information, final Rectangle subjectArea, boolean takeFocus) { - + try { fIsReplacing= true; if (! fDelayedInformationSet) @@ -91,11 +91,11 @@ public class InformationControlReplacer extends AbstractInformationControlManage takeFocus= true; // delayed input has been set, so the original info control must have been focused fContentBounds= contentBounds; fReplaceableArea= subjectArea; - + setCustomInformationControlCreator(informationPresenterControlCreator); - + takesFocusWhenVisible(takeFocus); - + showInformation(); } finally { fIsReplacing= false; @@ -105,7 +105,7 @@ public class InformationControlReplacer extends AbstractInformationControlManage setCustomInformationControlCreator(null); } } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager#computeInformation() */ @@ -114,7 +114,7 @@ public class InformationControlReplacer extends AbstractInformationControlManage setInformation(fReplacableInformation, fReplaceableArea); return; } - + if (DEBUG) System.out.println("InformationControlReplacer: no active replaceable"); //$NON-NLS-1$ } @@ -128,40 +128,40 @@ public class InformationControlReplacer extends AbstractInformationControlManage */ public void showInformationControl(Rectangle subjectArea, Object information) { IInformationControl informationControl= getInformationControl(); - + Rectangle controlBounds= fContentBounds; if (informationControl instanceof IInformationControlExtension3) { IInformationControlExtension3 iControl3= (IInformationControlExtension3) informationControl; Rectangle trim= iControl3.computeTrim(); controlBounds= Geometry.add(controlBounds, trim); - + /* * Ensure minimal size. Interacting with a tiny information control * (resizing, selecting text) would be a pain. */ controlBounds.width= Math.max(controlBounds.width, MIN_WIDTH); controlBounds.height= Math.max(controlBounds.height, MIN_HEIGHT); - + getInternalAccessor().cropToClosestMonitor(controlBounds); } - + Point location= Geometry.getLocation(controlBounds); Point size= Geometry.getSize(controlBounds); - + // Caveat: some IInformationControls fail unless setSizeConstraints(..) is called with concrete values informationControl.setSizeConstraints(size.x, size.y); - + if (informationControl instanceof IInformationControlExtension2) ((IInformationControlExtension2) informationControl).setInput(information); else informationControl.setInformation(information.toString()); - + informationControl.setLocation(location); informationControl.setSize(size.x, size.y); - + showInformationControl(subjectArea); } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager#hideInformationControl() */ @@ -185,23 +185,23 @@ public class InformationControlReplacer extends AbstractInformationControlManage /** * Tells whether the replacer is currently replacing another information control. - * + * * @return <code>true</code> while code from {@link #replaceInformationControl(IInformationControlCreator, Rectangle, Object, Rectangle, boolean)} is run */ public boolean isReplacing() { return fIsReplacing; } - + /** * @return the current information control, or <code>null</code> if none available */ public IInformationControl getCurrentInformationControl2() { return getInternalAccessor().getCurrentInformationControl(); } - + /** * The number of pixels to blow up the keep-up zone. - * + * * @return the margin in pixels */ public int getKeepUpMargin() { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InternalAccessor.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InternalAccessor.java index 6e56d90e813..6fcb946e472 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InternalAccessor.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InternalAccessor.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -22,14 +22,14 @@ import org.eclipse.jface.text.ITextViewerExtension8.EnrichMode; /** * An internal class that gives access to internal methods of {@link * AbstractInformationControlManager} and subclasses. - * + * * @since 3.4 */ public abstract class InternalAccessor { /** * Returns the current information control, or <code>null</code> if none. - * + * * @return the current information control, or <code>null</code> if none */ public abstract IInformationControl getCurrentInformationControl(); @@ -37,7 +37,7 @@ public abstract class InternalAccessor { /** * Sets the information control replacer for this manager and disposes the * old one if set. - * + * * @param replacer the information control replacer for this manager, or * <code>null</code> if no information control replacing should * take place @@ -46,38 +46,38 @@ public abstract class InternalAccessor { /** * Returns the current information control replacer or <code>null</code> if none has been installed. - * + * * @return the current information control replacer or <code>null</code> if none has been installed */ public abstract InformationControlReplacer getInformationControlReplacer(); - + /** * Tests whether the given information control is replaceable. - * + * * @param iControl information control or <code>null</code> if none * @return <code>true</code> if information control is replaceable, <code>false</code> otherwise */ public abstract boolean canReplace(IInformationControl iControl); - + /** * Tells whether this manager's information control is currently being replaced. - * + * * @return <code>true</code> if a replace is in progress */ public abstract boolean isReplaceInProgress(); - + /** * Crops the given bounds such that they lie completely on the closest monitor. - * + * * @param bounds shell bounds to crop */ public abstract void cropToClosestMonitor(Rectangle bounds); - + /** * Sets the hover enrich mode. Only applicable when an information * control replacer has been set with * {@link #setInformationControlReplacer(InformationControlReplacer)} . - * + * * @param mode the enrich mode * @see ITextViewerExtension8#setHoverEnrichMode(org.eclipse.jface.text.ITextViewerExtension8.EnrichMode) */ @@ -85,18 +85,18 @@ public abstract class InternalAccessor { /** * Indicates whether the mouse cursor is allowed to leave the subject area without closing the hover. - * + * * @return whether the mouse cursor is allowed to leave the subject area without closing the hover */ public abstract boolean getAllowMouseExit(); - + /** * Replaces this manager's information control as defined by * the information control replacer. * <strong>Must only be called when the information control is instanceof {@link IInformationControlExtension3}!</strong> - * + * * @param takeFocus <code>true</code> iff the replacing information control should take focus */ public abstract void replaceInformationControl(boolean takeFocus); - + } 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 c183999f603..c8b2a9ded0c 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 @@ -26,6 +26,8 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; +import org.eclipse.jface.util.Geometry; + import org.eclipse.jface.text.IInformationControl; import org.eclipse.jface.text.IInformationControlExtension3; import org.eclipse.jface.text.IInformationControlExtension5; @@ -34,7 +36,6 @@ import org.eclipse.jface.text.IWidgetTokenKeeper; import org.eclipse.jface.text.IWidgetTokenKeeperExtension; import org.eclipse.jface.text.IWidgetTokenOwner; import org.eclipse.jface.text.TextViewer; -import org.eclipse.jface.util.Geometry; /** @@ -72,7 +73,7 @@ public class StickyHoverManager extends InformationControlReplacer implements IW class Closer implements IInformationControlCloser, ControlListener, MouseListener, IViewportListener, KeyListener, FocusListener, Listener { //TODO: Catch 'Esc' key in fInformationControlToClose: Don't dispose, just hideInformationControl(). // This would allow to reuse the information control also when the user explicitly closes it. - + //TODO: if subject control is a Scrollable, should add selection listeners to both scroll bars // (and remove the ViewPortListener, which only listens to vertical scrolling) @@ -113,7 +114,7 @@ public class StickyHoverManager extends InformationControlReplacer implements IW } fTextViewer.addViewportListener(this); - + IInformationControl fInformationControlToClose= getCurrentInformationControl2(); if (fInformationControlToClose != null) fInformationControlToClose.addFocusListener(this); @@ -141,11 +142,11 @@ public class StickyHoverManager extends InformationControlReplacer implements IW fSubjectControl.removeMouseListener(this); fSubjectControl.removeKeyListener(this); } - + IInformationControl fInformationControlToClose= getCurrentInformationControl2(); if (fInformationControlToClose != null) fInformationControlToClose.removeFocusListener(this); - + if (fDisplay != null && !fDisplay.isDisposed()) { fDisplay.removeFilter(SWT.MouseMove, this); fDisplay.removeFilter(SWT.FocusOut, this); @@ -207,13 +208,13 @@ public class StickyHoverManager extends InformationControlReplacer implements IW */ public void keyReleased(KeyEvent e) { } - + /* * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent) */ public void focusGained(FocusEvent e) { } - + /* * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent) */ @@ -227,7 +228,7 @@ public class StickyHoverManager extends InformationControlReplacer implements IW } }); } - + /* * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) */ @@ -235,7 +236,7 @@ public class StickyHoverManager extends InformationControlReplacer implements IW if (event.type == SWT.MouseMove) { if (!(event.widget instanceof Control) || event.widget.isDisposed()) return; - + IInformationControl infoControl= getCurrentInformationControl2(); if (infoControl != null && !infoControl.isFocusControl() && infoControl instanceof IInformationControlExtension3) { // if (DEBUG) System.out.println("StickyHoverManager.Closer.handleEvent(): activeShell= " + fDisplay.getActiveShell()); //$NON-NLS-1$ @@ -249,7 +250,7 @@ public class StickyHoverManager extends InformationControlReplacer implements IW hideInformationControl(); } } - + } else { /* * TODO: need better understanding of why/if this is needed. @@ -258,7 +259,7 @@ public class StickyHoverManager extends InformationControlReplacer implements IW if (fDisplay != null && !fDisplay.isDisposed()) fDisplay.removeFilter(SWT.MouseMove, this); } - + } else if (event.type == SWT.FocusOut) { if (DEBUG) System.out.println("StickyHoverManager.Closer.handleEvent(): focusOut: " + event); //$NON-NLS-1$ IInformationControl iControl= getCurrentInformationControl2(); @@ -268,21 +269,21 @@ public class StickyHoverManager extends InformationControlReplacer implements IW } } - + private final TextViewer fTextViewer; - + /** * Creates a new sticky hover manager. - * + * * @param textViewer the text viewer */ public StickyHoverManager(TextViewer textViewer) { super(new DefaultInformationControlCreator()); - + fTextViewer= textViewer; setCloser(new Closer()); - + install(fTextViewer.getTextWidget()); } @@ -372,5 +373,5 @@ public class StickyHoverManager extends InformationControlReplacer implements IW iControl.setFocus(); return iControl.isFocusControl(); } - + } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/TableOwnerDrawSupport.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/TableOwnerDrawSupport.java index b0d4b041ccc..114fff28f80 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/TableOwnerDrawSupport.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/TableOwnerDrawSupport.java @@ -25,13 +25,13 @@ import org.eclipse.swt.widgets.TableItem; /** * Adds owner draw support for tables. - * + * * @since 3.4 */ public class TableOwnerDrawSupport implements Listener { - + private static final String STYLED_RANGES_KEY= "styled_ranges"; //$NON-NLS-1$ - + private TextLayout fLayout; public static void install(Table table) { @@ -41,10 +41,10 @@ public class TableOwnerDrawSupport implements Listener { table.addListener(SWT.EraseItem, listener); table.addListener(SWT.PaintItem, listener); } - + /** * Stores the styled ranges in the given table item. - * + * * @param item table item * @param column the column index * @param ranges the styled ranges or <code>null</code> to remove them @@ -52,10 +52,10 @@ public class TableOwnerDrawSupport implements Listener { public static void storeStyleRanges(TableItem item, int column, StyleRange[] ranges) { item.setData(STYLED_RANGES_KEY + column, ranges); } - + /** * Returns the styled ranges which are stored in the given table item. - * + * * @param item table item * @param column the column index * @return the styled ranges @@ -91,28 +91,28 @@ public class TableOwnerDrawSupport implements Listener { /** * Performs the paint operation. - * + * * @param event the event */ private void performPaint(Event event) { TableItem item= (TableItem) event.item; GC gc= event.gc; int index= event.index; - + boolean isSelected= (event.detail & SWT.SELECTED) != 0; - + // Remember colors to restore the GC later Color oldForeground= gc.getForeground(); Color oldBackground= gc.getBackground(); - + if (!isSelected) { Color foreground= item.getForeground(index); gc.setForeground(foreground); - + Color background= item.getBackground(index); gc.setBackground(background); } - + Image image=item.getImage(index); if (image != null) { Rectangle imageBounds=item.getImageBounds(index); @@ -121,14 +121,14 @@ public class TableOwnerDrawSupport implements Listener { int y=imageBounds.y + Math.max(0, (imageBounds.height - bounds.height) / 2); gc.drawImage(image, x, y); } - + fLayout.setFont(item.getFont(index)); - + // XXX: needed to clear the style info, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=226090 fLayout.setText(""); //$NON-NLS-1$ - + fLayout.setText(item.getText(index)); - + StyleRange[] ranges= getStyledRanges(item, index); if (ranges != null) { for (int i= 0; i < ranges.length; i++) { @@ -141,7 +141,7 @@ public class TableOwnerDrawSupport implements Listener { fLayout.setStyle(curr, curr.start, curr.start + curr.length - 1); } } - + Rectangle textBounds=item.getTextBounds(index); if (textBounds != null) { Rectangle layoutBounds=fLayout.getBounds(); @@ -149,20 +149,20 @@ public class TableOwnerDrawSupport implements Listener { int y=textBounds.y + Math.max(0, (textBounds.height - layoutBounds.height) / 2); fLayout.draw(gc, x, y); } - + if ((event.detail & SWT.FOCUSED) != 0) { Rectangle focusBounds=item.getBounds(); gc.drawFocus(focusBounds.x, focusBounds.y, focusBounds.width, focusBounds.height); } - + if (!isSelected) { gc.setForeground(oldForeground); gc.setBackground(oldBackground); } } - + private void widgetDisposed() { fLayout.dispose(); } } - + 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 75a3b044940..9266039ec03 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 @@ -69,7 +69,7 @@ import org.eclipse.jface.text.TextPresentation; * <li>focusLost event is not sent - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=84532</li> * </ul> * </p> - * + * * @since 3.2 */ public class BrowserInformationControl extends AbstractInformationControl implements IInformationControlExtension2, IDelayedInputChangeProvider { @@ -88,7 +88,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem Browser browser= new Browser(parent, SWT.NONE); browser.dispose(); fgIsAvailable= true; - + Slider sliderV= new Slider(parent, SWT.VERTICAL); Slider sliderH= new Slider(parent, SWT.HORIZONTAL); int width= sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; @@ -114,7 +114,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem private static final int MIN_WIDTH= 80; private static final int MIN_HEIGHT= 50; - + /** * Availability checking cache. */ @@ -126,7 +126,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem * @since 3.4 */ private static Point fgScrollBarSize; - + /** The control's browser widget */ private Browser fBrowser; /** Tells whether the browser has content */ @@ -166,7 +166,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem /** * Creates a browser information control with the given shell as parent. - * + * * @param parent the parent shell * @param symbolicFontName the symbolic name of the font used for size computations * @param resizable <code>true</code> if the control should be resizable @@ -177,10 +177,10 @@ public class BrowserInformationControl extends AbstractInformationControl implem fSymbolicFontName= symbolicFontName; create(); } - + /** * Creates a browser information control with the given shell as parent. - * + * * @param parent the parent shell * @param symbolicFontName the symbolic name of the font used for size computations * @param statusFieldText the text to be used in the optional status field @@ -192,10 +192,10 @@ public class BrowserInformationControl extends AbstractInformationControl implem fSymbolicFontName= symbolicFontName; create(); } - + /** * Creates a browser information control with the given shell as parent. - * + * * @param parent the parent shell * @param symbolicFontName the symbolic name of the font used for size computations * @param toolBarManager the manager or <code>null</code> if toolbar is not desired @@ -206,13 +206,13 @@ public class BrowserInformationControl extends AbstractInformationControl implem fSymbolicFontName= symbolicFontName; create(); } - + /* * @see org.eclipse.jface.text.AbstractInformationControl#createContent(org.eclipse.swt.widgets.Composite) */ protected void createContent(Composite parent) { fBrowser= new Browser(parent, SWT.NONE); - + Display display= getShell().getDisplay(); fBrowser.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); fBrowser.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); @@ -231,16 +231,16 @@ public class BrowserInformationControl extends AbstractInformationControl implem fCompleted= true; } }); - + fBrowser.addOpenWindowListener(new OpenWindowListener() { public void open(WindowEvent event) { event.required= true; // Cancel opening of new windows } }); - + // Replace browser's built-in context menu with none fBrowser.setMenu(new Menu(getShell(), SWT.NONE)); - + createTextLayout(); } @@ -263,7 +263,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem } }); } - + /** * {@inheritDoc} This control can handle {@link String} and * {@link BrowserInformationControlInput}. @@ -277,11 +277,11 @@ public class BrowserInformationControl extends AbstractInformationControl implem } fInput= (BrowserInformationControlInput)input; - + String content= null; if (fInput != null) content= fInput.getHtml(); - + fBrowserHasContent= content != null && content.length() > 0; if (!fBrowserHasContent) @@ -303,20 +303,20 @@ public class BrowserInformationControl extends AbstractInformationControl implem styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ }; //$NON-NLS-1$ else styles= new String[] { "overflow:scroll;" }; //$NON-NLS-1$ - + StringBuffer buffer= new StringBuffer(content); HTMLPrinter.insertStyles(buffer, styles); content= buffer.toString(); - + /* * XXX: Should add some JavaScript here that shows something like * "(continued...)" or "..." at the end of the visible area when the page overflowed * with "overflow:hidden;". */ - + fCompleted= false; fBrowser.setText(content); - + Object[] listeners= fInputChangeListeners.getListeners(); for (int i= 0; i < listeners.length; i++) ((IInputChangedListener)listeners[i]).inputChanged(fInput); @@ -329,45 +329,45 @@ public class BrowserInformationControl extends AbstractInformationControl implem Shell shell= getShell(); if (shell.isVisible() == visible) return; - + if (!visible) { super.setVisible(false); setInput(null); return; } - + /* * The Browser widget flickers when made visible while it is not completely loaded. * The fix is to delay the call to setVisible until either loading is completed * (see ProgressListener in constructor), or a timeout has been reached. */ final Display display= shell.getDisplay(); - + // Make sure the display wakes from sleep after timeout: display.timerExec(100, new Runnable() { public void run() { fCompleted= true; } }); - + while (!fCompleted) { // Drive the event loop to process the events required to load the browser widget's contents: if (!display.readAndDispatch()) { display.sleep(); } } - + shell= getShell(); if (shell == null || shell.isDisposed()) return; - + /* * Avoids flickering when replacing hovers, especially on Vista in ON_CLICK mode. * Causes flickering on GTK. Carbon does not care. */ if ("win32".equals(SWT.getPlatform())) //$NON-NLS-1$ shell.moveAbove(null); - + super.setVisible(true); } @@ -386,12 +386,12 @@ public class BrowserInformationControl extends AbstractInformationControl implem /** * Creates and initializes the text layout used * to compute the size hint. - * + * * @since 3.2 */ private void createTextLayout() { fTextLayout= new TextLayout(fBrowser.getDisplay()); - + // Initialize fonts Font font= fSymbolicFontName == null ? JFaceResources.getDialogFont() : JFaceResources.getFont(fSymbolicFontName); fTextLayout.setFont(font); @@ -401,7 +401,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem fontData[i].setStyle(SWT.BOLD); font= new Font(getShell().getDisplay(), fontData); fBoldStyle= new TextStyle(font, null, null); - + // Compute and set tab width fTextLayout.setText(" "); //$NON-NLS-1$ int tabWidth = fTextLayout.getBounds().width; @@ -423,7 +423,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem fBoldStyle= null; } fBrowser= null; - + super.dispose(); } @@ -434,7 +434,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem Point sizeConstraints= getSizeConstraints(); Rectangle trim= computeTrim(); int height= trim.height; - + //FIXME: The HTML2TextReader does not render <p> like a browser. // Instead of inserting an empty line, it just adds a single line break. // Furthermore, the indentation of <dl><dd> elements is too small (e.g with a long @see line) @@ -455,7 +455,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem if (sr.fontStyle == SWT.BOLD) fTextLayout.setStyle(fBoldStyle, sr.start, sr.start + sr.length - 1); } - + Rectangle bounds= fTextLayout.getBounds(); // does not return minimum width, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=217446 int lineCount= fTextLayout.getLineCount(); int textWidth= 0; @@ -468,15 +468,15 @@ public class BrowserInformationControl extends AbstractInformationControl implem } bounds.width= textWidth; fTextLayout.setText(""); //$NON-NLS-1$ - + int minWidth= bounds.width; height= height + bounds.height; - + // Add some air to accommodate for different browser renderings minWidth+= 15; height+= 15; - + // Apply max size constraints if (sizeConstraints != null) { if (sizeConstraints.x != SWT.DEFAULT) @@ -488,7 +488,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem // Ensure minimal size int width= Math.max(MIN_WIDTH, minWidth); height= Math.max(MIN_HEIGHT, height); - + return new Point(width, height); } @@ -507,11 +507,11 @@ public class BrowserInformationControl extends AbstractInformationControl implem } return trim; } - + /** * Adds the listener to the collection of listeners who will be * notified when the current location has changed or is about to change. - * + * * @param listener the location listener * @since 3.4 */ @@ -541,11 +541,11 @@ public class BrowserInformationControl extends AbstractInformationControl implem public boolean hasContents() { return fBrowserHasContent; } - + /** * Adds a listener for input changes to this input change provider. * Has no effect if an identical listener is already registered. - * + * * @param inputChangeListener the listener to add * @since 3.4 */ @@ -553,18 +553,18 @@ public class BrowserInformationControl extends AbstractInformationControl implem Assert.isNotNull(inputChangeListener); fInputChangeListeners.add(inputChangeListener); } - + /** * Removes the given input change listener from this input change provider. * Has no effect if an identical listener is not registered. - * + * * @param inputChangeListener the listener to remove * @since 3.4 */ public void removeInputChangeListener(IInputChangedListener inputChangeListener) { fInputChangeListeners.remove(inputChangeListener); } - + /* * @see org.eclipse.jface.text.IDelayedInputChangeProvider#setDelayedInputChangeListener(org.eclipse.jface.text.IInputChangedListener) * @since 3.4 @@ -572,10 +572,10 @@ public class BrowserInformationControl extends AbstractInformationControl implem public void setDelayedInputChangeListener(IInputChangedListener inputChangeListener) { fDelayedInputChangeListener= inputChangeListener; } - + /** * Tells whether a delayed input change listener is registered. - * + * * @return <code>true</code> iff a delayed input change * listener is currently registered * @since 3.4 @@ -583,10 +583,10 @@ public class BrowserInformationControl extends AbstractInformationControl implem public boolean hasDelayedInputChangeListener() { return fDelayedInputChangeListener != null; } - + /** * Notifies listeners of a delayed input change. - * + * * @param newInput the new input, or <code>null</code> to request cancellation * @since 3.4 */ @@ -594,7 +594,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem if (fDelayedInputChangeListener != null) fDelayedInputChangeListener.inputChanged(newInput); } - + /* * @see java.lang.Object#toString() * @since 3.4 @@ -610,21 +610,21 @@ public class BrowserInformationControl extends AbstractInformationControl implem public BrowserInformationControlInput getInput() { return fInput; } - + /* * @see org.eclipse.jface.text.IInformationControlExtension5#computeSizeConstraints(int, int) */ public Point computeSizeConstraints(int widthInChars, int heightInChars) { if (fSymbolicFontName == null) return null; - + GC gc= new GC(fBrowser); Font font= fSymbolicFontName == null ? JFaceResources.getDialogFont() : JFaceResources.getFont(fSymbolicFontName); gc.setFont(font); int width= gc.getFontMetrics().getAverageCharWidth(); int height= gc.getFontMetrics().getHeight(); gc.dispose(); - + return new Point(widthInChars * width, heightInChars * height); } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControlInput.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControlInput.java index 004208a5527..25da7836c42 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControlInput.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControlInput.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -19,10 +19,10 @@ import org.eclipse.jface.text.DefaultInformationControl; * @since 3.4 */ public abstract class BrowserInformationControlInput extends BrowserInput { - + /** * Returns the leading image width. - * + * * @return the size of the leading image, by default <code>0</code> is returned * @since 3.4 */ @@ -32,7 +32,7 @@ public abstract class BrowserInformationControlInput extends BrowserInput { /** * Creates the next browser input with the given input as previous one. - * + * * @param previous the previous input or <code>null</code> if none */ public BrowserInformationControlInput(BrowserInformationControlInput previous) { @@ -43,12 +43,12 @@ public abstract class BrowserInformationControlInput extends BrowserInput { * @return the HTML contents */ public abstract String getHtml(); - + /** * Returns the HTML from {@link #getHtml()}. * This is a fallback mode for platforms where the {@link BrowserInformationControl} * is not available and this input is passed to a {@link DefaultInformationControl}. - * + * * @return {@link #getHtml()} */ public String toString() { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInput.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInput.java index 751188d7fb4..a4e06275519 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInput.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInput.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -14,10 +14,10 @@ package org.eclipse.jface.internal.text.html; /** * A browser input contains an input element and * a previous and a next input, if available. - * + * * The browser input also provides a human readable * name of its input element. - * + * * @since 3.4 */ public abstract class BrowserInput { @@ -27,7 +27,7 @@ public abstract class BrowserInput { /** * Create a new Browser input. - * + * * @param previous the input previous to this or <code>null</code> if this is the first */ public BrowserInput(BrowserInput previous) { @@ -39,7 +39,7 @@ public abstract class BrowserInput { /** * The previous input or <code>null</code> if this * is the first. - * + * * @return the previous input or <code>null</code> */ public BrowserInput getPrevious() { @@ -49,7 +49,7 @@ public abstract class BrowserInput { /** * The next input or <code>null</code> if this * is the last. - * + * * @return the next input or <code>null</code> */ public BrowserInput getNext() { @@ -58,14 +58,14 @@ public abstract class BrowserInput { /** * The element to use to set the browsers input. - * + * * @return the input element */ public abstract Object getInputElement(); /** * A human readable name for the input. - * + * * @return the input name */ public abstract String getInputName(); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTML2TextReader.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTML2TextReader.java index d23f7e033b1..50d29cb2d94 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTML2TextReader.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTML2TextReader.java @@ -144,7 +144,7 @@ public class HTML2TextReader extends SubstitutionTextReader { return EMPTY_STRING; html= html.toLowerCase(); - + String tag= html; if ('/' == tag.charAt(0)) tag= tag.substring(1); @@ -212,13 +212,13 @@ public class HTML2TextReader extends SubstitutionTextReader { if ("/dd".equals(html)) //$NON-NLS-1$ return LINE_DELIM; - + if ("head".equals(html) && !fHeaderDetected) { //$NON-NLS-1$ fHeaderDetected= true; fIgnore= true; return EMPTY_STRING; } - + if ("/head".equals(html) && fHeaderDetected && fIgnore) { //$NON-NLS-1$ fIgnore= false; return EMPTY_STRING; @@ -267,11 +267,11 @@ public class HTML2TextReader extends SubstitutionTextReader { return html2Text(buf.toString()); } - + private static boolean isInComment(StringBuffer buf) { return buf.length() >= 3 && "!--".equals(buf.substring(0, 3)); //$NON-NLS-1$ } - + private static boolean isCommentEnd(StringBuffer buf) { int tagLen= buf.length(); return tagLen >= 5 && "--".equals(buf.substring(tagLen - 2)); //$NON-NLS-1$ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLMessages.java index 69679ccf543..388f41e29cb 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLMessages.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLMessages.java @@ -10,10 +10,11 @@ *******************************************************************************/ package org.eclipse.jface.internal.text.html; -import com.ibm.icu.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; +import com.ibm.icu.text.MessageFormat; + /** * Helper class to get NLSed messages. 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 230d7d1dcb4..089513ae8fa 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 @@ -171,12 +171,12 @@ public class HTMLPrinter { private static void appendStyleSheetURL(StringBuffer buffer, String styleSheet) { if (styleSheet == null) return; - + buffer.append("<head><style CHARSET=\"ISO-8859-1\" TYPE=\"text/css\">"); //$NON-NLS-1$ buffer.append(styleSheet); buffer.append("</style></head>"); //$NON-NLS-1$ } - + private static void appendStyleSheetURL(StringBuffer buffer, URL styleSheetURL) { if (styleSheetURL == null) return; @@ -204,7 +204,7 @@ public class HTMLPrinter { appendColors(pageProlog, FG_COLOR_RGB, BG_COLOR_RGB); buffer.insert(position, pageProlog.toString()); } - + public static void insertPageProlog(StringBuffer buffer, int position, String styleSheet) { insertPageProlog(buffer, position, null, null, styleSheet); } @@ -252,7 +252,7 @@ public class HTMLPrinter { if (paragraphReader != null) addParagraph(buffer, read(paragraphReader)); } - + /** * Replaces the following style attributes of the font definition of the <code>html</code> * element: @@ -267,7 +267,7 @@ public class HTMLPrinter { * <p> * If the listed font attributes are not contained in the passed style list, nothing happens. * </p> - * + * * @param styles CSS style definitions * @param fontData the font information to use * @return the modified style definitions @@ -276,10 +276,10 @@ public class HTMLPrinter { public static String convertTopLevelFont(String styles, FontData fontData) { boolean bold= (fontData.getStyle() & SWT.BOLD) != 0; boolean italic= (fontData.getStyle() & SWT.ITALIC) != 0; - + // See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=155993 String size= Integer.toString(fontData.getHeight()) + ("carbon".equals(SWT.getPlatform()) ? "px" : "pt"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + String family= "'" + fontData.getName() + "',sans-serif"; //$NON-NLS-1$ //$NON-NLS-2$ styles= styles.replaceFirst("(html\\s*\\{.*(?:\\s|;)font-size:\\s*)\\d+pt(\\;?.*\\})", "$1" + size + "$2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ styles= styles.replaceFirst("(html\\s*\\{.*(?:\\s|;)font-weight:\\s*)\\w+(\\;?.*\\})", "$1" + (bold ? "bold" : "normal") + "$2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLTextPresenter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLTextPresenter.java index d28c5b055f0..3216f8e2afe 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLTextPresenter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLTextPresenter.java @@ -98,7 +98,7 @@ public class HTMLTextPresenter implements DefaultInformationControl.IInformation /** * {@inheritDoc} - * + * * @see org.eclipse.jface.text.DefaultInformationControl.IInformationPresenter#updatePresentation(org.eclipse.swt.widgets.Display, * java.lang.String, org.eclipse.jface.text.TextPresentation, int, int) * @deprecated Use {@link #updatePresentation(Drawable, String, TextPresentation, int, int)} diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/CompletionProposalPopup2.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/CompletionProposalPopup2.java index c5c46cffce2..8e5165cb8dc 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/CompletionProposalPopup2.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/CompletionProposalPopup2.java @@ -107,11 +107,11 @@ class CompletionProposalPopup2 implements IContentAssistListener2 { /** * Tells whether colored labels support is enabled. * Only valid while the popup is active. - * + * * @since 3.4 */ private boolean fIsColoredLabelsSupportEnabled= false; - + private final IEditingSupport fFocusEditingSupport= new IEditingSupport() { public boolean isOriginator(DocumentEvent event, IRegion focus) { @@ -265,7 +265,7 @@ class CompletionProposalPopup2 implements IContentAssistListener2 { // fProposalShell= new Shell(control.getShell(), SWT.ON_TOP | SWT.RESIZE ); fProposalTable= new Table(fProposalShell, SWT.H_SCROLL | SWT.V_SCROLL); // fProposalTable= new Table(fProposalShell, SWT.H_SCROLL | SWT.V_SCROLL); - + fIsColoredLabelsSupportEnabled= fContentAssistant.isColoredLabelsSupportEnabled(); if (fIsColoredLabelsSupportEnabled) @@ -543,7 +543,7 @@ class CompletionProposalPopup2 implements IContentAssistListener2 { item= new TableItem(fProposalTable, SWT.NULL); if (p.getImage() != null) item.setImage(p.getImage()); - + String displayString; StyleRange[] styleRanges= null; if (fIsColoredLabelsSupportEnabled && p instanceof ICompletionProposalExtension6) { @@ -556,7 +556,7 @@ class CompletionProposalPopup2 implements IContentAssistListener2 { item.setText(displayString); if (fIsColoredLabelsSupportEnabled) TableOwnerDrawSupport.storeStyleRanges(item, 0, styleRanges); - + item.setData(p); if (validate && validateProposal(document, p, endOffset, null)) { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.java index d00721d23bc..7bedef7a79d 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.java @@ -11,10 +11,11 @@ package org.eclipse.jface.internal.text.link.contentassist; -import com.ibm.icu.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; +import com.ibm.icu.text.MessageFormat; + /** * Helper class to get NLSed messages. 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 a767e6dd57f..d6a6cd25ef5 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 @@ -697,13 +697,13 @@ public class ContentAssistant2 implements IContentAssistant, IContentAssistantEx private String[] fProposalStrings; private ICompletionProposal[] fProposals; private final List fProposalListeners= new ArrayList(); - + /** * Tells whether colored label support is enabled. * @since 3.4 */ private boolean fIsColoredLabelsSupportEnabled= false; - + /** * Creates a new content assistant. The content assistant is not automatically activated, @@ -1560,10 +1560,10 @@ public class ContentAssistant2 implements IContentAssistant, IContentAssistantEx public void addProposalListener(IProposalListener listener) { fProposalListeners.add(listener); } - + /** * Tells whether the support for colored labels is enabled. - * + * * @return <code>true</code> if the support for colored labels is enabled, <code>false</code> otherwise * @since 3.4 */ @@ -1575,7 +1575,7 @@ public class ContentAssistant2 implements IContentAssistant, IContentAssistantEx * Enables the support for colored labels in the proposal popup. * <p>Completion proposals can implement {@link ICompletionProposalExtension6} * to provide colored proposal labels.</p> - * + * * @param isEnabled if <code>true</code> the support for colored labels is enabled in the proposal popup * @since 3.4 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/LineBreakingReader.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/LineBreakingReader.java index 4c9eabdf4bf..ce1f8e13af0 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/LineBreakingReader.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/LineBreakingReader.java @@ -36,7 +36,7 @@ public class LineBreakingReader { /** * Creates a reader that breaks an input text to fit in a given width. - * + * * @param reader Reader of the input text * @param gc The graphic context that defines the currently used font sizes * @param maxLineWidth The max width (pixels) where the text has to fit in @@ -57,7 +57,7 @@ public class LineBreakingReader { /** * Reads the next line. The lengths of the line will not exceed the given maximum width. - * + * * @return the next line * @throws IOException if an I/O error occurs */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/ChangeRegion.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/ChangeRegion.java index 04fe63c7c94..553215e3322 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/ChangeRegion.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/ChangeRegion.java @@ -24,17 +24,17 @@ import org.eclipse.jface.text.source.LineRange; * A change region describes a contiguous range of lines that was changed in the same revision of a * document. Once it is adjusted to diff information, the originally contiguous range may be split * into several ranges or even be empty. - * + * * @since 3.2 */ public final class ChangeRegion { private final Revision fRevision; private final ILineRange fLines; private final List fAdjusted= new LinkedList(); - + /** * Creates a new change region for the given revision and line range. - * + * * @param revision the revision of the new region * @param lines the line range of the new region * @throws IndexOutOfBoundsException if the line range is not well-formed @@ -46,10 +46,10 @@ public final class ChangeRegion { fRevision=revision; clearDiff(); } - + /** * Returns the revision that this region belongs to. - * + * * @return the revision that this region belongs to */ public Revision getRevision() { @@ -58,7 +58,7 @@ public final class ChangeRegion { /** * Returns the original (before applying diff information) line range of this change region. - * + * * @return the original (before applying diff information) line range of this change region */ public ILineRange getOriginalRange() { @@ -68,28 +68,28 @@ public final class ChangeRegion { /** * Returns the list of {@link ILineRange}s of this change region for which the revision * information is still valid. - * + * * @return the list of adjusted line ranges */ public List getAdjustedRanges() { return fAdjusted; } - + /** * Returns the line coverage of the adjusted ranges, an empty range if the coverage is empty. - * + * * @return the line coverage of the adjusted ranges */ public ILineRange getAdjustedCoverage() { if (fAdjusted.isEmpty()) return new LineRange(fLines.getStartLine(), 0); - + Range first= (Range) fAdjusted.get(0); Range last= (Range) fAdjusted.get(fAdjusted.size() - 1); - + return Range.createAbsolute(first.start(), last.end()); } - + /** * Clears any adjusted ranges, restoring the original range. */ @@ -97,16 +97,16 @@ public final class ChangeRegion { fAdjusted.clear(); fAdjusted.add(Range.copy(fLines)); } - + /** * Adjusts this change region to a diff hunk. This will change the adjusted ranges. - * + * * @param hunk the diff hunk to adjust to */ public void adjustTo(Hunk hunk) { for (ListIterator it= fAdjusted.listIterator(); it.hasNext();) { Range range= (Range) it.next(); - + // do we need a split? int unchanged= getUnchanged(hunk, range.start()); if (unchanged > 0) { @@ -116,40 +116,40 @@ public final class ChangeRegion { it.add(range); it.previous(); it.next(); // needed so we can remove below } - + int line= range.start(); Assert.isTrue(hunk.line <= line); - + // by how much do we shrink? int overlap= getOverlap(hunk, line); if (overlap >= range.length()) { it.remove(); continue; } - + // by how much do we move? range.moveBy(hunk.delta + overlap); range.resizeBy(-overlap); } - + } - + private int getUnchanged(Hunk hunk, int line) { return Math.max(0, hunk.line - line); } /* - * Returns the number of lines after line that the hunk reports as changed. + * Returns the number of lines after line that the hunk reports as changed. */ private int getOverlap(Hunk hunk, int line) { - + int deltaLine= hunk.line + hunk.changed; if (hunk.delta >= 0) { if (deltaLine <= line) return 0; return deltaLine - line; } - + // hunk.delta < 0 int hunkEnd= deltaLine - hunk.delta; int cutCount= hunkEnd - line; diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Colors.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Colors.java index 713e70f09c5..73fe458ca25 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Colors.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Colors.java @@ -10,14 +10,14 @@ *******************************************************************************/ package org.eclipse.jface.internal.text.revisions; -import org.eclipse.core.runtime.Assert; - import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.RGB; +import org.eclipse.core.runtime.Assert; + /** * Utility for color operations. - * + * * @since 3.3 */ public final class Colors { @@ -30,7 +30,7 @@ public final class Colors { /** * Returns the human-perceived brightness of a color as float in [0.0, 1.0]. The used RGB * weights come from http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC9. - * + * * @param rgb the color * @return the gray-scale value */ @@ -43,7 +43,7 @@ public final class Colors { * are lightened. Depending on the hue, the brightness range within the RGB gamut may be * different, outside values are clipped. Note that this is an approximation; the returned RGB * is not guaranteed to have the requested {@link #brightness(RGB) brightness}. - * + * * @param color the color to normalize * @param brightness the requested brightness, in [0, 1] * @return a normalized version of <code>color</code> @@ -61,7 +61,7 @@ public final class Colors { /** * Converts an {@link RGB} to an <a href="http://en.wikipedia.org/wiki/HSL_color_space">HSI</a> * triplet. - * + * * @param color the color to convert * @return the HSI float array of length 3 */ @@ -82,7 +82,7 @@ public final class Colors { hue = (g - b) / delta; } else { if (g == max) { - hue = 2 + (b - r) / delta; + hue = 2 + (b - r) / delta; } else { hue = 4 + (r - g) / delta; } @@ -95,7 +95,7 @@ public final class Colors { /** * Converts a <a href="http://en.wikipedia.org/wiki/HSL_color_space">HSI</a> triplet to an RGB. - * + * * @param hsi the HSI values * @return the RGB corresponding to the HSI spec */ @@ -105,7 +105,7 @@ public final class Colors { float saturation= hsi[1]; float intensity= hsi[2]; if (saturation == 0) { - r = g = b = intensity; + r = g = b = intensity; } else { float temp2= intensity < 0.5f ? intensity * (1.0f + saturation) : (intensity + saturation) - (intensity * saturation); float temp1= 2f * intensity - temp2; @@ -119,7 +119,7 @@ public final class Colors { int red = (int)(r * 255 + 0.5); int green = (int)(g * 255 + 0.5); - int blue = (int)(b * 255 + 0.5); + int blue = (int)(b * 255 + 0.5); return new RGB(red, green, blue); } @@ -145,7 +145,7 @@ public final class Colors { * @param bg the background color * @param fg the foreground color * @param factor the mixing factor, must be in [0, 1] - * + * * @return the interpolated color */ public static RGB blend(RGB bg, RGB fg, float factor) { @@ -166,7 +166,7 @@ public final class Colors { * <p> * The returned array has size <code>steps</code>, and the color at index 0 is <code>start</code>, the color * at index <code>steps - 1</code> is <code>end</code>. - * + * * @param start the start color of the palette * @param end the end color of the palette * @param steps the requested size, must be > 0 @@ -176,14 +176,14 @@ public final class Colors { Assert.isLegal(start != null); Assert.isLegal(end != null); Assert.isLegal(steps > 0); - + if (steps == 1) return new RGB[] { start }; float step= 1.0f / (steps - 1); RGB[] gradient= new RGB[steps]; for (int i= 0; i < steps; i++) - gradient[i]= blend(start, end, step * i); + gradient[i]= blend(start, end, step * i); return gradient; } @@ -204,7 +204,7 @@ public final class Colors { * {@link SWT#COLOR_YELLOW yellow}, {@link SWT#COLOR_CYAN cyan}, * {@link SWT#COLOR_MAGENTA magenta}. * </p> - * + * * @param steps the requested size, must be >= 2 * @return an array of <code>steps</code> colors evenly distributed on the color wheel */ @@ -228,7 +228,7 @@ public final class Colors { * {@link SWT#COLOR_YELLOW yellow}, {@link SWT#COLOR_CYAN cyan}, * {@link SWT#COLOR_MAGENTA magenta}. * </p> - * + * * @param index the index of the color, must be >= 0 * @return a color hue in [0°, 360°) * @see RGB#RGB(float, float, float) @@ -239,7 +239,7 @@ public final class Colors { * Base 3 gives a nice partitioning for RGB colors with red, green, blue being the colors * 0,1,2, and yellow, cyan, magenta colors 3,4,5. */ - final int base= 3; + final int base= 3; final float range= 360f; // partition the baseRange by using the least significant bit to select one half of the diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Hunk.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Hunk.java index 20208bfd5dd..07f32e2f04f 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Hunk.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Hunk.java @@ -15,7 +15,7 @@ import org.eclipse.core.runtime.Assert; /** * A hunk describes a contiguous range of changed, added or deleted lines. <code>Hunk</code>s are separated by * one or more unchanged lines. - * + * * @since 3.3 */ public final class Hunk { @@ -35,7 +35,7 @@ public final class Hunk { /** * Creates a new hunk. - * + * * @param line the line at which the hunk starts, must be >= 0 * @param delta the difference in lines compared to the original * @param changed the number of changed lines in this hunk, must be >= 0 @@ -54,7 +54,7 @@ public final class Hunk { public String toString() { return "Hunk [" + line + ">" + changed + (delta < 0 ? "-" : "+") + Math.abs(delta) + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ } - + /* * @see java.lang.Object#hashCode() */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/HunkComputer.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/HunkComputer.java index 122b749ab2a..2cf259da26a 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/HunkComputer.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/HunkComputer.java @@ -19,14 +19,14 @@ import org.eclipse.jface.text.source.ILineDiffer; /** * Computes the diff hunks from an {@link ILineDiffer}. - * + * * @since 3.3 */ public final class HunkComputer { /** * Converts the line-based information of {@link ILineDiffer} into {@link Hunk}s, grouping * contiguous blocks of lines that are changed (added, deleted). - * + * * @param differ the line differ to query * @param lines the number of lines to query * @return the corresponding {@link Hunk} information @@ -69,7 +69,7 @@ public final class HunkComputer { changed= 0; } } - + return (Hunk[]) hunks.toArray(new Hunk[hunks.size()]); } private HunkComputer() { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/LineIndexOutOfBoundsException.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/LineIndexOutOfBoundsException.java index d346f1e4547..89886a3daf1 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/LineIndexOutOfBoundsException.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/LineIndexOutOfBoundsException.java @@ -14,7 +14,7 @@ package org.eclipse.jface.internal.text.revisions; * Thrown to indicate that an attempt to create or modify a {@link Range} failed because it would * have resulted in an illegal range. A range is illegal if its length is <= 0 or if its start * line is < 0. - * + * * @since 3.2 */ public final class LineIndexOutOfBoundsException extends IndexOutOfBoundsException { @@ -29,16 +29,16 @@ public final class LineIndexOutOfBoundsException extends IndexOutOfBoundsExcepti /** * Constructs an <code>LineIndexOutOfBoundsException</code> with the specified detail message. - * + * * @param s the detail message. */ public LineIndexOutOfBoundsException(String s) { super(s); } - + /** - * Constructs a new <code>LineIndexOutOfBoundsException</code> - * object with an argument indicating the illegal index. + * Constructs a new <code>LineIndexOutOfBoundsException</code> + * object with an argument indicating the illegal index. * * @param index the illegal index. */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Range.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Range.java index 2d8d723db0b..430595ca07c 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Range.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Range.java @@ -23,13 +23,13 @@ import org.eclipse.jface.text.source.ILineRange; * result in a {@link LineIndexOutOfBoundsException} being * thrown. * </p> - * + * * @since 3.2 */ public final class Range implements ILineRange, Cloneable { /** * Creates a new range with the same start and length as the passed line range. - * + * * @param range the range to copy * @return a <code>Range</code> with the same start and length as <code>range</code> * @throws LineIndexOutOfBoundsException if the passed {@link ILineRange} does not adhere to the @@ -38,20 +38,20 @@ public final class Range implements ILineRange, Cloneable { public static Range copy(ILineRange range) throws LineIndexOutOfBoundsException { return createRelative(range.getStartLine(), range.getNumberOfLines()); } - + /** * Creates a new range equal to the passed line range. - * + * * @param range the range to copy * @return a <code>Range</code> equal to <code>range</code> */ public static Range copy(Range range) { return createRelative(range.start(), range.length()); } - + /** * Creates a new range with the given start offset and length. - * + * * @param start the first line of the new range, must be >= 0 * @param length the number of lines included in the new range, must be > 0 * @return a <code>Range</code> with the given start and length @@ -64,7 +64,7 @@ public final class Range implements ILineRange, Cloneable { /** * Creates a new range with the given start and end offsets. - * + * * @param start the first line of the new range, must be >= 0 * @param end the first line not in the range any more (exclusive), must be > <code>start</code> * @return a <code>Range</code> with the given start and end offsets @@ -85,7 +85,7 @@ public final class Range implements ILineRange, Cloneable { moveTo(start); setLength(length); } - + /* * @see org.eclipse.jface.text.source.ILineRange#getStartLine() */ @@ -99,37 +99,37 @@ public final class Range implements ILineRange, Cloneable { public int getNumberOfLines() { return length(); } - + /** * Returns the first line contained in this range. Short equivalent of {@link #getStartLine()}. - * + * * @return the first line contained in this range */ public int start() { return fStart; } - + /** * Returns the number of lines contained in this range. Short equivalent of {@link #getNumberOfLines()}. - * + * * @return the number of lines contained in this range */ public int length() { return fLength; } - + /** * Returns the first line after this range. Equivalent to {@linkplain #start() start} + {@linkplain #length() length}. - * + * * @return the first line after this range */ public int end() { return start() + length(); } - + /** * Moves the receiver to <code>start</code>, keeping {@link #length()} constant. - * + * * @param start the new start, must be >= 0 * @throws LineIndexOutOfBoundsException if <code>start</code> < 0 */ @@ -138,32 +138,32 @@ public final class Range implements ILineRange, Cloneable { throw new LineIndexOutOfBoundsException("Cannot set a negative start: " + start); //$NON-NLS-1$ fStart= start; } - + /** * Moves this range such that the {@link #end()} is at <code>end</code>, keeping * {@link #length()} constant. - * + * * @param end the new end * @throws LineIndexOutOfBoundsException if <code>end</code> <= {@link #start()} */ public void moveEndTo(int end) throws LineIndexOutOfBoundsException { moveTo(end - length()); } - + /** * Moves the range by <code>delta</code> lines, keeping {@link #length()} constant. The * resulting start line must be >= 0. - * + * * @param delta the number of lines to shift the range * @throws LineIndexOutOfBoundsException if <code>-delta</code> > {@link #start()} */ public void moveBy(int delta) throws LineIndexOutOfBoundsException { moveTo(start() + delta); } - + /** * Moves the start offset to <code>start</code>, keeping {@link #end()} constant. - * + * * @param start the new start, must be >= 0 and < {@link #end()} * @throws LineIndexOutOfBoundsException if <code>start</code> < 0 or >= {@link #end()} */ @@ -174,20 +174,20 @@ public final class Range implements ILineRange, Cloneable { moveTo(start); setEnd(end); } - + /** * Sets the end of this range, keeping {@link #start()} constant. - * + * * @param end the new end, must be > {@link #start()} * @throws LineIndexOutOfBoundsException if <code>end</code> <= {@link #start()} */ public void setEnd(int end) throws LineIndexOutOfBoundsException { setLength(end - start()); } - + /** * Sets the length of this range, keeping {@link #start()} constant. - * + * * @param length the new length, must be > 0 * @throws LineIndexOutOfBoundsException if <code>length</code> <= 0 */ @@ -196,41 +196,41 @@ public final class Range implements ILineRange, Cloneable { throw new LineIndexOutOfBoundsException("Cannot set length <= 0: " + length); //$NON-NLS-1$ fLength= length; } - + /** * Sets the length of this range, keeping {@link #end()} constant. - * + * * @param length the new length, must be > 0 and <= {@link #end()} * @throws LineIndexOutOfBoundsException if <code>length</code> <= 0 */ public void setLengthAndMove(int length) throws LineIndexOutOfBoundsException { setStart(end() - length); } - + /** * Resizes the range by <code>delta</code> lines, keeping {@link #start()} constant. - * + * * @param delta the number of lines to resize the range - * @throws LineIndexOutOfBoundsException if <code>-delta</code> >= {@link #length()} + * @throws LineIndexOutOfBoundsException if <code>-delta</code> >= {@link #length()} */ public void resizeBy(int delta) throws LineIndexOutOfBoundsException { setLength(length() + delta); } - + /** * Resizes the range by <code>delta</code> lines by moving the start offset, {@link #end()} remains unchanged. - * + * * @param delta the number of lines to resize the range - * @throws LineIndexOutOfBoundsException if <code>-delta</code> >= {@link #length()} + * @throws LineIndexOutOfBoundsException if <code>-delta</code> >= {@link #length()} */ public void resizeAndMoveBy(int delta) throws LineIndexOutOfBoundsException { setStart(start() + delta); } - + /** * Splits a range off the end of the receiver. The receiver is shortened to only include * <code>remaining</code> lines after the split. - * + * * @param remaining the number of lines to remain in the receiver, must be in [1, {@link #length() length}) * @return the split off range * @throws LineIndexOutOfBoundsException if <code>remaining</code>>= {@link #length()} or <code>remaining</code><t;= 0 @@ -243,10 +243,10 @@ public final class Range implements ILineRange, Cloneable { setLength(remaining); return new Range(end(), splitLength); } - + /** * Returns <code>true</code> if the passed range has the same offset and length as the receiver. - * + * * @param range another line range to compare the receiver to * @return <code>true</code> if <code>range</code> has the same offset and length as the receiver */ @@ -257,7 +257,7 @@ public final class Range implements ILineRange, Cloneable { return false; return range.getStartLine() == start() && range.getNumberOfLines() == length(); } - + /* * @see java.lang.Object#clone() */ 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 b4be180da27..6335210f740 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 @@ -88,7 +88,7 @@ import org.eclipse.jface.text.source.LineRange; /** * A strategy for painting the live annotate colors onto the vertical ruler column. It also manages * the revision hover. - * + * * @since 3.2 */ public final class RevisionPainter { @@ -99,7 +99,7 @@ public final class RevisionPainter { private static final RGB BY_DATE_START_COLOR= new RGB(199, 134, 57); private static final RGB BY_DATE_END_COLOR= new RGB(241, 225, 206); - + /** * The annotations created to show a revision in the overview ruler. */ @@ -150,14 +150,14 @@ public final class RevisionPainter { /** * Sets the revision information, which is needed to compute the relative age of a revision. - * + * * @param info the new revision info, <code>null</code> for none. */ public void setInfo(RevisionInformation info) { fRevisions= null; fColors.clear(); fFocusColors.clear(); - + if (info == null) return; List revisions= new ArrayList(); @@ -210,7 +210,7 @@ public final class RevisionPainter { int index= fRevisions.indexOf(new Long(age)); return index; } - + private RGB getShadedColor(RGB color, float scale, boolean focus) { Assert.isLegal(scale >= 0.0); Assert.isLegal(scale <= 1.0); @@ -242,7 +242,7 @@ public final class RevisionPainter { /** * Returns the color for a revision based on relative age and author. - * + * * @param revision the revision * @param focus <code>true</code> to return the focus color * @return the color for a revision @@ -252,7 +252,7 @@ public final class RevisionPainter { RGB color= (RGB) map.get(revision); if (color != null) return color; - + color= adaptColor(revision, focus); map.put(revision, color); return color; @@ -265,7 +265,7 @@ public final class RevisionPainter { private class MouseHandler implements MouseMoveListener, MouseTrackListener, Listener { private RevisionRange fMouseDownRegion; - + private void handleMouseUp(Event e) { if (e.button == 1) { RevisionRange upRegion= fFocusRange; @@ -356,7 +356,7 @@ public final class RevisionPainter { */ private static final class HoverInformationControlCreator extends AbstractReusableInformationControlCreator { private boolean fIsFocusable; - + public HoverInformationControlCreator(boolean isFocusable) { fIsFocusable= isFocusable; } @@ -369,18 +369,18 @@ public final class RevisionPainter { return new BrowserInformationControl(parent, JFaceResources.DIALOG_FONT, fIsFocusable) { /** * {@inheritDoc} - * + * * @deprecated use {@link #setInput(Object)} */ public void setInformation(String content) { content= addCSSToHTMLFragment(content); super.setInformation(content); } - + /** * Adds a HTML header and CSS info if <code>html</code> is only an HTML fragment (has no * <html> section). - * + * * @param html the html / text produced by a revision * @return modified html */ @@ -389,14 +389,14 @@ public final class RevisionPainter { if (html.substring(0, max).indexOf("<html>") != -1) //$NON-NLS-1$ // there is already a header return html; - + StringBuffer info= new StringBuffer(512 + html.length()); HTMLPrinter.insertPageProlog(info, 0, fgStyleSheet); info.append(html); HTMLPrinter.addPageEpilog(info); return info.toString(); } - + }; } return new DefaultInformationControl(parent, fIsFocusable); @@ -442,12 +442,12 @@ public final class RevisionPainter { "var { font-style: italic }\n" + //$NON-NLS-1$ "th { font-weight: bold }\n" + //$NON-NLS-1$ ""; //$NON-NLS-1$ - + /** * The revision hover displays information about the currently selected revision. */ private final class RevisionHover implements IAnnotationHover, IAnnotationHoverExtension, IAnnotationHoverExtension2, IInformationProviderExtension2 { - + /* * @see org.eclipse.jface.text.source.IAnnotationHover#getHoverInfo(org.eclipse.jface.text.source.ISourceViewer, * int) @@ -624,7 +624,7 @@ public final class RevisionPainter { /** * Creates a new revision painter for a vertical ruler column. - * + * * @param column the column that will delegate{@link #paint(GC, ILineRange) painting} to the * newly created painter. * @param sharedColors a shared colors object to store shaded colors in @@ -638,7 +638,7 @@ public final class RevisionPainter { /** * Sets the revision information to be drawn and triggers a redraw. - * + * * @param info the revision information to show, <code>null</code> to draw none */ public void setRevisionInformation(RevisionInformation info) { @@ -657,7 +657,7 @@ public final class RevisionPainter { /** * Changes the rendering mode and triggers redrawing if needed. - * + * * @param renderingMode the rendering mode * @since 3.3 */ @@ -672,7 +672,7 @@ public final class RevisionPainter { /** * Sets the background color. - * + * * @param background the background color, <code>null</code> for the platform's list * background */ @@ -683,7 +683,7 @@ public final class RevisionPainter { /** * Sets the parent ruler - the delegating column must call this method as soon as it creates its * control. - * + * * @param parentRuler the parent ruler */ public void setParentRuler(CompositeRuler parentRuler) { @@ -694,7 +694,7 @@ public final class RevisionPainter { * Delegates the painting of the quick diff colors to this painter. The painter will draw the * color boxes onto the passed {@link GC} for all model (document) lines in * <code>visibleModelLines</code>. - * + * * @param gc the {@link GC} to draw onto * @param visibleLines the lines (in document offsets) that are currently (perhaps only * partially) visible @@ -715,14 +715,14 @@ public final class RevisionPainter { } fAuthorInset= gc.stringExtent(new String(string)).x; } - + // recompute colors (show intense colors if ruler is narrow) int width= getWidth(); if (width != fLastWidth) { fColorTool.setInfo(fRevisionInfo); fLastWidth= width; } - + // draw change regions List/* <RevisionRange> */ranges= getRanges(visibleLines); for (Iterator it= ranges.iterator(); it.hasNext();) { @@ -763,13 +763,13 @@ public final class RevisionPainter { handleDispose(); } }); - + fRevisionSelectionProvider.install(fViewer); } /** * Returns <code>true</code> if the column is fully connected. - * + * * @return <code>true</code> if the column is fully connected, false otherwise */ private boolean isConnected() { @@ -778,7 +778,7 @@ public final class RevisionPainter { /** * Sets the annotation model. - * + * * @param model the annotation model, possibly <code>null</code> * @see IVerticalRulerColumn#setModel(IAnnotationModel) */ @@ -795,7 +795,7 @@ public final class RevisionPainter { /** * Sets the annotation model. - * + * * @param model the annotation model. */ private void setAnnotationModel(IAnnotationModel model) { @@ -805,7 +805,7 @@ public final class RevisionPainter { /** * Sets the line differ. - * + * * @param differ the line differ or <code>null</code> if none */ private void setDiffer(IAnnotationModel differ) { @@ -830,13 +830,13 @@ public final class RevisionPainter { ((IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener); fLineDiffer= null; } - + fRevisionSelectionProvider.uninstall(); } /** * Paints a single change region onto <code>gc</code>. - * + * * @param range the range to paint * @param gc the {@link GC} to paint on */ @@ -906,16 +906,16 @@ public final class RevisionPainter { */ int offset= fWidget.getOffsetAtLine(widgetLine); int widgetBaseline= fWidget.getBaseline(offset); - + FontMetrics fm = gc.getFontMetrics(); int fontBaseline = fm.getAscent() + fm.getLeading(); int baselineBias= widgetBaseline - fontBaseline; return Math.max(0, baselineBias); } - + /** * Looks up the color for a certain revision. - * + * * @param revision the revision to get the color for * @param focus <code>true</code> if it is the focus revision * @return the color for the revision @@ -927,7 +927,7 @@ public final class RevisionPainter { /** * Returns the revision range that contains the given line, or * <code>null</code> if there is none. - * + * * @param line the line of interest * @return the corresponding <code>RevisionRange</code> or <code>null</code> */ @@ -952,7 +952,7 @@ public final class RevisionPainter { /** * Returns the sublist of all <code>RevisionRange</code>s that intersect with the given lines. - * + * * @param lines the model based lines of interest * @return elementType: RevisionRange */ @@ -983,7 +983,7 @@ public final class RevisionPainter { /** * Gets all change ranges of the revisions in the revision model and adapts them to the current * quick diff information. The list is cached. - * + * * @return the list of all change regions, with diff information applied */ private List getRangeCache() { @@ -1010,11 +1010,11 @@ public final class RevisionPainter { private void clearRangeCache() { fRevisionRanges= null; } - + /** * Returns <code>true</code> if <code>range</code> contains <code>line</code>. A line is * not contained in a range if it is the range's exclusive end line. - * + * * @param range the range to check whether it contains <code>line</code> * @param line the line the line * @return <code>true</code> if <code>range</code> contains <code>line</code>, @@ -1026,7 +1026,7 @@ public final class RevisionPainter { /** * Computes the end index of a line range. - * + * * @param range a line range * @return the last line (exclusive) of <code>range</code> */ @@ -1036,7 +1036,7 @@ public final class RevisionPainter { /** * Returns the visible extent of a document line range in widget lines. - * + * * @param range the document line range * @return the visible extent of <code>range</code> in widget lines */ @@ -1074,7 +1074,7 @@ public final class RevisionPainter { /** * Returns the revision hover. - * + * * @return the revision hover */ public IAnnotationHover getHover() { @@ -1085,7 +1085,7 @@ public final class RevisionPainter { * Computes and returns the bounds of the rectangle corresponding to a widget line range. The * rectangle is in pixel coordinates relative to the text widget's * {@link StyledText#getClientArea() client area} and has the width of the ruler. - * + * * @param range the widget line range * @return the box bounds corresponding to <code>range</code> */ @@ -1102,7 +1102,7 @@ public final class RevisionPainter { private void updateOverviewAnnotations() { if (fAnnotationModel == null) return; - + Revision revision= fFocusRevision != null ? fFocusRevision : fSelectedRevision; Map added= null; @@ -1144,7 +1144,7 @@ public final class RevisionPainter { /** * Returns the character offset based region of a line range. - * + * * @param lines the line range to convert * @return the character offset range corresponding to <code>range</code> * @throws BadLocationException if the line range is not within the document bounds @@ -1163,7 +1163,7 @@ public final class RevisionPainter { /** * Handles the selection of a revision and informs listeners. - * + * * @param revision the selected revision, <code>null</code> for none */ void handleRevisionSelected(Revision revision) { @@ -1175,7 +1175,7 @@ public final class RevisionPainter { /** * Handles the selection of a revision id and informs listeners - * + * * @param id the selected revision id */ void handleRevisionSelected(String id) { @@ -1197,7 +1197,7 @@ public final class RevisionPainter { /** * Returns the selection provider. - * + * * @return the selection provider */ public RevisionSelectionProvider getRevisionSelectionProvider() { @@ -1206,7 +1206,7 @@ public final class RevisionPainter { /** * Updates the focus line with a new line. - * + * * @param line the new focus line, -1 for no focus */ private void updateFocusLine(int line) { @@ -1216,7 +1216,7 @@ public final class RevisionPainter { /** * Handles a changing focus line. - * + * * @param previousLine the old focus line (-1 for no focus) * @param nextLine the new focus line (-1 for no focus) */ @@ -1230,7 +1230,7 @@ public final class RevisionPainter { /** * Updates the focus range. - * + * * @param range the new focus range, <code>null</code> for no focus */ private void updateFocusRange(RevisionRange range) { @@ -1240,7 +1240,7 @@ public final class RevisionPainter { /** * Handles a changing focus range. - * + * * @param previousRange the old focus range (<code>null</code> for no focus) * @param nextRange the new focus range (<code>null</code> for no focus) */ @@ -1259,7 +1259,7 @@ public final class RevisionPainter { /** * Handles a changing focus revision. - * + * * @param previousRevision the old focus revision (<code>null</code> for no focus) * @param nextRevision the new focus revision (<code>null</code> for no focus) */ @@ -1296,7 +1296,7 @@ public final class RevisionPainter { /** * Handles a mouse wheel event. - * + * * @param event the mouse wheel event */ private void handleMouseWheel(Event event) { @@ -1372,7 +1372,7 @@ public final class RevisionPainter { /** * Translates a y coordinate in the pixel coordinates of the column's control to a document line * number. - * + * * @param y the y coordinate * @return the corresponding document line, -1 for no line * @see CompositeRuler#toDocumentLineNumber(int) @@ -1397,7 +1397,7 @@ public final class RevisionPainter { /** * Returns the width of the column. - * + * * @return the width of the column */ private int getWidth() { @@ -1406,7 +1406,7 @@ public final class RevisionPainter { /** * Returns the System background color for list widgets. - * + * * @return the System background color for list widgets */ private Color getBackground() { @@ -1417,7 +1417,7 @@ public final class RevisionPainter { /** * Sets the hover later returned by {@link #getHover()}. - * + * * @param hover the hover */ public void setHover(IAnnotationHover hover) { @@ -1426,7 +1426,7 @@ public final class RevisionPainter { /** * Returns <code>true</code> if the receiver can provide a hover for a certain document line. - * + * * @param activeLine the document line of interest * @return <code>true</code> if the receiver can provide a hover */ @@ -1436,7 +1436,7 @@ public final class RevisionPainter { /** * Returns the revision at a certain document offset, or <code>null</code> for none. - * + * * @param offset the document offset * @return the revision at offset, or <code>null</code> for none */ @@ -1458,7 +1458,7 @@ public final class RevisionPainter { /** * Returns <code>true</code> if a revision model has been set, <code>false</code> otherwise. - * + * * @return <code>true</code> if a revision model has been set, <code>false</code> otherwise */ public boolean hasInformation() { @@ -1467,7 +1467,7 @@ public final class RevisionPainter { /** * Returns the width in chars required to display information. - * + * * @return the width in chars required to display information * @since 3.3 */ @@ -1497,7 +1497,7 @@ public final class RevisionPainter { /** * Enables showing the revision id. - * + * * @param show <code>true</code> to show the revision, <code>false</code> to hide it */ public void showRevisionId(boolean show) { @@ -1508,10 +1508,10 @@ public final class RevisionPainter { postRedraw(); } } - + /** * Enables showing the revision author. - * + * * @param show <code>true</code> to show the author, <code>false</code> to hide it */ public void showRevisionAuthor(boolean show) { @@ -1525,7 +1525,7 @@ public final class RevisionPainter { /** * Adds a revision listener. - * + * * @param listener the listener * @since 3.3 */ @@ -1535,7 +1535,7 @@ public final class RevisionPainter { /** * Removes a revision listener. - * + * * @param listener the listener * @since 3.3 */ @@ -1545,7 +1545,7 @@ public final class RevisionPainter { /** * Informs the revision listeners about a change. - * + * * @since 3.3 */ private void informListeners() { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java index a8539a6cfe6..b1021e349a7 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java @@ -12,10 +12,6 @@ package org.eclipse.jface.internal.text.revisions; import org.eclipse.core.runtime.ListenerList; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.revisions.Revision; - import org.eclipse.jface.viewers.IPostSelectionProvider; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; @@ -24,6 +20,10 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.text.ITextSelection; +import org.eclipse.jface.text.ITextViewer; +import org.eclipse.jface.text.revisions.Revision; + /** * A selection provider for annotate revisions. Selections of a revision can currently happen in * following ways - note that this list may be changed in the future: @@ -34,7 +34,7 @@ import org.eclipse.jface.viewers.StructuredSelection; * <p> * Calling {@link #setSelection(ISelection)} will set the current sticky revision on the ruler. * </p> - * + * * @since 3.2 */ public final class RevisionSelectionProvider implements ISelectionProvider { @@ -58,9 +58,9 @@ public final class RevisionSelectionProvider implements ISelectionProvider { int offset= ts.getOffset(); setSelectedRevision(fPainter.getRevision(offset)); } - + } - + public void dispose() { fPostProvider.removePostSelectionChangedListener(this); } @@ -68,7 +68,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider { private final RevisionPainter fPainter; private final ListenerList fListeners= new ListenerList(); - + /** * The text viewer once we are installed, <code>null</code> if not installed. */ @@ -90,7 +90,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider { /** * Creates a new selection provider. - * + * * @param painter the painter that the created provider interacts with */ RevisionSelectionProvider(RevisionPainter painter) { @@ -110,7 +110,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider { public void removeSelectionChangedListener(ISelectionChangedListener listener) { fListeners.remove(listener); } - + /* * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection() */ @@ -139,7 +139,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider { /** * Installs the selection provider on the viewer. - * + * * @param viewer the viewer on which we listen to for post selection events */ void install(ITextViewer viewer) { @@ -153,7 +153,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider { } } } - + /** * Uninstalls the selection provider. */ @@ -167,7 +167,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider { /** * Private protocol used by {@link RevisionPainter} to signal selection of a revision. - * + * * @param revision the selected revision, or <code>null</code> for none */ void revisionSelected(Revision revision) { @@ -176,7 +176,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider { /** * Updates the currently selected revision and sends out an event if it changed. - * + * * @param revision the newly selected revision or <code>null</code> for none */ private void setSelectedRevision(Revision revision) { 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 c3d462ea20f..aafea2e6bab 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 @@ -42,7 +42,7 @@ import org.eclipse.jface.text.source.IVerticalRulerColumn; /** * A strategy for painting the quick diff colors onto the vertical ruler column. It also manages the * quick diff hover. - * + * * @since 3.2 */ public final class DiffPainter { @@ -87,7 +87,7 @@ public final class DiffPainter { /** * Creates a new diff painter for a vertical ruler column. - * + * * @param column the column that will delegate{@link #paint(GC, ILineRange) painting} to the * newly created painter. * @param sharedColors a shared colors object to store shaded colors in, may be @@ -102,7 +102,7 @@ public final class DiffPainter { /** * Sets the parent ruler - the delegating column must call this method as soon as it creates its * control. - * + * * @param parentRuler the parent ruler */ public void setParentRuler(CompositeRuler parentRuler) { @@ -111,7 +111,7 @@ public final class DiffPainter { /** * Sets the quick diff hover later returned by {@link #getHover()}. - * + * * @param hover the hover */ public void setHover(IAnnotationHover hover) { @@ -120,7 +120,7 @@ public final class DiffPainter { /** * Returns the quick diff hover set by {@link #setHover(IAnnotationHover)}. - * + * * @return the quick diff hover set by {@link #setHover(IAnnotationHover)} */ public IAnnotationHover getHover() { @@ -129,7 +129,7 @@ public final class DiffPainter { /** * Sets the background color. - * + * * @param background the background color, <code>null</code> to use the platform's list background */ public void setBackground(Color background) { @@ -140,7 +140,7 @@ public final class DiffPainter { * Delegates the painting of the quick diff colors to this painter. The painter will draw the * color boxes onto the passed {@link GC} for all model (document) lines in * <code>visibleModelLines</code>. - * + * * @param gc the {@link GC} to draw onto * @param visibleModelLines the lines (in document offsets) that are currently (perhaps only * partially) visible @@ -191,7 +191,7 @@ public final class DiffPainter { /** * Returns <code>true</code> if the column is fully connected. - * + * * @return <code>true</code> if the column is fully connected, false otherwise */ private boolean isConnected() { @@ -210,7 +210,7 @@ public final class DiffPainter { /** * Paints a single model line onto <code>gc</code>. - * + * * @param line the model line to paint * @param gc the {@link GC} to paint onto * @param width the width of the column @@ -248,7 +248,7 @@ public final class DiffPainter { /** * Returns whether the line background differs from the default. - * + * * @param info the info being queried * @return <code>true</code> if <code>info</code> describes either a changed or an added * line. @@ -260,7 +260,7 @@ public final class DiffPainter { /** * Retrieves the <code>ILineDiffInfo</code> for <code>line</code> from the model. There are * optimizations for direct access and sequential access patterns. - * + * * @param line the line we want the info for. * @return the <code>ILineDiffInfo</code> for <code>line</code>, or <code>null</code>. */ @@ -273,7 +273,7 @@ public final class DiffPainter { /** * Returns the color for deleted lines. - * + * * @return the color to be used for the deletion indicator */ private Color getDeletionColor() { @@ -282,7 +282,7 @@ public final class DiffPainter { /** * Returns the color for the given line diff info. - * + * * @param info the <code>ILineDiffInfo</code> being queried * @return the correct background color for the line type being described by <code>info</code> */ @@ -302,7 +302,7 @@ public final class DiffPainter { /** * Sets the background color for changed lines. - * + * * @param color the new color to be used for the changed lines background * @return the shaded color */ @@ -328,7 +328,7 @@ public final class DiffPainter { /** * Sets the annotation model. - * + * * @param model the annotation model, possibly <code>null</code> * @see IVerticalRulerColumn#setModel(IAnnotationModel) */ @@ -344,7 +344,7 @@ public final class DiffPainter { /** * Sets the line differ. - * + * * @param differ the line differ */ private void setDiffer(IAnnotationModel differ) { @@ -384,7 +384,7 @@ public final class DiffPainter { /** * Returns the width of the column. - * + * * @return the width of the column */ private int getWidth() { @@ -393,7 +393,7 @@ public final class DiffPainter { /** * Computes the end index of a line range. - * + * * @param range a line range * @return the last line (exclusive) of <code>range</code> */ @@ -403,7 +403,7 @@ public final class DiffPainter { /** * Returns the System background color for list widgets or the set background. - * + * * @return the System background color for list widgets */ private Color getBackground() { @@ -414,7 +414,7 @@ public final class DiffPainter { /** * Sets the color for added lines. - * + * * @param addedColor the color for added lines * @see org.eclipse.jface.text.source.IChangeRulerColumn#setAddedColor(org.eclipse.swt.graphics.Color) */ @@ -424,7 +424,7 @@ public final class DiffPainter { /** * Sets the color for changed lines. - * + * * @param changedColor the color for changed lines * @see org.eclipse.jface.text.source.IChangeRulerColumn#setChangedColor(org.eclipse.swt.graphics.Color) */ @@ -434,7 +434,7 @@ public final class DiffPainter { /** * Sets the color for deleted lines. - * + * * @param deletedColor the color for deleted lines * @see org.eclipse.jface.text.source.IChangeRulerColumn#setDeletedColor(org.eclipse.swt.graphics.Color) */ @@ -444,7 +444,7 @@ public final class DiffPainter { /** * Returns <code>true</code> if the receiver can provide a hover for a certain document line. - * + * * @param activeLine the document line of interest * @return <code>true</code> if the receiver can provide a hover */ @@ -454,7 +454,7 @@ public final class DiffPainter { /** * Returns the display character for the accessibility mode for a certain model line. - * + * * @param line the document line of interest * @return the display character for <code>line</code> */ @@ -465,7 +465,7 @@ public final class DiffPainter { /** * Returns the character to display in character display mode for the given * <code>ILineDiffInfo</code> - * + * * @param info the <code>ILineDiffInfo</code> being queried * @return the character indication for <code>info</code> */ @@ -484,7 +484,7 @@ public final class DiffPainter { /** * Returns a specification of a color that lies between the given foreground and background * color using the given scale factor. - * + * * @param fg the foreground color * @param bg the background color * @param scale the scale factor @@ -496,7 +496,7 @@ public final class DiffPainter { /** * Returns the grey value in which the given color would be drawn in grey-scale. - * + * * @param rgb the color * @return the grey-scale value */ @@ -508,7 +508,7 @@ public final class DiffPainter { /** * Returns whether the given color is dark or light depending on the colors grey-scale level. - * + * * @param rgb the color * @return <code>true</code> if the color is dark, <code>false</code> if it is light */ @@ -518,7 +518,7 @@ public final class DiffPainter { /** * Returns <code>true</code> if diff information is being displayed, <code>false</code> otherwise. - * + * * @return <code>true</code> if diff information is being displayed, <code>false</code> otherwise * @since 3.3 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractHoverInformationControlManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractHoverInformationControlManager.java index ca66688219a..5a0b52d4bf9 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractHoverInformationControlManager.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractHoverInformationControlManager.java @@ -10,12 +10,6 @@ *******************************************************************************/ package org.eclipse.jface.text; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; - import org.eclipse.swt.SWT; import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.ControlListener; @@ -38,12 +32,19 @@ import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.ScrollBar; import org.eclipse.swt.widgets.Scrollable; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; + import org.eclipse.jface.internal.text.DelayedInputChangeListener; import org.eclipse.jface.internal.text.InformationControlReplacer; import org.eclipse.jface.internal.text.InternalAccessor; +import org.eclipse.jface.util.Geometry; + import org.eclipse.jface.text.ITextViewerExtension8.EnrichMode; import org.eclipse.jface.text.source.AnnotationBarHoverManager; -import org.eclipse.jface.util.Geometry; /** @@ -63,14 +64,14 @@ import org.eclipse.jface.util.Geometry; * @since 2.0 */ abstract public class AbstractHoverInformationControlManager extends AbstractInformationControlManager { - + /** * The information control closer for the hover information. Closes the information control as * soon as the mouse pointer leaves the subject area (unless "move into hover" is enabled), * a mouse button is pressed, the user presses a key, or the subject control is resized, moved, or loses focus. */ class Closer implements IInformationControlCloser, MouseListener, MouseMoveListener, ControlListener, KeyListener, SelectionListener, Listener { - + /** The closer's subject control */ private Control fSubjectControl; /** The subject area */ @@ -130,17 +131,17 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf if (hBar != null) hBar.addSelectionListener(this); } - + fDisplay= fSubjectControl.getDisplay(); if (!fDisplay.isDisposed()) { fDisplay.addFilter(SWT.Activate, this); fDisplay.addFilter(SWT.MouseWheel, this); - + fDisplay.addFilter(SWT.FocusOut, this); - + fDisplay.addFilter(SWT.MouseDown, this); fDisplay.addFilter(SWT.MouseUp, this); - + fDisplay.addFilter(SWT.MouseMove, this); fDisplay.addFilter(SWT.MouseEnter, this); fDisplay.addFilter(SWT.MouseExit, this); @@ -179,12 +180,12 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf if (fDisplay != null && !fDisplay.isDisposed()) { fDisplay.removeFilter(SWT.Activate, this); fDisplay.removeFilter(SWT.MouseWheel, this); - + fDisplay.removeFilter(SWT.FocusOut, this); - + fDisplay.removeFilter(SWT.MouseDown, this); fDisplay.removeFilter(SWT.MouseUp, this); - + fDisplay.removeFilter(SWT.MouseMove, this); fDisplay.removeFilter(SWT.MouseEnter, this); fDisplay.removeFilter(SWT.MouseExit, this); @@ -261,13 +262,13 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf public void widgetSelected(SelectionEvent e) { hideInformationControl(); } - + /* * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) */ public void widgetDefaultSelected(SelectionEvent e) { } - + /* * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) * @since 3.1 @@ -293,7 +294,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf } } break; - + case SWT.MouseUp: case SWT.MouseDown: if (!hasInformationControlReplacer()) @@ -319,7 +320,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf } }); } - + // XXX: workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=212392 : control.getShell().getDisplay().asyncExec(new Runnable() { public void run() { @@ -341,7 +342,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf if (iControl != null && ! iControl.isFocusControl()) hideInformationControl(); break; - + case SWT.MouseMove: case SWT.MouseEnter: case SWT.MouseExit: @@ -352,24 +353,24 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf /** * Handle mouse movement events. - * + * * @param event the event * @since 3.4 */ private void handleMouseMove(Event event) { // if (DEBUG) // System.out.println("AbstractHoverInformationControl.Closer.handleMouseMove():" + event); //$NON-NLS-1$ - + if (!(event.widget instanceof Control)) return; Control eventControl= (Control) event.widget; - + //transform coordinates to subject control: Point mouseLoc= event.display.map(eventControl, fSubjectControl, event.x, event.y); - + if (fSubjectArea.contains(mouseLoc)) return; - + IInformationControl iControl= getCurrentInformationControl(); if (!hasInformationControlReplacer() || !canMoveIntoInformationControl(iControl)) { if (AbstractHoverInformationControlManager.this instanceof AnnotationBarHoverManager) { @@ -379,7 +380,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf hideInformationControl(); return; } - + IInformationControlExtension3 iControl3= (IInformationControlExtension3) iControl; Rectangle controlBounds= iControl3.getBounds(); if (controlBounds != null) { @@ -496,7 +497,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf System.out.println("AbstractHoverInformationControlManager...mouseHover: @ " + event.x + "/" + event.y + " : hover cancelled: fIsComputing= " + fIsComputing + ", fIsInRestartMode= " + fIsInRestartMode); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ return; } - + fIsInRestartMode= true; fIsComputing= true; fMouseLostWhileComputing= false; @@ -526,7 +527,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf protected void deactivate() { if (fIsComputing) return; - + fIsInRestartMode= false; if (fSubjectControl != null && !fSubjectControl.isDisposed()) { fSubjectControl.removeMouseMoveListener(this); @@ -632,24 +633,24 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf /** * The thread that delays replacing of the hover information control. * To be accessed in the UI thread only! - * + * * @since 3.4 */ private Job fReplacingDelayJob; - + /** * The {@link ITextViewerExtension8.EnrichMode}, may be <code>null</code>. * @since 3.4 */ private EnrichMode fEnrichMode; - + /** * Indicates whether we have received a MouseDown event and are waiting for a MouseUp * (and don't replace the information control until that happened). * @since 3.4 */ private boolean fWaitForMouseUp= false; - + /** * Creates a new hover information control manager using the given information control creator. * By default a <code>Closer</code> instance is set as this manager's closer. @@ -665,21 +666,21 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf /** * Tests whether a given mouse location is within the keep-up zone. * The hover should not be hidden as long as the mouse stays inside this zone. - * + * * @param x the x coordinate, relative to the <em>subject control</em> * @param y the y coordinate, relative to the <em>subject control</em> * @param subjectControl the subject control * @param subjectArea the area for which the presented information is valid * @param blowUp If <code>true</code>, then calculate for the closer, i.e. blow up the keepUp area. * If <code>false</code>, then use tight bounds for hover detection. - * + * * @return <code>true</code> iff the mouse event occurred in the keep-up zone * @since 3.4 */ private boolean inKeepUpZone(int x, int y, Control subjectControl, Rectangle subjectArea, boolean blowUp) { if (subjectArea.contains(x, y)) return true; - + IInformationControl iControl= getCurrentInformationControl(); if ((iControl instanceof IInformationControlExtension5 && !((IInformationControlExtension5) iControl).isVisible())) { iControl= null; @@ -692,7 +693,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf } if (iControl instanceof IInformationControlExtension3) { IInformationControlExtension3 iControl3= (IInformationControlExtension3) iControl; - + Rectangle iControlBounds= subjectControl.getDisplay().map(null, subjectControl, iControl3.getBounds()); Rectangle totalBounds= Geometry.copy(iControlBounds); if (blowUp && isReplaceInProgress()) { @@ -701,11 +702,11 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf int margin= getInformationControlReplacer().getKeepUpMargin(); Geometry.expand(totalBounds, margin, margin, margin, margin); } - + if (!blowUp) { if (iControlBounds.contains(x, y)) return true; - + if (subjectArea.y + subjectArea.height < iControlBounds.y) { // special case for hover events: subjectArea totally above iControl: // +-----------+ @@ -724,7 +725,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf // FIXME: cases when subjectArea extends to left or right of iControl? } return false; - + } else if (iControlBounds.x + iControlBounds.width < subjectArea.x) { // special case for hover events (e.g. in overview ruler): iControl totally left of subjectArea // +--------------------+-----------+ @@ -740,7 +741,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf } } return false; - + } else if (subjectArea.x + subjectArea.width < iControlBounds.x) { // special case for hover events (e.g. in annotation ruler): subjectArea totally left of iControl // +-----------+--------------------+ @@ -758,7 +759,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf return false; } } - + // FIXME: should maybe use convex hull, not bounding box totalBounds.add(subjectArea); if (totalBounds.contains(x, y)) @@ -766,11 +767,11 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf } return false; } - + /** * Tests whether the given information control allows the mouse to be moved * into it. - * + * * @param iControl information control or <code>null</code> if none * @return <code>true</code> if information control allows mouse move into * control, <code>false</code> otherwise @@ -778,7 +779,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf boolean canMoveIntoInformationControl(IInformationControl iControl) { return fEnrichMode != null && canReplace(iControl); } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager#hideInformationControl() */ @@ -791,7 +792,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf * Sets the hover enrich mode. Only applicable when an information * control replacer has been set with * {@link #setInformationControlReplacer(InformationControlReplacer)} . - * + * * @param mode the enrich mode * @since 3.4 * @see ITextViewerExtension8#setHoverEnrichMode(org.eclipse.jface.text.ITextViewerExtension8.EnrichMode) @@ -799,7 +800,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf void setHoverEnrichMode(EnrichMode mode) { fEnrichMode= mode; } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager#replaceInformationControl(boolean) */ @@ -807,7 +808,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf fWaitForMouseUp= false; super.replaceInformationControl(takeFocus); } - + /** * Cancels the replacing delay job. * @return <code>true</code> iff canceling was successful, <code>false</code> if replacing has already started @@ -825,20 +826,20 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf // System.out.println("AbstractHoverInformationControlManager.cancelReplacingDelay(): not delayed"); //$NON-NLS-1$ return true; } - + /** * Starts replacing the information control, considering the current * {@link ITextViewerExtension8.EnrichMode}. * If set to {@link ITextViewerExtension8.EnrichMode#AFTER_DELAY}, this * method cancels previous requests and restarts the delay timer. - * + * * @param display the display to be used for the call to * {@link #replaceInformationControl(boolean)} in the UI thread */ private void startReplaceInformationControl(final Display display) { if (fEnrichMode == EnrichMode.ON_CLICK) return; - + if (fReplacingDelayJob != null) { if (fReplacingDelayJob.getState() != Job.RUNNING) { if (fReplacingDelayJob.cancel()) { @@ -855,7 +856,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf } return; } - + fReplacingDelayJob= new Job("AbstractHoverInformationControlManager Replace Delayer") { //$NON-NLS-1$ public IStatus run(final IProgressMonitor monitor) { if (monitor.isCanceled() || display.isDisposed()) { @@ -960,12 +961,12 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf protected int getHoverEventStateMask() { return fHoverEventStateMask; } - + /** * Returns an adapter that gives access to internal methods. * <p> * <strong>Note:</strong> This method is not intended to be referenced or overridden by clients.</p> - * + * * @return the replaceable information control accessor * @since 3.4 * @noreference This method is not intended to be referenced by clients. diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java index b0ea42e4478..974a479cf2c 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java @@ -63,7 +63,7 @@ import org.eclipse.jface.util.Geometry; * They should also extend {@link #computeTrim()} if they create a content area * with additional trim (e.g. scrollbars) and override {@link #getInformationPresenterControlCreator()}. * </p> - * + * * @since 3.4 */ public abstract class AbstractInformationControl implements IInformationControl, IInformationControlExtension, IInformationControlExtension3, IInformationControlExtension4, IInformationControlExtension5 { @@ -74,7 +74,7 @@ public abstract class AbstractInformationControl implements IInformationControl, private final Composite fContentComposite; /** Whether the information control is resizable. */ private final boolean fResizable; - + /** Composite containing the status line content or <code>null</code> if none. */ private Composite fStatusComposite; /** Separator between content and status line or <code>null</code> if none. */ @@ -85,17 +85,17 @@ public abstract class AbstractInformationControl implements IInformationControl, private final ToolBarManager fToolBarManager; /** Status line toolbar or <code>null</code> if none. */ private ToolBar fToolBar; - + /** Listener for shell activation and deactivation. */ private Listener fShellListener; /** All focus listeners registered to this information control. */ private ListenerList fFocusListeners= new ListenerList(ListenerList.IDENTITY); - + /** Size constraints, x is the maxWidth and y is the maxHeight, or <code>null</code> if not set. */ private Point fSizeConstraints; /** The size of the resize handle if already set, -1 otherwise */ private int fResizeHandleSize; - + /** * Creates an abstract information control with the given shell as parent. * The control will not be resizable and optionally show a status line with @@ -103,7 +103,7 @@ public abstract class AbstractInformationControl implements IInformationControl, * <p> * <em>Important: Subclasses are required to call {@link #create()} at the end of their constructor.</em> * </p> - * + * * @param parentShell the parent of this control's shell * @param statusFieldText the text to be used in the status field or <code>null</code> to hide the status field */ @@ -118,7 +118,7 @@ public abstract class AbstractInformationControl implements IInformationControl, * <p> * <em>Important: Subclasses are required to call {@link #create()} at the end of their constructor.</em> * </p> - * + * * @param parentShell the parent of this control's shell * @param toolBarManager the manager or <code>null</code> if toolbar is not desired */ @@ -131,7 +131,7 @@ public abstract class AbstractInformationControl implements IInformationControl, * <p> * <em>Important: Subclasses are required to call {@link #create()} at the end of their constructor.</em> * </p> - * + * * @param parentShell the parent of this control's shell * @param isResizable <code>true</code> if the control should be resizable */ @@ -149,47 +149,47 @@ public abstract class AbstractInformationControl implements IInformationControl, * <p> * <strong>Important:</strong>: Subclasses are required to call {@link #create()} at the end of their constructor. * </p> - * + * * @param parentShell the parent of this control's shell * @param shellStyle style of this control's shell * @param statusFieldText the text to be used in the status field or <code>null</code> to hide the status field * @param toolBarManager the manager or <code>null</code> if toolbar is not desired - * + * * @deprecated clients should use one of the public constructors */ AbstractInformationControl(Shell parentShell, int shellStyle, final String statusFieldText, final ToolBarManager toolBarManager) { Assert.isTrue(statusFieldText == null || toolBarManager == null); fResizeHandleSize= -1; fToolBarManager= toolBarManager; - + if ((shellStyle & SWT.NO_TRIM) != 0) shellStyle&= ~(SWT.NO_TRIM | SWT.SHELL_TRIM); // make sure we get the OS border but no other trims - + fResizable= (shellStyle & SWT.RESIZE) != 0; // on GTK, Shell removes SWT.RESIZE if SWT.ON_TOP is set fShell= new Shell(parentShell, shellStyle); Display display= fShell.getDisplay(); Color foreground= display.getSystemColor(SWT.COLOR_INFO_FOREGROUND); Color background= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND); setColor(fShell, foreground, background); - + GridLayout layout= new GridLayout(1, false); layout.marginHeight= 0; layout.marginWidth= 0; layout.verticalSpacing= 0; fShell.setLayout(layout); - + fContentComposite= new Composite(fShell, SWT.NONE); fContentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); fContentComposite.setLayout(new FillLayout()); setColor(fContentComposite, foreground, background); - + createStatusComposite(statusFieldText, toolBarManager, foreground, background); } private void createStatusComposite(final String statusFieldText, final ToolBarManager toolBarManager, Color foreground, Color background) { if (toolBarManager == null && statusFieldText == null) return; - + fStatusComposite= new Composite(fShell, SWT.NONE); GridData gridData= new GridData(SWT.FILL, SWT.BOTTOM, true, false); fStatusComposite.setLayoutData(gridData); @@ -198,10 +198,10 @@ public abstract class AbstractInformationControl implements IInformationControl, statusLayout.marginWidth= 0; statusLayout.verticalSpacing= 1; fStatusComposite.setLayout(statusLayout); - + fSeparator= new Label(fStatusComposite, SWT.SEPARATOR | SWT.HORIZONTAL); fSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + if (statusFieldText != null) { createStatusLabel(statusFieldText, foreground, background); } else { @@ -213,39 +213,39 @@ public abstract class AbstractInformationControl implements IInformationControl, fStatusLabel= new Label(fStatusComposite, SWT.RIGHT); fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fStatusLabel.setText(statusFieldText); - + FontData[] fontDatas= JFaceResources.getDialogFont().getFontData(); for (int i= 0; i < fontDatas.length; i++) { fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10); } fStatusLabel.setFont(new Font(fStatusLabel.getDisplay(), fontDatas)); - + fStatusLabel.setForeground(fStatusLabel.getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); fStatusLabel.setBackground(background); setColor(fStatusComposite, foreground, background); } - + private void createToolBar(ToolBarManager toolBarManager) { final Composite bars= new Composite(fStatusComposite, SWT.NONE); bars.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); - + GridLayout layout= new GridLayout(3, false); layout.marginHeight= 0; layout.marginWidth= 0; layout.horizontalSpacing= 0; layout.verticalSpacing= 0; bars.setLayout(layout); - + fToolBar= toolBarManager.createControl(bars); GridData gd= new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false); fToolBar.setLayoutData(gd); - + Composite spacer= new Composite(bars, SWT.NONE); gd= new GridData(SWT.FILL, SWT.FILL, true, true); gd.widthHint= 0; gd.heightHint= 0; spacer.setLayoutData(gd); - + addMoveSupport(spacer); addResizeSupportIfNecessary(bars); } @@ -258,11 +258,11 @@ public abstract class AbstractInformationControl implements IInformationControl, final boolean isWin= platform.equals("win32"); //$NON-NLS-1$ if (!isWin && !platform.equals("gtk")) //$NON-NLS-1$ return; - + final Canvas resizer= new Canvas(bars, SWT.NONE); - + int size= getResizeHandleSize(bars); - + GridData data= new GridData(SWT.END, SWT.END, false, true); data.widthHint= size; data.heightHint= size; @@ -285,7 +285,7 @@ public abstract class AbstractInformationControl implements IInformationControl, for (int i= 0; i <= 2; i++) for (int j= 0; j <= 2 - i; j++) e.gc.fillRectangle(end - 4 * i, end - 4 * j, 2, 2); - + } else { // draw diagonal lines e.gc.setForeground(resizer.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); @@ -299,12 +299,12 @@ public abstract class AbstractInformationControl implements IInformationControl, } } }); - - final boolean isRTL= (resizer.getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; + + final boolean isRTL= (resizer.getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; resizer.setCursor(new Cursor(resizer.getDisplay(), isRTL ? SWT.CURSOR_SIZESW : SWT.CURSOR_SIZESE)); MouseAdapter resizeSupport= new MouseAdapter() { private MouseMoveListener fResizeListener; - + public void mouseDown(MouseEvent e) { Rectangle shellBounds= fShell.getBounds(); final int shellX= shellBounds.x; @@ -329,7 +329,7 @@ public abstract class AbstractInformationControl implements IInformationControl, }; resizer.addMouseMoveListener(fResizeListener); } - + public void mouseUp(MouseEvent e) { resizer.removeMouseMoveListener(fResizeListener); fResizeListener= null; @@ -348,13 +348,13 @@ public abstract class AbstractInformationControl implements IInformationControl, sliderH.dispose(); fResizeHandleSize= Math.min(width, height); } - + return fResizeHandleSize; } /** * Adds support to move the shell by dragging the given control. - * + * * @param control the control that can be used to move the shell */ private void addMoveSupport(final Control control) { @@ -390,7 +390,7 @@ public abstract class AbstractInformationControl implements IInformationControl, /** * Utility to set the foreground and the background color of the given * control - * + * * @param control the control to modify * @param foreground the color to use for the foreground * @param background the color to use for the background @@ -402,17 +402,17 @@ public abstract class AbstractInformationControl implements IInformationControl, /** * The shell of the popup window. - * + * * @return the shell used for the popup window */ protected final Shell getShell() { return fShell; } - + /** * The toolbar manager used to manage the toolbar, or <code>null</code> if * no toolbar is shown. - * + * * @return the tool bar manager or <code>null</code> */ protected final ToolBarManager getToolBarManager() { @@ -443,11 +443,11 @@ public abstract class AbstractInformationControl implements IInformationControl, * The given <code>parent</code> comes with a {@link FillLayout}. * Subclasses may set a different layout. * </p> - * + * * @param parent the container of the content */ protected abstract void createContent(Composite parent); - + /** * Sets the information to be presented by this information control. * <p> @@ -455,16 +455,16 @@ public abstract class AbstractInformationControl implements IInformationControl, * or implement {@link IInformationControlExtension2}. * * @param information the information to be presented - * + * * @see org.eclipse.jface.text.IInformationControl#setInformation(java.lang.String) */ public void setInformation(String information) { - + } - + /** * Returns whether the information control is resizable. - * + * * @return <code>true</code> if the information control is resizable, * <code>false</code> if it is not resizable. */ @@ -478,7 +478,7 @@ public abstract class AbstractInformationControl implements IInformationControl, public void setVisible(boolean visible) { if (fShell.isVisible() == visible) return; - + fShell.setVisible(visible); } @@ -510,10 +510,10 @@ public abstract class AbstractInformationControl implements IInformationControl, public void setSizeConstraints(int maxWidth, int maxHeight) { fSizeConstraints= new Point(maxWidth, maxHeight); } - + /** * Returns the size constraints. - * + * * @return the size constraints or <code>null</code> if not set * @see #setSizeConstraints(int, int) */ @@ -529,7 +529,7 @@ public abstract class AbstractInformationControl implements IInformationControl, Point constrains= getSizeConstraints(); if (constrains == null) return fShell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); - + return fShell.computeSize(constrains.x, constrains.y, true); } @@ -537,7 +537,7 @@ public abstract class AbstractInformationControl implements IInformationControl, * Computes the trim (status text and tool bar are considered as trim). * Subclasses can extend this method to add additional trim (e.g. scroll * bars for resizable information controls). - * + * * @see org.eclipse.jface.text.IInformationControlExtension3#computeTrim() */ public Rectangle computeTrim() { @@ -617,7 +617,7 @@ public abstract class AbstractInformationControl implements IInformationControl, /** * This default implementation sets the focus on the popup shell. * Subclasses can override or extend. - * + * * @see IInformationControl#setFocus() */ public void setFocus() { @@ -673,10 +673,10 @@ public abstract class AbstractInformationControl implements IInformationControl, * shown if the information control has been created with a non-null status * field text. * </p> - * + * * @param statusFieldText the text to be used in the optional status field * or <code>null</code> if the status field should be hidden - * + * * @see org.eclipse.jface.text.IInformationControlExtension4#setStatusText(java.lang.String) */ public void setStatusText(String statusFieldText) { @@ -689,7 +689,7 @@ public abstract class AbstractInformationControl implements IInformationControl, } } } - + /* * @see org.eclipse.jface.text.IInformationControlExtension5#containsControl(org.eclipse.swt.widgets.Control) */ @@ -723,7 +723,7 @@ public abstract class AbstractInformationControl implements IInformationControl, * Computes the size constraints based on the * {@link JFaceResources#getDialogFont() dialog font}. Subclasses can * override or extend. - * + * * @see org.eclipse.jface.text.IInformationControlExtension5#computeSizeConstraints(int, int) */ public Point computeSizeConstraints(int widthInChars, int heightInChars) { @@ -735,5 +735,5 @@ public abstract class AbstractInformationControl implements IInformationControl, return new Point(widthInChars * width, heightInChars * height); } - + } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java index 1dd6b6cfe59..b8894e766c9 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java @@ -54,30 +54,30 @@ abstract public class AbstractInformationControlManager { /** * An internal class that gives access to internal methods. - * + * * @since 3.4 */ class MyInternalAccessor extends InternalAccessor { public IInformationControl getCurrentInformationControl() { return AbstractInformationControlManager.this.getCurrentInformationControl(); } - + public void setInformationControlReplacer(InformationControlReplacer replacer) { AbstractInformationControlManager.this.setInformationControlReplacer(replacer); } - + public InformationControlReplacer getInformationControlReplacer() { return AbstractInformationControlManager.this.getInformationControlReplacer(); } - + public boolean canReplace(IInformationControl control) { return AbstractInformationControlManager.this.canReplace(control); } - + public boolean isReplaceInProgress() { return AbstractInformationControlManager.this.isReplaceInProgress(); } - + public void replaceInformationControl(boolean takeFocus) { AbstractInformationControlManager.this.replaceInformationControl(takeFocus); } @@ -85,11 +85,11 @@ abstract public class AbstractInformationControlManager { public void cropToClosestMonitor(Rectangle bounds) { AbstractInformationControlManager.this.cropToClosestMonitor(bounds); } - + public void setHoverEnrichMode(EnrichMode mode) { throw new UnsupportedOperationException("only implemented in AbstractHoverInformationControlManager"); //$NON-NLS-1$ } - + public boolean getAllowMouseExit() { throw new UnsupportedOperationException("only implemented in AnnotationBarHoverManager"); //$NON-NLS-1$ } @@ -153,14 +153,14 @@ abstract public class AbstractInformationControlManager { /** * Returns the SWT direction flag. One of {@link SWT#BOTTOM}, {@link SWT#TOP}, * {@link SWT#LEFT}, {@link SWT#RIGHT}, {@link SWT#CENTER}, - * + * * @return the SWT direction flag * @since 3.3 */ int getSWTFlag() { return fFlag; } - + public String toString() { switch (fFlag) { case SWT.BOTTOM: return "BOTTOM"; //$NON-NLS-1$ @@ -210,7 +210,7 @@ abstract public class AbstractInformationControlManager { * @since 3.0 */ public static final String STORE_SIZE_HEIGHT= "size.height"; //$NON-NLS-1$ - + /** * Tells whether this class and its subclasses are in debug mode. * <p> @@ -235,7 +235,7 @@ abstract public class AbstractInformationControlManager { /** * The information control. - * + * * <p>This field should not be referenced by subclasses. It is <code>protected</code> for API * compatibility reasons. */ @@ -243,7 +243,7 @@ abstract public class AbstractInformationControlManager { /** * The information control creator. - * + * * <p>This field should not be referenced by subclasses. It is <code>protected</code> for API * compatibility reasons. */ @@ -251,7 +251,7 @@ abstract public class AbstractInformationControlManager { /** * The information control closer. - * + * * <p>This field should not be referenced by subclasses. It is <code>protected</code> for API * compatibility reasons. */ @@ -259,7 +259,7 @@ abstract public class AbstractInformationControlManager { /** * Indicates that the information control has been disposed. - * + * * <p>This field should not be referenced by subclasses. It is <code>protected</code> for API * compatibility reasons. */ @@ -268,7 +268,7 @@ abstract public class AbstractInformationControlManager { /** * The information control replacer to be used when this information control * needs to be replaced with another information control. - * + * * @since 3.4 */ private InformationControlReplacer fInformationControlReplacer; @@ -353,7 +353,7 @@ abstract public class AbstractInformationControlManager { /** * The dispose listener on the subject control. - * + * * @since 3.1 */ private DisposeListener fSubjectControlDisposeListener; @@ -426,11 +426,11 @@ abstract public class AbstractInformationControlManager { protected void setCloser(IInformationControlCloser closer) { fInformationControlCloser= closer; } - + /** * Sets the information control replacer for this manager and disposes the * old one if set. - * + * * @param replacer the information control replacer for this manager, or * <code>null</code> if no information control replacing should * take place @@ -444,7 +444,7 @@ abstract public class AbstractInformationControlManager { /** * Returns the current information control replacer or <code>null</code> if none has been installed. - * + * * @return the current information control replacer or <code>null</code> if none has been installed * @since 3.4 */ @@ -454,17 +454,17 @@ abstract public class AbstractInformationControlManager { /** * Returns whether an information control replacer has been installed. - * + * * @return whether an information control replacer has been installed * @since 3.4 */ boolean hasInformationControlReplacer() { return fInformationControlReplacer != null; } - + /** * Tests whether the given information control is replaceable. - * + * * @param iControl information control or <code>null</code> if none * @return <code>true</code> if information control is replaceable, <code>false</code> otherwise * @since 3.4 @@ -474,10 +474,10 @@ abstract public class AbstractInformationControlManager { && iControl instanceof IInformationControlExtension5 && ((IInformationControlExtension5) iControl).getInformationPresenterControlCreator() != null; } - + /** * Returns the current information control, or <code>null</code> if none. - * + * * @return the current information control, or <code>null</code> if none * @since 3.4 */ @@ -487,7 +487,7 @@ abstract public class AbstractInformationControlManager { /** * Tells whether this manager's information control is currently being replaced. - * + * * @return <code>true</code> if a replace is in progress * @since 3.4 */ @@ -498,7 +498,7 @@ abstract public class AbstractInformationControlManager { /** * Sets the horizontal and vertical margin to be used when laying out the * information control relative to the subject control. - * + * * @param xMargin the x-margin * @param yMargin the y-Margin */ @@ -542,7 +542,7 @@ abstract public class AbstractInformationControlManager { * <li>{@link AbstractInformationControlManager#STORE_SIZE_HEIGHT}</li> * </ul> * </p> - * + * * @param dialogSettings the dialog settings * @param restoreLocation <code>true</code> iff the location is must be (re-)stored * @param restoreSize <code>true</code>iff the size is (re-)stored @@ -645,11 +645,11 @@ abstract public class AbstractInformationControlManager { setEnabled(true); fDisposed= false; } - + /** * Returns the dispose listener which gets added * to the subject control. - * + * * @return the dispose listener * @since 3.1 */ @@ -861,11 +861,11 @@ abstract public class AbstractInformationControlManager { return fSubjectControl.toDisplay(new Point(subjectArea.x + xShift, subjectArea.y + yShift)); } - + /** * Computes the area available for an information control given an anchor and the subject area * within <code>bounds</code>. - * + * * @param subjectArea the subject area * @param bounds the bounds * @param anchor the anchor at the subject area @@ -902,7 +902,7 @@ abstract public class AbstractInformationControlManager { area.intersect(bounds); return area; } - + /** * Checks whether a control of the given size at the given location would be completely visible * in the given display area when laid out by using the given anchor. If not, this method tries @@ -1024,7 +1024,7 @@ abstract public class AbstractInformationControlManager { Monitor monitor= getClosestMonitor(subjectAreaDisplayRelative, testAnchor); if (updateLocation(upperLeft, controlSize, monitor.getClientArea(), testAnchor)) return upperLeft; - + // compute available area for this anchor and update if better than best Rectangle available= computeAvailableArea(subjectAreaDisplayRelative, monitor.getClientArea(), testAnchor); Rectangle proposed= new Rectangle(upperLeft.x, upperLeft.y, controlSize.x, controlSize.y); @@ -1035,20 +1035,20 @@ abstract public class AbstractInformationControlManager { bestBounds= available; bestAnchor= testAnchor; } - + testAnchor= getNextFallbackAnchor(testAnchor); } while (testAnchor != fAnchor && testAnchor != null); - + // no anchor is perfect - select the one with larges area and set the size to not overlap with the subjectArea if (bestAnchor != ANCHOR_GLOBAL) Geometry.set(controlSize, Geometry.getSize(bestBounds)); return Geometry.getLocation(bestBounds); } - + /** * Gets the closest monitor given an anchor and the subject area. - * + * * @param area the subject area * @param anchor the anchor * @return the monitor closest to the edge of <code>area</code> defined by @@ -1068,7 +1068,7 @@ abstract public class AbstractInformationControlManager { * Copied from org.eclipse.jface.window.Window. Returns the monitor whose client area contains * the given point. If no monitor contains the point, returns the monitor that is closest to the * point. If this is ever made public, it should be moved into a separate utility class. - * + * * @param display the display to search for monitors * @param rectangle the rectangle to find the closest monitor for (display coordinates) * @return the monitor closest to the given point @@ -1150,7 +1150,7 @@ abstract public class AbstractInformationControlManager { ((InformationControlReplacer) this).showInformationControl(subjectArea, information); return; } - + IInformationControl informationControl= getInformationControl(); if (informationControl != null) { @@ -1203,14 +1203,14 @@ abstract public class AbstractInformationControlManager { size= Geometry.getSize(controlBounds); informationControl.setLocation(location); informationControl.setSize(size.x, size.y); - + showInformationControl(subjectArea); } } /** * Crops the given bounds such that they lie completely on the closest monitor. - * + * * @param bounds shell bounds to crop * @since 3.4 */ @@ -1251,7 +1251,7 @@ abstract public class AbstractInformationControlManager { * Replaces this manager's information control as defined by * the information control replacer. * <strong>Must only be called when {@link #fInformationControl} instanceof {@link IInformationControlExtension3}!</strong> - * + * * @param takeFocus <code>true</code> iff the replacing information control should take focus * * @since 3.4 @@ -1267,7 +1267,7 @@ abstract public class AbstractInformationControlManager { } hideInformationControl(); } - + /** * Disposes this manager's information control. */ @@ -1289,12 +1289,12 @@ abstract public class AbstractInformationControlManager { setEnabled(false); disposeInformationControl(); - + if (fInformationControlReplacer != null) { fInformationControlReplacer.dispose(); fInformationControlReplacer= null; } - + if (fSubjectControl != null && !fSubjectControl.isDisposed() && fSubjectControlDisposeListener != null) fSubjectControl.removeDisposeListener(fSubjectControlDisposeListener); fSubjectControl= null; @@ -1420,7 +1420,7 @@ abstract public class AbstractInformationControlManager { * Returns an adapter that gives access to internal methods. * <p> * <strong>Note:</strong> This method is not intended to be referenced or overridden by clients.</p> - * + * * @return the replaceable information control accessor * @since 3.4 * @noreference This method is not intended to be referenced by clients. diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractReusableInformationControlCreator.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractReusableInformationControlCreator.java index c5a0ac3647d..435cb6f54de 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractReusableInformationControlCreator.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractReusableInformationControlCreator.java @@ -21,7 +21,7 @@ import org.eclipse.swt.widgets.Shell; /** * Abstract class for a reusable information control creators. - * + * * @since 3.3 */ public abstract class AbstractReusableInformationControlCreator implements IInformationControlCreator, IInformationControlCreatorExtension, DisposeListener { @@ -30,7 +30,7 @@ public abstract class AbstractReusableInformationControlCreator implements IInfo /** * Creates the control. - * + * * @param parent the parent shell * @return the created information control */ @@ -45,10 +45,10 @@ public abstract class AbstractReusableInformationControlCreator implements IInfo control= doCreateInformationControl(parent); control.addDisposeListener(this); fInformationControls.put(parent, control); - } + } return control; } - + /* * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent) */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/CursorLinePainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/CursorLinePainter.java index 7e45271e24b..14242aa61b0 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/CursorLinePainter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/CursorLinePainter.java @@ -18,12 +18,6 @@ import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Point; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.ITextViewerExtension5; -import org.eclipse.jface.text.Position; - /** * A painter the draws the background of the caret line in a configured color. 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 5807e5b86c8..90ea2835287 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 @@ -66,17 +66,17 @@ public class DefaultInformationControl extends AbstractInformationControl implem */ String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight); } - - + + /** * An information presenter determines the style presentation * of information displayed in the default information control. * The interface can be implemented by clients. - * + * * @since 3.2 */ public interface IInformationPresenterExtension { - + /** * Updates the given presentation of the given information and * thereby may manipulate the information to be displayed. The manipulation @@ -98,7 +98,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem */ String updatePresentation(Drawable drawable, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight); } - + /** * Inner border thickness in pixels. @@ -112,7 +112,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem private final IInformationPresenter fPresenter; /** A cached text presentation */ private final TextPresentation fPresentation= new TextPresentation(); - + /** * Additional styles to use for the text control. * @since 3.4, previously called <code>fTextStyle</code> @@ -122,7 +122,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem /** * Creates a default information control with the given shell as parent. An information * presenter that can handle simple HTML is used to process the information to be displayed. - * + * * @param parent the parent shell * @param isResizeable <code>true</code> if the control should be resizable * @since 3.4 @@ -137,7 +137,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem /** * Creates a default information control with the given shell as parent. An information * presenter that can handle simple HTML is used to process the information to be displayed. - * + * * @param parent the parent shell * @param statusFieldText the text to be used in the status field or <code>null</code> to hide the status field * @since 3.4 @@ -150,7 +150,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem * Creates a default information control with the given shell as parent. The * given information presenter is used to process the information to be * displayed. - * + * * @param parent the parent shell * @param statusFieldText the text to be used in the status field or <code>null</code> to hide the status field * @param presenter the presenter to be used, or <code>null</code> if no presenter should be used @@ -167,7 +167,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem * Creates a resizable default information control with the given shell as parent. An * information presenter that can handle simple HTML is used to process the information to be * displayed. - * + * * @param parent the parent shell * @param toolBarManager the manager or <code>null</code> if toolbar is not desired * @since 3.4 @@ -180,7 +180,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem * Creates a resizable default information control with the given shell as * parent. The given information presenter is used to process the * information to be displayed. - * + * * @param parent the parent shell * @param toolBarManager the manager or <code>null</code> if toolbar is not desired * @param presenter the presenter to be used, or <code>null</code> if no presenter should be used @@ -220,7 +220,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem * given information presenter is used to process the information to be * displayed. The given styles are applied to the created styled text * widget. - * + * * @param parent the parent shell * @param shellStyle the additional styles for the shell * @param style the additional styles for the styled text widget @@ -236,7 +236,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem * given information presenter is used to process the information to be * displayed. The given styles are applied to the created styled text * widget. - * + * * @param parentShell the parent shell * @param shellStyle the additional styles for the shell * @param style the additional styles for the styled text widget @@ -256,7 +256,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem * Creates a default information control with the given shell as parent. The * given information presenter is used to process the information to be * displayed. - * + * * @param parent the parent shell * @param textStyles the additional styles for the styled text widget * @param presenter the presenter to be used @@ -270,7 +270,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem * Creates a default information control with the given shell as parent. The * given information presenter is used to process the information to be * displayed. - * + * * @param parent the parent shell * @param textStyles the additional styles for the styled text widget * @param presenter the presenter to be used @@ -295,14 +295,14 @@ public class DefaultInformationControl extends AbstractInformationControl implem fText.setFont(JFaceResources.getDialogFont()); FillLayout layout= (FillLayout)parent.getLayout(); if (fText.getWordWrap()) { - // indent does not work for wrapping StyledText, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=56342 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=115432 + // indent does not work for wrapping StyledText, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=56342 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=115432 layout.marginHeight= INNER_BORDER; layout.marginWidth= INNER_BORDER; } else { fText.setIndent(INNER_BORDER); } } - + /* * @see IInformationControl#setInformation(String) */ @@ -311,7 +311,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem fText.setText(content); } else { fPresentation.clear(); - + int maxWidth= -1; int maxHeight= -1; Point constraints= getSizeConstraints(); @@ -331,7 +331,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem } if (isResizable()) maxHeight= Integer.MAX_VALUE; - + if (fPresenter instanceof IInformationPresenterExtension) content= ((IInformationPresenterExtension)fPresenter).updatePresentation(fText, content, fPresentation, maxWidth, maxHeight); else @@ -359,7 +359,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem setSize(currentSize.x, currentSize.y); // restore previous size } } - + super.setVisible(visible); } @@ -372,10 +372,10 @@ public class DefaultInformationControl extends AbstractInformationControl implem Point constraints= getSizeConstraints(); if (constraints != null && fText.getWordWrap()) widthHint= constraints.x; - + return getShell().computeSize(widthHint, SWT.DEFAULT, true); } - + /* * @see org.eclipse.jface.text.AbstractInformationControl#computeTrim() */ @@ -428,5 +428,5 @@ public class DefaultInformationControl extends AbstractInformationControl implem } }; } - + } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextDoubleClickStrategy.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextDoubleClickStrategy.java index 41344e9489a..d5ba81db325 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextDoubleClickStrategy.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextDoubleClickStrategy.java @@ -11,9 +11,10 @@ package org.eclipse.jface.text; -import com.ibm.icu.text.BreakIterator; import java.text.CharacterIterator; +import com.ibm.icu.text.BreakIterator; + /** * Standard implementation of * {@link org.eclipse.jface.text.ITextDoubleClickStrategy}. diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextHover.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextHover.java index 9996154d2cd..612fd20fbff 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextHover.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextHover.java @@ -21,7 +21,7 @@ import org.eclipse.jface.text.source.ISourceViewerExtension2; /** * Standard implementation of {@link org.eclipse.jface.text.ITextHover}. - * + * * @since 3.2 */ public class DefaultTextHover implements ITextHover { @@ -31,24 +31,24 @@ public class DefaultTextHover implements ITextHover { /** * Creates a new annotation hover. - * + * * @param sourceViewer this hover's annotation model */ public DefaultTextHover(ISourceViewer sourceViewer) { Assert.isNotNull(sourceViewer); fSourceViewer= sourceViewer; } - + /** * {@inheritDoc} - * + * * @deprecated As of 3.4, replaced by {@link ITextHoverExtension2#getHoverInfo2(ITextViewer, IRegion)} */ public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { IAnnotationModel model= getAnnotationModel(fSourceViewer); if (model == null) return null; - + Iterator e= model.getAnnotationIterator(); while (e.hasNext()) { Annotation a= (Annotation) e.next(); @@ -61,7 +61,7 @@ public class DefaultTextHover implements ITextHover { } } } - + return null; } @@ -71,18 +71,18 @@ public class DefaultTextHover implements ITextHover { public IRegion getHoverRegion(ITextViewer textViewer, int offset) { return findWord(textViewer.getDocument(), offset); } - + /** * Tells whether the annotation should be included in * the computation. - * + * * @param annotation the annotation to test * @return <code>true</code> if the annotation is included in the computation */ protected boolean isIncluded(Annotation annotation) { return true; } - + private IAnnotationModel getAnnotationModel(ISourceViewer viewer) { if (viewer instanceof ISourceViewerExtension2) { ISourceViewerExtension2 extension= (ISourceViewerExtension2) viewer; @@ -90,7 +90,7 @@ public class DefaultTextHover implements ITextHover { } return viewer.getAnnotationModel(); } - + private IRegion findWord(IDocument document, int offset) { int start= -2; int end= -1; diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java index 8109f796772..bd24a6cefa7 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java @@ -158,24 +158,24 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { * @since 3.1 */ public boolean canUndo() { - + if (isConnected() && isValid()) { IDocument doc= fTextViewer.getDocument(); if (doc instanceof IDocumentExtension4) { long docStamp= ((IDocumentExtension4)doc).getModificationStamp(); - + // Normal case: an undo is valid if its redo will restore document // to its current modification stamp - boolean canUndo= docStamp == IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP || + boolean canUndo= docStamp == IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP || docStamp == getRedoModificationStamp(); - - /* Special case to check if the answer is false. + + /* Special case to check if the answer is false. * If the last document change was empty, then the document's - * modification stamp was incremented but nothing was committed. + * modification stamp was incremented but nothing was committed. * The operation being queried has an older stamp. In this case only, * the comparison is different. A sequence of document changes that * include an empty change is handled correctly when a valid commit - * follows the empty change, but when #canUndo() is queried just after + * follows the empty change, but when #canUndo() is queried just after * an empty change, we must special case the check. The check is very * specific to prevent false positives. * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=98245 @@ -186,14 +186,14 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { !fCurrent.isValid() && // the current operation is not a valid document modification fCurrent.fUndoModificationStamp != // the invalid current operation has a document stamp IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP) { - canUndo= fCurrent.fRedoModificationStamp == docStamp; + canUndo= fCurrent.fRedoModificationStamp == docStamp; } /* - * When the composite is the current command, it may hold the timestamp - * of a no-op change. We check this here rather than in an override of + * When the composite is the current command, it may hold the timestamp + * of a no-op change. We check this here rather than in an override of * canUndo() in CompoundTextCommand simply to keep all the special case checks * in one place. - */ + */ if (!canUndo && this == fHistory.getUndoOperation(fUndoContext) && // this is the latest operation this instanceof CompoundTextCommand && @@ -219,7 +219,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { IDocument doc= fTextViewer.getDocument(); if (doc instanceof IDocumentExtension4) { long docStamp= ((IDocumentExtension4)doc).getModificationStamp(); - return docStamp == IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP || + return docStamp == IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP || docStamp == getUndoModificationStamp(); } // if there is no timestamp to check, simply return true per the 3.0.1 behavior @@ -267,7 +267,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { } return IOperationHistory.OPERATION_INVALID_STATUS; } - + /** * Re-applies the change described by this command. * @@ -354,11 +354,11 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { fPreservedText= fPreservedTextBuffer.toString(); } } - + /** * Attempt a commit of this command and answer true if a new * fCurrent was created as a result of the commit. - * + * * @return true if the command was committed and created a * new fCurrent, false if not. * @since 3.1 @@ -412,20 +412,20 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { text.append('\''); return text.toString(); } - + /** * Return the undo modification stamp - * + * * @return the undo modification stamp for this command * @since 3.1 */ protected long getUndoModificationStamp() { return fUndoModificationStamp; } - + /** * Return the redo modification stamp - * + * * @return the redo modification stamp for this command * @since 3.1 */ @@ -467,7 +467,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { */ public IStatus undo(IProgressMonitor monitor, IAdaptable uiInfo) { resetProcessChangeSate(); - + int size= fCommands.size(); if (size > 0) { @@ -564,10 +564,10 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { return (fStart > -1 || fCommands.size() > 0); return false; } - + /** * Returns the undo modification stamp. - * + * * @return the undo modification stamp * @since 3.1 */ @@ -579,10 +579,10 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { return fUndoModificationStamp; } - + /** * Returns the redo modification stamp. - * + * * @return the redo modification stamp * @since 3.1 */ @@ -747,7 +747,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { if (fTextViewer instanceof TextViewer) ((TextViewer)fTextViewer).ignoreAutoEditStrategies(true); listenToTextChanges(false); - + // in the undo case only, make sure compounds are closed if (type == OperationHistoryEvent.ABOUT_TO_UNDO) { if (fFoldingIntoCompoundChange) { @@ -755,9 +755,9 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { } } } else { - // the undo or redo has our context, but it is not one of + // the undo or redo has our context, but it is not one of // our commands. We will listen to the changes, but will - // reset the state that tracks the undo/redo history. + // reset the state that tracks the undo/redo history. commit(); fLastAddedCommand= null; } @@ -986,10 +986,10 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { } fCurrent.commit(); } - + /** * Reset processChange state. - * + * * @since 3.2 */ private void resetProcessChangeSate() { @@ -1036,7 +1036,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { int length= insertedText.length(); int diff= modelEnd - modelStart; - + if (fCurrent.fUndoModificationStamp == IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP) fCurrent.fUndoModificationStamp= beforeChangeModificationStamp; @@ -1055,7 +1055,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { fCurrent.fRedoModificationStamp= beforeChangeModificationStamp; if (fCurrent.attemptCommit()) fCurrent.fUndoModificationStamp= beforeChangeModificationStamp; - + fInserting= true; } if (fCurrent.fStart < 0) @@ -1159,7 +1159,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension { // because of typing or pasting whereby selection is not empty fCurrent.fRedoModificationStamp= beforeChangeModificationStamp; if (fCurrent.attemptCommit()) - fCurrent.fUndoModificationStamp= beforeChangeModificationStamp; + fCurrent.fUndoModificationStamp= beforeChangeModificationStamp; fCurrent.fStart= modelStart; fCurrent.fEnd= modelEnd; diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapterContentProposalProvider.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapterContentProposalProvider.java index bfe8f9bb3c4..e0dff953c5c 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapterContentProposalProvider.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapterContentProposalProvider.java @@ -33,43 +33,43 @@ import org.eclipse.jface.fieldassist.IContentProposalProvider; */ public class FindReplaceDocumentAdapterContentProposalProvider implements IContentProposalProvider { - + /** * Proposal computer. */ private static class ProposalComputer { private static class Proposal implements IContentProposal { - + private String fContent; private String fLabel; private String fDescription; private int fCursorPosition; - + Proposal(String content, String label, String description, int cursorPosition) { fContent= content; fLabel= label; fDescription= description; fCursorPosition= cursorPosition; } - + public String getContent() { return fContent; } - + public String getLabel() { return fLabel; } - + public String getDescription() { return fDescription; } - + public int getCursorPosition() { return fCursorPosition; } } - + /** * The whole regular expression. @@ -102,7 +102,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte fDocumentOffset= position; fPriorityProposals= new ArrayList(); fProposals= new ArrayList(); - + boolean isEscape= false; esc: for (int i= position - 1; i >= 0; i--) { if (fExpression.charAt(i) == '\\') @@ -131,7 +131,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte addBsProposal("\\a", RegExMessages.getString("displayString_bs_a"), RegExMessages.getString("additionalInfo_bs_a")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBsProposal("\\e", RegExMessages.getString("displayString_bs_e"), RegExMessages.getString("additionalInfo_bs_e")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("\\c", 2, RegExMessages.getString("displayString_bs_c"), RegExMessages.getString("additionalInfo_bs_c")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + if (! fIsEscape) addBracketProposal(".", 1, RegExMessages.getString("displayString_dot"), RegExMessages.getString("additionalInfo_dot")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBsProposal("\\d", RegExMessages.getString("displayString_bs_d"), RegExMessages.getString("additionalInfo_bs_d")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ @@ -140,15 +140,15 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte addBsProposal("\\S", RegExMessages.getString("displayString_bs_S"), RegExMessages.getString("additionalInfo_bs_S")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBsProposal("\\w", RegExMessages.getString("displayString_bs_w"), RegExMessages.getString("additionalInfo_bs_w")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBsProposal("\\W", RegExMessages.getString("displayString_bs_W"), RegExMessages.getString("additionalInfo_bs_W")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + // back reference addBsProposal("\\", RegExMessages.getString("displayString_bs_i"), RegExMessages.getString("additionalInfo_bs_i")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + //quoting addBsProposal("\\", RegExMessages.getString("displayString_bs"), RegExMessages.getString("additionalInfo_bs")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBsProposal("\\Q", RegExMessages.getString("displayString_bs_Q"), RegExMessages.getString("additionalInfo_bs_Q")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBsProposal("\\E", RegExMessages.getString("displayString_bs_E"), RegExMessages.getString("additionalInfo_bs_E")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + //character sets if (! fIsEscape) { addBracketProposal("[]", 1, RegExMessages.getString("displayString_set"), RegExMessages.getString("additionalInfo_set")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ @@ -163,7 +163,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte addBracketProposal("\\p{}", 3, RegExMessages.getString("displayString_posix"), RegExMessages.getString("additionalInfo_posix")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("\\P{}", 3, RegExMessages.getString("displayString_posixNot"), RegExMessages.getString("additionalInfo_posixNot")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } - + //boundary matchers if (fDocumentOffset == 0) { addPriorityProposal("^", RegExMessages.getString("displayString_start"), RegExMessages.getString("additionalInfo_start")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ @@ -179,25 +179,25 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte addBsProposal("\\G", RegExMessages.getString("displayString_bs_G"), RegExMessages.getString("additionalInfo_bs_G")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBsProposal("\\Z", RegExMessages.getString("displayString_bs_Z"), RegExMessages.getString("additionalInfo_bs_Z")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBsProposal("\\z", RegExMessages.getString("displayString_bs_z"), RegExMessages.getString("additionalInfo_bs_z")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + if (! fIsEscape) { //capturing groups addBracketProposal("()", 1, RegExMessages.getString("displayString_group"), RegExMessages.getString("additionalInfo_group")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + //flags addBracketProposal("(?)", 2, RegExMessages.getString("displayString_flag"), RegExMessages.getString("additionalInfo_flag")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("(?:)", 3, RegExMessages.getString("displayString_flagExpr"), RegExMessages.getString("additionalInfo_flagExpr")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + //non-capturing group addBracketProposal("(?:)", 3, RegExMessages.getString("displayString_nonCap"), RegExMessages.getString("additionalInfo_nonCap")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("(?>)", 3, RegExMessages.getString("displayString_atomicCap"), RegExMessages.getString("additionalInfo_atomicCap")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + //look around addBracketProposal("(?=)", 3, RegExMessages.getString("displayString_posLookahead"), RegExMessages.getString("additionalInfo_posLookahead")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("(?!)", 3, RegExMessages.getString("displayString_negLookahead"), RegExMessages.getString("additionalInfo_negLookahead")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("(?<=)", 4, RegExMessages.getString("displayString_posLookbehind"), RegExMessages.getString("additionalInfo_posLookbehind")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("(?<!)", 4, RegExMessages.getString("displayString_negLookbehind"), RegExMessages.getString("additionalInfo_negLookbehind")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + //greedy quantifiers addBracketProposal("?", 1, RegExMessages.getString("displayString_quest"), RegExMessages.getString("additionalInfo_quest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("*", 1, RegExMessages.getString("displayString_star"), RegExMessages.getString("additionalInfo_star")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ @@ -205,7 +205,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte addBracketProposal("{}", 1, RegExMessages.getString("displayString_exact"), RegExMessages.getString("additionalInfo_exact")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("{,}", 1, RegExMessages.getString("displayString_least"), RegExMessages.getString("additionalInfo_least")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("{,}", 1, RegExMessages.getString("displayString_count"), RegExMessages.getString("additionalInfo_count")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + //lazy quantifiers addBracketProposal("??", 1, RegExMessages.getString("displayString_questLazy"), RegExMessages.getString("additionalInfo_questLazy")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("*?", 1, RegExMessages.getString("displayString_starLazy"), RegExMessages.getString("additionalInfo_starLazy")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ @@ -213,7 +213,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte addBracketProposal("{}?", 1, RegExMessages.getString("displayString_exactLazy"), RegExMessages.getString("additionalInfo_exactLazy")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("{,}?", 1, RegExMessages.getString("displayString_leastLazy"), RegExMessages.getString("additionalInfo_leastLazy")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("{,}?", 1, RegExMessages.getString("displayString_countLazy"), RegExMessages.getString("additionalInfo_countLazy")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + //possessive quantifiers addBracketProposal("?+", 1, RegExMessages.getString("displayString_questPoss"), RegExMessages.getString("additionalInfo_questPoss")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("*+", 1, RegExMessages.getString("displayString_starPoss"), RegExMessages.getString("additionalInfo_starPoss")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ @@ -221,11 +221,11 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte addBracketProposal("{}+", 1, RegExMessages.getString("displayString_exactPoss"), RegExMessages.getString("additionalInfo_exactPoss")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("{,}+", 1, RegExMessages.getString("displayString_leastPoss"), RegExMessages.getString("additionalInfo_leastPoss")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addBracketProposal("{,}+", 1, RegExMessages.getString("displayString_countPoss"), RegExMessages.getString("additionalInfo_countPoss")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + //alternative addBracketProposal("|", 1, RegExMessages.getString("displayString_alt"), RegExMessages.getString("additionalInfo_alt")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } - + fPriorityProposals.addAll(fProposals); return (IContentProposal[]) fPriorityProposals.toArray(new IContentProposal[fProposals.size()]); } @@ -257,10 +257,10 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte fPriorityProposals.addAll(fProposals); return (IContentProposal[]) fPriorityProposals.toArray(new IContentProposal[fPriorityProposals.size()]); } - + /** * Adds a proposal. - * + * * @param proposal the string to be inserted * @param displayString the proposal's label * @param additionalInfo the additional information @@ -271,7 +271,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte /** * Adds a proposal. - * + * * @param proposal the string to be inserted * @param cursorPosition the cursor position after insertion, * relative to the start of the proposal @@ -284,7 +284,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte /** * Adds a proposal to the priority proposals list. - * + * * @param proposal the string to be inserted * @param displayString the proposal's label * @param additionalInfo the additional information @@ -292,10 +292,10 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte private void addPriorityProposal(String proposal, String displayString, String additionalInfo) { fPriorityProposals.add(new Proposal(proposal, displayString, additionalInfo, proposal.length())); } - + /** * Adds a proposal. Ensures that existing pre- and postfixes are not duplicated. - * + * * @param proposal the string to be inserted * @param cursorPosition the cursor position after insertion, * relative to the start of the proposal @@ -327,7 +327,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte /** * Adds a proposal that starts with a backslash. * Ensures that the backslash is not repeated if already typed. - * + * * @param proposal the string to be inserted * @param displayString the proposal's label * @param additionalInfo the additional information @@ -348,17 +348,17 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte } } } - + /** * <code>true</code> iff the processor is for the find field. * <code>false</code> iff the processor is for the replace field. */ private final boolean fIsFind; - + /** * Creates a new completion proposal provider. - * + * * @param isFind <code>true</code> if the provider is used for the 'find' field * <code>false</code> if the provider is used for the 'replace' field */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IDelayedInputChangeProvider.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IDelayedInputChangeProvider.java index 8856338b19e..d1a62c08897 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IDelayedInputChangeProvider.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IDelayedInputChangeProvider.java @@ -17,14 +17,14 @@ package org.eclipse.jface.text; * operation of the provider. * <p> * Clients can implement that interface and its extension interfaces.</p> - * + * * @since 3.4 */ public interface IDelayedInputChangeProvider { /** * Sets or clears the delayed input change listener. - * + * * @param inputChangeListener the new delayed input change listener, or * <code>null</code> if none * @since 3.4 diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IEditingSupportRegistry.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IEditingSupportRegistry.java index 5dd6b3ecee4..fd12e991e81 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IEditingSupportRegistry.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IEditingSupportRegistry.java @@ -15,7 +15,7 @@ package org.eclipse.jface.text; * <p> * This interface is not meant to be implemented outside the JFace text * framework.</p> - * + * * @see IEditingSupport * @since 3.1 * @noimplement This interface is not intended to be implemented by clients. diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControl.java index 432856bff44..999aefa0821 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControl.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControl.java @@ -106,7 +106,7 @@ public interface IInformationControl { * <strong>Note:</strong> The information control must not grab focus when * made visible. * </p> - * + * * @param visible <code>true</code> if the control should be visible */ void setVisible(boolean visible); @@ -184,7 +184,7 @@ public interface IInformationControl { * encouraged to subclass {@link AbstractInformationControl}, which does this * for free. * </p> - * + * * @param listener the listener to be added */ void addFocusListener(FocusListener listener); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java index 61207ea6392..502284a07f5 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java @@ -47,7 +47,7 @@ public interface IInformationControlExtension3 { * information control's actual content area. It includes all borders of the * control and other static content placed around the content area (e.g. a * toolbar). - * + * * @return The receiver's trim. <code>x</code> and <code>y</code> denote * the upper left corner of the trimming relative to this control's * location i.e. this will most likely be negative values. diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension4.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension4.java index 1100a226ba1..196fd8574af 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension4.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension4.java @@ -26,7 +26,7 @@ public interface IInformationControlExtension4 { * The implementor can specify whether the new text affects an * already visible information control. * </p> - * + * * @param statusFieldText the text to be used in the optional status field * or <code>null</code> if the status field should be hidden * @since 3.2 diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension5.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension5.java index 708a5491ba1..515098d94a9 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension5.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension5.java @@ -26,12 +26,12 @@ import org.eclipse.jface.resource.JFaceResources; * <li>to compute size constraints based on the information control's main font and</li> * <li>to return a control creator for an enriched version of this information control.</li> * </ul> - * + * * <p> * <b>Important:</b> Enriching this information control only works properly if * {@link IInformationControl#isFocusControl()} is implemented like this (<code>fShell</code> * is the control's shell): - * + * * <pre> * return fShell.getDisplay().getActiveShell() == fShell * </pre> @@ -42,7 +42,7 @@ import org.eclipse.jface.resource.JFaceResources; * encouraged to subclass {@link AbstractInformationControl}, which does this * for free. * </p> - * + * * @see org.eclipse.jface.text.IInformationControl * @since 3.4 */ @@ -51,32 +51,32 @@ public interface IInformationControlExtension5 { /** * Tests whether the given control is this information control * or a child of this information control. - * + * * @param control the control to test * @return <code>true</code> iff the given control is this information control * or a child of this information control */ public boolean containsControl(Control control); - + /** * @return <code>true</code> iff the information control is currently visible */ public abstract boolean isVisible(); - + /** * Computes the width- and height constraints of the information control in * pixels, based on the given width and height in characters. Implementors * should use the main font of the information control to do the * characters-to-pixels conversion. This is typically the * {@link JFaceResources#getDialogFont() dialog font}. - * + * * @param widthInChars the width constraint in number of characters * @param heightInChars the height constraint in number of characters * @return a point with width and height in pixels, or <code>null</code> * to use the subject control's font to calculate the size */ public Point computeSizeConstraints(int widthInChars, int heightInChars); - + /** * Returns the rich information control creator for this information control. * <p> @@ -103,5 +103,5 @@ public interface IInformationControlExtension5 { * @return the information presenter control creator or <code>null</code> to disable enriching */ IInformationControlCreator getInformationPresenterControlCreator(); - + } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInputChangedListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInputChangedListener.java index 371cf0f9e96..472910b9a03 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInputChangedListener.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInputChangedListener.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -22,7 +22,7 @@ public interface IInputChangedListener { /** * Called when a the input has changed. - * + * * @param newInput the new input, or <code>null</code> iff the listener should not show any new input */ void inputChanged(Object newInput); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IPaintPositionManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IPaintPositionManager.java index e11989e4d0c..314c381a878 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IPaintPositionManager.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IPaintPositionManager.java @@ -11,7 +11,6 @@ package org.eclipse.jface.text; -import org.eclipse.jface.text.Position; /** * Manages and updates positions used by {@link IPainter}s. diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ISelectionValidator.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ISelectionValidator.java index 18fc413d98e..267c7d23b9b 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ISelectionValidator.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/ISelectionValidator.java @@ -31,7 +31,7 @@ public interface ISelectionValidator { /** * Tests whether the given post selection is still valid. - * + * * @param selection the selection * @return <code>true</code> if the selection is still valid */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextHoverExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextHoverExtension2.java index 3c864943e7a..148ffc41238 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextHoverExtension2.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextHoverExtension2.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -16,7 +16,7 @@ package org.eclipse.jface.text; * <p> * Provides a way for hovers to return hover-specific information objects. * </p> - * + * * @see org.eclipse.jface.text.ITextHover * @since 3.4 */ @@ -42,5 +42,5 @@ public interface ITextHoverExtension2 { * @return the hover popup display information, or <code>null</code> if none available */ Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion); - + } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewer.java index 34287137c49..2d45db112be 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewer.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewer.java @@ -464,7 +464,7 @@ public interface ITextViewer { /** * Sets the selection to the specified range. - * + * * @param offset the offset of the selection range * @param length the length of the selection range. A negative length places * the caret at the visual start of the selection. diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension7.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension7.java index e8dda3a87d8..8edd2f1d510 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension7.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension7.java @@ -21,7 +21,7 @@ public interface ITextViewerExtension7 { /** * Sets an auto edit strategy can converts tabs to spaces. - * + * * @param converter the converter or <code>null</code> if none should be used */ void setTabsToSpacesConverter(IAutoEditStrategy converter); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension8.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension8.java index 782f349dc37..9288ac9919f 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension8.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension8.java @@ -16,14 +16,14 @@ import org.eclipse.swt.custom.StyledTextPrintOptions; /** * Extension interface for {@link org.eclipse.jface.text.ITextViewer}. Adds the * ability to print and set how hovers should be enriched when the mouse is moved into them. - * + * * @since 3.4 */ public interface ITextViewerExtension8 { - + /** * Print the text viewer contents using the given options. - * + * * @param options the print options */ void print(StyledTextPrintOptions options); @@ -38,12 +38,12 @@ public interface ITextViewerExtension8 { * Note that a hover can only be enriched if its {@link IInformationControlExtension5#getInformationPresenterControlCreator()} * is not <code>null</code>. * </p> - * + * * @param mode the enrich mode, or <code>null</code> */ void setHoverEnrichMode(EnrichMode mode); - - + + /** * Type-safe enum of the available enrich modes. */ @@ -52,26 +52,26 @@ public interface ITextViewerExtension8 { /** * Enrich the hover shortly after the mouse has been moved into it and * stopped moving. - * + * * @see ITextViewerExtension8#setHoverEnrichMode(org.eclipse.jface.text.ITextViewerExtension8.EnrichMode) */ public static final EnrichMode AFTER_DELAY= new EnrichMode("after delay"); //$NON-NLS-1$ /** * Enrich the hover immediately when the mouse is moved into it. - * + * * @see ITextViewerExtension8#setHoverEnrichMode(org.eclipse.jface.text.ITextViewerExtension8.EnrichMode) */ public static final EnrichMode IMMEDIATELY= new EnrichMode("immediately"); //$NON-NLS-1$ /** * Enrich the hover on explicit mouse click. - * + * * @see ITextViewerExtension8#setHoverEnrichMode(org.eclipse.jface.text.ITextViewerExtension8.EnrichMode) */ public static final EnrichMode ON_CLICK= new EnrichMode("on click"); //$NON-NLS-1$; - + private String fName; private EnrichMode(String name) { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java index 517922726a6..ac76cba97aa 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java @@ -24,19 +24,19 @@ import org.eclipse.jface.text.source.LineRange; * <p> * This class is neither intended to be instantiated nor subclassed. * </p> - * + * * @since 3.3 * @noinstantiate This class is not intended to be instantiated by clients. */ public final class JFaceTextUtil { - + private JFaceTextUtil() { // Do not instantiate } /** * Computes the line height for the given line range. - * + * * @param textWidget the <code>StyledText</code> widget * @param startLine the start line * @param endLine the end line (exclusive) @@ -46,7 +46,7 @@ public final class JFaceTextUtil { public static int computeLineHeight(StyledText textWidget, int startLine, int endLine, int lineCount) { return getLinePixel(textWidget, endLine) - getLinePixel(textWidget, startLine); } - + /** * Returns the last fully visible line of the widget. The exact semantics of "last fully visible * line" are: @@ -54,39 +54,39 @@ public final class JFaceTextUtil { * <li>the last line of which the last pixel is visible, if any * <li>otherwise, the only line that is partially visible * </ul> - * + * * @param widget the widget * @return the last fully visible line */ public static int getBottomIndex(StyledText widget) { int lastPixel= computeLastVisiblePixel(widget); - + // bottom is in [0 .. lineCount - 1] int bottom= widget.getLineIndex(lastPixel); // bottom is the first line - no more checking if (bottom == 0) return bottom; - + int pixel= widget.getLinePixel(bottom); // bottom starts on or before the client area start - bottom is the only visible line if (pixel <= 0) return bottom; - + int offset= widget.getOffsetAtLine(bottom); int height= widget.getLineHeight(offset); - + // bottom is not showing entirely - use the previous line if (pixel + height - 1 > lastPixel) return bottom - 1; - + // bottom is fully visible and its last line is exactly the last pixel return bottom; } /** * Returns the index of the first (possibly only partially) visible line of the widget - * + * * @param widget the widget * @return the index of the first line of which a pixel is visible */ @@ -94,7 +94,7 @@ public final class JFaceTextUtil { // see StyledText#getPartialTopIndex() int top= widget.getTopIndex(); int pixels= widget.getLinePixel(top); - + // FIXME remove when https://bugs.eclipse.org/bugs/show_bug.cgi?id=123770 is fixed if (pixels == -widget.getLineHeight(widget.getOffsetAtLine(top))) { top++; @@ -103,13 +103,13 @@ public final class JFaceTextUtil { if (pixels > 0) top--; - + return top; } /** * Returns the index of the last (possibly only partially) visible line of the widget - * + * * @param widget the text widget * @return the index of the last line of which a pixel is visible */ @@ -122,7 +122,7 @@ public final class JFaceTextUtil { /** * Returns the last visible pixel in the widget's client area. - * + * * @param widget the widget * @return the last visible pixel in the widget's client area */ @@ -134,11 +134,11 @@ public final class JFaceTextUtil { // lastPixel -= 4; return lastPixel; } - + /** * Returns the line index of the first visible model line in the viewer. The line may be only * partially visible. - * + * * @param viewer the text viewer * @return the first line of which a pixel is visible, or -1 for no line */ @@ -147,7 +147,7 @@ public final class JFaceTextUtil { int widgetTop= getPartialTopIndex(widget); return widgetLine2ModelLine(viewer, widgetTop); } - + /** * Returns the last, possibly partially, visible line in the view port. * @@ -163,7 +163,7 @@ public final class JFaceTextUtil { /** * Returns the range of lines that is visible in the viewer, including any partially visible * lines. - * + * * @param viewer the viewer * @return the range of lines that is visible in the viewer, <code>null</code> if no lines are * visible @@ -180,7 +180,7 @@ public final class JFaceTextUtil { * Converts a widget line into a model (i.e. {@link IDocument}) line using the * {@link ITextViewerExtension5} if available, otherwise by adapting the widget line to the * viewer's {@link ITextViewer#getVisibleRegion() visible region}. - * + * * @param viewer the viewer * @param widgetLine the widget line to convert. * @return the model line corresponding to <code>widgetLine</code> or -1 to signal that there @@ -202,12 +202,12 @@ public final class JFaceTextUtil { } return modelLine; } - + /** * Converts a model (i.e. {@link IDocument}) line into a widget line using the * {@link ITextViewerExtension5} if available, otherwise by adapting the model line to the * viewer's {@link ITextViewer#getVisibleRegion() visible region}. - * + * * @param viewer the viewer * @param modelLine the model line to convert. * @return the widget line corresponding to <code>modelLine</code> or -1 to signal that there @@ -240,7 +240,7 @@ public final class JFaceTextUtil { /** * Returns the number of hidden pixels of the first partially visible line. If there is no * partially visible line, zero is returned. - * + * * @param textWidget the widget * @return the number of hidden pixels of the first partial line, always >= 0 */ @@ -248,14 +248,14 @@ public final class JFaceTextUtil { int top= getPartialTopIndex(textWidget); return -textWidget.getLinePixel(top); } - + /* * @see StyledText#getLinePixel(int) */ public static int getLinePixel(StyledText textWidget, int line) { return textWidget.getLinePixel(line); } - + /* * @see StyledText#getLineIndex(int) */ @@ -267,7 +267,7 @@ public final class JFaceTextUtil { /** * Returns <code>true</code> if the widget displays the entire contents, i.e. it cannot * be vertically scrolled. - * + * * @param widget the widget * @return <code>true</code> if the widget displays the entire contents, i.e. it cannot * be vertically scrolled, <code>false</code> otherwise @@ -275,7 +275,7 @@ public final class JFaceTextUtil { public static boolean isShowingEntireContents(StyledText widget) { if (widget.getTopPixel() != 0) // more efficient shortcut return false; - + int lastVisiblePixel= computeLastVisiblePixel(widget); int lastPossiblePixel= widget.getLinePixel(widget.getLineCount()); return lastPossiblePixel <= lastVisiblePixel; @@ -288,7 +288,7 @@ public final class JFaceTextUtil { * @param region the region whose graphical extend must be computed * @param textViewer the text viewer containing the region * @return the graphical extend of the given region in the given viewer - * + * * @since 3.4 */ public static Rectangle computeArea(IRegion region, ITextViewer textViewer) { @@ -299,7 +299,7 @@ public final class JFaceTextUtil { start= widgetRegion.getOffset(); end= start + widgetRegion.getLength(); } - + StyledText styledText= textViewer.getTextWidget(); Rectangle bounds; if (end > 0 && start < end) @@ -308,7 +308,7 @@ public final class JFaceTextUtil { Point loc= styledText.getLocationAtOffset(start); bounds= new Rectangle(loc.x, loc.y, getAverageCharWidth(textViewer.getTextWidget()), styledText.getLineHeight(start)); } - + return new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height); } @@ -319,7 +319,7 @@ public final class JFaceTextUtil { * @param region the document region * @param textViewer the viewer containing the region * @return the corresponding widget region - * + * * @since 3.4 */ private static IRegion modelRange2WidgetRange(IRegion region, ITextViewer textViewer) { @@ -327,22 +327,22 @@ public final class JFaceTextUtil { ITextViewerExtension5 extension= (ITextViewerExtension5) textViewer; return extension.modelRange2WidgetRange(region); } - + IRegion visibleRegion= textViewer.getVisibleRegion(); int start= region.getOffset() - visibleRegion.getOffset(); int end= start + region.getLength(); if (end > visibleRegion.getLength()) end= visibleRegion.getLength(); - + return new Region(start, end - start); } /** * Returns the average character width of the given control's font. - * + * * @param control the control to calculate the average char width for * @return the average character width of the controls font - * + * * @since 3.4 */ public static int getAverageCharWidth(Control control) { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/RegExMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/RegExMessages.java index bac5641ddd6..36fc2d08da0 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/RegExMessages.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/RegExMessages.java @@ -17,11 +17,11 @@ import java.util.ResourceBundle; /** * RegEx messages. Helper class to get NLSed messages. - * + * * @since 3.4 */ final class RegExMessages { - + private static final String RESOURCE_BUNDLE= RegExMessages.class.getName(); private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TabsToSpacesConverter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TabsToSpacesConverter.java index 7c9ceda8f3a..ea97c64108f 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TabsToSpacesConverter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TabsToSpacesConverter.java @@ -17,7 +17,7 @@ package org.eclipse.jface.text; * Clients usually instantiate and configure this class but * can also extend it in their own subclass. * </p> - * + * * @since 3.3 */ public class TabsToSpacesConverter implements IAutoEditStrategy { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextAttribute.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextAttribute.java index 8d08448a21c..a4a255fce11 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextAttribute.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextAttribute.java @@ -47,7 +47,7 @@ public class TextAttribute { /** The text style */ private int style; - + /** * The text font. * @since 3.3 @@ -72,7 +72,7 @@ public class TextAttribute { this.background= background; this.style= style; } - + /** * Creates a text attribute with the given colors and style. * @@ -110,7 +110,7 @@ public class TextAttribute { if (!(object instanceof TextAttribute)) return false; TextAttribute a= (TextAttribute)object; - + return (a.style == style && equals(a.foreground, foreground) && equals(a.background, background) && equals(a.font, font)); } @@ -169,7 +169,7 @@ public class TextAttribute { public int getStyle() { return style; } - + /** * Returns the attribute's font. * diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextPresentation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextPresentation.java index 7c4dab62ae9..b219368c44c 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextPresentation.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextPresentation.java @@ -439,19 +439,19 @@ public class TextPresentation { if (template.font != null) target.font= template.font; target.fontStyle|= template.fontStyle; - + if (template.metrics != null) target.metrics= template.metrics; - + if (template.foreground != null) target.foreground= template.foreground; if (template.background != null) target.background= template.background; - + target.strikeout|= template.strikeout; if (template.strikeoutColor != null) target.strikeoutColor= template.strikeoutColor; - + target.underline|= template.underline; if (template.underlineStyle != SWT.NONE) target.underlineStyle= template.underlineStyle; diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java index ebceff9a145..a4ee096e71d 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java @@ -120,7 +120,7 @@ public class TextViewer extends Viewer implements * @since 3.4 */ private static final int TEXT_HOVER_HEIGHT_CHARS= 12; //used to be 10 (text font) - + /** * Represents a replace command that brings the text viewer's text widget * back in synchronization with text viewer's document after the document @@ -200,12 +200,12 @@ public class TextViewer extends Viewer implements public void getNextOffset(MovementEvent event) { if (event.movement != SWT.MOVEMENT_WORD_END) return; - + if (TRACE_DOUBLE_CLICK) { System.out.println("\n+++"); //$NON-NLS-1$ print(event); } - + if (fDoubleClickSelection != null) { if (fDoubleClickSelection.x <= event.offset && event.offset <= fDoubleClickSelection.y) event.newOffset= fDoubleClickSelection.y; @@ -219,7 +219,7 @@ public class TextViewer extends Viewer implements public void getPreviousOffset(MovementEvent event) { if (event.movement != SWT.MOVEMENT_WORD_START) return; - + if (TRACE_DOUBLE_CLICK) { System.out.println("\n---"); //$NON-NLS-1$ print(event); @@ -243,7 +243,7 @@ public class TextViewer extends Viewer implements /** * Print trace info about <code>MovementEvent</code>. - * + * * @param e the event to print * @since 3.3 */ @@ -1104,7 +1104,7 @@ public class TextViewer extends Viewer implements fStateMask= stateMask; } } - + /** * Captures and remembers the viewer state (selection and visual position). {@link TextViewer.ViewerState} * instances are normally used once and then discarded, similar to the following snippet: @@ -1113,7 +1113,7 @@ public class TextViewer extends Viewer implements * doStuff(); // operation that may call setRedraw() and perform complex document modifications * state.restore(true); // restore the remembered state * </pre> - * + * * @since 3.3 */ private final class ViewerState { @@ -1146,7 +1146,7 @@ public class TextViewer extends Viewer implements /** * Returns the normalized selection, i.e. the the selection length is always non-negative. - * + * * @return the normalized selection */ public Point getSelection() { @@ -1157,7 +1157,7 @@ public class TextViewer extends Viewer implements /** * Updates the selection. - * + * * @param offset the new selection offset * @param length the new selection length */ @@ -1172,7 +1172,7 @@ public class TextViewer extends Viewer implements /** * Restores the state and disconnects it from the document. The selection is no longer * tracked after this call. - * + * * @param restoreViewport <code>true</code> to restore both selection and viewport, * <code>false</code> to only restore the selection */ @@ -1220,7 +1220,7 @@ public class TextViewer extends Viewer implements /** * Remembers the viewer state. - * + * * @param document the document to remember the state of */ private void connect(IDocument document) { @@ -1266,7 +1266,7 @@ public class TextViewer extends Viewer implements /** * Updates a position with the given information and clears its deletion state. - * + * * @param position the position to update * @param offset the new selection offset * @param length the new selection length @@ -1281,7 +1281,7 @@ public class TextViewer extends Viewer implements /** * Returns the document line to keep visually stable. If the caret line is (partially) * visible, it is returned, otherwise the topmost (partially) visible line is returned. - * + * * @return the visually stable line of this viewer state */ private int getStableLine() { @@ -1298,7 +1298,7 @@ public class TextViewer extends Viewer implements /** * Returns <code>true</code> if the viewer state is being tracked, <code>false</code> * otherwise. - * + * * @return the tracking state */ private boolean isConnected() { @@ -1326,7 +1326,7 @@ public class TextViewer extends Viewer implements /** * Internal cursor listener i.e. aggregation of mouse and key listener. - * + * * @since 3.0 */ private class CursorListener implements KeyListener, MouseListener { @@ -1420,8 +1420,8 @@ public class TextViewer extends Viewer implements } } } - - + + /** * Identifies the scrollbars as originators of a view port change. */ @@ -1700,7 +1700,7 @@ public class TextViewer extends Viewer implements protected void createControl(Composite parent, int styles) { fTextWidget= createTextWidget(parent, styles); - + // Support scroll page upon MOD1+MouseWheel fTextWidget.addListener(SWT.MouseWheel, new Listener() { @@ -1719,7 +1719,7 @@ public class TextViewer extends Viewer implements updateViewportListeners(INTERNAL); } }); - + fTextWidget.addDisposeListener( new DisposeListener() { public void widgetDisposed(DisposeEvent e) { @@ -1815,7 +1815,7 @@ public class TextViewer extends Viewer implements * control has been disposed. */ protected void handleDispose() { - + setDocument(null); if (fPaintManager != null) { @@ -1904,7 +1904,7 @@ public class TextViewer extends Viewer implements fVisibleDocument= null; fDocument= null; fScroller= null; - + fTextWidget= null; } @@ -2204,7 +2204,7 @@ public class TextViewer extends Viewer implements /** * {@inheritDoc} - * + * * @since 3.4 */ public void setHoverEnrichMode(ITextViewerExtension8.EnrichMode mode) { @@ -2985,7 +2985,7 @@ public class TextViewer extends Viewer implements * accurate if the widget does not use variable line heights - for that reason, clients should * not use this method any longer and use the client area height of the text widget to find out * how much content fits into it. - * + * * @return the view port height in lines * @deprecated as of 3.2 */ @@ -3005,7 +3005,7 @@ public class TextViewer extends Viewer implements if (fTextWidget == null) return -1; - + int widgetBottom= JFaceTextUtil.getBottomIndex(fTextWidget); return widgetLine2ModelLine(widgetBottom); } @@ -3098,7 +3098,7 @@ public class TextViewer extends Viewer implements // scroll vertically int bottom= JFaceTextUtil.getBottomIndex(fTextWidget); int lines= bottom - top; - + // if the widget is not scrollable as it is displaying the entire content // setTopIndex won't have any effect. @@ -3199,7 +3199,7 @@ public class TextViewer extends Viewer implements Rectangle bounds= fTextWidget.getTextBounds(start, end - 1); return new Region(bounds.x, bounds.width); } - + return new Region(fTextWidget.getLocationAtOffset(start).x, 0); } @@ -3549,9 +3549,9 @@ public class TextViewer extends Viewer implements protected void customizeDocumentCommand(DocumentCommand command) { if (isIgnoringAutoEditStrategies()) return; - + IDocument document= getDocument(); - + if (fTabsToSpacesConverter != null) fTabsToSpacesConverter.customizeDocumentCommand(document, command); @@ -3990,7 +3990,7 @@ public class TextViewer extends Viewer implements protected void shift(boolean useDefaultPrefixes, boolean right, boolean ignoreWhitespace) { if (fUndoManager != null) fUndoManager.beginCompoundChange(); - + IDocument d= getDocument(); Map partitioners= null; DocumentRewriteSession rewriteSession= null; @@ -4043,7 +4043,7 @@ public class TextViewer extends Viewer implements if (partitioners != null) TextUtilities.addDocumentPartitioners(d, partitioners); - + if (d instanceof IDocumentExtension4) { IDocumentExtension4 extension= (IDocumentExtension4) d; extension.stopRewriteSession(rewriteSession); @@ -4163,7 +4163,7 @@ public class TextViewer extends Viewer implements /** * {@inheritDoc} - * + * * @since 3.4 */ public void print(StyledTextPrintOptions options) { @@ -4409,7 +4409,7 @@ public class TextViewer extends Viewer implements range= modelStyleRange2WidgetStyleRange(range); if (range != null) fTextWidget.setStyleRange(range); - + ArrayList ranges= new ArrayList(presentation.getDenumerableRanges()); Iterator e= presentation.getNonDefaultStyleRangeIterator(); while (e.hasNext()) { @@ -4418,10 +4418,10 @@ public class TextViewer extends Viewer implements if (range != null) ranges.add(range); } - + if (!ranges.isEmpty()) fTextWidget.replaceStyleRanges(0, 0, (StyleRange[])ranges.toArray(new StyleRange[ranges.size()])); - + } else { IRegion region= modelRange2WidgetRange(presentation.getCoverage()); if (region == null) @@ -4760,9 +4760,9 @@ public class TextViewer extends Viewer implements * way for subclasses to pass in a desired top index that should be used when * <code>redraw</code> is <code>true</code>. If <code>topIndex</code> is -1, this method is * identical to <code>ITextViewerExtension.setRedraw(boolean)</code>. - * + * * @see ITextViewerExtension#setRedraw(boolean) - * + * * @param redraw <code>true</code> if redraw is enabled * @param topIndex the top index * @since 3.0 @@ -5310,7 +5310,7 @@ public class TextViewer extends Viewer implements ((IHyperlinkDetectorExtension)fHyperlinkDetectors[i]).dispose(); } } - + boolean enable= hyperlinkDetectors != null && hyperlinkDetectors.length > 0; fHyperlinkStateMask= eventStateMask; fHyperlinkDetectors= hyperlinkDetectors; 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 31dd488d7a2..784671f950b 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 @@ -298,7 +298,7 @@ class TextViewerHoverManager extends AbstractHoverInformationControlManager impl fTextViewer.releaseWidgetToken(this); } } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager#replaceInformationControl(boolean) * @since 3.4 @@ -350,15 +350,15 @@ class TextViewerHoverManager extends AbstractHoverInformationControlManager impl public boolean setFocus(IWidgetTokenOwner owner) { if (! hasInformationControlReplacer()) return false; - + IInformationControl iControl= getCurrentInformationControl(); if (canReplace(iControl)) { if (cancelReplacingDelay()) replaceInformationControl(true); - + return true; } - + return false; } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerUndoManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerUndoManager.java index 6075efee0cb..827a523430f 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerUndoManager.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerUndoManager.java @@ -43,20 +43,20 @@ import org.eclipse.jface.dialogs.MessageDialog; * <p> * This class is not intended to be subclassed. * </p> - * + * * @see ITextViewer * @see ITextInputListener * @see IDocumentUndoManager * @see MouseListener * @see KeyListener * @see DocumentUndoManager - * + * * @since 3.2 * @noextend This class is not intended to be subclassed by clients. */ public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtension { - + /** * Internal listener to mouse and key events. */ @@ -140,7 +140,7 @@ public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtensio */ public void documentUndoNotification(DocumentUndoEvent event ){ if (!isConnected()) return; - + int eventType= event.getEventType(); if (((eventType & DocumentUndoEvent.ABOUT_TO_UNDO) != 0) || ((eventType & DocumentUndoEvent.ABOUT_TO_REDO) != 0)) { if (event.isCompound()) { @@ -157,7 +157,7 @@ public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtensio ((TextViewer)fTextViewer).ignoreAutoEditStrategies(true); } }); - + } else if (((eventType & DocumentUndoEvent.UNDONE) != 0) || ((eventType & DocumentUndoEvent.REDONE) != 0)) { fTextViewer.getTextWidget().getDisplay().syncExec(new Runnable() { public void run() { @@ -173,7 +173,7 @@ public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtensio if (extension != null) extension.setRedraw(true); } - + // Reveal the change if this manager's viewer has the focus. if (fTextViewer != null) { StyledText widget= fTextViewer.getTextWidget(); @@ -193,16 +193,16 @@ public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtensio /** The text viewer the undo manager is connected to */ private ITextViewer fTextViewer; - + /** The undo level */ private int fUndoLevel; - + /** The document undo manager that is active. */ private IDocumentUndoManager fDocumentUndoManager; - + /** The document that is active. */ private IDocument fDocument; - + /** The document undo listener */ private IDocumentUndoListener fDocumentUndoListener; @@ -344,7 +344,7 @@ public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtensio public void reset() { if (isConnected()) fDocumentUndoManager.reset(); - + } /* @@ -417,7 +417,7 @@ public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtensio } return null; } - + private void connectDocumentUndoManager(IDocument document) { disconnectDocumentUndoManager(); if (document != null) { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java index 2356e62c295..27399db3980 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java @@ -26,7 +26,7 @@ import org.eclipse.swt.graphics.Point; /** * A painter for drawing visible characters for (invisible) whitespace * characters. - * + * * @since 3.3 */ public class WhitespaceCharacterPainter implements IPainter, PaintListener { @@ -36,7 +36,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener { private static final char TAB_SIGN= '\u00bb'; private static final char CARRIAGE_RETURN_SIGN= '\u00a4'; private static final char LINE_FEED_SIGN= '\u00b6'; - + /** Indicates whether this painter is active. */ private boolean fIsActive= false; /** The source viewer this painter is attached to. */ @@ -48,7 +48,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener { /** * Creates a new painter for the given text viewer. - * + * * @param textViewer the text viewer the painter should be attached to */ public WhitespaceCharacterPainter(ITextViewer textViewer) { @@ -149,7 +149,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener { /** * Draw the given line range. - * + * * @param gc the GC * @param startLine first line number * @param endLine last line number (inclusive) @@ -218,7 +218,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener { /** * Draw characters of content range. - * + * * @param gc the GC * @param startOffset inclusive start index * @param endOffset exclusive end index @@ -289,7 +289,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener { /** * Check if the given widget line is a folded line. - * + * * @param widgetLine the widget line number * @return <code>true</code> if the line is folded */ @@ -312,7 +312,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener { /** * Draw string at widget offset. - * + * * @param gc the GC * @param offset the widget offset * @param s the string to be drawn @@ -324,7 +324,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener { FontMetrics fontMetrics= gc.getFontMetrics(); int fontBaseline= fontMetrics.getAscent() + fontMetrics.getLeading(); int baslineDelta= baseline - fontBaseline; - + Point pos= fTextWidget.getLocationAtOffset(offset); gc.setForeground(fg); gc.drawString(s, pos.x, pos.y + baslineDelta, true); @@ -332,7 +332,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener { /** * Convert a document offset to the corresponding widget offset. - * + * * @param documentOffset the document offset * @return widget offset */ @@ -351,7 +351,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener { /** * Convert a widget offset to the corresponding document offset. - * + * * @param widgetOffset the widget offset * @return document offset */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java index f71c9dc69b6..6e4f7f23b4b 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java @@ -10,12 +10,6 @@ *******************************************************************************/ package org.eclipse.jface.text.contentassist; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; - import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Point; @@ -26,7 +20,14 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; + import org.eclipse.jface.internal.text.InformationControlReplacer; + import org.eclipse.jface.text.AbstractInformationControlManager; import org.eclipse.jface.text.AbstractReusableInformationControlCreator; import org.eclipse.jface.text.DefaultInformationControl; @@ -41,15 +42,15 @@ import org.eclipse.jface.text.IInformationControlExtension3; * @since 2.0 */ class AdditionalInfoController extends AbstractInformationControlManager { - + /** * A timer thread. - * + * * @since 3.2 */ private static abstract class Timer { private static final int DELAY_UNTIL_JOB_IS_SCHEDULED= 50; - + /** * A <code>Task</code> is {@link Task#run() run} when {@link #delay()} milliseconds have * elapsed after it was scheduled without a {@link #reset(ICompletionProposal) reset} @@ -69,7 +70,7 @@ class AdditionalInfoController extends AbstractInformationControlManager { */ public abstract Task nextTask(); } - + /** * IDLE: the initial task, and active whenever the info has been shown. It cannot be run, * but specifies an infinite delay. @@ -78,16 +79,16 @@ class AdditionalInfoController extends AbstractInformationControlManager { public void run() { Assert.isTrue(false); } - + public Task nextTask() { Assert.isTrue(false); return null; } - + public long delay() { return Long.MAX_VALUE; } - + public String toString() { return "IDLE"; //$NON-NLS-1$ } @@ -116,15 +117,15 @@ class AdditionalInfoController extends AbstractInformationControlManager { }; job.schedule(); } - + public Task nextTask() { return SECOND_WAIT; } - + public long delay() { return DELAY_UNTIL_JOB_IS_SCHEDULED; } - + public String toString() { return "FIRST_WAIT"; //$NON-NLS-1$ } @@ -138,15 +139,15 @@ class AdditionalInfoController extends AbstractInformationControlManager { // show the info allowShowing(); } - + public Task nextTask() { return IDLE; } - + public long delay() { return fDelay - DELAY_UNTIL_JOB_IS_SCHEDULED; } - + public String toString() { return "SECOND_WAIT"; //$NON-NLS-1$ } @@ -170,15 +171,15 @@ class AdditionalInfoController extends AbstractInformationControlManager { }); } } - + public Task nextTask() { return IDLE; } - + public long delay() { return fDelay; } - + public String toString() { return "LEGACY_WAIT"; //$NON-NLS-1$ } @@ -199,12 +200,12 @@ class AdditionalInfoController extends AbstractInformationControlManager { public void run() { Assert.isTrue(false); } - + public String toString() { return "EXIT"; //$NON-NLS-1$ } }; - + /** The timer thread. */ private final Thread fThread; @@ -212,17 +213,17 @@ class AdditionalInfoController extends AbstractInformationControlManager { private Task fTask; /** The next wake up time. */ private long fNextWakeup; - + private ICompletionProposal fCurrentProposal= null; private Object fCurrentInfo= null; private boolean fAllowShowing= false; private final Display fDisplay; private final int fDelay; - + /** * Creates a new timer. - * + * * @param display the display to use for display thread posting. * @param delay the delay until to show additional info */ @@ -242,7 +243,7 @@ class AdditionalInfoController extends AbstractInformationControlManager { }, JFaceTextMessages.getString("InfoPopup.info_delay_timer_name")); //$NON-NLS-1$ fThread.start(); } - + /** * Terminates the timer thread. */ @@ -250,10 +251,10 @@ class AdditionalInfoController extends AbstractInformationControlManager { schedule(EXIT, System.currentTimeMillis()); notifyAll(); } - + /** * Resets the timer thread as the selection has changed to a new proposal. - * + * * @param p the new proposal */ public final synchronized void reset(ICompletionProposal p) { @@ -269,7 +270,7 @@ class AdditionalInfoController extends AbstractInformationControlManager { notifyAll(); } } - + private Task taskOnReset(ICompletionProposal p) { if (p == null) return IDLE; @@ -295,11 +296,11 @@ class AdditionalInfoController extends AbstractInformationControlManager { } } } - + private Task currentTask() { return fTask; } - + private void schedule(Task task, long current) { fTask= task; long nextWakeup= current + task.delay(); @@ -316,7 +317,7 @@ class AdditionalInfoController extends AbstractInformationControlManager { ICompletionProposal getCurrentProposal() { return fCurrentProposal; } - + ICompletionProposalExtension5 getCurrentProposalEx() { Assert.isTrue(fCurrentProposal instanceof ICompletionProposalExtension5); return (ICompletionProposalExtension5) fCurrentProposal; @@ -345,10 +346,10 @@ class AdditionalInfoController extends AbstractInformationControlManager { }); } } - + /** * Called in the display thread to show additional info. - * + * * @param proposal the proposal to show information about * @param info the information about <code>proposal</code> */ @@ -377,7 +378,7 @@ class AdditionalInfoController extends AbstractInformationControlManager { public void widgetDefaultSelected(SelectionEvent e) { } } - + /** * Default control creator for the information control replacer. * @since 3.4 @@ -423,7 +424,7 @@ class AdditionalInfoController extends AbstractInformationControlManager { fDelay= delay; setAnchor(ANCHOR_RIGHT); setFallbackAnchors(new Anchor[] { ANCHOR_RIGHT, ANCHOR_LEFT, ANCHOR_BOTTOM }); - + /* * Adjust the location by one pixel towards the proposal popup, so that the single pixel * border of the additional info popup overlays with the border of the popup. This avoids @@ -431,7 +432,7 @@ class AdditionalInfoController extends AbstractInformationControlManager { */ int spacing= -1; setMargins(spacing, spacing); // see also adjustment in #computeLocation - + InformationControlReplacer replacer= new InformationControlReplacer(new DefaultPresenterControlCreator()); getInternalAccessor().setInformationControlReplacer(replacer); } @@ -452,7 +453,7 @@ class AdditionalInfoController extends AbstractInformationControlManager { fProposalTable= (Table) control; fProposalTable.addSelectionListener(fSelectionListener); getInternalAccessor().getInformationControlReplacer().install(fProposalTable); - + fTimer= new Timer(fProposalTable.getDisplay(), fDelay) { protected void showInformation(ICompletionProposal proposal, Object info) { InformationControlReplacer replacer= getInternalAccessor().getInformationControlReplacer(); @@ -507,10 +508,10 @@ class AdditionalInfoController extends AbstractInformationControlManager { void showInformation(ICompletionProposal proposal, Object info) { if (fProposalTable == null || fProposalTable.isDisposed()) return; - + if (fProposal == proposal && ((info == null && fInformation == null) || (info != null && info.equals(fInformation)))) return; - + fInformation= info; fProposal= proposal; showInformation(); @@ -537,7 +538,7 @@ class AdditionalInfoController extends AbstractInformationControlManager { */ protected Point computeLocation(Rectangle subjectArea, Point controlSize, Anchor anchor) { Point location= super.computeLocation(subjectArea, controlSize, anchor); - + /* * The location is computed using subjectControl.toDisplay(), which does not include the * trim of the subject control. As we want the additional info popup aligned with the outer @@ -557,7 +558,7 @@ class AdditionalInfoController extends AbstractInformationControlManager { // at least as big as the proposal table Point sizeConstraint= super.computeSizeConstraints(subjectControl, informationControl); Point size= subjectControl.getShell().getSize(); - + // AbstractInformationControlManager#internalShowInformationControl(Rectangle, Object) adds trims // to the computed constraints. Need to remove them here, to make the outer bounds of the additional // info shell fit the bounds of the proposal shell: @@ -573,7 +574,7 @@ class AdditionalInfoController extends AbstractInformationControlManager { sizeConstraint.y= size.y; return sizeConstraint; } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager#hideInformationControl() */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java index b186776fc24..b5a5ae9b2cf 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java @@ -104,23 +104,23 @@ class CompletionProposalPopup implements IContentAssistListener { /** * Completion proposal selection handler. - * + * * @since 3.4 */ final class ProposalSelectionHandler extends AbstractHandler { - + /** * Selection operation codes. */ static final int SELECT_NEXT= 1; static final int SELECT_PREVIOUS= 2; - + private int fOperationCode; /** * Creates a new selection handler. - * + * * @param operationCode the operation code * @since 3.4 */ @@ -153,11 +153,11 @@ class CompletionProposalPopup implements IContentAssistListener { } } - + /** * The empty proposal displayed if there is nothing else to show. - * + * * @since 3.2 */ private static final class EmptyProposal implements ICompletionProposal, ICompletionProposalExtension { @@ -261,15 +261,15 @@ class CompletionProposalPopup implements IContentAssistListener { private final class CommandKeyListener extends KeyAdapter { private KeySequence fCommandSequence; - + private CommandKeyListener(KeySequence keySequence) { fCommandSequence= keySequence; } - + public void keyPressed(KeyEvent e) { if (!Helper.okToUse(fProposalShell)) return; - + int accelerator= SWTKeySupport.convertEventToUnmodifiedAccelerator(e); KeySequence sequence= KeySequence.getInstance(SWTKeySupport.convertAcceleratorToKeyStroke(accelerator)); if (sequence.equals(fCommandSequence)) @@ -277,11 +277,11 @@ class CompletionProposalPopup implements IContentAssistListener { incrementalComplete(); else showProposals(false); - + } } - - + + /** The associated text viewer. */ private ITextViewer fViewer; /** The associated content assistant. */ @@ -349,14 +349,14 @@ class CompletionProposalPopup implements IContentAssistListener { private boolean fIsFilteredSubset; /** * The filter runnable. - * + * * @since 3.1.1 */ private final Runnable fFilterRunnable= new Runnable() { public void run() { if (!fIsFilterPending) return; - + fIsFilterPending= false; if (!Helper.okToUse(fContentAssistSubjectControlAdapter.getControl())) @@ -384,50 +384,50 @@ class CompletionProposalPopup implements IContentAssistListener { /** * <code>true</code> if <code>fFilterRunnable</code> has been * posted, <code>false</code> if not. - * + * * @since 3.1.1 */ private boolean fIsFilterPending= false; /** * The info message at the bottom of the popup, or <code>null</code> for no popup (if * ContentAssistant does not provide one). - * + * * @since 3.2 */ private Label fMessageText; /** * The font used for <code>fMessageText</code> or null; dispose when done. - * + * * @since 3.2 */ private Font fMessageTextFont; /** * The most recent completion offset (used to determine repeated invocation) - * + * * @since 3.2 */ private int fLastCompletionOffset; /** * The (reusable) empty proposal. - * + * * @since 3.2 */ private final EmptyProposal fEmptyProposal= new EmptyProposal(); /** * The text for the empty proposal, or <code>null</code> to use the default text. - * + * * @since 3.2 */ private String fEmptyMessage= null; /** * Tells whether colored labels support is enabled. * Only valid while the popup is active. - * + * * @since 3.4 */ private boolean fIsColoredLabelsSupportEnabled= false; - + /** * Creates a new completion proposal popup for the given elements. * @@ -488,7 +488,7 @@ class CompletionProposalPopup implements IContentAssistListener { int count= (fComputedProposals == null ? 0 : fComputedProposals.length); if (count == 0 && hideWhenNoProposals(autoActivated)) return; - + if (count == 1 && !autoActivated && canAutoInsert(fComputedProposals[0])) { insertProposal(fComputedProposals[0], (char) 0, 0, fInvocationOffset); hide(); @@ -506,11 +506,11 @@ class CompletionProposalPopup implements IContentAssistListener { return getErrorMessage(); } - + /** * Hides the popup and returns <code>true</code> if the popup is configured * to never display an empty list. Returns <code>false</code> otherwise. - * + * * @param autoActivated whether the invocation was auto-activated * @return <code>false</code> if an empty list should be displayed, <code>true</code> otherwise * @since 3.2 @@ -531,7 +531,7 @@ class CompletionProposalPopup implements IContentAssistListener { /** * If content assist is set up to handle cycling, then the proposals are recomputed. Otherwise, * nothing happens. - * + * * @since 3.2 */ private void handleRepeatedInvocation() { @@ -585,7 +585,7 @@ class CompletionProposalPopup implements IContentAssistListener { } else { fProposalTable= new Table(fProposalShell, SWT.H_SCROLL | SWT.V_SCROLL); } - + fIsColoredLabelsSupportEnabled= fContentAssistant.isColoredLabelsSupportEnabled(); if (fIsColoredLabelsSupportEnabled) TableOwnerDrawSupport.install(fProposalTable); @@ -599,7 +599,7 @@ class CompletionProposalPopup implements IContentAssistListener { layout.marginHeight= 0; layout.verticalSpacing= 1; fProposalShell.setLayout(layout); - + if (fContentAssistant.isStatusLineVisible()) { createMessageText(); } @@ -636,7 +636,7 @@ class CompletionProposalPopup implements IContentAssistListener { fSize= fProposalShell.getSize(); } }); - + fProposalShell.setBackground(control.getDisplay().getSystemColor(SWT.COLOR_GRAY)); Color c= getBackgroundColor(control); @@ -663,14 +663,14 @@ class CompletionProposalPopup implements IContentAssistListener { }); fProposalTable.setHeaderVisible(false); - + addCommandSupport(fProposalTable); } /** * Returns the minimal required height for the proposal, may return 0 if the popup has not been * created yet. - * + * * @return the minimal height * @since 3.3 */ @@ -688,7 +688,7 @@ class CompletionProposalPopup implements IContentAssistListener { /** * Adds command support to the given control. - * + * * @param control the control to watch for focus * @since 3.2 */ @@ -744,7 +744,7 @@ class CompletionProposalPopup implements IContentAssistListener { /** * Returns the background color to use. - * + * * @param control the control to get the display from * @return the background color * @since 3.2 @@ -758,7 +758,7 @@ class CompletionProposalPopup implements IContentAssistListener { /** * Returns the foreground color to use. - * + * * @param control the control to get the display from * @return the foreground color * @since 3.2 @@ -769,10 +769,10 @@ class CompletionProposalPopup implements IContentAssistListener { c= JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR); return c; } - + /** * Creates the caption line under the proposal table. - * + * * @since 3.2 */ private void createMessageText() { @@ -831,7 +831,7 @@ class CompletionProposalPopup implements IContentAssistListener { item.setText(displayString); if (fIsColoredLabelsSupportEnabled) TableOwnerDrawSupport.storeStyleRanges(item, 0, styleRanges); - + item.setImage(current.getImage()); item.setData(current); } else { @@ -851,11 +851,11 @@ class CompletionProposalPopup implements IContentAssistListener { */ if (fIsFilterPending) fFilterRunnable.run(); - + // filter runnable may have hidden the proposals if (!Helper.okToUse(fProposalTable)) return null; - + int i= fProposalTable.getSelectionIndex(); if (fFilteredProposals == null || i < 0 || i >= fFilteredProposals.length) return null; @@ -1017,20 +1017,20 @@ class CompletionProposalPopup implements IContentAssistListener { fProposalShell.dispose(); fProposalShell= null; } - + if (fMessageTextFont != null) { fMessageTextFont.dispose(); fMessageTextFont= null; } - + if (fMessageText != null) { fMessageText= null; } - + fEmptyMessage= null; - + fLastCompletionOffset= -1; - + fContentAssistant.fireSessionEndEvent(); } @@ -1092,7 +1092,7 @@ class CompletionProposalPopup implements IContentAssistListener { if (Helper.okToUse(fProposalTable)) { if (oldProposal instanceof ICompletionProposalExtension2 && fViewer != null) ((ICompletionProposalExtension2) oldProposal).unselected(fViewer); - + if (proposals == null || proposals.length == 0) { fEmptyProposal.fOffset= fFilterOffset; fEmptyProposal.fDisplayString= fEmptyMessage != null ? fEmptyMessage : JFaceTextMessages.getString("CompletionProposalPopup.no_proposals"); //$NON-NLS-1$ @@ -1160,7 +1160,7 @@ class CompletionProposalPopup implements IContentAssistListener { if (fContentAssistant.addContentAssistListener(this, ContentAssistant.PROPOSAL_SELECTOR)) { ensureDocumentListenerInstalled(); - + if (fFocusHelper == null) { fFocusHelper= new IEditingSupport() { @@ -1341,11 +1341,11 @@ class CompletionProposalPopup implements IContentAssistListener { fireSelectionEvent(null, smartToggle); return; } - + ICompletionProposal proposal= fFilteredProposals[index]; if (proposal instanceof ICompletionProposalExtension2 && fViewer != null) ((ICompletionProposalExtension2) proposal).selected(fViewer, smartToggle); - + fireSelectionEvent(proposal, smartToggle); fLastProposal= proposal; @@ -1358,7 +1358,7 @@ class CompletionProposalPopup implements IContentAssistListener { /** * Fires a selection event, see {@link ICompletionListener}. - * + * * @param proposal the selected proposal, possibly <code>null</code> * @param smartToggle true if the smart toggle is on * @since 3.2 @@ -1485,11 +1485,11 @@ class CompletionProposalPopup implements IContentAssistListener { fProposalShell.setFocus(); } } - + /** * Returns <code>true</code> if <code>proposal</code> should be auto-inserted, * <code>false</code> otherwise. - * + * * @param proposal the single proposal that might be automatically inserted * @return <code>true</code> if <code>proposal</code> can be inserted automatically, * <code>false</code> otherwise @@ -1541,7 +1541,7 @@ class CompletionProposalPopup implements IContentAssistListener { int count= (fFilteredProposals == null ? 0 : fFilteredProposals.length); if (count == 0 && hideWhenNoProposals(false)) return; - + if (count == 1 && canAutoInsert(fFilteredProposals[0])) { insertProposal(fFilteredProposals[0], (char) 0, 0, fInvocationOffset); hide(); @@ -1567,7 +1567,7 @@ class CompletionProposalPopup implements IContentAssistListener { * proposal, it is inserted, otherwise, the common prefix of all proposals * is inserted into the document. If there is no common prefix, nothing * happens and <code>false</code> is returned. - * + * * @return <code>true</code> if a single proposal was inserted and the * selector can be closed, <code>false</code> otherwise * @since 3.0 @@ -1592,7 +1592,7 @@ class CompletionProposalPopup implements IContentAssistListener { List rightCase= new ArrayList(); boolean isWrongCaseMatch= false; - + // the prefix of all case insensitive matches. This differs from the document // contents and will be replaced. CharSequence wrongCasePrefix= null; @@ -1603,10 +1603,10 @@ class CompletionProposalPopup implements IContentAssistListener { for (int i= 0; i < fFilteredProposals.length; i++) { ICompletionProposal proposal= fFilteredProposals[i]; - + if (!(proposal instanceof ICompletionProposalExtension3)) return false; - + int start= ((ICompletionProposalExtension3)proposal).getPrefixCompletionStart(fContentAssistSubjectControlAdapter.getDocument(), fFilterOffset); CharSequence insertion= ((ICompletionProposalExtension3)proposal).getPrefixCompletionText(fContentAssistSubjectControlAdapter.getDocument(), fFilterOffset); if (insertion == null) @@ -1744,11 +1744,11 @@ class CompletionProposalPopup implements IContentAssistListener { // all equal up to minimum buffer.delete(min, buffer.length()); } - + /** * Sets the message for the repetition affordance text at the bottom of the proposal. Only has * an effect if {@link ContentAssistant#isRepeatedInvocationMode()} returns <code>true</code>. - * + * * @param message the new caption * @since 3.2 */ @@ -1761,7 +1761,7 @@ class CompletionProposalPopup implements IContentAssistListener { /** * Sets the text to be displayed if no proposals are available. Only has an effect if * {@link ContentAssistant#isShowEmptyList()} returns <code>true</code>. - * + * * @param message the empty message * @since 3.2 */ @@ -1772,14 +1772,14 @@ class CompletionProposalPopup implements IContentAssistListener { /** * Enables or disables showing of the caption line. See also {@link #setMessage(String)}. - * + * * @param show <code>true</code> if the status line is visible * @since 3.2 */ public void setStatusLineVisible(boolean show) { if (!isActive() || show == (fMessageText != null)) return; // nothing to do - + if (show) { createMessageText(); } else { @@ -1791,7 +1791,7 @@ class CompletionProposalPopup implements IContentAssistListener { /** * Informs the popup that it is being placed above the caret line instead of below. - * + * * @param above <code>true</code> if the location of the popup is above the caret line, <code>false</code> if it is below * @since 3.3 */ @@ -1807,7 +1807,7 @@ class CompletionProposalPopup implements IContentAssistListener { /** * Returns a new proposal selection handler. - * + * * @param operationCode the operation code * @return the handler * @since 3.4 diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistEvent.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistEvent.java index 61adff9e7fc..749c471631e 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistEvent.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistEvent.java @@ -17,7 +17,7 @@ package org.eclipse.jface.text.contentassist; * <p> * Clients may use this class. * </p> - * + * * @since 3.2 * @see ICompletionListener * @noinstantiate This class is not intended to be instantiated by clients. @@ -25,7 +25,7 @@ package org.eclipse.jface.text.contentassist; public final class ContentAssistEvent { /** * Creates a new event. - * + * * @param ca the assistant * @param proc the processor * @param isAutoActivated whether content assist was triggered by auto activation @@ -39,7 +39,7 @@ public final class ContentAssistEvent { /** * Creates a new event. - * + * * @param ca the assistant * @param proc the processor */ @@ -60,7 +60,7 @@ public final class ContentAssistEvent { * <p> * <strong>Note:</strong> This flag is only valid in {@link ICompletionListener#assistSessionStarted(ContentAssistEvent)}. * </p> - * + * * @since 3.4 */ public final boolean isAutoActivated; diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistSubjectControlAdapter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistSubjectControlAdapter.java index 7fe385055c7..09486febc2a 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistSubjectControlAdapter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistSubjectControlAdapter.java @@ -19,7 +19,9 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.core.runtime.Assert; -import org.eclipse.jface.contentassist.*; +import org.eclipse.jface.contentassist.IContentAssistSubjectControl; +import org.eclipse.jface.contentassist.ISubjectControlContextInformationPresenter; +import org.eclipse.jface.contentassist.ISubjectControlContextInformationValidator; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IEventConsumer; @@ -73,7 +75,7 @@ final class ContentAssistSubjectControlAdapter implements IContentAssistSubjectC public int getLineHeight() { if (fContentAssistSubjectControl != null) return fContentAssistSubjectControl.getLineHeight(); - + return fViewer.getTextWidget().getLineHeight(getCaretOffset()); } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java index 4b694dada4b..54312240a47 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java @@ -75,22 +75,22 @@ import org.eclipse.jface.text.TextUtilities; * instantiate this class and configure it before using it. */ public class ContentAssistant implements IContentAssistant, IContentAssistantExtension, IContentAssistantExtension2, IContentAssistantExtension3, IContentAssistantExtension4, IWidgetTokenKeeper, IWidgetTokenKeeperExtension { - - - + + + /** * Content assist command identifier for 'select next proposal'. - * + * * @since 3.4 */ public static final String SELECT_NEXT_PROPOSAL_COMMAND_ID= "org.eclipse.ui.edit.text.contentAssist.selectNextProposal"; //$NON-NLS-1$ /** * Content assist command identifier for 'select previous proposal'. - * + * * @since 3.4 */ public static final String SELECT_PREVIOUS_PROPOSAL_COMMAND_ID= "org.eclipse.ui.edit.text.contentAssist.selectPreviousProposal"; //$NON-NLS-1$ - + /** * A generic closer class used to monitor various interface events in order to determine whether @@ -241,7 +241,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt * implementation utilizes a thread to watch for input characters matching the activation * characters specified by the content assist processor, and if detected, will wait the * indicated delay interval before activating the content assistant. - * + * * @since 3.4 protected, was added in 2.1 as private class */ protected class AutoAssistListener extends KeyAdapter implements Runnable, VerifyKeyListener { @@ -310,10 +310,10 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt // Only act on typed characters and ignore modifier-only events if (e.character == 0 && (e.keyCode & SWT.KEYCODE_BIT) == 0) return; - + if (e.character != 0 && (e.stateMask == SWT.ALT)) return; - + // Only act on characters that are trigger candidates. This // avoids computing the model selection on every keystroke if (computeAllAutoActivationTriggers().indexOf(e.character) < 0) { @@ -356,20 +356,20 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt final Control control= fContentAssistSubjectControlAdapter.getControl(); if (control == null) return; - + final Display d= control.getDisplay(); if (d == null) return; - + try { d.syncExec(new Runnable() { public void run() { if (isProposalPopupActive()) return; - + if (control.isDisposed() || !control.isFocusControl()) return; - + if (showStyle == SHOW_PROPOSALS) { if (!prepareToShowCompletions(true)) return; @@ -476,7 +476,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt /** * Layouts the popup defined by <code>type</code> at the given widget offset. - * + * * @param type the kind of popup to layout * @param offset the widget offset */ @@ -589,7 +589,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt /** * Moves <code>point</code> such that <code>rectangle</code> does not bleed outside of * <code>bounds</code>. All coordinates must have the same reference. - * + * * @param point the point to move if needed * @param shellSize the size of the shell that may be moved * @param bounds the bounds @@ -601,10 +601,10 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt if (point.x < bounds.x) point.x= bounds.x; - + if (point.y + shellSize.y > bounds.y + bounds.height) point.y= bounds.y + bounds.height - shellSize.y; - + if (point.y < bounds.y) point.y= bounds.y; } @@ -613,20 +613,20 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt // clip width if (rect.width > bounds.width) rect.width= bounds.width; - + if (rect.x + rect.width > bounds.x + bounds.width) rect.x= bounds.x + bounds.width - rect.width; if (rect.x < bounds.x) rect.x= bounds.x; - + return rect; } - + /** * Returns the display bounds for <code>shell</code> such that it appears right above * <code>offset</code>, or below it if above is not suitable. The returned bounds lie * within the monitor at the caret location and never overlap with the caret line. - * + * * @param shell the shell to compute the placement for * @param preferred the preferred size for <code>shell</code> * @param offset the caret offset in the subject control @@ -640,7 +640,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt Monitor monitor= getClosestMonitor(display, caret); Rectangle bounds= monitor.getClientArea(); Geometry.moveInside(caret, bounds); - + int spaceAbove= caret.y - bounds.y; int caretLowerY= caret.y + caret.height; int spaceBelow= bounds.y + bounds.height - caretLowerY; @@ -654,7 +654,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt rect= new Rectangle(caret.x, bounds.y, preferred.x, spaceAbove); else rect= new Rectangle(caret.x, caretLowerY, preferred.x, spaceBelow); - + return constrainHorizontally(rect, bounds); } @@ -662,7 +662,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt * Returns the display bounds for <code>shell</code> such that it appears right below * <code>offset</code>, or above it if below is not suitable. The returned bounds lie * within the monitor at the caret location and never overlap with the caret line. - * + * * @param shell the shell to compute the placement for * @param preferred the preferred size for <code>shell</code> * @param offset the caret offset in the subject control @@ -698,10 +698,10 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt rect= new Rectangle(caret.x, bounds.y, preferred.x, spaceAbove); switched= true; } - + if (popup != null) popup.switchedPositionToAbove(switched); - + return constrainHorizontally(rect, bounds); } @@ -714,7 +714,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt Rectangle subjectRectangle= new Rectangle(location.x, location.y, 1, fContentAssistSubjectControlAdapter.getLineHeight()); return subjectRectangle; } - + protected Point getStackedLocation(Shell shell, Shell parent) { Point p= parent.getLocation(); Point size= parent.getSize(); @@ -754,7 +754,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt * contains the given point. If no monitor contains the point, returns the monitor that is * closest to the point. If this is ever made public, it should be moved into a separate * utility class. - * + * * @param toSearch point to find (display coordinates) * @param rectangle rectangle to find (display coordinates) * @return the monitor closest to the given point @@ -959,7 +959,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt private boolean fIsStatusLineVisible; /** * The last system time when auto activation performed. - * + * * @since 3.2 */ private long fLastAutoActivation= Long.MIN_VALUE; @@ -969,17 +969,17 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt * @since 3.2 */ private KeySequence fRepeatedInvocationKeySequence; - + /** * Maps handler to command identifiers. - * + * * @since 3.4 */ private Map fHandlers; - + /** * Tells whether colored labels support is enabled. - * + * * @since 3.4 */ private boolean fIsColoredLabelsSupportEnabled= false; @@ -1134,7 +1134,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt /** * This method allows subclasses to provide their own {@link AutoAssistListener}. - * + * * @return a new auto assist listener * @since 3.4 */ @@ -1155,7 +1155,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt /** * Gets the delay after which the content assistant is automatically invoked if the cursor is * behind an auto activation character. - * + * * @return the auto activation delay * @since 3.4 */ @@ -1235,7 +1235,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt /** * Returns the foreground of the context information popup. - * + * * * @return the foreground of the context information popup * @since 2.0 @@ -1402,7 +1402,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt public void uninstall() { hide(); manageAutoActivation(false); - + if (fHandlers != null) { fHandlers.clear(); fHandlers= null; @@ -1451,10 +1451,10 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt void layout(int type, int visibleOffset) { fLayoutManager.layout(type, visibleOffset); } - + /** * Returns the layout manager. - * + * * @return the layout manager * @since 3.3 */ @@ -1673,7 +1673,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt /** * Prepares to show content assist proposals. It returns false if auto activation has kicked in * recently. - * + * * @param isAutoActivated whether completion was triggered by auto activation * @return <code>true</code> if the caller should continue and show the proposals, * <code>false</code> otherwise. @@ -1684,7 +1684,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt int gracePeriod= Math.max(fAutoActivationDelay, 200); if (current < fLastAutoActivation + gracePeriod) return false; - + promoteKeyListener(); fireSessionBeginEvent(isAutoActivated); return true; @@ -2076,7 +2076,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt * <li>{@link ContentAssistant#STORE_SIZE_Y}</li> * </ul> * </p> - * + * * @param dialogSettings the dialog settings * @since 3.0 */ @@ -2160,10 +2160,10 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt public void enablePrefixCompletion(boolean enabled) { fIsPrefixCompletionEnabled= enabled; } - + /** * Returns the prefix completion state. - * + * * @return <code>true</code> if prefix completion is enabled, <code>false</code> otherwise * @since 3.2 */ @@ -2200,7 +2200,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt /** * Fires a session begin event to all registered {@link ICompletionListener}s. - * + * * @param isAutoActivated <code>true</code> if this session was triggered by auto activation * @since 3.2 */ @@ -2215,7 +2215,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt } } } - + /** * Fires a session restart event to all registered {@link ICompletionListener}s. * @@ -2369,17 +2369,17 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt /** * Returns the repeated invocation key sequence. - * + * * @return the repeated invocation key sequence or <code>null</code>, if none * @since 3.2 */ KeySequence getRepeatedInvocationKeySequence() { return fRepeatedInvocationKeySequence; } - + /** * Returns whether proposal popup is active. - * + * * @return <code>true</code> if the proposal popup is active, <code>false</code> otherwise * @since 3.4 */ @@ -2389,7 +2389,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt /** * Returns whether the context information popup is active. - * + * * @return <code>true</code> if the context information popup is active, <code>false</code> otherwise * @since 3.4 */ @@ -2399,7 +2399,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt /** * {@inheritDoc} - * + * * @since 3.4 */ public final IHandler getHandler(String commandId) { @@ -2409,14 +2409,14 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt IHandler handler= (IHandler)fHandlers.get(commandId); if (handler != null) return handler; - + Assert.isLegal(false); return null; } /** * Registers the given handler under the given command identifier. - * + * * @param commandId the command identifier * @param handler the handler * @since 3.4 @@ -2429,7 +2429,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt /** * Tells whether the support for colored labels is enabled. - * + * * @return <code>true</code> if the support for colored labels is enabled, <code>false</code> otherwise * @since 3.4 */ @@ -2441,7 +2441,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt * Enables the support for colored labels in the proposal popup. * <p>Completion proposals can implement {@link ICompletionProposalExtension6} * to provide colored proposal labels.</p> - * + * * @param isEnabled if <code>true</code> the support for colored labels is enabled in the proposal popup * @since 3.4 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformationPopup.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformationPopup.java index e01820034c1..d3354ecc319 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformationPopup.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformationPopup.java @@ -441,7 +441,7 @@ class ContextInformationPopup implements IContentAssistListener { if (bounds.width < size.x) // we don't fit on the screen - try again and wrap size= fContextInfoText.computeSize(bounds.width - PAD, SWT.DEFAULT, true); - + size.x += TEXT_PAD; fContextInfoText.setSize(size); fContextInfoText.setLocation(1,1); @@ -544,7 +544,7 @@ class ContextInformationPopup implements IContentAssistListener { /** * Returns the minimal required height for the popup, may return 0 if the popup has not been * created yet. - * + * * @return the minimal height * @since 3.3 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java index 82615134961..1dda37e2bc0 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java @@ -29,27 +29,27 @@ package org.eclipse.jface.text.contentassist; * <p> * Clients may implement this interface. * </p> - * + * * @since 3.2 */ public interface ICompletionListener { /** * Called when code assist is invoked when there is no current code assist session. - * + * * @param event the content assist event */ void assistSessionStarted(ContentAssistEvent event); /** * Called when a code assist session ends (for example, the proposal popup is closed). - * + * * @param event the content assist event */ void assistSessionEnded(ContentAssistEvent event); /** * Called when the selection in the proposal popup is changed or if the insert-mode changed. - * + * * @param proposal the newly selected proposal, possibly <code>null</code> * @param smartToggle <code>true</code> if the insert-mode toggle is being pressed, * <code>false</code> otherwise diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListenerExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListenerExtension.java index 587714cd103..60473b1d3f2 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListenerExtension.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListenerExtension.java @@ -16,13 +16,13 @@ package org.eclipse.jface.text.contentassist; * <p> * Clients may implement this interface. * </p> - * + * * @since 3.4 */ public interface ICompletionListenerExtension { /** * Called when code assist is invoked when there is already a current code assist session. - * + * * @param event the content assist event */ void assistSessionRestarted(ContentAssistEvent event); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposal.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposal.java index 66ff95d720c..b12f981241f 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposal.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposal.java @@ -106,7 +106,7 @@ public interface ICompletionProposal { * If {@link ICompletionProposalExtension5} is implemented, this method should not be called any * longer. This method may be deprecated in a future release. * </p> - * + * * @return the additional information or <code>null</code> */ String getAdditionalProposalInfo(); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension4.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension4.java index 77634d78311..94a50a56a81 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension4.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension4.java @@ -17,7 +17,7 @@ package org.eclipse.jface.text.contentassist; * <ul> * <li>specify whether a proposal is automatically insertable</li> * </ul> - * + * * @since 3.1 */ public interface ICompletionProposalExtension4 { @@ -30,7 +30,7 @@ public interface ICompletionProposalExtension4 { * a list of proposals, but simply insert the single proposal. A * proposal may veto this behavior by returning <code>false</code> * to a call to this method. - * + * * @return <code>true</code> if the proposal may be inserted * automatically, <code>false</code> if not */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension5.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension5.java index 3182415d0a7..6ec7cb4505b 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension5.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension5.java @@ -18,7 +18,7 @@ import org.eclipse.core.runtime.IProgressMonitor; * <ul> * <li>Allow background computation of the additional info.</li> * </ul> - * + * * @since 3.2 */ public interface ICompletionProposalExtension5 { @@ -33,7 +33,7 @@ public interface ICompletionProposalExtension5 { * {@link ICompletionProposalExtension3#getInformationControlCreator()} is implemented, the * information will be passed to a custom information control for display. * </p> - * + * * @param monitor a monitor to report progress and to watch for * {@link IProgressMonitor#isCanceled() cancelation}. * @return the additional information, <code>null</code> for no information diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension6.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension6.java index 5434dbcea55..a98bb719da9 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension6.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension6.java @@ -19,11 +19,11 @@ import org.eclipse.jface.viewers.StyledString; * <ul> * <li>Allow styled ranges in the display string.</li> * </ul> - * + * * @since 3.4 */ public interface ICompletionProposalExtension6 { - + /** * Returns the styled string used to display this proposal in the list of completion proposals. * This can for example be used to draw mixed colored labels. @@ -32,7 +32,7 @@ public interface ICompletionProposalExtension6 { * correctly implemented as this method might be ignored in case of uninstalled owner draw * support. * </p> - * + * * @return the string builder used to display this proposal */ StyledString getStyledDisplayString(); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension2.java index 923f1fced6b..dfa5d247733 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension2.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension2.java @@ -19,21 +19,21 @@ package org.eclipse.jface.text.contentassist; * <li>a local status line for the completion popup</li> * <li>control over the behavior when no proposals are available</li> * </ul> - * + * * @since 3.2 */ public interface IContentAssistantExtension2 { /** * Adds a completion listener that will be informed before proposals are computed. - * + * * @param listener the listener */ public void addCompletionListener(ICompletionListener listener); /** * Removes a completion listener. - * + * * @param listener the listener to remove */ public void removeCompletionListener(ICompletionListener listener); @@ -41,7 +41,7 @@ public interface IContentAssistantExtension2 { /** * Enables repeated invocation mode, which will trigger re-computation of the proposals when * code assist is executed repeatedly. The default is no <code>false</code>. - * + * * @param cycling <code>true</code> to enable repetition mode, <code>false</code> to disable */ public void setRepeatedInvocationMode(boolean cycling); @@ -49,7 +49,7 @@ public interface IContentAssistantExtension2 { /** * Enables displaying an empty completion proposal pop-up. The default is not to show an empty * list. - * + * * @param showEmpty <code>true</code> to show empty lists */ public void setShowEmptyList(boolean showEmpty); @@ -57,14 +57,14 @@ public interface IContentAssistantExtension2 { /** * Enables displaying a status line below the proposal popup. The default is not to show the * status line. The contents of the status line may be set via {@link #setStatusMessage(String)}. - * + * * @param show <code>true</code> to show a message line, <code>false</code> to not show one. */ public void setStatusLineVisible(boolean show); /** * Sets the caption message displayed at the bottom of the completion proposal popup. - * + * * @param message the message */ public void setStatusMessage(String message); @@ -72,7 +72,7 @@ public interface IContentAssistantExtension2 { /** * Sets the text to be shown if no proposals are available and * {@link #setShowEmptyList(boolean) empty lists} are displayed. - * + * * @param message the text for the empty list */ public void setEmptyMessage(String message); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension3.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension3.java index 22cef8bd879..90a850f90f8 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension3.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension3.java @@ -26,7 +26,7 @@ public interface IContentAssistantExtension3 { /** * Sets the key sequence to listen for in repeated invocation mode. If the key sequence is * encountered, a step in the repetition iteration is triggered. - * + * * @param sequence the key sequence used for the repeated invocation mode or <code>null</code> if none */ public void setRepeatedInvocationTrigger(KeySequence sequence); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension4.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension4.java index 07c8e0817d6..ad310fec8f0 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension4.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension4.java @@ -19,7 +19,7 @@ import org.eclipse.core.commands.IHandler; * <ul> * <li>allows to get a handler for the given command identifier</li> * </ul> - * + * * @since 3.4 */ public interface IContentAssistantExtension4 { @@ -30,7 +30,7 @@ public interface IContentAssistantExtension4 { * The same handler instance will be returned when called a more than once * with the same command identifier. * </p> - * + * * @param commandId the command identifier * @return the handler for the given command identifier * @throws IllegalArgumentException if the command is not supported by this diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformation.java index 88652234fba..6b85ce24402 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformation.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformation.java @@ -32,7 +32,7 @@ import org.eclipse.swt.graphics.Image; * {@link org.eclipse.jface.text.contentassist.ContextInformation} as * the standard implementer of this interface. * </p> - * + * * @see IContentAssistProcessor */ public interface IContextInformation { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationExtension.java index 417529b9910..d5a36479994 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationExtension.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationExtension.java @@ -22,7 +22,7 @@ public interface IContextInformationExtension { /** * Returns the start offset of the range for which this context * information is valid or <code>-1</code> if unknown. - * + * * @return the start offset of the range for which this context * information is valid */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/PopupCloser.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/PopupCloser.java index 5c3abab0a01..821e257029b 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/PopupCloser.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/PopupCloser.java @@ -75,7 +75,7 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen public void install(ContentAssistant contentAssistant, Table table) { install(contentAssistant, table, null); } - + /** * Installs this closer on the given table opened by the given content assistant. * @@ -88,22 +88,22 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen fContentAssistant= contentAssistant; fTable= table; fAdditionalInfoController= additionalInfoController; - + if (Helper.okToUse(fTable)) { fShell= fTable.getShell(); fDisplay= fShell.getDisplay(); - + fShell.addShellListener(this); fTable.addFocusListener(this); fScrollbar= fTable.getVerticalBar(); if (fScrollbar != null) fScrollbar.addSelectionListener(this); - + fDisplay.addFilter(SWT.Activate, this); fDisplay.addFilter(SWT.MouseWheel, this); - + fDisplay.addFilter(SWT.Deactivate, this); - + fDisplay.addFilter(SWT.MouseUp, this); } } @@ -123,9 +123,9 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen if (fDisplay != null && ! fDisplay.isDisposed()) { fDisplay.removeFilter(SWT.Activate, this); fDisplay.removeFilter(SWT.MouseWheel, this); - + fDisplay.removeFilter(SWT.Deactivate, this); - + fDisplay.removeFilter(SWT.MouseUp, this); } } @@ -205,7 +205,7 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen return; if (event.widget == fShell || event.widget == fTable || event.widget == fScrollbar) return; - + if (fAdditionalInfoController.getInternalAccessor().getInformationControlReplacer() == null) fAdditionalInfoController.hideInformationControl(); else if (!fAdditionalInfoController.getInternalAccessor().isReplaceInProgress()) { @@ -223,7 +223,7 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen } } break; - + case SWT.MouseUp: if (fAdditionalInfoController == null || fAdditionalInfoController.getInternalAccessor().isReplaceInProgress()) break; @@ -244,7 +244,7 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen } }); } - + // XXX: workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=212392 : control.getShell().getDisplay().asyncExec(new Runnable() { public void run() { @@ -255,7 +255,7 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen } } break; - + case SWT.Deactivate: if (fAdditionalInfoController == null) break; diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IContentFormatterExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IContentFormatterExtension.java index 6199c3e1852..51ddb6cd037 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IContentFormatterExtension.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IContentFormatterExtension.java @@ -62,7 +62,7 @@ public interface IContentFormatterExtension { * formatting strategies. For each partition contained in the range to be formatted, the content * formatter determines its content type and formats the partition with the correct formatting * strategy.</li> - * + * * @param document the document to be formatted * @param context the formatting context to pass to the formatting strategies. This argument * must not be <code>null</code>. diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingContext.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingContext.java index 2b35dce5b7e..fa92119d1c7 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingContext.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingContext.java @@ -18,7 +18,7 @@ import org.eclipse.jface.preference.IPreferenceStore; /** * Formatting context used in formatting strategies implementing interface * <code>IFormattingStrategyExtension</code>. - * + * * @see IFormattingStrategyExtension * @since 3.0 */ @@ -33,14 +33,14 @@ public interface IFormattingContext { /** * Returns the preference keys used for the retrieval of formatting preferences. - * + * * @return The preference keys for formatting */ String[] getPreferenceKeys(); /** * Retrieves the property <code>key</code> from the formatting context - * + * * @param key the key of the property to store in the context * @return the property <code>key</code> if available, <code>null</code> otherwise */ @@ -48,7 +48,7 @@ public interface IFormattingContext { /** * Is this preference key for a boolean preference? - * + * * @param key the preference key to query its type * @return <code>true</code> iff this key is for a boolean preference, <code>false</code> * otherwise. @@ -57,7 +57,7 @@ public interface IFormattingContext { /** * Is this preference key for a double preference? - * + * * @param key the preference key to query its type * @return <code>true</code> iff this key is for a double preference, <code>false</code> * otherwise. @@ -66,7 +66,7 @@ public interface IFormattingContext { /** * Is this preference key for a float preference? - * + * * @param key The preference key to query its type * @return <code>true</code> iff this key is for a float preference, <code>false</code> * otherwise. @@ -75,7 +75,7 @@ public interface IFormattingContext { /** * Is this preference key for an integer preference? - * + * * @param key The preference key to query its type * @return <code>true</code> iff this key is for an integer preference, <code>false</code> * otherwise. @@ -84,7 +84,7 @@ public interface IFormattingContext { /** * Is this preference key for a long preference? - * + * * @param key The preference key to query its type * @return <code>true</code> iff this key is for a long preference, <code>false</code> * otherwise. @@ -93,7 +93,7 @@ public interface IFormattingContext { /** * Is this preference key for a string preference? - * + * * @param key The preference key to query its type * @return <code>true</code> iff this key is for a string preference, <code>false</code> * otherwise. @@ -106,7 +106,7 @@ public interface IFormattingContext { * Note that the preference keys returned by {@link #getPreferenceKeys()} must not be used in * the preference store. Otherwise the preferences are overwritten. * </p> - * + * * @param map Map to retrieve the preferences from * @param store Preference store to store the preferences in */ @@ -114,7 +114,7 @@ public interface IFormattingContext { /** * Stores the property <code>key</code> in the formatting context. - * + * * @param key Key of the property to store in the context * @param property Property to store in the context. If already present, the new property * overwrites the present one. @@ -127,7 +127,7 @@ public interface IFormattingContext { * Note that the preference keys returned by {@link #getPreferenceKeys()} must not be used in * the map. Otherwise the preferences are overwritten. * </p> - * + * * @param store Preference store to retrieve the preferences from * @param map Map to store the preferences in * @param useDefault <code>true</code> if the default preferences should be used, diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategyExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategyExtension.java index 06f97a5dbbf..3f8136252f1 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategyExtension.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategyExtension.java @@ -45,7 +45,7 @@ public interface IFormattingStrategyExtension { /** * Informs the strategy about the start of a formatting process in which it will participate. - * + * * @param context the formatting context used in the corresponding formatting process. */ void formatterStarts(IFormattingContext context); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/AbstractHyperlinkDetector.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/AbstractHyperlinkDetector.java index 6b0e46fec05..ef4392b1ec1 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/AbstractHyperlinkDetector.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/AbstractHyperlinkDetector.java @@ -21,7 +21,7 @@ import org.eclipse.core.runtime.IAdaptable; * <p> * Clients may subclass. * </p> - * + * * @since 3.3 */ public abstract class AbstractHyperlinkDetector implements IHyperlinkDetector, IHyperlinkDetectorExtension { @@ -34,7 +34,7 @@ public abstract class AbstractHyperlinkDetector implements IHyperlinkDetector, I /** * Sets this hyperlink detector's context which * is responsible to provide the adapters. - * + * * @param context the context for this hyperlink detector * @throws IllegalArgumentException if the context is <code>null</code> * @throws IllegalStateException if this method is called more than once @@ -58,7 +58,7 @@ public abstract class AbstractHyperlinkDetector implements IHyperlinkDetector, I * and provides additional context for this hyperlink detector. * * @param adapterClass the adapter class to look up - * @return an instance that can be cast to the given class, + * @return an instance that can be cast to the given class, * or <code>null</code> if this object does not * have an adapter for the given class */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/DefaultHyperlinkPresenter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/DefaultHyperlinkPresenter.java index b56f31ba950..820a5678419 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/DefaultHyperlinkPresenter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/DefaultHyperlinkPresenter.java @@ -48,7 +48,7 @@ import org.eclipse.jface.text.TextPresentation; * It can only be used together with the {@link HyperlinkManager#FIRST} * or the {@link HyperlinkManager#LONGEST_REGION_FIRST} hyperlink strategy. * </p> - * + * * @since 3.1 */ public class DefaultHyperlinkPresenter implements IHyperlinkPresenter, IHyperlinkPresenterExtension, ITextPresentationListener, ITextInputListener, IDocumentListener, IPropertyChangeListener { @@ -133,7 +133,7 @@ public class DefaultHyperlinkPresenter implements IHyperlinkPresenter, IHyperlin /** * {@inheritDoc} - * + * * @since 3.4 */ public boolean canHideHyperlinks() { @@ -302,7 +302,7 @@ public class DefaultHyperlinkPresenter implements IHyperlinkPresenter, IHyperlin fActiveRegion= new Region(event.getOffset(), event.getLength()); } fRememberedPosition= null; - + StyledText widget= fTextViewer.getTextWidget(); if (widget != null && !widget.isDisposed()) { widget.getDisplay().asyncExec(new Runnable() { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkManager.java index 69cc889de8d..7daac7b77e0 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkManager.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkManager.java @@ -164,7 +164,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M text.addMouseTrackListener(this); fTextViewer.addTextListener(this); - + fHyperlinkPresenter.install(fTextViewer); } @@ -218,7 +218,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M text.removeMouseTrackListener(this); } fTextViewer.removeTextListener(this); - + fHyperlinkPresenter.uninstall(); fHyperlinkPresenter= null; @@ -236,7 +236,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M /** * Finds hyperlinks at the current offset. - * + * * @return the hyperlinks or <code>null</code> if none. */ protected IHyperlink[] findHyperlinks() { @@ -252,7 +252,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M IHyperlinkDetector detector= fHyperlinkDetectors[i]; if (detector == null) continue; - + if (detector instanceof IHyperlinkDetectorExtension2) { int stateMask= ((IHyperlinkDetectorExtension2)detector).getStateMask(); if (stateMask != -1 && stateMask != fActiveHyperlinkStateMask) @@ -299,7 +299,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M /** * Computes the length of the longest detected hyperlink. - * + * * @param hyperlinks the list of hyperlinks * @return the length of the longest detected */ @@ -318,7 +318,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M /** * Returns the current text offset. - * + * * @return the current text offset */ protected int getCurrentTextOffset() { @@ -336,7 +336,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M Point p= text.getLocationAtOffset(widgetOffset); if (p.x > relativePosition.x) widgetOffset--; - + if (fTextViewer instanceof ITextViewerExtension5) { ITextViewerExtension5 extension= (ITextViewerExtension5)fTextViewer; return extension.widgetOffset2ModelOffset(widgetOffset); @@ -440,14 +440,14 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M if (!((IHyperlinkPresenterExtension)fHyperlinkPresenter).canHideHyperlinks()) return; } - + if (!isRegisteredStateMask(event.stateMask)) { if (fActive) deactivate(); - + return; } - + fActive= true; fActiveHyperlinkStateMask= event.stateMask; @@ -474,7 +474,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M /** * Checks whether the given state mask is registered. - * + * * @param stateMask the state mask * @return <code>true</code> if a detector is registered for the given state mask * @since 3.3 @@ -482,7 +482,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M private boolean isRegisteredStateMask(int stateMask) { if (stateMask == fHyperlinkStateMask) return true; - + synchronized (fHyperlinkDetectors) { for (int i= 0; i < fHyperlinkDetectors.length; i++) { if (fHyperlinkDetectors[i] instanceof IHyperlinkDetectorExtension2) { @@ -493,7 +493,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M } return false; } - + /* * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent) */ @@ -514,7 +514,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M //key up deactivate(); } - + /* * @see org.eclipse.jface.text.ITextListener#textChanged(TextEvent) * @since 3.2 @@ -526,7 +526,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M /** * {@inheritDoc} - * + * * @since 3.4 */ public void mouseExit(MouseEvent e) { @@ -539,7 +539,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M /** * {@inheritDoc} - * + * * @since 3.4 */ public void mouseEnter(MouseEvent e) { @@ -547,7 +547,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M /** * {@inheritDoc} - * + * * @since 3.4 */ public void mouseHover(MouseEvent e) { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkMessages.java index 137ee8d6982..f957f410dd6 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkMessages.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkMessages.java @@ -16,20 +16,20 @@ import java.util.ResourceBundle; /** * Helper class to get NLSed messages. - * + * * @since 3.4 */ class HyperlinkMessages { private static final String BUNDLE_NAME= HyperlinkMessages.class.getName(); - + private static final ResourceBundle RESOURCE_BUNDLE= ResourceBundle.getBundle(BUNDLE_NAME); - + private HyperlinkMessages() { } /** * Gets a string from the resource bundle. - * + * * @param key the string used to get the bundle value, must not be * <code>null</code> * @return the string from the resource bundle diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension.java index 8c995db0df8..e4b408eacfd 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension.java @@ -17,7 +17,7 @@ package org.eclipse.jface.text.hyperlink; * <p> * Clients may implement this interface. * </p> - * + * * @since 3.3 */ public interface IHyperlinkDetectorExtension { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension2.java index 55bbab80d0b..1a7816cc4b0 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension2.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension2.java @@ -18,7 +18,7 @@ package org.eclipse.jface.text.hyperlink; * <p> * Clients may implement this interface. * </p> - * + * * @since 3.3 */ public interface IHyperlinkDetectorExtension2 { @@ -26,7 +26,7 @@ public interface IHyperlinkDetectorExtension2 { /** * Returns the state mask of the modifier keys that * need to be pressed for this hyperlink detector. - * + * * @return the state mask */ int getStateMask(); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkPresenterExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkPresenterExtension.java index cad1dd4c955..a655107846e 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkPresenterExtension.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkPresenterExtension.java @@ -18,7 +18,7 @@ package org.eclipse.jface.text.hyperlink; * <p> * Clients may implement this interface. * </p> - * + * * @since 3.4 */ public interface IHyperlinkPresenterExtension { @@ -26,7 +26,7 @@ public interface IHyperlinkPresenterExtension { /** * Tells whether the currently shown hyperlinks * can be hidden. - * + * * @return <code>true</code> if the hyperlink manager can hide the current hyperlinks */ boolean canHideHyperlinks(); 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 53d1d62839e..742c15322af 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 @@ -64,40 +64,40 @@ import org.eclipse.jface.text.Region; /** * A hyperlink presenter capable of showing multiple hyperlinks in a hover. - * + * * @since 3.4 */ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { - + private static final boolean IS_WIN32= "win32".equals(SWT.getPlatform()); //$NON-NLS-1$ - + /** * An information control capable of showing a list of hyperlinks. The hyperlinks can be opened. */ private static class LinkListInformationControl extends AbstractInformationControl implements IInformationControlExtension2 { - + private static final class LinkContentProvider implements IStructuredContentProvider { - + /* * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) */ public Object[] getElements(Object inputElement) { return (Object[]) inputElement; } - + /* * @see org.eclipse.jface.viewers.IContentProvider#dispose() */ public void dispose() { } - + /* * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } } - + private static final class LinkLabelProvider extends ColumnLabelProvider { /* * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object) @@ -110,17 +110,17 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { return HyperlinkMessages.getString("LinkListInformationControl.unknownLink"); //$NON-NLS-1$ } } - + private final MultipleHyperlinkHoverManager fManager; - + private IHyperlink[] fInput; private Composite fParent; private Table fTable; private Color fForegroundColor; private Color fBackgroundColor; - - + + /** * Creates a link list information control with the given shell as parent. * @@ -136,14 +136,14 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { fBackgroundColor= backgroundColor; create(); } - + /* * @see org.eclipse.jface.text.IInformationControl#setInformation(java.lang.String) */ public void setInformation(String information) { //replaced by IInformationControlExtension2#setInput(java.lang.Object) } - + /* * @see org.eclipse.jface.text.IInformationControlExtension2#setInput(java.lang.Object) */ @@ -151,7 +151,7 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { fInput= (IHyperlink[]) input; deferredCreateContent(fParent); } - + /* * @see org.eclipse.jface.text.AbstractInformationControl#createContent(org.eclipse.swt.widgets.Composite) */ @@ -166,40 +166,40 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { fParent.setForeground(fForegroundColor); fParent.setBackground(fBackgroundColor); } - + /* * @see org.eclipse.jface.text.AbstractInformationControl#computeSizeHint() */ public Point computeSizeHint() { Point preferedSize= getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true); - + Point constraints= getSizeConstraints(); if (constraints == null) return preferedSize; - + if (fTable.getVerticalBar() == null || fTable.getHorizontalBar() == null) return Geometry.min(constraints, preferedSize); - + int scrollBarWidth= fTable.getVerticalBar().getSize().x; int scrollBarHeight= fTable.getHorizontalBar().getSize().y; - + int width; if (preferedSize.y - scrollBarHeight <= constraints.y) { width= preferedSize.x - scrollBarWidth; } else { width= Math.min(preferedSize.x, constraints.x); } - + int height; if (preferedSize.x - scrollBarWidth <= constraints.x) { height= preferedSize.y - scrollBarHeight; } else { height= Math.min(preferedSize.y, constraints.y); } - + return new Point(width, height); } - + private void deferredCreateContent(Composite parent) { fTable= new Table(parent, SWT.SINGLE | SWT.FULL_SELECTION); fTable.setLinesVisible(false); @@ -217,11 +217,11 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { viewer.setLabelProvider(new LinkLabelProvider()); viewer.setInput(fInput); fTable.setSelection(0); - + registerTableListeners(); - + getShell().addShellListener(new ShellAdapter() { - + /* * @see org.eclipse.swt.events.ShellAdapter#shellActivated(org.eclipse.swt.events.ShellEvent) */ @@ -229,17 +229,17 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { if (viewer.getTable().getSelectionCount() == 0) { viewer.getTable().setSelection(0); } - + viewer.getTable().setFocus(); } }); } - + private void registerTableListeners() { - + fTable.addMouseMoveListener(new MouseMoveListener() { TableItem fLastItem= null; - + public void mouseMove(MouseEvent e) { if (fTable.equals(e.getSource())) { Object o= fTable.getItem(new Point(e.x, e.y)); @@ -267,21 +267,21 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { } } }); - + fTable.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { openSelectedLink(); } }); - + fTable.addMouseListener(new MouseAdapter() { public void mouseUp(MouseEvent e) { if (fTable.getSelectionCount() < 1) return; - + if (e.button != 1) return; - + if (fTable.equals(e.getSource())) { Object o= fTable.getItem(new Point(e.x, e.y)); TableItem selection= fTable.getSelection()[0]; @@ -290,7 +290,7 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { } } }); - + fTable.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.keyCode == 0x0D) // return @@ -298,7 +298,7 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { } }); } - + /* * @see org.eclipse.jface.text.IInformationControlExtension#hasContents() */ @@ -316,7 +316,7 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { link.open(); } } - + private class MultipleHyperlinkHover implements ITextHover, ITextHoverExtension, ITextHoverExtension2 { /** @@ -334,14 +334,14 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { public IRegion getHoverRegion(ITextViewer textViewer, int offset) { return fSubjectRegion; } - + /* * @see org.eclipse.jface.text.ITextHoverExtension2#getHoverInfo2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion) */ public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) { return fHyperlinks; } - + /* * @see org.eclipse.jface.text.ITextHoverExtension#getHoverControlCreator() */ @@ -355,36 +355,36 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { }; } } - + private static class MultipleHyperlinkHoverManager extends AbstractInformationControlManager implements IWidgetTokenKeeper, IWidgetTokenKeeperExtension { - + private class Closer implements IInformationControlCloser, Listener, KeyListener { - + private Control fSubjectControl; private Display fDisplay; private IInformationControl fControl; private Rectangle fSubjectArea; - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager.IInformationControlCloser#setInformationControl(org.eclipse.jface.text.IInformationControl) */ public void setInformationControl(IInformationControl control) { fControl= control; } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager.IInformationControlCloser#setSubjectControl(org.eclipse.swt.widgets.Control) */ public void setSubjectControl(Control subject) { fSubjectControl= subject; } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager.IInformationControlCloser#start(org.eclipse.swt.graphics.Rectangle) */ public void start(Rectangle subjectArea) { fSubjectArea= subjectArea; - + fDisplay= fSubjectControl.getDisplay(); if (!fDisplay.isDisposed()) { fDisplay.addFilter(SWT.FocusOut, this); @@ -392,7 +392,7 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { fTextViewer.getTextWidget().addKeyListener(this); } } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager.IInformationControlCloser#stop() */ @@ -402,10 +402,10 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { fDisplay.removeFilter(SWT.MouseMove, this); fTextViewer.getTextWidget().removeKeyListener(this); } - + fSubjectArea= null; } - + /* * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) */ @@ -420,41 +420,41 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { break; } } - + /** * Handle mouse movement events. - * + * * @param event the event */ private void handleMouseMove(Event event) { if (!(event.widget instanceof Control)) return; - + if (fControl.isFocusControl()) return; - + Control eventControl= (Control) event.widget; - + //transform coordinates to subject control: Point mouseLoc= event.display.map(eventControl, fSubjectControl, event.x, event.y); - + if (fSubjectArea.contains(mouseLoc)) return; - + if (inKeepUpZone(mouseLoc.x, mouseLoc.y, ((IInformationControlExtension3) fControl).getBounds())) return; - + hideInformationControl(); } - + /** * Tests whether a given mouse location is within the keep-up zone. * The hover should not be hidden as long as the mouse stays inside this zone. - * + * * @param x the x coordinate, relative to the <em>subject control</em> * @param y the y coordinate, relative to the <em>subject control</em> * @param controlBounds the bounds of the current control - * + * * @return <code>true</code> iff the mouse event occurred in the keep-up zone */ private boolean inKeepUpZone(int x, int y, Rectangle controlBounds) { @@ -467,23 +467,23 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { // +--------------------+ if (fSubjectArea.contains(x, y)) return true; - + Rectangle iControlBounds= fSubjectControl.getDisplay().map(null, fSubjectControl, controlBounds); Rectangle totalBounds= Geometry.copy(iControlBounds); if (totalBounds.contains(x, y)) return true; - + int keepUpY= fSubjectArea.y + fSubjectArea.height; Rectangle alsoKeepUp= new Rectangle(fSubjectArea.x, keepUpY, fSubjectArea.width, totalBounds.y - keepUpY); return alsoKeepUp.contains(x, y); } - + /* * @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent) */ public void keyPressed(KeyEvent e) { } - + /* * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent) */ @@ -492,41 +492,41 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { } } - + /** * Priority of the hover managed by this manager. * Default value: One higher then for the hovers * managed by TextViewerHoverManager. */ private static final int WIDGET_TOKEN_PRIORITY= 1; - + private final MultipleHyperlinkHover fHover; private final ITextViewer fTextViewer; private final MultipleHyperlinkPresenter fHyperlinkPresenter; private Closer fCloser; private boolean fIsControlVisible; - + /** * Create a new MultipleHyperlinkHoverManager. The MHHM can show and hide * the given MultipleHyperlinkHover inside the given ITextViewer. - * + * * @param hover the hover to manage * @param viewer the viewer to show the hover in * @param hyperlinkPresenter the hyperlink presenter using this manager to present hyperlinks */ public MultipleHyperlinkHoverManager(MultipleHyperlinkHover hover, ITextViewer viewer, MultipleHyperlinkPresenter hyperlinkPresenter) { super(hover.getHoverControlCreator()); - + fHover= hover; fTextViewer= viewer; fHyperlinkPresenter= hyperlinkPresenter; - + fCloser= new Closer(); setCloser(fCloser); fIsControlVisible= false; } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager#computeInformation() */ @@ -536,32 +536,32 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { setInformation(null, null); return; } - + Rectangle area= JFaceTextUtil.computeArea(region, fTextViewer); if (area == null || area.isEmpty()) { setInformation(null, null); return; } - + Object information= fHover.getHoverInfo2(fTextViewer, region); setCustomInformationControlCreator(fHover.getHoverControlCreator()); setInformation(information, area); } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager#computeInformationControlLocation(org.eclipse.swt.graphics.Rectangle, org.eclipse.swt.graphics.Point) */ protected Point computeInformationControlLocation(Rectangle subjectArea, Point controlSize) { Point result= super.computeInformationControlLocation(subjectArea, controlSize); - + Point cursorLocation= fTextViewer.getTextWidget().getDisplay().getCursorLocation(); if (cursorLocation.x <= result.x + controlSize.x) return result; - + result.x= cursorLocation.x + 20 - controlSize.x; return result; } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager#showInformationControl(org.eclipse.swt.graphics.Rectangle) */ @@ -575,38 +575,38 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { } else { super.showInformationControl(subjectArea); } - + fIsControlVisible= true; } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager#hideInformationControl() */ protected void hideInformationControl() { super.hideInformationControl(); - + if (fTextViewer instanceof IWidgetTokenOwner) { ((IWidgetTokenOwner) fTextViewer).releaseWidgetToken(this); } - + fIsControlVisible= false; fHyperlinkPresenter.hideHyperlinks(); } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager#disposeInformationControl() */ public void disposeInformationControl() { super.disposeInformationControl(); - + if (fTextViewer instanceof IWidgetTokenOwner) { ((IWidgetTokenOwner) fTextViewer).releaseWidgetToken(this); } - + fIsControlVisible= false; fHyperlinkPresenter.hideHyperlinks(); } - + /* * @see org.eclipse.jface.text.IWidgetTokenKeeper#requestWidgetToken(org.eclipse.jface.text.IWidgetTokenOwner) */ @@ -614,42 +614,42 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { hideInformationControl(); return true; } - + /* * @see org.eclipse.jface.text.IWidgetTokenKeeperExtension#requestWidgetToken(org.eclipse.jface.text.IWidgetTokenOwner, int) */ public boolean requestWidgetToken(IWidgetTokenOwner owner, int priority) { if (priority < WIDGET_TOKEN_PRIORITY) return false; - + hideInformationControl(); return true; } - + /* * @see org.eclipse.jface.text.IWidgetTokenKeeperExtension#setFocus(org.eclipse.jface.text.IWidgetTokenOwner) */ public boolean setFocus(IWidgetTokenOwner owner) { return false; } - + /** * Returns <code>true</code> if the information control managed by * this manager is visible, <code>false</code> otherwise. - * + * * @return <code>true</code> if information control is visible */ public boolean isInformationControlVisible() { return fIsControlVisible; } } - + private ITextViewer fTextViewer; - + private IHyperlink[] fHyperlinks; private Region fSubjectRegion; private MultipleHyperlinkHoverManager fManager; - + /** * Creates a new multiple hyperlink presenter which uses * {@link #HYPERLINK_COLOR} to read the color from the given preference store. @@ -659,7 +659,7 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { public MultipleHyperlinkPresenter(IPreferenceStore store) { super(store); } - + /** * Creates a new multiple hyperlink presenter. * @@ -668,55 +668,55 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { public MultipleHyperlinkPresenter(RGB color) { super(color); } - + /* * @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#install(org.eclipse.jface.text.ITextViewer) */ public void install(ITextViewer viewer) { super.install(viewer); fTextViewer= viewer; - + fManager= new MultipleHyperlinkHoverManager(new MultipleHyperlinkHover(), fTextViewer, this); fManager.install(viewer.getTextWidget()); fManager.setSizeConstraints(100, 12, false, true); } - + /* * @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#uninstall() */ public void uninstall() { super.uninstall(); - + if (fTextViewer != null) { fManager.dispose(); - + fTextViewer= null; } } - + /* * @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#canShowMultipleHyperlinks() */ public boolean canShowMultipleHyperlinks() { return true; } - + /* * @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#canHideHyperlinks() */ public boolean canHideHyperlinks() { return !fManager.isInformationControlVisible(); } - + /* * @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#hideHyperlinks() */ public void hideHyperlinks() { super.hideHyperlinks(); - + fHyperlinks= null; } - + /* * @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#showHyperlinks(org.eclipse.jface.text.hyperlink.IHyperlink[]) */ @@ -725,23 +725,23 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter { fSubjectRegion= null; fHyperlinks= hyperlinks; - + if (hyperlinks.length == 1) return; - + int start= hyperlinks[0].getHyperlinkRegion().getOffset(); int end= start + hyperlinks[0].getHyperlinkRegion().getLength(); - + for (int i= 1; i < hyperlinks.length; i++) { int hstart= hyperlinks[i].getHyperlinkRegion().getOffset(); int hend= hstart + hyperlinks[i].getHyperlinkRegion().getLength(); - + start= Math.min(start, hstart); end= Math.max(end, hend); } - + fSubjectRegion= new Region(start, end - start); - + fManager.showInformation(); } } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlink.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlink.java index 063e8e11384..8b032893fb2 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlink.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlink.java @@ -31,7 +31,7 @@ public class URLHyperlink implements IHyperlink { /** * Creates a new URL hyperlink. - * + * * @param region the region * @param urlString the URL string */ @@ -76,7 +76,7 @@ public class URLHyperlink implements IHyperlink { /** * Returns the URL string of this hyperlink. - * + * * @return the URL string * @since 3.2 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java index ce6a231304a..17da07900e5 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java @@ -37,7 +37,7 @@ public class URLHyperlinkDetector extends AbstractHyperlinkDetector { */ public URLHyperlinkDetector() { } - + /** * Creates a new URL hyperlink detector. * @@ -76,7 +76,7 @@ public class URLHyperlinkDetector extends AbstractHyperlinkDetector { boolean startDoubleQuote= false; int urlOffsetInLine= 0; int urlLength= 0; - + int urlSeparatorOffset= line.indexOf("://"); //$NON-NLS-1$ while (urlSeparatorOffset >= 0) { @@ -100,10 +100,10 @@ public class URLHyperlinkDetector extends AbstractHyperlinkDetector { urlLength= tokenizer.nextToken().length() + 3 + urlSeparatorOffset - urlOffsetInLine; if (offsetInLine >= urlOffsetInLine && offsetInLine <= urlOffsetInLine + urlLength) break; - + urlSeparatorOffset= line.indexOf("://", urlSeparatorOffset + 1); //$NON-NLS-1$ } - + if (urlSeparatorOffset < 0) return null; diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationPresenterExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationPresenterExtension.java index 43765bb6ddd..a78229ade78 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationPresenterExtension.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationPresenterExtension.java @@ -15,7 +15,7 @@ package org.eclipse.jface.text.information; * the ability to handle documents with multiple partitions. * * @see org.eclipse.jface.text.information.IInformationPresenter - * + * * @since 3.0 */ public interface IInformationPresenterExtension { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/InformationPresenter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/information/InformationPresenter.java index 09ad827f4e4..2030138ddff 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/InformationPresenter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/information/InformationPresenter.java @@ -13,8 +13,6 @@ package org.eclipse.jface.text.information; import java.util.HashMap; import java.util.Map; -import org.eclipse.core.runtime.Assert; - import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.ControlListener; @@ -29,6 +27,8 @@ import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; +import org.eclipse.core.runtime.Assert; + import org.eclipse.jface.text.AbstractInformationControlManager; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocumentExtension3; @@ -344,7 +344,7 @@ public class InformationPresenter extends AbstractInformationControlManager impl // backward compatibility code info= provider.getInformation(fTextViewer, subject); } - + if (provider instanceof IInformationProviderExtension2) setCustomInformationControlCreator(((IInformationProviderExtension2) provider).getInformationPresenterControlCreator()); else @@ -369,7 +369,7 @@ public class InformationPresenter extends AbstractInformationControlManager impl start= widgetRegion.getOffset(); end= widgetRegion.getOffset() + widgetRegion.getLength(); } - + StyledText styledText= fTextViewer.getTextWidget(); Rectangle bounds; if (end > 0 && start < end) @@ -378,7 +378,7 @@ public class InformationPresenter extends AbstractInformationControlManager impl Point loc= styledText.getLocationAtOffset(start); bounds= new Rectangle(loc.x, loc.y, 0, styledText.getLineHeight(start)); } - + return bounds; } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedModeUI.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedModeUI.java index 42897d7943e..64533a67572 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedModeUI.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedModeUI.java @@ -624,8 +624,8 @@ public class LinkedModeUI { } }; - - + + /** Whether this UI is in simple highlighting mode or not. */ private boolean fSimple; @@ -985,7 +985,7 @@ public class LinkedModeUI { final StyledText widget= fCurrentTarget.fWidget; if (widget == null || widget.isDisposed()) return; - + // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=132263 widget.getDisplay().asyncExec(new Runnable() { public void run() { @@ -1048,7 +1048,7 @@ public class LinkedModeUI { /** * Returns all possible content types of <code>document</code>. - * + * * @param document the document * @return all possible content types of <code>document</code> * @throws BadPartitioningException if partitioning is invalid for this document @@ -1067,7 +1067,7 @@ public class LinkedModeUI { } return document.getLegalContentTypes(); } - + private void createAnnotationModel() { if (fCurrentTarget.fAnnotationModel == null) { LinkedPositionAnnotations lpa= new LinkedPositionAnnotations(); @@ -1286,7 +1286,7 @@ public class LinkedModeUI { * Enables the support for colored labels in the proposal popup. * <p>Completion proposals can implement {@link ICompletionProposalExtension6} * to provide colored proposal labels.</p> - * + * * @param isEnabled if <code>true</code> the support for colored labels is enabled in the proposal popup * @since 3.4 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedPositionAnnotations.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedPositionAnnotations.java index 6a6d9d8de2f..32609cd84e2 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedPositionAnnotations.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedPositionAnnotations.java @@ -161,7 +161,7 @@ final class LinkedPositionAnnotations extends AnnotationModel { * Switches the focus position to <code>position</code> given the * <code>LinkedModeModel env</code>. The slave positions for <code>position</code> is extracted * from the environment and set accordingly, the target positions are updated as well. - * + * * @param env the linked mode model * @param position the linked position */ @@ -235,7 +235,7 @@ final class LinkedPositionAnnotations extends AnnotationModel { /** * Sets the target positions. - * + * * @param positions an array of positions */ public void setTargets(Position[] positions) { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/link/TabStopIterator.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/link/TabStopIterator.java index 7031fe36f6e..bdf20e7a7c5 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/link/TabStopIterator.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/link/TabStopIterator.java @@ -20,7 +20,6 @@ import java.util.NoSuchElementException; import org.eclipse.core.runtime.Assert; import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.link.LinkedPosition; diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/PresentationReconciler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/PresentationReconciler.java index 3db127c051b..aa409fe65e7 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/PresentationReconciler.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/PresentationReconciler.java @@ -356,7 +356,7 @@ public class PresentationReconciler implements IPresentationReconciler, IPresent fViewer= viewer; fViewer.addTextInputListener(fInternalListener); - + IDocument document= viewer.getDocument(); if (document != null) fInternalListener.inputDocumentChanged(null, document); @@ -476,7 +476,7 @@ public class PresentationReconciler implements IPresentationReconciler, IPresent */ private IRegion getDamage(DocumentEvent e, boolean optimize) { int length= e.getText() == null ? 0 : e.getText().length(); - + if (fDamagers == null || fDamagers.isEmpty()) { length= Math.max(e.getLength(), length); length= Math.min(e.getDocument().getLength() - e.getOffset(), length); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistant.java index 041a89a3301..f566c353a4c 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistant.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistant.java @@ -86,7 +86,7 @@ import org.eclipse.jface.text.source.ISourceViewerExtension3; * @return an optional error message if no proposals can be computed */ String showPossibleQuickAssists(); - + /** * Registers a given quick assist processor for a particular content type. If there is already * a processor registered, the new processor is registered instead of the old one. @@ -95,34 +95,34 @@ import org.eclipse.jface.text.source.ISourceViewerExtension3; * an existing one */ void setQuickAssistProcessor(IQuickAssistProcessor processor); - + /** * Returns the quick assist processor to be used for the given content type. * * @return the quick assist processor or <code>null</code> if none exists */ IQuickAssistProcessor getQuickAssistProcessor(); - + /** * Tells whether this assistant has a fix for the given annotation. * <p> * <strong>Note:</strong> This test must be fast and optimistic i.e. it is OK to return * <code>true</code> even though there might be no quick fix. * </p> - * + * * @param annotation the annotation * @return <code>true</code> if the assistant has a fix for the given annotation */ boolean canFix(Annotation annotation); - + /** * Tells whether this assistant has assists for the given invocation context. - * + * * @param invocationContext the invocation context * @return <code>true</code> if the assistant has a fix for the given annotation */ boolean canAssist(IQuickAssistInvocationContext invocationContext); - + /** * Sets the proposal selector's background color. * <p> @@ -144,34 +144,34 @@ import org.eclipse.jface.text.source.ISourceViewerExtension3; * @param foreground the foreground color */ void setProposalSelectorForeground(Color foreground); - + /** * Adds a completion listener that will be informed before proposals are computed. - * + * * @param listener the listener */ void addCompletionListener(ICompletionListener listener); /** * Removes a completion listener. - * + * * @param listener the listener to remove */ void removeCompletionListener(ICompletionListener listener); - + /** * Enables displaying a status line below the proposal popup. The default is not to show the * status line. The contents of the status line may be set via {@link #setStatusMessage(String)}. - * + * * @param show <code>true</code> to show a message line, <code>false</code> to not show one. */ public void setStatusLineVisible(boolean show); /** * Sets the caption message displayed at the bottom of the completion proposal popup. - * + * * @param message the message */ public void setStatusMessage(String message); - + } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistantExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistantExtension.java index ac4acfeac7a..53cb7bd5332 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistantExtension.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistantExtension.java @@ -21,7 +21,7 @@ import org.eclipse.jface.text.contentassist.ICompletionProposalExtension6; * <li>allows to get a handler for the given command identifier</li> * <li>allows to enable support for colored labels in the proposal popup</li> * </ul> - * + * * @since 3.4 */ public interface IQuickAssistAssistantExtension { @@ -32,7 +32,7 @@ public interface IQuickAssistAssistantExtension { * The same handler instance will be returned when called a more than once * with the same command identifier. * </p> - * + * * @param commandId the command identifier * @return the handler for the given command identifier * @throws IllegalArgumentException if the command is not supported by this @@ -46,7 +46,7 @@ public interface IQuickAssistAssistantExtension { * Enables the support for colored labels in the proposal popup. * <p>Completion proposals can implement {@link ICompletionProposalExtension6} * to provide colored proposal labels.</p> - * + * * @param isEnabled if <code>true</code> the support for colored labels is enabled in the proposal popup * @since 3.4 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistInvocationContext.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistInvocationContext.java index f830d5ece20..bd7ab4f623b 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistInvocationContext.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistInvocationContext.java @@ -17,28 +17,28 @@ import org.eclipse.jface.text.source.ISourceViewer; * Context information for quick fix and quick assist processors. * <p> * This interface can be implemented by clients.</p> - * + * * @since 3.2 */ public interface IQuickAssistInvocationContext { /** * Returns the offset where quick assist was invoked. - * + * * @return the invocation offset or <code>-1</code> if unknown */ int getOffset(); /** * Returns the length of the selection at the invocation offset. - * + * * @return the length of the current selection or <code>-1</code> if none or unknown */ int getLength(); - + /** * Returns the viewer for this context. - * + * * @return the viewer or <code>null</code> if not available */ ISourceViewer getSourceViewer(); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistProcessor.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistProcessor.java index 2ed8679588d..bef2c582577 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistProcessor.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistProcessor.java @@ -22,7 +22,7 @@ import org.eclipse.jface.text.source.Annotation; * </p> * <p> * This interface can be implemented by clients.</p> - * + * * @since 3.2 */ public interface IQuickAssistProcessor { @@ -41,20 +41,20 @@ public interface IQuickAssistProcessor { * <strong>Note:</strong> This test must be fast and optimistic i.e. it is OK to return * <code>true</code> even though there might be no quick fix. * </p> - * + * * @param annotation the annotation * @return <code>true</code> if the assistant has a fix for the given annotation */ boolean canFix(Annotation annotation); - + /** * Tells whether this assistant has assists for the given invocation context. - * + * * @param invocationContext the invocation context * @return <code>true</code> if the assistant has a fix for the given annotation */ boolean canAssist(IQuickAssistInvocationContext invocationContext); - + /** * Returns a list of quick assist and quick fix proposals for the * given invocation context. @@ -63,5 +63,5 @@ public interface IQuickAssistProcessor { * @return an array of completion proposals or <code>null</code> if no proposals are available */ ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext); - + } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickFixableAnnotation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickFixableAnnotation.java index dfecd8fc484..a2ade54c122 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickFixableAnnotation.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickFixableAnnotation.java @@ -25,7 +25,7 @@ import org.eclipse.jface.text.source.Annotation; * </p> * <p> * This interface can be implemented by clients.</p> - * + * * @since 3.2 */ public interface IQuickFixableAnnotation { @@ -33,7 +33,7 @@ public interface IQuickFixableAnnotation { /** * Sets whether there are quick fixes available for * this annotation. - * + * * @param state <code>true</code> if there are quick fixes available, false otherwise */ void setQuickFixable(boolean state); @@ -45,7 +45,7 @@ public interface IQuickFixableAnnotation { * called at least once but it can also be hard-coded, e.g. always * return <code>true</code>. * </p> - * + * * @return <code>true</code> if the state has been set */ boolean isQuickFixableStateSet(); @@ -55,7 +55,7 @@ public interface IQuickFixableAnnotation { * <p> * <strong>Note:</strong> This method must only be called * if {@link #isQuickFixableStateSet()} returns <code>true</code>.</p> - * + * * @return <code>true</code> if this annotation offers quick fixes * @throws AssertionFailedException if called when {@link #isQuickFixableStateSet()} is <code>false</code> */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/QuickAssistAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/QuickAssistAssistant.java index fafcf76e677..7f81993b8cf 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/QuickAssistAssistant.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/QuickAssistAssistant.java @@ -30,12 +30,12 @@ import org.eclipse.jface.text.source.TextInvocationContext; /** * Default implementation of <code>IQuickAssistAssistant</code>. - * + * * @since 3.2 */ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssistAssistantExtension { - - + + private static final class QuickAssistAssistantImpl extends ContentAssistant { /* * @see org.eclipse.jface.text.contentassist.ContentAssistant#possibleCompletionsClosed() @@ -43,7 +43,7 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist public void possibleCompletionsClosed() { super.possibleCompletionsClosed(); } - + /* * @see org.eclipse.jface.text.contentassist.ContentAssistant#hide() * @since 3.4 @@ -53,7 +53,7 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist } } - + private static final class ContentAssistProcessor implements IContentAssistProcessor { private IQuickAssistProcessor fQuickAssistProcessor; @@ -61,7 +61,7 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist ContentAssistProcessor(IQuickAssistProcessor processor) { fQuickAssistProcessor= processor; } - + /* * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int) */ @@ -69,7 +69,7 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist // panic code - should not happen if (!(viewer instanceof ISourceViewer)) return null; - + return fQuickAssistProcessor.computeQuickAssistProposals(new TextInvocationContext((ISourceViewer)viewer, offset, -1)); } @@ -107,12 +107,12 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist public IContextInformationValidator getContextInformationValidator() { return null; } - + } - + private QuickAssistAssistantImpl fQuickAssistAssistantImpl; private IQuickAssistProcessor fQuickAssistProcessor; - + public QuickAssistAssistant() { fQuickAssistAssistantImpl= new QuickAssistAssistantImpl(); fQuickAssistAssistantImpl.enableAutoActivation(false); @@ -169,21 +169,21 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist public void setInformationControlCreator(IInformationControlCreator creator) { fQuickAssistAssistantImpl.setInformationControlCreator(creator); } - + /* * @see org.eclipse.jface.text.quickassist.IQuickAssistAssistant#uninstall() */ public void uninstall() { fQuickAssistAssistantImpl.uninstall(); } - + /* * @see org.eclipse.jface.text.quickassist.IQuickAssistAssistant#setProposalSelectorBackground(org.eclipse.swt.graphics.Color) */ public void setProposalSelectorBackground(Color background) { fQuickAssistAssistantImpl.setProposalSelectorBackground(background); } - + /* * @see org.eclipse.jface.text.quickassist.IQuickAssistAssistant#setProposalSelectorForeground(org.eclipse.swt.graphics.Color) */ @@ -218,7 +218,7 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist */ public void setStatusLineVisible(boolean show) { fQuickAssistAssistantImpl.setStatusLineVisible(show); - + } /* @@ -227,10 +227,10 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist public void setStatusMessage(String message) { fQuickAssistAssistantImpl.setStatusMessage(message); } - + /** * {@inheritDoc} - * + * * @since 3.4 */ public final IHandler getHandler(String commandId) { @@ -248,7 +248,7 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist /** * {@inheritDoc} - * + * * @since 3.4 */ public void enableColoredLabels(boolean isEnabled) { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconcileStep.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconcileStep.java index 6e74f3d4198..fd082423f95 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconcileStep.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconcileStep.java @@ -18,7 +18,6 @@ import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.reconciler.DirtyRegion; /** diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java index 8df31cc937b..bfdb539656c 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java @@ -380,7 +380,7 @@ abstract public class AbstractReconciler implements IReconciler { public void setIsIncrementalReconciler(boolean isIncremental) { fIsIncrementalReconciler= isIncremental; } - + /** * Tells the reconciler whether it is allowed to change the document * inside its reconciler thread. @@ -509,11 +509,11 @@ abstract public class AbstractReconciler implements IReconciler { if (e.getLength() == 0 && e.getText() != null) { // Insert fDirtyRegionQueue.addDirtyRegion(new DirtyRegion(e.getOffset(), e.getText().length(), DirtyRegion.INSERT, e.getText())); - + } else if (e.getText() == null || e.getText().length() == 0) { // Remove fDirtyRegionQueue.addDirtyRegion(new DirtyRegion(e.getOffset(), e.getLength(), DirtyRegion.REMOVE, null)); - + } else { // Replace (Remove + Insert) fDirtyRegionQueue.addDirtyRegion(new DirtyRegion(e.getOffset(), e.getLength(), DirtyRegion.REMOVE, null)); @@ -554,7 +554,7 @@ abstract public class AbstractReconciler implements IReconciler { if (fThread.isActive()) fProgressMonitor.setCanceled(true); - + if (fIsIncrementalReconciler) { DocumentEvent e= new DocumentEvent(fDocument, 0, fDocument.getLength(), fDocument.get()); createDirtyRegion(e); @@ -591,11 +591,11 @@ abstract public class AbstractReconciler implements IReconciler { */ protected void reconcilerReset() { } - + /** * Tells whether the code is running in this reconciler's * background thread. - * + * * @return <code>true</code> if running in this reconciler's background thread * @since 3.4 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcileStep.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcileStep.java index 681da8cc37b..c22cbcca508 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcileStep.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcileStep.java @@ -13,7 +13,6 @@ package org.eclipse.jface.text.reconciler; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.reconciler.DirtyRegion; /** diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionListener.java index 9350d002191..480800d6c3f 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionListener.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionListener.java @@ -11,7 +11,7 @@ package org.eclipse.jface.text.revisions; -/** +/** * A listener which is notified when revision information changes. * * @see RevisionInformation @@ -23,7 +23,7 @@ public interface IRevisionListener { * Notifies the receiver that the revision information has been updated. This typically occurs * when revision information is being displayed in an editor and the annotated document is * modified. - * + * * @param e the revision event describing the change */ void revisionInformationChanged(RevisionEvent e); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumn.java index be09f12631b..e06088cc96b 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumn.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumn.java @@ -25,7 +25,7 @@ import org.eclipse.jface.text.source.IVerticalRulerInfoExtension; * version 3.3 allowing to register a selection listener on revisions and a configurable rendering mode. * </li> * </ul> - * + * * @since 3.2 * @see RevisionInformation * @see IRevisionRulerColumnExtension @@ -33,7 +33,7 @@ import org.eclipse.jface.text.source.IVerticalRulerInfoExtension; public interface IRevisionRulerColumn extends IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension { /** * Sets the revision information. - * + * * @param info the new revision information, or <code>null</code> to reset the ruler */ void setRevisionInformation(RevisionInformation info); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumnExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumnExtension.java index 23322a5be21..23c969b1beb 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumnExtension.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumnExtension.java @@ -21,12 +21,12 @@ import org.eclipse.jface.viewers.ISelectionProvider; * Introduces the ability to register a selection listener on revisions and configurable rendering * modes. * </p> - * + * * @see IRevisionRulerColumn * @since 3.3 */ public interface IRevisionRulerColumnExtension { - + /** * Rendering mode type-safe enum. */ @@ -44,7 +44,7 @@ public interface IRevisionRulerColumnExtension { return fName; } } - + /** * Rendering mode that assigns a unique color to each revision author. */ @@ -59,7 +59,7 @@ public interface IRevisionRulerColumnExtension { RenderingMode AGE= new RenderingMode("Age"); //$NON-NLS-1$ /** * Rendering mode that assigns unique colors per revision author and - * uses different color intensity depending on the age. + * uses different color intensity depending on the age. * <p> * Currently it selects lighter colors for older revisions and more intense * colors for more recent revisions. @@ -70,44 +70,44 @@ public interface IRevisionRulerColumnExtension { /** * Changes the rendering mode and triggers redrawing if needed. - * + * * @param mode the rendering mode */ void setRevisionRenderingMode(RenderingMode mode); - + /** * Enables showing the revision id. - * + * * @param show <code>true</code> to show the revision, <code>false</code> to hide it */ void showRevisionId(boolean show); - + /** * Enables showing the revision author. - * + * * @param show <code>true</code> to show the author, <code>false</code> to hide it */ void showRevisionAuthor(boolean show); - + /** * Returns the revision selection provider. - * + * * @return the revision selection provider */ ISelectionProvider getRevisionSelectionProvider(); - + /** * Adds a revision listener that will be notified when the displayed revision information * changes. - * + * * @param listener the listener to add */ void addRevisionListener(IRevisionListener listener); - + /** * Removes a previously registered revision listener; nothing happens if <code>listener</code> * was not registered with the receiver. - * + * * @param listener the listener to remove */ void removeRevisionListener(IRevisionListener listener); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/Revision.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/Revision.java index 6801d8f35ba..af0cc44dc88 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/Revision.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/Revision.java @@ -29,7 +29,7 @@ import org.eclipse.jface.text.source.ILineRange; * <p> * Clients may subclass. * </p> - * + * * @since 3.2 */ public abstract class Revision { @@ -38,7 +38,7 @@ public abstract class Revision { /** * The cached list of adjusted ranges, element type: {@link RevisionRange}. <code>null</code> * if the list must be re-computed. Unmodifiable. - * + * * @since 3.3 */ private List fRanges= null; @@ -52,7 +52,7 @@ public abstract class Revision { /** * Adds a line range to this revision. The range must be non-empty and have a legal start line * (not -1). - * + * * @param range a line range that was changed with this revision * @throws IndexOutOfBoundsException if the line range is empty or has a negative start line */ @@ -64,7 +64,7 @@ public abstract class Revision { * Returns the contained {@link RevisionRange}s adapted to the current diff state. The returned * information is only valid at the moment it is returned, and may change as the annotated * document is modified. - * + * * @return an unmodifiable view of the contained ranges (element type: {@link RevisionRange}) */ public final List getRegions() { @@ -85,7 +85,7 @@ public abstract class Revision { /** * Adjusts the revision information to the given diff information. Any previous diff information * is discarded. - * + * * @param hunks the diff hunks to adjust the revision information to * @since 3.3 */ @@ -109,7 +109,7 @@ public abstract class Revision { * must be able process the given object. If the default information control creator is used * the supported format is simple text, full HTML or an HTML fragment. * </p> - * + * * @return the hover information for this revision or <code>null</code> for no hover * @see RevisionInformation#setHoverControlCreator(IInformationControlCreator) */ @@ -121,7 +121,7 @@ public abstract class Revision { * <p> * Revisions from the same author must return the same color and revisions from different authors * must return distinct colors.</p> - * + * * @return the RGB color for this revision's author */ public abstract RGB getColor(); @@ -129,14 +129,14 @@ public abstract class Revision { /** * Returns the unique (within the document) id of this revision. This may be the version string * or a different identifier. - * + * * @return the id of this revision */ public abstract String getId(); /** * Returns the modification date of this revision. - * + * * @return the modification date of this revision */ public abstract Date getDate(); @@ -153,7 +153,7 @@ public abstract class Revision { * <p> * Subclasses should replace - the default implementation returns the empty string. * </p> - * + * * @return the author name * @since 3.3 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionEvent.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionEvent.java index 18bda6b9a42..5b55f900a64 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionEvent.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionEvent.java @@ -18,17 +18,17 @@ import org.eclipse.core.runtime.Assert; * <p> * Clients may use but not instantiate this class. * </p> - * + * * @since 3.3 * @noinstantiate This class is not intended to be instantiated by clients. */ public final class RevisionEvent { - + private final RevisionInformation fInformation; /** * Creates a new event. - * + * * @param information the revision info */ public RevisionEvent(RevisionInformation information) { @@ -38,7 +38,7 @@ public final class RevisionEvent { /** * Returns the revision information that has changed. - * + * * @return the revision information that has changed */ public RevisionInformation getRevisionInformation() { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionInformation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionInformation.java index 62f5b7873b7..07b6e76dc18 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionInformation.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionInformation.java @@ -29,7 +29,7 @@ import org.eclipse.jface.text.information.IInformationProviderExtension2; * <p> * Clients may instantiate. * </p> - * + * * @since 3.2 * @see Revision */ @@ -41,18 +41,18 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat /** * The flattened list of {@link RevisionRange}s, unmodifiable. <code>null</code> if the list * must be re-computed. - * + * * @since 3.3 */ private List fRanges= null; - + /** * The hover control creator. Can be <code>null</code>. * * @since 3.3 */ private IInformationControlCreator fHoverControlCreator; - + /** * The information presenter control creator. Can be <code>null</code>. * @@ -68,7 +68,7 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat /** * Adds a revision. - * + * * @param revision a revision */ public void addRevision(Revision revision) { @@ -78,7 +78,7 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat /** * Returns the contained revisions. - * + * * @return an unmodifiable view of the contained revisions (element type: {@link Revision}) */ public List getRevisions() { @@ -90,7 +90,7 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat * at the moment it is returned, and may change as the annotated document is modified. See * {@link IRevisionListener} for a way to be informed when the revision information changes. The * returned list is sorted by document offset. - * + * * @return an unmodifiable view of the line ranges (element type: {@link RevisionRange}) * @see IRevisionListener * @since 3.3 @@ -120,7 +120,7 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat /** * Adjusts the revision information to the given diff information. Any previous diff information is discarded. <strong>Note</strong>: This is an internal framework method and must not be called by clients. - * + * * @param hunks the diff hunks to adjust the revision information to * @since 3.3 * @noreference This method is not intended to be referenced by clients. @@ -147,14 +147,14 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat public IInformationControlCreator getInformationPresenterControlCreator() { return fInformationPresenterControlCreator; } - + /** * Sets the hover control creator. * <p> * <strong>Note:</strong> The created information control must be able to display the object * returned by the concrete implementation of {@link Revision#getHoverInfo()}. * </p> - * + * * @param creator the control creator * @since 3.3 */ @@ -164,7 +164,7 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat /** * Sets the information presenter control creator. - * + * * @param creator the control creator * @since 3.3 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionRange.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionRange.java index 65e998affe3..c2a05a24ce6 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionRange.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionRange.java @@ -17,7 +17,7 @@ import org.eclipse.jface.text.source.ILineRange; /** * An unmodifiable line range that belongs to a {@link Revision}. - * + * * @since 3.3 * @noinstantiate This class is not intended to be instantiated by clients. */ @@ -35,7 +35,7 @@ public final class RevisionRange implements ILineRange { /** * Returns the revision that this range belongs to. - * + * * @return the revision that this range belongs to */ public Revision getRevision() { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/DefaultDamagerRepairer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/DefaultDamagerRepairer.java index 4eceeab16fd..a47ea6a4835 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/DefaultDamagerRepairer.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/DefaultDamagerRepairer.java @@ -12,8 +12,8 @@ package org.eclipse.jface.text.rules; -import org.eclipse.swt.custom.StyleRange; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; import org.eclipse.core.runtime.Assert; diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IRule.java index 8277d8e024c..667de4689d4 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IRule.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IRule.java @@ -14,7 +14,7 @@ package org.eclipse.jface.text.rules; /** * Defines the interface for a rule used in the scanning of text for the purpose of document * partitioning or text styling. - * + * * @see ICharacterScanner */ public interface IRule { @@ -24,7 +24,7 @@ public interface IRule { * The token returned by this rule returns <code>true</code> when calling * <code>isUndefined</code>, if the text that the rule investigated does not match the rule's * requirements - * + * * @param scanner the character scanner to be used by this rule * @return the token computed by the rule */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java index 9858fbb9708..f7bb1a65ba4 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java @@ -264,7 +264,7 @@ public class PatternRule implements IPredicateRule { } readCount++; } - + if (fBreaksOnEOF) return true; diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedPartitionScanner.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedPartitionScanner.java index 8e8535703e3..85ccb3ca650 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedPartitionScanner.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedPartitionScanner.java @@ -30,7 +30,7 @@ public class RuleBasedPartitionScanner extends BufferedRuleBasedScanner implemen /** * Disallow setting the rules since this scanner * exclusively uses predicate rules. - * + * * @param rules the sequence of rules controlling this scanner */ public void setRules(IRule[] rules) { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedScanner.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedScanner.java index 0638d8796a1..dc2777672bf 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedScanner.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedScanner.java @@ -108,7 +108,7 @@ public class RuleBasedScanner implements ICharacterScanner, ITokenScanner { /** * Checks that the given range is valid. * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=69292 - * + * * @param offset the offset of the document range to scan * @param length the length of the document range to scan * @param documentLength the document's length diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WordRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WordRule.java index 02ca1f1be57..6e864a18796 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WordRule.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WordRule.java @@ -24,7 +24,7 @@ import org.eclipse.core.runtime.Assert; * associate a token to a word. That is, not only can the rule be used to provide tokens for exact * matches, but also for the generalized notion of a word in the context in which it is used. A word * rule uses a word detector to determine what a word is. - * + * * @see IWordDetector */ public class WordRule implements IRule { 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 f3e010565bd..9d56786d104 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 @@ -228,7 +228,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert * <p> * Clients may reimplement this method to create a canvas with their * desired style bits.</p> - * + * * @return the SWT style bits, or <code>SWT.NONE</code> if none */ protected int getCanvasStyle() { @@ -268,7 +268,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert /** * Returns the parent ruler, <code>null</code> before * {@link #createControl(CompositeRuler, Composite)} has been called. - * + * * @return the parent ruler or <code>null</code> */ protected final CompositeRuler getParentRuler() { @@ -277,7 +277,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert /** * {@inheritDoc} - * + * * @param font the font or <code>null</code> to use the default font */ public final void setFont(Font font) { @@ -290,7 +290,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert /** * Returns the current font. If a font has not been explicitly set, the widget's font is * returned. - * + * * @return the font used to render text on the ruler. */ protected final Font getFont() { @@ -303,7 +303,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert /** * Sets the text inset (padding) used to draw text in {@link #paintLine(GC, int, int, int, int)}. - * + * * @param textInset the new text inset */ protected final void setTextInset(int textInset) { @@ -316,7 +316,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert /** * Returns the text inset for text drawn by {@link #paintLine(GC, int, int, int, int)}. The * <code>DEFAULT_TEXT_INSET</code> constant specifies the default inset in pixels. - * + * * @return the text inset for text */ protected final int getTextInset() { @@ -344,7 +344,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert * Sets the default background color for this column. The default background is used as default * implementation of {@link #computeBackground(int)} and also to paint the area of the ruler * that does not correspond to any lines (when the viewport is not entirely filled with lines). - * + * * @param background the default background color, <code>null</code> to use the text widget's * background */ @@ -359,7 +359,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert /** * Returns the background color. May return <code>null</code> if the system is shutting down. - * + * * @return the background color */ protected final Color getDefaultBackground() { @@ -379,7 +379,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert /** * Sets the annotation hover. - * + * * @param hover the annotation hover, <code>null</code> for no hover */ protected final void setHover(IAnnotationHover hover) { @@ -428,7 +428,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert /** * Marks the region covered by <code>lines</code> as needing to be redrawn. - * + * * @param lines the lines to be redrawn in document coordinates */ protected final void redraw(ILineRange lines) { @@ -447,7 +447,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert /** * Paints the ruler column. - * + * * @param event the paint event */ private void paintControl(PaintEvent event) { @@ -473,7 +473,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert /** * Computes the widget lines that need repainting given the clipping region of a paint event. - * + * * @param event the paint event * @return the lines in widget coordinates that need repainting */ @@ -491,7 +491,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert * Subclasses may replace or extend. The default implementation calls * {@link #paintLine(GC, int, int, int, int)} for every visible line. * </p> - * + * * @param gc the graphics context to paint on * @param lines the lines to paint in widget coordinates */ @@ -516,7 +516,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert * the entire width using the {@link #computeBackground(int) background color}. The text is * drawn {@link #getTextInset()} pixels to the right of the left border. * </p> - * + * * @param gc the graphics context to paint on * @param modelLine the model line (based on document coordinates) * @param widgetLine the line in the text widget corresponding to <code>modelLine</code> @@ -539,7 +539,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert * <p> * Subclasses may replace or extend. * </p> - * + * * @param line the document line number * @return the text to be drawn for the given line, <code>null</code> for no text */ @@ -554,7 +554,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert * <p> * Subclasses may replace or extend. * </p> - * + * * @param line the document line number * @return the background color for drawn for the given line */ @@ -569,7 +569,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert * <p> * Subclasses may replace or extend. * </p> - * + * * @param line the document line number * @return the foreground color for drawn for the given line */ @@ -608,7 +608,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert /** * Scrolls the canvas vertically (adapted from * {@linkplain StyledText StyledText.scrollVertical()}). - * + * * @param pixels the number of pixels to scroll (negative to scroll upwards) * @return <code>true</code> if the widget was scrolled, <code>false</code> if the widget * was not scrolled diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationBarHoverManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationBarHoverManager.java index daadea9074e..24f2bd417a7 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationBarHoverManager.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationBarHoverManager.java @@ -62,7 +62,7 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa /** * The information control closer for the hover information. Closes the information control as soon as the mouse pointer leaves the subject area, a mouse button is pressed, the user presses a key, or the subject control is resized or moved. - * + * * @since 3.0 * @deprecated As of 3.4, no longer used as closer from super class is used */ @@ -126,7 +126,7 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa fSubjectControl.getShell().addShellListener(this); fSubjectControl.addControlListener(this); fSubjectControl.addKeyListener(this); - + fDisplay= fSubjectControl.getDisplay(); if (!fDisplay.isDisposed() && fHideOnMouseWheel) { fHasWheelFilter= true; @@ -152,18 +152,18 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa fSubjectControl.removeControlListener(this); fSubjectControl.removeKeyListener(this); } - + if (fDisplay != null && !fDisplay.isDisposed() && fHasWheelFilter) fDisplay.removeFilter(SWT.MouseWheel, this); fHasWheelFilter= false; - + fDisplay= null; - + } /** * Stops the information control and if <code>delayRestart</code> is set allows restart only after a certain delay. - * + * * @param delayRestart <code>true</code> if restart should be delayed * @deprecated As of 3.4, replaced by {@link #stop()}. Note that <code>delayRestart</code> was never honored. */ @@ -198,7 +198,7 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa public void mouseDoubleClick(MouseEvent event) { hideInformationControl(); } - + /* * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) * @since 3.2 @@ -300,11 +300,11 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa protected boolean fAllowMouseExit= false; /** * Whether we should hide the over on mouse wheel action. - * + * * @since 3.2 */ private boolean fHideOnMouseWheel= true; - + /** * The current annotation hover. * @since 3.2 @@ -379,7 +379,7 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa } } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager#showInformationControl(org.eclipse.swt.graphics.Rectangle) * @since 3.2 @@ -388,7 +388,7 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa super.showInformationControl(subjectArea); fCurrentHover= getHover(getHoverEvent()); } - + /* * @see org.eclipse.jface.text.AbstractInformationControlManager#hideInformationControl() * @since 3.2 @@ -469,11 +469,11 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa Rectangle size= text.getClientArea(); Rectangle trim= text.computeTrim(0, 0, 0, 0); int height= size.height - trim.height; - + int lines= JFaceTextUtil.getLineIndex(text, height) - text.getTopIndex(); - + int bottomLine= topLine + lines; - + int rangeBottomLine= getWidgetLineNumber(lineRange.getStartLine() + lineRange.getNumberOfLines() - 1); int bottomDelta= Math.max(rangeBottomLine - bottomLine, 0); @@ -744,7 +744,7 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa * <p> * <strong>Note:</strong> This method is not intended to be referenced or overridden by clients. * </p> - * + * * @return the replaceable information control accessor * @since 3.4 * @noreference This method is not intended to be referenced by clients. @@ -755,23 +755,23 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa public IInformationControl getCurrentInformationControl() { return AnnotationBarHoverManager.super.getInternalAccessor().getCurrentInformationControl(); } - + public void setInformationControlReplacer(InformationControlReplacer replacer) { AnnotationBarHoverManager.super.getInternalAccessor().setInformationControlReplacer(replacer); } - + public InformationControlReplacer getInformationControlReplacer() { return AnnotationBarHoverManager.super.getInternalAccessor().getInformationControlReplacer(); } - + public boolean canReplace(IInformationControl control) { return AnnotationBarHoverManager.super.getInternalAccessor().canReplace(control); } - + public boolean isReplaceInProgress() { return AnnotationBarHoverManager.super.getInternalAccessor().isReplaceInProgress(); } - + public void replaceInformationControl(boolean takeFocus) { AnnotationBarHoverManager.super.getInternalAccessor().replaceInformationControl(takeFocus); } @@ -779,11 +779,11 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa public void cropToClosestMonitor(Rectangle bounds) { AnnotationBarHoverManager.super.getInternalAccessor().cropToClosestMonitor(bounds); } - + public void setHoverEnrichMode(EnrichMode mode) { AnnotationBarHoverManager.super.getInternalAccessor().setHoverEnrichMode(mode); } - + public boolean getAllowMouseExit() { return fAllowMouseExit; } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationColumn.java index 17306ae2459..e456454427d 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationColumn.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationColumn.java @@ -22,7 +22,7 @@ public final class AnnotationColumn extends AnnotationRulerColumn { /** * Creates a new <code>AnnotationColumn</code> of the given width. - * + * * @param width the width of this column * @deprecated Use * {@link org.eclipse.jface.text.source.AnnotationRulerColumn#AnnotationRulerColumn(int)} diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java index c4623edf480..002480bdc08 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java @@ -87,7 +87,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo * decoration drawn in drawing mode. This can usually be accomplished by calling * {@linkplain StyledText#redrawRange(int, int, boolean) textWidget.redrawRange(offset, length, true)}.</li> * </ul> - * + * * @param annotation the annotation to be drawn * @param gc the graphics context, <code>null</code> when in clearing mode * @param textWidget the text widget to draw on @@ -100,7 +100,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo /** * Squiggles drawing strategy. - * + * * @since 3.0 * @deprecated As of 3.4, replaced by {@link AnnotationPainter.UnderlineStrategy} */ @@ -123,7 +123,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo right.x= rect.x + rect.width; int[] polyline= computePolyline(left, right, textWidget.getBaseline(offset), textWidget.getLineHeight(offset)); - + gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance gc.setLineStyle(SWT.LINE_SOLID); gc.setForeground(color); @@ -198,26 +198,26 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo // do nothing } } - - + + /** * A text style painting strategy draws the decoration for an annotation * onto the text widget by applying a {@link TextStyle} on a given * {@link StyleRange}. - * + * * @since 3.4 */ public interface ITextStyleStrategy { /** * Applies a text style on the given <code>StyleRange</code>. - * + * * @param styleRange the style range on which to apply the text style * @param annotationColor the color of the annotation */ void applyTextStyle(StyleRange styleRange, Color annotationColor); } - + /** * @since 3.4 @@ -228,14 +228,14 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo } } - + /** * Underline text style strategy. - * + * * @since 3.4 */ public static final class UnderlineStrategy implements ITextStyleStrategy { - + int fUnderlineStyle; public UnderlineStrategy(int style) { @@ -250,27 +250,27 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo } } - + /** * Box text style strategy. - * + * * @since 3.4 */ public static final class BoxStrategy implements ITextStyleStrategy { - + int fBorderStyle; public BoxStrategy(int style) { Assert.isLegal(style == SWT.BORDER_DASH || style == SWT.BORDER_DASH || style == SWT.BORDER_SOLID); fBorderStyle= style; } - + public void applyTextStyle(StyleRange styleRange, Color annotationColor) { styleRange.borderStyle= fBorderStyle; styleRange.borderColor= annotationColor; } } - + /** * Implementation of <code>IRegion</code> that can be reused @@ -292,7 +292,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo /** * This strategy is used to mark the <code>null</code> value in the chache * maps. - * + * * @since 3.4 */ private static final IDrawingStrategy NULL_STRATEGY= new NullStrategy(); @@ -303,14 +303,14 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo private static final Object SQUIGGLES= new Object(); /** * The squiggly painter strategy. - * + * * @since 3.4 */ private static final ITextStyleStrategy HIGHLIGHTING_STRATEGY= new HighlightingStrategy(); /** * The highlighting text style strategy id. - * + * * @since 3.4 */ private static final Object HIGHLIGHTING= new Object(); @@ -374,7 +374,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo private Object fHighlightedDecorationsMapLock= new Object(); /** * Maps an annotation type to its registered color. - * + * * @see #setAnnotationTypeColor(Object, Color) */ private Map fAnnotationType2Color= new HashMap(); @@ -418,7 +418,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo private boolean fInputDocumentAboutToBeChanged; /** * Maps annotation types to painting strategy identifiers. - * + * * @see #addAnnotationType(Object, Object) * @since 3.0 */ @@ -431,7 +431,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo /** * Maps painting strategy identifiers to painting strategies. - * + * * @since 3.0 */ private Map fPaintingStrategyId2PaintingStrategy= new HashMap(); @@ -441,7 +441,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo * @since 3.3 */ private ReusableRegion fReusableRegion= new ReusableRegion(); - + /** * Creates a new annotation painter for the given source viewer and with the * given annotation access. The painter is not initialized, i.e. no @@ -538,7 +538,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo int highlightAnnotationRangeStart= Integer.MAX_VALUE; int highlightAnnotationRangeEnd= -1; - + int drawRangeStart= Integer.MAX_VALUE; int drawRangeEnd= -1; @@ -571,9 +571,9 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo Decoration decoration= (Decoration)entry.getValue(); drawDecoration(decoration, null, annotation, clippingRegion, document); } - + decorationsMap.clear(); - + highlightedDecorationsMap.clear(); e= fModel.getAnnotationIterator(); @@ -602,7 +602,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo drawRangeEnd= Math.max(drawRangeEnd, position.offset + position.length); } } - + } // Update existing annotations @@ -611,7 +611,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo Annotation annotation= changedAnnotations[i]; boolean isHighlighting= false; - + Decoration decoration= (Decoration)highlightedDecorationsMap.get(annotation); if (decoration != null) { @@ -678,7 +678,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo highlightAnnotationRangeStart= Math.min(highlightAnnotationRangeStart, pp.fPosition.offset); highlightAnnotationRangeEnd= Math.max(highlightAnnotationRangeEnd, pp.fPosition.offset + pp.fPosition.length); } - + } } @@ -749,7 +749,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo adaptToDocumentLength(fCurrentHighlightAnnotationRange); adaptToDocumentLength(fTotalHighlightAnnotationRange); } - + /** * Updates the remembered decoration ranges. * @@ -760,20 +760,20 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo */ private void updateDrawRanges(int drawRangeStart, int drawRangeEnd, boolean isWorldChange) { if (drawRangeStart != Integer.MAX_VALUE) { - + int maxRangeStart= drawRangeStart; int maxRangeEnd= drawRangeEnd; - + if (fTotalDrawRange != null) { maxRangeStart= Math.min(maxRangeStart, fTotalDrawRange.offset); maxRangeEnd= Math.max(maxRangeEnd, fTotalDrawRange.offset + fTotalDrawRange.length); } - + if (fTotalDrawRange == null) fTotalDrawRange= new Position(0); if (fCurrentDrawRange == null) fCurrentDrawRange= new Position(0); - + if (isWorldChange) { fTotalDrawRange.offset= drawRangeStart; fTotalDrawRange.length= drawRangeEnd - drawRangeStart; @@ -793,7 +793,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo fCurrentDrawRange= null; } } - + adaptToDocumentLength(fCurrentDrawRange); adaptToDocumentLength(fTotalDrawRange); } @@ -840,7 +840,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo Position position= fModel.getPosition(annotation); if (position == null || position.isDeleted()) return null; - + if (decoration == null) decoration= new Decoration(); @@ -852,15 +852,15 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo } else { decoration.fLayer= IAnnotationAccessExtension.DEFAULT_LAYER; } - + decoration.fPaintingStrategy= paintingStrategy; - + return decoration; } /** * Returns the painting strategy for the given annotation. - * + * * @param type the annotation type * @return the annotation painter * @since 3.0 @@ -1136,7 +1136,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo }; fSourceViewer.addTextInputListener(fTextInputListener); } - + } /** @@ -1166,7 +1166,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo * The given id can be referenced when adding annotation types, see * {@link #addAnnotationType(Object, Object)}. * </p> - * + * * @param id the identifier under which the strategy can be referenced, not <code>null</code> * @param strategy the new strategy * @since 3.4 @@ -1263,12 +1263,12 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo fCachedAnnotationType2PaintingStrategy.clear(); fCachedAnnotationType2PaintingStrategy= null; } - + if (fAnnotationType2PaintingStrategyId != null) { fAnnotationType2PaintingStrategyId.clear(); fAnnotationType2PaintingStrategyId= null; } - + fTextWidget= null; fSourceViewer= null; fAnnotationAccess= null; @@ -1348,10 +1348,10 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo IRegion clippingRegion= computeClippingRegion(event, false); if (clippingRegion == null) return; - + int vOffset= clippingRegion.getOffset(); int vLength= clippingRegion.getLength(); - + final GC gc= event != null ? event.gc : null; // Clone decorations @@ -1368,7 +1368,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo ArrayList toBeDrawn= new ArrayList(10); for (Iterator e = decorations.iterator(); e.hasNext();) { Map.Entry entry= (Map.Entry)e.next(); - + Annotation a= (Annotation)entry.getKey(); Decoration pp = (Decoration)entry.getValue(); // prune any annotation that is not drawable or does not need drawing @@ -1390,7 +1390,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo } } } - + private void drawDecoration(Decoration pp, GC gc, Annotation annotation, IRegion clippingRegion, IDocument document) { if (clippingRegion == null) return; @@ -1428,12 +1428,12 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo } catch (BadLocationException x) { } } - + /** * Computes the model (document) region that is covered by the paint event's clipping region. If * <code>event</code> is <code>null</code>, the model range covered by the visible editor * area (viewport) is returned. - * + * * @param event the paint event or <code>null</code> to use the entire viewport * @param isClearing tells whether the clipping is need for clearing an annotation * @return the model region comprised by either the paint event's clipping region or the @@ -1442,21 +1442,21 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo */ private IRegion computeClippingRegion(PaintEvent event, boolean isClearing) { if (event == null) { - + if (!isClearing && fCurrentDrawRange != null) return new Region(fCurrentDrawRange.offset, fCurrentDrawRange.length); - + // trigger a repaint of the entire viewport int vOffset= getInclusiveTopIndexStartOffset(); if (vOffset == -1) return null; - + // http://bugs.eclipse.org/bugs/show_bug.cgi?id=17147 int vLength= getExclusiveBottomIndexEndOffset() - vOffset; - + return new Region(vOffset, vLength); } - + int widgetOffset; try { int widgetClippingStartOffset= fTextWidget.getOffsetAtLocation(new Point(0, event.y)); @@ -1470,7 +1470,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo widgetOffset= 0; } } - + int widgetEndOffset; try { int widgetClippingEndOffset= fTextWidget.getOffsetAtLocation(new Point(0, event.y + event.height)); @@ -1489,9 +1489,9 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo widgetEndOffset= fTextWidget.getCharCount(); } } - + IRegion clippingRegion= getModelRange(widgetOffset, widgetEndOffset - widgetOffset); - + return clippingRegion; } @@ -1510,7 +1510,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo /** * Returns the widget region that corresponds to the * given offset and length in the viewer's document. - * + * * @param modelOffset the model offset * @param modelLength the model length * @return the corresponding widget region @@ -1556,11 +1556,11 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo ITextViewerExtension5 extension= (ITextViewerExtension5) fSourceViewer; return extension.widgetRange2ModelRange(new Region(offset, length)); } - + IRegion region= fSourceViewer.getVisibleRegion(); return new Region(region.getOffset() + offset, length); } - + /** * Checks whether the intersection of the given text ranges * is empty or not. diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java index 94c7bf5a6fd..dd58e939d05 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java @@ -423,7 +423,7 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul IDocument d= fCachedTextViewer.getDocument(); if (d == null) return false; - + line= d.getLineInformation(lineNumber); } catch (BadLocationException ex) { return false; @@ -534,11 +534,11 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul protected int getInclusiveTopIndexStartOffset() { if (fCachedTextWidget == null || fCachedTextWidget.isDisposed()) return -1; - + IDocument document= fCachedTextViewer.getDocument(); if (document == null) return -1; - + int top= JFaceTextUtil.getPartialTopIndex(fCachedTextViewer); try { return document.getLineOffset(top); @@ -556,11 +556,11 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul private int getExclusiveBottomIndexEndOffset() { if (fCachedTextWidget == null || fCachedTextWidget.isDisposed()) return -1; - + IDocument document= fCachedTextViewer.getDocument(); if (document == null) return -1; - + int bottom= JFaceTextUtil.getPartialBottomIndex(fCachedTextViewer); try { if (bottom >= document.getNumberOfLines()) @@ -659,10 +659,10 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul r.x= 0; r.y= JFaceTextUtil.computeLineHeight(fCachedTextWidget, 0, startLine, startLine) - fScrollPos; - + r.width= dimension.x; int lines= endLine - startLine; - + r.height= JFaceTextUtil.computeLineHeight(fCachedTextWidget, startLine, endLine + 1, lines + 1); if (r.y < dimension.y && fAnnotationAccessExtension != null) // annotation within visible area @@ -758,7 +758,7 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul r.x= 0; r.y= JFaceTextUtil.computeLineHeight(fCachedTextWidget, 0, startLine, startLine) - fScrollPos; - + r.width= dimension.x; int lines= endLine - startLine; r.height= JFaceTextUtil.computeLineHeight(fCachedTextWidget, startLine, endLine + 1, lines + 1); @@ -867,7 +867,7 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul public int toDocumentLineNumber(int y_coordinate) { return fParentRuler.toDocumentLineNumber(y_coordinate); } - + /** * Removes the given annotation type from this annotation ruler column. * Annotations of the given type are no longer shown in this annotation diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ChangeRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ChangeRulerColumn.java index ad8277f0a56..d599bef0a88 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ChangeRulerColumn.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ChangeRulerColumn.java @@ -114,9 +114,9 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR } } - + /** - * The view(port) listener. + * The view(port) listener. */ private final InternalListener fInternalListener= new InternalListener(); /** @@ -149,7 +149,7 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR private IAnnotationModel fAnnotationModel; /** The width of the change ruler column. */ private final int fWidth= 5; - + /** Cache for the actual scroll position in pixels */ private int fScrollPos; /** The buffer for double buffering */ @@ -159,17 +159,17 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR /** * Creates a new ruler column. - * + * * @deprecated since 3.2 use {@link #ChangeRulerColumn(ISharedTextColors)} instead */ public ChangeRulerColumn() { fRevisionPainter= null; fDiffPainter= new DiffPainter(this, null); } - + /** * Creates a new revision ruler column. - * + * * @param sharedColors the colors to look up RGBs * @since 3.2 */ @@ -178,7 +178,7 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR fRevisionPainter= new RevisionPainter(this, sharedColors); fDiffPainter= new DiffPainter(this, null); // no shading } - + /** * Returns the System background color for list widgets. * @@ -225,7 +225,7 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR fCachedTextViewer.addViewportListener(fInternalListener); fCachedTextViewer.addTextListener(fInternalListener); } - + fRevisionPainter.setParentRuler(parentRuler); fDiffPainter.setParentRuler(parentRuler); @@ -287,7 +287,7 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR /** * Returns the view port height in lines. - * + * * @return the view port height in lines * @deprecated as of 3.2 the number of lines in the viewport cannot be computed because * StyledText supports variable line heights @@ -300,7 +300,7 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR /** * Returns <code>true</code> if the viewport displays the entire viewer contents, i.e. the * viewer is not vertically scrollable. - * + * * @return <code>true</code> if the viewport displays the entire contents, <code>false</code> otherwise * @since 3.2 */ @@ -485,10 +485,10 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR public void removeVerticalRulerListener(IVerticalRulerListener listener) { throw new UnsupportedOperationException(); } - + /** * Computes the document based line range visible in the text widget. - * + * * @return the document based line range visible in the text widget * @since 3.2 */ @@ -496,35 +496,35 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR IDocument doc= fCachedTextViewer.getDocument(); if (doc == null) return null; - + int topLine; IRegion coverage; - + if (fCachedTextViewer instanceof ITextViewerExtension5) { ITextViewerExtension5 extension= (ITextViewerExtension5) fCachedTextViewer; - + // ITextViewer.getTopIndex returns the fully visible line, but we want the partially // visible one int widgetTopLine= JFaceTextUtil.getPartialTopIndex(fCachedTextWidget); topLine= extension.widgetLine2ModelLine(widgetTopLine); - + coverage= extension.getModelCoverage(); - + } else { - topLine= JFaceTextUtil.getPartialTopIndex(fCachedTextViewer); + topLine= JFaceTextUtil.getPartialTopIndex(fCachedTextViewer); coverage= fCachedTextViewer.getVisibleRegion(); } - + int bottomLine= fCachedTextViewer.getBottomIndex(); if (bottomLine != -1) ++ bottomLine; - + // clip by coverage window try { int firstLine= doc.getLineOfOffset(coverage.getOffset()); if (firstLine > topLine) topLine= firstLine; - + int lastLine= doc.getLineOfOffset(coverage.getOffset() + coverage.getLength()); if (lastLine < bottomLine || bottomLine == -1) bottomLine= lastLine; @@ -532,11 +532,11 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR x.printStackTrace(); return null; } - + ILineRange visibleModelLines= new LineRange(topLine, bottomLine - topLine + 1); return visibleModelLines; } - + /* * @see org.eclipse.jface.text.revisions.IRevisionRulerColumn#setRevisionInformation(org.eclipse.jface.text.revisions.RevisionInformation) */ @@ -547,7 +547,7 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR /** * Returns the revision selection provider. - * + * * @return the revision selection provider * @since 3.2 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/CompositeRuler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/CompositeRuler.java index 59acd9ac45f..37f6b274994 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/CompositeRuler.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/CompositeRuler.java @@ -535,7 +535,7 @@ public class CompositeRuler implements IVerticalRuler, IVerticalRulerExtension, /** * Constructs a new composite ruler with the given gap between its columns. - * + * * @param gap the gap */ public CompositeRuler(int gap) { @@ -672,10 +672,10 @@ public class CompositeRuler implements IVerticalRuler, IVerticalRulerExtension, } } } - + /** * Immediately redraws the entire ruler (without asynchronous posting). - * + * * @since 3.2 */ public void immediateUpdate() { @@ -730,13 +730,13 @@ public class CompositeRuler implements IVerticalRuler, IVerticalRulerExtension, StyledText text= fTextViewer.getTextWidget(); int line= text.getLineIndex(y_coordinate); - + if (line == text.getLineCount() - 1) { // check whether y_coordinate exceeds last line if (y_coordinate > text.getLinePixel(line + 1)) return -1; } - + return widgetLine2ModelLine(fTextViewer, line); } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ContentAssistantFacade.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ContentAssistantFacade.java index b1c9dcb4356..61ce50cbd6a 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ContentAssistantFacade.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ContentAssistantFacade.java @@ -25,7 +25,7 @@ import org.eclipse.jface.text.contentassist.IContentAssistantExtension4; * <p> * The offered API access can grow over time. * </p> - * + * * @since 3.4 */ public final class ContentAssistantFacade { @@ -34,7 +34,7 @@ public final class ContentAssistantFacade { /** * Creates a new facade. - * + * * @param contentAssistant the content assistant which implements {@link IContentAssistantExtension2} and {@link IContentAssistantExtension4} */ public ContentAssistantFacade(IContentAssistant contentAssistant) { @@ -48,7 +48,7 @@ public final class ContentAssistantFacade { * The same handler instance will be returned when called a more than once * with the same command identifier. * </p> - * + * * @param commandId the command identifier * @return the handler for the given command identifier * @throws IllegalArgumentException if the command is not supported by this @@ -65,7 +65,7 @@ public final class ContentAssistantFacade { /** * Adds a completion listener that will be informed before proposals are * computed. - * + * * @param listener the listener * @throws IllegalStateException if called when the content assistant is * uninstalled @@ -78,7 +78,7 @@ public final class ContentAssistantFacade { /** * Removes a completion listener. - * + * * @param listener the listener to remove * @throws IllegalStateException if called when the content assistant is * uninstalled diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultAnnotationHover.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultAnnotationHover.java index c6be5bbfe0e..1449145454a 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultAnnotationHover.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultAnnotationHover.java @@ -23,23 +23,23 @@ import org.eclipse.jface.text.source.projection.AnnotationBag; /** * Standard implementation of {@link org.eclipse.jface.text.source.IAnnotationHover}. - * + * * @since 3.2 */ public class DefaultAnnotationHover implements IAnnotationHover { - - + + /** * Tells whether the line number should be shown when no annotation is found * under the cursor. - * + * * @since 3.4 */ private boolean fShowLineNumber; /** * Creates a new default annotation hover. - * + * * @since 3.4 */ public DefaultAnnotationHover() { @@ -48,33 +48,33 @@ public class DefaultAnnotationHover implements IAnnotationHover { /** * Creates a new default annotation hover. - * + * * @param showLineNumber <code>true</code> if the line number should be shown when no annotation is found * @since 3.4 */ public DefaultAnnotationHover(boolean showLineNumber) { fShowLineNumber= showLineNumber; } - + /* * @see org.eclipse.jface.text.source.IAnnotationHover#getHoverInfo(org.eclipse.jface.text.source.ISourceViewer, int) */ public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) { List javaAnnotations= getAnnotationsForLine(sourceViewer, lineNumber); if (javaAnnotations != null) { - + if (javaAnnotations.size() == 1) { - + // optimization Annotation annotation= (Annotation) javaAnnotations.get(0); String message= annotation.getText(); if (message != null && message.trim().length() > 0) return formatSingleMessage(message); - + } else { - + List messages= new ArrayList(); - + Iterator e= javaAnnotations.iterator(); while (e.hasNext()) { Annotation annotation= (Annotation) e.next(); @@ -82,10 +82,10 @@ public class DefaultAnnotationHover implements IAnnotationHover { if (message != null && message.trim().length() > 0) messages.add(message.trim()); } - + if (messages.size() == 1) return formatSingleMessage((String)messages.get(0)); - + if (messages.size() > 1) return formatMultipleMessages(messages); } @@ -96,46 +96,46 @@ public class DefaultAnnotationHover implements IAnnotationHover { return null; } - + /** * Tells whether the annotation should be included in * the computation. - * + * * @param annotation the annotation to test * @return <code>true</code> if the annotation is included in the computation */ protected boolean isIncluded(Annotation annotation) { return true; } - + /** * Hook method to format the given single message. * <p> * Subclasses can change this to create a different * format like HTML. * </p> - * + * * @param message the message to format * @return the formatted message */ protected String formatSingleMessage(String message) { return message; } - + /** * Hook method to formats the given messages. * <p> * Subclasses can change this to create a different * format like HTML. * </p> - * + * * @param messages the messages to format * @return the formatted message */ protected String formatMultipleMessages(List messages) { StringBuffer buffer= new StringBuffer(); buffer.append(JFaceTextMessages.getString("DefaultAnnotationHover.multipleMarkers")); //$NON-NLS-1$ - + Iterator e= messages.iterator(); while (e.hasNext()) { buffer.append('\n'); @@ -144,7 +144,7 @@ public class DefaultAnnotationHover implements IAnnotationHover { } return buffer.toString(); } - + private boolean isRulerLine(Position position, IDocument document, int line) { if (position.getOffset() > -1 && position.getLength() > -1) { try { @@ -154,7 +154,7 @@ public class DefaultAnnotationHover implements IAnnotationHover { } return false; } - + private IAnnotationModel getAnnotationModel(ISourceViewer viewer) { if (viewer instanceof ISourceViewerExtension2) { ISourceViewerExtension2 extension= (ISourceViewerExtension2) viewer; @@ -162,13 +162,13 @@ public class DefaultAnnotationHover implements IAnnotationHover { } return viewer.getAnnotationModel(); } - + private boolean isDuplicateAnnotation(Map messagesAtPosition, Position position, String message) { if (messagesAtPosition.containsKey(position)) { Object value= messagesAtPosition.get(position); if (message.equals(value)) return true; - + if (value instanceof List) { List messages= (List)value; if (messages.contains(message)) @@ -185,35 +185,35 @@ public class DefaultAnnotationHover implements IAnnotationHover { messagesAtPosition.put(position, message); return false; } - + private boolean includeAnnotation(Annotation annotation, Position position, HashMap messagesAtPosition) { if (!isIncluded(annotation)) return false; - + String text= annotation.getText(); return (text != null && !isDuplicateAnnotation(messagesAtPosition, position, text)); } - + private List getAnnotationsForLine(ISourceViewer viewer, int line) { IAnnotationModel model= getAnnotationModel(viewer); if (model == null) return null; - + IDocument document= viewer.getDocument(); List javaAnnotations= new ArrayList(); HashMap messagesAtPosition= new HashMap(); Iterator iterator= model.getAnnotationIterator(); - + while (iterator.hasNext()) { Annotation annotation= (Annotation) iterator.next(); - + Position position= model.getPosition(annotation); if (position == null) continue; - + if (!isRulerLine(position, document, line)) continue; - + if (annotation instanceof AnnotationBag) { AnnotationBag bag= (AnnotationBag) annotation; Iterator e= bag.iterator(); @@ -225,11 +225,11 @@ public class DefaultAnnotationHover implements IAnnotationHover { } continue; } - + if (includeAnnotation(annotation, position, messagesAtPosition)) javaAnnotations.add(annotation); } - + return javaAnnotations; } } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java index 4d6c2e33c8c..0afbc881cd0 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java @@ -45,7 +45,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { * char[] chars = new char[] {'(', ')', '{', '}', '[', ']'}; * new SimpleCharacterPairMatcher(chars, ...); * </pre> - * + * * @param chars a list of characters * @param partitioning the partitioning to match within */ @@ -55,7 +55,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { fPairs= new CharPairs(chars); fPartitioning= partitioning; } - + /** * Creates a new character pair matcher that matches characters * within the default partitioning. The specified list of @@ -66,13 +66,13 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { * char[] chars = new char[] {'(', ')', '{', '}', '[', ']'}; * new SimpleCharacterPairMatcher(chars); * </pre> - * + * * @param chars a list of characters */ public DefaultCharacterPairMatcher(char[] chars) { this(chars, IDocumentExtension3.DEFAULT_PARTITIONING); } - + /* @see ICharacterPairMatcher#match(IDocument, int) */ public IRegion match(IDocument doc, int offset) { if (doc == null || offset < 0 || offset > doc.getLength()) return null; @@ -82,7 +82,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { return null; } } - + /* * Performs the actual work of matching for #match(IDocument, int). */ @@ -108,7 +108,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { /** * Searches <code>doc</code> for the specified end character, <code>end</code>. - * + * * @param doc the document to search * @param start the opening matching character * @param end the end character to search for @@ -138,7 +138,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { public int getAnchor() { return fAnchor; } - + /* @see ICharacterPairMatcher#dispose() */ public void dispose() { } @@ -154,14 +154,14 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { * valid match, only considers position within its partition. */ private static class DocumentPartitionAccessor { - + private final IDocument fDocument; private final String fPartitioning, fPartition; private ITypedRegion fCachedPartition; - + /** * Creates a new partitioned document for the specified document. - * + * * @param doc the document to wrap * @param partitioning the partitioning used * @param partition the partition managed by this document @@ -175,7 +175,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { /** * Returns the character at the specified position in this document. - * + * * @param pos an offset within this document * @return the character at the offset * @throws BadLocationException if the offset is invalid in this document @@ -188,7 +188,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { * Returns true if the character at the specified position is a valid match for the * specified end character. To be a valid match, it must be in the appropriate partition and * equal to the end character. - * + * * @param pos an offset within this document * @param end the end character to match against * @return true exactly if the position represents a valid match @@ -197,11 +197,11 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { public boolean isMatch(int pos, char end) throws BadLocationException { return getChar(pos) == end && inPartition(pos); } - + /** * Returns true if the specified offset is within the partition * managed by this document. - * + * * @param pos an offset within this document * @return true if the offset is within this document's partition */ @@ -209,11 +209,11 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { final ITypedRegion partition= getPartition(pos); return partition != null && partition.getType().equals(fPartition); } - + /** * Returns the next position to query in the search. The position * is not guaranteed to be in this document's partition. - * + * * @param pos an offset within the document * @param searchForward the direction of the search * @return the next position to query @@ -234,15 +234,15 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { } return simpleIncrement(pos, searchForward); } - + private int simpleIncrement(int pos, boolean searchForward) { return pos + (searchForward ? 1 : -1); } - + /** * Returns partition information about the region containing the * specified position. - * + * * @param pos a position within this document. * @return positioning information about the region containing the * position @@ -258,12 +258,12 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { } return fCachedPartition; } - + private static boolean contains(IRegion region, int pos) { int offset= region.getOffset(); return offset <= pos && pos < offset + region.getLength(); } - + } /** @@ -280,7 +280,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { /** * Returns true if the specified character pair occurs in one * of the character pairs. - * + * * @param c a character * @return true exactly if the character occurs in one of the pairs */ @@ -320,17 +320,17 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { /** * Returns true of the specified character is a start character. - * + * * @param c a character * @return true exactly if the character is a start character */ public boolean isStartCharacter(char c) { return this.isOpeningCharacter(c, true); } - + /** * Returns the matching character for the specified character. - * + * * @param c a character occurring in a character pair * @return the matching character */ @@ -342,15 +342,15 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher { Assert.isTrue(false); return '\0'; } - + private char getStartChar(int i) { return fPairs[i]; } - + private char getEndChar(int i) { return fPairs[i + 1]; } - + } } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationAccessExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationAccessExtension2.java index 314552cb090..3d0e5bcae3e 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationAccessExtension2.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationAccessExtension2.java @@ -21,13 +21,13 @@ import org.eclipse.jface.text.quickassist.IQuickAssistAssistant; * @since 3.2 */ public interface IAnnotationAccessExtension2 { - + /** * Provides this annotation access with a quick assist assistant that * is used to decide whether the quick fix image should be shown. - * + * * @param assistant the quick assist assistant */ void setQuickAssistAssistant(IQuickAssistAssistant assistant); - + } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationHover.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationHover.java index 7a3be26eb53..808a98df3a2 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationHover.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationHover.java @@ -25,7 +25,7 @@ package org.eclipse.jface.text.source; * This allows for sophisticated hovers in a way that information computed by * the hover can be displayed in the best possible form.</li> * <li>{@link org.eclipse.jface.text.source.IAnnotationHoverExtension2} since - * version 3.2 allowing a text hover to specify whether it handles mouse-wheel + * version 3.2 allowing a text hover to specify whether it handles mouse-wheel * events itself.</li> * </ul></p> * <p> diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineDifferExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineDifferExtension2.java index ecc4721dcd1..7acc7a86e68 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineDifferExtension2.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineDifferExtension2.java @@ -21,7 +21,7 @@ package org.eclipse.jface.text.source; public interface ILineDifferExtension2 { /** * Returns <code>true</code> if the receiver is suspended, <code>false</code> otherwise. - * + * * @return <code>true</code> if the receiver is suspended, <code>false</code> otherwise */ boolean isSuspended(); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineRange.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineRange.java index f304799d4e9..1b21dfa7b0d 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineRange.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineRange.java @@ -17,7 +17,7 @@ package org.eclipse.jface.text.source; * computes the first line <em>after</em> the range, and a range with * <code>getNumberOfLines() == 0</code> is empty. * </p> - * + * * @since 3.0 */ public interface ILineRange { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.java index e3033eba751..7bc26b68c88 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.java @@ -85,7 +85,7 @@ public interface ISourceViewer extends ITextViewer { /* * XXX: Cannot continue numbering due to operation codes used in ProjectionViewer - */ + */ /** * Text operation code for requesting quick assist. This will normally diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension3.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension3.java index 1ca8b58bed7..b5349a5f848 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension3.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension3.java @@ -17,7 +17,7 @@ import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext; /** * Extension interface for {@link org.eclipse.jface.text.source.ISourceViewer}.<p> * It introduces the concept of a quick assist assistant and provides access - * to the quick assist invocation context. It also gives access to any currently + * to the quick assist invocation context. It also gives access to any currently * showing annotation hover.</p> * * @see IQuickAssistAssistant diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension4.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension4.java index 54a351a4ac2..f9933530d21 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension4.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension4.java @@ -18,7 +18,7 @@ import org.eclipse.jface.text.contentassist.IContentAssistant; * <p> * It introduces API to access a minimal set of content assistant APIs.</li> * </p> - * + * * @see IContentAssistant * @since 3.4 */ @@ -26,7 +26,7 @@ public interface ISourceViewerExtension4 { /** * Returns a facade for this viewer's content assistant. - * + * * @return a content assistant facade or <code>null</code> if none is * configured */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerInfo.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerInfo.java index 659d452a102..547912117cd 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerInfo.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerInfo.java @@ -47,7 +47,7 @@ public interface IVerticalRulerInfo { * Returns the line number of the last mouse button activity. * Based on the input document of the connected text viewer. * - * @return the line number of the last mouse button activity or <code>-1</code> if + * @return the line number of the last mouse button activity or <code>-1</code> if * the last mouse activity does not correspond to a valid document line */ int getLineOfLastMouseButtonActivity(); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/JFaceTextMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/JFaceTextMessages.java index d71ade87466..79251467dd4 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/JFaceTextMessages.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/JFaceTextMessages.java @@ -11,10 +11,11 @@ package org.eclipse.jface.text.source; -import com.ibm.icu.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; +import com.ibm.icu.text.MessageFormat; + /** * Accessor for the <code>JFaceTextMessages.properties</code> file in * package <code>org.eclipse.jface.text</code>. diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberChangeRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberChangeRulerColumn.java index 7ba3353cebd..c645db5492e 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberChangeRulerColumn.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberChangeRulerColumn.java @@ -17,15 +17,15 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.internal.text.revisions.RevisionPainter; +import org.eclipse.jface.internal.text.source.DiffPainter; +import org.eclipse.jface.viewers.ISelectionProvider; + import org.eclipse.jface.text.revisions.IRevisionListener; import org.eclipse.jface.text.revisions.IRevisionRulerColumn; import org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension; import org.eclipse.jface.text.revisions.RevisionInformation; -import org.eclipse.jface.internal.text.revisions.RevisionPainter; -import org.eclipse.jface.internal.text.source.DiffPainter; -import org.eclipse.jface.viewers.ISelectionProvider; - /** * A vertical ruler column displaying line numbers and serving as a UI for quick diff. * Clients usually instantiate and configure object of this class. @@ -39,13 +39,13 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp private boolean fCharacterDisplay; /** * The revision painter strategy. - * + * * @since 3.2 */ private final RevisionPainter fRevisionPainter; - /** + /** * The diff information painter strategy. - * + * * @since 3.2 */ private final DiffPainter fDiffPainter; @@ -65,7 +65,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp fRevisionPainter= new RevisionPainter(this, sharedColors); fDiffPainter= new DiffPainter(this, sharedColors); } - + /* * @see org.eclipse.jface.text.source.LineNumberRulerColumn#createControl(org.eclipse.jface.text.source.CompositeRuler, org.eclipse.swt.widgets.Composite) */ @@ -75,7 +75,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp fDiffPainter.setParentRuler(parentRuler); return control; } - + /* * @see org.eclipse.jface.text.source.IVerticalRulerInfo#getLineOfLastMouseButtonActivity() */ @@ -102,7 +102,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp layout(true); postRedraw(); } - + private void setAnnotationModel(IAnnotationModel model) { if (fAnnotationModel != model) fAnnotationModel= model; @@ -177,7 +177,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp public void removeVerticalRulerListener(IVerticalRulerListener listener) { throw new UnsupportedOperationException(); } - + /* * @see org.eclipse.jface.text.source.LineNumberRulerColumn#doPaint(org.eclipse.swt.graphics.GC) */ @@ -193,7 +193,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp if (fShowNumbers || fCharacterDisplay) super.doPaint(gc, visibleLines); } - + /* * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#getHover() */ @@ -243,7 +243,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp public void setDeletedColor(Color deletedColor) { fDiffPainter.setDeletedColor(deletedColor); } - + /* * @see org.eclipse.jface.text.revisions.IRevisionRulerColumn#setRevisionInformation(org.eclipse.jface.text.revisions.RevisionInformation) */ @@ -273,7 +273,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp /** * Sets the line number display mode. - * + * * @param showNumbers <code>true</code> to show numbers, <code>false</code> to only show * diff / revision info. * @since 3.3 @@ -299,7 +299,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp /** * Returns <code>true</code> if the ruler is showing line numbers, <code>false</code> * otherwise - * + * * @return <code>true</code> if line numbers are shown, <code>false</code> otherwise * @since 3.3 */ @@ -310,7 +310,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp /** * Returns <code>true</code> if the ruler is showing revision information, <code>false</code> * otherwise - * + * * @return <code>true</code> if revision information is shown, <code>false</code> otherwise * @since 3.3 */ @@ -321,7 +321,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp /** * Returns <code>true</code> if the ruler is showing change information, <code>false</code> * otherwise - * + * * @return <code>true</code> if change information is shown, <code>false</code> otherwise * @since 3.3 */ @@ -368,7 +368,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp public void removeRevisionListener(IRevisionListener listener) { fRevisionPainter.removeRevisionListener(listener); } - + /* * @see org.eclipse.jface.text.source.LineNumberRulerColumn#handleDispose() * @since 3.3 diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java index 8cb5cb7d9ba..2741c00c6fd 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java @@ -157,7 +157,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { /** * Called when line drag selection started. Adds mouse move and track * listeners to this column's control. - * + * * @param expandExistingSelection if <code>true</code> the existing selection will be expanded, * otherwise a new selection is started */ @@ -195,7 +195,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { } catch (BadLocationException x) { } } - + /** * Called when line drag selection stopped. Removes all previously * installed listeners from this column's control. @@ -216,13 +216,13 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { IDocument document= fCachedTextViewer.getDocument(); IRegion lineInfo= document.getLineInformation(lineNumber); - + Display display= fCachedTextWidget.getDisplay(); Point absolutePosition= display.getCursorLocation(); Point relativePosition= fCachedTextWidget.toControl(absolutePosition); int offset; - + if (relativePosition.x < 0) offset= lineInfo.getOffset(); else { @@ -295,7 +295,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { autoScroll(SWT.UP); return true; } - + stopAutoScroll(); return false; } @@ -699,7 +699,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { /** * Returns the view port height in lines. - * + * * @return the view port height in lines * @deprecated as of 3.2 the number of lines in the viewport cannot be computed because * StyledText supports variable line heights @@ -707,12 +707,12 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { protected int getVisibleLinesInViewport() { return getVisibleLinesInViewport(fCachedTextWidget); } - + /** * Returns <code>true</code> if the viewport displays the entire viewer contents, i.e. the * viewer is not vertically scrollable. - * + * * @return <code>true</code> if the viewport displays the entire contents, <code>false</code> otherwise * @since 3.2 */ @@ -729,10 +729,10 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { */ void doPaint(GC gc, ILineRange visibleLines) { Display display= fCachedTextWidget.getDisplay(); - + // draw diff info int y= -JFaceTextUtil.getHiddenTopLinePixels(fCachedTextWidget); - + int lastLine= end(visibleLines); for (int line= visibleLines.getStartLine(); line < lastLine; line++) { int widgetLine= JFaceTextUtil.modelLineToWidgetLine(fCachedTextViewer, line); @@ -749,7 +749,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { private static int end(ILineRange range) { return range.getStartLine() + range.getNumberOfLines(); } - + /** * Computes the string to be printed for <code>line</code>. The default implementation returns * <code>Integer.toString(line + 1)</code>. @@ -783,7 +783,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { */ int offset= fCachedTextWidget.getOffsetAtLine(widgetLine); int widgetBaseline= fCachedTextWidget.getBaseline(offset); - + FontMetrics fm= gc.getFontMetrics(); int fontBaseline= fm.getAscent() + fm.getLeading(); int baselineBias= widgetBaseline - fontBaseline; @@ -877,7 +877,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { /** * Returns the number of lines in the view port. - * + * * @param textWidget the styled text widget * @return the number of lines visible in the view port <code>-1</code> if there's no client * area @@ -897,5 +897,5 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { } return -1; } - + } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java index 39409af55a5..0306bcae9a5 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java @@ -61,7 +61,7 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener { * Creates a new MatchingCharacterPainter for the given source viewer using the given character * pair matcher. The character matcher is not adopted by this painter. Thus, it is not disposed. * However, this painter requires exclusive access to the given pair matcher. - * + * * @param sourceViewer the source viewer * @param matcher the character pair matcher */ @@ -175,7 +175,7 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener { if (gc != null) { gc.setForeground(fColor); - + Rectangle bounds; if (length > 0) bounds= fTextWidget.getTextBounds(offset, offset + length - 1); @@ -183,7 +183,7 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener { Point loc= fTextWidget.getLocationAtOffset(offset); bounds= new Rectangle(loc.x, loc.y, 1, fTextWidget.getLineHeight(offset)); } - + // draw box around line segment gc.drawRectangle(bounds.x, bounds.y, bounds.width - 1, bounds.height - 1); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java index 28bbd87965b..10c72d6df0a 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java @@ -93,12 +93,12 @@ public class OverviewRuler implements IOverviewRuler { public void modelChanged(AnnotationModelEvent event) { if (!event.isValid()) return; - + if (event.isWorldChange()) { update(); return; } - + Annotation[] annotations= event.getAddedAnnotations(); int length= annotations.length; for (int i= 0; i < length; i++) { @@ -107,7 +107,7 @@ public class OverviewRuler implements IOverviewRuler { return; } } - + annotations= event.getRemovedAnnotations(); length= annotations.length; for (int i= 0; i < length; i++) { @@ -116,7 +116,7 @@ public class OverviewRuler implements IOverviewRuler { return; } } - + annotations= event.getChangedAnnotations(); length= annotations.length; for (int i= 0; i < length; i++) { @@ -125,7 +125,7 @@ public class OverviewRuler implements IOverviewRuler { return; } } - + } } @@ -362,7 +362,7 @@ public class OverviewRuler implements IOverviewRuler { * @since 3.0 */ private List fCachedAnnotations= new ArrayList(); - + /** * Redraw runnable lock * @since 3.3 @@ -390,7 +390,7 @@ public class OverviewRuler implements IOverviewRuler { * Tells whether temporary annotations are drawn with * a separate color. This color will be computed by * discoloring the original annotation color. - * + * * @since 3.4 */ private boolean fIsTemporaryAnnotationDiscolored; @@ -414,7 +414,7 @@ public class OverviewRuler implements IOverviewRuler { /** * Constructs a overview ruler of the given width using the given annotation * access and the given color manager. - * + * * @param annotationAccess the annotation access * @param width the width of the vertical ruler * @param sharedColors the color manager @@ -577,7 +577,7 @@ public class OverviewRuler implements IOverviewRuler { gc.fillRectangle(0, 0, size.x, size.y); cacheAnnotations(); - + if (fTextViewer instanceof ITextViewerExtension5) doPaint1(gc); else @@ -608,7 +608,7 @@ public class OverviewRuler implements IOverviewRuler { Point size= fCanvas.getSize(); int writable= JFaceTextUtil.computeLineHeight(textWidget, 0, maxLines, maxLines); - + if (size.y > writable) size.y= Math.max(writable - fHeader.getSize().y, 0); @@ -622,7 +622,7 @@ public class OverviewRuler implements IOverviewRuler { for (int t=0; t < style.length; t++) { Iterator e= new FilterIterator(annotationType, style[t], fCachedAnnotations.iterator()); - + boolean areColorsComputed= false; Color fill= null; Color stroke= null; @@ -733,7 +733,7 @@ public class OverviewRuler implements IOverviewRuler { for (int t=0; t < style.length; t++) { Iterator e= new FilterIterator(annotationType, style[t], fCachedAnnotations.iterator()); - + boolean areColorsComputed= false; Color fill= null; Color stroke= null; @@ -1296,7 +1296,7 @@ public class OverviewRuler implements IOverviewRuler { private void updateHeader() { if (fHeader == null || fHeader.isDisposed()) return; - + fHeader.setToolTipText(null); Object colorType= null; @@ -1304,7 +1304,7 @@ public class OverviewRuler implements IOverviewRuler { Object annotationType= fAnnotationsSortedByLayer.get(i); if (skipInHeader(annotationType) || skip(annotationType)) continue; - + Iterator e= new FilterIterator(annotationType, FilterIterator.PERSISTENT | FilterIterator.TEMPORARY | FilterIterator.IGNORE_BAGS, fCachedAnnotations.iterator()); while (e.hasNext()) { if (e.next() != null) { @@ -1328,18 +1328,18 @@ public class OverviewRuler implements IOverviewRuler { } fHeaderPainter.setColor(color); } - + fHeader.redraw(); } - + /** * Updates the header tool tip text of this ruler. */ private void updateHeaderToolTipText() { if (fHeader == null || fHeader.isDisposed()) return; - + if (fHeader.getToolTipText() != null) return; @@ -1371,7 +1371,7 @@ public class OverviewRuler implements IOverviewRuler { overview += JFaceTextMessages.getFormattedString("OverviewRulerHeader.toolTipTextEntry", new Object[] {annotationTypeLabel, new Integer(count)}); //$NON-NLS-1$ } } - + if (overview.length() > 0) fHeader.setToolTipText(overview); } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRulerHoverManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRulerHoverManager.java index aa7df2a72d6..e10f80eb998 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRulerHoverManager.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRulerHoverManager.java @@ -53,12 +53,12 @@ class OverviewRulerHoverManager extends AnnotationBarHoverManager { Point location= getHoverEventLocation(); int line= getVerticalRulerInfo().toDocumentLineNumber(location.y); IAnnotationHover hover= getAnnotationHover(); - + IInformationControlCreator controlCreator= null; if (hover instanceof IAnnotationHoverExtension) controlCreator= ((IAnnotationHoverExtension)hover).getHoverControlCreator(); setCustomInformationControlCreator(controlCreator); - + setInformation(hover.getHoverInfo(getSourceViewer(), line), computeArea(location.y)); } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java index 5f112f770c1..dff8afecf7c 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java @@ -453,7 +453,7 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi fOverviewRulerHoveringController.getInternalAccessor().setInformationControlReplacer(new StickyHoverManager(this)); } } - + /* * @see org.eclipse.jface.text.TextViewer#setHoverEnrichMode(org.eclipse.jface.text.ITextViewerExtension8.EnrichMode) * @since 3.4 @@ -511,17 +511,17 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi /** * Disposes the visual annotation model. - * + * * @since 3.1 */ protected void disposeVisualAnnotationModel() { if (fVisualAnnotationModel != null) { if (getDocument() != null) fVisualAnnotationModel.disconnect(getDocument()); - + if ( fVisualAnnotationModel instanceof IAnnotationModelExtension) ((IAnnotationModelExtension)fVisualAnnotationModel).removeAnnotationModel(MODEL_ANNOTATION_MODEL); - + fVisualAnnotationModel= null; } } @@ -570,7 +570,7 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi /** * {@inheritDoc} - * + * * @since 3.4 */ public final ContentAssistantFacade getContentAssistantFacade() { @@ -687,7 +687,7 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi if (operation == CONTENTASSIST_CONTEXT_INFORMATION) return fContentAssistant != null && fContentAssistantInstalled && isEditable(); - + if (operation == QUICK_ASSIST) return fQuickAssistAssistant != null && fQuickAssistAssistantInstalled && isEditable(); @@ -950,10 +950,10 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi break; } case QUICK_ASSIST: { - + if (fQuickAssistAssistant == null) return; - + if (enable) { if (!fQuickAssistAssistantInstalled) { fQuickAssistAssistant.install(this); @@ -1031,14 +1031,14 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi /** * Tells whether the vertical ruler only acts as annotation ruler. - * + * * @return <code>true</code> if the vertical ruler only show annotations * @since 3.3 */ private boolean isVerticalRulerOnlyShowingAnnotations() { if (fVerticalRuler instanceof VerticalRuler) return true; - + if (fVerticalRuler instanceof CompositeRuler) { Iterator iter= ((CompositeRuler)fVerticalRuler).getDecoratorIterator(); return iter.hasNext() && iter.next() instanceof AnnotationRulerColumn && !iter.hasNext(); @@ -1074,7 +1074,7 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi } } } - + /* * @see org.eclipse.jface.text.source.ISourceViewer#getCurrentAnnotationHover() * @since 3.2 diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewerConfiguration.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewerConfiguration.java index be73aa275ce..4e87f5ec3e6 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewerConfiguration.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewerConfiguration.java @@ -220,11 +220,11 @@ public class SourceViewerConfiguration { public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) { return new String[] { "\t", " ", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } - + /** * Computes and returns the indent prefixes for tab indentation * which is represented as <code>tabSizeInSpaces</code>. - * + * * @param tabWidth the display tab width * @return the indent prefixes * @see #getIndentPrefixes(ISourceViewer, String) diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/TextInvocationContext.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/TextInvocationContext.java index 51c2121bc2b..7d9fa00e74f 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/TextInvocationContext.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/TextInvocationContext.java @@ -18,7 +18,7 @@ import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext; * <p> * Clients may extend this class to add additional context information. * </p> - * + * * @since 3.3 */ public class TextInvocationContext implements IQuickAssistInvocationContext { @@ -26,7 +26,7 @@ public class TextInvocationContext implements IQuickAssistInvocationContext { private ISourceViewer fSourceViewer; private int fOffset; private int fLength; - + public TextInvocationContext(ISourceViewer sourceViewer, int offset, int length) { fSourceViewer= sourceViewer; fOffset= offset; @@ -53,5 +53,5 @@ public class TextInvocationContext implements IQuickAssistInvocationContext { public ISourceViewer getSourceViewer() { return fSourceViewer; } - + } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VerticalRuler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VerticalRuler.java index 9c2bfc7be1a..9fef74e0446 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VerticalRuler.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VerticalRuler.java @@ -346,10 +346,10 @@ public final class VerticalRuler implements IVerticalRuler, IVerticalRulerExtens r.x= 0; r.y= JFaceTextUtil.computeLineHeight(styledText, 0, startLine, startLine) - fScrollPos; - + r.width= d.x; int lines= endLine - startLine; - + r.height= JFaceTextUtil.computeLineHeight(styledText, startLine, endLine + 1, (lines+1)); if (r.y < d.y && annotationAccessExtension != null) // annotation within visible area @@ -424,10 +424,10 @@ public final class VerticalRuler implements IVerticalRuler, IVerticalRulerExtens r.x= 0; r.y= JFaceTextUtil.computeLineHeight(textWidget, 0, startLine, startLine) - fScrollPos; - + r.width= dimension.x; int lines= endLine - startLine; - + r.height= JFaceTextUtil.computeLineHeight(textWidget, startLine, endLine + 1, lines+1); if (r.y < dimension.y && annotationAccessExtension != null) // annotation within visible area @@ -520,13 +520,13 @@ public final class VerticalRuler implements IVerticalRuler, IVerticalRulerExtens StyledText text= fTextViewer.getTextWidget(); int line= text.getLineIndex(y_coordinate); - + if (line == text.getLineCount() - 1) { // check whether y_coordinate exceeds last line if (y_coordinate > text.getLinePixel(line + 1)) return -1; } - + return widgetLine2ModelLine(fTextViewer, line); } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/JFaceTextTemplateMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/JFaceTextTemplateMessages.java index 9367244333b..8c96ec23f75 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/JFaceTextTemplateMessages.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/JFaceTextTemplateMessages.java @@ -10,10 +10,11 @@ *******************************************************************************/ package org.eclipse.jface.text.templates; -import com.ibm.icu.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; +import com.ibm.icu.text.MessageFormat; + /** * @since 3.0 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/PositionBasedCompletionProposal.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/PositionBasedCompletionProposal.java index b95f1b2bb58..f969eae1cac 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/PositionBasedCompletionProposal.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/PositionBasedCompletionProposal.java @@ -29,7 +29,7 @@ import org.eclipse.jface.text.contentassist.IContextInformation; /** * A position based completion proposal. - * + * * @since 3.0 */ final class PositionBasedCompletionProposal implements ICompletionProposal, ICompletionProposalExtension2 { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/TemplateProposal.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/TemplateProposal.java index 04878dde6cd..d5b9651a52d 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/TemplateProposal.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/TemplateProposal.java @@ -10,8 +10,14 @@ *******************************************************************************/ package org.eclipse.jface.text.templates; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Shell; + import org.eclipse.core.runtime.Assert; + import org.eclipse.jface.dialogs.MessageDialog; + import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.BadPositionCategoryException; import org.eclipse.jface.text.DocumentEvent; @@ -32,9 +38,6 @@ import org.eclipse.jface.text.link.LinkedModeUI; import org.eclipse.jface.text.link.LinkedPosition; import org.eclipse.jface.text.link.LinkedPositionGroup; import org.eclipse.jface.text.link.ProposalPosition; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Shell; /** @@ -191,7 +194,7 @@ public class TemplateProposal implements ICompletionProposal, ICompletionProposa document.addPosition(getCategory(), pos); proposals[j]= new PositionBasedCompletionProposal(values[j], pos, length); } - + if (proposals.length > 1) first= new ProposalPosition(document, offsets[0] + start, length, proposals); else diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceMessages.java index b756bad3b54..a830e173f6f 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceMessages.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceMessages.java @@ -10,10 +10,11 @@ *******************************************************************************/ package org.eclipse.jface.text.templates.persistence; -import com.ibm.icu.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; +import com.ibm.icu.text.MessageFormat; + /** * @since 3.0 */ diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateReaderWriter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateReaderWriter.java index 1ce8a33c48d..f73a5f29793 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateReaderWriter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateReaderWriter.java @@ -32,6 +32,9 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; @@ -41,9 +44,6 @@ import org.w3c.dom.Text; import org.eclipse.core.runtime.Assert; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - import org.eclipse.jface.text.templates.Template; /** 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 10bceecb54c..c4fb28d3c47 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 @@ -54,13 +54,13 @@ public class TemplateStore { /** * Set to <code>true</code> if property change events should be ignored (e.g. during writing * to the preference store). - * + * * @since 3.2 */ private boolean fIgnorePreferenceStoreChanges= false; /** * The property listener, if any is registered, <code>null</code> otherwise. - * + * * @since 3.2 */ private IPropertyChangeListener fPropertyListener; @@ -108,13 +108,13 @@ public class TemplateStore { loadContributedTemplates(); loadCustomTemplates(); } - + /** * Starts listening for property changes on the preference store. If the configured preference * key changes, the template store is {@link #load() reloaded}. Call * {@link #stopListeningForPreferenceChanges()} to remove any listener and stop the * auto-updating behavior. - * + * * @since 3.2 */ public final void startListeningForPreferenceChanges() { @@ -136,13 +136,13 @@ public class TemplateStore { }; fPreferenceStore.addPropertyChangeListener(fPropertyListener); } - + } - + /** * Stops the auto-updating behavior started by calling * {@link #startListeningForPreferenceChanges()}. - * + * * @since 3.2 */ public final void stopListeningForPreferenceChanges() { @@ -151,11 +151,11 @@ public class TemplateStore { fPropertyListener= null; } } - + /** * Handles an {@link IOException} thrown during reloading the preferences due to a preference * store update. The default is to write to stderr. - * + * * @param x the exception * @since 3.2 */ @@ -276,7 +276,7 @@ public class TemplateStore { /** * Deletes all user-added templates and reverts all contributed templates. - * + * * @param doSave <code>true</code> if the store should be saved after restoring * @since 3.5 */ @@ -298,7 +298,7 @@ public class TemplateStore { // can't log from jface-text x.printStackTrace(); } - + if (oldValue != null) { try { fIgnorePreferenceStoreChanges= true; |