Example usage for org.eclipse.jface.util Util isWin32

List of usage examples for org.eclipse.jface.util Util isWin32

Introduction

In this page you can find the example usage for org.eclipse.jface.util Util isWin32.

Prototype

public static boolean isWin32() 

Source Link

Document

Common WS query helper method.

Usage

From source file:org.eclipse.jface.snippets.viewers.TableCursor.java

License:Open Source License

@Override
protected void paint(Event event) {
    if (getSelectedCells().length == 1 && getSelectedCells()[0] == null)
        return;/*from w w w . j  av  a2  s .com*/
    ViewerCell cell = getSelectedCells()[0];

    GC gc = event.gc;
    Display display = getDisplay();
    gc.setBackground(getBackground());
    gc.setForeground(getForeground());
    gc.fillRectangle(event.x, event.y, event.width, event.height);
    int x = 0;
    Point size = getSize();
    Image image = cell.getImage();
    if (image != null) {
        Rectangle imageSize = image.getBounds();
        int imageY = (size.y - imageSize.height) / 2;
        gc.drawImage(image, x, imageY);
        x += imageSize.width;
    }
    String text = cell.getText();
    if (text != "") { //$NON-NLS-1$
        Rectangle bounds = cell.getBounds();
        Point extent = gc.stringExtent(text);
        // Temporary code - need a better way to determine table trim
        if (Util.isWin32()) {
            if (((Table) getParent()).getColumnCount() == 0 || cell.getColumnIndex() == 0) {
                x += 2;
            } else {
                int alignmnent = ((Table) getParent()).getColumn(cell.getColumnIndex()).getAlignment();
                switch (alignmnent) {
                case SWT.LEFT:
                    x += 6;
                    break;
                case SWT.RIGHT:
                    x = bounds.width - extent.x - 6;
                    break;
                case SWT.CENTER:
                    x += (bounds.width - x - extent.x) / 2;
                    break;
                }
            }
        } else {
            if (((Table) getParent()).getColumnCount() == 0) {
                x += 5;
            } else {
                int alignmnent = ((Table) getParent()).getColumn(cell.getColumnIndex()).getAlignment();
                switch (alignmnent) {
                case SWT.LEFT:
                    x += 5;
                    break;
                case SWT.RIGHT:
                    x = bounds.width - extent.x - 2;
                    break;
                case SWT.CENTER:
                    x += (bounds.width - x - extent.x) / 2 + 2;
                    break;
                }
            }
        }
        int textY = (size.y - extent.y) / 2;
        gc.drawString(text, x, textY);
    }
    if (isFocusControl()) {
        gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
        gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
        gc.drawFocus(0, 0, size.x, size.y);
    }
}

From source file:org.eclipse.viatra.query.patternlanguage.emf.ui.labeling.HTMLPrinter.java

License:Open Source License

/** JFaceColors#getInformationViewerBackgroundColor was only introduced in Neon */
private static Color getInformationViewerBackgroundColor(Display display) {
    if (Util.isWin32() || Util.isCocoa()) {
        // Technically COLOR_INFO_* should only be used for tooltips. But on
        // Windows/Cocoa COLOR_INFO_* gives info viewers/hovers a
        // yellow background which is very suitable for information
        // presentation.
        return display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
    }/*  w  w  w.j a v  a  2s .  com*/

    // Technically, COLOR_LIST_* is not the best system color for this
    // because it is only supposed to be used for Tree/List controls. But at
    // the moment COLOR_TEXT_* is not implemented, so this should work for
    // now. See Bug 508612.
    return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
}

From source file:org.eclipse.viatra.query.patternlanguage.emf.ui.labeling.HTMLPrinter.java

License:Open Source License

/** JFaceColors#getInformationViewerForegroundColor was only introduced in Neon */
private static Color getInformationViewerForegroundColor(Display display) {
    if (Util.isWin32() || Util.isCocoa()) {
        // Technically COLOR_INFO_* should only be used for tooltips. But on
        // Windows/Cocoa COLOR_INFO_* gives info viewers/hovers a
        // yellow background which is very suitable for information
        // presentation.
        return display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
    }//from   w  w w. ja  v a 2 s  . c om

    // Technically, COLOR_LIST_* is not the best system color for this
    // because it is only supposed to be used for Tree/List controls. But at
    // the moment COLOR_TEXT_* is not implemented, so this should work for
    // now. See Bug 508612.
    return display.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
}

From source file:org.springsource.ide.eclipse.commons.ui.HtmlTooltip.java

License:Open Source License

public static Color getInformationViewerBackgroundColor(Display display) {
    if (Util.isWin32() || Util.isCocoa()) {
        // Technically COLOR_INFO_* should only be used for tooltips. But on
        // Windows/Cocoa COLOR_INFO_* gives info viewers/hovers a
        // yellow background which is very suitable for information
        // presentation.
        return display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
    }/*from ww  w .j av  a  2 s . co  m*/

    // Technically, COLOR_LIST_* is not the best system color for this
    // because it is only supposed to be used for Tree/List controls. But at
    // the moment COLOR_TEXT_* is not implemented, so this should work for
    // now. See Bug 508612.
    return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
}

From source file:org.springsource.ide.eclipse.commons.ui.HtmlTooltip.java

License:Open Source License

public static Color getInformationViewerForegroundColor(Display display) {
    if (Util.isWin32() || Util.isCocoa()) {
        // Technically COLOR_INFO_* should only be used for tooltips. But on
        // Windows/Cocoa COLOR_INFO_* gives info viewers/hovers a
        // yellow background which is very suitable for information
        // presentation.
        return display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
    }// w  w  w.j  a  va  2s.  co m

    // Technically, COLOR_LIST_* is not the best system color for this
    // because it is only supposed to be used for Tree/List controls. But at
    // the moment COLOR_TEXT_* is not implemented, so this should work for
    // now. See Bug 508612.
    return display.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
}