Example usage for org.eclipse.jface.dialogs IDialogConstants OK_ID

List of usage examples for org.eclipse.jface.dialogs IDialogConstants OK_ID

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants OK_ID.

Prototype

int OK_ID

To view the source code for org.eclipse.jface.dialogs IDialogConstants OK_ID.

Click Source Link

Document

Button id for an "Ok" button (value 0).

Usage

From source file:ca.uvic.chisel.feature.research.ui.internal.ResearchDialog.java

License:Open Source License

@Override
protected void createFormContent(IManagedForm mform) {
    FormToolkit tk = mform.getToolkit();
    ScrolledForm form = mform.getForm();
    form.setText("Thank You For Using Diver");
    form.getBody().setLayout(new GridLayout());
    FormText text = tk.createFormText(form.getBody(), false);
    text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    text.setText(TEXT, true, false);/*  w  ww . j a v  a 2 s  .  co  m*/
    FontData fd = text.getFont().getFontData()[0];
    final Font largefont = new Font(text.getDisplay(), fd.getName(), 11, SWT.NORMAL);
    text.setFont(largefont);
    text.addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(DisposeEvent e) {
            largefont.dispose();
        }
    });
    text.addHyperlinkListener(new IHyperlinkListener() {

        @Override
        public void linkExited(HyperlinkEvent e) {
        }

        @Override
        public void linkEntered(HyperlinkEvent e) {
        }

        @Override
        public void linkActivated(HyperlinkEvent e) {
            Object o = e.getHref();
            if ("participate".equals(o)) {
                setReturnCode(IDialogConstants.OK_ID);
                close();
            }
        }
    });
}

From source file:ca.uvic.chisel.feature.research.ui.internal.ResearchDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create the standard OK and cancel buttons, but reset their text
    super.createButtonsForButtonBar(parent);
    Button b = getButton(IDialogConstants.OK_ID);
    b.setText("Participate >");
    b = getButton(IDialogConstants.CANCEL_ID);
    b.setText("Later");
}

From source file:ca.uvic.cs.tagsea.dialogs.RefreshTagsDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    boolean syncAll = allButton.getSelection();

    super.buttonPressed(buttonId);

    if (buttonId == IDialogConstants.OK_ID) {
        doSynchronize(syncAll);/*from   w w  w . j a  va2s .co m*/
    }
}

From source file:ca.uvic.cs.tagsea.research.UserIDDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    okay = createButton(parent, IDialogConstants.OK_ID, "Get ID", true);
    // create OK and Cancel buttons by default
    finish = createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.FINISH_LABEL, false);
    cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    finish.setEnabled(false);/*from  w  ww. j a v  a  2  s  .  c  om*/
}

From source file:ca.uvic.cs.tagsea.research.UserIDDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.OK_ID:
        okPressed();//from   www  . j a v  a  2 s .  c o m
        break;
    case IDialogConstants.CANCEL_ID:
        cancelPressed();
        break;
    case IDialogConstants.FINISH_ID:
        finishPressed();
        break;
    }
}

From source file:cc.frz.ecl.openproject.OpenProjectAction.java

License:Open Source License

public void run(IAction action) {
    OpenProjectDialog openProjectDialog = new OpenProjectDialog(Display.getCurrent().getActiveShell());
    if (openProjectDialog.open() != IDialogConstants.OK_ID)
        return;/*from w w w. jav a 2  s  . co  m*/

    Object[] res = openProjectDialog.getResult();
    if (res.length == 0) {
        return;
    }

    // find the explorers (!)
    // HACK THE PLANET (!)

    List<ISetSelectionTarget> nav = new ArrayList<ISetSelectionTarget>();
    int openViews = 0;
    IWorkbench workbench = Activator.getDefault().getWorkbench();

    for (IWorkbenchWindow window : workbench.getWorkbenchWindows()) {
        for (IWorkbenchPage page : window.getPages()) {
            for (IViewReference reference : page.getViewReferences()) {
                IWorkbenchPart part = reference.getPart(false);

                if (part != null) {
                    for (Class<?> view : knownViews) {
                        if (view.isAssignableFrom(part.getClass())) {
                            nav.add((ISetSelectionTarget) part);
                            if (page.isPartVisible(part)) {
                                openViews++;
                            }
                        }
                    }
                }
            }
        }
    }

    if (openViews == 0) { // try to open the package explorer
        try {
            nav.add((ISetSelectionTarget) workbench.getActiveWorkbenchWindow().getActivePage()
                    .showView("org.eclipse.jdt.ui.PackageExplorer"));
        } catch (PartInitException e) {
            // didn't work, try the project explorer
            try {
                nav.add((ISetSelectionTarget) workbench.getActiveWorkbenchWindow().getActivePage()
                        .showView("org.eclipse.ui.navigator.ProjectExplorer"));
            } catch (PartInitException e1) {
                // give up
            }
        }
    }
    for (ISetSelectionTarget setSelectionTarget : nav) {
        setSelectionTarget.selectReveal(new StructuredSelection(res[0]));
    }
}

From source file:ch.elexis.base.messages.MsgDetailDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(final Composite parent) {
    String sOK;// w  ww.j a va2s. c o  m
    if (incomingMsg == null) {
        sOK = Messages.MsgDetailDialog_send;
    } else {
        sOK = Messages.MsgDetailDialog_delete;
    }
    bOK = createButton(parent, IDialogConstants.OK_ID, sOK, false);
    parent.getShell().setDefaultButton(bOK);
    bAnswer = createButton(parent, IDialogConstants.CLIENT_ID + 1, Messages.MsgDetailDialog_reply, false);
    if (incomingMsg == null) {
        bAnswer.setEnabled(false);
    }
    createButton(parent, IDialogConstants.CLIENT_ID + 2, Messages.MsgDetailDialog_asReminder, false);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.MsgDetailDialog_cancel, false);
}

From source file:ch.elexis.base.messages.MsgDetailDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.OK_ID:
        okPressed();/*from w w w . java  2 s. c o m*/
        return;
    case IDialogConstants.CLIENT_ID + 1:
        if (incomingMsg != null) {
            Anwender an = incomingMsg.getSender();
            new Message(an, txtMessage.getText());
        }
        okPressed();
    case IDialogConstants.CLIENT_ID + 2:
        StructuredSelection ss = ((StructuredSelection) cbTo.getSelection());
        if (!ss.isEmpty()) {
            Anwender anw = (Anwender) ss.getFirstElement();
            Reminder rem = new Reminder(null, new TimeTool().toString(TimeTool.DATE_GER), Visibility.ALWAYS, "",
                    incomingMsg.get(Message.FLD_TEXT));
            ElexisEventDispatcher.getInstance()
                    .fire(new ElexisEvent(rem, Reminder.class, ElexisEvent.EVENT_CREATE));
            rem.addResponsible(anw);
        }
        okPressed();
    default:
        break;
    }
    super.buttonPressed(buttonId);
}

From source file:ch.elexis.core.ui.contacts.dialogs.AdvancedFilterDialog.java

License:Open Source License

/**
 * Create contents of the button bar.//w  w  w  . j a  v  a2s  .c o m
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button button_1 = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    button_1.setText("Filter anwenden");
    Button btnAbbrechen = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL,
            false);
    btnAbbrechen.setText("Abbrechen");
}

From source file:ch.elexis.core.ui.contacts.dialogs.BezugsKontaktAuswahl.java

License:Open Source License

@Override
public void create() {
    super.create();
    getShell().setText(Messages.Patientenblatt2_kindOfRelation); //$NON-NLS-1$
    if (locked) {
        Button btnOk = getButton(IDialogConstants.OK_ID);
        if (btnOk != null) {
            btnOk.setEnabled(false);/*from   w  ww . j  ava2s.com*/
        }
    }
}