当前位置: 首页>>代码示例>>Java>>正文


Java IPackageFragmentRoot.isExternal方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.IPackageFragmentRoot.isExternal方法的典型用法代码示例。如果您正苦于以下问题:Java IPackageFragmentRoot.isExternal方法的具体用法?Java IPackageFragmentRoot.isExternal怎么用?Java IPackageFragmentRoot.isExternal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.IPackageFragmentRoot的用法示例。


在下文中一共展示了IPackageFragmentRoot.isExternal方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compare

import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
  IPackageFragmentRoot root1 = (IPackageFragmentRoot) e1;
  IPackageFragmentRoot root2 = (IPackageFragmentRoot) e2;
  @SuppressWarnings("rawtypes")
  final Comparator comparator = getComparator();
  int result = comparator.compare(root1.getJavaProject().getElementName(),
      root2.getJavaProject().getElementName());
  if (result != 0)
    return result;
  if (root1.isExternal() != root2.isExternal()) {
    return root1.isExternal() ? 1 : -1;
  }
  return comparator.compare(getPathLabel(root1), getPathLabel(root2));
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:16,代码来源:ScopeViewer.java

示例2: getName

import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
String getName(IPackageFragmentRoot root) {
  IPath path = root.getPath();
  if (!root.isExternal() && path.segmentCount() > 1) {
    return path.removeFirstSegments(1).toString();
  } else {
    return path.lastSegment();
  }
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:9,代码来源:SessionAnalyzer.java

示例3: analyze

import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
AnalyzedNodes analyze(final IPackageFragmentRoot root) throws CoreException {
  if (root.isExternal()) {
    return analyzeExternal(root);
  } else {
    return analyzeInternal(root);
  }
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:8,代码来源:PackageFragementRootAnalyzer.java

示例4: appendArchiveLabel

import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
private void appendArchiveLabel(IPackageFragmentRoot root, long flags) {
	boolean external= root.isExternal();
	if (external) {
		appendExternalArchiveLabel(root, flags);
	} else {
		appendInternalArchiveLabel(root, flags);
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:9,代码来源:JavaElementLabelComposer.java

示例5: appendVariableLabel

import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
private boolean appendVariableLabel(IPackageFragmentRoot root, long flags) {
	try {
		IClasspathEntry rawEntry= root.getRawClasspathEntry();
		if (rawEntry.getEntryKind() == IClasspathEntry.CPE_VARIABLE) {
			IClasspathEntry entry= JavaModelUtil.getClasspathEntry(root);
			if (entry.getReferencingEntry() != null) {
				return false; // not the variable entry itself, but a referenced entry
			}
			IPath path= rawEntry.getPath().makeRelative();

			if (getFlag(flags, JavaElementLabels.REFERENCED_ROOT_POST_QUALIFIED)) {
				int segements= path.segmentCount();
				if (segements > 0) {
					fBuilder.append(path.segment(segements - 1));
					if (segements > 1) {
						fBuilder.append(JavaElementLabels.CONCAT_STRING);
						fBuilder.append(path.removeLastSegments(1).toOSString());
					}
				} else {
					fBuilder.append(path.toString());
				}
			} else {
				fBuilder.append(path.toString());
			}
			fBuilder.append(JavaElementLabels.CONCAT_STRING);
			if (root.isExternal()) {
				fBuilder.append(root.getPath().toOSString());
			} else {
				fBuilder.append(root.getPath().makeRelative().toString());
			}

			return true;
		}
	} catch (JavaModelException e) {
		// problems with class path, ignore (bug 202792)
		return false;
	}
	return false;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:40,代码来源:JavaElementLabelComposer.java

示例6: 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

示例7: getBuildPathForMethodInvocation

import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
public static Object[] getBuildPathForMethodInvocation() throws JavaModelException, MalformedURLException {
	String transfromJarPath = null;
	Object[] returnObj=new Object[3];
	IJavaProject iJavaProject = JavaCore.create(BuildExpressionEditorDataSturcture.INSTANCE.getCurrentProject());
	List<URL> urlList = new ArrayList<>();
	Properties properties = ConfigFileReader.INSTANCE.getCommonConfigurations();
	for (IPackageFragmentRoot iPackageFragmentRoot : iJavaProject.getAllPackageFragmentRoots()) {
		if (!iPackageFragmentRoot.isExternal()
				|| StringUtils.contains(iPackageFragmentRoot.getElementName(), properties.getProperty(Constants.KEY_TRANSFORMATION_JAR))
				|| StringUtils.contains(iPackageFragmentRoot.getElementName(), Constants.ANTLR_JAR_FILE_NAME)
				|| StringUtils.contains(iPackageFragmentRoot.getElementName(), Constants.BEAN_SHELLJAR_FILE_NAME)
				|| StringUtils.contains(iPackageFragmentRoot.getElementName(), Constants.SL4JLOG)
				|| StringUtils.contains(iPackageFragmentRoot.getElementName(), properties.getProperty(Constants.KEY_EXPRESSION_JAR))) {
			URL url = null;
			if (!iPackageFragmentRoot.isExternal()) {
				url = BuildExpressionEditorDataSturcture.INSTANCE.getCurrentProject()
						.getFile(iPackageFragmentRoot.getPath().removeFirstSegments(1)).getLocation().toFile()
						.toURI().toURL();
				urlList.add(url);
			} else {
				url = iPackageFragmentRoot.getPath().toFile().toURI().toURL();
				urlList.add(url);
			}

			if (!iPackageFragmentRoot.isExternal()
					|| StringUtils.contains(iPackageFragmentRoot.getElementName(), properties.getProperty(Constants.KEY_TRANSFORMATION_JAR))) {
				if (transfromJarPath == null) {
					if (OSValidator.isMac() || OSValidator.isUnix())
						transfromJarPath = url.getPath() + Constants.COLON;
					else
						transfromJarPath = url.getPath() + Constants.SEMICOLON;
				} else {
					if (OSValidator.isMac() || OSValidator.isUnix())
						transfromJarPath = transfromJarPath + url.getPath() + Constants.COLON;
					else
						transfromJarPath = transfromJarPath + url.getPath() + Constants.SEMICOLON;
				}
			}
		}
	}
	
	returnObj[0]=urlList;
	returnObj[1]=transfromJarPath;
	returnObj[2]=getPropertyFilePath(iJavaProject);
	iJavaProject.close();
	return returnObj;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:48,代码来源:ValidateExpressionToolButton.java


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