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

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

Introduction

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

Prototype

int CANCEL_ID

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

Click Source Link

Document

Button id for a "Cancel" button (value 1).

Usage

From source file:com.bdaum.zoom.ui.internal.preferences.FileExtensionDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    okButton.setEnabled(false);/* w w  w  .  j  ava  2  s  . c o m*/
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.bluexml.side.application.ui.action.GeneratePopUp.java

License:Open Source License

/**
 * Create contents of the button bar//w  ww  . jav a 2  s .c  o  m
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, Activator.Messages.getString("GeneratePopUp_3"), true);
    createButton(parent, IDialogConstants.CANCEL_ID, Activator.Messages.getString("GeneratePopUp_2"), false);
}

From source file:com.bluexml.side.application.ui.action.GeneratePopUp.java

License:Open Source License

@Override
protected void cancelPressed() {
    generalMonitor.addErrorText(Activator.Messages.getString("GeneratePopUp_0"));
    listener.addButtonPressedListener(IDialogConstants.CANCEL_ID);
    getButton(IDialogConstants.CANCEL_ID).setEnabled(false);
    // super.cancelPressed();
}

From source file:com.bluexml.side.application.ui.action.GeneratePopUp.java

License:Open Source License

/**
 * Method to setup dialog when job's done
 */// w  w  w.j  a  v a 2 s  .  c  o  m
public void displayLink() {
    Display currentDisp = ApplicationUtil.getDisplay();
    currentDisp.syncExec(new Runnable() {
        public void run() {
            final String logPath = getGeneralMonitor().getConsoleLog().getLogDirectory();
            logLink.setVisible(true);
            logLink.addHyperlinkListener(new HyperlinkAdapter() {
                public void linkActivated(HyperlinkEvent event) {
                    ApplicationUtil.browseTo("file://" //$NON-NLS-1$
                            + IFileHelper.getIFolder(logPath).getRawLocation().toFile().getAbsolutePath()
                            + File.separator + LogSave.LOG_HTML_FILE_NAME);
                }
            });
            // change button according to the "done" state
            getButton(IDialogConstants.CANCEL_ID).setEnabled(false);
            getButton(IDialogConstants.OK_ID).setText(Activator.Messages.getString("GeneratePopUp_9"));
            setButtonLayoutData(getButton(IDialogConstants.OK_ID));
            setButtonLayoutData(getButton(IDialogConstants.CANCEL_ID));
        }
    });

}

From source file:com.bluexml.side.application.ui.action.GeneratePopUp.java

License:Open Source License

public void launch() {
    /*// w w  w  .j av  a2 s.c  o m
     * update .application with plugin extensions
     */
    try {
        ApplicationUtil.updateApplicationFromExtensionPoint(applicationModel, applicationFile);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    this.setBlockOnOpen(false);

    this.open();
    Display currentDisp = ApplicationUtil.getDisplay();
    currentDisp.syncExec(new Runnable() {
        public void run() {
            List<Model> models;
            models = ApplicationUtil.getModels((Application) configuration.eContainer());

            // set job to run
            final Generate gen = new Generate(configuration, models, GeneratePopUp.this.getGeneralMonitor(),
                    GeneratePopUp.this.getComponentMonitor());
            // when job's done dialog must display link to open report html page...
            gen.addJobChangeListener(new IJobChangeListener() {
                public void sleeping(IJobChangeEvent event) {
                }

                public void scheduled(IJobChangeEvent event) {
                }

                public void running(IJobChangeEvent event) {
                }

                public void done(IJobChangeEvent event) {
                    // display link only if not disposed yet
                    if (GeneratePopUp.this != null && GeneratePopUp.this.getShell() != null) {
                        GeneratePopUp.this.displayLink();
                    } else {
                        //                     System.err.println("GeneratePopup closed");
                    }

                }

                public void awake(IJobChangeEvent event) {
                }

                public void aboutToRun(IJobChangeEvent event) {
                }
            });

            // manage cancel
            GeneratePopUp.this.addDialogEventListener(new IDialogEventListener() {
                public void addButtonPressedListener(int buttonId) {
                    if (buttonId == IDialogConstants.CANCEL_ID) {
                        gen.cancel();
                        GeneratePopUp.this.displayLink();
                    }
                }
            });

            // schedule side job
            gen.schedule();
        }
    });
}

From source file:com.buildml.eclipse.actions.dialogs.MatchPatternSelectionDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    /* //from  w  ww .j  a va2 s.c o  m
     * Replace the standard "OK" label with the name of the operation we're performing
     * (e.g "Delete" or "Make Atomic".
     */
    createButton(parent, IDialogConstants.OK_ID, operation, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.buildml.eclipse.outline.OutlinePage.java

License:Open Source License

/**
 * Remove the currently-selected package or package folder from the BuildML build system.
 * This is a UI method which will update the view and report necessary error messages.
 * Packages can only be removed if they don't contain any files/actions. Package folders
 * can only be removed if they don't contain any sub-packages (or package folders).
 *//*from   ww  w .  ja  v a 2 s. c om*/
public void remove() {

    /* if nothing is selected, we can't delete anything */
    if (selectedNode == null) {
        return;
    }

    /* determine the name and type of the thing we're deleting */
    int id = selectedNode.getId();
    String name = pkgMgr.getName(id);
    boolean isFolder = pkgMgr.isFolder(id);

    int status = AlertDialog.displayOKCancelDialog(
            "Are you sure you want to delete the " + "\"" + name + "\" " + (isFolder ? "folder?" : "package?"));
    if (status == IDialogConstants.CANCEL_ID) {
        return;
    }

    /* record the item's parent, in case we need to undo later */
    int parentId = pkgMgr.getParent(id);

    /* go ahead and remove it, possibly with an error code being returned */
    int rc = pkgMgr.remove(id);

    /* An error occured while removing... */
    if (rc != ErrorCode.OK) {

        /* for some reason, the element couldn't be deleted */
        if (rc == ErrorCode.CANT_REMOVE) {

            /* give an appropriate error message */
            if (selectedNode instanceof UIPackage) {
                AlertDialog.displayErrorDialog("Can't Delete Package",
                        "The selected package couldn't be deleted because it still "
                                + "contains files and actions.");

            } else {
                AlertDialog.displayErrorDialog("Can't Delete Package Folder",
                        "The selected package folder couldn't be deleted because it still "
                                + "contains sub-packages");
            }
        } else {
            throw new FatalBuildStoreError(
                    "Unexpected error when attempting to delete package " + "or package folder");
        }
    }

    /* Success - element removed. Update view accordingly. */
    else {
        PackageUndoOp op = new PackageUndoOp(buildStore, id);
        if (isFolder) {
            op.recordRemoveFolder(name, parentId);
        } else {
            op.recordRemovePackage(name, parentId);
        }
        new UndoOpAdapter(isFolder ? "Remove Folder" : "Remove Package", op).record();
    }
}

From source file:com.buildml.eclipse.utils.AlertDialog.java

License:Open Source License

@Override
protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {

    /*//from   ww  w.j  a v a  2  s  . c om
     * Ignore the CANCEL button (if not needed), but display the OK button.
     */
    if (!allowCancel && (id == IDialogConstants.CANCEL_ID)) {
        return null;
    } else {
        return super.createButton(parent, id, label, defaultButton);
    }
}

From source file:com.buildml.eclipse.utils.NameFilterDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, "Select", true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    /* disable the OK button by default, until some text is entered */
    getButton(OK).setEnabled(false);// w  w  w  .  j a va2s.c  o m
}

From source file:com.byterefinery.rmbench.dialogs.AbstractDependencyDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
    detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, IDialogConstants.SHOW_DETAILS_LABEL,
            false);//from w ww  . j  a  v  a  2s  .  c  om

}