本文整理匯總了Java中org.eclipse.ui.dialogs.ElementTreeSelectionDialog.setAllowMultiple方法的典型用法代碼示例。如果您正苦於以下問題:Java ElementTreeSelectionDialog.setAllowMultiple方法的具體用法?Java ElementTreeSelectionDialog.setAllowMultiple怎麽用?Java ElementTreeSelectionDialog.setAllowMultiple使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.ui.dialogs.ElementTreeSelectionDialog
的用法示例。
在下文中一共展示了ElementTreeSelectionDialog.setAllowMultiple方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: chooseWorkspace
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
protected void chooseWorkspace ()
{
final ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog ( getShell (), new WorkbenchLabelProvider (), new WorkbenchContentProvider () );
dialog.setTitle ( "Select driver exporter configuration file" );
dialog.setMessage ( "Choose a driver exporter file for the configuration" );
dialog.setInput ( ResourcesPlugin.getWorkspace ().getRoot () );
dialog.setComparator ( new ResourceComparator ( ResourceComparator.NAME ) );
dialog.setAllowMultiple ( true );
dialog.setDialogBoundsSettings ( getDialogBoundsSettings ( HiveTab.WORKSPACE_SELECTION_DIALOG ), Dialog.DIALOG_PERSISTSIZE );
if ( dialog.open () == IDialogConstants.OK_ID )
{
final IResource resource = (IResource)dialog.getFirstResult ();
if ( resource != null )
{
final String arg = resource.getFullPath ().toString ();
final String fileLoc = VariablesPlugin.getDefault ().getStringVariableManager ().generateVariableExpression ( "workspace_loc", arg ); //$NON-NLS-1$
this.fileText.setText ( fileLoc );
makeDirty ();
}
}
}
示例2: selectFile
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
* 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;
}
示例3: createElementTreeSelectionDialog
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
* Creates a dialog used to select exactly <i>one</i> value from the input
* tree.
*
* @param shell
* The parent shell for the dialog.
* @param labelProvider
* The label provider for the tree.
* @param contentProvider
* The content provider for the tree.
* @return The new dialog.
*/
private ElementTreeSelectionDialog createElementTreeSelectionDialog(
Shell shell, ILabelProvider labelProvider,
ITreeContentProvider contentProvider) {
// Create a custom selection listener to update the selected elements on
// the fly.
final ISelectionChangedListener selectionListener = createSelectionChangedListener();
ElementTreeSelectionDialog treeDialog = new ElementTreeSelectionDialog(
shell, labelProvider, contentProvider) {
/*
* (non-Javadoc)
* @see org.eclipse.ui.dialogs.ElementTreeSelectionDialog#createTreeViewer(org.eclipse.swt.widgets.Composite)
*/
@Override
protected TreeViewer createTreeViewer(Composite parent) {
TreeViewer viewer = super.createTreeViewer(parent);
// Add the selection changed listener.
viewer.addSelectionChangedListener(selectionListener);
return viewer;
}
};
// Do not allow multi-selection here.
treeDialog.setAllowMultiple(false);
return treeDialog;
}
示例4: handleManifestfileBrowse
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
* 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);
}
}
}
示例5: selectWorkspaceDir
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
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: handleManifestfileBrowse
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
* 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);
}
}
}
示例7: selectWorkspaceDir
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
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;
}
示例8: createWorkspaceFileSelectionDialog
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
* Creates and returns a dialog to choose an existing workspace file.
* @param title the title
* @param message the dialog message
* @return the dialog
*/
protected ElementTreeSelectionDialog createWorkspaceFileSelectionDialog(String title, String message) {
int labelFlags= JavaElementLabelProvider.SHOW_BASICS
| JavaElementLabelProvider.SHOW_OVERLAY_ICONS
| JavaElementLabelProvider.SHOW_SMALL_ICONS;
final DecoratingLabelProvider provider= new DecoratingLabelProvider(new JavaElementLabelProvider(labelFlags), new ProblemsLabelDecorator(null));
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), provider, new StandardJavaElementContentProvider());
dialog.setComparator(new JavaElementComparator());
dialog.setAllowMultiple(false);
dialog.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
StatusInfo res= new StatusInfo();
// only single selection
if (selection.length == 1 && (selection[0] instanceof IFile))
res.setOK();
else
res.setError(""); //$NON-NLS-1$
return res;
}
});
dialog.addFilter(new EmptyInnerPackageFilter());
dialog.addFilter(new LibraryFilter());
dialog.setTitle(title);
dialog.setMessage(message);
dialog.setStatusLineAboveButtons(true);
dialog.setInput(JavaCore.create(JavaPlugin.getWorkspace().getRoot()));
return dialog;
}
示例9: chooseInternal
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
private String chooseInternal() {
String initSelection= fPathField.getText();
ILabelProvider lp= new WorkbenchLabelProvider();
ITreeContentProvider cp= new WorkbenchContentProvider();
Class<?>[] acceptedClasses= new Class[] { IProject.class, IFolder.class };
TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, true);
ViewerFilter filter= new TypedViewerFilter(acceptedClasses);
IResource initSel= null;
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
if (initSelection.length() > 0) {
initSel= root.findMember(new Path(initSelection));
}
if (initSel == null) {
initSel= root.findMember(fEntry.getPath());
}
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(fShell, lp, cp);
dialog.setAllowMultiple(false);
dialog.setValidator(validator);
dialog.addFilter(filter);
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
dialog.setTitle(NewWizardMessages.NativeLibrariesDialog_intfiledialog_title);
dialog.setMessage(NewWizardMessages.NativeLibrariesDialog_intfiledialog_message);
dialog.setInput(root);
dialog.setInitialSelection(initSel);
dialog.setHelpAvailable(false);
if (dialog.open() == Window.OK) {
IResource res= (IResource) dialog.getFirstResult();
return res.getFullPath().makeRelative().toString();
}
return null;
}
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:35,代碼來源:NativeLibrariesConfigurationBlock.java
示例10: configureDialog
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
private void configureDialog(ElementTreeSelectionDialog diag, String title, String message, Object selection) {
diag.setTitle(title);
diag.setMessage("Select Folder");
diag.setAllowMultiple(false);
diag.setHelpAvailable(false);
diag.setInput(project);
if (selection != null) {
diag.setInitialSelection(selection);
}
}
示例11: createFileBrowseAdapter
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
* Creates a selection adaptor for a file browse button.
*
* @param text the text control.
* @param fileExtension the file extension.
* @param title the title for a dialog to select a file.
* @return a selection adaptor.
*/
private SelectionAdapter createFileBrowseAdapter(final Text text,
final String fileExtension, final String title) {
return new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
// create a tree selection dialog and initializes it.
ElementTreeSelectionDialog fileDialog = new ElementTreeSelectionDialog(
getShell(), new DecoratingLabelProvider(
new WorkbenchLabelProvider(), PlatformUI
.getWorkbench().getDecoratorManager()
.getLabelDecorator()),
new FileExtensionRestrictTreeContentProvider(fileExtension));
// set projects from workspace.
fileDialog.setInput(ResourcesPlugin.getWorkspace().getRoot()
.getProjects());
fileDialog.setAllowMultiple(false);
fileDialog.setBlockOnOpen(true);
fileDialog.setTitle(title);
fileDialog.open();
Object[] results = fileDialog.getResult();
if (results != null && results.length == 1
&& results[0] instanceof IResource) {
text.setText(((IResource) results[0]).getFullPath()
.toString());
}
}
};
}
示例12: showDialogAndGetDiagramFile
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
* Shows a dialog to select a diagram file to compare.
*
* @return selected diagram file.
*/
private IFile showDialogAndGetDiagramFile() {
ElementTreeSelectionDialog fileDialog = new ElementTreeSelectionDialog(
DcaseEditorUtil.getActiveWindowShell(),
new DecoratingLabelProvider(new WorkbenchLabelProvider(),
PlatformUI.getWorkbench().getDecoratorManager()
.getLabelDecorator()),
new FileExtensionRestrictTreeContentProvider(PropertyUtil
.getSystemProperty(DIAGRAM_FILE_EXTENSION)));
fileDialog.setInput(ResourcesPlugin.getWorkspace().getRoot()
.getProjects());
fileDialog.setAllowMultiple(false);
fileDialog.setBlockOnOpen(true);
// sets validator that tests whether a file is selected.
fileDialog.setValidator(new FileSelectionStatusValidator());
fileDialog.setTitle(Messages.CompareDcaseFileSelectionAdapter_1);
fileDialog.open();
Object[] results = fileDialog.getResult();
if (results == null) {
return null;
}
return (IFile) results[0];
}
示例13: internalChooseArchivePath
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
private String internalChooseArchivePath() {
ZipFile zipFile= null;
try {
if (fWorkspaceRadio.isSelected()) {
IResource resource= ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(fArchiveField.getText()));
if (resource != null) {
IPath location= resource.getLocation();
if (location != null) {
zipFile= new ZipFile(location.toOSString());
}
}
} else {
zipFile= new ZipFile(fArchiveField.getText());
}
if (zipFile == null) {
return null;
}
ZipFileStructureProvider provider= new ZipFileStructureProvider(zipFile);
ILabelProvider lp= new ZipDialogLabelProvider(provider);
ZipDialogContentProvider cp= new ZipDialogContentProvider(provider);
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(fShell, lp, cp);
dialog.setAllowMultiple(false);
dialog.setValidator(new ZipDialogValidator());
dialog.setTitle(PreferencesMessages.JavadocConfigurationBlock_browse_jarorzip_path_title);
dialog.setMessage(PreferencesMessages.JavadocConfigurationBlock_location_in_jarorzip_message);
dialog.setComparator(new ViewerComparator());
String init= fArchivePathField.getText();
if (init.length() == 0) {
init= "docs/api"; //$NON-NLS-1$
}
dialog.setInitialSelection(cp.findElement(new Path(init)));
dialog.setInput(this);
if (dialog.open() == Window.OK) {
String name= provider.getFullPath(dialog.getFirstResult());
return new Path(name).removeTrailingSeparator().toString();
}
} catch (IOException e) {
JavaPlugin.log(e);
} finally {
if (zipFile != null) {
try {
zipFile.close();
} catch (IOException e1) {
// ignore
}
}
}
return null;
}
示例14: selectAttachmentFromWS
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
* Select the attachment from the workspace.
*
* @param parent the parent.
* @param currentAttachment the original attachment.
* @return the selected attachment.
*/
private String selectAttachmentFromWS(Shell parent, String currentAttachment) {
IFile selectedFile = null;
if (currentAttachment != null && currentAttachment.length() > 0) {
selectedFile = FileUtil.getWorksapceFileFromPath(currentAttachment);
}
// creates tree and initializes it to show files in the workspace.
ElementTreeSelectionDialog fileDialog = new ElementTreeSelectionDialog(
parent, new DecoratingLabelProvider(
new WorkbenchLabelProvider(), PlatformUI
.getWorkbench().getDecoratorManager()
.getLabelDecorator()),
//new FileExtensionRestrictTreeContentProvider(null)
new WorkbenchContentProvider());
// sets projects to the tree selection dialog.
fileDialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
fileDialog.setAllowMultiple(false);
fileDialog.setBlockOnOpen(true);
// sets the validator.
fileDialog.setValidator(new FileSelectionStatusValidator());
fileDialog.setTitle(TermsMessages.SelectAttachmentHandler_0);
if (selectedFile != null) {
fileDialog.setInitialSelection(selectedFile);
}
fileDialog.open();
Object[] results = fileDialog.getResult();
// sets the value of the attachment attribute.
if (results != null && results.length == 1
&& results[0] instanceof IResource) {
String diagramPath = ((IResource) results[0]).getFullPath()
.toString();
return diagramPath;
}
return null;
}