Example usage for org.eclipse.jface.resource JFaceResources getColorRegistry

List of usage examples for org.eclipse.jface.resource JFaceResources getColorRegistry

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getColorRegistry.

Prototype

public static ColorRegistry getColorRegistry() 

Source Link

Document

Returns the color registry for JFace itself.

Usage

From source file:org.eclipse.dltk.mod.ui.infoviews.AbstractInfoView.java

License:Open Source License

final public void dispose() {
    // cancel possible running computation
    fComputeCount++;/* ww  w  . ja v a  2 s  . com*/
    getSite().getWorkbenchWindow().getPartService().removePartListener(fPartListener);
    ISelectionProvider provider = getSelectionProvider();
    if (provider != null)
        provider.removeSelectionChangedListener(fCopyToClipboardAction);
    JFaceResources.getColorRegistry().removeListener(this);
    fBackgroundColorRGB = null;
    if (fBackgroundColor != null) {
        fBackgroundColor.dispose();
        fBackgroundColor = null;
    }
    internalDispose();
}

From source file:org.eclipse.dltk.ui.infoviews.AbstractInfoView.java

License:Open Source License

@Override
final public void dispose() {
    // cancel possible running computation
    fComputeCount++;/*from  w w w .  ja  v a2 s  . c om*/
    if (fContextActivation != null) {
        IContextService ctxService = (IContextService) getSite().getService(IContextService.class);
        if (ctxService != null) {
            ctxService.deactivateContext(fContextActivation);
        }
    }
    getSite().getWorkbenchWindow().getPartService().removePartListener(fPartListener);
    ISelectionProvider provider = getSelectionProvider();
    if (provider != null)
        provider.removeSelectionChangedListener(fCopyToClipboardAction);
    JFaceResources.getColorRegistry().removeListener(this);
    fBackgroundColorRGB = null;
    if (fBackgroundColor != null) {
        fBackgroundColor.dispose();
        fBackgroundColor = null;
    }
    internalDispose();
}

From source file:org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor.java

License:Open Source License

@Inject
public void setNotVisibleColor(@Preference("notVisibleColor") String color) {
    RGB current = JFaceResources.getColorRegistry().getRGB(ComponentLabelProvider.NOT_VISIBLE_KEY);

    if (current == null || !current.equals(color)) {
        JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_VISIBLE_KEY,
                StringConverter.asRGB(color, new RGB(200, 200, 200)));
    }//  w  w w .  jav a2  s .c  o m

    if (viewer != null) {
        viewer.refresh();
        viewer.getControl().redraw();
    }
}

From source file:org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor.java

License:Open Source License

@Inject
public void setNotRenderedColor(@Preference("notRenderedColor") String color) {
    RGB current = JFaceResources.getColorRegistry().getRGB(ComponentLabelProvider.NOT_RENDERED_KEY);

    if (current == null || !current.equals(color)) {
        JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_RENDERED_KEY,
                StringConverter.asRGB(color, new RGB(200, 200, 200)));
    }/*www .ja  v  a  2s.  co m*/

    if (viewer != null) {
        viewer.refresh();
        viewer.getControl().redraw();
    }
}

From source file:org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor.java

License:Open Source License

@Inject
public void setNotVisibleRenderedColor(@Preference("notVisibleAndRenderedColor") String color) {
    RGB current = JFaceResources.getColorRegistry().getRGB(ComponentLabelProvider.NOT_VISIBLE_AND_RENDERED_KEY);

    if (current == null || !current.equals(color)) {
        JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_VISIBLE_AND_RENDERED_KEY,
                StringConverter.asRGB(color, new RGB(200, 200, 200)));
    }/* www .j a  v  a 2s .co m*/

    if (viewer != null) {
        viewer.refresh();
        viewer.getControl().redraw();
    }
}

From source file:org.eclipse.e4.ui.internal.progress.ProgressInfoItem.java

License:Open Source License

@PostConstruct
private void createImages() throws IOException {
    ImageRegistry registry = JFaceResources.getImageRegistry();

    if (registry.get(STOP_IMAGE_KEY) == null) {
        URL url = FileLocator/*w w w .  j  a v a2 s.c  o m*/
                .toFileURL(Activator.getContext().getBundle().getEntry("icons/full/elcl16/progress_stop.gif")); //$NON-NLS-1$

        JFaceResources.getImageRegistry().put(STOP_IMAGE_KEY, ImageDescriptor.createFromURL(url));
    }

    if (registry.get(DISABLED_STOP_IMAGE_KEY) == null) {
        URL url = FileLocator
                .toFileURL(Activator.getContext().getBundle().getEntry("icons/full/dlcl16/progress_stop.gif")); //$NON-NLS-1$
        JFaceResources.getImageRegistry().put(DISABLED_STOP_IMAGE_KEY, ImageDescriptor.createFromURL(url));
    }

    if (registry.get(DEFAULT_JOB_KEY) == null) {
        URL url = FileLocator.toFileURL(
                Activator.getContext().getBundle().getEntry("icons/full/progress/progress_task.gif")); //$NON-NLS-1$
        JFaceResources.getImageRegistry().put(DEFAULT_JOB_KEY, ImageDescriptor.createFromURL(url));
    }

    if (registry.get(CLEAR_FINISHED_JOB_KEY) == null) {
        URL url = FileLocator
                .toFileURL(Activator.getContext().getBundle().getEntry("icons/full/elcl16/progress_rem.gif")); //$NON-NLS-1$
        JFaceResources.getImageRegistry().put(CLEAR_FINISHED_JOB_KEY, ImageDescriptor.createFromURL(url));
    }

    if (registry.get(DISABLED_CLEAR_FINISHED_JOB_KEY) == null) {
        URL url = FileLocator
                .toFileURL(Activator.getContext().getBundle().getEntry("icons/full/dlcl16/progress_rem.gif")); //$NON-NLS-1$
        JFaceResources.getImageRegistry().put(DISABLED_CLEAR_FINISHED_JOB_KEY,
                ImageDescriptor.createFromURL(url));
    }

    // Mac has different Gamma value
    int shift = Util.isMac() ? -25 : -10;

    Color lightColor = Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND);

    // Determine a dark color by shifting the list color
    RGB darkRGB = new RGB(Math.max(0, lightColor.getRed() + shift), Math.max(0, lightColor.getGreen() + shift),
            Math.max(0, lightColor.getBlue() + shift));
    JFaceResources.getColorRegistry().put(DARK_COLOR_KEY, darkRGB);
}

From source file:org.eclipse.ease.discovery.ui.viewer.DiscoveryViewer.java

License:Open Source License

private void initializeColors() {
    IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
    if (colorWhite == null) {
        ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
        if (!colorRegistry.hasValueFor(COLOR_WHITE)) {
            colorRegistry.put(COLOR_WHITE, new RGB(255, 255, 255));
        }/*  www.j a v a 2 s.co  m*/
        colorWhite = colorRegistry.get(COLOR_WHITE);
    }
    if (colorDisabled == null) {
        ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
        if (!colorRegistry.hasValueFor(COLOR_DARK_GRAY)) {
            colorRegistry.put(COLOR_DARK_GRAY, new RGB(0x69, 0x69, 0x69));
        }
        colorDisabled = colorRegistry.get(COLOR_DARK_GRAY);
    }
    if (colorCategoryGradientStart == null) {
        colorCategoryGradientStart = themeManager.getCurrentTheme().getColorRegistry()
                .get(CommonThemes.COLOR_CATEGORY_GRADIENT_START);
        colorCategoryGradientEnd = themeManager.getCurrentTheme().getColorRegistry()
                .get(CommonThemes.COLOR_CATEGORY_GRADIENT_END);
    }
}

From source file:org.eclipse.ecf.internal.example.collab.ui.LineChatClientView.java

License:Open Source License

public LineChatClientView(EclipseCollabSharedObject lch, LineChatView view, String name, String initText,
        String downloaddir) {/*from  w ww.j av a2  s . co  m*/
    super();
    this.lch = lch;
    this.view = view;
    this.name = name;
    this.teamChat = new TeamChat(this, view.tabFolder, SWT.NULL, initText);
    this.userdata = lch.getUser();
    this.downloaddir = downloaddir;
    users = new ArrayList();
    teamChat.getTableViewer().setInput(users);
    if (userdata != null)
        addUser(userdata);

    ClientPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals(ClientPlugin.PREF_DISPLAY_TIMESTAMP)) {
                showTimestamp = ((Boolean) event.getNewValue()).booleanValue();
            }
        }

    });

    JFaceResources.getColorRegistry().put(ViewerToolTip.HEADER_BG_COLOR, new RGB(255, 255, 255));
    JFaceResources.getFontRegistry().put(ViewerToolTip.HEADER_FONT, JFaceResources.getFontRegistry()
            .getBold(JFaceResources.getDefaultFont().getFontData()[0].getName()).getFontData());

    final ToolTip toolTip = new ViewerToolTip(teamChat.getTableViewer().getControl());
    toolTip.setHideOnMouseDown(false);
    toolTip.setPopupDelay(200);
}

From source file:org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.EMFCompareColor.java

License:Open Source License

public EMFCompareColor(Display display, boolean leftIsLocal, ITheme theme, EventBus eventBus) {
    super(display, leftIsLocal, theme != null ? theme.getColorRegistry() : JFaceResources.getColorRegistry());
    this.eventBus = eventBus;
    this.theme = theme;
    this.fThemeChangeListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            handlePropertyChangeEvent(event);
        }/*from  w ww .j  a va  2s  . c om*/
    };

    if (theme != null) {
        theme.addPropertyChangeListener(fThemeChangeListener);
    }
}

From source file:org.eclipse.emf.compare.rcp.ui.mergeviewer.CompareColorImpl.java

License:Open Source License

private void updateColors() {
    ColorRegistry registry = JFaceResources.getColorRegistry();

    RGB bg = getBackground();//from ww  w .ja  v  a  2  s .  c  o  m
    fIncomingSelected = registry.getRGB(INCOMING_COLOR);
    if (fIncomingSelected == null) {
        fIncomingSelected = new RGB(0, 0, MAX_RGB_COMPONENT); // BLUE
    }
    fIncoming = interpolate(fIncomingSelected, bg, INTERPOLATION_SCALE_1);
    fIncomingFill = interpolate(fIncomingSelected, bg, INTERPOLATION_SCALE_2);

    fOutgoingSelected = registry.getRGB(OUTGOING_COLOR);
    if (fOutgoingSelected == null) {
        fOutgoingSelected = new RGB(0, 0, 0); // BLACK
    }
    fOutgoing = interpolate(fOutgoingSelected, bg, INTERPOLATION_SCALE_1);
    fOutgoingFill = interpolate(fOutgoingSelected, bg, INTERPOLATION_SCALE_2);

    fConflictSelected = registry.getRGB(CONFLICTING_COLOR);
    if (fConflictSelected == null) {
        fConflictSelected = new RGB(MAX_RGB_COMPONENT, 0, 0); // RED
    }
    fConflict = interpolate(fConflictSelected, bg, INTERPOLATION_SCALE_1);
    fConflictFill = interpolate(fConflictSelected, bg, INTERPOLATION_SCALE_2);

    fResolved = registry.getRGB(RESOLVED_COLOR);
    if (fResolved == null) {
        fResolved = new RGB(0, MAX_RGB_COMPONENT, 0); // GREEN
    }
}