本文整理匯總了Java中org.eclipse.ui.dialogs.ElementTreeSelectionDialog.OK屬性的典型用法代碼示例。如果您正苦於以下問題:Java ElementTreeSelectionDialog.OK屬性的具體用法?Java ElementTreeSelectionDialog.OK怎麽用?Java ElementTreeSelectionDialog.OK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.ui.dialogs.ElementTreeSelectionDialog
的用法示例。
在下文中一共展示了ElementTreeSelectionDialog.OK屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: selectFile
/**
* Open a dialog box asking the user to select an existing project under the
* current workspace.
*
* @param parentShell
* @param title
*/
public static IResource selectFile(Shell parentShell, String title) {
ElementTreeSelectionDialog dialog =
new ElementTreeSelectionDialog(
parentShell,
new WorkbenchLabelProvider(),
new WorkbenchContentProvider()
);
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
dialog.setTitle(title);
dialog.setAllowMultiple(false);
if(dialog.open() == ElementTreeSelectionDialog.OK) {
return (IResource) dialog.getFirstResult();
}
return null;
}
示例2: handleManifestfileBrowse
/**
* Uses the standard container selection dialog to choose the new value for
* the container field.
*/
private void handleManifestfileBrowse() {
String manifestFilename = getManifestfile();
ILabelProvider lp = new WorkbenchLabelProvider();
ITreeContentProvider cp = new WorkbenchContentProvider();
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), lp, cp);
dialog.setValidator(null);
dialog.setAllowMultiple(false);
dialog.setTitle("Select Manifest File"); //$NON-NLS-1$
// dialog.setMessage("msg?"); //$NON-NLS-1$
// dialog.addFilter(filter);
// dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
dialog.setInput(jproject.getProject());
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (dialog.open() == ElementTreeSelectionDialog.OK) {
Object[] elements = dialog.getResult();
if (elements.length == 1) {
manifestFilename = ((IResource) elements[0]).getFullPath().toOSString();
int n = manifestFilename.indexOf(File.separatorChar, 1);
if (n != -1)
manifestFilename = manifestFilename.substring(n + 1);
manifestfileText.setText(manifestFilename);
}
}
}
示例3: selectWorkspaceDir
private String selectWorkspaceDir() {
String result = null;
ILabelProvider lp = new WorkbenchLabelProvider();
ITreeContentProvider cp = new WorkbenchContentProvider();
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
getShell(), lp, cp);
dialog.setValidator(null);
dialog.setAllowMultiple(false);
dialog.setTitle("Select base directory to add"); //$NON-NLS-1$
dialog.setMessage("msg?"); //$NON-NLS-1$
ViewerFilter filter = new ViewerFilter() {
public boolean select(Viewer viewer, Object parentElement,
Object element) {
boolean ok = (element instanceof Folder)
|| (element instanceof Project);
return ok;
}
};
dialog.addFilter(filter);
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (dialog.open() == ElementTreeSelectionDialog.OK) {
Object[] elements = dialog.getResult();
if (elements.length == 1) {
result = ((IResource) elements[0]).getFullPath().toOSString();
}
}
return result;
}
示例4: handleManifestfileBrowse
/**
* Uses the standard container selection dialog to
* choose the new value for the container field.
*/
private void handleManifestfileBrowse() {
String manifestFilename = getManifestfile();
ILabelProvider lp= new WorkbenchLabelProvider();
ITreeContentProvider cp= new WorkbenchContentProvider();
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(
getShell(), lp, cp);
dialog.setValidator(null);
dialog.setAllowMultiple(false);
dialog.setTitle("Select Manifest File"); //$NON-NLS-1$
// dialog.setMessage("msg?"); //$NON-NLS-1$
//dialog.addFilter(filter);
// dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
//TODO: Validate Input, Make project list IAdaptable
// dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
dialog.setInput(jproject.getProject());
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (dialog.open() == ElementTreeSelectionDialog.OK) {
Object[] elements= dialog.getResult();
if (elements.length == 1) {
manifestFilename = ((IResource)elements[0]).getLocation().toOSString();
// int n = manifestFilename.indexOf(File.separatorChar,1);
// if (n!=-1)
// manifestFilename = manifestFilename.substring(n+1);
manifestfileText.setText(manifestFilename);
}
}
}
示例5: selectWorkspaceDir
private String selectWorkspaceDir() {
String result = null;
ILabelProvider lp= new WorkbenchLabelProvider();
ITreeContentProvider cp= new WorkbenchContentProvider();
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(
getShell(), lp, cp);
dialog.setValidator(null);
dialog.setAllowMultiple(false);
dialog.setTitle("Select base directory to add"); //$NON-NLS-1$
dialog.setMessage("msg?"); //$NON-NLS-1$
ViewerFilter filter = new ViewerFilter() {
public boolean select(Viewer viewer, Object parentElement, Object element) {
boolean ok = (element instanceof Folder) || (element instanceof Project);
return ok;
}
};
dialog.addFilter(filter);
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (dialog.open() == ElementTreeSelectionDialog.OK) {
Object[] elements= dialog.getResult();
if (elements.length == 1) {
result = ((IResource)elements[0]).getFullPath().toOSString();
}
}
return result;
}
示例6: open
/**
* Opens the selection dialog and tells if the user validated to selection.
*
* @return true when a selection was made, false otherwise.
*/
public boolean open() {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService()
.getSelection();
IStructuredSelection structuredSelection = (selection != null && selection instanceof IStructuredSelection)
? (IStructuredSelection) selection
: new StructuredSelection();
boolean result = false;
try {
ResourceCollector collector = root != null ? ResourceCollector.run(root) : ResourceCollector.run();
hadDoxyfiles = collector.isEmpty() == false;
if (collector.isEmpty() == false) {
MyDoxyfileSelectionDialog selectionDialog = new MyDoxyfileSelectionDialog(shell, new MyLabelProvider(),
new MyContentProvider());
selectionDialog.setAllowMultiple(false);
selectionDialog.setInput(collector.getDoxyfiles());
selectionDialog.setValidator(new MySelectionValidator());
selectionDialog.setEmptyListMessage("No Doxyfile found in opened projects.");
selectionDialog.setMessage("Select a Doxyfile:");
selectionDialog.setTitle("Doxyfile Selection");
selectionDialog.setInitialSelections(structuredSelection.toArray());
// Opens the selection dialog and save the selection.
if (selectionDialog.open() == ElementTreeSelectionDialog.OK) {
doxyfile = (IFile) selectionDialog.getFirstResult();
result = true;
}
}
} catch (Throwable t) {
eclox.ui.Plugin.log(t);
}
return result;
}