Search in sources :

Example 76 with PaintListener

use of org.eclipse.swt.events.PaintListener in project liferay-ide by liferay.

the class LayoutTplPreviewEditor method _refreshViewer.

private void _refreshViewer(GraphicalViewer viewer) {
    Control control = viewer.getControl();
    control.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent e) {
            EditPart editPage = getGraphicalViewer().getContents();
            editPage.refresh();
            control.removePaintListener(this);
        }
    });
}
Also used : Control(org.eclipse.swt.widgets.Control) PaintEvent(org.eclipse.swt.events.PaintEvent) PaintListener(org.eclipse.swt.events.PaintListener) LayoutTplRootEditPart(com.liferay.ide.layouttpl.ui.parts.LayoutTplRootEditPart) EditPart(org.eclipse.gef.EditPart)

Example 77 with PaintListener

use of org.eclipse.swt.events.PaintListener in project core by jcryptool.

the class AlgorithmView method createSearchArea.

/**
 * Creates the search field. On Mac the text does contain a clear (reset) icon which resets
 * the view filter. Since Windows does not support this an additional clear (reset) icon
 * is shown next to the text.
 *
 * @param parent The parent composite
 */
private void createSearchArea(Composite parent) {
    // search field
    final Text search = new Text(parent, SWT.SEARCH | SWT.ICON_CANCEL | SWT.ICON_SEARCH);
    if ((search.getStyle() & SWT.CANCEL) == 0) {
        // reset search button for systems that do not support the cancel icon
        Canvas canvas = new Canvas(parent, SWT.NONE);
        GridData gridData = new GridData();
        gridData.heightHint = 18;
        gridData.widthHint = 18;
        canvas.setLayoutData(gridData);
        canvas.addPaintListener(new PaintListener() {

            public void paintControl(PaintEvent e) {
                // $NON-NLS-1$
                e.gc.drawImage(ViewsPlugin.getImageDescriptor("icons/clear.gif").createImage(), 1, 1);
            }
        });
        canvas.addMouseListener(new MouseAdapter() {

            public void mouseUp(MouseEvent e) {
                search.setText(Messages.AlgorithmView_search_message);
                search.setForeground(COLOR_FILTER_INITIAL);
                initialSearchState = true;
                // $NON-NLS-1$
                treeView.setFilter("");
                // $NON-NLS-1$
                paletteView.setFilter("");
            }
        });
    }
    search.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    search.setText(Messages.AlgorithmView_search_message);
    search.setForeground(COLOR_FILTER_INITIAL);
    search.addMouseListener(new MouseAdapter() {

        public void mouseDown(MouseEvent e) {
            if (initialSearchState) {
                // $NON-NLS-1$
                search.setText("");
                search.setForeground(COLOR_FILTER_USER);
                initialSearchState = false;
            }
        }
    });
    search.addKeyListener(new KeyAdapter() {

        public void keyReleased(KeyEvent e) {
            treeView.setFilter(search.getText());
            paletteView.setFilter(search.getText());
        }
    });
    search.addSelectionListener(new SelectionAdapter() {

        public void widgetDefaultSelected(SelectionEvent e) {
            if (e.detail == SWT.CANCEL) {
                search.setText(Messages.AlgorithmView_search_message);
                search.setForeground(COLOR_FILTER_INITIAL);
                initialSearchState = true;
                // $NON-NLS-1$
                treeView.setFilter("");
                // $NON-NLS-1$
                paletteView.setFilter("");
            }
        }
    });
}
Also used : KeyEvent(org.eclipse.swt.events.KeyEvent) PaintEvent(org.eclipse.swt.events.PaintEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) PaintListener(org.eclipse.swt.events.PaintListener) Canvas(org.eclipse.swt.widgets.Canvas) KeyAdapter(org.eclipse.swt.events.KeyAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) MouseAdapter(org.eclipse.swt.events.MouseAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text)

Example 78 with PaintListener

use of org.eclipse.swt.events.PaintListener in project jbosstools-openshift by jbosstools.

the class AbstractProjectPage method onPageActivated.

@Override
protected void onPageActivated(final DataBindingContext dbc) {
    loadResources(getPreviousPage() == null);
    // fix GTK3 combo boxes too small
    // https://issues.jboss.org/browse/JBIDE-16877,
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=431425
    getControl().addPaintListener(new PaintListener() {

        @Override
        public void paintControl(PaintEvent e) {
            if (getControl().isVisible()) {
                ((Composite) getControl()).layout(true, true);
                ((Composite) getControl()).update();
                getControl().removePaintListener(this);
            }
        }
    });
}
Also used : PaintEvent(org.eclipse.swt.events.PaintEvent) PaintListener(org.eclipse.swt.events.PaintListener)

Example 79 with PaintListener

use of org.eclipse.swt.events.PaintListener in project whole by wholeplatform.

the class LanguageWorkbenchSplashHandler method init.

public void init(Shell splash) {
    super.init(splash);
    IProduct product = Platform.getProduct();
    if (product == null) {
        getContent();
        return;
    }
    String progressPosition = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT);
    setProgressRect(StringConverter.asRectangle(progressPosition, new Rectangle(0, 0, 300, 15)));
    String messagePosition = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT);
    setMessageRect(StringConverter.asRectangle(messagePosition, new Rectangle(0, 35, 300, 15)));
    String foreground = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR);
    int foregroundColor;
    try {
        foregroundColor = Integer.parseInt(foreground, 16);
    } catch (NumberFormatException e) {
        // off white
        foregroundColor = 0xD2D7FF;
    }
    setForeground(new RGB((foregroundColor & 0xFF0000) >> 16, (foregroundColor & 0xFF00) >> 8, foregroundColor & 0xFF));
    getContent().addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent e) {
            e.gc.setForeground(getForeground());
            e.gc.drawText(Platform.getBundle("org.whole.product.lw").getVersion().toString(), 250, 52, true);
        }
    });
}
Also used : PaintEvent(org.eclipse.swt.events.PaintEvent) PaintListener(org.eclipse.swt.events.PaintListener) Rectangle(org.eclipse.swt.graphics.Rectangle) IProduct(org.eclipse.core.runtime.IProduct) RGB(org.eclipse.swt.graphics.RGB)

Example 80 with PaintListener

use of org.eclipse.swt.events.PaintListener in project watchdog by TestRoots.

the class EditorListener method listenToEditorScrolling.

private void listenToEditorScrolling() {
    styledText = (StyledText) editor.getAdapter(Control.class);
    if (styledText == null) {
        return;
    }
    // creates a listener for when the user moves the caret (cursor)
    caretListener = new CaretListener() {

        @Override
        public void caretMoved(CaretEvent event) {
            WatchDogEventType.CARET_MOVED.process(editor);
        // cursor place changed
        }
    };
    styledText.addCaretListener(caretListener);
    // creates a listener for redraws of the view, e.g. when scrolled
    paintListener = new PaintListener() {

        @Override
        public void paintControl(PaintEvent e) {
            WatchDogEventType.PAINT.process(editor);
        }
    };
    styledText.addPaintListener(paintListener);
    focusListener = new FocusListener() {

        @Override
        public void focusLost(FocusEvent e) {
        }

        @Override
        public void focusGained(FocusEvent e) {
            WatchDogEventType.ACTIVE_FOCUS.process(editor);
        }
    };
    styledText.addFocusListener(focusListener);
}
Also used : CaretEvent(org.eclipse.swt.custom.CaretEvent) CaretListener(org.eclipse.swt.custom.CaretListener) PaintEvent(org.eclipse.swt.events.PaintEvent) PaintListener(org.eclipse.swt.events.PaintListener) FocusListener(org.eclipse.swt.events.FocusListener) FocusEvent(org.eclipse.swt.events.FocusEvent)

Aggregations

PaintListener (org.eclipse.swt.events.PaintListener)89 PaintEvent (org.eclipse.swt.events.PaintEvent)88 Canvas (org.eclipse.swt.widgets.Canvas)32 Composite (org.eclipse.swt.widgets.Composite)29 MouseEvent (org.eclipse.swt.events.MouseEvent)26 GridData (org.eclipse.swt.layout.GridData)26 Rectangle (org.eclipse.swt.graphics.Rectangle)25 Point (org.eclipse.swt.graphics.Point)23 GridLayout (org.eclipse.swt.layout.GridLayout)22 MouseAdapter (org.eclipse.swt.events.MouseAdapter)15 SelectionEvent (org.eclipse.swt.events.SelectionEvent)15 DisposeEvent (org.eclipse.swt.events.DisposeEvent)14 DisposeListener (org.eclipse.swt.events.DisposeListener)14 FillLayout (org.eclipse.swt.layout.FillLayout)14 Control (org.eclipse.swt.widgets.Control)14 ControlEvent (org.eclipse.swt.events.ControlEvent)13 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)12 Event (org.eclipse.swt.widgets.Event)11 GC (org.eclipse.swt.graphics.GC)10 Button (org.eclipse.swt.widgets.Button)10