本文整理汇总了Java中org.eclipse.ui.dialogs.ISelectionStatusValidator类的典型用法代码示例。如果您正苦于以下问题:Java ISelectionStatusValidator类的具体用法?Java ISelectionStatusValidator怎么用?Java ISelectionStatusValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISelectionStatusValidator类属于org.eclipse.ui.dialogs包,在下文中一共展示了ISelectionStatusValidator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: openTypeSelectionDialog
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
private void openTypeSelectionDialog(){
int elementKinds= IJavaSearchConstants.TYPE;
final IJavaSearchScope scope= createWorkspaceSourceScope();
FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false,
getWizard().getContainer(), scope, elementKinds);
dialog.setTitle(RefactoringMessages.MoveMembersInputPage_choose_Type);
dialog.setMessage(RefactoringMessages.MoveMembersInputPage_dialogMessage);
dialog.setValidator(new ISelectionStatusValidator(){
public IStatus validate(Object[] selection) {
Assert.isTrue(selection.length <= 1);
if (selection.length == 0)
return new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, RefactoringMessages.MoveMembersInputPage_Invalid_selection, null);
Object element= selection[0];
if (! (element instanceof IType))
return new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, RefactoringMessages.MoveMembersInputPage_Invalid_selection, null);
IType type= (IType)element;
return validateDestinationType(type, type.getElementName());
}
});
dialog.setInitialPattern(createInitialFilter());
if (dialog.open() == Window.CANCEL)
return;
IType firstResult= (IType)dialog.getFirstResult();
fDestinationField.setText(firstResult.getFullyQualifiedName('.'));
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:MoveMembersWizard.java
示例2: init
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
private void init() {
FindFileDialog listDialog = this;
// ElementListSelectionDialog listDialog = new ElementListSelectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), labelProvider);
listDialog.setStatusLineAboveButtons(true);
listDialog.setValidator(new ISelectionStatusValidator() {
@Override
public IStatus validate(Object[] selection) {
IResource r = (IResource) selection[0];
return new Status(IStatus.INFO, Activator.PLUGIN_ID, r.getProjectRelativePath().toPortableString());
}
});
listDialog.setMultipleSelection(false);
listDialog.setTitle("ATL files in the workspace");
listDialog.setMessage("");
// listDialog.setElements(list.toArray());
// listDialog.open();
}
开发者ID:jesusc,项目名称:bento,代码行数:21,代码来源:FindFileDialog.java
示例3: WorkspaceResourceSelectionDialog
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
public WorkspaceResourceSelectionDialog(Shell parent, Mode mode) {
super(parent, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
this.mode = mode;
setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
if (selection.length > 0 && checkMode(selection[0])) {
return new Status(IStatus.OK, TypeScriptUIPlugin.PLUGIN_ID, IStatus.OK, EMPTY_STRING, null);
}
return new Status(IStatus.ERROR, TypeScriptUIPlugin.PLUGIN_ID, IStatus.ERROR, EMPTY_STRING, null);
}
});
setInput(ResourcesPlugin.getWorkspace().getRoot());
}
开发者ID:angelozerr,项目名称:typescript.java,代码行数:14,代码来源:WorkspaceResourceSelectionDialog.java
示例4: FileSelectionDialog
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
public FileSelectionDialog(Shell parent, List<IFile> files, String title,
String message, String filterExtension, String filterMessage) {
super(parent, new WorkbenchLabelProvider(),
new WorkbenchContentProvider());
setTitle(title);
setMessage(message);
fFilter = new FileFilter(files, filterExtension);
fFilterMessage = filterMessage;
setInput(ResourcesPlugin.getWorkspace().getRoot());
setComparator(new ResourceComparator(ResourceComparator.NAME));
ISelectionStatusValidator validator = new ISelectionStatusValidator() {
@Override
public IStatus validate(Object[] selection) {
if (selection.length == 0) {
return new Status(IStatus.ERROR,
JSBuildFileUIPlugin.PLUGIN_ID, 0, "", null);
}
for (int i = 0; i < selection.length; i++) {
if (!(selection[i] instanceof IFile)) {
return new Status(IStatus.ERROR,
JSBuildFileUIPlugin.PLUGIN_ID, 0, "", null);
}
}
return new Status(IStatus.OK, JSBuildFileUIPlugin.PLUGIN_ID, 0,
"", null);
}
};
setValidator(validator);
}
开发者ID:angelozerr,项目名称:jsbuild-eclipse,代码行数:32,代码来源:FileSelectionDialog.java
示例5: chooseException
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
private IType chooseException() {
IJavaElement[] elements= new IJavaElement[] { fProject.getJavaProject() };
final IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false,
PlatformUI.getWorkbench().getProgressService(), scope, IJavaSearchConstants.CLASS);
dialog.setTitle(RefactoringMessages.ChangeExceptionsControl_choose_title);
dialog.setMessage(RefactoringMessages.ChangeExceptionsControl_choose_message);
dialog.setInitialPattern("*Exception*"); //$NON-NLS-1$
dialog.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
if (selection.length == 0)
return new StatusInfo(IStatus.ERROR, ""); //$NON-NLS-1$
try {
return checkException((IType)selection[0]);
} catch (JavaModelException e) {
JavaPlugin.log(e);
return StatusInfo.OK_STATUS;
}
}
});
if (dialog.open() == Window.OK) {
return (IType) dialog.getFirstResult();
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:ChangeExceptionsControl.java
示例6: createWorkspaceFileSelectionDialog
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的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;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:JarManifestWizardPage.java
示例7: chooseFolder
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
private IFolder chooseFolder(String title, String message, IPath initialPath) {
Class<?>[] acceptedClasses= new Class[] { IFolder.class };
ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);
ViewerFilter filter= new TypedViewerFilter(acceptedClasses, null);
ILabelProvider lp= new WorkbenchLabelProvider();
ITreeContentProvider cp= new WorkbenchContentProvider();
IProject currProject= fCurrJProject.getProject();
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), lp, cp);
dialog.setValidator(validator);
dialog.setTitle(title);
dialog.setMessage(message);
dialog.addFilter(filter);
dialog.setInput(currProject);
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
IResource res= currProject.findMember(initialPath);
if (res != null) {
dialog.setInitialSelection(res);
}
if (dialog.open() == Window.OK) {
return (IFolder) dialog.getFirstResult();
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:NewSourceFolderWizardPage.java
示例8: chooseContainer
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
private IContainer chooseContainer() {
Class<?>[] acceptedClasses= new Class[] { IProject.class, IFolder.class };
ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);
IProject[] allProjects= fWorkspaceRoot.getProjects();
ArrayList<IProject> rejectedElements= new ArrayList<IProject>(allProjects.length);
IProject currProject= fCurrJProject.getProject();
for (int i= 0; i < allProjects.length; i++) {
if (!allProjects[i].equals(currProject)) {
rejectedElements.add(allProjects[i]);
}
}
ViewerFilter filter= new TypedViewerFilter(acceptedClasses, rejectedElements.toArray());
ILabelProvider lp= new WorkbenchLabelProvider();
ITreeContentProvider cp= new WorkbenchContentProvider();
IResource initSelection= null;
if (fOutputLocationPath != null) {
initSelection= fWorkspaceRoot.findMember(fOutputLocationPath);
}
FolderSelectionDialog dialog= new FolderSelectionDialog(getShell(), lp, cp);
dialog.setTitle(NewWizardMessages.BuildPathsBlock_ChooseOutputFolderDialog_title);
dialog.setValidator(validator);
dialog.setMessage(NewWizardMessages.BuildPathsBlock_ChooseOutputFolderDialog_description);
dialog.addFilter(filter);
dialog.setInput(fWorkspaceRoot);
dialog.setInitialSelection(initSelection);
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (dialog.open() == Window.OK) {
return (IContainer)dialog.getFirstResult();
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:36,代码来源:BuildPathsBlock.java
示例9: chooseFolder
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
private IFolder chooseFolder(String title, String message, IPath initialPath) {
Class<?>[] acceptedClasses= new Class[] { IFolder.class };
ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);
ViewerFilter filter= new TypedViewerFilter(acceptedClasses, null);
ILabelProvider lp= new WorkbenchLabelProvider();
ITreeContentProvider cp= new WorkbenchContentProvider();
IProject currProject= fNewElement.getJavaProject().getProject();
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), lp, cp) {
@Override
protected Control createDialogArea(Composite parent) {
Control result= super.createDialogArea(parent);
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJavaHelpContextIds.BP_CHOOSE_EXISTING_FOLDER_TO_MAKE_SOURCE_FOLDER);
return result;
}
};
dialog.setValidator(validator);
dialog.setTitle(title);
dialog.setMessage(message);
dialog.addFilter(filter);
dialog.setInput(currProject);
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
IResource res= currProject.findMember(initialPath);
if (res != null) {
dialog.setInitialSelection(res);
}
if (dialog.open() == Window.OK) {
return (IFolder) dialog.getFirstResult();
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:AddSourceFolderWizardPage.java
示例10: addMultipleEntries
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
private void addMultipleEntries(ListDialogField field) {
Class[] acceptedClasses = new Class[] { IFolder.class, IFile.class };
ISelectionStatusValidator validator = new TypedElementSelectionValidator(
acceptedClasses, true);
ViewerFilter filter = new TypedViewerFilter(acceptedClasses);
ILabelProvider lp = new WorkbenchLabelProvider();
ITreeContentProvider cp = new WorkbenchContentProvider();
String title, message;
if (isExclusion(field)) {
title = "Exclusion Pattern Selection";
message = "&Choose folders or files to exclude:";
} else {
title = "Inclusion Pattern Selection";
message = "&Choose folders or files to include:";
}
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
lp, cp);
dialog.setTitle(title);
dialog.setValidator(validator);
dialog.setMessage(message);
dialog.addFilter(filter);
dialog.setInput(currSourceFolder);
dialog.setInitialSelection(null);
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (dialog.open() == Window.OK) {
Object[] objects = dialog.getResult();
int existingSegments = currSourceFolder.getFullPath().segmentCount();
for (int i = 0; i < objects.length; i++) {
IResource curr = (IResource) objects[i];
IPath path = curr.getFullPath().removeFirstSegments(existingSegments)
.makeRelative();
String res;
if (curr instanceof IContainer) {
res = path.addTrailingSeparator().toString();
} else {
res = path.toString();
}
field.addElement(res);
}
}
}
开发者ID:iloveeclipse,项目名称:filesync4eclipse,代码行数:46,代码来源:InclusionExclusionDialog.java
示例11: openFileDialog
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
private IPath openFileDialog(IPath path) {
Class[] acceptedClasses = new Class[] { IFile.class, IFolder.class,
IProject.class };
ISelectionStatusValidator validator = new TypedElementSelectionValidator(
acceptedClasses, false) {
@Override
public IStatus validate(Object[] elements) {
if (elements.length > 1 || elements.length == 0
|| !(elements[0] instanceof IFile)) {
return errorStatus;
}
return okStatus;
}
};
IProject[] allProjects = workspaceRoot.getProjects();
ArrayList rejectedElements = new ArrayList(allProjects.length);
for (int i = 0; i < allProjects.length; i++) {
if (!allProjects[i].equals(project)) {
rejectedElements.add(allProjects[i]);
}
}
ViewerFilter filter = new TypedViewerFilter(acceptedClasses, rejectedElements
.toArray());
ILabelProvider lp = new WorkbenchLabelProvider();
ITreeContentProvider cp = new WorkbenchContentProvider();
IResource initSelection = null;
if (path != null) {
initSelection = project.findMember(path);
}
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
lp, cp);
dialog.setTitle("Variables");
dialog.setValidator(validator);
dialog.setMessage("Select file with variables definition");
dialog.addFilter(filter);
dialog.setInput(workspaceRoot);
dialog.setInitialSelection(initSelection);
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (dialog.open() == Window.OK) {
return ((IFile) dialog.getFirstResult()).getProjectRelativePath();
}
return null;
}
开发者ID:iloveeclipse,项目名称:filesync4eclipse,代码行数:49,代码来源:ProjectSyncPropertyPage.java
示例12: chooseExclusionPattern
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
private IPath chooseExclusionPattern() {
Class[] acceptedClasses = new Class[] { IFolder.class, IFile.class };
ISelectionStatusValidator validator = new TypedElementSelectionValidator(
acceptedClasses, false);
ViewerFilter filter = new TypedViewerFilter(acceptedClasses);
ILabelProvider lp = new WorkbenchLabelProvider();
ITreeContentProvider cp = new WorkbenchContentProvider();
IPath initialPath = new Path(exclPatternDialog.getText());
IResource initialElement = null;
IContainer curr = currSourceFolder;
int nSegments = initialPath.segmentCount();
for (int i = 0; i < nSegments; i++) {
IResource elem = curr.findMember(initialPath.segment(i));
if (elem != null) {
initialElement = elem;
}
if (elem instanceof IContainer) {
curr = (IContainer) elem;
} else {
break;
}
}
String title, message;
if (isExclusion) {
title = "Exclusion Pattern Selection";
message = "&Choose a folder or file to exclude:";
} else {
title = "Inclusion Pattern Selection";
message = "&Choose a folder or file to include:";
}
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
getShell(), lp, cp);
dialog.setTitle(title);
dialog.setValidator(validator);
dialog.setMessage(message);
dialog.addFilter(filter);
dialog.setInput(currSourceFolder);
dialog.setInitialSelection(initialElement);
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (dialog.open() == Window.OK) {
IResource res = (IResource) dialog.getFirstResult();
IPath path = res.getFullPath().removeFirstSegments(
currSourceFolder.getFullPath().segmentCount())
.makeRelative();
if (res instanceof IContainer) {
return path.addTrailingSeparator();
}
return path;
}
return null;
}
开发者ID:iloveeclipse,项目名称:filesync4eclipse,代码行数:56,代码来源:InclusionExclusionEntryDialog.java
示例13: getFile
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
/**
* Helper to open the file chooser dialog.
*
* @param startingDirectory
* the directory to open the dialog on.
* @return File The File the user selected or <code>null</code> if they do not.
*/
private IFile getFile(IResource resource) {
String project = (baseURI != null ? baseURI.segment(1) : null);
Shell shell = getShell();
WorkspaceLabelProvider labelProvider = new WorkspaceLabelProvider();
WorkbenchContentProvider contentProvider = new WorkbenchContentProvider();
final WorkspaceResourceDialog dialog = new WorkspaceResourceDialog(shell, labelProvider, contentProvider) {
@Override
protected void fileTextModified(String text) {
super.fileTextModified(text);
updateOKStatus();
}
};
dialog.setAllowMultiple(false);
String decodedProject = CommonUtils.decodeUTF8(project);
dialog.setTitle(project != null ? decodedProject : CommonUIPlugin.INSTANCE.getString("_UI_FileSelection_title"));//$NON-NLS-1$
dialog.setMessage(null);
dialog.setShowNewFolderControl(true);
if (style == SWT.SAVE) {
dialog.setShowFileControl(true);
}
dialog.addFilter(dialog.createDefaultViewerFilter(true));
dialog.addFilter(new FilePatternFilter());
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
Object input = (project != null ? root.getProject(decodedProject) : null);
if (input == null) {
input = root;
}
dialog.setValidator(new ISelectionStatusValidator() {
@Override
public IStatus validate(Object[] selection) {
if (selection.length == 0) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, MUST_SELECT_AN_OUTPUT_FOLDER);
} else if (selection.length > 0) {
Object s = selection[0];
if (s instanceof IFile) {
return hasValidExtension(((IFile) s).getName());
}
}
return hasValidExtension(dialog.getFileText());
}
});
dialog.setInput(input);
dialog.setInitialSelection(resource);
if (dialog.open() == Window.OK) {
IFile file = getFileFromDialog(dialog);
if (file != null) {
getTextControl().setFocus();
return file;
}
}
return null;
}
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:63,代码来源:IFileFieldEditor.java
示例14: setValidator
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
public void setValidator(ISelectionStatusValidator validator) {
fValidator= validator;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:TypeSelectionDialog2.java
示例15: createValidator
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
private static ISelectionStatusValidator createValidator(int entries) {
AddGetterSetterSelectionStatusValidator validator= new AddGetterSetterSelectionStatusValidator(entries);
return validator;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:AddGetterSetterAction.java
示例16: createPackageDialog
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
/**
* Creates a selection dialog that lists all packages under the given package
* fragment root.
* The caller is responsible for opening the dialog with <code>Window.open</code>,
* and subsequently extracting the selected packages (of type
* <code>IPackageFragment</code>) via <code>SelectionDialog.getResult</code>.
*
* @param packageFragments the package fragments
* @return a new selection dialog
*/
protected SelectionDialog createPackageDialog(Set<IJavaElement> packageFragments) {
List<IPackageFragment> packages= new ArrayList<IPackageFragment>(packageFragments.size());
for (Iterator<IJavaElement> iter= packageFragments.iterator(); iter.hasNext();) {
IPackageFragment fragment= (IPackageFragment)iter.next();
boolean containsJavaElements= false;
int kind;
try {
kind= fragment.getKind();
containsJavaElements= fragment.getChildren().length > 0;
} catch (JavaModelException ex) {
ExceptionHandler.handle(ex, getContainer().getShell(), JarPackagerMessages.JarManifestWizardPage_error_jarPackageWizardError_title, Messages.format(JarPackagerMessages.JarManifestWizardPage_error_jarPackageWizardError_message, JavaElementLabels.getElementLabel(fragment, JavaElementLabels.ALL_DEFAULT)));
continue;
}
if (kind != IPackageFragmentRoot.K_BINARY && containsJavaElements)
packages.add(fragment);
}
StandardJavaElementContentProvider cp= new StandardJavaElementContentProvider() {
@Override
public boolean hasChildren(Object element) {
// prevent the + from being shown in front of packages
return !(element instanceof IPackageFragment) && super.hasChildren(element);
}
};
final DecoratingLabelProvider provider= new DecoratingLabelProvider(new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT), new ProblemsLabelDecorator(null));
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getContainer().getShell(), provider, cp);
dialog.setDoubleClickSelects(false);
dialog.setComparator(new JavaElementComparator());
dialog.setInput(JavaCore.create(JavaPlugin.getWorkspace().getRoot()));
dialog.addFilter(new EmptyInnerPackageFilter());
dialog.addFilter(new LibraryFilter());
dialog.addFilter(new SealPackagesFilter(packages));
dialog.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
StatusInfo res= new StatusInfo();
for (int i= 0; i < selection.length; i++) {
if (!(selection[i] instanceof IPackageFragment)) {
res.setError(JarPackagerMessages.JarManifestWizardPage_error_mustContainPackages);
return res;
}
}
res.setOK();
return res;
}
});
return dialog;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:57,代码来源:JarManifestWizardPage.java
示例17: getSelectionValidator
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
@Override
public ISelectionStatusValidator getSelectionValidator() {
return getValidator();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:GenerateToStringDialog.java
示例18: chooseOutputLocation
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
private IContainer chooseOutputLocation() {
IWorkspaceRoot root= fCurrProject.getWorkspace().getRoot();
final Class<?>[] acceptedClasses= new Class[] { IProject.class, IFolder.class };
IProject[] allProjects= root.getProjects();
ArrayList<IProject> rejectedElements= new ArrayList<IProject>(allProjects.length);
for (int i= 0; i < allProjects.length; i++) {
if (!allProjects[i].equals(fCurrProject)) {
rejectedElements.add(allProjects[i]);
}
}
ViewerFilter filter= new TypedViewerFilter(acceptedClasses, rejectedElements.toArray());
ILabelProvider lp= new WorkbenchLabelProvider();
ITreeContentProvider cp= new WorkbenchContentProvider();
IResource initSelection= null;
if (fOutputLocation != null) {
initSelection= root.findMember(fOutputLocation);
}
FolderSelectionDialog dialog= new FolderSelectionDialog(getShell(), lp, cp);
dialog.setTitle(NewWizardMessages.OutputLocationDialog_ChooseOutputFolder_title);
dialog.setValidator(new ISelectionStatusValidator() {
ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);
public IStatus validate(Object[] selection) {
IStatus typedStatus= validator.validate(selection);
if (!typedStatus.isOK())
return typedStatus;
if (selection[0] instanceof IFolder) {
IFolder folder= (IFolder) selection[0];
try {
IStatus result= ClasspathModifier.checkSetOutputLocationPrecondition(fEntryToEdit, folder.getFullPath(), fAllowInvalidClasspath, fCPJavaProject);
if (result.getSeverity() == IStatus.ERROR)
return result;
} catch (CoreException e) {
JavaPlugin.log(e);
}
return new StatusInfo();
} else {
return new StatusInfo(IStatus.ERROR, ""); //$NON-NLS-1$
}
}
});
dialog.setMessage(NewWizardMessages.OutputLocationDialog_ChooseOutputFolder_description);
dialog.addFilter(filter);
dialog.setInput(root);
dialog.setInitialSelection(initSelection);
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (dialog.open() == Window.OK) {
return (IContainer)dialog.getFirstResult();
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:56,代码来源:OutputLocationDialog.java
示例19: chooseExclusionPattern
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
public static IPath[] chooseExclusionPattern(Shell shell, IContainer currentSourceFolder, String title, String message, IPath initialPath, boolean multiSelection) {
Class<?>[] acceptedClasses= new Class[] { IFolder.class, IFile.class };
ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, multiSelection);
ViewerFilter filter= new TypedViewerFilter(acceptedClasses);
ILabelProvider lp= new WorkbenchLabelProvider();
ITreeContentProvider cp= new WorkbenchContentProvider();
IResource initialElement= null;
if (initialPath != null) {
IContainer curr= currentSourceFolder;
int nSegments= initialPath.segmentCount();
for (int i= 0; i < nSegments; i++) {
IResource elem= curr.findMember(initialPath.segment(i));
if (elem != null) {
initialElement= elem;
}
if (elem instanceof IContainer) {
curr= (IContainer) elem;
} else {
break;
}
}
}
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(shell, lp, cp);
dialog.setTitle(title);
dialog.setValidator(validator);
dialog.setMessage(message);
dialog.addFilter(filter);
dialog.setInput(currentSourceFolder);
dialog.setInitialSelection(initialElement);
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
dialog.setHelpAvailable(false);
if (dialog.open() == Window.OK) {
Object[] objects= dialog.getResult();
int existingSegments= currentSourceFolder.getFullPath().segmentCount();
IPath[] resArr= new IPath[objects.length];
for (int i= 0; i < objects.length; i++) {
IResource currRes= (IResource) objects[i];
IPath path= currRes.getFullPath().removeFirstSegments(existingSegments).makeRelative();
if (currRes instanceof IContainer) {
path= path.addTrailingSeparator();
}
resArr[i]= path;
}
return resArr;
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:54,代码来源:ExclusionInclusionEntryDialog.java
示例20: MoveResourceDialog
import org.eclipse.ui.dialogs.ISelectionStatusValidator; //导入依赖的package包/类
/**
* Constructs a dialog for moving resource.
*
* @param files
*/
public MoveResourceDialog( final Collection<File> files )
{
super( false, false, null );
setTitle( Messages.getString( "MoveResourceDialog.Title" ) );
setMessage( Messages.getString( "MoveResourceDialog.Message" ) );
setDoubleClickSelects( true );
setAllowMultiple( false );
setHelpAvailable( false );
setEmptyFolderShowStatus( IResourceContentProvider.ALWAYS_SHOW_EMPTYFOLDER );
setValidator( new ISelectionStatusValidator( ) {
public IStatus validate( Object[] selection )
{
for ( Object s : selection )
{
if ( s instanceof ResourceEntry )
{
URL url = ( (ResourceEntry) s ).getURL( );
try {
url = URIUtil.toURI(url).toURL();
} catch (Exception e1) {
}
for ( File f : files )
{
try
{
if ( url.equals( f.getParentFile( )
.toURI( )
.toURL( ) )
|| url.equals( f.toURI( ).toURL( ) ) )
return new Status( IStatus.ERROR,
ReportPlugin.REPORT_UI,
"" );
}
catch ( MalformedURLException e )
{
}
}
}
}
return new Status( IStatus.OK, ReportPlugin.REPORT_UI, "" );
}
} );
}
开发者ID:eclipse,项目名称:birt,代码行数:50,代码来源:MoveResourceDialog.java
注:本文中的org.eclipse.ui.dialogs.ISelectionStatusValidator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论