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.nokia.s60tools.ui.dialogs.S60ToolsListBoxDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    // Creating OK button
    Button okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    // Optionally adding context-sensitive help support
    if (contextHelpID != null) {
        PlatformUI.getWorkbench().getHelpSystem().setHelp(okButton, contextHelpID);
    }/*from   w ww  .  j  a  v a2s .com*/
    //if cancel button also required
    if (hasCancelButton) {
        Button cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL,
                true);
        // Optionally adding context-sensitive help support
        if (contextHelpID != null) {
            PlatformUI.getWorkbench().getHelpSystem().setHelp(cancelButton, contextHelpID);
        }
    }
}

From source file:com.nokia.sdt.component.symbian.actions.EnableSourceGenDebugAction.java

License:Open Source License

/**
 * Put up a dialog showing components for selected projects and allow
 * user to select which of these is debugged.
 * @param allComponentIds list of all components
 * @param debuggableComponentIds modified list of selected components
 * @return true if changes made//from  ww w  .  j a  va 2s  .  c  om
 */
private boolean selectComponents(final Collection<String> allComponentIds,
        final Collection<String> debuggableComponentIds) {

    final List<String> sortedComponentIds = new ArrayList<String>(allComponentIds);
    Collections.sort(sortedComponentIds);
    ListSelectionDialog dlg = new ListSelectionDialog(workbenchWindow.getShell(), new Object(),
            new IStructuredContentProvider() {

                public void dispose() {
                }

                public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
                }

                public Object[] getElements(Object arg0) {
                    return sortedComponentIds.toArray();
                }

            }, new LabelProvider() {

                public String getText(Object element) {
                    return element.toString();
                }
            }, "Select components for which to save generated sourcegen scripts:");

    dlg.setInitialSelections(debuggableComponentIds.toArray());
    dlg.setTitle("Debug Component Sourcegen"); //$NON-NLS-1$

    int result = dlg.open();
    if (result == IDialogConstants.CANCEL_ID)
        return false;

    debuggableComponentIds.clear();
    List results = Arrays.asList(dlg.getResult());
    for (Iterator iter = results.iterator(); iter.hasNext();) {
        Object obj = iter.next();
        debuggableComponentIds.add((String) obj);
    }

    return true;
}

From source file:com.nokia.sdt.component.symbian.actions.SelectCustomComponentProjectsAction.java

License:Open Source License

/**
 * Put up a dialog showing projects in workspace and allow
 * user to select which of these is searched for custom components.
 *//*from  w w  w .  ja v  a 2s  .  co  m*/
private void selectProjects() {

    IProject[] projectArray = ResourcesPlugin.getWorkspace().getRoot().getProjects();
    List<IProject> projects = new ArrayList(Arrays.asList(projectArray));

    for (Iterator iter = projects.iterator(); iter.hasNext();) {
        IProject project = (IProject) iter.next();
        if (!project.isOpen())
            iter.remove();
    }

    // If the editor list is empty, return.
    if (projects.isEmpty())
        return;

    // Find the custom component projects
    List<IProject> customComponentProjects = new ArrayList<IProject>();
    for (Iterator iter = projects.iterator(); iter.hasNext();) {
        IProject project = (IProject) iter.next();
        if (UserComponentProjectNature.hasNature(project))
            customComponentProjects.add(project);
    }

    // Convert the list into an element collection.
    AdaptableList input = new AdaptableList(projects);

    ListSelectionDialog dlg = new ListSelectionDialog(workbenchWindow.getShell(), input,
            new BaseWorkbenchContentProvider(), new LabelProvider() {

                public String getText(Object element) {
                    return ((IProject) element).getName();
                }
            }, com.nokia.sdt.component.symbian.actions.Messages
                    .getString("SelectCustomComponentProjectsAction.DialogMessage")); //$NON-NLS-1$

    dlg.setInitialSelections(customComponentProjects.toArray());
    dlg.setTitle(com.nokia.sdt.component.symbian.actions.Messages
            .getString("SelectCustomComponentProjectsAction.DialogTitle")); //$NON-NLS-1$

    int result = dlg.open();
    if (result == IDialogConstants.CANCEL_ID)
        return;

    final List newCustomComponentProjects = Arrays.asList(dlg.getResult());

    // turn off excluded projects
    for (Iterator iter = customComponentProjects.iterator(); iter.hasNext();) {
        IProject project = (IProject) iter.next();
        if (!newCustomComponentProjects.contains(project))
            UserComponentProjectNature.setNature(project, false);
    }

    // turn on included projects (redundantly)
    for (Iterator iter = newCustomComponentProjects.iterator(); iter.hasNext();) {
        IProject project = (IProject) iter.next();
        UserComponentProjectNature.setNature(project, true);
    }
}

From source file:com.nokia.sdt.sourcegen.SourceGenPlugin.java

License:Open Source License

/**
 * Put up a dialog showing possible sources that will be
 * modified and allow the user to select items to save,
 * and save the selected items.//w  ww.j ava 2  s .  co m
 * <p>
 * This is a ripoff of the Eclipse EditorManager#saveAll()
 * method, which is internal.
 * @param dirtyParts
 * @return true: saving confirmed, false: save canceled
 */
private boolean confirmAndSaveAll(List dirtyParts, boolean confirm, IWorkbenchWindow window) {
    // If the editor list is empty return.
    if (dirtyParts.isEmpty())
        return true;

    // Convert the list into an element collection.
    AdaptableList input = new AdaptableList(dirtyParts);

    ListSelectionDialog dlg = new ListSelectionDialog(window.getShell(), input,
            new BaseWorkbenchContentProvider(), new WorkbenchPartLabelProvider(),
            Messages.getString("SourceGenPlugin.SelectResources")); //$NON-NLS-1$

    dlg.setInitialSelections(dirtyParts.toArray(new Object[dirtyParts.size()]));
    dlg.setTitle(Messages.getString("SourceGenPlugin.SaveSourcesTitle")); //$NON-NLS-1$
    int result = dlg.open();

    if (result == IDialogConstants.CANCEL_ID)
        return false;

    final List savingDirtyParts = Arrays.asList(dlg.getResult());

    final boolean[] saveSucceeded = new boolean[1];

    saveSucceeded[0] = true;
    UITaskUtils.runImmediately(new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            monitor.beginTask(Messages.getString("SourceGenPlugin.SavingEditors"), savingDirtyParts.size()); //$NON-NLS-1$
            for (Iterator iter = savingDirtyParts.iterator(); iter.hasNext();) {
                if (monitor.isCanceled())
                    saveSucceeded[0] = false;
                IEditorPart editor = (IEditorPart) iter.next();
                editor.doSave(monitor);
                monitor.worked(1);
            }
            monitor.done();
        }

    });

    return saveSucceeded[0];
}

From source file:com.nokia.sdt.symbian.ui.editors.ArrayEditorDialog.java

License:Open Source License

/**
 * Create contents of the button bar/*from w  w w  .j a  v a2 s  . co  m*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    // override to create with no default button. The user should
    // be able to press Enter to begin editing in the property sheet but
    // that would trigger the default button.
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.nokia.tools.s60.editor.ProjectSaveAsDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.nokia.tools.s60.editor.Series60EditorPart.java

License:Open Source License

public void partActivated(IWorkbenchPart part) {
    try {/*from ww w.  j a v a2s  .c  o m*/
        activatePart(part);

        if (!cancelledNotification && part == this) {
            synchronized (this) {
                if (!cancelledNotification) {
                    Theme activeTheme = ThemeUtil.getCurrentActiveTheme();
                    if (activeTheme instanceof S60Theme) {
                        Map<ThirdPartyIconWrapper, List<TPIconConflictEntry>> conflictingIconList = ThirdPartyIconManager
                                .getConflictingIconList((S60Theme) activeTheme);
                        if (!conflictingIconList.isEmpty()) {
                            boolean confirmed = MessageDialog.openConfirm(part.getSite().getShell(),
                                    "Third Party Icons Conflicts",
                                    "Third party icon definitions for the current theme has conflicts. Resolve them now?");

                            if (confirmed) {
                                if (IDialogConstants.CANCEL_ID == showThirdPartyIconPage())
                                    cancelledNotification = true;
                            } else {
                                cancelledNotification = true;
                            }
                        }
                    }
                }
            }
        }

    } catch (RuntimeException e) {

        e.printStackTrace();
    }
}

From source file:com.nokia.tools.s60.editor.ui.dialogs.ElevenPieceOperationConfirmDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    /*createButton(parent, IDialogConstants.YES_ID,
    IDialogConstants.YES_LABEL, true);// w ww .  j a  va 2s. com
    createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL,
    false);*/
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.nokia.tools.s60.editor.ui.dialogs.MaskDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, "&OK", true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.nokia.tools.s60.editor.ui.dialogs.MaskDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (IDialogConstants.OK_ID == buttonId || IDialogConstants.CANCEL_ID == buttonId) {
        isDirty = false;/*from  w w  w.jav  a  2s .c om*/
    }
    super.buttonPressed(buttonId);
}