Simplify the BrowserInformationControl.
While investigating AERI report in BrowserInformationControl a lot of
unused code was found. Just drop it to make further investigations
easier.
Small cleanups like useless see tags and generifications applied too.
Change-Id: I5c3e1986c864307384861b804fe77e3543d96a1d
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/BrowserInformationControl.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/BrowserInformationControl.java
index 51d471e..01e4de7 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/BrowserInformationControl.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/BrowserInformationControl.java
@@ -239,10 +239,6 @@
fSymbolicFontName, true);
}
- /*
- * @see org.eclipse.jface.text.AbstractInformationControl#createContent(org.
- * eclipse .swt.widgets.Composite)
- */
@Override
protected void createContent(Composite parent) {
fBrowser = new Browser(parent, SWT.NONE);
@@ -360,9 +356,6 @@
listener.inputChanged(fInput);
}
- /*
- * @see IInformationControl#setVisible(boolean)
- */
@Override
public void setVisible(boolean visible) {
Shell shell = getShell();
@@ -477,9 +470,9 @@
fTextLayout.setText(text);
fTextLayout.setWidth(sizeConstraints == null ? SWT.DEFAULT
: sizeConstraints.x - trim.width);
- Iterator iter = presentation.getAllStyleRangeIterator();
+ Iterator<StyleRange> iter = presentation.getAllStyleRangeIterator();
while (iter.hasNext()) {
- StyleRange sr = (StyleRange) iter.next();
+ StyleRange sr = iter.next();
if (sr.fontStyle == SWT.BOLD)
fTextLayout.setStyle(fBoldStyle, sr.start,
sr.start + sr.length - 1);
@@ -621,11 +614,6 @@
fDelayedInputChangeListener.inputChanged(newInput);
}
- /*
- * @see java.lang.Object#toString()
- *
- * @since 3.4
- */
@Override
public String toString() {
String style = (getShell().getStyle() & SWT.RESIZE) == 0 ? "fixed" //$NON-NLS-1$
@@ -640,10 +628,6 @@
return fInput;
}
- /*
- * @see org.eclipse.jface.text.IInformationControlExtension5#
- * computeSizeConstraints (int, int)
- */
@Override
public Point computeSizeConstraints(int widthInChars, int heightInChars) {
if (fSymbolicFontName == null)
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/BrowserInformationControl2.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/BrowserInformationControl2.java
deleted file mode 100644
index 428489d..0000000
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/BrowserInformationControl2.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.dltk.internal.ui;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.IInformationControlExtension4;
-import org.eclipse.jface.text.IInformationControlExtension5;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-/*
- * TODO (alex) to be removed
- */
-public class BrowserInformationControl2 extends BrowserInformationControl
- implements IInformationControlExtension4, IInformationControlExtension5 {
- public BrowserInformationControl2(Shell parent, int shellStyle, int style,
- String statusFieldText) {
- super(parent, JFaceResources.DIALOG_FONT, statusFieldText);
- }
-
- @Override
- public Point computeSizeConstraints(int widthInChars, int heightInChars) {
- return null;
- }
-
- @Override
- public boolean containsControl(Control control) {
- do {
- if (control == getShell())
- return true;
- if (control instanceof Shell)
- return false;
- control = control.getParent();
- } while (control != null);
- return false;
- }
-
- @Override
- public IInformationControlCreator getInformationPresenterControlCreator() {
- return null;
- }
-
- @Override
- public boolean isVisible() {
- return getShell() != null && !getShell().isDisposed()
- && getShell().isVisible();
- }
-}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/CompletionHoverControlCreator.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/CompletionHoverControlCreator.java
deleted file mode 100644
index 267a3db..0000000
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/CompletionHoverControlCreator.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package org.eclipse.dltk.internal.ui.text.hover;
-
-import org.eclipse.dltk.internal.ui.BrowserInformationControl;
-import org.eclipse.dltk.internal.ui.BrowserInformationControl2;
-import org.eclipse.dltk.ui.DLTKUIPlugin;
-import org.eclipse.jface.text.AbstractReusableInformationControlCreator;
-import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.IInformationControlExtension4;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.editors.text.EditorsUI;
-
-/**
- * Hover control creator.
- *
- * TODO (alex) to be removed
- *
- * @since 2.0
- */
-public final class CompletionHoverControlCreator extends
- AbstractReusableInformationControlCreator {
- /**
- * The information presenter control creator.
- */
- private final IInformationControlCreator fInformationPresenterControlCreator;
- /**
- * <code>true</code> to use the additional info affordance,
- * <code>false</code> to use the hover affordance.
- */
- private final boolean fAdditionalInfoAffordance;
-
- /**
- * @param informationPresenterControlCreator
- * control creator for enriched hover
- */
- public CompletionHoverControlCreator(
- IInformationControlCreator informationPresenterControlCreator) {
- this(informationPresenterControlCreator, false);
- }
-
- /**
- * @param informationPresenterControlCreator
- * control creator for enriched hover
- * @param additionalInfoAffordance
- * <code>true</code> to use the additional info affordance,
- * <code>false</code> to use the hover affordance
- */
- public CompletionHoverControlCreator(
- IInformationControlCreator informationPresenterControlCreator,
- boolean additionalInfoAffordance) {
- fInformationPresenterControlCreator = informationPresenterControlCreator;
- fAdditionalInfoAffordance = additionalInfoAffordance;
- }
-
- /*
- * @seeorg.eclipse.jdt.internal.ui.text.java.hover.
- * AbstractReusableInformationControlCreator
- * #doCreateInformationControl(org.eclipse.swt.widgets.Shell)
- */
- @Override
- public IInformationControl doCreateInformationControl(Shell parent) {
- String tooltipAffordanceString = fAdditionalInfoAffordance ? DLTKUIPlugin
- .getAdditionalInfoAffordanceString()
- : EditorsUI.getTooltipAffordanceString();
- if (BrowserInformationControl.isAvailable(parent)) {
- BrowserInformationControl2 iControl = new BrowserInformationControl2(
- parent, SWT.TOOL | SWT.NO_TRIM, SWT.NONE,
- tooltipAffordanceString) {
- @Override
- public IInformationControlCreator getInformationPresenterControlCreator() {
- return fInformationPresenterControlCreator;
- }
- };
- return iControl;
- } else {
- return new DefaultInformationControl(parent,
- tooltipAffordanceString);
- }
- }
-
- /*
- * @seeorg.eclipse.jdt.internal.ui.text.java.hover.
- * AbstractReusableInformationControlCreator
- * #canReuse(org.eclipse.jface.text.IInformationControl)
- */
- @Override
- public boolean canReuse(IInformationControl control) {
- if (!super.canReuse(control))
- return false;
-
- if (control instanceof IInformationControlExtension4) {
- String tooltipAffordanceString = fAdditionalInfoAffordance ? DLTKUIPlugin
- .getAdditionalInfoAffordanceString()
- : EditorsUI.getTooltipAffordanceString();
- ((IInformationControlExtension4) control)
- .setStatusText(tooltipAffordanceString);
- }
-
- return true;
- }
-}
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/DocumentationBrowserInformationControlInput.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/DocumentationBrowserInformationControlInput.java
index a1df81b..208e08f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/DocumentationBrowserInformationControlInput.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/DocumentationBrowserInformationControlInput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,12 +16,12 @@
/**
* Browser input for Javadoc hover.
- *
+ *
* @since 4.0
*/
@SuppressWarnings("restriction")
-public class DocumentationBrowserInformationControlInput extends
- BrowserInformationControlInput {
+public class DocumentationBrowserInformationControlInput
+ extends BrowserInformationControlInput {
private final Object fElement;
private final String fHtml;
@@ -29,7 +29,7 @@
/**
* Creates a new browser information control input.
- *
+ *
* @param previous
* previous input, or <code>null</code> if none available
* @param element
@@ -49,11 +49,6 @@
fLeadingImageWidth = leadingImageWidth;
}
- /*
- * @see BrowserInformationControlInput#getLeadingImageWidth()
- *
- * @since 4.0
- */
@Override
public int getLeadingImageWidth() {
return fLeadingImageWidth;
@@ -61,36 +56,28 @@
/**
* Returns the Java element.
- *
+ *
* @return the element or <code>null</code> if none available
*/
public Object getElement() {
return fElement;
}
- /*
- * @see org.eclipse.jface.internal.text.html.BrowserInput#getHtml()
- */
@Override
public String getHtml() {
return fHtml;
}
- /*
- * @see org.eclipse.jdt.internal.ui.infoviews.BrowserInput#getInputElement()
- */
@Override
public Object getInputElement() {
return fElement == null ? (Object) fHtml : fElement;
}
- /*
- * @see org.eclipse.jdt.internal.ui.infoviews.BrowserInput#getInputName()
- */
@Override
public String getInputName() {
- return fElement instanceof IModelElement ? ((IModelElement) fElement)
- .getElementName() : ""; //$NON-NLS-1$
+ return fElement instanceof IModelElement
+ ? ((IModelElement) fElement).getElementName()
+ : ""; //$NON-NLS-1$
}
}