Example usage for org.eclipse.jface.dialogs PopupDialog POPUP_IMG_MENU

List of usage examples for org.eclipse.jface.dialogs PopupDialog POPUP_IMG_MENU

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs PopupDialog POPUP_IMG_MENU.

Prototype

String POPUP_IMG_MENU

To view the source code for org.eclipse.jface.dialogs PopupDialog POPUP_IMG_MENU.

Click Source Link

Document

Image registry key for menu image.

Usage

From source file:com.xored.glance.ui.panels.SearchPanel.java

License:Open Source License

protected ToolItem createSettingsMenu(final ToolBar bar) {
    final ToolItem settings = new ToolItem(bar, SWT.PUSH);
    settings.setImage(JFaceResources.getImage(PopupDialog.POPUP_IMG_MENU));
    settings.setDisabledImage(JFaceResources.getImage(PopupDialog.POPUP_IMG_MENU_DISABLED));
    settings.setToolTipText("Settings"); //$NON-NLS-1$
    settings.addSelectionListener(new SelectionAdapter() {
        @Override/*from w  w w.j a v a2s .c  o  m*/
        public void selected(final SelectionEvent e) {
            showSettings();
        }
    });
    return settings;
}

From source file:org.locationtech.udig.ui.filter.ExpressionViewer.java

License:Open Source License

/**
 * Creates an ExpressionViewer using the provided style.
 * <ul>/*from  ww w  . j a  v  a 2s . c o  m*/
 * <li>SWT.SINGLE - A simple text field showing the expression using extended CQL notation
 * <li>
 * <li>SWT.MULTI - A multi line text field</li>
 * <li>SWT.READ_ONLY - read only display of a expression</li>
 * </ul>
 * 
 * @param parent
 * @param style
 */
public ExpressionViewer(Composite parent, int style) {
    control = new Composite(parent, SWT.NO_SCROLL) {
        public void setEnabled(boolean enabled) {
            super.setEnabled(enabled);
            config.setEnabled(enabled);
            if (delegate != null) {
                config.setEnabled(enabled);
            }
            if (input != null && input.getFeedback() != null && input.getFeedback().getControl() != null) {
                input.getFeedback().getControl().setEnabled(enabled);
            }
        }
    };

    control.setLayout(new MigLayout("insets 0", "[fill][]", "[fill]"));

    pageBook = new PageBook(control, SWT.NO_SCROLL);
    pageBook.setLayoutData("cell 0 0,grow,width 200:100%:100%,height 18:75%:100%");

    placeholder = new Label(pageBook, SWT.SINGLE);
    placeholder.setText("Choose expression editor");

    delegate = new CQLExpressionViewer(pageBook, style);
    delegate.addSelectionChangedListener(listener);
    pageBook.showPage(delegate.getControl());

    this.pages = new HashMap<String, IExpressionViewer>();
    pages.put(ExpressionViewerFactory.CQL_EXPRESSION_VIEWER, delegate);

    config = new Label(control, SWT.SINGLE);
    config.setImage(JFaceResources.getImage(PopupDialog.POPUP_IMG_MENU));
    config.setLayoutData("cell 1 0,aligny top,height 16!, width 16!");

    createContextMenu(config);
    config.addMouseListener(new MouseAdapter() {
        public void mouseDown(org.eclipse.swt.events.MouseEvent e) {
            Menu menu = config.getMenu();
            if (menu != null) {
                menu.setVisible(true);
            }
        }
    });
    this.style = style;
}

From source file:org.locationtech.udig.ui.filter.FilterViewer.java

License:Open Source License

/**
 * Creates an FilterViewer using the provided style.
 * <ul>/*from  w  ww . ja v a2 s .co  m*/
 * <li>SWT.SINGLE - A simple text field showing the expression using extended CQL notation
 * <li>
 * <li>SWT.MULTI - A multi line text field</li>
 * <li>SWT.READ_ONLY - read only display of a filter</li>
 * </ul>
 * 
 * @param parent
 * @param style
 */
public FilterViewer(Composite parent, int style) {
    control = new Composite(parent, SWT.NO_SCROLL) {
        @Override
        public void setEnabled(boolean enabled) {
            super.setEnabled(enabled);
            config.setEnabled(enabled);
            if (delegate != null) {
                config.setEnabled(enabled);
            }
            if (input != null && input.getFeedback() != null && input.getFeedback().getControl() != null) {
                Control feedbackLabel = input.getFeedback().getControl();
                Display display = feedbackLabel.getDisplay();
                feedbackLabel.setEnabled(enabled);
                if (enabled) {
                    feedbackLabel.setForeground(display.getSystemColor(SWT.COLOR_TITLE_FOREGROUND));
                } else {
                    feedbackLabel.setForeground(display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
                }
            }
        }
    };
    control.setLayout(new MigLayout("insets 0", "[fill][]", "[fill]"));

    pageBook = new PageBook(control, SWT.NO_SCROLL);
    pageBook.setLayoutData("cell 0 0,grow,width 200:100%:100%,height 18:75%:100%");

    placeholder = new Label(pageBook, SWT.SINGLE);
    placeholder.setText("Choose filter editor");

    delegate = new CQLFilterViewer(pageBook, style);
    delegate.addSelectionChangedListener(listener);
    pageBook.showPage(delegate.getControl());

    this.pages = new HashMap<String, IFilterViewer>();
    pages.put(FilterViewerFactory.CQL_FILTER_VIEWER, delegate);

    config = new Label(control, SWT.SINGLE);
    config.setImage(JFaceResources.getImage(PopupDialog.POPUP_IMG_MENU));
    config.setLayoutData("cell 1 0,aligny top,height 16!, width 16!");

    createContextMenu(config);

    config.addMouseListener(new MouseAdapter() {
        public void mouseDown(org.eclipse.swt.events.MouseEvent e) {
            Menu menu = config.getMenu();
            if (menu != null) {
                menu.setVisible(true);
            }
        }
    });
    this.style = style;
}