Search in sources :

Example 6 with Color

use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.

the class SchemaXMLLinker method initColors.

/**
     * amaumont Comment method "initColors".
     * 
     * @param display
     */
private void initColors(Display display) {
    // selectedLoopLinkColor = new Color(display, 255, 131, 255);
    // light blue
    selectedLoopLinkColor = new Color(display, 110, 168, 255);
    selectedRelativeLinkColor = new Color(display, 110, 168, 0);
    getSource().addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            selectedLoopLinkColor.dispose();
            selectedRelativeLinkColor.dispose();
            getSource().removeDisposeListener(this);
        }
    });
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) Color(org.eclipse.swt.graphics.Color) DisposeEvent(org.eclipse.swt.events.DisposeEvent)

Example 7 with Color

use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.

the class ColorCombo method popupEvent.

void popupEvent(Event event) {
    switch(event.type) {
        case SWT.Paint:
            // draw black rectangle around list
            Rectangle listRect = list.getBounds();
            Color black = getDisplay().getSystemColor(SWT.COLOR_BLACK);
            event.gc.setForeground(black);
            event.gc.drawRectangle(0, 0, listRect.width + 1, listRect.height + 1);
            break;
        case SWT.Close:
            event.doit = false;
            dropDown(false);
            break;
        case SWT.Deactivate:
            /*
             * Bug in GTK. When the arrow button is pressed the popup control receives a deactivate event and then the
             * arrow button receives a selection event. If we hide the popup in the deactivate event, the selection
             * event will show it again. To prevent the popup from showing again, we will let the selection event of the
             * arrow button hide the popup. In Windows, hiding the popup during the deactivate causes the deactivate to
             * be called twice and the selection event to be disappear.
             */
            if (!"carbon".equals(SWT.getPlatform())) {
                //$NON-NLS-1$
                Point point = arrow.toControl(getDisplay().getCursorLocation());
                Point size = arrow.getSize();
                Rectangle rect = new Rectangle(0, 0, size.x, size.y);
                if (!rect.contains(point)) {
                    dropDown(false);
                }
            } else {
                dropDown(false);
            }
            break;
    }
}
Also used : Color(org.eclipse.swt.graphics.Color) Rectangle(org.eclipse.swt.graphics.Rectangle) Point(org.eclipse.swt.graphics.Point)

Example 8 with Color

use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.

the class ImportItemWizardPage method createItemList.

private void createItemList(Composite workArea) {
    Composite labelComposite = new Composite(workArea, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.makeColumnsEqualWidth = false;
    labelComposite.setLayout(layout);
    Label title = new Label(labelComposite, SWT.NONE);
    //$NON-NLS-1$
    title.setText(Messages.getString("ImportItemWizardPage.ItemsList"));
    itemListInfo = new Label(labelComposite, SWT.NONE);
    // red
    itemListInfo.setForeground(new Color(null, 255, 0, 0));
    //$NON-NLS-1$
    itemListInfo.setText(Messages.getString("ImportItemWizardPage.NoValidItems"));
    itemListInfo.setVisible(false);
    Composite listComposite = new Composite(workArea, SWT.NONE);
    GridLayout layout2 = new GridLayout();
    layout2.numColumns = 2;
    layout2.marginWidth = 0;
    layout2.makeColumnsEqualWidth = false;
    listComposite.setLayout(layout2);
    GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
    gridData.heightHint = 250;
    gridData.widthHint = 600;
    listComposite.setLayoutData(gridData);
    checkTreeViewer = (CheckboxTreeViewer) createTreeViewer(listComposite);
    createSelectionButtons(listComposite);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Color(org.eclipse.swt.graphics.Color) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData)

Example 9 with Color

use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.

the class DummyConnectionFigure method setConnectionProperty.

protected void setConnectionProperty(IConnectionProperty connectionProperty) {
    if (connectionProperty == null) {
        return;
    }
    setLineStyle(connectionProperty.getLineStyle());
    Color color = ColorUtils.getCacheColor(connectionProperty.getRGB());
    ResourceDisposeUtil.setAndCheckColor(this, color, true);
    if (!DesignerPlugin.getDefault().getPreferenceStore().getBoolean(TalendDesignerPrefConstants.EDITOR_LINESTYLE)) {
        this.setLineWidth(1);
    } else {
        this.setLineWidth(2);
    }
}
Also used : Color(org.eclipse.swt.graphics.Color)

Example 10 with Color

use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.

the class ColorProviderMapper method releaseColor.

public static void releaseColor(ColorInfo colorInfo) {
    Color color = colorsCache.get(colorInfo);
    if (!color.isDisposed()) {
        color.dispose();
    }
    colorsCache.remove(colorInfo);
}
Also used : Color(org.eclipse.swt.graphics.Color)

Aggregations

Color (org.eclipse.swt.graphics.Color)1008 Point (org.eclipse.swt.graphics.Point)145 RGB (org.eclipse.swt.graphics.RGB)127 GridData (org.eclipse.swt.layout.GridData)120 Composite (org.eclipse.swt.widgets.Composite)118 Rectangle (org.eclipse.swt.graphics.Rectangle)116 Image (org.eclipse.swt.graphics.Image)115 GridLayout (org.eclipse.swt.layout.GridLayout)99 Display (org.eclipse.swt.widgets.Display)97 Test (org.junit.Test)95 Font (org.eclipse.swt.graphics.Font)86 Label (org.eclipse.swt.widgets.Label)79 GC (org.eclipse.swt.graphics.GC)74 SelectionEvent (org.eclipse.swt.events.SelectionEvent)65 Shell (org.eclipse.swt.widgets.Shell)54 ArrayList (java.util.ArrayList)51 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)51 StyleRange (org.eclipse.swt.custom.StyleRange)49 TableItem (org.eclipse.swt.widgets.TableItem)48 Button (org.eclipse.swt.widgets.Button)45