Java Code Examples for org.eclipse.swt.widgets.Display.getSystemColor()

The following are Jave code examples for showing how to use getSystemColor() of the org.eclipse.swt.widgets.Display class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: n4js   File: SpecProcessPage.java   View Source Code Vote up 6 votes
/**
 * (non-Javadoc) Method declared on IDialogPage.
 */
@Override
public void createControl(Composite parent) {
	setPageComplete(true);
	initializeDialogUnits(parent);

	Composite composite = new Composite(parent, SWT.NULL);
	composite.setLayout(new GridLayout());
	composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));

	new Label(composite, SWT.NONE).setText("Messages:");
	createErrorGroup(composite);

	Display display = getShell().getDisplay();
	highlightColor = display.getSystemColor(SWT.COLOR_RED);

	setControl(composite);
}
 
Example 2
Project: convertigo-eclipse   File: JavelinAttributeEditor.java   View Source Code Vote up 6 votes
private Color getColor(int c) {
	Display display = getControl().getShell().getDisplay();
	switch (c) {
		case -2: return display.getSystemColor (SWT.COLOR_GRAY);
		case -1: return display.getSystemColor (SWT.COLOR_GRAY);
		default:
		case 0: return display.getSystemColor (SWT.COLOR_BLACK);
		case 1: return display.getSystemColor (SWT.COLOR_RED);
		case 2: return display.getSystemColor (SWT.COLOR_GREEN);
		case 3: return display.getSystemColor (SWT.COLOR_YELLOW);
		case 4: return display.getSystemColor (SWT.COLOR_BLUE);
		case 5: return display.getSystemColor (SWT.COLOR_MAGENTA);
		case 6: return display.getSystemColor (SWT.COLOR_CYAN);
		case 7: return display.getSystemColor (SWT.COLOR_WHITE);
	}
}
 
Example 3
Project: vertigo-chroma-kspplugin   File: KspOutlinePage.java   View Source Code Vote up 6 votes
private void setStyledText(ViewerCell cell, TreeObject obj) {
	/* Calcul du texte. */
	String mainText = obj.getMainText();
	if (mainText == null) {
		return;
	}
	String subText = obj.getSubText();
	String subTextFinal = subText == null ? "" : (" : " + subText);
	String fullText = mainText + subTextFinal;
	cell.setText(fullText);

	/* Calcul du style. */
	List<StyleRange> styles = new ArrayList<>();
	StyleRange styleMainText = new StyleRange(0, mainText.length(), null, null);
	styles.add(styleMainText);
	if (!subTextFinal.isEmpty()) {
		Display display = Display.getCurrent();
		Color blue = display.getSystemColor(SWT.COLOR_DARK_YELLOW);
		StyleRange styleSubText = new StyleRange(mainText.length(), subTextFinal.length(), blue, null);
		styles.add(styleSubText);
	}
	cell.setStyleRanges(styles.toArray(new StyleRange[0]));
}
 
Example 4
Project: n4js   File: CFEdge.java   View Source Code Vote up 5 votes
/** Sets the color of the {@link GC} depending on the edge type. */
void setColor(GC gc) {
	Display displ = Display.getCurrent();
	Color color = GraphUtils.getColor(50, 50, 50);

	if (isDead || cfTypes.contains(ControlFlowType.DeadCode)) {
		color = displ.getSystemColor(SWT.COLOR_GRAY);
	} else {
		for (ControlFlowType cfType : cfTypes) {
			switch (cfType) {
			case LoopEnter:
			case LoopReenter:
			case LoopInfinite:
			case Break:
			case Continue:
			case Return:
				color = displ.getSystemColor(SWT.COLOR_BLUE);
				break;
			case Throw:
				color = displ.getSystemColor(SWT.COLOR_RED);
				break;
			default:
				break;
			}
		}
	}
	gc.setForeground(color);
}
 
Example 5
Project: n4js   File: CFNode.java   View Source Code Vote up 5 votes
@Override
public Color getBackgroundColor() {
	Color col = null;
	if (isDeadCode) {
		Display displ = Display.getCurrent();
		col = displ.getSystemColor(SWT.COLOR_GRAY);
	} else {
		col = super.getBackgroundColor();
	}
	return col;
}
 
Example 6
Project: convertigo-eclipse   File: AnimatedGif.java   View Source Code Vote up 5 votes
public AnimatedGif(Display display, Canvas animationCanvas, String animatedGifFile) {
	this.display = display;
	this.animationCanvas = animationCanvas;

	try {
		loader = new ImageLoader();
	} catch (SWTException ex) {
		ConvertigoPlugin.logException(ex, "There was an error loading the GIF", false);
		loader = null;
	}
	imageDataArray = loader.load(getClass().getResourceAsStream(animatedGifFile));
	animationCanvasGC = new GC(animationCanvas);
	shellBackground = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
}
 
Example 7
Project: Sensors   File: SWTResourceManager.java   View Source Code Vote up 2 votes
/**
 * Returns the system {@link Color} matching the specific ID.
 * 
 * @param systemColorID
 *            the ID value for the color
 * @return the system {@link Color} matching the specific ID
 */
public static Color getColor(int systemColorID) {
	Display display = Display.getCurrent();
	return display.getSystemColor(systemColorID);
}
 
Example 8
Project: AgentWorkbench   File: SWTResourceManager.java   View Source Code Vote up 2 votes
/**
 * Returns the system {@link Color} matching the specific ID.
 * 
 * @param systemColorID
 *            the ID value for the color
 * @return the system {@link Color} matching the specific ID
 */
public static Color getColor(int systemColorID) {
	Display display = Display.getCurrent();
	return display.getSystemColor(systemColorID);
}
 
Example 9
Project: APITools   File: SWTResourceManager.java   View Source Code Vote up 2 votes
/**
 * Returns the system {@link Color} matching the specific ID.
 * 
 * @param systemColorID
 *            the ID value for the color
 * @return the system {@link Color} matching the specific ID
 */
public static Color getColor(int systemColorID) {
	Display display = Display.getCurrent();
	return display.getSystemColor(systemColorID);
}
 
Example 10
Project: APITools   File: SWTResourceManager.java   View Source Code Vote up 2 votes
/**
 * Returns the system {@link Color} matching the specific ID.
 * 
 * @param systemColorID
 *            the ID value for the color
 * @return the system {@link Color} matching the specific ID
 */
public static Color getColor(int systemColorID) {
	Display display = Display.getCurrent();
	return display.getSystemColor(systemColorID);
}
 
Example 11
Project: Hydrograph   File: SWTResourceManager.java   View Source Code Vote up 2 votes
/**
 * Returns the system {@link Color} matching the specific ID.
 * 
 * @param systemColorID
 *            the ID value for the color
 * @return the system {@link Color} matching the specific ID
 */
public static Color getColor(int systemColorID) {
	Display display = Display.getCurrent();
	return display.getSystemColor(systemColorID);
}
 
Example 12
Project: Hydrograph   File: SWTResourceManager.java   View Source Code Vote up 2 votes
/**
 * Returns the system {@link Color} matching the specific ID.
 * 
 * @param systemColorID
 *            the ID value for the color
 * @return the system {@link Color} matching the specific ID
 */
public static Color getColor(int systemColorID) {
	Display display = Display.getCurrent();
	return display.getSystemColor(systemColorID);
}
 
Example 13
Project: Hydrograph   File: SWTResourceManager.java   View Source Code Vote up 2 votes
/**
 * Returns the system {@link Color} matching the specific ID.
 * 
 * @param systemColorID
 *            the ID value for the color
 * @return the system {@link Color} matching the specific ID
 */
public static Color getColor(int systemColorID) {
	Display display = Display.getCurrent();
	return display.getSystemColor(systemColorID);
}
 
Example 14
Project: pdi   File: SWTResourceManager.java   View Source Code Vote up 2 votes
/**
 * Returns the system {@link Color} matching the specific ID.
 * 
 * @param systemColorID
 *            the ID value for the color
 * @return the system {@link Color} matching the specific ID
 */
public static Color getColor(int systemColorID) {
	Display display = Display.getCurrent();
	return display.getSystemColor(systemColorID);
}