List of usage examples for org.eclipse.jface.resource JFaceColors getActiveHyperlinkText
public static Color getActiveHyperlinkText(Display display)
From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.editor.LinkWidget.java
License:Open Source License
public void createControl() { Composite linkComposite = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 5).applyTo(linkComposite); GridDataFactory.fillDefaults().grab(true, false).applyTo(linkComposite); if (toolkit != null) { labelControl = toolkit.createLabel(linkComposite, label + ":"); //$NON-NLS-1$ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(labelControl); labelControl.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); linkControl = toolkit.createHyperlink(linkComposite, location, SWT.MULTI); GridDataFactory.fillDefaults().grab(true, false).align(SWT.LEFT, SWT.TOP).applyTo(linkControl); linkControl.setBackground(toolkit.getColors().getBackground()); } else {// ww w . j av a 2 s . c o m labelControl = new Label(linkComposite, SWT.NONE); labelControl.setText(label); GridDataFactory.fillDefaults().grab(false, false).applyTo(labelControl); linkControl = new Hyperlink(linkComposite, SWT.MULTI); GridDataFactory.fillDefaults().grab(true, false).hint(250, SWT.DEFAULT).applyTo(linkControl); linkControl.setText(location); } linkControl.setForeground(JFaceColors.getActiveHyperlinkText(linkControl.getDisplay())); linkControl.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { navigate(); } }); }
From source file:org.cloudfoundry.ide.eclipse.internal.server.ui.editor.LinkWidget.java
License:Open Source License
public void createControl() { Composite linkComposite = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 5).applyTo(linkComposite); GridDataFactory.fillDefaults().grab(true, false).applyTo(linkComposite); if (toolkit != null) { labelControl = toolkit.createLabel(linkComposite, label + ":"); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(labelControl); labelControl.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); linkControl = toolkit.createHyperlink(linkComposite, location, SWT.MULTI); GridDataFactory.fillDefaults().grab(true, false).align(SWT.LEFT, SWT.TOP).applyTo(linkControl); linkControl.setBackground(toolkit.getColors().getBackground()); } else {//from w w w . jav a2 s. com labelControl = new Label(linkComposite, SWT.NONE); labelControl.setText(label); GridDataFactory.fillDefaults().grab(false, false).applyTo(labelControl); linkControl = new Hyperlink(linkComposite, SWT.MULTI); GridDataFactory.fillDefaults().grab(true, false).hint(250, SWT.DEFAULT).applyTo(linkControl); linkControl.setText(location); } linkControl.setForeground(JFaceColors.getActiveHyperlinkText(linkControl.getDisplay())); linkControl.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { navigate(); } }); }
From source file:org.eclipse.sapphire.ui.forms.swt.internal.HyperlinkTable.java
License:Open Source License
private void handlePaintItem(final Event event) { final TableItem item = (TableItem) event.item; if (this.controlKeyActive && this.mouseOverTableItem == item) { for (int i = 0, n = getColumnCount(this.table); i < n; i++) { final Display display = this.table.getDisplay(); final String text = item.getText(i); final Font font = item.getFont(i); final TextStyle style = new TextStyle(font, null, null); if (this.mouseOverColumn == i) { final Color hyperlinkColor = JFaceColors.getActiveHyperlinkText(display); style.underline = true;/*from ww w. ja v a2 s . c o m*/ style.foreground = hyperlinkColor; style.underlineColor = hyperlinkColor; } final Image image = item.getImage(i); if (image != null) { final Rectangle bounds = item.getBounds(i); final Point offset = (i == 0 ? IMAGE_OFFSET_PRIMARY_COLUMN : IMAGE_OFFSET_SECONDARY_COLUMN); event.gc.drawImage(image, bounds.x + offset.x, bounds.y + offset.y); } final TextLayout layout = new TextLayout(display); layout.setText(text); layout.setStyle(style, 0, text.length() - 1); final Point offset = (i == 0 ? TEXT_OFFSET_PRIMARY_COLUMN : TEXT_OFFSET_SECONDARY_COLUMN); final Rectangle clientArea = item.getTextBounds(i); layout.setWidth(clientArea.width); layout.draw(event.gc, clientArea.x + offset.x, clientArea.y + offset.y); } } }
From source file:org.eclipse.sapphire.ui.forms.swt.internal.TextOverlayPainter.java
License:Open Source License
private void handlePaint(final Event event) { if (this.textControl.isEnabled()) { if (this.hyperlinkActive) { final TextStyle style = new TextStyle(this.textControl.getFont(), null, null); style.underline = true;// ww w . j a v a2 s . c o m style.foreground = JFaceColors.getActiveHyperlinkText(this.display); style.underlineColor = style.foreground; paintTextOverlay(event.gc, style, getTextWithOverlay()); } else if (!this.textControl.isFocusControl() && this.textControl.getText().length() == 0) { final String overlay = overlay(); if (overlay != null && overlay.length() > 0) { final TextStyle style = new TextStyle(this.textControl.getFont(), null, null); style.foreground = this.display.getSystemColor(SWT.COLOR_GRAY); paintTextOverlay(event.gc, style, overlay); } } } }
From source file:org.eclipse.sapphire.ui.swt.renderer.TextOverlayPainter.java
License:Open Source License
private void handlePaint(final Event event) { if (this.textControl.isEnabled()) { if (this.hyperlinkActive) { final TextStyle style = new TextStyle(this.textControl.getFont(), null, null); style.underline = true;// ww w. jav a2 s . c o m style.foreground = JFaceColors.getActiveHyperlinkText(this.display); style.underlineColor = style.foreground; paintTextOverlay(event.gc, style, getTextWithDefault()); } else if (!this.textControl.isFocusControl() && this.textControl.getText().length() == 0) { final String defaultText = this.controller.getDefaultText(); if (defaultText != null && defaultText.length() > 0) { final TextStyle style = new TextStyle(this.textControl.getFont(), null, null); style.foreground = this.display.getSystemColor(SWT.COLOR_GRAY); paintTextOverlay(event.gc, style, defaultText); } } } }
From source file:org.eclipse.ui.forms.HyperlinkSettings.java
License:Open Source License
/** * Initializes the hyperlink foregrounds from the JFace defaults set for the * entire workbench.//from w ww .j a v a 2 s . co m * * @see JFaceColors * @param display * the display to use when creating colors */ public void initializeDefaultForegrounds(Display display) { Color fg = JFaceColors.getHyperlinkText(display); Color afg = JFaceColors.getActiveHyperlinkText(display); if (fg == null) fg = display.getSystemColor(SWT.COLOR_LINK_FOREGROUND); setForeground(fg); setActiveForeground(afg); }
From source file:org.jboss.tools.common.model.ui.widgets.DefaultSettings.java
License:Open Source License
protected void initColors() { defaultBackground = Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); defaultForeground = Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND); whiteBackground = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); redBackground = Display.getCurrent().getSystemColor(SWT.COLOR_RED); hyperlinkColor = JFaceColors.getHyperlinkText(Display.getCurrent()); activeHyperlinkColor = JFaceColors.getActiveHyperlinkText(Display.getCurrent()); }