aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDawid Pakuła2018-06-22 10:57:30 -0400
committerDawid Pakula2018-06-26 05:55:05 -0400
commitb2a94329c094d590a07328cd9707473c3a9326c1 (patch)
tree95fe725a6d1df137f5a4568123ab0a0f1275999a
parentfe0aebb554d2e90e50cf902e385189a53bfe053a (diff)
downloadorg.eclipse.pdt-b2a94329c094d590a07328cd9707473c3a9326c1.zip
org.eclipse.pdt-b2a94329c094d590a07328cd9707473c3a9326c1.tar.gz
org.eclipse.pdt-b2a94329c094d590a07328cd9707473c3a9326c1.tar.xz
Bug 534520 - Documentation dialog is light on dark theme
Change-Id: Ibeb8e1b6ccfed6bb15a3d5c071b581c74d2c941e Signed-off-by: Dawid Pakuła <zulus@w3des.net>
-rw-r--r--plugins/org.eclipse.php.ui/PHPDocumentationHoverStyleSheet.css4
-rw-r--r--plugins/org.eclipse.php.ui/plugin.properties5
-rw-r--r--plugins/org.eclipse.php.ui/plugin.xml18
-rw-r--r--plugins/org.eclipse.php.ui/resources/css/dark/preferencestyle.css7
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/documentation/PHPDocumentationProvider.java11
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/hover/PHPDocumentationHover.java57
6 files changed, 73 insertions, 29 deletions
diff --git a/plugins/org.eclipse.php.ui/PHPDocumentationHoverStyleSheet.css b/plugins/org.eclipse.php.ui/PHPDocumentationHoverStyleSheet.css
index 549f9a1..5882476 100644
--- a/plugins/org.eclipse.php.ui/PHPDocumentationHoverStyleSheet.css
+++ b/plugins/org.eclipse.php.ui/PHPDocumentationHoverStyleSheet.css
@@ -21,8 +21,8 @@ dt { margin-top: 0px; margin-bottom: 0px; font-weight: bold; }
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; }
a.header:link { text-decoration: none; color: InfoText }
a.header:visited { text-decoration: none; color: InfoText }
diff --git a/plugins/org.eclipse.php.ui/plugin.properties b/plugins/org.eclipse.php.ui/plugin.properties
index b2a4e7a..1e7d43e 100644
--- a/plugins/org.eclipse.php.ui/plugin.properties
+++ b/plugins/org.eclipse.php.ui/plugin.properties
@@ -880,6 +880,11 @@ themeElementCategory.label.0 = PHP
Bundle-Vendor.1 = Eclipse PDT
Bundle-Name.1 = PDT UI Plug-in
+PHPDocumentationBackgroundColor.label= PHPDoc documentation background
+PHPDocumentationBackgroundColor.description= The color used as background for the PHPDoc documentation view and hover.
+PHPDocumentationForegroundColor.label= PHPDoc documentation text color
+PHPDocumentationForegroundColor.description= The foreground color for text in the PHPDoc documentation view and hover.
+
#---Include path
includepath.page.name.0=Include Path
diff --git a/plugins/org.eclipse.php.ui/plugin.xml b/plugins/org.eclipse.php.ui/plugin.xml
index f327bad..a42a9c5 100644
--- a/plugins/org.eclipse.php.ui/plugin.xml
+++ b/plugins/org.eclipse.php.ui/plugin.xml
@@ -1951,6 +1951,24 @@
<extension point="org.eclipse.ui.themes">
<themeElementCategory id="org.eclipse.php.ui.themePHP"
label="%themeElementCategory.label.0" />
+ <colorDefinition
+ label="%PHPDocumentationBackgroundColor.label"
+ categoryId="org.eclipse.php.ui.themePHP"
+ defaultsTo="org.eclipse.ui.workbench.INFORMATION_BACKGROUND"
+ id="org.eclipse.php.ui.documentation.backgroundColor">
+ <description>
+ %PHPDocumentationBackgroundColor.description
+ </description>
+ </colorDefinition>
+ <colorDefinition
+ label="%PHPDocumentationForegroundColor.label"
+ categoryId="org.eclipse.php.ui.themePHP"
+ defaultsTo="org.eclipse.ui.workbench.INFORMATION_FOREGROUND"
+ id="org.eclipse.php.ui.documentation.foregroundColor">
+ <description>
+ %PHPDocumentationForegroundColor.description
+ </description>
+ </colorDefinition>
</extension>
<extension point="org.eclipse.ui.decorators">
<decorator
diff --git a/plugins/org.eclipse.php.ui/resources/css/dark/preferencestyle.css b/plugins/org.eclipse.php.ui/resources/css/dark/preferencestyle.css
index a147404..157320d 100644
--- a/plugins/org.eclipse.php.ui/resources/css/dark/preferencestyle.css
+++ b/plugins/org.eclipse.php.ui/resources/css/dark/preferencestyle.css
@@ -57,3 +57,10 @@ IEclipsePreferences#org-eclipse-ui-editors:org-eclipse-php-ui {
'overrideIndicatorColorForPHP=78,120,117'
}
+
+IEclipsePreferences#org-eclipse-ui-workbench:org-eclipse-php-ui {
+ preferences:
+ 'org.eclipse.php.ui.documentation.backgroundColor=52,57,61'
+ 'org.eclipse.php.ui.documentation.foregroundColor=238,238,238'
+}
+
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/documentation/PHPDocumentationProvider.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/documentation/PHPDocumentationProvider.java
index 774b2ed..80e3a88 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/documentation/PHPDocumentationProvider.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/documentation/PHPDocumentationProvider.java
@@ -23,6 +23,7 @@ import org.eclipse.dltk.ui.PreferenceConstants;
import org.eclipse.dltk.ui.ScriptElementLabels;
import org.eclipse.dltk.ui.documentation.IScriptDocumentationProvider;
import org.eclipse.jface.internal.text.html.HTMLPrinter;
+import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.php.core.compiler.PHPFlags;
import org.eclipse.php.core.compiler.ast.nodes.ConstantDeclaration;
@@ -38,6 +39,7 @@ import org.eclipse.php.internal.ui.PHPUiPlugin;
import org.eclipse.php.internal.ui.editor.hover.PHPDocumentationHover;
import org.eclipse.php.ui.PHPElementLabels;
import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.RGB;
import org.osgi.framework.Bundle;
public class PHPDocumentationProvider implements IScriptDocumentationProvider {
@@ -109,7 +111,10 @@ public class PHPDocumentationProvider implements IScriptDocumentationProvider {
}
if (builder.length() > 0) {
- HTMLPrinter.insertPageProlog(builder, 0, getStyleSheet());
+ ColorRegistry registry = JFaceResources.getColorRegistry();
+ RGB fgRGB = registry.getRGB("org.eclipse.php.ui.documentation.foregroundColor"); //$NON-NLS-1$
+ RGB bgRGB = registry.getRGB("org.eclipse.php.ui.documentation.backgroundColor"); //$NON-NLS-1$
+ HTMLPrinter.insertPageProlog(builder, 0, fgRGB, bgRGB, getStyleSheet());
HTMLPrinter.addPageEpilog(builder);
return new StringReader(builder.toString());
@@ -170,8 +175,8 @@ public class PHPDocumentationProvider implements IScriptDocumentationProvider {
}
/**
- * Returns the Javadoc hover style sheet with the current Javadoc font from the
- * preferences.
+ * Returns the Javadoc hover style sheet with the current Javadoc font from
+ * the preferences.
*
* @return the updated style sheet
*/
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/hover/PHPDocumentationHover.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/hover/PHPDocumentationHover.java
index e96fb39..fa8beaa 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/hover/PHPDocumentationHover.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/hover/PHPDocumentationHover.java
@@ -31,6 +31,7 @@ import org.eclipse.jface.internal.text.html.BrowserInformationControl;
import org.eclipse.jface.internal.text.html.BrowserInformationControlInput;
import org.eclipse.jface.internal.text.html.BrowserInput;
import org.eclipse.jface.internal.text.html.HTMLPrinter;
+import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.*;
import org.eclipse.jface.text.IRegion;
@@ -53,6 +54,7 @@ import org.eclipse.php.ui.editor.hover.IHoverMessageDecorator;
import org.eclipse.php.ui.editor.hover.IPHPTextHover;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
@@ -273,8 +275,7 @@ public class PHPDocumentationHover extends AbstractPHPEditorTextHover
/**
* @param informationPresenterControlCreator
- * control creator for enriched
- * hover
+ * control creator for enriched hover
* @since 3.4
*/
public HoverControlCreator(IInformationControlCreator informationPresenterControlCreator) {
@@ -294,7 +295,8 @@ public class PHPDocumentationHover extends AbstractPHPEditorTextHover
BrowserInformationControl iControl = new BrowserInformationControl(parent, font,
tooltipAffordanceString) {
/*
- * @see org.eclipse.jface.text.IInformationControlExtension5#
+ * @see
+ * org.eclipse.jface.text.IInformationControlExtension5#
* getInformationPresenterControlCreator()
*/
@Override
@@ -391,8 +393,9 @@ public class PHPDocumentationHover extends AbstractPHPEditorTextHover
/*
* (non-Javadoc)
*
- * @see org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks .ILinkHandler
- * #handleInlineJavadocLink(org.eclipse.jdt.core .IModelElement)
+ * @see org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks
+ * .ILinkHandler #handleInlineJavadocLink(org.eclipse.jdt.core
+ * .IModelElement)
*/
@Override
public void handleInlineLink(IModelElement linkTarget) {
@@ -409,8 +412,9 @@ public class PHPDocumentationHover extends AbstractPHPEditorTextHover
/*
* (non-Javadoc)
*
- * @see org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks .ILinkHandler
- * #handleDeclarationLink(org.eclipse.jdt.core. IModelElement)
+ * @see org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks
+ * .ILinkHandler #handleDeclarationLink(org.eclipse.jdt.core.
+ * IModelElement)
*/
@Override
public void handleDeclarationLink(IModelElement linkTarget) {
@@ -454,7 +458,8 @@ public class PHPDocumentationHover extends AbstractPHPEditorTextHover
}
/*
- * @see org.eclipse.jface.text.ITextHoverExtension2#getHoverInfo2(org.eclipse
+ * @see
+ * org.eclipse.jface.text.ITextHoverExtension2#getHoverInfo2(org.eclipse
* .jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
*/
@Override
@@ -509,14 +514,14 @@ public class PHPDocumentationHover extends AbstractPHPEditorTextHover
* Computes the hover info.
*
* @param elements
- * the resolved elements
+ * the resolved elements
* @param constantValue
- * a constant value iff result contains exactly 1
- * constant field, or <code>null</code>
+ * a constant value iff result contains exactly 1 constant field,
+ * or <code>null</code>
* @param previousInput
- * the previous input, or <code>null</code>
- * @return the HTML hover info for the given element(s) or <code>null</code> if
- * no information is available
+ * the previous input, or <code>null</code>
+ * @return the HTML hover info for the given element(s) or <code>null</code>
+ * if no information is available
* @since 3.4
*/
private static PHPDocumentationBrowserInformationControlInput getHoverInfo(IModelElement[] elements,
@@ -554,7 +559,10 @@ public class PHPDocumentationHover extends AbstractPHPEditorTextHover
}
if (builder.length() > 0) {
- HTMLPrinter.insertPageProlog(builder, 0, getStyleSheet());
+ ColorRegistry registry = JFaceResources.getColorRegistry();
+ RGB fgRGB = registry.getRGB("org.eclipse.php.ui.documentation.foregroundColor"); //$NON-NLS-1$
+ RGB bgRGB = registry.getRGB("org.eclipse.php.ui.documentation.backgroundColor"); //$NON-NLS-1$
+ HTMLPrinter.insertPageProlog(builder, 0, fgRGB, bgRGB, getStyleSheet());
HTMLPrinter.addPageEpilog(builder);
return new PHPDocumentationBrowserInformationControlInput(previousInput, element, builder.toString(),
leadingImageWidth);
@@ -604,10 +612,11 @@ public class PHPDocumentationHover extends AbstractPHPEditorTextHover
* Returns the constant value for the given field.
*
* @param field
- * the field
+ * the field
* @param hoverRegion
- * the hover region
- * @return the constant value for the given field or <code>null</code> if none
+ * the hover region
+ * @return the constant value for the given field or <code>null</code> if
+ * none
* @since 3.4
*/
private String getConstantValue(IField field, IRegion hoverRegion) {
@@ -713,13 +722,13 @@ public class PHPDocumentationHover extends AbstractPHPEditorTextHover
}
/**
- * Creates and returns a formatted message for the given constant with its hex
- * value.
+ * Creates and returns a formatted message for the given constant with its
+ * hex value.
*
* @param constantValue
- * the constant value
+ * the constant value
* @param hexValue
- * the hex value
+ * the hex value
* @return a formatted string with constant and hex values
* @since 3.4
*/
@@ -729,8 +738,8 @@ public class PHPDocumentationHover extends AbstractPHPEditorTextHover
}
/**
- * Returns the Javadoc hover style sheet with the current Javadoc font from the
- * preferences.
+ * Returns the Javadoc hover style sheet with the current Javadoc font from
+ * the preferences.
*
* @return the updated style sheet
* @since 3.4