Example usage for org.eclipse.jface.dialogs ProgressMonitorDialog ProgressMonitorDialog

List of usage examples for org.eclipse.jface.dialogs ProgressMonitorDialog ProgressMonitorDialog

Introduction

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

Prototype

public ProgressMonitorDialog(Shell parent) 

Source Link

Document

Creates a progress monitor dialog under the given shell.

Usage

From source file:com.hudson.hibernatesynchronizer.popup.actions.RemoveRelatedFiles.java

License:GNU General Public License

/**
 * @see IActionDelegate#run(IAction)//from w w  w  .j  a  va2  s  .  com
 */
public void run(IAction action) {
    final Shell shell = new Shell();
    if (MessageDialog.openConfirm(shell, "File Removal Confirmation",
            "Are you sure you want to delete all related class and resources to the selected mapping files?")) {
        ISelectionProvider provider = part.getSite().getSelectionProvider();
        if (null != provider) {
            if (provider.getSelection() instanceof StructuredSelection) {
                StructuredSelection selection = (StructuredSelection) provider.getSelection();
                Object[] obj = selection.toArray();
                final IFile[] files = new IFile[obj.length];
                IProject singleProject = null;
                boolean isSingleProject = true;
                for (int i = 0; i < obj.length; i++) {
                    if (obj[i] instanceof IFile) {
                        IFile file = (IFile) obj[i];
                        files[i] = file;
                        if (null == singleProject)
                            singleProject = file.getProject();
                        if (!singleProject.getName().equals(file.getProject().getName())) {
                            isSingleProject = false;
                        }
                    }
                }
                if (isSingleProject) {
                    final IProject project = singleProject;
                    ProgressMonitorDialog dialog = new ProgressMonitorDialog(part.getSite().getShell());
                    try {
                        dialog.run(false, true, new IRunnableWithProgress() {
                            public void run(IProgressMonitor monitor)
                                    throws InvocationTargetException, InterruptedException {
                                try {
                                    RemoveRelatedFilesRunnable runnable = new RemoveRelatedFilesRunnable(
                                            project, files, monitor, shell);
                                    ResourcesPlugin.getWorkspace().run(runnable, monitor);
                                } catch (Exception e) {
                                    throw new InvocationTargetException(e);
                                } finally {
                                    monitor.done();
                                }
                            }
                        });
                    } catch (Exception e) {
                    }
                } else {
                    HSUtil.showError("The selected files must belong to a single project", shell);
                }
            }
        }
    }
}

From source file:com.hudson.hibernatesynchronizer.popup.actions.SynchronizeFiles.java

License:GNU General Public License

/**
 * @see IActionDelegate#run(IAction)/*  ww w. ja v  a 2  s.c  o m*/
 */
public void run(IAction action) {
    Shell shell = new Shell();
    final ISelectionProvider provider = part.getSite().getSelectionProvider();
    if (null != provider) {
        if (provider.getSelection() instanceof StructuredSelection) {
            ProgressMonitorDialog dialog = new ProgressMonitorDialog(part.getSite().getShell());
            try {
                dialog.run(false, true, new IRunnableWithProgress() {
                    public void run(IProgressMonitor monitor)
                            throws InvocationTargetException, InterruptedException {
                        try {
                            IStructuredSelection selection = (StructuredSelection) provider.getSelection();
                            monitor.beginTask("Synchronizing files...", 2 + (selection.toArray().length * 14));
                            exec(selection, monitor);
                        } catch (Exception e) {
                            throw new InvocationTargetException(e);
                        } finally {
                            monitor.done();
                        }
                    }
                });
            } catch (Exception e) {
            }
        }
    }
}

From source file:com.hudson.hibernatesynchronizer.wizard.NewMappingWizard.java

License:GNU General Public License

/**
 * This method is called when 'Finish' button is pressed in the wizard. We
 * will create an operation and run it using wizard as execution context.
 *//*from   w  ww  .  ja va 2s  .  c om*/
public boolean performFinish() {
    final String containerName = page.getContainerName();
    final List tables = page.getTables();
    final String packageName = page.getPackage();
    final Properties props = page.getProperties();
    Plugin.saveProperty(page.project.getProject(), "package", packageName);
    int foreignKeys = 0;
    for (Iterator i = tables.iterator(); i.hasNext();) {
        DBTable tbl = (DBTable) i.next();
        tbl.setProperties(props);
        foreignKeys += tbl.getForeignKeys().size();
    }
    try {
        Template template = Constants.templateGenerator.getTemplate("Mapping.vm");
        Connection c = page.getConnection(null);
        final MappingWizardRunnable runnable = new MappingWizardRunnable(containerName, tables, packageName,
                props, template, c, getShell());
        ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
        try {
            dialog.run(false, true, new IRunnableWithProgress() {
                public void run(IProgressMonitor monitor)
                        throws InvocationTargetException, InterruptedException {
                    try {
                        ResourcesPlugin.getWorkspace().run(runnable, monitor);
                    } catch (Exception e) {
                        throw new InvocationTargetException(e);
                    } finally {
                        monitor.done();
                    }
                }
            });
        } catch (Exception e) {
        } finally {
            if (null != c)
                c.close();
        }
        if (null != runnable.files && runnable.files.length > 0) {
            AddMappingReference.addMappingReference(page.project.getProject(), runnable.files, false,
                    getShell());
        }
    } catch (Exception e) {
        HSUtil.showError(e.getMessage(), getShell());
    }
    return true;
}

From source file:com.hudson.hibernatesynchronizer.wizard.NewMappingWizardPage.java

License:GNU General Public License

public Composite addConfiguration(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);/*from  w w  w . ja v a  2 s.c o  m*/
    layout.numColumns = 3;
    layout.verticalSpacing = 9;

    Label label = new Label(container, SWT.NULL);
    label.setText("&Container:");

    containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
    containerText.setEnabled(false);
    containerText.setBackground(new Color(null, 255, 255, 255));
    GridData gd = new GridData();
    gd.widthHint = 250;
    containerText.setLayoutData(gd);
    containerText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    Button containerButton = new Button(container, SWT.NATIVE);
    containerButton.setText("Browse");
    containerButton.addMouseListener(new ContainerMouseListener(this));

    label = new Label(container, SWT.NULL);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 3;
    label.setLayoutData(gd);

    label = new Label(container, SWT.NULL);
    label.setText("&Driver:");
    driverText = new Text(container, SWT.BORDER | SWT.SINGLE);
    driverText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    driverText.setEnabled(false);
    driverText.setBackground(new Color(null, 255, 255, 255));
    gd = new GridData();
    gd.widthHint = 250;
    driverText.setLayoutData(gd);
    Button driverButton = new Button(container, SWT.NATIVE);
    driverButton.setText("Browse");
    driverButton.addMouseListener(new DriverMouseListener(this));

    label = new Label(container, SWT.NULL);
    label.setText("&Database URL:");
    databaseUrlText = new Text(container, SWT.BORDER | SWT.SINGLE);
    databaseUrlText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    gd = new GridData();
    gd.horizontalSpan = 2;
    gd.widthHint = 250;
    databaseUrlText.setLayoutData(gd);

    label = new Label(container, SWT.NULL);
    label.setText("&Username:");
    usernameText = new Text(container, SWT.BORDER | SWT.SINGLE);
    usernameText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    gd = new GridData();
    gd.horizontalSpan = 2;
    gd.widthHint = 150;
    usernameText.setLayoutData(gd);

    label = new Label(container, SWT.NULL);
    label.setText("&Password:");
    passwordText = new Text(container, SWT.BORDER | SWT.SINGLE);
    passwordText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    passwordText.setEchoChar('*');
    gd = new GridData();
    gd.horizontalSpan = 2;
    gd.widthHint = 150;
    passwordText.setLayoutData(gd);

    label = new Label(container, SWT.NULL);
    label.setText("Table pattern:");
    tablePattern = new Text(container, SWT.BORDER | SWT.SINGLE);
    tablePattern.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    tablePattern.setEnabled(true);
    tablePattern.setBackground(new Color(null, 255, 255, 255));
    gd = new GridData();
    gd.horizontalSpan = 2;
    gd.widthHint = 250;
    tablePattern.setLayoutData(gd);

    label = new Label(container, SWT.NULL);
    label.setText("Schema pattern:");
    schemaPattern = new Text(container, SWT.BORDER | SWT.SINGLE);
    schemaPattern.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    schemaPattern.setEnabled(true);
    schemaPattern.setBackground(new Color(null, 255, 255, 255));
    gd = new GridData();
    gd.horizontalSpan = 2;
    gd.widthHint = 250;
    schemaPattern.setLayoutData(gd);

    label = new Label(container, SWT.NULL);
    label.setText("Tables");
    table = new Table(container, SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.CHECK);
    table.setVisible(true);
    table.setLinesVisible(false);
    table.setHeaderVisible(false);
    table.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            dialogChanged();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    GridData data = new GridData();
    data.heightHint = 150;
    data.widthHint = 250;
    table.setLayoutData(data);

    // create the columns
    TableColumn nameColumn = new TableColumn(table, SWT.LEFT);
    ColumnLayoutData nameColumnLayout = new ColumnWeightData(100, false);

    // set columns in Table layout
    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(nameColumnLayout);
    table.setLayout(tableLayout);

    Composite buttonContainer = new Composite(container, SWT.NULL);
    buttonContainer.setLayout(new GridLayout(1, true));
    gd = new GridData();
    gd.verticalAlignment = GridData.BEGINNING;
    gd.horizontalAlignment = GridData.BEGINNING;
    buttonContainer.setLayoutData(gd);
    tableRefreshButton = new Button(buttonContainer, SWT.PUSH);
    tableRefreshButton.setText("Refresh");
    tableRefreshButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    tableRefreshButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
            try {
                dialog.run(false, true, new IRunnableWithProgress() {
                    public void run(IProgressMonitor monitor)
                            throws InvocationTargetException, InterruptedException {
                        try {
                            monitor.beginTask("Refreshing tables...", 21);
                            refreshTables(monitor);
                        } catch (Exception e) {
                            throw new InvocationTargetException(e);
                        } finally {
                            monitor.done();
                        }
                    }
                });
            } catch (Exception exc) {
            }
        }
    });
    selectAllButton = new Button(buttonContainer, SWT.PUSH);
    selectAllButton.setText("Select All");
    selectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    selectAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            try {
                for (int i = 0; i < table.getItemCount(); i++) {
                    table.getItem(i).setChecked(true);
                }
                dialogChanged();
            } catch (Exception exc) {
            }
        }
    });
    selectNoneButton = new Button(buttonContainer, SWT.PUSH);
    selectNoneButton.setText("Select None");
    selectNoneButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    selectNoneButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            try {
                for (int i = 0; i < table.getItemCount(); i++) {
                    table.getItem(i).setChecked(false);
                }
                dialogChanged();
            } catch (Exception exc) {
            }
        }
    });

    label = new Label(container, SWT.NULL);
    label.setText("&Package:");
    packageText = new Text(container, SWT.BORDER | SWT.SINGLE);
    packageText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    gd = new GridData();
    gd.widthHint = 250;
    packageText.setLayoutData(gd);

    packageButton = new Button(container, SWT.NATIVE);
    packageButton.setText("Browse");
    packageButton.addMouseListener(new MouseListener() {
        public void mouseDown(MouseEvent e) {
            if (null != project) {
                try {
                    IJavaSearchScope searchScope = SearchEngine.createWorkspaceScope();
                    SelectionDialog sd = JavaUI.createPackageDialog(getShell(), project,
                            IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS);
                    sd.open();
                    Object[] objects = sd.getResult();
                    if (null != objects && objects.length > 0) {
                        IPackageFragment pf = (IPackageFragment) objects[0];
                        packageText.setText(pf.getElementName());
                    }
                } catch (JavaModelException jme) {
                    jme.printStackTrace();
                }
            }
        }

        public void mouseDoubleClick(MouseEvent e) {
        }

        public void mouseUp(MouseEvent e) {
        }

    });

    if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) {
        IStructuredSelection ssel = (IStructuredSelection) selection;
        if (ssel.size() == 1) {
            Object obj = ssel.getFirstElement();
            if (obj instanceof IResource) {
                IContainer cont;
                if (obj instanceof IContainer)
                    cont = (IContainer) obj;
                else
                    cont = ((IResource) obj).getParent();
                containerText.setText(cont.getFullPath().toString());
                projectChanged(cont.getProject());
            } else if (obj instanceof IPackageFragment) {
                IPackageFragment frag = (IPackageFragment) obj;
                containerText.setText(frag.getPath().toString());
                projectChanged(frag.getJavaProject().getProject());
            } else if (obj instanceof IPackageFragmentRoot) {
                IPackageFragmentRoot root = (IPackageFragmentRoot) obj;
                containerText.setText(root.getPath().toString());
                projectChanged(root.getJavaProject().getProject());
            } else if (obj instanceof IJavaProject) {
                IJavaProject proj = (IJavaProject) obj;
                containerText.setText("/" + proj.getProject().getName());
                projectChanged(proj.getProject());
            } else if (obj instanceof IProject) {
                IProject proj = (IProject) obj;
                containerText.setText("/" + proj.getName());
                projectChanged(proj);
            }
        }
    }

    containerText.forceFocus();
    initialize();
    dialogChanged();
    return container;
}

From source file:com.ibm.domino.osgi.debug.actions.CreateNotesJavaApiProject.java

License:Open Source License

private void doCreateNotesJavaApiProject() {
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    final IProject project = root.getProject(JAVA_API_PROJECT_NAME);
    if (project.exists()) {
        boolean bContinue = MessageDialog.openQuestion(window.getShell(), "Debug plug-in for Domino OSGi",
                MessageFormat.format("Project {0} already exists. Would you like to update it?",
                        JAVA_API_PROJECT_NAME));
        if (!bContinue) {
            return;
        }//from w w w  . jav a  2 s. c  o  m
    }

    String binDirectory = Activator.getDefault().getPreferenceStore()
            .getString(PreferenceConstants.PREF_DOMINO_BIN_DIR);
    if (binDirectory == null || binDirectory.length() == 0) {
        int ret = new MessageDialog(window.getShell(), "Question", null,
                "Domino Bin directory not set, please click on the link to set it", MessageDialog.WARNING,
                new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0) {
            /*
             * (non-Javadoc)
             * @see org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
             */
            @Override
            protected Control createCustomArea(Composite parent) {
                Link link = new Link(parent, SWT.NONE);
                link.setFont(parent.getFont());
                link.setText("<A>Domino Debug Plugin Preferences....</A>");
                link.addSelectionListener(new SelectionListener() {
                    public void widgetSelected(SelectionEvent e) {
                        doLinkActivated();
                    }

                    private void doLinkActivated() {
                        String id = "com.ibm.domino.osgi.debug.preferences.DominoOSGiDebugPreferencePage";
                        PreferencesUtil
                                .createPreferenceDialogOn(window.getShell(), id, new String[] { id }, null)
                                .open();
                    }

                    public void widgetDefaultSelected(SelectionEvent e) {
                        doLinkActivated();
                    }
                });
                return link;
            }
        }.open();

        if (ret == 1) {
            return;
        }
    }

    binDirectory = Activator.getDefault().getPreferenceStore()
            .getString(PreferenceConstants.PREF_DOMINO_BIN_DIR);
    if (binDirectory == null || binDirectory.length() == 0) {
        MessageDialog.openError(window.getShell(), "Error", "Domino Bin directory not set");
        return;
    }

    try {
        final String sBinDir = binDirectory;
        new ProgressMonitorDialog(window.getShell()).run(true, true, new IRunnableWithProgress() {
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                try {
                    if (!project.exists()) {
                        project.create(monitor);
                    }
                    project.open(monitor);

                    IProjectDescription description = project.getDescription();
                    String[] natures = description.getNatureIds();
                    String[] newNatures = new String[natures.length + 2];
                    System.arraycopy(natures, 0, newNatures, 0, natures.length);
                    newNatures[natures.length] = JavaCore.NATURE_ID;
                    newNatures[natures.length + 1] = "org.eclipse.pde.PluginNature";
                    description.setNatureIds(newNatures);
                    project.setDescription(description, monitor);
                    //Copy the resources under res
                    copyOneLevel(project, monitor, "res", "");

                    //Copy notes.jar
                    File notesJar = new File(sBinDir + "/jvm/lib/ext/Notes.jar");
                    if (!notesJar.exists() || !notesJar.isFile()) {
                        MessageDialog.openError(window.getShell(), "Error",
                                MessageFormat.format("{0} does not exist", notesJar.getAbsolutePath()));
                        return;
                    }

                    copyFile(notesJar, project.getFile("Notes.jar"), monitor);

                } catch (Throwable t) {
                    throw new InvocationTargetException(t);
                }
            }
        });
    } catch (Throwable t) {
        MessageDialog.openError(window.getShell(), "error", t.getMessage());
        t.printStackTrace();
    }
}

From source file:com.ibm.etools.mft.conversion.esb.editor.parameter.ConversionEditor.java

License:Open Source License

@Override
public void widgetSelected(SelectionEvent e) {
    if (e.getSource() == startConversion) {
        // if (!showFlashWarning()) {
        // return;
        // }//from  ww w . j a va  2s .co  m

        if (!checkAllConverters()) {
            return;
        }

        ProgressMonitorDialog pmd = new ProgressMonitorDialog(
                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
        try {
            pmd.run(true, false, new IRunnableWithProgress() {
                @Override
                public void run(IProgressMonitor monitor)
                        throws InvocationTargetException, InterruptedException {

                    if (!showWarningIfNecessary()) {
                        return;
                    }

                    WESBConversionManager manager = new WESBConversionManager(getModel(), getLog());

                    manager.convert(((Controller) getPropertyEditorHelper().getController()).getModelFile(),
                            monitor);
                    Display.getDefault().syncExec(new Runnable() {

                        @Override
                        public void run() {
                            getController().getConvertStep().setCompleted(true);
                            getController().getEditor().getNavigationbar().selectNextItem();
                            getController().refreshLogStatus(new Status(Status.INFO,
                                    WESBConversionPlugin.getDefault().getBundle().getSymbolicName(),
                                    WESBConversionMessages.messageConversionCompleted));
                            getController().refreshLogViewer();
                            getController().refreshNavigationBar();
                            changed();
                        }
                    });
                }
            });
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

From source file:com.ibm.xsp.extlib.designer.bluemix.manifest.editor.ManifestEditorPage.java

License:Open Source License

private void createServicesArea(Composite parent) {
    Section section = XSPEditorUtil.createSection(_toolkit, parent, "Bound Services", 1, 1); // $NLX-ManifestEditorPage.BoundServices-1$
    Composite container = XSPEditorUtil.createSectionChild(section, 1);

    XSPEditorUtil.createLabel(container, "Specify the bound services for this application.", 1); // $NLX-ManifestEditorPage.Specifytheboundservicesforthisapp-1$

    // Create the Table
    _serviceTableEditor = new ManifestTableEditor(container, 1, new String[] { "service" },
            new String[] { "Service" }, true, true, 3, 60, "bluemix.services", _serviceList, true, this, null,
            null); // $NON-NLS-1$ $NON-NLS-3$ $NLX-ManifestEditorPage.Service-2$

    // Create the Buttons
    Composite btnContainer = new Composite(container, SWT.NONE);
    btnContainer.setLayout(SWTLayoutUtils.createLayoutNoMarginDefaultSpacing(3));
    btnContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    btnContainer.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

    // Add Button
    Button addBtn = new Button(btnContainer, SWT.PUSH);
    addBtn.setText("Add"); // $NLX-ManifestEditorPage.Add-1$
    addBtn.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            _serviceTableEditor.createItem(new TableEntry("Service")); // $NLX-ManifestEditorPage.Service.1-1$
        }/*w  w w.j  ava2s  .  c o m*/
    });

    // Delete Button
    Button delBtn = new Button(btnContainer, SWT.PUSH);
    delBtn.setText("Delete"); // $NLX-ManifestEditorPage.Delete-1$
    delBtn.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            _serviceTableEditor.deleteItem();
        }
    });

    // Choose button
    Button chooseBtn = new Button(btnContainer, SWT.PUSH);
    chooseBtn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, true, 1, 1));
    chooseBtn.setText("Choose..."); // $NLX-ManifestEditorPage.Choose-1$
    chooseBtn.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            if (BluemixUtil.isServerConfigured()) {
                boolean success = false;
                try {
                    // Retrieve the Services List from the Cloud Space
                    ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
                    dialog.run(true, true, new GetBluemixServices());
                    success = true;
                } catch (InvocationTargetException e) {
                    MessageDialog.openError(getShell(), "Error retrieving services",
                            BluemixUtil.getErrorText(e)); // $NLX-ManifestEditorPage.ErrorRetrievingServices-1$
                } catch (InterruptedException e) {
                    // Ignore
                }
                if (success) {
                    // Open the Services Dialog
                    if (_cloudServices.size() == 0) {
                        MessageDialog.openInformation(getShell(),
                                BluemixUtil.productizeString("%BM_PRODUCT% Services"),
                                "There are no defined services in this Cloud Space"); // $NLX-ManifestEditorPage.IBMBluemixServices-1$ $NLX-ManifestEditorPage.TherearenodefinedServicesinthisCl-2$
                    } else {
                        ManifestServicesDialog dialog = new ManifestServicesDialog(getShell(), _cloudServices,
                                _serviceList);
                        if (dialog.open() == Dialog.OK) {
                            updateServices();
                            _serviceTableEditor.refresh();
                        }
                    }
                }
            }
        }
    });

    section.setClient(container);
}

From source file:com.ibm.xsp.extlib.designer.bluemix.preference.PreferencePage.java

License:Open Source License

@Override
public void widgetSelected(SelectionEvent event) {
    if (event.widget == _testButton) {
        boolean showSuccess = true;
        try {/*from  w  w  w  .  j av a 2  s .co  m*/
            ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
            dialog.run(true, true,
                    new BluemixTest(_serverCombo.getText(), _usernameText.getText(), _passwordText.getText()));
        } catch (InvocationTargetException e) {
            showSuccess = false;
            MessageDialog.openError(getShell(), "Connection Error", BluemixUtil.getErrorText(e)); // $NLX-PreferencePage.ConnectionError-1$
        } catch (InterruptedException e) {
            showSuccess = false;
        }

        if (showSuccess) {
            String msg = StringUtil.format("The connection to \"{0}\" was successful",
                    _serverCombo.getText().trim()); // $NLX-PreferencePage.Theconnectionto0wassuccessful-1$
            MessageDialog.openInformation(getShell(), "Connection Success", msg); // $NLX-PreferencePage.ConnectionSuccess-1$
        }
    } else if (event.widget == _newProfileButton) {
        HybridProfile profile = new HybridProfile();
        if (HybridBluemixWizard.launch(profile, true) == Window.OK) {
            _hybridTableEditor.createItem(new ProfileListItem(profile));
        }
    } else if (event.widget == _editProfileButton) {
        HybridProfile profile = ((ProfileListItem) _profileList.get(_hybridTableEditor.getSelectedRow()))
                .getProfile();
        HybridBluemixWizard.launch(profile, false);
    } else if (event.widget == _dupProfileButton) {
        HybridProfile profile = (HybridProfile) ((ProfileListItem) _profileList
                .get(_hybridTableEditor.getSelectedRow())).getProfile().clone();
        _hybridTableEditor.createItem(new ProfileListItem(profile));
    } else if (event.widget == _deleteProfileButton) {
        _hybridTableEditor.deleteItem();
    }

    updateComposites();
}

From source file:com.iw.plugins.spindle.editorjwc.beans.NewBeanDialog.java

License:Mozilla Public License

protected String chooseBeanClass() {
    String value = beanClassname.getTextValue();
    IJavaElement[] elements = new IJavaElement[] { root.getJavaProject() };
    IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);

    IProject project = root.getJavaProject().getProject();
    try {// ww  w  . j  a  v  a 2s . com
        SelectionDialog dialog = JavaUI.createTypeDialog(getShell(), new ProgressMonitorDialog(getShell()),
                scope, IJavaElementSearchConstants.CONSIDER_CLASSES, false);
        dialog.setTitle("Bean Class");
        dialog.setMessage("Choose a Class");
        if (dialog.open() == dialog.OK) {
            return ((IType) dialog.getResult()[0]).getFullyQualifiedName();
        }
    } catch (JavaModelException jmex) {
        TapestryPlugin.getDefault().logException(jmex);
    }
    return value;
}

From source file:com.iw.plugins.spindle.editorlib.RenamedLibraryAction.java

License:Mozilla Public License

private void performChanges(Object[] toChange, Map changeData) {
    if (toChange.length > 0) {

        ProgressMonitorDialog dialog = new ProgressMonitorDialog(
                TapestryPlugin.getDefault().getActiveWorkbenchWindow().getShell());

        try {//  w w w .ja va2  s .  c om

            dialog.run(false, true, getRunnable(toChange, changeData, oldName, newName));

        } catch (InvocationTargetException e) {

        } catch (InterruptedException e) {

        }

    }
}