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

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

Introduction

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

Prototype

int INFOPOPUPRESIZE_SHELLSTYLE

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

Click Source Link

Document

Shell style appropriate for a resizable info popup that can get focus.

Usage

From source file:com.aptana.ui.dialogs.GenericInfoPopupDialog.java

License:Open Source License

public GenericInfoPopupDialog(Shell parentShell, String title, String message, final Runnable runnable) {
    super(parentShell, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE | SWT.MODELESS, false, true, true, false, false,
            title, null);/*from w w  w . j a  v  a2 s.  com*/
    this.message = message;

    clickListener = new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent e) {
            if (runnable != null) {
                runnable.run();
            }
            close();
        }
    };
}

From source file:com.aptana.ui.dialogs.TitaniumUpdatePopup.java

License:Open Source License

public TitaniumUpdatePopup(Shell parentShell, final Runnable updateAction) {
    super(parentShell, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE | SWT.MODELESS, false, true, true, false, false,
            EplMessages.TitaniumUpdatePopup_update_title, null);

    clickListener = new MouseAdapter() {
        public void mouseDown(MouseEvent e) {
            updateAction.run();/*w  w  w .j a  va 2s . c  o m*/
            close();
        }
    };

}

From source file:com.liferay.ide.project.ui.upgrade.animated.InitConfigureProjectPage.java

License:Open Source License

@Override
public void createSpecialDescriptor(Composite parent, int style) {
    Composite fillLayoutComposite = SWTUtil.createComposite(parent, 2, 2, GridData.FILL_HORIZONTAL);

    final String descriptor = "The initial step will be to upgrade to Liferay Workspace or Liferay Plugins SDK 7.0. "
            + "For more details, please see <a>dev.liferay.com</a>.";

    String url = "https://dev.liferay.com/develop/tutorials";

    SWTUtil.createHyperLink(fillLayoutComposite, SWT.WRAP, descriptor, 1, url);

    final String extensionDec = "The first step will help you convert a Liferay Plugins SDK 6.2 to Liferay Plugins SDK 7.0 or to Liferay Workspace.\n"
            + "Click the \"import\" button to import your project into Eclipse workspace"
            + "(this process maybe need 5-10 mins for bundle init).\n" + "Note:\n"
            + "       In order to save time, downloading 7.0 ivy cache locally could be a good choice to upgrade to liferay plugins sdk 7. \n"
            + "       Theme and ext projects will be ignored for that we do not support to upgrade them in this tool currently. \n";

    Label image = new Label(fillLayoutComposite, SWT.WRAP);
    image.setImage(loadImage("question.png"));

    PopupDialog popupDialog = new PopupDialog(fillLayoutComposite.getShell(),
            PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, false, false, false, false, null, null) {
        private static final int CURSOR_SIZE = 15;

        protected Point getInitialLocation(Point initialSize) {
            Display display = getShell().getDisplay();
            Point location = display.getCursorLocation();
            location.x += CURSOR_SIZE;//from  w  ww  .ja v a 2 s  .  c  om
            location.y += CURSOR_SIZE;
            return location;
        }

        protected Control createDialogArea(Composite parent) {
            Label label = new Label(parent, SWT.WRAP);
            label.setText(extensionDec);
            label.setFont(new Font(null, "Times New Roman", 11, SWT.NORMAL));
            GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH);
            gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING;
            gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING;
            label.setLayoutData(gd);
            return label;
        }
    };

    image.addListener(SWT.MouseHover, new org.eclipse.swt.widgets.Listener() {
        @Override
        public void handleEvent(org.eclipse.swt.widgets.Event event) {
            popupDialog.open();
        }
    });

    image.addListener(SWT.MouseExit, new org.eclipse.swt.widgets.Listener() {
        @Override
        public void handleEvent(org.eclipse.swt.widgets.Event event) {
            popupDialog.close();
        }
    });
}

From source file:com.reprezen.swagedit.core.editor.outline.QuickOutline.java

License:Open Source License

public QuickOutline(Shell parent, JsonEditor editor, String fileContentType) {
    super(parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, true, true, true, true, null, null);
    this.fileContentType = fileContentType;

    IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench()
            .getAdapter(IBindingService.class);
    this.bindingKey = bindingService.getBestActiveBindingFormattedFor(COMMAND_ID);
    this.triggerSequence = bindingService.getBestActiveBindingFor(COMMAND_ID);
    this.editor = editor;

    setInfoText(statusMessage());// www  . ja v  a  2  s.c  o  m
    create();
}

From source file:com.reprezen.swagedit.editor.outline.QuickOutline.java

License:Open Source License

public QuickOutline(Shell parent, SwaggerEditor editor) {
    super(parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, true, true, true, true, null, null);

    IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench()
            .getAdapter(IBindingService.class);
    this.bindingKey = bindingService.getBestActiveBindingFormattedFor(COMMAND_ID);
    this.triggerSequence = bindingService.getBestActiveBindingFor(COMMAND_ID);
    this.editor = editor;

    setInfoText(statusMessage());/*from   w ww  .j ava 2  s  .  c om*/
    create();
}

From source file:de.jcup.egradle.eclipse.ui.AbstractFilterableTreeQuickDialog.java

License:Apache License

/**
 * Creates a quick outline dialog containing a filterable tree
 * /*from  w w  w  .  j  ava2 s.  c o  m*/
 * @param adaptable
 *            adaptable which can be used by child class implementations
 * @param parent
 *            shell to use is null the outline will have no content! If the
 *            gradle editor is null location setting etc. will not work.
 * @param title
 *            title for dialog
 * @param minWidth
 * @param minHeight
 * @param infoText
 *            additional information to show at the bottom of dialogs
 */
public AbstractFilterableTreeQuickDialog(IAdaptable adaptable, Shell parent, String title, int minWidth,
        int minHeight, String infoText) {
    super(parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, GRAB_FOCUS, PERSIST_SIZE, PERSIST_BOUNDS,
            DO_SHOW_DIALOG, SHOW_PERSIST_ACTIONS, title, infoText);
    this.minWidth = minWidth;
    this.minHeight = minHeight;

    contentProvider = createTreeContentProvider(adaptable);

    if (contentProvider == null) {
        contentProvider = new FallbackOutlineContentProvider();
    }
}

From source file:de.jcup.egradle.eclipse.ui.QuickLaunchDialog.java

License:Apache License

public QuickLaunchDialog(Shell parent) {
    super(parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, GRAB_FOCUS, PERSIST_SIZE, PERSIST_BOUNDS,
            SHOW_DIALOG_MENU, SHOW_PERSIST_ACTIONS, TITLE, INFOTEXT);
}

From source file:org.eclipse.babel.editor.widgets.suggestion.PartialTranslationDialog.java

License:Open Source License

private void createDialog(final int shellStyle) {
    // int shellStyle = PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE;
    boolean takeFocusOnOpen = false;
    boolean persistSize = false;
    boolean persistLocation = false;
    boolean showDialogMenu = false;
    boolean showPersistActions = false;
    String titleText = null;//w  ww. j  a va2s  . co m
    dialog = new PopupDialog(shell, shellStyle, takeFocusOnOpen, persistSize, persistLocation, showDialogMenu,
            showPersistActions, titleText, infoText) {

        @Override
        protected Control createDialogArea(Composite parent) {
            composite = (Composite) super.createDialogArea(parent);

            composite.setLayout(new GridLayout(2, false));

            final Button button = new Button(composite, SWT.PUSH);
            button.setText("Apply");
            button.setEnabled(false);
            button.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    NullableText nText = (NullableText) PartialTranslationDialog.this.parent.getTextField()
                            .getParent();

                    nText.setText(PartialTranslationDialog.this.parent.getTextField().getText()
                            + textField.getSelectionText(), true);

                    PartialTranslationDialog.this.parent.dispose();
                }

                @Override
                public void widgetDefaultSelected(SelectionEvent e) {
                }

            });

            Label label = new Label(composite, SWT.NONE);
            label.setText("Selected translation");

            FontData fontData = label.getFont().getFontData()[0];
            Font font = new Font(label.getDisplay(),
                    new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
            label.setFont(font);

            // Invisible separator
            new Label(composite, SWT.NONE);

            textField = new Text(composite, SWT.V_SCROLL | SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | orientation);
            textField.setText(text);
            textField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
            textField.addListener(SWT.MouseUp, new Listener() {
                @Override
                public void handleEvent(Event event) {
                    Text text = (Text) event.widget;

                    String selection = text.getSelectionText();

                    if (selection.length() > 0 && !SuggestionErrors.contains(textField.getText())) {
                        button.setEnabled(true);
                    } else {
                        button.setEnabled(false);
                    }
                }
            });

            Listener scrollBarListener = new Listener() {
                @Override
                public void handleEvent(Event event) {
                    Text t = (Text) event.widget;
                    Rectangle r1 = t.getClientArea();
                    Rectangle r2 = t.computeTrim(r1.x, r1.y, r1.width, r1.height);
                    Point p = t.computeSize(composite.getSize().x, SWT.DEFAULT, true);
                    t.getVerticalBar().setVisible(r2.height <= p.y);
                }
            };

            textField.addListener(SWT.Resize, scrollBarListener);

            return composite;
        }

        @Override
        protected void adjustBounds() {
            super.adjustBounds();

            Point start = parent.getCurrentLocation();
            Point size = parent.getSize();

            int x = start.x + size.x;
            int y = start.y;
            int screenWidth = Display.getCurrent().getBounds().width;

            if (screenWidth - x <= 200) {
                x = start.x - 450;
            }

            getShell().setLocation(x, y);

            if (screenWidth - x < 450) {
                getShell().setSize(screenWidth - x, 200);
            } else {
                getShell().setSize(450, 200);
            }
        }

        @Override
        protected void configureShell(Shell shell) {
            super.configureShell(shell);

            if (win) {
                shell.addFocusListener(new FocusListener() {

                    @Override
                    public void focusGained(FocusEvent e) {
                        if (shellStyle == INFOPOPUPRESIZE_SHELLSTYLE || dialog == null) {
                            return;
                        }
                        dialog.close();
                        infoText = FOOT_NOTE_2;
                        createDialog(PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE);
                        dialog.open();
                        dialog.getShell().setFocus();
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                    }
                });
            }
        }
    };
}

From source file:org.eclipse.babel.editor.widgets.suggestion.SuggestionBubble.java

License:Open Source License

/**
 * Constructor//w  ww .j  a  v  a 2s  . co  m
 *
 * @param parent
 *            is the parent {@link Text} object, to which SuggestionBubble
 *            will be added.
 * @param targetLanguage
 *            is the language, to which the
 *            {@link SuggestionBubble.defaultText} will be translated
 */
public SuggestionBubble(Text parent, String targetLanguage) {
    shell = parent.getShell();
    text = parent;
    this.targetLanguage = targetLanguage;

    suggestionFilter = new SuggestionFilter();
    suggestions = new ArrayList<Suggestion>();

    String srcLang = System.getProperty("tapiji.translator.default.language");
    if (srcLang != null) {
        SRC_LANG = srcLang.substring(0, 2).toUpperCase();
    }

    if (System.getProperty("os.name").toLowerCase().contains("windows")) {
        SHELL_STYLE = PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE;
        win = true;
    } else {
        SHELL_STYLE = PopupDialog.HOVER_SHELLSTYLE;
        win = false;
    }

    // MessagesEditorPlugin.getDefault().getBundle().
    // getEntry("glossary.xml").getPath()
    // System.out.println("install path "+MessagesEditorPlugin.getDefault().getBundle().getEntry("/").getPath()+"glossary.xml");

    SuggestionProviderUtils.addSuggestionProviderUpdateListener(this);

    /*
     * Read shortcut of content assist (code completion) directly from
     * org.eclipse.ui.IWorkbenchCommandConstants.EDIT_CONTENT_ASSIST and
     * save it to CONTENT_ASSIST final variable
     */
    IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench()
            .getAdapter(IBindingService.class);

    CONTENT_ASSIST = bindingService
            .getBestActiveBindingFormattedFor(IWorkbenchCommandConstants.EDIT_CONTENT_ASSIST);

    init();
}

From source file:org.eclipse.debug.ui.DebugPopup.java

License:Open Source License

/**
 * Constructs a new popup dialog of type <code>PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE</code>
 * @param parent The parent shell//  www.  j  a  v  a 2  s.  co m
 * @param anchor point at which to anchor the popup dialog in Display coordinate space.
 *    Since 3.3, <code>null</code> can be specified to use a default anchor point
 * @param commandId The command id to be used for persistence of 
 *  the dialog, or <code>null</code>
 */
public DebugPopup(Shell parent, Point anchor, String commandId) {
    super(parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, true, false, true, false, null, null);
    fAnchor = anchor;
    fCommandId = commandId;
}