Java Code Examples for org.eclipse.swt.SWT#BORDER_SOLID

The following examples show how to use org.eclipse.swt.SWT#BORDER_SOLID . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CoverageInformationItem.java    From tlaplus with MIT License 6 votes vote down vote up
public void style(final TextPresentation textPresentation, final Color c, final Representation rep) {
	if (!isRoot()) {
		final StyleRange rs = new StyleRange();
		rs.start = region.getOffset();
		rs.length = region.getLength();
		rs.background = c;
		if ((rep == Representation.STATES_DISTINCT || rep == Representation.STATES) && !(this instanceof ActionInformationItem)) {
			rs.background = JFaceResources.getColorRegistry().get(ModuleCoverageInformation.GRAY);
			rs.borderStyle = SWT.NONE;
			rs.borderColor = null;
		} else if (rep != Representation.COST && rep.getValue(this, Grouping.INDIVIDUAL) == 0L) {
			rs.background = null;
			rs.borderStyle = SWT.BORDER_SOLID;
			rs.borderColor = JFaceResources.getColorRegistry().get(ModuleCoverageInformation.RED);
		}
		active = false;
		textPresentation.replaceStyleRange(addStlye(rs));
	}
	for (CoverageInformationItem child : childs) {
		child.style(textPresentation, c, rep);
	}
}
 
Example 2
Source File: CoverageInformationItem.java    From tlaplus with MIT License 5 votes vote down vote up
protected void style(final TextPresentation textPresentation, final boolean merge, final Representation rep) {
	if (!isRoot()) {
		final StyleRange rs = new StyleRange();
		
		// IRegion
		rs.start = region.getOffset();
		rs.length = region.getLength();
		
		// Background Color
		rs.background = rep.getColor(this, merge ? Grouping.COMBINED : Grouping.INDIVIDUAL);
		
		// Zero Coverage
		if ((rep == Representation.STATES_DISTINCT || rep == Representation.STATES) && !(this instanceof ActionInformationItem)) {
			rs.background = JFaceResources.getColorRegistry().get(ModuleCoverageInformation.GRAY);
			rs.borderStyle = SWT.NONE;
			rs.borderColor = null;
		} else if (rep != Representation.COST && rep.getValue(this, Grouping.INDIVIDUAL) == 0L) {
			rs.background = null;
			rs.borderStyle = SWT.BORDER_SOLID;
			rs.borderColor = JFaceResources.getColorRegistry().get(ModuleCoverageInformation.RED);
		}
		
		// Track active subtree
		rs.data = this; //mergeStyleRange does not merge rs.data, thus track active instead.
		active = true;
		
		textPresentation.mergeStyleRange(addStlye(rs));
	}
	for (CoverageInformationItem child : childs) {
		child.style(textPresentation, merge, rep);
	}
}
 
Example 3
Source File: AbstractEditor.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
protected Control createLabelParameterControl(final Composite comp) {
	fixedValue = new CLabel(comp, SWT.READ_ONLY | SWT.BORDER_SOLID);
	fixedValue.setForeground(IGamaColors.BLACK.color()); // force text color, see #2601
	fixedValue.setText(getOriginalValue() instanceof String ? (String) getOriginalValue()
			: StringUtils.toGaml(getOriginalValue(), false));
	// addToolbarHiders(fixedValue);
	return fixedValue;
}
 
Example 4
Source File: OutlinePage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void createControl(Composite parent) {
	sash = new SashForm(parent, SWT.VERTICAL);
	new Label(sash, SWT.BORDER_SOLID).setText(M.FilterByName);
	searchText = new Text(sash, SWT.BORDER_SOLID);
	searchText.addPaintListener(new SearchPaintListener());
	getViewer().createControl(sash);
	getViewer().setEditDomain(editDomain);
	getViewer().setEditPartFactory(new AppTreeEditPartFactory(model));
	getViewer().setContents(model.getProductSystem());
	getViewer().setContextMenu(createContextMenu());
	selectionSynchronizer.addViewer(getViewer());
	searchText.addModifyListener(new SearchModifyListener());
}
 
Example 5
Source File: AnsiConsoleAttributes.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
public static void updateRangeStyle(StyleRange range, AnsiConsoleAttributes attribute) {
    AnsiConsoleAttributes tempAttrib = attribute.clone();

    boolean hilite = false;

    // Prepare the foreground color
    if (hilite) {
        if (tempAttrib.currentFgColor == null) {
            range.foreground = AnsiConsoleUtils.getDebugConsoleFgColor();
            range.foreground = hiliteRgbColor(range.foreground);
        } else {
            if (tempAttrib.currentFgColor < AnsiCommands.COMMAND_COLOR_INTENSITY_DELTA)
                range.foreground = new Color(null, AnsiConsoleColorPalette.getColor(tempAttrib.currentFgColor
                        + AnsiCommands.COMMAND_COLOR_INTENSITY_DELTA));
            else
                range.foreground = new Color(null, AnsiConsoleColorPalette.getColor(tempAttrib.currentFgColor));
        }
    } else {
        if (tempAttrib.currentFgColor != null)
            range.foreground = new Color(null, AnsiConsoleColorPalette.getColor(tempAttrib.currentFgColor));
    }

    // Prepare the background color
    if (tempAttrib.currentBgColor != null)
        range.background = new Color(null, AnsiConsoleColorPalette.getColor(tempAttrib.currentBgColor));

    // These two still mess with the foreground/background colors
    // We need to solve them before we use them for strike/underline/frame colors
    if (tempAttrib.invert) {
        if (range.foreground == null)
            range.foreground = AnsiConsoleUtils.getDebugConsoleFgColor();
        if (range.background == null)
            range.background = AnsiConsoleUtils.getDebugConsoleBgColor();
        Color tmp = range.background;
        range.background = range.foreground;
        range.foreground = tmp;
    }

    if (tempAttrib.conceal) {
        if (range.background == null)
            range.background = AnsiConsoleUtils.getDebugConsoleBgColor();
        range.foreground = range.background;
    }

    range.font = null;
    range.fontStyle = SWT.NORMAL;
    // Prepare the rest of the attributes
    if (tempAttrib.bold)
        range.fontStyle |= SWT.BOLD;

    if (tempAttrib.italic)
        range.fontStyle |= SWT.ITALIC;

    if (tempAttrib.underline != UNDERLINE_NONE) {
        range.underline = true;
        range.underlineColor = range.foreground;
        range.underlineStyle = tempAttrib.underline;
    } else
        range.underline = false;

    range.strikeout = tempAttrib.strike;
    range.strikeoutColor = range.foreground;

    if (tempAttrib.framed) {
        range.borderStyle = SWT.BORDER_SOLID;
        range.borderColor = range.foreground;
    } else
        range.borderStyle = SWT.NONE;
}
 
Example 6
Source File: SyntaxFormatter.java    From ldparteditor with MIT License 2 votes vote down vote up
/**
 * Extends the style range of the text with a boxing-style.
 *
 * @param range
 *            the reference to the style range
 */
private void setBorderStyle(StyleRange range) {
    range.borderStyle = SWT.BORDER_SOLID;
    range.borderColor = Colour.line_box_font[0];
    range.length = range.length;
}