當前位置: 首頁>>代碼示例>>Java>>正文


Java IPackageFragmentRoot.isArchive方法代碼示例

本文整理匯總了Java中org.eclipse.jdt.core.IPackageFragmentRoot.isArchive方法的典型用法代碼示例。如果您正苦於以下問題:Java IPackageFragmentRoot.isArchive方法的具體用法?Java IPackageFragmentRoot.isArchive怎麽用?Java IPackageFragmentRoot.isArchive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jdt.core.IPackageFragmentRoot的用法示例。


在下文中一共展示了IPackageFragmentRoot.isArchive方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: appendPackageFragmentRootLabel

import org.eclipse.jdt.core.IPackageFragmentRoot; //導入方法依賴的package包/類
/**
 * Appends the label for a package fragment root. Considers the ROOT_* flags.
 *
 * @param root the element to render
 * @param flags the rendering flags. Flags with names starting with ROOT_' are considered.
 */
public void appendPackageFragmentRootLabel(IPackageFragmentRoot root, long flags) {
	// Handle variables different
	if (getFlag(flags, JavaElementLabels.ROOT_VARIABLE) && appendVariableLabel(root, flags)) {
		return;
	}
	if (root.isArchive()) {
		appendArchiveLabel(root, flags);
	} else {
		appendFolderLabel(root, flags);
	}
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:18,代碼來源:JavaElementLabelComposer.java

示例2: getFixImportProposals

import org.eclipse.jdt.core.IPackageFragmentRoot; //導入方法依賴的package包/類
@Override
public ClasspathFixProposal[] getFixImportProposals(final IJavaProject project, String name) throws CoreException
{
	IProject requestedProject = project.getProject();
	if( !requestedProject.hasNature(JPFProjectNature.NATURE_ID) )
	{
		return null;
	}
	ArrayList<ClasspathFixProposal> props = new ArrayList<ClasspathFixProposal>();

	IWorkspace workspace = ResourcesPlugin.getWorkspace();
	int idx = name.lastIndexOf('.');
	char[] packageName = idx != -1 ? name.substring(0, idx).toCharArray() : null;
	char[] typeName = name.substring(idx + 1).toCharArray();

	if( typeName.length == 1 && typeName[0] == '*' )
	{
		typeName = null;
	}

	ArrayList<TypeNameMatch> res = new ArrayList<TypeNameMatch>();
	TypeNameMatchCollector requestor = new TypeNameMatchCollector(res);

	IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
	int matchMode = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
	new SearchEngine().searchAllTypeNames(packageName, matchMode, typeName, matchMode, IJavaSearchConstants.TYPE,
		scope, requestor, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null);

	if( res.isEmpty() )
	{
		return null;
	}
	JPFPluginModelManager service = JPFPluginModelManager.instance();
	for( TypeNameMatch curr : res )
	{
		IType type = curr.getType();
		if( type != null )
		{
			IPackageFragmentRoot root = (IPackageFragmentRoot) type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
			IPluginModel model = null;
			if( root.isArchive() )
			{
				model = service.findModel((IFile) root.getResource());
			}
			else if( !root.isExternal() )
			{
				model = service.findModel(root.getResource().getProject());
			}
			if( model != null )
			{
				System.err.println("Found in " + model.getParsedManifest().getId());
				props.add(new JPFClasspathFixProposal(project, JPFProject.getManifest(requestedProject), model));
			}
		}
	}
	return props.toArray(new ClasspathFixProposal[props.size()]);
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:58,代碼來源:JPFClasspathFixProcessor.java


注:本文中的org.eclipse.jdt.core.IPackageFragmentRoot.isArchive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。