Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plug-In Image browser does not highlight the current page in dark theme #904

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/org.eclipse.pde.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ Require-Bundle:
org.eclipse.equinox.bidi;bundle-version="[1.4.300,2.0.0)",
org.eclipse.equinox.security;bundle-version="[1.4.100,2.0.0)",
org.eclipse.pde.bnd.ui;bundle-version="1.0.0",
org.eclipse.e4.ui.css.swt.theme;bundle-version="0.14.200",
org.eclipse.pde.ds.core;bundle-version="1.3.300"
Import-Package: aQute.bnd.build;version="4.5.0",
aQute.bnd.build.model;version="[4.2.0,5.0.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Christian Pontesegger - initial API and implementation
* IBM Corporation - ongoing enhancements
* Alena Laskavaia - Bug 481613 pagination controls
* Latha Patil - Issue 822 Current page in pagination control is not highlighted in Dark Theme
*******************************************************************************/

package org.eclipse.pde.internal.ui.views.imagebrowser;
Expand All @@ -27,6 +28,8 @@
import org.eclipse.core.commands.NotEnabledException;
import org.eclipse.core.commands.NotHandledException;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.e4.ui.css.swt.theme.ITheme;
import org.eclipse.e4.ui.css.swt.theme.IThemeEngine;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.RowLayoutFactory;
Expand Down Expand Up @@ -87,10 +90,12 @@
* Provides the PDE Image browser view which displays all icons and images from plug-ins. The plug-ins
* can be loaded from the target platform, the workspace or the current install.
*/
@SuppressWarnings("restriction")
public class ImageBrowserView extends ViewPart implements IImageTarget {

private static final String COMMAND_SAVE_TO_WORKSPACE = "org.eclipse.pde.ui.imagebrowser.saveToWorkspace"; //$NON-NLS-1$
protected final static String VIEW_ID = "org.eclipse.pde.ui.ImageBrowserView"; //$NON-NLS-1$
private static final String DISABLE_CSS = "org.eclipse.e4.ui.css.disabled"; //$NON-NLS-1$

private final UpdateUI mUIJob = new UpdateUI();

Expand Down Expand Up @@ -123,6 +128,7 @@ public class ImageBrowserView extends ViewPart implements IImageTarget {
private ImageElement imageElement;

private Action saveAction;
private boolean isDarkTheme = false;

public ImageBrowserView() {
// create default filters
Expand All @@ -144,6 +150,7 @@ public ImageBrowserView() {
mFilters.add(enabledIcons);
textPatternFilter = new StringFilter("*"); //$NON-NLS-1$
mFilters.add(textPatternFilter);
isDarkTheme = isDarkThemeApplied();
}

@Override
Expand Down Expand Up @@ -363,6 +370,16 @@ public void linkActivated(HyperlinkEvent e) {
scanImages();
}
});
} else {
// Remove Cursor for current page
pageLink.setCursor(null);
// FIXME :#1168 Issue (Current page is not highlighted in
// Dark theme) - This is the temporary fix provided . Actual
// fix has to be done in CSS styling.
if (isDarkTheme) {
pageLink.setData(DISABLE_CSS, Boolean.TRUE);
pageLink.setForeground(getDisplay().getSystemColor(SWT.COLOR_TRANSPARENT));
}
}

}
Expand Down Expand Up @@ -588,4 +605,13 @@ public void widgetDefaultSelected(SelectionEvent e) {

}
}

private boolean isDarkThemeApplied() {
IThemeEngine themeEngine = PlatformUI.getWorkbench().getService(IThemeEngine.class);
if (themeEngine != null) {
ITheme activeTheme = themeEngine.getActiveTheme();
return (activeTheme != null && activeTheme.getLabel() != null && activeTheme.getLabel().equals("Dark")); //$NON-NLS-1$
}
return false;
}
}
Loading