• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TypedElementSelectionValidator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator的典型用法代码示例。如果您正苦于以下问题:Java TypedElementSelectionValidator类的具体用法?Java TypedElementSelectionValidator怎么用?Java TypedElementSelectionValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TypedElementSelectionValidator类属于org.eclipse.jdt.internal.ui.wizards包,在下文中一共展示了TypedElementSelectionValidator类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: ClientBundleResourceSelectionDialog

import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator; //导入依赖的package包/类
private ClientBundleResourceSelectionDialog(Shell shell,
    IJavaProject javaProject, boolean multiSelection) {
  super(shell, new JavaElementLabelProvider(
      JavaElementLabelProvider.SHOW_DEFAULT),
      new StandardJavaElementContentProvider());
  setValidator(new TypedElementSelectionValidator(new Class[] {IFile.class},
      multiSelection));
  setComparator(new JavaElementComparator());
  setTitle("Resource Selection");
  String message = MessageFormat.format("Choose {0} to bundle:",
      (multiSelection ? "one or more resources" : "a resource"));
  setMessage(message);
  addFilter(new ViewerFilter(javaProject));
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:15,代码来源:ClientBundleResourceSelectionDialog.java


示例2: configureJAREntry

import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator; //导入依赖的package包/类
/**
 * Shows the UI to configure a JAR or ZIP archive located in the workspace.
 * The dialog returns the configured classpath entry path or <code>null</code> if the dialog has
 * been canceled. The dialog does not apply any changes.
 *
 * @param shell The parent shell for the dialog.
 * @param initialEntry The path of the initial archive entry
 * @param usedEntries An array of paths that are already on the classpath and therefore should not be
 * selected again.
 * @return Returns the configured JAR path or <code>null</code> if the dialog has
 * been canceled by the user.
 */
public static IPath configureJAREntry(Shell shell, IPath initialEntry, IPath[] usedEntries) {
	if (initialEntry == null || usedEntries == null) {
		throw new IllegalArgumentException();
	}

	Class<?>[] acceptedClasses= new Class[] { IFile.class };
	TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);

	ArrayList<IResource> usedJars= new ArrayList<IResource>(usedEntries.length);
	IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
	for (int i= 0; i < usedEntries.length; i++) {
		IPath curr= usedEntries[i];
		if (!curr.equals(initialEntry)) {
			IResource resource= root.findMember(usedEntries[i]);
			if (resource instanceof IFile) {
				usedJars.add(resource);
			}
		}
	}

	IResource existing= root.findMember(initialEntry);

	FilteredElementTreeSelectionDialog dialog= new FilteredElementTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
	dialog.setValidator(validator);
	dialog.setTitle(NewWizardMessages.BuildPathDialogAccess_JARArchiveDialog_edit_title);
	dialog.setMessage(NewWizardMessages.BuildPathDialogAccess_JARArchiveDialog_edit_description);
	dialog.setInitialFilter(ArchiveFileFilter.JARZIP_FILTER_STRING);
	dialog.addFilter(new ArchiveFileFilter(usedJars, true, true));
	dialog.setInput(root);
	dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
	dialog.setInitialSelection(existing);

	if (dialog.open() == Window.OK) {
		IResource element= (IResource) dialog.getFirstResult();
		return element.getFullPath();
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:51,代码来源:BuildPathDialogAccess.java


示例3: chooseJAREntries

import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator; //导入依赖的package包/类
/**
 * Shows the UI to select new JAR or ZIP archive entries located in the workspace.
 * The dialog returns the selected entries or <code>null</code> if the dialog has
 * been canceled. The dialog does not apply any changes.
 *
 * @param shell The parent shell for the dialog.
 * @param initialSelection The path of the element (container or archive) to initially select or <code>null</code> to not select an entry.
 * @param usedEntries An array of paths that are already on the classpath and therefore should not be
 * selected again.
 * @return Returns the new JAR paths or <code>null</code> if the dialog has
 * been canceled by the user.
 */
public static IPath[] chooseJAREntries(Shell shell, IPath initialSelection, IPath[] usedEntries) {
	if (usedEntries == null) {
		throw new IllegalArgumentException();
	}

	Class<?>[] acceptedClasses= new Class[] { IFile.class };
	TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, true);
	ArrayList<IResource> usedJars= new ArrayList<IResource>(usedEntries.length);
	IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
	for (int i= 0; i < usedEntries.length; i++) {
		IResource resource= root.findMember(usedEntries[i]);
		if (resource instanceof IFile) {
			usedJars.add(resource);
		}
	}
	IResource focus= initialSelection != null ? root.findMember(initialSelection) : null;

	FilteredElementTreeSelectionDialog dialog= new FilteredElementTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
	dialog.setHelpAvailable(false);
	dialog.setValidator(validator);
	dialog.setTitle(NewWizardMessages.BuildPathDialogAccess_JARArchiveDialog_new_title);
	dialog.setMessage(NewWizardMessages.BuildPathDialogAccess_JARArchiveDialog_new_description);
	dialog.setInitialFilter(ArchiveFileFilter.JARZIP_FILTER_STRING);
	dialog.addFilter(new ArchiveFileFilter(usedJars, true, true));
	dialog.setInput(root);
	dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
	dialog.setInitialSelection(focus);

	if (dialog.open() == Window.OK) {
		Object[] elements= dialog.getResult();
		IPath[] res= new IPath[elements.length];
		for (int i= 0; i < res.length; i++) {
			IResource elem= (IResource)elements[i];
			res[i]= elem.getFullPath();
		}
		return res;
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:52,代码来源:BuildPathDialogAccess.java


示例4: chooseWorkspaceArchive

import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator; //导入依赖的package包/类
private String chooseWorkspaceArchive() {
	String initSelection= fArchiveField.getText();

	ILabelProvider lp= new WorkbenchLabelProvider();
	ITreeContentProvider cp= new WorkbenchContentProvider();
	Class<?>[] acceptedClasses= new Class[] { IFile.class };
	TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, true);

	IResource initSel= null;
	IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
	if (initSelection.length() > 0) {
		initSel= root.findMember(new Path(initSelection));
	}

	FilteredElementTreeSelectionDialog dialog= new FilteredElementTreeSelectionDialog(fShell, lp, cp);
	dialog.setInitialFilter(ArchiveFileFilter.JARZIP_FILTER_STRING);
	dialog.setAllowMultiple(false);
	dialog.setValidator(validator);
	dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
	dialog.setTitle(PreferencesMessages.JavadocConfigurationBlock_workspace_archive_selection_dialog_title);
	dialog.setMessage(PreferencesMessages.JavadocConfigurationBlock_workspace_archive_selection_dialog_description);
	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,代码行数:31,代码来源:JavadocConfigurationBlock.java


示例5: chooseInternal

import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator; //导入依赖的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


示例6: chooseContainer

import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator; //导入依赖的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


示例7: chooseFolder

import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator; //导入依赖的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


示例8: chooseOutputLocation

import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator; //导入依赖的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


示例9: chooseExclusionPattern

import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator; //导入依赖的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



注:本文中的org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Event类代码示例发布时间:2022-05-22
下一篇:
Java Repository类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap