org.eclipse.ui.dialogs.ResourceListSelectionDialog Java Examples

The following examples show how to use org.eclipse.ui.dialogs.ResourceListSelectionDialog. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LaunchConfigurationMainTab.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/***
 * Open a resource chooser to select a file
 **/
protected void browseFiles() {
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
	ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(), root, IResource.FILE);
	dialog.setTitle("Search File");
	if (dialog.open() == Window.OK) {
		Object[] files = dialog.getResult();
		IFile file = (IFile) files[0];
		fileText.setText(file.getFullPath().toString());
	}

}
 
Example #2
Source File: AbstractLaunchConfigurationMainTab.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Open a resource chooser to select a resource as the main entry point for the launch.
 */
protected String searchResource() {
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
	ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(), root,
			getAcceptedResourceTypes());
	dialog.setTitle("Search " + getResourceLabel());
	if (dialog.open() == Window.OK) {
		Object[] files = dialog.getResult();
		IFile file = (IFile) files[0];
		return file.getFullPath().toString();
	}
	return null;
}