use of org.eclipse.ui.dialogs.ContainerSelectionDialog in project m2e-core by eclipse-m2e.
the class MavenPomWizardPage method handleBrowse.
/**
* Uses the standard container selection dialog to choose the new value for the container field.
*/
void handleBrowse() {
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, Messages.MavenPomWizardPage_dialog_title);
dialog.showClosedProjects(false);
if (dialog.open() == Window.OK) {
Object[] result = dialog.getResult();
if (result.length == 1) {
projectText.setText(((Path) result[0]).toString());
}
}
// IJavaModel javaModel = JavaCore.create();
//
// IJavaProject[] projects;
// try {
// projects = javaModel.getJavaProjects();
// } catch(JavaModelException e) {
// log.error(e.getMessage(), e);
// projects = new IJavaProject[0];
// }
//
// ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
// ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
// dialog.setTitle("Select Project");
// dialog.setMessage("Choose project where POM will be created");
// dialog.setElements(projects);
//
// String projectName = getProject();
// if(projectName != null && projectName.length() > 0) {
// IJavaProject javaProject = javaModel.getJavaProject(projectName);
// if(javaProject != null) {
// dialog.setInitialSelections(new Object[] {javaProject});
// }
// }
//
// if(dialog.open() == Window.OK) {
// projectText.setText(((IJavaProject) dialog.getFirstResult()).getProject().getFullPath().toString());
// }
}
use of org.eclipse.ui.dialogs.ContainerSelectionDialog in project eclipse.pde by eclipse-pde.
the class BaseBlock method handleBrowseWorkspace.
protected void handleBrowseWorkspace() {
ContainerSelectionDialog dialog = new ContainerSelectionDialog(fLocationText.getShell(), getContainer(), true, PDEUIMessages.BaseBlock_relative);
if (dialog.open() == Window.OK) {
Object[] result = dialog.getResult();
if (result.length == 0)
return;
IPath path = (IPath) result[0];
// $NON-NLS-1$ //$NON-NLS-2$
fLocationText.setText("${workspace_loc:" + path.makeRelative().toString() + "}");
}
}
use of org.eclipse.ui.dialogs.ContainerSelectionDialog in project jbosstools-server by jbosstools.
the class FilesetReferenceWizardFragment method browsePressed.
protected void browsePressed(Button b, Text t) {
// show the dialog, then set the proper text
ContainerSelectionDialog d = new ContainerSelectionDialog(b.getShell(), null, false, // $NON-NLS-1$
"Please select a root folder");
if (d.open() == Dialog.OK) {
Object[] o = d.getResult();
if (o != null && o.length > 0) {
IPath path = (IPath) o[0];
t.setText(path.toString());
}
}
}
use of org.eclipse.ui.dialogs.ContainerSelectionDialog in project jbosstools-base by jbosstools.
the class ContainerChooserAdapter method invoke0.
public String invoke0(Control control) {
String v = getStringValue(true);
IPath p = v.length() == 0 ? null : new Path(v);
IResource r = (p == null) ? null : ModelPlugin.getWorkspace().getRoot().findMember(p);
IContainer c = (r instanceof IContainer) ? (IContainer) r : null;
ContainerSelectionDialog dialog = new ContainerSelectionDialog(control.getShell(), c, false, null);
dialog.create();
if (dialog.open() != 0)
return null;
Object[] os = dialog.getResult();
return os == null || os.length == 0 ? null : os[0].toString();
}
use of org.eclipse.ui.dialogs.ContainerSelectionDialog in project uima-ruta by apache.
the class RutaMainLaunchConfigurationTab method doCreateControl.
@Override
protected void doCreateControl(Composite composite) {
super.doCreateControl(composite);
// Input Resource Group
Group inputResourceGroup = new Group(composite, SWT.None);
inputResourceGroup.setText("Input Folder:");
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(inputResourceGroup);
GridLayout inputResourceGroupLayout = new GridLayout(4, false);
inputResourceGroup.setLayout(inputResourceGroupLayout);
inputFolderText = new Text(inputResourceGroup, SWT.BORDER);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(3, 1).applyTo(inputFolderText);
inputFolderText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
updateLaunchConfigurationDialog();
}
});
Button browseInputResource = new Button(inputResourceGroup, SWT.NONE);
browseInputResource.setText("Browse ...");
browseInputResource.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
dialog.setTitle("Select input folder");
dialog.setMessage("Select input folder");
dialog.setInput(getProject().getProject());
dialog.setInitialSelection(getWorkspaceRoot().findMember(inputFolderText.getText()));
if (dialog.open() == IDialogConstants.OK_ID) {
IResource resource = (IResource) dialog.getFirstResult();
if (resource != null) {
String fileLoc = resource.getFullPath().toString();
inputFolderText.setText(fileLoc);
}
}
}
});
recursivelyButton = new Button(inputResourceGroup, SWT.CHECK);
recursivelyButton.setText("Recursively");
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(recursivelyButton);
recursivelyButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent event) {
updateLaunchConfigurationDialog();
}
public void widgetDefaultSelected(SelectionEvent event) {
}
});
Label viewLabel = new Label(inputResourceGroup, SWT.NONE);
viewLabel.setText("View Name:");
viewText = new Text(inputResourceGroup, SWT.BORDER);
GridDataFactory.swtDefaults().hint(250, SWT.DEFAULT).align(SWT.LEFT, SWT.CENTER).grab(true, false).applyTo(viewText);
viewText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
updateLaunchConfigurationDialog();
}
});
Group outputFolderGroup = new Group(composite, SWT.None);
outputFolderGroup.setText("Output Folder:");
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(outputFolderGroup);
GridLayout outputFolderGroupLayout = new GridLayout(2, false);
outputFolderGroup.setLayout(outputFolderGroupLayout);
outputFolderText = new Text(outputFolderGroup, SWT.BORDER);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(outputFolderText);
outputFolderText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
updateLaunchConfigurationDialog();
}
});
Button browseOutputFolderButton = new Button(outputFolderGroup, SWT.NONE);
browseOutputFolderButton.setText("Browse ...");
browseOutputFolderButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String currentContainerString = outputFolderText.getText();
IContainer currentContainer = getContainer(currentContainerString);
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), currentContainer, false, "Select output folder");
dialog.showClosedProjects(false);
dialog.open();
Object[] results = dialog.getResult();
if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) {
IPath path = (IPath) results[0];
String containerName = path.toOSString();
outputFolderText.setText(containerName);
}
}
});
}
Aggregations