Bug 534520 - Documentation dialog is light on dark theme
Change-Id: Ib22625fd97eacbb46413215f548c021f7c81be3d
Signed-off-by: Dawid Pakuła <zulus@w3des.net>
diff --git a/core/plugins/org.eclipse.dltk.ui/DocumentationHoverStyleSheet.css b/core/plugins/org.eclipse.dltk.ui/DocumentationHoverStyleSheet.css
index fafa4b9..83a11cd 100644
--- a/core/plugins/org.eclipse.dltk.ui/DocumentationHoverStyleSheet.css
+++ b/core/plugins/org.eclipse.dltk.ui/DocumentationHoverStyleSheet.css
@@ -21,8 +21,8 @@
dd { margin-top: 0px; margin-bottom: 0px; }
/* Styles and colors */
-a:link { color: #0000FF; }
-a:hover { color: #000080; }
+a:link { color: hyperlinkColor; }
+a:hover { color: activeHyperlinkColor; }
a:visited { text-decoration: underline; }
h4 { font-style: italic; }
strong { font-weight: bold; }
diff --git a/core/plugins/org.eclipse.dltk.ui/DocumentationViewStyleSheet.css b/core/plugins/org.eclipse.dltk.ui/DocumentationViewStyleSheet.css
index 57eb0f3..ead6d43 100644
--- a/core/plugins/org.eclipse.dltk.ui/DocumentationViewStyleSheet.css
+++ b/core/plugins/org.eclipse.dltk.ui/DocumentationViewStyleSheet.css
@@ -23,8 +23,8 @@
dd { margin-top: 0px; margin-bottom: 0px; }
/* Styles and colors */
-a:link { color: #0000FF; }
-a:hover { color: #000080; }
+a:link { color: hyperlinkColor; }
+a:hover { color: activeHyperlinkColor; }
a:visited { text-decoration: underline; }
h4 { font-style: italic; }
strong { font-weight: bold; }
diff --git a/core/plugins/org.eclipse.dltk.ui/build.properties b/core/plugins/org.eclipse.dltk.ui/build.properties
index b8acf4d..ace924b 100644
--- a/core/plugins/org.eclipse.dltk.ui/build.properties
+++ b/core/plugins/org.eclipse.dltk.ui/build.properties
@@ -20,4 +20,5 @@
schema/,\
DocumentationViewStyleSheet.css,\
DocumentationHoverStyleSheet.css,\
- about.html
+ about.html,\
+ css/
diff --git a/core/plugins/org.eclipse.dltk.ui/css/e4-dark.css b/core/plugins/org.eclipse.dltk.ui/css/e4-dark.css
new file mode 100644
index 0000000..f2dfe3f
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.ui/css/e4-dark.css
@@ -0,0 +1,5 @@
+IEclipsePreferences#org-eclipse-ui-workbench:org-eclipse-dltk-ui {
+ preferences:
+ 'org.eclipse.dltk.ui.documentation.backgroundColor=52,57,61'
+ 'org.eclipse.dltk.ui.documentation.foregroundColor=238,238,238'
+}
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.ui/plugin.properties b/core/plugins/org.eclipse.dltk.ui/plugin.properties
index 8674bc9..95e53fc 100644
--- a/core/plugins/org.eclipse.dltk.ui/plugin.properties
+++ b/core/plugins/org.eclipse.dltk.ui/plugin.properties
@@ -155,6 +155,11 @@
dltkDisplayFontDefiniton.label= Documentation display font
dltkDisplayFontDefiniton.description= The documentation display font is used in the documentation view, for documentation hovers and for the additional information in content assist.
+dltkDocumentationBackgroundColor.label= DLTK documentation background
+dltkDocumentationBackgroundColor.description= The color used as background for the DLTK documentation view and hover.
+dltkDocumentationForegroundColor.label= DLTK documentation text color
+dltkDocumentationForegroundColor.description= The foreground color for text in the DLTK documentation view and hover.
+
##########################################################################
# Coding Action set
##########################################################################
diff --git a/core/plugins/org.eclipse.dltk.ui/plugin.xml b/core/plugins/org.eclipse.dltk.ui/plugin.xml
index 97c03dd..b8baf85 100644
--- a/core/plugins/org.eclipse.dltk.ui/plugin.xml
+++ b/core/plugins/org.eclipse.dltk.ui/plugin.xml
@@ -1637,6 +1637,24 @@
%dltkDisplayFontDefiniton.description
</description>
</fontDefinition>
+ <colorDefinition
+ label="%dltkDocumentationBackgroundColor.label"
+ categoryId="org.eclipse.dltk.ui.presentation"
+ defaultsTo="org.eclipse.ui.workbench.INFORMATION_BACKGROUND"
+ id="org.eclipse.dltk.ui.documentation.backgroundColor">
+ <description>
+ %dltkDocumentationBackgroundColor.description
+ </description>
+ </colorDefinition>
+ <colorDefinition
+ label="%dltkDocumentationForegroundColor.label"
+ categoryId="org.eclipse.dltk.ui.presentation"
+ defaultsTo="org.eclipse.ui.workbench.INFORMATION_FOREGROUND"
+ id="org.eclipse.dltk.ui.documentation.foregroundColor">
+ <description>
+ %dltkDocumentationForegroundColor.description
+ </description>
+ </colorDefinition>
</extension>
<extension
@@ -1735,4 +1753,14 @@
</specification>
</extension>
+<extension
+ point="org.eclipse.e4.ui.css.swt.theme">
+ <stylesheet
+ uri="css/e4-dark.css">
+ <themeid
+ refid="org.eclipse.e4.ui.css.theme.e4_dark">
+ </themeid>
+ </stylesheet>
+</extension>
+
</plugin>
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AbstractAnnotationHover.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AbstractAnnotationHover.java
index d22b322..1d821e5 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AbstractAnnotationHover.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AbstractAnnotationHover.java
@@ -20,12 +20,15 @@
import org.eclipse.dltk.ui.text.completion.HTMLPrinter;
import org.eclipse.dltk.utils.TextUtils;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ColorRegistry;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.editors.text.EditorsUI;
@@ -37,8 +40,7 @@
* Abstract super class for annotation hovers.
*
*/
-public abstract class AbstractAnnotationHover
- extends AbstractScriptEditorTextHover {
+public abstract class AbstractAnnotationHover extends AbstractScriptEditorTextHover {
protected DefaultMarkerAnnotationAccess fAnnotationAccess = new DefaultMarkerAnnotationAccess();
protected boolean fAllAnnotations;
@@ -56,7 +58,10 @@
*/
protected String formatMessage(String message) {
StringBuffer buffer = new StringBuffer();
- HTMLPrinter.insertPageProlog(buffer, 0, getStyleSheet());
+ ColorRegistry registry = JFaceResources.getColorRegistry();
+ RGB fgRGB = registry.getRGB("org.eclipse.dltk.ui.documentation.foregroundColor"); //$NON-NLS-1$
+ RGB bgRGB = registry.getRGB("org.eclipse.dltk.ui.documentation.backgroundColor"); //$NON-NLS-1$
+ HTMLPrinter.insertPageProlog(buffer, 0, bgRGB, fgRGB, getStyleSheet());
buffer.append(postUpdateMessage(TextUtils.escapeHTML(message)));
HTMLPrinter.addPageEpilog(buffer);
return buffer.toString();
@@ -82,8 +87,7 @@
try {
final IPreferenceStore store = getCombinedPreferenceStore();
- Iterator<Annotation> e = new ScriptAnnotationIterator(model,
- fAllAnnotations);
+ Iterator<Annotation> e = new ScriptAnnotationIterator(model, fAllAnnotations);
int layer = -1;
String message = null;
boolean multi = false;
@@ -95,8 +99,7 @@
continue;
}
if (!isActive(store, preference.getTextPreferenceKey())
- && !isActive(store,
- preference.getHighlightPreferenceKey())) {
+ && !isActive(store, preference.getHighlightPreferenceKey())) {
continue;
}
@@ -104,8 +107,7 @@
int l = fAnnotationAccess.getLayer(a);
- if (l >= layer && p != null && p.overlapsWith(
- hoverRegion.getOffset(), hoverRegion.getLength())) {
+ if (l >= layer && p != null && p.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) {
String msg = getMessageFromAnnotation(a);
if (msg != null && msg.trim().length() > 0) {
if (message != null) {
@@ -128,8 +130,7 @@
} finally {
try {
if (path != null) {
- ITextFileBufferManager manager = FileBuffers
- .getTextFileBufferManager();
+ ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
manager.disconnect(path, LocationKind.NORMALIZE, null);
}
} catch (CoreException ex) {
@@ -144,8 +145,7 @@
return a.getText();
}
- protected static boolean isActive(IPreferenceStore store,
- String preference) {
+ protected static boolean isActive(IPreferenceStore store, String preference) {
return preference != null && store.getBoolean(preference);
}
@@ -153,8 +153,8 @@
protected synchronized IPreferenceStore getCombinedPreferenceStore() {
if (combinedStore == null) {
- combinedStore = new ChainedPreferenceStore(new IPreferenceStore[] {
- getPreferenceStore(), EditorsUI.getPreferenceStore() });
+ combinedStore = new ChainedPreferenceStore(
+ new IPreferenceStore[] { getPreferenceStore(), EditorsUI.getPreferenceStore() });
}
return combinedStore;
}
@@ -188,8 +188,7 @@
IAnnotationModel model = null;
try {
- model = manager.getTextFileBuffer(path, LocationKind.NORMALIZE)
- .getAnnotationModel();
+ model = manager.getTextFileBuffer(path, LocationKind.NORMALIZE).getAnnotationModel();
return model;
} finally {
if (model == null) {
@@ -205,17 +204,14 @@
/**
* Returns the annotation preference for the given annotation.
*
- * @param annotation
- * the annotation
+ * @param annotation the annotation
* @return the annotation preference or <code>null</code> if none
*/
- protected AnnotationPreference getAnnotationPreference(
- Annotation annotation) {
+ protected AnnotationPreference getAnnotationPreference(Annotation annotation) {
if (annotation.isMarkedDeleted()) {
return null;
}
- return EditorsUI.getAnnotationPreferenceLookup()
- .getAnnotationPreference(annotation);
+ return EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/DocumentationHover.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/DocumentationHover.java
index 8816192..4918624 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/DocumentationHover.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/DocumentationHover.java
@@ -30,7 +30,9 @@
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.internal.text.html.BrowserInformationControl;
import org.eclipse.jface.internal.text.html.BrowserInformationControlInput;
+import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.AbstractReusableInformationControlCreator;
import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.IInformationControl;
@@ -41,6 +43,7 @@
import org.eclipse.jface.text.ITextHoverExtension;
import org.eclipse.jface.text.information.IInformationProviderExtension2;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.ISharedImages;
@@ -58,17 +61,12 @@
implements IInformationProviderExtension2, ITextHoverExtension {
private static final long LABEL_FLAGS = ScriptElementLabels.ALL_FULLY_QUALIFIED
- | ScriptElementLabels.M_APP_RETURNTYPE
- | ScriptElementLabels.F_APP_TYPE_SIGNATURE
- | ScriptElementLabels.M_PARAMETER_TYPES
- | ScriptElementLabels.M_PARAMETER_NAMES
- | ScriptElementLabels.M_EXCEPTIONS
- | ScriptElementLabels.F_PRE_TYPE_SIGNATURE
- | ScriptElementLabels.M_PRE_TYPE_PARAMETERS
- | ScriptElementLabels.T_TYPE_PARAMETERS
+ | ScriptElementLabels.M_APP_RETURNTYPE | ScriptElementLabels.F_APP_TYPE_SIGNATURE
+ | ScriptElementLabels.M_PARAMETER_TYPES | ScriptElementLabels.M_PARAMETER_NAMES
+ | ScriptElementLabels.M_EXCEPTIONS | ScriptElementLabels.F_PRE_TYPE_SIGNATURE
+ | ScriptElementLabels.M_PRE_TYPE_PARAMETERS | ScriptElementLabels.T_TYPE_PARAMETERS
| ScriptElementLabels.USE_RESOLVED;
- private static final long LOCAL_VARIABLE_FLAGS = LABEL_FLAGS
- & ~ScriptElementLabels.F_FULLY_QUALIFIED
+ private static final long LOCAL_VARIABLE_FLAGS = LABEL_FLAGS & ~ScriptElementLabels.F_FULLY_QUALIFIED
| ScriptElementLabels.F_POST_QUALIFIED;
/**
@@ -93,18 +91,16 @@
fInfoControl = infoControl;
setText(ScriptHoverMessages.ScriptdocHover_back);
ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
- setImageDescriptor(
- images.getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
- setDisabledImageDescriptor(images
- .getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
+ setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
+ setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
update();
}
@Override
public void run() {
- BrowserInformationControlInput previous = (BrowserInformationControlInput) fInfoControl
- .getInput().getPrevious();
+ BrowserInformationControlInput previous = (BrowserInformationControlInput) fInfoControl.getInput()
+ .getPrevious();
if (previous != null) {
fInfoControl.setInput(previous);
}
@@ -139,18 +135,15 @@
fInfoControl = infoControl;
setText(ScriptHoverMessages.ScriptdocHover_forward);
ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
- setImageDescriptor(
- images.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
- setDisabledImageDescriptor(images.getImageDescriptor(
- ISharedImages.IMG_TOOL_FORWARD_DISABLED));
+ setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
+ setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
update();
}
@Override
public void run() {
- BrowserInformationControlInput next = (BrowserInformationControlInput) fInfoControl
- .getInput().getNext();
+ BrowserInformationControlInput next = (BrowserInformationControlInput) fInfoControl.getInput().getNext();
if (next != null) {
fInfoControl.setInput(next);
}
@@ -199,8 +192,7 @@
try {
if (infoInput.getElement() instanceof IModelElement) {
// FIXME: add hover location to editor navigation history?
- DLTKUIPlugin.openInEditor(
- (IModelElement) infoInput.getElement());
+ DLTKUIPlugin.openInEditor((IModelElement) infoInput.getElement());
}
// TODO (alex) try via IOpenDelegate
} catch (PartInitException | ModelException e) {
@@ -214,14 +206,12 @@
*
* @since 4.0
*/
- public static final class PresenterControlCreator
- extends AbstractReusableInformationControlCreator {
+ public static final class PresenterControlCreator extends AbstractReusableInformationControlCreator {
/**
* Creates a new PresenterControlCreator.
*
- * @param site
- * the site or <code>null</code> if none
+ * @param site the site or <code>null</code> if none
*/
public PresenterControlCreator(IWorkbenchSite site) {
}
@@ -231,8 +221,7 @@
if (BrowserInformationControl.isAvailable(parent)) {
ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
String font = PreferenceConstants.APPEARANCE_DOCUMENTATION_FONT;
- BrowserInformationControl iControl = new BrowserInformationControl(
- parent, font, tbm);
+ BrowserInformationControl iControl = new BrowserInformationControl(parent, font, tbm);
final BackAction backAction = new BackAction(iControl);
backAction.setEnabled(false);
@@ -245,8 +234,7 @@
// ShowInJavadocViewAction(
// iControl);
// tbm.add(showInJavadocViewAction);
- final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(
- iControl);
+ final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl);
tbm.add(openDeclarationAction);
// final SimpleSelectionProvider selectionProvider = new
@@ -323,43 +311,33 @@
*
* @since 4.0
*/
- public static final class HoverControlCreator
- extends AbstractReusableInformationControlCreator {
+ public static final class HoverControlCreator 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.
+ * <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
+ * @param informationPresenterControlCreator control creator for enriched hover
*/
- public HoverControlCreator(
- IInformationControlCreator informationPresenterControlCreator) {
+ public HoverControlCreator(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
+ * @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 HoverControlCreator(
- IInformationControlCreator informationPresenterControlCreator,
+ public HoverControlCreator(IInformationControlCreator informationPresenterControlCreator,
boolean additionalInfoAffordance) {
fInformationPresenterControlCreator = informationPresenterControlCreator;
fAdditionalInfoAffordance = additionalInfoAffordance;
@@ -375,8 +353,8 @@
: EditorsUI.getTooltipAffordanceString();
if (BrowserInformationControl.isAvailable(parent)) {
String font = PreferenceConstants.APPEARANCE_DOCUMENTATION_FONT;
- BrowserInformationControl iControl = new BrowserInformationControl(
- parent, font, tooltipAffordanceString) {
+ BrowserInformationControl iControl = new BrowserInformationControl(parent, font,
+ tooltipAffordanceString) {
/**
* @see IInformationControlExtension5#getInformationPresenterControlCreator()
*/
@@ -388,8 +366,7 @@
// TODO (alex) addLinkListener(iControl);
return iControl;
}
- return new DefaultInformationControl(parent,
- tooltipAffordanceString);
+ return new DefaultInformationControl(parent, tooltipAffordanceString);
}
/**
@@ -404,8 +381,7 @@
String tooltipAffordanceString = fAdditionalInfoAffordance
? DLTKUIPlugin.getAdditionalInfoAffordanceString()
: EditorsUI.getTooltipAffordanceString();
- ((IInformationControlExtension4) control)
- .setStatusText(tooltipAffordanceString);
+ ((IInformationControlExtension4) control).setStatusText(tooltipAffordanceString);
}
return true;
@@ -415,8 +391,7 @@
@Override
public IInformationControlCreator getHoverControlCreator() {
if (fHoverControlCreator == null)
- fHoverControlCreator = new HoverControlCreator(
- getInformationPresenterControlCreator());
+ fHoverControlCreator = new HoverControlCreator(getInformationPresenterControlCreator());
return fHoverControlCreator;
}
@@ -430,13 +405,11 @@
boolean hasContents = false;
if (nResults > 1) {
HTMLPrinter.addSmallHeader(buffer,
- getInfoText(result[0], titleAdapter.getTitle(result[0]),
- titleAdapter.getImage(result[0])));
+ getInfoText(result[0], titleAdapter.getTitle(result[0]), titleAdapter.getImage(result[0])));
HTMLPrinter.addParagraph(buffer, "<hr>"); //$NON-NLS-1$
for (int i = 0; i < result.length; i++) {
Object element = result[i];
- Reader reader = ScriptDocumentationAccess
- .getHTMLContentReader(nature, element, true, true);
+ Reader reader = ScriptDocumentationAccess.getHTMLContentReader(nature, element, true, true);
if (reader == null) {
continue;
}
@@ -448,18 +421,14 @@
}
} else {
Object element = result[0];
- IDocumentationResponse response = ScriptDocumentationAccess
- .getDocumentation(nature, element, titleAdapter);
+ IDocumentationResponse response = ScriptDocumentationAccess.getDocumentation(nature, element, titleAdapter);
// Provide hint why there's no doc
if (response == null) {
- response = new TextDocumentationResponse(element,
- titleAdapter.getTitle(element),
- titleAdapter.getImage(element),
- ScriptHoverMessages.ScriptdocHover_noAttachedInformation);
+ response = new TextDocumentationResponse(element, titleAdapter.getTitle(element),
+ titleAdapter.getImage(element), ScriptHoverMessages.ScriptdocHover_noAttachedInformation);
}
try {
- HTMLPrinter.addSmallHeader(buffer, getInfoText(element,
- response.getTitle(), response.getImage()));
+ HTMLPrinter.addSmallHeader(buffer, getInfoText(element, response.getTitle(), response.getImage()));
HTMLPrinter.addParagraph(buffer, response.getReader());
hasContents = true;
} catch (IOException e) {
@@ -468,41 +437,38 @@
/*
* else if (curr.getElementType() == IModelElement.LOCAL_VARIABLE ||
* curr.getElementType() == IModelElement.TYPE_PARAMETER) {
- * HTMLPrinter.addSmallHeader(buffer, getInfoText(curr));
- * hasContents= true; }
+ * HTMLPrinter.addSmallHeader(buffer, getInfoText(curr)); hasContents= true; }
*/
}
if (!hasContents)
return null;
if (buffer.length() > 0) {
- HTMLPrinter.insertPageProlog(buffer, 0, getStyleSheet());
+ ColorRegistry registry = JFaceResources.getColorRegistry();
+ RGB fgRGB = registry.getRGB("org.eclipse.dltk.ui.documentation.foregroundColor"); //$NON-NLS-1$
+ RGB bgRGB = registry.getRGB("org.eclipse.dltk.ui.documentation.backgroundColor"); //$NON-NLS-1$
+ HTMLPrinter.insertPageProlog(buffer, 0, bgRGB, fgRGB, getStyleSheet());
HTMLPrinter.addPageEpilog(buffer);
return buffer.toString();
}
return null;
}
- private String getInfoText(Object element, String title,
- ImageDescriptor image) {
+ private String getInfoText(Object element, String title, ImageDescriptor image) {
String imageName = null;
if (image != null) {
- final URL imageURL = DLTKUIPlugin.getDefault()
- .getImagesOnFSRegistry().getImageURL(image);
+ final URL imageURL = DLTKUIPlugin.getDefault().getImagesOnFSRegistry().getImageURL(image);
if (imageURL != null) {
imageName = imageURL.toExternalForm();
}
}
StringBuffer buf = new StringBuffer();
addImageAndLabel(buf, element, imageName, 16, 16,
- org.eclipse.jface.internal.text.html.HTMLPrinter
- .convertToHTMLContent(title),
- 20, 2);
+ org.eclipse.jface.internal.text.html.HTMLPrinter.convertToHTMLContent(title), 20, 2);
return buf.toString();
}
- private static void addImageAndLabel(StringBuffer buf, Object element,
- String imageSrcPath, int imageWidth, int imageHeight, String label,
- int labelLeft, int labelTop) {
+ private static void addImageAndLabel(StringBuffer buf, Object element, String imageSrcPath, int imageWidth,
+ int imageHeight, String label, int labelLeft, int labelTop) {
buf.append("<div style='word-wrap: break-word; position: relative; "); //$NON-NLS-1$
if (imageSrcPath != null) {
@@ -522,8 +488,7 @@
// element = null; // no link
// }
// }
- StringBuffer imageStyle = new StringBuffer(
- "border:none; position: absolute; "); //$NON-NLS-1$
+ StringBuffer imageStyle = new StringBuffer("border:none; position: absolute; "); //$NON-NLS-1$
imageStyle.append("width: ").append(imageWidth).append("px; "); //$NON-NLS-1$ //$NON-NLS-2$
imageStyle.append("height: ").append(imageHeight).append("px; "); //$NON-NLS-1$ //$NON-NLS-2$
imageStyle.append("left: ").append(-labelLeft - 1).append("px; "); //$NON-NLS-1$ //$NON-NLS-2$
@@ -533,11 +498,9 @@
buf.append("<!--[if lte IE 6]><![if gte IE 5.5]>\n"); //$NON-NLS-1$
String tooltip = element == null ? "" //$NON-NLS-1$
: "alt='" //$NON-NLS-1$
- + ScriptHoverMessages.ScriptdocHover_openDeclaration
- + "' "; //$NON-NLS-1$
+ + ScriptHoverMessages.ScriptdocHover_openDeclaration + "' "; //$NON-NLS-1$
buf.append("<span ").append(tooltip).append("style=\"") //$NON-NLS-1$ //$NON-NLS-2$
- .append(imageStyle)
- .append("filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='") //$NON-NLS-1$
+ .append(imageStyle).append("filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='") //$NON-NLS-1$
.append(imageSrcPath).append("')\"></span>\n"); //$NON-NLS-1$
buf.append("<![endif]><![endif]-->\n"); //$NON-NLS-1$
@@ -563,13 +526,16 @@
@Override
protected String getHoverInfo(String nature, String content) {
try {
- Reader reader = ScriptDocumentationAccess.getKeywordDocumentation(
- nature, getEditorInputModelElement(), content);
+ Reader reader = ScriptDocumentationAccess.getKeywordDocumentation(nature, getEditorInputModelElement(),
+ content);
if (reader != null) {
StringBuffer buffer = new StringBuffer();
HTMLPrinter.addParagraph(buffer, reader);
if (buffer.length() > 0) {
- HTMLPrinter.insertPageProlog(buffer, 0, getStyleSheet());
+ ColorRegistry registry = JFaceResources.getColorRegistry();
+ RGB fgRGB = registry.getRGB("org.eclipse.dltk.ui.documentation.foregroundColor"); //$NON-NLS-1$
+ RGB bgRGB = registry.getRGB("org.eclipse.dltk.ui.documentation.backgroundColor"); //$NON-NLS-1$
+ HTMLPrinter.insertPageProlog(buffer, 0, bgRGB, fgRGB, getStyleSheet());
HTMLPrinter.addPageEpilog(buffer);
return buffer.toString();
}
@@ -583,8 +549,7 @@
private static final ScriptDocumentationTitleAdapter titleAdapter = new ScriptDocumentationTitleAdapter();
@Internal
- static class ScriptDocumentationTitleAdapter extends PlatformObject
- implements IScriptDocumentationTitleAdapter {
+ static class ScriptDocumentationTitleAdapter extends PlatformObject implements IScriptDocumentationTitleAdapter {
private ScriptElementImageProvider fImageProvider;
@@ -592,12 +557,9 @@
public String getTitle(Object element) {
if (element instanceof IModelElement) {
IModelElement member = (IModelElement) element;
- long flags = member
- .getElementType() == IModelElement.LOCAL_VARIABLE
- ? LOCAL_VARIABLE_FLAGS
- : LABEL_FLAGS;
- String label = ScriptElementLabels.getDefault()
- .getElementLabel(member, flags);
+ long flags = member.getElementType() == IModelElement.LOCAL_VARIABLE ? LOCAL_VARIABLE_FLAGS
+ : LABEL_FLAGS;
+ String label = ScriptElementLabels.getDefault().getElementLabel(member, flags);
return label;
}
return null;
@@ -611,8 +573,7 @@
fImageProvider = new ScriptElementImageProvider();
}
return fImageProvider.getScriptImageDescriptor(modelElement,
- ScriptElementImageProvider.OVERLAY_ICONS
- | ScriptElementImageProvider.SMALL_ICONS);
+ ScriptElementImageProvider.OVERLAY_ICONS | ScriptElementImageProvider.SMALL_ICONS);
}
return null;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/PreferenceConstants.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/PreferenceConstants.java
index 85e0dcc..91a2136 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/PreferenceConstants.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/PreferenceConstants.java
@@ -12,7 +12,9 @@
import org.eclipse.dltk.ui.text.completion.ProposalSorterRegistry;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.JFacePreferences;
import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
@@ -121,8 +123,8 @@
public final static String EDITOR_EVALUTE_TEMPORARY_PROBLEMS = "handleTemporaryProblems"; //$NON-NLS-1$
/**
- * A named preference that controls whether the 'sub-word navigation'
- * feature is enabled.
+ * A named preference that controls whether the 'sub-word navigation' feature is
+ * enabled.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
@@ -143,8 +145,8 @@
* A named preference that holds the number of spaces used per tab in the
* editor.
* <p>
- * Value is of type <code>Integer</code>: positive integer value specifying
- * the number of spaces per tab.
+ * Value is of type <code>Integer</code>: positive integer value specifying the
+ * number of spaces per tab.
* </p>
*
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants#EDITOR_TAB_WIDTH
@@ -154,8 +156,8 @@
public final static String EDITOR_TAB_ALWAYS_INDENT = "tab_always_indent"; //$NON-NLS-1$
/**
- * A named preference that controls whether the outline view selection
- * should stay in sync with with the element at the current cursor position.
+ * A named preference that controls whether the outline view selection should
+ * stay in sync with with the element at the current cursor position.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
@@ -164,8 +166,8 @@
public final static String EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE = "syncOutlineOnCursorMove"; //$NON-NLS-1$
/**
- * A named preference that controls if correction indicators are shown in
- * the UI.
+ * A named preference that controls if correction indicators are shown in the
+ * UI.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
@@ -176,16 +178,16 @@
* A named preference that controls whether new projects are generated using
* source and output folder.
* <p>
- * Value is of type <code>Boolean</code>. if <code>true</code> new projects
- * are created with a source and output folder. If <code>false</code> source
- * and output folder equals to the project.
+ * Value is of type <code>Boolean</code>. if <code>true</code> new projects are
+ * created with a source and output folder. If <code>false</code> source and
+ * output folder equals to the project.
* </p>
*/
public static final String SRCBIN_FOLDERS_IN_NEWPROJ = "org.eclipse.dltk.ui.wizards.srcBinFoldersInNewProjects"; //$NON-NLS-1$
/**
- * A named preference that controls whether the hierarchy view's selection
- * is linked to the active editor.
+ * A named preference that controls whether the hierarchy view's selection is
+ * linked to the active editor.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
@@ -193,8 +195,8 @@
public static final String LINK_TYPEHIERARCHY_TO_EDITOR = "org.eclipse.dltk.ui.packages.linktypehierarchytoeditor"; //$NON-NLS-1$
/**
- * A named preference that specifies the source folder name used when
- * creating a new script project. Value is inactive if
+ * A named preference that specifies the source folder name used when creating a
+ * new script project. Value is inactive if
* <code>SRCBIN_FOLDERS_IN_NEWPROJ</code> is set to <code>false</code>.
* <p>
* Value is of type <code>String</code>.
@@ -213,8 +215,8 @@
public static final String APPEARANCE_METHOD_RETURNTYPE = "org.eclipse.dltk.ui.methodreturntype";//$NON-NLS-1$
/**
- * A named preference that controls if method parameter names are rendered
- * in the UI.
+ * A named preference that controls if method parameter names are rendered in
+ * the UI.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
@@ -222,8 +224,8 @@
public static final String APPEARANCE_METHOD_PARAMETER_NAMES = "org.eclipse.dltk.ui.methodParameterNames";//$NON-NLS-1$
/**
- * A named preference that controls if method parameter types are rendered
- * in the UI.
+ * A named preference that controls if method parameter types are rendered in
+ * the UI.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
@@ -254,8 +256,8 @@
public static final String EDITOR_FOLDING_ENABLED = "editor_folding_enabled"; //$NON-NLS-1$
/**
- * A named preference that controls whether comment folding is enabled in
- * the script editor.
+ * A named preference that controls whether comment folding is enabled in the
+ * script editor.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
@@ -263,8 +265,8 @@
public static final String EDITOR_COMMENTS_FOLDING_ENABLED = "editor_comments_folding_enabled"; //$NON-NLS-1$
/**
- * A named preference that controls whether doc folding is enabled in the
- * script editor.
+ * A named preference that controls whether doc folding is enabled in the script
+ * editor.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
@@ -272,8 +274,8 @@
public static final String EDITOR_DOCS_FOLDING_ENABLED = "editor_docs_folding_enabled"; //$NON-NLS-1$
/**
- * A named preference that controls whether comments are initially folded
- * when the editor is opened.
+ * A named preference that controls whether comments are initially folded when
+ * the editor is opened.
*
* <p>
* Value is of type <code>Boolean</code>.
@@ -282,8 +284,8 @@
public static final String EDITOR_FOLDING_INIT_COMMENTS = "editor_folding_init_comments"; //$NON-NLS-1$
/**
- * A named preference that controls whether docs are initially folded when
- * the editor is opened.
+ * A named preference that controls whether docs are initially folded when the
+ * editor is opened.
*
* <p>
* Value is of type <code>Boolean</code>.
@@ -292,8 +294,8 @@
public static final String EDITOR_FOLDING_INIT_DOCS = "editor_folding_init_docs"; //$NON-NLS-1$
/**
- * A named preference that controls whether header comments are initially
- * folded when the editor is opened.
+ * A named preference that controls whether header comments are initially folded
+ * when the editor is opened.
*
* <p>
* Value is of type <code>Boolean</code>.
@@ -302,8 +304,8 @@
public static final String EDITOR_FOLDING_INIT_HEADER_COMMENTS = "editor_folding_init_header_comments"; //$NON-NLS-1$
/**
- * A named preference that controls whether classes (packages, modules, etc)
- * are initially folded when the editor is opened.
+ * A named preference that controls whether classes (packages, modules, etc) are
+ * initially folded when the editor is opened.
*
* <p>
* Value is of type <code>Boolean</code>.
@@ -312,8 +314,8 @@
public static final String EDITOR_FOLDING_INIT_CLASSES = "editor_folding_init_classes"; //$NON-NLS-1$
/**
- * A named preference that controls whether methods are initially folded
- * when the editor is opened.
+ * A named preference that controls whether methods are initially folded when
+ * the editor is opened.
*
* <p>
* Value is of type <code>Boolean</code>.
@@ -322,8 +324,8 @@
public static final String EDITOR_FOLDING_INIT_METHODS = "editor_folding_init_methods"; //$NON-NLS-1$
/**
- * A named preference that controls whether comments separated by newlines
- * are joined together to form a single comment folding block.
+ * A named preference that controls whether comments separated by newlines are
+ * joined together to form a single comment folding block.
*
* <p>
* Value is of type <code>Boolean</code>.
@@ -350,8 +352,8 @@
public static final String CODEASSIST_LRU_HISTORY = "content_assist_lru_history"; //$NON-NLS-1$
/**
- * A named preference that defines whether the hint to make hover sticky
- * should be shown.
+ * A named preference that defines whether the hint to make hover sticky should
+ * be shown.
*
* @see JavaUI
* @deprecated there is global preference now
@@ -369,8 +371,8 @@
public static final String EDITOR_TEXT_HOVER_MODIFIERS = "hoverModifiers"; //$NON-NLS-1$
/**
- * A named preference that defines the key for the hover modifier state
- * masks. The value is only used if the value of
+ * A named preference that defines the key for the hover modifier state masks.
+ * The value is only used if the value of
* <code>EDITOR_TEXT_HOVER_MODIFIERS</code> cannot be resolved to valid SWT
* modifier bits.
*
@@ -410,41 +412,45 @@
/**
* @param store
- * @param isDLTKUI
- * should be <code>true</code> for the DLTKUI preferences and
- * <code>false</code> for the language specific preferences
+ * @param isDLTKUI should be <code>true</code> for the DLTKUI preferences and
+ * <code>false</code> for the language specific preferences
* @noreference This method is not intended to be referenced by clients.
*/
- public static void initializeDefaultValues(IPreferenceStore store,
- boolean isDLTKUI) {
+ public static void initializeDefaultValues(IPreferenceStore store, boolean isDLTKUI) {
store.setDefault(PreferenceConstants.SHOW_SOURCE_MODULE_CHILDREN, true);
store.setDefault(PreferenceConstants.REFACTOR_SAVE_ALL_EDITORS, false);
store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION, true);
- store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY,
- 200);
+ store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 200);
store.setDefault(PreferenceConstants.CODEASSIST_AUTOINSERT, true);
- PreferenceConverter.setDefault(store,
- PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, new RGB(
- 255, 255, 255));
- PreferenceConverter.setDefault(store,
- PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, new RGB(0,
- 0, 0));
- PreferenceConverter.setDefault(store,
- PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND, new RGB(
- 255, 255, 255));
- PreferenceConverter.setDefault(store,
- PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND, new RGB(
- 0, 0, 0));
- PreferenceConverter.setDefault(store,
- PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND, new RGB(
- 255, 255, 0));
- PreferenceConverter.setDefault(store,
- PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND, new RGB(
- 255, 0, 0));
- store.setDefault(PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS,
- true);
+
+ RGB bgRGB = null;
+ RGB fgRGB = null;
+
+ // Don't fail in headless mode
+ if (PlatformUI.isWorkbenchRunning()) {
+ bgRGB = JFaceResources.getColorRegistry().getRGB(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
+ fgRGB = JFaceResources.getColorRegistry().getRGB(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR);
+ }
+
+ // Workaround for https://bugs.eclipse.org/306736
+ if (bgRGB == null)
+ bgRGB = new RGB(255, 255, 255);
+ if (fgRGB == null)
+ fgRGB = new RGB(0, 0, 0);
+
+ PreferenceConverter.setDefault(store, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, bgRGB);
+ PreferenceConverter.setDefault(store, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, fgRGB);
+
+ PreferenceConverter.setDefault(store, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND,
+ new RGB(255, 255, 255));
+ PreferenceConverter.setDefault(store, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND, new RGB(0, 0, 0));
+ PreferenceConverter.setDefault(store, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND,
+ new RGB(255, 255, 0));
+ PreferenceConverter.setDefault(store, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND,
+ new RGB(255, 0, 0));
+ store.setDefault(PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, true);
store.setDefault(PreferenceConstants.CODEASSIST_TIMEOUT, 5000); // 5
// seconds
@@ -457,87 +463,68 @@
store.setDefault(PreferenceConstants.CODEASSIST_CASE_SENSITIVITY, false);
store.setDefault(PreferenceConstants.CODEASSIST_ADDIMPORT, true);
store.setDefault(PreferenceConstants.CODEASSIST_INSERT_COMPLETION, true);
- store.setDefault(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES,
- true);
- store.setDefault(PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS,
- false);
- store.setDefault(PreferenceConstants.CODEASSIST_PREFIX_COMPLETION,
- false);
- store.setDefault(
- PreferenceConstants.CODEASSIST_CATEGORY_ORDER,
+ store.setDefault(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, true);
+ store.setDefault(PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, false);
+ store.setDefault(PreferenceConstants.CODEASSIST_PREFIX_COMPLETION, false);
+ store.setDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER,
"org.eclipse.dltk.javascript.ui.javascriptDocProposalCategory:65546\0org.eclipse.dltk.ui.spellingProposalCategory:65545\0org.eclipse.dltk.ui.scriptTypeProposalCategory:65540\0org.eclipse.dltk.ui.scriptNoTypeProposalCategory:65539\0org.eclipse.dltk.ui.textProposalCategory:65541\0org.eclipse.dltk.ui.templateProposalCategory:2\0"); //$NON-NLS-1$
store.setDefault(PreferenceConstants.CODEASSIST_LRU_HISTORY, ""); //$NON-NLS-1$
- store.setDefault(PreferenceConstants.CODEASSIST_SORTER,
- "org.eclipse.dltk.ui.RelevanceSorter"); //$NON-NLS-1$
+ store.setDefault(PreferenceConstants.CODEASSIST_SORTER, "org.eclipse.dltk.ui.RelevanceSorter"); //$NON-NLS-1$
store.setDefault(PreferenceConstants.DOUBLE_CLICK, DOUBLE_CLICK_EXPANDS);
final int sourceHoverModifier = SWT.MOD2;
- final String sourceHoverModifierName = Action
- .findModifierString(sourceHoverModifier); // Shift
- store.setDefault(
- PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS,
- "org.eclipse.dltk.ui.BestMatchHover;0;org.eclipse.dltk.ui.ScriptSourceHover;" + sourceHoverModifierName); //$NON-NLS-1$
- store.setDefault(
- PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS,
+ final String sourceHoverModifierName = Action.findModifierString(sourceHoverModifier); // Shift
+ store.setDefault(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS,
+ "org.eclipse.dltk.ui.BestMatchHover;0;org.eclipse.dltk.ui.ScriptSourceHover;" //$NON-NLS-1$
+ + sourceHoverModifierName);
+ store.setDefault(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS,
"org.eclipse.dltk.ui.BestMatchHover;0;org.eclipse.dltk.ui.ScriptSourceHover;" + sourceHoverModifier); //$NON-NLS-1$
store.setDefault(PreferenceConstants.EDITOR_MATCHING_BRACKETS, true);
store.setDefault(PreferenceConstants.EDITOR_TAB_ALWAYS_INDENT, false);
- PreferenceConverter.setDefault(store,
- PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR, new RGB(
- 192, 192, 192));
+ PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR,
+ new RGB(192, 192, 192));
if (isDLTKUI) {
- store.setDefault(
- PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS, true);
+ store.setDefault(PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS, true);
store.setDefault(RESOURCE_SHOW_ERROR_INVALID_RESOURCE_NAME, false);
}
store.setDefault(PreferenceConstants.EDITOR_CORRECTION_INDICATION, true);
initializeEditorHoverBackgroundColor(store);
- store.setValue(
- PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT,
- true);
+ store.setValue(PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT, true);
// Fix bug 252155 - contributed by Eden Klein
- store.setDefault(PreferenceConstants.APPEARANCE_MEMBER_SORT_ORDER,
- "F,T,C,M"); //$NON-NLS-1$
+ store.setDefault(PreferenceConstants.APPEARANCE_MEMBER_SORT_ORDER, "F,T,C,M"); //$NON-NLS-1$
store.setDefault(APPEARANCE_METHOD_PARAMETER_NAMES, true);
// mark occurrences
store.setDefault(PreferenceConstants.EDITOR_MARK_OCCURRENCES, true);
store.setDefault(PreferenceConstants.EDITOR_STICKY_OCCURRENCES, true);
if (!isDLTKUI) {
- store.setDefault(
- PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE,
- true);
+ store.setDefault(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, true);
}
}
- private static void initializeEditorHoverBackgroundColor(
- IPreferenceStore store) {
+ private static void initializeEditorHoverBackgroundColor(IPreferenceStore store) {
final Display display;
try {
display = PlatformUI.getWorkbench().getDisplay();
} catch (IllegalStateException e) {
// no workbench
- PreferenceConverter.setValue(store,
- PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR,
+ PreferenceConverter.setValue(store, PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR,
new RGB(237, 233, 227));
return;
}
final RGB rgb[] = new RGB[1];
- display.syncExec(() -> rgb[0] = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)
- .getRGB());
- PreferenceConverter.setValue(store,
- PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR,
- rgb[0]);
+ display.syncExec(() -> rgb[0] = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB());
+ PreferenceConverter.setValue(store, PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR, rgb[0]);
}
/**
- * A named preference that controls whether all dirty editors are
- * automatically saved before a refactoring is executed.
+ * A named preference that controls whether all dirty editors are automatically
+ * saved before a refactoring is executed.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
@@ -545,12 +532,12 @@
public static final String REFACTOR_SAVE_ALL_EDITORS = "Refactoring.savealleditors"; //$NON-NLS-1$
/**
- * A named preference that defines how member elements are ordered by the
- * Script views using the <code>ScriptElementSorter</code>.
+ * A named preference that defines how member elements are ordered by the Script
+ * views using the <code>ScriptElementSorter</code>.
* <p>
- * Value is of type <code>String</code>: A comma separated list of the
- * following entries. Each entry must be in the list, no duplication. List
- * order defines the sort order.
+ * Value is of type <code>String</code>: A comma separated list of the following
+ * entries. Each entry must be in the list, no duplication. List order defines
+ * the sort order.
* <ul>
* <li><b>T</b>: Types</li>
* <li><b>C</b>: Constructors</li>
@@ -573,8 +560,7 @@
public final static String CODEASSIST_AUTOACTIVATION = "content_assist_autoactivation"; //$NON-NLS-1$
/**
- * A name preference that holds the auto activation delay time in
- * milliseconds.
+ * A name preference that holds the auto activation delay time in milliseconds.
* <p>
* Value is of type <code>Integer</code>.
* </p>
@@ -593,8 +579,8 @@
public final static String CODEASSIST_SHOW_VISIBLE_PROPOSALS = "content_assist_show_visible_proposals"; //$NON-NLS-1$
/**
- * A named preference that controls if the Script code assist inserts a
- * proposal automatically if only one proposal is available.
+ * A named preference that controls if the Script code assist inserts a proposal
+ * automatically if only one proposal is available.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
@@ -628,8 +614,8 @@
public final static String CODEASSIST_INSERT_COMPLETION = "content_assist_insert_completion"; //$NON-NLS-1$
/**
- * A named preference that controls whether code assist proposals filtering
- * is case sensitive or not.
+ * A named preference that controls whether code assist proposals filtering is
+ * case sensitive or not.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
@@ -658,37 +644,40 @@
public final static String CODEASSIST_AUTOACTIVATION_TRIGGERS = "content_assist_autoactivation_triggers_script"; //$NON-NLS-1$
/**
- * A named preference that holds the background color used in the code
- * assist selection dialog.
+ * A named preference that holds the background color used in the code assist
+ * selection dialog.
* <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a
- * string using class <code>PreferenceConverter</code>
+ * Value is of type <code>String</code>. A RGB color value encoded as a string
+ * using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
+ * @deprecated As of 5.10, replaced by {@link JFacePreferences#CONTENT_ASSIST_BACKGROUND_COLOR},
*/
+ @Deprecated
public final static String CODEASSIST_PROPOSALS_BACKGROUND = "content_assist_proposals_background"; //$NON-NLS-1$
/**
- * A named preference that holds the foreground color used in the code
- * assist selection dialog.
+ * A named preference that holds the foreground color used in the code assist
+ * selection dialog.
* <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a
- * string using class <code>PreferenceConverter</code>
+ * Value is of type <code>String</code>. A RGB color value encoded as a string
+ * using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
+ * @deprecated As of 3.4, replaced by {@link JFacePreferences#CONTENT_ASSIST_FOREGROUND_COLOR}
*/
+ @Deprecated
public final static String CODEASSIST_PROPOSALS_FOREGROUND = "content_assist_proposals_foreground"; //$NON-NLS-1$
/**
- * A named preference that holds the background color used for parameter
- * hints.
+ * A named preference that holds the background color used for parameter hints.
* <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a
- * string using class <code>PreferenceConverter</code>
+ * Value is of type <code>String</code>. A RGB color value encoded as a string
+ * using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
@@ -697,11 +686,11 @@
public final static String CODEASSIST_PARAMETERS_BACKGROUND = "content_assist_parameters_background"; //$NON-NLS-1$
/**
- * A named preference that holds the foreground color used in the code
- * assist selection dialog.
+ * A named preference that holds the foreground color used in the code assist
+ * selection dialog.
* <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a
- * string using class <code>PreferenceConverter</code>
+ * Value is of type <code>String</code>. A RGB color value encoded as a string
+ * using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
@@ -710,11 +699,11 @@
public final static String CODEASSIST_PARAMETERS_FOREGROUND = "content_assist_parameters_foreground"; //$NON-NLS-1$
/**
- * A named preference that holds the background color used in the code
- * assist selection dialog to mark replaced code.
+ * A named preference that holds the background color used in the code assist
+ * selection dialog to mark replaced code.
* <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a
- * string using class <code>PreferenceConverter</code>
+ * Value is of type <code>String</code>. A RGB color value encoded as a string
+ * using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
@@ -724,11 +713,11 @@
public final static String CODEASSIST_REPLACEMENT_BACKGROUND = "content_assist_completion_replacement_background"; //$NON-NLS-1$
/**
- * A named preference that holds the foreground color used in the code
- * assist selection dialog to mark replaced code.
+ * A named preference that holds the foreground color used in the code assist
+ * selection dialog to mark replaced code.
* <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a
- * string using class <code>PreferenceConverter</code>
+ * Value is of type <code>String</code>. A RGB color value encoded as a string
+ * using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
@@ -738,11 +727,10 @@
public final static String CODEASSIST_REPLACEMENT_FOREGROUND = "content_assist_completion_replacement_foreground"; //$NON-NLS-1$
/**
- * A named preference that controls whether annotation roll over is used or
- * not.
+ * A named preference that controls whether annotation roll over is used or not.
* <p>
- * Value is of type <code>Boolean</code>. If <code>true</code> the
- * annotation ruler column uses a roll over to display multiple annotations
+ * Value is of type <code>Boolean</code>. If <code>true</code> the annotation
+ * ruler column uses a roll over to display multiple annotations
* </p>
*
*/
@@ -777,8 +765,8 @@
public static final String EDITOR_ANNOTATION_ROLL_OVER = "editor_annotation_roll_over"; //$NON-NLS-1$
/**
- * A named preference that controls if content assist inserts the common
- * prefix of all proposals before presenting choices.
+ * A named preference that controls if content assist inserts the common prefix
+ * of all proposals before presenting choices.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
@@ -788,11 +776,10 @@
public final static String CODEASSIST_PREFIX_COMPLETION = "content_assist_prefix_completion"; //$NON-NLS-1$
/**
- * A named preference that controls which completion proposal categories
- * have been excluded from the default proposal list.
+ * A named preference that controls which completion proposal categories have
+ * been excluded from the default proposal list.
* <p>
- * Value is of type <code>String</code>, a "\0"-separated list of
- * identifiers.
+ * Value is of type <code>String</code>, a "\0"-separated list of identifiers.
* </p>
*
*
@@ -800,11 +787,10 @@
public static final String CODEASSIST_EXCLUDED_CATEGORIES = "content_assist_disabled_computers"; //$NON-NLS-1$
/**
- * A named preference that controls which the order of the specific code
- * assist commands.
+ * A named preference that controls which the order of the specific code assist
+ * commands.
* <p>
- * Value is of type <code>String</code>, a "\0"-separated list of
- * identifiers.
+ * Value is of type <code>String</code>, a "\0"-separated list of identifiers.
* </p>
*
*
@@ -849,8 +835,8 @@
+ ".notification.not_on_buildpath"; //$NON-NLS-1$
/**
- * A named preference that holds a list of semicolon separated fully
- * qualified type names with wild card characters.
+ * A named preference that holds a list of semicolon separated fully qualified
+ * type names with wild card characters.
*/
public static final String TYPEFILTER_ENABLED = "org.eclipse.dltk.ui.typefilter.enabled"; //$NON-NLS-1$
public static final String METHODFILTER_ENABLED = "org.eclipse.dltk.ui.methodfilter.enabled"; //$NON-NLS-1$
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/ScriptDocumentationAccess.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/ScriptDocumentationAccess.java
index 39d87a6..3ad1ef4 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/ScriptDocumentationAccess.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/ScriptDocumentationAccess.java
@@ -36,15 +36,13 @@
private static final String DOCUMENTATION_PROVIDERS_EXTENSION_POINT = "org.eclipse.dltk.ui.scriptDocumentationProviders"; //$NON-NLS-1$
private static final NatureExtensionManager<IScriptDocumentationProvider> providers = new NatureExtensionManager<IScriptDocumentationProvider>(
- DOCUMENTATION_PROVIDERS_EXTENSION_POINT,
- IScriptDocumentationProvider.class) {
+ DOCUMENTATION_PROVIDERS_EXTENSION_POINT, IScriptDocumentationProvider.class) {
@Override
protected void initializeDescriptors(List<Object> descriptors) {
Collections.sort(descriptors, new Comparator<Object>() {
int priority(IConfigurationElement element) {
try {
- return Integer
- .parseInt(element.getAttribute("priority"));
+ return Integer.parseInt(element.getAttribute("priority"));
} catch (NumberFormatException e) {
return 0;
}
@@ -52,8 +50,7 @@
@Override
public int compare(Object o1, Object o2) {
- return priority((IConfigurationElement) o2)
- - priority((IConfigurationElement) o1);
+ return priority((IConfigurationElement) o2) - priority((IConfigurationElement) o1);
}
});
}
@@ -114,8 +111,7 @@
return null;
}
- private static IDocumentationResponse merge(String nature,
- Operation2 operation) {
+ private static IDocumentationResponse merge(String nature, Operation2 operation) {
for (IScriptDocumentationProvider p : getProviders(nature)) {
final IDocumentationResponse response = operation.getInfo(p);
if (response != null) {
@@ -127,38 +123,29 @@
/**
* Gets a reader for an IMember documentation. Content are found using
- * documentation documentationProviders, contributed via extension point.
- * The content does contain HTML code describing member. It may be for ex.
- * header comment or a man page. (if <code>allowExternal</code> is
- * <code>true</code>)
+ * documentation documentationProviders, contributed via extension point. The
+ * content does contain HTML code describing member. It may be for ex. header
+ * comment or a man page. (if <code>allowExternal</code> is <code>true</code>)
*
- * @param member
- * The member to get documentation for.
- * @param allowInherited
- * For procedures and methods: if member doesn't
- * have it's own documentation, look into parent
- * types methods.
- * @param allowExternal
- * Allows external documentation like man-pages.
+ * @param member The member to get documentation for.
+ * @param allowInherited For procedures and methods: if member doesn't have it's
+ * own documentation, look into parent types methods.
+ * @param allowExternal Allows external documentation like man-pages.
* @return Reader for a content, or <code>null</code> if no documentation is
* found.
- * @throws ModelException
- * is thrown when the elements documentation can
- * not be accessed
+ * @throws ModelException is thrown when the elements documentation can not be
+ * accessed
* @since 3.0
*/
- public static Reader getHTMLContentReader(String nature,
- final Object member, final boolean allowInherited,
+ public static Reader getHTMLContentReader(String nature, final Object member, final boolean allowInherited,
final boolean allowExternal) {
return merge(nature, (Operation) provider -> {
if (provider instanceof IScriptDocumentationProviderExtension2) {
final IScriptDocumentationProviderExtension2 ext = (IScriptDocumentationProviderExtension2) provider;
- final IDocumentationResponse response = ext
- .getDocumentationFor(member);
+ final IDocumentationResponse response = ext.getDocumentationFor(member);
return DocumentationUtils.getReader(response);
} else if (member instanceof IMember) {
- return provider.getInfo((IMember) member, allowInherited,
- allowExternal);
+ return provider.getInfo((IMember) member, allowInherited, allowExternal);
} else {
return null;
}
@@ -168,17 +155,15 @@
/**
* @since 3.0
*/
- public static IDocumentationResponse getDocumentation(String nature,
- final Object member, final IAdaptable context) {
+ public static IDocumentationResponse getDocumentation(String nature, final Object member,
+ final IAdaptable context) {
return merge(nature, (Operation2) provider -> {
if (provider instanceof IScriptDocumentationProviderExtension2) {
final IScriptDocumentationProviderExtension2 ext = (IScriptDocumentationProviderExtension2) provider;
- final IDocumentationResponse response = ext
- .getDocumentationFor(member);
+ final IDocumentationResponse response = ext.getDocumentationFor(member);
if (response != null && response.getTitle() == null) {
- final IScriptDocumentationTitleAdapter titleAdapter = AdaptUtils
- .getAdapter(context,
- IScriptDocumentationTitleAdapter.class);
+ final IScriptDocumentationTitleAdapter titleAdapter = AdaptUtils.getAdapter(context,
+ IScriptDocumentationTitleAdapter.class);
if (titleAdapter != null) {
final String title = titleAdapter.getTitle(member);
// TODO (alex) image
@@ -211,8 +196,7 @@
return response;
} else if (member instanceof IMember) {
final IMember m = (IMember) member;
- return DocumentationUtils.wrap(member, context,
- provider.getInfo(m, true, true));
+ return DocumentationUtils.wrap(member, context, provider.getInfo(m, true, true));
} else {
return null;
}
@@ -221,20 +205,17 @@
/**
* Gets a reader for an keyword documentation. Content are found using ALL
- * documentation documentationProviders, contributed via extension point.
- * The content does contain HTML code describing member.
+ * documentation documentationProviders, contributed via extension point. The
+ * content does contain HTML code describing member.
*
- * @param content
- * The keyword to find.
+ * @param content The keyword to find.
* @return Reader for a content, or <code>null</code> if no documentation is
* found.
- * @throws ModelException
- * is thrown when the elements documentation can
- * not be accessed
+ * @throws ModelException is thrown when the elements documentation can not be
+ * accessed
*/
@Deprecated
- public static Reader getHTMLContentReader(String nature,
- final String content) throws ModelException {
+ public static Reader getHTMLContentReader(String nature, final String content) throws ModelException {
return merge(nature, (Operation) provider -> provider.getInfo(content));
}
@@ -246,14 +227,12 @@
* @param keyword
* @since 2.0
*/
- public static Reader getKeywordDocumentation(String nature,
- final IModelElement context, final String keyword)
+ public static Reader getKeywordDocumentation(String nature, final IModelElement context, final String keyword)
throws ModelException {
return merge(nature, (Operation) provider -> {
if (provider instanceof IScriptDocumentationProviderExtension) {
final IScriptDocumentationProviderExtension ext = (IScriptDocumentationProviderExtension) provider;
- final IDocumentationResponse response = ext
- .describeKeyword(keyword, context);
+ final IDocumentationResponse response = ext.describeKeyword(keyword, context);
return DocumentationUtils.getReader(response);
}
return provider.getInfo(keyword);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractDocumentationView.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractDocumentationView.java
index 1b39201..be2943b 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractDocumentationView.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractDocumentationView.java
@@ -42,6 +42,7 @@
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.Document;
@@ -89,12 +90,9 @@
private static final boolean WARNING_DIALOG_ENABLED = false;
/** Flags used to render a label in the text widget. */
private static final long LABEL_FLAGS = ScriptElementLabels.ALL_FULLY_QUALIFIED
- | ScriptElementLabels.M_APP_RETURNTYPE
- | ScriptElementLabels.F_APP_TYPE_SIGNATURE
- | ScriptElementLabels.M_PARAMETER_TYPES
- | ScriptElementLabels.M_PARAMETER_NAMES
- | ScriptElementLabels.M_EXCEPTIONS
- | ScriptElementLabels.T_TYPE_PARAMETERS;
+ | ScriptElementLabels.M_APP_RETURNTYPE | ScriptElementLabels.F_APP_TYPE_SIGNATURE
+ | ScriptElementLabels.M_PARAMETER_TYPES | ScriptElementLabels.M_PARAMETER_NAMES
+ | ScriptElementLabels.M_EXCEPTIONS | ScriptElementLabels.T_TYPE_PARAMETERS;
/** The HTML widget. */
private Browser fBrowser;
/** The text widget. */
@@ -123,13 +121,10 @@
/**
* Creates the action.
*
- * @param control
- * the widget
- * @param selectionProvider
- * the selection provider
+ * @param control the widget
+ * @param selectionProvider the selection provider
*/
- public SelectAllAction(Control control,
- SelectionProvider selectionProvider) {
+ public SelectAllAction(Control control, SelectionProvider selectionProvider) {
super("selectAll"); //$NON-NLS-1$
fControl = control;
fSelectionProvider = selectionProvider;
@@ -164,27 +159,24 @@
*/
private static class SelectionProvider implements ISelectionProvider {
/** The selection changed listeners. */
- private ListenerList<ISelectionChangedListener> fListeners = new ListenerList<>(
- ListenerList.IDENTITY);
+ private ListenerList<ISelectionChangedListener> fListeners = new ListenerList<>(ListenerList.IDENTITY);
/** The widget. */
private Control fControl;
/**
* Creates a new selection provider.
*
- * @param control
- * the widget
+ * @param control the widget
*/
public SelectionProvider(Control control) {
fControl = control;
if (fControl instanceof StyledText) {
- ((StyledText) fControl)
- .addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- fireSelectionChanged();
- }
- });
+ ((StyledText) fControl).addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ fireSelectionChanged();
+ }
+ });
} else {
// FIXME: see
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=63022
@@ -202,23 +194,20 @@
*/
public void fireSelectionChanged() {
ISelection selection = getSelection();
- SelectionChangedEvent event = new SelectionChangedEvent(this,
- selection);
+ SelectionChangedEvent event = new SelectionChangedEvent(this, selection);
for (ISelectionChangedListener listener : fListeners)
listener.selectionChanged(event);
}
@Override
- public void addSelectionChangedListener(
- ISelectionChangedListener listener) {
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
fListeners.add(listener);
}
@Override
public ISelection getSelection() {
if (fControl instanceof StyledText) {
- IDocument document = new Document(
- ((StyledText) fControl).getSelectionText());
+ IDocument document = new Document(((StyledText) fControl).getSelectionText());
return new TextSelection(document, 0, document.getLength());
}
// FIXME: see
@@ -227,8 +216,7 @@
}
@Override
- public void removeSelectionChangedListener(
- ISelectionChangedListener listener) {
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
fListeners.remove(listener);
}
@@ -245,11 +233,10 @@
fIsUsingBrowserWidget = true;
} catch (SWTError er) {
/*
- * The Browser widget throws an SWTError if it fails to instantiate
- * properly. Application code should catch this SWTError and disable
- * any feature requiring the Browser widget. Platform requirements
- * for the SWT Browser widget are available from the SWT FAQ web
- * site.
+ * The Browser widget throws an SWTError if it fails to instantiate properly.
+ * Application code should catch this SWTError and disable any feature requiring
+ * the Browser widget. Platform requirements for the SWT Browser widget are
+ * available from the SWT FAQ web site.
*/
IPreferenceStore store = this.getPreferenceStore();// JavaPlugin.getDefault().getPreferenceStore();
boolean doNotWarn = store.getBoolean(DO_NOT_WARN_PREFERENCE_KEY);
@@ -257,12 +244,10 @@
String title = InfoViewMessages.ScriptdocView_error_noBrowser_title;
String message = InfoViewMessages.ScriptdocView_error_noBrowser_message;
String toggleMessage = InfoViewMessages.ScriptdocView_error_noBrowser_doNotWarn;
- MessageDialogWithToggle dialog = MessageDialogWithToggle
- .openError(parent.getShell(), title, message,
- toggleMessage, false, null, null);
+ MessageDialogWithToggle dialog = MessageDialogWithToggle.openError(parent.getShell(), title, message,
+ toggleMessage, false, null, null);
if (dialog.getReturnCode() == Window.OK)
- store.setValue(DO_NOT_WARN_PREFERENCE_KEY,
- dialog.getToggleState());
+ store.setValue(DO_NOT_WARN_PREFERENCE_KEY, dialog.getToggleState());
}
fIsUsingBrowserWidget = false;
}
@@ -292,8 +277,7 @@
return;
try {
styleSheetURL = FileLocator.toFileURL(styleSheetURL);
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(styleSheetURL.openStream()));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(styleSheetURL.openStream()));
StringBuffer buffer = new StringBuffer(200);
String line = reader.readLine();
while (line != null) {
@@ -301,10 +285,10 @@
buffer.append('\n');
line = reader.readLine();
}
- FontData fontData = JFaceResources.getFontRegistry().getFontData(
- PreferenceConstants.APPEARANCE_DOCUMENTATION_FONT)[0];
- fgStyleSheet = org.eclipse.dltk.ui.text.completion.HTMLPrinter
- .convertTopLevelFont(buffer.toString(), fontData);
+ FontData fontData = JFaceResources.getFontRegistry()
+ .getFontData(PreferenceConstants.APPEARANCE_DOCUMENTATION_FONT)[0];
+ fgStyleSheet = org.eclipse.dltk.ui.text.completion.HTMLPrinter.convertTopLevelFont(buffer.toString(),
+ fontData);
} catch (IOException ex) {
DLTKUIPlugin.log(ex);
}
@@ -313,8 +297,7 @@
@Override
protected void createActions() {
super.createActions();
- fSelectAllAction = new SelectAllAction(getControl(),
- (SelectionProvider) getSelectionProvider());
+ fSelectAllAction = new SelectAllAction(getControl(), (SelectionProvider) getSelectionProvider());
}
@Override
@@ -346,8 +329,7 @@
fBackgroundColorRGB = color.getRGB();
if (getInput() == null) {
StringBuffer buffer = new StringBuffer();
- HTMLPrinter.insertPageProlog(buffer, 0, fBackgroundColorRGB,
- fForegroundColorRGB, fgStyleSheet);
+ HTMLPrinter.insertPageProlog(buffer, 0, fBackgroundColorRGB, fForegroundColorRGB, fgStyleSheet);
setInput(buffer.toString());
} else {
setInput(computeInput(getInput()));
@@ -401,12 +383,10 @@
String javadocHtml = (String) input;
if (fIsUsingBrowserWidget) {
if (javadocHtml != null && javadocHtml.length() > 0) {
- boolean RTL = (getSite().getShell().getStyle()
- & SWT.RIGHT_TO_LEFT) != 0;
+ boolean RTL = (getSite().getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0;
if (RTL) {
StringBuffer buffer = new StringBuffer(javadocHtml);
- HTMLPrinter.insertStyles(buffer,
- new String[] { "direction:rtl" }); //$NON-NLS-1$
+ HTMLPrinter.insertStyles(buffer, new String[] { "direction:rtl" }); //$NON-NLS-1$
javadocHtml = buffer.toString();
}
}
@@ -416,8 +396,7 @@
Rectangle size = fText.getClientArea();
try {
javadocHtml = ((DefaultInformationControl.IInformationPresenterExtension) fPresenter)
- .updatePresentation(getSite().getShell(), javadocHtml,
- fPresentation, size.width, size.height);
+ .updatePresentation(getSite().getShell(), javadocHtml, fPresentation, size.width, size.height);
} catch (IllegalArgumentException ex) {
// the javadoc might no longer be valid
return;
@@ -430,15 +409,14 @@
/**
* Returns the doc in HTML format.
*
- * @param result
- * the Script elements for which to get the Javadoc
+ * @param result the Script elements for which to get the Javadoc
* @return a string with the Javadoc in HTML format.
*/
private String getScriptdocHtml(KeywordInput keyword) {
StringBuffer buffer = new StringBuffer();
try {
- Reader reader = ScriptDocumentationAccess.getKeywordDocumentation(
- getNature(), keyword.getContext(), keyword.getValue());
+ Reader reader = ScriptDocumentationAccess.getKeywordDocumentation(getNature(), keyword.getContext(),
+ keyword.getValue());
if (reader != null) {
HTMLPrinter.addParagraph(buffer, reader);
}
@@ -447,7 +425,10 @@
return null;
}
if (buffer.length() > 0) {
- HTMLPrinter.insertPageProlog(buffer, 0, fgStyleSheet);
+ ColorRegistry registry = JFaceResources.getColorRegistry();
+ RGB fgRGB = registry.getRGB("org.eclipse.dltk.ui.documentation.foregroundColor"); //$NON-NLS-1$
+ RGB bgRGB = registry.getRGB("org.eclipse.dltk.ui.documentation.backgroundColor"); //$NON-NLS-1$
+ HTMLPrinter.insertPageProlog(buffer, 0, bgRGB, fgRGB, fgStyleSheet);
HTMLPrinter.addPageEpilog(buffer);
return buffer.toString();
}
@@ -457,8 +438,7 @@
/**
* Returns the Javadoc in HTML format.
*
- * @param result
- * the Script elements for which to get the Javadoc
+ * @param result the Script elements for which to get the Javadoc
* @return a string with the Javadoc in HTML format.
*/
private String getScriptdocHtmlDetailed(Object[] result) {
@@ -466,8 +446,7 @@
final List<String> nodocs = new ArrayList<>();
for (int i = 0; i < result.length; i++) {
final Object member = result[i];
- Reader reader = ScriptDocumentationAccess
- .getHTMLContentReader(getNature(), member, true, true);
+ Reader reader = ScriptDocumentationAccess.getHTMLContentReader(getNature(), member, true, true);
if (reader != null) {
buffer.append("<b>"); //$NON-NLS-1$
buffer.append(getInfoText(member));
@@ -475,8 +454,7 @@
HTMLPrinter.addParagraph(buffer, reader);
} else {
if (member instanceof IModelElement) {
- nodocs.add(ScriptElementLabels.getDefault().getElementLabel(
- (IModelElement) member,
+ nodocs.add(ScriptElementLabels.getDefault().getElementLabel((IModelElement) member,
LABEL_FLAGS | ScriptElementLabels.APPEND_FILE));
} else {
// TODO
@@ -485,8 +463,7 @@
}
if (!nodocs.isEmpty()) {
Collections.sort(nodocs);
- HTMLPrinter.addParagraph(buffer,
- InfoViewMessages.ScriptdocView_noAttachedInformationHeader);
+ HTMLPrinter.addParagraph(buffer, InfoViewMessages.ScriptdocView_noAttachedInformationHeader);
HTMLPrinter.startBulletList(buffer);
for (String s : nodocs) {
HTMLPrinter.addBullet(buffer, s);
@@ -499,8 +476,7 @@
/**
* Returns the Javadoc in HTML format.
*
- * @param result
- * the Script elements for which to get the Javadoc
+ * @param result the Script elements for which to get the Javadoc
* @return a string with the Javadoc in HTML format.
*/
private String getScriptdocHtmlList(IModelElement[] result) {
@@ -520,8 +496,7 @@
/**
* Returns the Javadoc in HTML format.
*
- * @param result
- * the Script elements for which to get the Javadoc
+ * @param result the Script elements for which to get the Javadoc
* @return a string with the Javadoc in HTML format.
*/
private String getScriptdocHtml(IModelElement curr) {
@@ -529,14 +504,12 @@
if (curr instanceof IMember) {
IMember member = (IMember) curr;
// HTMLPrinter.addSmallHeader(buffer, getInfoText(member));
- Reader reader = ScriptDocumentationAccess
- .getHTMLContentReader(getNature(), member, true, true);
+ Reader reader = ScriptDocumentationAccess.getHTMLContentReader(getNature(), member, true, true);
if (reader != null) {
HTMLPrinter.addParagraph(buffer, reader);
} else {
// Provide hint why there's no Javadoc
- HTMLPrinter.addParagraph(buffer,
- InfoViewMessages.ScriptdocView_noAttachedInformation);
+ HTMLPrinter.addParagraph(buffer, InfoViewMessages.ScriptdocView_noAttachedInformation);
}
}
return addPrologeEpilog(buffer);
@@ -544,8 +517,7 @@
private String addPrologeEpilog(StringBuffer buffer) {
if (buffer.length() > 0) {
- HTMLPrinter.insertPageProlog(buffer, 0, fBackgroundColorRGB,
- fForegroundColorRGB, fgStyleSheet);
+ HTMLPrinter.insertPageProlog(buffer, 0, fBackgroundColorRGB, fForegroundColorRGB, fgStyleSheet);
HTMLPrinter.addPageEpilog(buffer);
return buffer.toString();
}
@@ -566,13 +538,10 @@
if (editorNature != null) {
return editorNature.equals(getNature());
}
- ISourceModule sourceModule = EditorUtility
- .getEditorInputModelElement(editor, false);
+ ISourceModule sourceModule = EditorUtility.getEditorInputModelElement(editor, false);
if (sourceModule != null) {
- final IDLTKLanguageToolkit toolkit = DLTKLanguageManager
- .getLanguageToolkit(sourceModule);
- return toolkit != null
- && toolkit.getNatureId().equals(getNature());
+ final IDLTKLanguageToolkit toolkit = DLTKLanguageManager.getLanguageToolkit(sourceModule);
+ return toolkit != null && toolkit.getNatureId().equals(getNature());
}
}
return false;
@@ -581,14 +550,12 @@
/**
* Gets the label for the given member.
*
- * @param member
- * the Script member
+ * @param member the Script member
* @return a string containing the member's label
*/
private String getInfoText(Object member) {
if (member instanceof IModelElement) {
- return ScriptElementLabels.getDefault()
- .getElementLabel((IModelElement) member, LABEL_FLAGS);
+ return ScriptElementLabels.getDefault().getElementLabel((IModelElement) member, LABEL_FLAGS);
}
// TODO
return null;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/AbstractScriptCompletionProposal.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/AbstractScriptCompletionProposal.java
index c781d4b..444bda0 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/AbstractScriptCompletionProposal.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/AbstractScriptCompletionProposal.java
@@ -34,6 +34,7 @@
import org.eclipse.jface.internal.text.html.BrowserInformationControl;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
@@ -542,9 +543,12 @@
public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
if (getProposalInfo() != null) {
String info = getProposalInfo().getInfo(monitor);
- if (info != null && info.length() > 0) {
+ if (info != null && info.length() > 0 && !info.contains("<html")) { //$NON-NLS-1$
StringBuffer buffer = new StringBuffer();
- HTMLPrinter.insertPageProlog(buffer, 0, getCSSStyles());
+ ColorRegistry registry = JFaceResources.getColorRegistry();
+ RGB fgRGB = registry.getRGB("org.eclipse.dltk.ui.documentation.foregroundColor"); //$NON-NLS-1$
+ RGB bgRGB = registry.getRGB("org.eclipse.dltk.ui.documentation.backgroundColor"); //$NON-NLS-1$
+ HTMLPrinter.insertPageProlog(buffer, 0, bgRGB, fgRGB, getCSSStyles());
buffer.append(info);
HTMLPrinter.addPageEpilog(buffer);
info = buffer.toString();