List of usage examples for org.eclipse.jface.resource JFaceResources getColorRegistry
public static ColorRegistry getColorRegistry()
From source file:org.jeelee.utils.MessageToolTips2.java
License:Open Source License
@Override protected void createContent(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); setColor(comp);/*from w w w .ja v a 2 s .c o m*/ GridLayout gl = new GridLayout(1, false); gl.marginBottom = 0; gl.marginTop = 0; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 0; gl.marginRight = 0; gl.verticalSpacing = 1; comp.setLayout(gl); Composite topArea = new Composite(comp, SWT.NONE); GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); data.widthHint = 200; topArea.setLayoutData(data); setColor(topArea); gl = new GridLayout(2, false); gl.marginBottom = 2; gl.marginTop = 2; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 5; gl.marginRight = 2; topArea.setLayout(gl); titleLabel = new CLabel(topArea, SWT.NONE); titleLabel.setText(title); titleLabel.setFont(JFaceResources.getFontRegistry().get("org.eclipse.jface.TOOLTIP_HEAD_FONT")); titleLabel.setLayoutData(new GridData(GridData.FILL_BOTH)); // titleLabel.addMouseListener(mouseListener); setColor(titleLabel); Composite iconComp = new Composite(topArea, SWT.NONE); iconComp.setLayoutData(new GridData()); iconComp.setLayout(new GridLayout(2, false)); setColor(iconComp); gl = new GridLayout(2, false); gl.marginBottom = 0; gl.marginTop = 0; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 0; gl.marginRight = 0; iconComp.setLayout(gl); PluginResources r = SharedResources.getResources(); if ((style & ShowHelpIcon) != 0) { Label helpIcon = new Label(iconComp, SWT.NONE); helpIcon.setBackground( JFaceResources.getColorRegistry().get("org.eclipse.jface.TOOLTIP_HEAD_BG_COLOR")); helpIcon.setImage(r.getImage("help")); helpIcon.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { setVisible(false); } }); setColor(helpIcon); } Label closeIcon = new Label(iconComp, SWT.NONE); closeIcon.setImage(r.getImage("close")); closeIcon.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { parentShell.setFocus(); setVisible(false); } }); setColor(closeIcon); Composite messageComposite = new Composite(comp, SWT.NONE); messageComposite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); FillLayout layout = new FillLayout(); layout.marginWidth = 5; messageComposite.setLayout(layout); messageLabel = new CLabel(messageComposite, SWT.NONE); messageLabel.setText(message); // messageLabel.addMouseListener(mouseListener); setColor(messageLabel); }
From source file:org.kalypso.contribs.eclipse.jface.wizard.view.WizardView.java
License:Open Source License
/** * @see org.eclipse.jface.wizard.IWizardContainer#updateTitleBar() *///from ww w . ja v a 2 s . c o m @Override public void updateTitleBar() { // update title-bar colors final RGB backgroundRGB; final RGB foregroundRGB = m_defaultTitleForeground; if (m_wizard != null) backgroundRGB = m_wizard.getTitleBarColor(); else backgroundRGB = m_defaultTitleBackground; final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); colorRegistry.put(m_backgroundRgbId, backgroundRGB); colorRegistry.put(m_foregroundRgbId, foregroundRGB); final Color background = colorRegistry.get(m_backgroundRgbId); final Color foreground = colorRegistry.get(m_foregroundRgbId); if (m_parent != null && !m_parent.isDisposed()) m_parent.setBackground(background); if (m_titleImage != null && !m_titleImage.isDisposed()) m_titleImage.setBackground(background); if (m_titleLabel != null && !m_titleLabel.isDisposed()) JFaceColors.setColors(m_titleLabel, foreground, background); if (m_messageImageLabel != null && !m_messageImageLabel.isDisposed()) m_messageImageLabel.setBackground(background); if (m_messageLabel != null && !m_messageLabel.isDisposed()) JFaceColors.setColors(m_messageLabel, foreground, background); if (m_leftFillerLabel != null && !m_leftFillerLabel.isDisposed()) m_leftFillerLabel.setBackground(background); if (m_bottomFillerLabel != null && !m_bottomFillerLabel.isDisposed()) m_bottomFillerLabel.setBackground(background); String s = null; if (m_currentPage != null) s = m_currentPage.getTitle(); if (s == null) s = ""; //$NON-NLS-1$ setWizardTitle(s); if (m_currentPage != null) setWizardTitleImage(m_currentPage.getImage()); updateDescriptionMessage(); updateMessage(); }
From source file:org.kalypso.ogc.gml.featureview.control.FeatureControlBuilder.java
License:Open Source License
private Color getBackgroundColor() { final String htmlColor = getBackgroundHtml(); if (StringUtils.isBlank(htmlColor)) return null; final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); final Color cachedColor = colorRegistry.get(htmlColor); if (cachedColor != null) return cachedColor; final RGB rgb = ColorUtilities.toRGBFromHTML(htmlColor); if (rgb == null) return null; colorRegistry.put(htmlColor, rgb);//from w w w. j av a 2 s . c o m return colorRegistry.get(htmlColor); }
From source file:org.kalypso.ogc.gml.table.LayerTablePainter.java
License:Open Source License
private Color getColor(final java.awt.Color fillColor) { final RGB fillRGB = ColorUtilities.toRGB(fillColor); final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); final String symbolicName = fillRGB.toString(); colorRegistry.put(symbolicName, fillRGB); return colorRegistry.get(symbolicName); }
From source file:org.kalypso.ui.editor.styleeditor.fill.FillComposite.java
License:Open Source License
private void createColorControl(final FormToolkit toolkit, final Composite parent) { toolkit.createLabel(parent, Messages.getString("org.kalypso.ui.editor.sldEditor.FillEditorComposite.0")); //$NON-NLS-1$ final Label colorLabel = toolkit.createLabel(parent, StringUtils.EMPTY, SWT.BORDER); final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); gridData.widthHint = 16;/* w w w . j a va 2s. co m*/ colorLabel.setLayoutData(gridData); colorLabel.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_HAND)); final IObservableValue target = SWTObservables.observeBackground(colorLabel); final IObservableValue model = new FillColorValue(m_input); m_binding.bindValue(target, model, new SwrToAwtColorConverter(), new AwtToSwtColorConverter(JFaceResources.getColorRegistry(), toString())); colorLabel.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent e) { final ColorDialog colorDialog = new ColorDialog(getShell()); colorDialog.setRGB(ColorUtilities.toRGB((Color) model.getValue())); final RGB chosenColor = colorDialog.open(); if (chosenColor != null) model.setValue(ColorUtilities.toAwtColor(chosenColor)); } }); }
From source file:org.kalypso.ui.editor.styleeditor.stroke.StrokeComposite.java
License:Open Source License
private void createColorControl(final FormToolkit toolkit, final Composite parent) { toolkit.createLabel(parent, Messages.getString("org.kalypso.ui.editor.sldEditor.StrokeEditorComposite.16")); //$NON-NLS-1$ final Label colorLabel = toolkit.createLabel(parent, StringUtils.EMPTY, SWT.BORDER); final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1); gridData.widthHint = 16;/*from www. j a va 2 s . co m*/ colorLabel.setLayoutData(gridData); final IObservableValue target = SWTObservables.observeBackground(colorLabel); final IObservableValue model = new StrokeColorValue(m_input); m_binding.bindValue(target, model, new SwrToAwtColorConverter(), new AwtToSwtColorConverter(JFaceResources.getColorRegistry(), toString())); colorLabel.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent e) { final ColorDialog colorDialog = new ColorDialog(getShell()); colorDialog.setRGB(ColorUtilities.toRGB((Color) model.getValue())); final RGB chosenColor = colorDialog.open(); if (chosenColor != null) model.setValue(ColorUtilities.toAwtColor(chosenColor)); } }); colorLabel.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_HAND)); }
From source file:org.l2x6.eircc.ui.prefs.IrcPreferences.java
License:Open Source License
/** * *//*from w ww.jav a 2 s . c o m*/ public IrcPreferences() { super(); ColorRegistry reg = JFaceResources.getColorRegistry(); systemMessageStyle = new ExtendedTextStyle( Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND)); reg.put(DEFAULT_NOTIFICATION_MESSAGE_COLOR_KEY, new RGB(254, 128, 0)); notificationMessageStyle = new ExtendedTextStyle(reg.get(DEFAULT_NOTIFICATION_MESSAGE_COLOR_KEY)); messageTimeStyle = new ExtendedTextStyle( Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND)); Colors colors = Colors.getInstance(); String keyPrefix = this.getClass().getName() + ".user#"; userStyles = new ExtendedTextStyle[colors.getColorCount()]; userStylesNamingMe = new ExtendedTextStyle[colors.getColorCount()]; userStylers = new IrcUserStyler[colors.getColorCount()]; for (int i = 0; i < userStyles.length; i++) { String key = keyPrefix + i; reg.put(key, colors.getRGB(i)); Color c = reg.get(key); userStyles[i] = new ExtendedTextStyle(c); userStylesNamingMe[i] = new ExtendedTextStyle(c, SWT.BOLD); userStylers[i] = new IrcUserStyler(this, i); } }
From source file:org.locationtech.udig.mapgraphic.style.FontStyleConfigurator.java
License:Open Source License
private org.eclipse.swt.graphics.Color toSwtColor(RGB rgb) { String colorKey = rgb.red + "_" + rgb.green + "_" + rgb.blue; //$NON-NLS-1$ //$NON-NLS-2$ org.eclipse.swt.graphics.Color swtColor = JFaceResources.getColorRegistry().get(colorKey); if (swtColor == null) { swtColor = new org.eclipse.swt.graphics.Color(label.getDisplay(), color); JFaceResources.getColorRegistry().put(colorKey, color); }/*ww w . j a va 2 s . c o m*/ return swtColor; }
From source file:org.opendaylight.yangide.editor.editors.YangSourceViewerConfiguration.java
License:Open Source License
@Override public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { ContentAssistant assistant = new ContentAssistant(); IContentAssistProcessor processor = new YangSimpleCompletionProcessor(getEditor()); assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); assistant.setDocumentPartitioning(YangDocumentSetupParticipant.YANG_PARTITIONING); assistant.enableAutoActivation(false); assistant.setAutoActivationDelay(200); assistant.setProposalPopupOrientation(ContentAssistant.PROPOSAL_REMOVE); assistant.setContextInformationPopupOrientation(ContentAssistant.CONTEXT_INFO_ABOVE); assistant.setInformationControlCreator(getInformationControlCreator()); Color background = JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR); assistant.setContextInformationPopupBackground(background); assistant.setContextSelectorBackground(background); Color foreground = JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR); assistant.setContextInformationPopupForeground(foreground); assistant.setContextSelectorForeground(foreground); assistant.setStatusLineVisible(true); assistant.enableAutoInsert(true);// ww w . j a v a 2 s . c om return assistant; }
From source file:org.openscada.core.ui.styles.generator.SimpleRuleStyleGenerator.java
License:Open Source License
public SimpleRuleStyleGenerator() { this.resourceManager = new LocalResourceManager(JFaceResources.getResources()); this.colorBgDisconnected = new ColorUpdater("org.openscada.core.ui.styles.alarming.disconnected.bg", //$NON-NLS-1$ this.resourceManager, COLOR_DISCONNECTED_BG); this.colorBgError = new ColorUpdater("org.openscada.core.ui.styles.alarming.error.bg", this.resourceManager, //$NON-NLS-1$ COLOR_ERROR_BG);//from ww w . j a va 2s .c o m this.colorBgAlarm = new ColorUpdater("org.openscada.core.ui.styles.alarming.alarm.bg", this.resourceManager, //$NON-NLS-1$ COLOR_ALARM_BG); this.colorBgWarning = new ColorUpdater("org.openscada.core.ui.styles.alarming.warning.bg", //$NON-NLS-1$ this.resourceManager, COLOR_WARNING_BG); this.colorBgManual = new ColorUpdater("org.openscada.core.ui.styles.alarming.manual.bg", //$NON-NLS-1$ this.resourceManager, COLOR_MANUAL_BG); this.colorBgBlock = new ColorUpdater("org.openscada.core.ui.styles.alarming.block.bg", this.resourceManager, //$NON-NLS-1$ COLOR_BLOCK_BG); this.colorFgBlock = new ColorUpdater("org.openscada.core.ui.styles.alarming.block.fg", this.resourceManager, //$NON-NLS-1$ COLOR_BLOCK_FG); JFaceResources.getColorRegistry().addListener(this.listener); }