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

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

Introduction

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

Prototype

int INFOPOPUP_SHELLSTYLE

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

Click Source Link

Document

Shell style appropriate for an info popup that can get focus.

Usage

From source file:bndtools.utils.MessagesPopupDialog.java

License:Open Source License

public MessagesPopupDialog(Control controlAttachment, IMessage[] messages, IWorkbenchPart part) {
    super(null, PopupDialog.INFOPOPUP_SHELLSTYLE, true, false, false, false, false, null, null);
    this.controlAttachment = controlAttachment;
    this.messages = messages;
    this.part = part;

    this.hyperlinkGroup = new HyperlinkGroup(controlAttachment.getDisplay());
    this.hyperlinkGroup.setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_ALWAYS);

}

From source file:com.aptana.scripting.keybindings.internal.KeybindingsManager.java

License:Open Source License

private void popup(final Shell shell, final IBindingService bindingService,
        final IContextService contextService, final ICommandElementsProvider commandElementsProvider,
        final List<CommandElement> commandElements, final Event event, final Binding binding,
        final Point initialLocation) {
    PopupDialog popupDialog = new PopupDialog(shell, PopupDialog.INFOPOPUP_SHELLSTYLE, true, false, false,
            false, false, null, null) {//from  ww w.j  a va2 s  .  c  om

        @Override
        protected Point getInitialLocation(Point initialSize) {
            Display display = shell.getDisplay();
            Point cursorLocation = display.getCursorLocation();
            if (initialLocation != null) {
                // Warp the cursor ?
                // if (!cursorLocation.equals(initialLocation))
                // {
                // display.setCursorLocation(initialLocation);
                // }
                return initialLocation;
            }
            return cursorLocation;
        }

        protected Control createDialogArea(Composite parent) {

            registerShellType();

            // Create a composite for the dialog area.
            final Composite composite = new Composite(parent, SWT.NONE);
            final GridLayout compositeLayout = new GridLayout();
            compositeLayout.marginHeight = 1;
            compositeLayout.marginWidth = 1;
            composite.setLayout(compositeLayout);
            composite.setLayoutData(new GridData(GridData.FILL_BOTH));

            // Layout the table.
            final Table commandElementTable = new Table(composite,
                    SWT.FULL_SELECTION | SWT.SINGLE | SWT.NO_SCROLL);
            final GridData gridData = new GridData(GridData.FILL_BOTH);
            commandElementTable.setLayoutData(gridData);
            commandElementTable.setLinesVisible(true);

            // Initialize the columns and rows.
            final TableColumn columnCommandName = new TableColumn(commandElementTable, SWT.LEFT, 0);
            final TableColumn columnAccelerator = new TableColumn(commandElementTable, SWT.CENTER, 1);

            int mnemonic = 0;
            for (CommandElement commandElement : commandElements) {
                final String[] text = { commandElement.getDisplayName(),
                        (mnemonic < MNEMONICS.length() ? String.valueOf(MNEMONICS.charAt(mnemonic++)) : "") }; //$NON-NLS-1$
                final TableItem item = new TableItem(commandElementTable, SWT.NULL);
                item.setText(text);
                item.setData(CommandElement.class.getName(), commandElement);
            }

            if (binding != null) {
                ParameterizedCommand originalParameterizedCommand = binding.getParameterizedCommand();
                // Add original command
                if (originalParameterizedCommand != null) {
                    try {
                        String name = originalParameterizedCommand.getName();
                        final TableItem item = new TableItem(commandElementTable, SWT.NULL);
                        item.setText(new String[] { name,
                                (mnemonic < MNEMONICS.length() ? String.valueOf(MNEMONICS.charAt(mnemonic++))
                                        : "") }); //$NON-NLS-1$
                        item.setData(ParameterizedCommand.class.getName(), originalParameterizedCommand);
                    } catch (NotDefinedException nde) {
                        IdeLog.logError(ScriptingActivator.getDefault(), nde.getMessage(), nde);
                    }
                }
            }

            Dialog.applyDialogFont(parent);
            columnAccelerator.pack();
            columnCommandName.pack();
            columnAccelerator.setWidth(columnAccelerator.getWidth() * 4);

            /*
             * If the user double-clicks on the table row, it should execute the selected command.
             */
            commandElementTable.addListener(SWT.DefaultSelection, new Listener() {
                public final void handleEvent(final Event event) {
                    // Try to execute the corresponding command.
                    Object commandElement = null;
                    Object parameterizedCommand = null;
                    final TableItem[] selection = commandElementTable.getSelection();
                    if (selection.length > 0) {
                        commandElement = selection[0].getData(CommandElement.class.getName());
                        parameterizedCommand = selection[0].getData(ParameterizedCommand.class.getName());
                    }
                    close();
                    if (commandElement instanceof CommandElement) {
                        executeCommandElement(commandElementsProvider, (CommandElement) commandElement);
                    } else if (parameterizedCommand instanceof ParameterizedCommand) {
                        try {
                            executeCommand(binding, event);
                        } catch (CommandException e) {
                            IdeLog.logError(ScriptingActivator.getDefault(), e.getMessage(), e);
                        }
                    }
                }
            });

            commandElementTable.addKeyListener(new KeyListener() {
                public void keyReleased(KeyEvent e) {
                }

                public void keyPressed(KeyEvent e) {
                    if (!e.doit) {
                        return;
                    }
                    int index = MNEMONICS.indexOf(e.character);
                    if (index != -1) {
                        if (index < commandElementTable.getItemCount()) {
                            e.doit = false;
                            TableItem tableItem = commandElementTable.getItem(index);
                            Object commandElement = tableItem.getData(CommandElement.class.getName());
                            Object parameterizedCommand = tableItem
                                    .getData(ParameterizedCommand.class.getName());
                            close();
                            if (commandElement instanceof CommandElement) {
                                executeCommandElement(commandElementsProvider, (CommandElement) commandElement);
                            } else if (parameterizedCommand instanceof ParameterizedCommand) {
                                try {
                                    executeCommand(binding, event);
                                } catch (CommandException ex) {
                                    IdeLog.logError(ScriptingActivator.getDefault(), ex.getMessage(), ex);
                                }
                            }
                        }
                    }
                }
            });
            return composite;
        }

        protected Color getBackground() {
            return getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
        }

        @Override
        protected Control createContents(Composite parent) {
            return super.createContents(parent);
        }

        @Override
        public int open() {
            showingCommandsMenu = true;
            bindingService.setKeyFilterEnabled(false);
            return super.open();
        }

        @Override
        public boolean close() {
            boolean closed = super.close();
            if (closed) {
                showingCommandsMenu = false;
                bindingService.setKeyFilterEnabled(true);
            }
            return closed;
        }

        /**
         * Registers the shell as the same type as its parent with the context support. This ensures that it does
         * not modify the current state of the application.
         */
        private final void registerShellType() {
            final Shell shell = getShell();
            contextService.registerShell(shell, contextService.getShellType((Shell) shell.getParent()));
        }
    };

    popupDialog.open();
}

From source file:com.aptana.snippets.ui.views.SnippetPopupDialog.java

License:Open Source License

public SnippetPopupDialog(Shell shell, SnippetElement snippet, Control positionTarget) {
    super(shell, PopupDialog.INFOPOPUP_SHELLSTYLE, true, true, false, false, false, snippet.getDisplayName(),
            null);//from  ww w. j  ava 2 s . co m
    this.positionTarget = positionTarget;
    this.snippet = snippet;
    colorManager = new ColorManager();
    tabChar = Platform.getOS().equals(Platform.OS_MACOSX) ? "\u21E5" : "\u00bb"; //$NON-NLS-1$ //$NON-NLS-2$ 
}

From source file:com.aptana.ui.QuickMenuDialog.java

License:Open Source License

public QuickMenuDialog(Shell parent) {
    super(parent, PopupDialog.INFOPOPUP_SHELLSTYLE, true, false, false, false, false, null, null);
}

From source file:com.subgraph.vega.ui.http.dialogs.PopupConfigDialog.java

License:Open Source License

public PopupConfigDialog(Shell parentShell, Point origin, IConfigDialogContent content) {
    super(parentShell, PopupDialog.INFOPOPUP_SHELLSTYLE, true, false, false, false, false, content.getTitle(),
            "Press 'ESC' to close");
    this.origin = origin;
    this.content = content;
}

From source file:com.subgraph.vega.ui.http.intercept.config.ConfigureInterceptionPanel.java

License:Open Source License

public ConfigureInterceptionPanel(Shell parent, Point point, IModel model, TransactionDirection direction) {
    super(parent, PopupDialog.INFOPOPUP_SHELLSTYLE | SWT.ON_TOP, true, false, false, false, false,
            "Interceptor Options", "Press 'ESC' to close");
    this.model = model;
    final IWorkspace workspace = model.getCurrentWorkspace();
    final IHttpConditionManager conditionManager = (workspace == null) ? (null)
            : (workspace.getHttpConditionMananger());
    this.conditionInput = new ConditionInput(conditionManager);
    this.direction = direction;
    this.conditionSetEventHandler = createConditionSetEventHandler();
    this.conditionSet = model.addConditionSetTracker(getConditionSetName(), conditionSetEventHandler);
    p = point;//from  w  ww.j a v  a  2  s .c  o  m
    create();
}

From source file:eu.compassresearch.ide.collaboration.ui.menu.CollaborationNotificationPopUp.java

License:Open Source License

public CollaborationNotificationPopUp(IWorkbenchWindow window, CollaborationView collaborationview) {
    super(window.getShell(), PopupDialog.INFOPOPUP_SHELLSTYLE | SWT.ON_TOP, false, false, false, false, false,
            null, null);/*from w  ww  . j  a v  a2  s . c o  m*/
    this.window = window;
    collabview = collaborationview;
}

From source file:gov.nasa.ensemble.common.ui.multiselect.AbstractInPlaceDialog.java

License:Open Source License

public AbstractInPlaceDialog(Shell parent, int side, Control openControl) {
    super(parent, PopupDialog.INFOPOPUP_SHELLSTYLE, false, false, false, false, false, null, null);
    this.side = side;
    this.openControl = openControl;

    Rectangle bounds;/*  ww  w  .j  a  va2 s  .  c  om*/
    if (openControl == null || openControl.isDisposed()) {
        bounds = new Rectangle(0, 0, 0, 0);
    } else {
        bounds = openControl.getBounds();
        Point absPosition = openControl.toDisplay(openControl.getLocation());
        bounds.x = absPosition.x - bounds.x;
        bounds.y = absPosition.y - bounds.y;
    }
    this.controlBounds = bounds;
    if (openControl != null) {
        openControl.addDisposeListener(disposeListener);
    }

}

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

License:Open Source License

/**
 * The constructor//from  w ww .  j  av  a  2 s.c o  m
 *
 * @param shell
 *            is the shell of the SuggestionBubble that is parent of this
 *            dialog
 * @param parent
 *            is the parent of this dialog.
 */
public PartialTranslationDialog(Shell shell, SuggestionBubble parent) {
    this.parent = parent;
    this.shell = shell;

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

}

From source file:org.eclipse.e4.ui.bindings.internal.KeyAssistDialog.java

License:Open Source License

/**
 * Constructs a new instance of <code>KeyAssistDialog</code>. When the dialog is first
 * constructed, it contains no widgets. The dialog is first created with no parent. If a parent
 * is required, call <code>setParentShell()</code>. Also, between uses, it might be necessary to
 * call <code>setParentShell()</code> as well.
 * //from  w  w  w  .ja va  2  s.co m
 * @param context
 *            The context in which this dialog is created; must not be <code>null</code>.
 * @param associatedKeyboard
 *            The key binding listener for the workbench; must not be <code>null</code>.
 */
public KeyAssistDialog(IEclipseContext context, KeyBindingDispatcher associatedKeyboard) {
    super((Shell) null, PopupDialog.INFOPOPUP_SHELLSTYLE, true, false, false, false, null, null);
    //super(null, PopupDialog.INFOPOPUP_SHELLSTYLE, true, false, false, false, false, DIALOG_TITLE, getKeySequenceString()); //$NON-NLS-1$

    this.context = context;
    this.workbenchKeyboard = associatedKeyboard;
}