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

Java IJarEntryResource类代码示例

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

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



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

示例1: internalGetUri

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
@Override
protected URI internalGetUri(IStorage storage) {
	if (!uriValidator.isPossiblyManaged(storage))
		return null;
	URI uri = super.internalGetUri(storage);
	if (uri != null)
		return uri;
	if (storage instanceof IJarEntryResource) {
		final IJarEntryResource storage2 = (IJarEntryResource) storage;
		Map<URI, IStorage> data = getAllEntries(storage2.getPackageFragmentRoot());
		for (Map.Entry<URI, IStorage> entry : data.entrySet()) {
			if (entry.getValue().equals(storage2))
				return entry.getKey();
		}
	}
	return null;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:Storage2UriMapperJavaImpl.java


示例2: getURI

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
/**
 * @return a URI for the given jarEntry, can be <code>null</code>.
 */
public URI getURI(IPackageFragmentRoot root, IJarEntryResource jarEntry, TraversalState state) {
	if (root.isArchive()) {
		URI jarURI = JarEntryURIHelper.getUriForPackageFragmentRoot(root);
		URI storageURI = URI.createURI(jarEntry.getFullPath().toString());
		return createJarURI(root.isArchive(), jarURI, storageURI);
	} else if (root instanceof ExternalPackageFragmentRoot) {
		IResource resource = ((ExternalPackageFragmentRoot) root).resource();
		IPath result = resource.getFullPath();
		for(int i = 1; i < state.getParents().size(); i++) {
			Object obj = state.getParents().get(i);
			if (obj instanceof IPackageFragment) {
				result = result.append(new Path(((IPackageFragment) obj).getElementName().replace('.', '/')));
			} else if (obj instanceof IJarEntryResource) {
				result = result.append(((IJarEntryResource) obj).getName());
			}
		}
		result = result.append(jarEntry.getName());
		return URI.createPlatformResourceURI(result.toString(), true);			
	} else {
		throw new IllegalStateException("Unexpeced root type: " + root.getClass().getName());
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:26,代码来源:JarEntryLocator.java


示例3: getLogicalURI

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
/**
 * Converts the physical URI to a logic URI based on the bundle symbolic name.
 */
protected URI getLogicalURI(URI uri, IStorage storage, TraversalState state) {
	if (bundleSymbolicName != null) {
		URI logicalURI = URI.createPlatformResourceURI(bundleSymbolicName, false);
		List<?> parents = state.getParents();
		for (int i = 1; i < parents.size(); i++) {
			Object obj = parents.get(i);
			if (obj instanceof IPackageFragment) {
				logicalURI = logicalURI.appendSegments(((IPackageFragment) obj).getElementName().split("\\."));
			} else if (obj instanceof IJarEntryResource) {
				logicalURI = logicalURI.appendSegment(((IJarEntryResource) obj).getName());
			} else if (obj instanceof IFolder) {
				logicalURI = logicalURI.appendSegment(((IFolder) obj).getName());
			}
		}
		return logicalURI.appendSegment(uri.lastSegment());
	}
	return uri;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:22,代码来源:SourceAttachmentPackageFragmentRootWalker.java


示例4: traverse

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
public T traverse(IPackageFragmentRoot root, boolean stopOnFirstResult) throws JavaModelException {
	T result = null;
	if (root.exists()) {
		Object[] resources = root.getNonJavaResources();
		TraversalState state = new TraversalState(root);
		for (Object object : resources) {
			if (object instanceof IJarEntryResource) {
				result = traverse((IJarEntryResource) object, stopOnFirstResult, state);
				if (stopOnFirstResult && result != null)
					return result;
			}
		}

		IJavaElement[] children = root.getChildren();
		for (IJavaElement javaElement : children) {
			if (javaElement instanceof IPackageFragment) {
				result = traverse((IPackageFragment) javaElement, stopOnFirstResult, state);
				if (stopOnFirstResult && result != null)
					return result;
			}
		}
	}
	return result;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:25,代码来源:PackageFragmentRootWalker.java


示例5: getJarWithEntry

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
protected IPackageFragmentRoot getJarWithEntry(URI uri) {
	Iterable<Pair<IStorage, IProject>> storages = getStorages(uri);
	IPackageFragmentRoot result = null;
	for (Pair<IStorage, IProject> storage2Project : storages) {
		IStorage storage = storage2Project.getFirst();
		if (storage instanceof IJarEntryResource) {
			IPackageFragmentRoot fragmentRoot = ((IJarEntryResource) storage).getPackageFragmentRoot();
			if (fragmentRoot != null) {
				IJavaProject javaProject = fragmentRoot.getJavaProject();
				if (isAccessibleXtextProject(javaProject.getProject()))
					return fragmentRoot;
				if (result != null)
					result = fragmentRoot;
			}
		}
	}
	return result;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:19,代码来源:JavaProjectsStateHelper.java


示例6: findJarDirectoryChildren

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
private Object[] findJarDirectoryChildren(JarEntryDirectory directory, String path) {
  String directoryPath = directory.getFullPath().toOSString();
  if (directoryPath.equals(path)) {
    return directory.getChildren();
  }
  if (path.startsWith(directoryPath)) {
    for (IJarEntryResource resource : directory.getChildren()) {
      String childrenPath = resource.getFullPath().toOSString();
      if (childrenPath.equals(path)) {
        return resource.getChildren();
      }
      if (path.startsWith(childrenPath) && resource instanceof JarEntryDirectory) {
        findJarDirectoryChildren((JarEntryDirectory) resource, path);
      }
    }
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:JavaNavigation.java


示例7: getText

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
@Override
public String getText(Object element) {
  if (!(element instanceof IModule)) {
    return super.getText(element);
  }
  String text = null;

  IModule module = (IModule) element;
  String packageName = module.getPackageName();

  if (!module.isBinary()) {
    ModuleFile moduleFile = (ModuleFile) module;
    IFile file = moduleFile.getFile();
    String modulePath = file.getFullPath().makeRelative().toString();
    text = packageName + " - " + modulePath;
  } else {
    ModuleJarResource moduleJarResource = (ModuleJarResource) module;
    IJarEntryResource jarEntryResource = moduleJarResource.getJarEntryResource();
    String jarPath = jarEntryResource.getPackageFragmentRoot().getPath().makeRelative().toString();
    text = packageName + " - " + jarPath;
  }

  return text;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:25,代码来源:ModuleSelectionDialog.java


示例8: getPathForModule

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
/**
 * Helper method to return the absolute workspace path of a GWT Module.
 * 
 * If the module file is located in a JAR, then the absolute path of the JAR
 * on the file system is returned.
 */
private static IPath getPathForModule(IModule module) {

  if (module == null) {
    return null;
  }

  if (!module.isBinary()) {
    ModuleFile moduleFile = (ModuleFile) module;
    IFile file = moduleFile.getFile();
    return file.getFullPath();
  }

  ModuleJarResource moduleJarResource = (ModuleJarResource) module;
  IJarEntryResource jarEntryResource = moduleJarResource.getJarEntryResource();
  return jarEntryResource.getPackageFragmentRoot().getPath();
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:23,代码来源:ModuleSelectionDialog.java


示例9: extractManifest

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
/**
 * @param packageFragmentRoot
 * @throws JavaModelException
 * @throws CoreException
 */
@SuppressWarnings("restriction")
private static Manifest extractManifest(IPackageFragmentRoot packageFragmentRoot) throws JavaModelException {

  Manifest result = null;
  final Object[] nonJavaResources = packageFragmentRoot.getNonJavaResources();

  for (Object obj : nonJavaResources) {
    if (obj instanceof JarEntryDirectory) {
      final JarEntryDirectory jarEntryDirectory = (JarEntryDirectory) obj;
      final IJarEntryResource[] jarEntryResources = jarEntryDirectory.getChildren();
      for (IJarEntryResource jarEntryResource : jarEntryResources) {
        if ("MANIFEST.MF".equals(jarEntryResource.getName())) {
          try {
            final InputStream stream = jarEntryResource.getContents();
            result = new Manifest(stream);
          } catch (Exception e) {
            // no manifest as result
          }
        }
      }
    }
  }
  return result;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:30,代码来源:ExtensionUtil.java


示例10: collectNonJavaResources

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
private static void collectNonJavaResources(Object[] nonJavaResources,
		IPath rootPath, List<JarEntryStorage> list,
		JarEntryPredicate jarEntryPredicate) {
	for (Object nonJavaRes : nonJavaResources) {
		if (nonJavaRes instanceof IJarEntryResource) {
			IJarEntryResource jarEntry = (IJarEntryResource) nonJavaRes;

			boolean addToList = jarEntryPredicate == null ? true
					: jarEntryPredicate.test(jarEntry);

			if (addToList) {
				list.add(new JarEntryStorage(rootPath.append(jarEntry
						.getFullPath()), jarEntry));
			}
		}
	}
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:18,代码来源:ProjectUtil.java


示例11: isEclipseNLSAvailable

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
private static boolean isEclipseNLSAvailable(IStorageEditorInput editorInput) {
	IStorage storage;
	try {
		storage= editorInput.getStorage();
	} catch (CoreException ex) {
		return false;
	}
	if (!(storage instanceof IJarEntryResource))
		return false;

	IJavaProject javaProject= ((IJarEntryResource) storage).getPackageFragmentRoot().getJavaProject();

	if (javaProject == null || !javaProject.exists())
		return false;

	try {
		return javaProject.findType("org.eclipse.osgi.util.NLS") != null; //$NON-NLS-1$
	} catch (JavaModelException e) {
		return false;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:PropertyKeyHyperlinkDetector.java


示例12: getQualifiedName

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
private String getQualifiedName(Object element) throws JavaModelException {
	if (element instanceof IResource)
		return ((IResource)element).getFullPath().toString();

	if (element instanceof IJarEntryResource)
		return ((IJarEntryResource)element).getFullPath().toString();

	if (element instanceof LogicalPackage)
		return ((LogicalPackage)element).getElementName();

	if (element instanceof IJavaProject || element instanceof IPackageFragmentRoot || element instanceof ITypeRoot) {
		IResource resource= ((IJavaElement)element).getCorrespondingResource();
		if (resource != null)
			return getQualifiedName(resource);
	}

	if (element instanceof IBinding)
		return BindingLabelProvider.getBindingLabel((IBinding)element, LABEL_FLAGS);

	return TextProcessor.deprocess(JavaElementLabels.getTextLabel(element, LABEL_FLAGS));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:CopyQualifiedNameAction.java


示例13: getChildren

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
public IJarEntryResource[] getChildren() {
	if (this.resource instanceof IContainer) {
		IResource[] members;
		try {
			members = ((IContainer) this.resource).members();
		} catch (CoreException e) {
			Util.log(e, "Could not retrieve children of " + this.resource.getFullPath()); //$NON-NLS-1$
			return NO_CHILDREN;
		}
		int length = members.length;
		if (length == 0)
			return NO_CHILDREN;
		IJarEntryResource[] children = new IJarEntryResource[length];
		for (int i = 0; i < length; i++) {
			children[i] = new NonJavaResource(this, members[i]);
		}
		return children;
	}
	return NO_CHILDREN;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:NonJavaResource.java


示例14: searchNonJavaResources

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
private TapestryFile searchNonJavaResources(IParent root, String path) throws JavaModelException
{
    String[] segments = path.split("/");

    if (root instanceof IPackageFragmentRoot)
    {
        for (Object nonJava : ((IPackageFragmentRoot) root).getNonJavaResources())
        {
            if (nonJava instanceof IJarEntryResource)
            {
                IJarEntryResource resource = (IJarEntryResource) nonJava;
                
                if (StringUtils.equals(segments[0], resource.getName()))
                {
                    return searchRecursively(resource, path, segments, 1);
                }
            }
        }
    }
    
    return null;
}
 
开发者ID:anjlab,项目名称:eclipse-tapestry5-plugin,代码行数:23,代码来源:JarFileLookup.java


示例15: initializeFromResources

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
/**
 * Initialize the processor cache from JAR resources.
 * 
 * @param jarEntryResources A list of JAR entries describing the dialects and their
 * 				processors to store.
 * @throws CoreException 
 * @throws XMLException 
 */
public static void initializeFromResources(List<IJarEntryResource> jarEntryResources) throws XMLException, CoreException {

	XMLReader<Dialect> xmlreader = new XMLReader<Dialect>(Dialect.class);

	for (IJarEntryResource jarEntry: jarEntryResources) {
		
		// Get default file as stream
		Dialect dialect = xmlreader.readXMLData(jarEntry.getContents());
		
		// Link the processor with it's dialect
		for (Processor processor: dialect.getProcessors()) {
			processor.setDialect(dialect);
			processors.add(processor);
		}

		// Ensure processors are in alphabetical order
		Collections.sort(processors, new Comparator<Processor>() {
			@Override
			public int compare(Processor p1, Processor p2) {
				return p1.getName().compareTo(p2.getName());
			}
		});
	}
}
 
开发者ID:tduchateau,项目名称:thymeleaf-eclipse-plugin,代码行数:33,代码来源:ProcessorCache.java


示例16: getDialectDefinitions

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
/**
 * <p>
 * Scan the current project's dependencies looking for XML file (ending with
 * "Dialect.xml").
 * <p>
 * The return list contains JarEntryResource that will be read by the
 * ProcessorCache.
 * 
 * @return List<IJarEntryResource> A list of XML files corresponding to the
 *         definitions of Thymeleaf dialects that exist in the current's
 *         project dependencies.
 * @throws JavaModelException
 * @throws CoreException
 */
private List<IJarEntryResource> getDialectDefinitions() throws JavaModelException, CoreException {
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();

	List<IJarEntryResource> resources = new ArrayList<IJarEntryResource>();
	
	IProject[] projects = root.getProjects();

	// Each project of the workspace is processed
	for (IProject project : projects) {

		System.out.println("project name: " + project.getName());
		
		// Only Java project are scanned
		// TODO Is that filter really necessary ?
		if (project.isNatureEnabled("org.eclipse.jdt.core.javanature")) {
			
			IJavaProject javaProject = JavaCore.create(project);
			IPackageFragment[] packages = javaProject.getPackageFragments();
			
			for(IPackageFragment packageFragment : packages){
				
				// No need to iterated over java classes, just resources
				for(Object ob : packageFragment.getNonJavaResources()){

					IJarEntryResource jarEntry = (IJarEntryResource) ob;

					// Resources are filtered by their suffix
					if(jarEntry.isFile() && jarEntry.getName().endsWith("Dialect.xml")){
						resources.add(jarEntry);
					}
				}
			}
		}
	}
	
	return resources;
}
 
开发者ID:tduchateau,项目名称:thymeleaf-eclipse-plugin,代码行数:52,代码来源:ThymeleafPlugin.java


示例17: handle

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
/**
 * Delegate to
 * {@link #handle(URI, IStorage, org.eclipse.xtext.ui.resource.PackageFragmentRootWalker.TraversalState)}.
 */
@Override
protected T handle(IJarEntryResource jarEntry, TraversalState state) {
	URI uri = getURI(jarEntry, state);
	if (isValid(uri, jarEntry)) {
		return handle(getLogicalURI(uri, jarEntry, state), jarEntry, state);
	}
	return null;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:13,代码来源:SourceAttachmentPackageFragmentRootWalker.java


示例18: createResource

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
@Override
protected Resource createResource(IStorage storage) throws CoreException {
	if (storage instanceof IJarEntryResource) {
		return createResourceFor((IJarEntryResource) storage);
	}
	return super.createResource(storage);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:8,代码来源:JavaClassPathResourceForIEditorInputFactory.java


示例19: createResourceFor

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
protected Resource createResourceFor(IJarEntryResource storage) {
	ResourceSet resourceSet = getResourceSet(storage);
	URI uri = storageToUriMapper.getUri(storage);
	configureResourceSet(resourceSet, uri);
	XtextResource resource = createResource(resourceSet, uri);
	resource.setValidationDisabled(isValidationDisabled(storage));
	return resource;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:9,代码来源:JavaClassPathResourceForIEditorInputFactory.java


示例20: isValidationDisabled

import org.eclipse.jdt.core.IJarEntryResource; //导入依赖的package包/类
/**
 * @since 2.4
 */
@Override
protected boolean isValidationDisabled(IStorage storage) {
	if (storage instanceof IJarEntryResource) {
		return true;
	}
	return super.isValidationDisabled(storage);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:11,代码来源:JavaClassPathResourceForIEditorInputFactory.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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