org.eclipse.jface.dialogs.PopupDialog Java Examples

The following examples show how to use org.eclipse.jface.dialogs.PopupDialog. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Popup2.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
public Popup2(final IPopupProvider provider, final Widget... controls) {
	super(WorkbenchHelper.getShell(), PopupDialog.HOVER_SHELLSTYLE, false, false, false, false, false, null, null);
	this.provider = provider;
	final Shell parent = provider.getControllingShell();
	parent.addListener(SWT.Move, hide);
	parent.addListener(SWT.Resize, hide);
	parent.addListener(SWT.Close, hide);
	parent.addListener(SWT.Deactivate, hide);
	parent.addListener(SWT.Hide, hide);
	parent.addListener(SWT.Dispose, event -> close());
	for (final Widget c : controls) {
		if (c == null) {
			continue;
		}
		final TypedListener typedListener = new TypedListener(mtl);
		c.addListener(SWT.MouseEnter, typedListener);
		c.addListener(SWT.MouseExit, typedListener);
		c.addListener(SWT.MouseHover, typedListener);
	}
}
 
Example #2
Source File: GenericInfoPopupDialog.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
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);
	this.message = message;

	clickListener = new MouseAdapter()
	{

		@Override
		public void mouseDown(MouseEvent e)
		{
			if (runnable != null)
			{
				runnable.run();
			}
			close();
		}
	};
}
 
Example #3
Source File: BonitaContentProposalAdapter.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent) {
    text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP | SWT.NO_FOCUS);

    // Use the compact margins employed by PopupDialog.
    final GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH);
    gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING;
    gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING;
    text.setLayoutData(gd);
    text.setText(contents);

    // since SWT.NO_FOCUS is only a hint...
    text.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(final FocusEvent event) {
            ContentProposalPopup.this.close();
        }
    });
    return text;
}
 
Example #4
Source File: XFindPanel.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
protected ToolItem createSettingsMenu(final ToolBar bar) {
    bSettings = new ToolItem(bar, SWT.PUSH);
    bSettings.setImage(JFaceResources.getImage(PopupDialog.POPUP_IMG_MENU));
    bSettings.setDisabledImage(JFaceResources.getImage(PopupDialog.POPUP_IMG_MENU_DISABLED));
    bSettings.setToolTipText(Messages.XFindPanel_ShowSettings_tooltip); //$NON-NLS-1$
    bSettings.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            showSettings();
        }
    });
    return bSettings;
}
 
Example #5
Source File: QuickOutline.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
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());
      create();
  }
 
Example #6
Source File: TitaniumUpdatePopup.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public TitaniumUpdatePopup(Shell parentShell, final Runnable updateAction)
{
	super(parentShell, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE | SWT.MODELESS, false, true, true, false, false,
			MessageFormat.format(EplMessages.TitaniumUpdatePopup_update_title, EclipseUtil.getStudioPrefix()), null);

	clickListener = new MouseAdapter()
	{
		public void mouseDown(MouseEvent e)
		{
			updateAction.run();
			close();
		}
	};

}
 
Example #7
Source File: SelectionDialog.java    From e4macs with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("deprecation")	// backward compatibility
public SelectionDialog(Shell parent, ISelectExecute mini, ITextEditor editor) {
	// Europa compatible constructor
	super((Shell) null, PopupDialog.HOVER_SHELLSTYLE, false, false, false, false, null, null);
	this.editor = editor;
	this.minibuffer = mini;
}
 
Example #8
Source File: BonitaContentProposalAdapter.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void adjustBounds() {
    final Rectangle parentBounds = getParentShell().getBounds();
    Rectangle proposedBounds;
    // Try placing the info popup to the right
    Rectangle rightProposedBounds = new Rectangle(parentBounds.x + parentBounds.width
            + PopupDialog.POPUP_HORIZONTALSPACING, parentBounds.y + PopupDialog.POPUP_VERTICALSPACING,
            parentBounds.width, parentBounds.height);
    rightProposedBounds = getConstrainedShellBounds(rightProposedBounds);
    // If it won't fit on the right, try the left
    if (rightProposedBounds.intersects(parentBounds)) {
        Rectangle leftProposedBounds = new Rectangle(parentBounds.x - parentBounds.width
                - POPUP_HORIZONTALSPACING - 1, parentBounds.y, parentBounds.width, parentBounds.height);
        leftProposedBounds = getConstrainedShellBounds(leftProposedBounds);
        // If it won't fit on the left, choose the proposed bounds
        // that fits the best
        if (leftProposedBounds.intersects(parentBounds)) {
            if (rightProposedBounds.x - parentBounds.x >= parentBounds.x - leftProposedBounds.x) {
                rightProposedBounds.x = parentBounds.x + parentBounds.width
                        + PopupDialog.POPUP_HORIZONTALSPACING;
                proposedBounds = rightProposedBounds;
            } else {
                leftProposedBounds.width = parentBounds.x - POPUP_HORIZONTALSPACING - leftProposedBounds.x;
                proposedBounds = leftProposedBounds;
            }
        } else {
            // use the proposed bounds on the left
            proposedBounds = leftProposedBounds;
        }
    } else {
        // use the proposed bounds on the right
        proposedBounds = rightProposedBounds;
    }
    getShell().setBounds(proposedBounds);
}
 
Example #9
Source File: QuickMenuDialog.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public QuickMenuDialog(Shell parent, String title)
{
	super(parent, PopupDialog.INFOPOPUP_SHELLSTYLE, true, false, false, false, false, title, null);
}
 
Example #10
Source File: BonitaContentProposalAdapter.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
InfoPopupDialog(final Shell parent) {
    super(parent, PopupDialog.HOVER_SHELLSTYLE, false, false, false, false, false, null, null);
}
 
Example #11
Source File: KeyAssistDialog.java    From Pydev with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * 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.
 * 
 * @param workbench
 *            The workbench 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>.
 * @param associatedState
 *            The key binding state associated with the workbench; must not
 *            be <code>null</code>.
 */
@SuppressWarnings("deprecation")
public KeyAssistDialog(final PyEdit pyedit) {
    //Note: had to change to HOVER_SHELLSTYLE instead of INFOPOPUP_SHELLSTYLE because
    //otherwise the focus would end up in a null Control in linux (GTK),
    //which made the dialog show and hide quickly and go out of the ctrl+2 mode.
    //See: http://sourceforge.net/tracker/?func=detail&aid=2984743&group_id=85796&atid=577329
    super((Shell) null, PopupDialog.HOVER_SHELLSTYLE, false, false, false, false, null, null);
    this.setInfoText("   Ctrl+2 actions   ");
}