Search in sources :

Example 1 with SelectExistingProjectDialog

use of org.jboss.tools.openshift.internal.common.ui.SelectExistingProjectDialog in project jbosstools-openshift by jbosstools.

the class ApplicationSourceListPage method onBrowseProjects.

/**
 * Open a dialog box to select an open project when clicking on the 'Browse' button.
 *
 * @return
 */
private SelectionListener onBrowseProjects() {
    return new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            SelectExistingProjectDialog dialog = new SelectExistingProjectDialog(model.getEclipseProject() == null ? "Select an existing workspace project from the list below." : NLS.bind("Currently project {0} is selected, you may pick a different one from the list below.", model.getEclipseProject().getName()), getShell());
            if (model.getEclipseProject() != null) {
                dialog.setInitialSelections(new Object[] { model.getEclipseProject() });
            }
            if (dialog.open() == Dialog.OK) {
                Object selectedProject = dialog.getFirstResult();
                model.setEclipseProject(((org.eclipse.core.resources.IProject) selectedProject));
            }
        }
    };
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectExistingProjectDialog(org.jboss.tools.openshift.internal.common.ui.SelectExistingProjectDialog)

Aggregations

SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectExistingProjectDialog (org.jboss.tools.openshift.internal.common.ui.SelectExistingProjectDialog)1