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

Java IVirtualComponent类代码示例

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

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



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

示例1: validateJsp

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
/**
 * Verifies that every <jsp-file> element exists in the project.
 */
private void validateJsp() {
  if (isVersion25()) {
    IProject project = resource.getProject();
    IVirtualComponent component = ComponentCore.createComponent(project);
    if (component != null && component.exists()) {
      IVirtualFolder root = component.getRootFolder();
      if (root.exists()) {
        NodeList jspList = document.getElementsByTagName("jsp-file");
        for (int i = 0; i < jspList.getLength(); i++) {
          Node jspNode = jspList.item(i);
          String jspName = jspNode.getTextContent();
          if (!resolveJsp(root, jspName)) {
            DocumentLocation location = (DocumentLocation) jspNode.getUserData("location");
            BannedElement element = new JspFileElement(jspName, location, jspName.length());
            blacklist.add(element);
          }
        }
      }
    }
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:25,代码来源:WebXmlValidator.java


示例2: findFile

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
public static IFile findFile(final IDocument document, String name,
		final boolean inClassesFolder) {
	IFile result = null;
	IProject project = getCurrentProject(document);
	if (project != null && project.exists()) {
		IVirtualComponent rootComponent = ComponentCore
				.createComponent(project);
		if (rootComponent != null) {
			IVirtualFolder folder = rootComponent.getRootFolder();
			if (folder != null && folder.exists()) {
				if (inClassesFolder) {
					name = WEB_INF_CLASSES_FOLDER_PATH + "/" + name;
				}
				result = folder.getFile(name).getUnderlyingFile();
			}
		}
	}
	return result;
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:20,代码来源:ProjectUtil.java


示例3: traverse

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
/**
 * Scans the module using the specified visitor.
 * 
 * @param module
 *            module to traverse
 * @param visitor
 *            visitor to handle resources
 * @param monitor
 *            a progress monitor
 * @throws CoreException
 */
public static void traverse(IModule module, IModuleVisitor visitor, IProgressMonitor monitor) throws CoreException
{
    if (module == null || module.getModuleType() == null)
        return;

    String typeId = module.getModuleType().getId();
    IVirtualComponent component = ComponentCore.createComponent(module.getProject());

    if (component == null)
    {
        // can happen if project has been closed
        Trace.trace(Trace.WARNING,"Unable to create component for module " + module.getName());
        return;
    }

    if (EAR_MODULE.equals(typeId))
    {
        traverseEarComponent(component,visitor,monitor);
    }
    else if (WEB_MODULE.equals(typeId))
    {
        traverseWebComponent(component,visitor,monitor);
    }
}
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:36,代码来源:ModuleTraverser.java


示例4: getWebContentPath

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
/**
 * Returns the web contents folder of the specified project
 * 
 * @param project
 *            the project which web contents path is needed
 * @return IPath of the web contents folder
 */
public static IPath getWebContentPath( IProject project )
{
	IPath path = null;

	if ( project != null
			&& JavaEEProjectUtilities.isDynamicWebProject( project )
	)
	{
		IVirtualComponent component = ComponentCore
				.createComponent( project );
		path = component.getRootFolder( ).getWorkspaceRelativePath( );
	}

	return path;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:23,代码来源:BirtWizardUtil.java


示例5: findWebInfForNewResource

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
/**
 * Find the directory within the project where new resources for the {@code WEB-INF} should be
 * placed, respecting the order and tags on the WTP virtual component model. Specifically, we use
 * the directory in the {@code <wb-resource>} with the {@code defaultRootSource} tag when present.
 */
private static IFolder findWebInfForNewResource(IProject project) {
  // Check if the project is a faceted project, and use the deployment assembly information
  IVirtualComponent component = ComponentCore.createComponent(project);
  if (component != null && component.exists()) {
    IVirtualFolder root = component.getRootFolder();
    // first see if there is a resource tagged as the defaultSourceRoot
    IPath defaultPath = J2EEModuleVirtualComponent.getDefaultDeploymentDescriptorFolder(root);
    if (defaultPath != null) {
      return project.getFolder(defaultPath).getFolder(WEB_INF);
    }
    // otherwise use the first
    return (IFolder) root.getFolder(WEB_INF).getUnderlyingFolder();
  }
  // Otherwise it's seemingly fair game
  for (String possibleWebInfContainer : DEFAULT_WEB_PATHS) {
    // simplify mocking: get the location as two parts and check for null despite that getFolder()
    // should be @NonNull
    IFolder defaultLocation = project.getFolder(possibleWebInfContainer);
    if (defaultLocation != null && defaultLocation.exists()) {
      defaultLocation = defaultLocation.getFolder(WEB_INF);
      if (defaultLocation != null && defaultLocation.exists()) {
        return defaultLocation;
      }
    }
  }
  return project.getFolder(DEFAULT_WEB_PATH).getFolder(WEB_INF);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:33,代码来源:WebProjectUtil.java


示例6: findInWebInf

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
/**
 * Attempt to resolve the given file within the project's {@code WEB-INF}. Note that this method
 * may return a file that is in a build location (e.g.,
 * {@code target/m2e-wtp/web-resources/WEB-INF}) which may be frequently removed or regenerated.
 *
 * @return the file location or {@code null} if not found
 */
public static IFile findInWebInf(IProject project, IPath filePath) {
  // Try to obtain the directory as if it was a Dynamic Web Project
  IVirtualComponent component = ComponentCore.createComponent(project);
  if (component != null && component.exists()) {
    IVirtualFolder root = component.getRootFolder();
    // the root should exist, but the WEB-INF may not yet exist
    IVirtualFile file = root.getFolder(WEB_INF).getFile(filePath);
    if (file != null && file.exists()) {
      return file.getUnderlyingFile();
    }
    return null;
  }
  // Otherwise check the standard places
  for (String possibleWebInfContainer : DEFAULT_WEB_PATHS) {
    // check each directory component to simplify mocking in tests
    // so we can just say WEB-INF doesn't exist
    IFolder defaultLocation = project.getFolder(possibleWebInfContainer);
    if (defaultLocation != null && defaultLocation.exists()) {
      defaultLocation = defaultLocation.getFolder(WEB_INF);
      if (defaultLocation != null && defaultLocation.exists()) {
        IFile resourceFile = defaultLocation.getFile(filePath);
        if (resourceFile.exists()) {
          return resourceFile;
        }
      }
    }
  }
  return null;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:37,代码来源:WebProjectUtil.java


示例7: getWebContentFolder

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
/**
 * Returns the WebContent folder for a Dynamic Web Project, or null if the
 * project does not have a WebContent folder.
 *
 * @return A project-relative path to the WebContent folder
 */
public static IPath getWebContentFolder(IProject project) {
  IPath path = null;
  IVirtualComponent component = ComponentCore.createComponent(project);
  if (component != null && component.exists()) {
    path = component.getRootFolder().getWorkspaceRelativePath();
    if (project.getFullPath().isPrefixOf(path)) {
      return path.removeFirstSegments(project.getFullPath().segmentCount());
    }
  }

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


示例8: traverseEarComponent

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
private static void traverseEarComponent(IVirtualComponent component, IModuleVisitor visitor, IProgressMonitor monitor) throws CoreException
{
    // Currently the JST Server portion of WTP may not depend on the JST Enterprise portion of WTP
    /*
     * EARArtifactEdit earEdit = EARArtifactEdit .getEARArtifactEditForRead(component); if (earEdit != null) { IVirtualReference[] j2eeComponents =
     * earEdit.getJ2EEModuleReferences(); for (int i = 0; i < j2eeComponents.length; i++) { traverseWebComponent(
     * j2eeComponents[i].getReferencedComponent(), visitor, monitor); } IVirtualReference[] jarComponents = earEdit.getUtilityModuleReferences(); for (int i
     * = 0; i < jarComponents.length; i++) { IVirtualReference jarReference = jarComponents[i]; IVirtualComponent jarComponent = jarReference
     * .getReferencedComponent(); IProject dependentProject = jarComponent.getProject(); if (!dependentProject.hasNature(JavaCore.NATURE_ID)) continue;
     * IJavaProject project = JavaCore.create(dependentProject); IClasspathEntry cpe = getClasspathEntry(project, jarComponent
     * .getRootFolder().getProjectRelativePath()); visitor.visitEarResource(null, getOSPath(dependentProject, project, cpe.getOutputLocation())); } }
     */
    visitor.endVisitEarComponent(component);
}
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:15,代码来源:ModuleTraverser.java


示例9: visitWebComponent

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void visitWebComponent(IVirtualComponent component) throws CoreException
{
    IProject project = component.getProject();
    if (project.hasNature(JavaCore.NATURE_ID))
    {
        IJavaProject javaProject = JavaCore.create(project);
        runtimeClasspath.add(JavaRuntime.newDefaultProjectClasspathEntry(javaProject));
    }
}
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:13,代码来源:JettySourcePathComputerDelegate.java


示例10: getWebContentPath

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
/**
 * Returns the web contents folder of the specified project
 * 
 * @param project
 *            the project which web contents path is needed
 * @return IPath of the web contents folder
 */
public static IPath getWebContentPath( IProject project )
{
	IPath path = null;

	if ( project != null
			&& JavaEEProjectUtilities.isDynamicWebProject( project ) )
	{
		IVirtualComponent component = ComponentCore.createComponent( project );
		path = component.getRootFolder( ).getWorkspaceRelativePath( );
	}

	return path;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:21,代码来源:BirtWizardUtil.java


示例11: findTemplateFoldersNames

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
public static Set<String> findTemplateFoldersNames(
		final IDocument currentDocument) {
	final Set<String> result = new HashSet<String>();

	try {
		final IProject project = getCurrentProject(currentDocument);
		if (project != null && project.exists()) {
			IVirtualComponent rootComponent = ComponentCore
					.createComponent(project);

			if (rootComponent != null) {
				IVirtualFolder folder = rootComponent.getRootFolder();
				folder = folder.getFolder(WEB_INF_CLASSES_FOLDER_PATH + "/"
						+ TEMPLATE_FOLDER_NAME);

				if (folder != null && folder.exists()) {
					IResource[] resources = folder.getUnderlyingResources();
					if (resources != null) {
						for (final IResource res : resources) {
							res.accept(new IResourceVisitor() {
								@Override
								public boolean visit(IResource resource)
										throws CoreException {
									if (resource.isAccessible()
											&& resource.getType() == IResource.FOLDER
											&& !TEMPLATE_FOLDER_NAME
													.equals(resource
															.getName())) {
										result.add(resource.getName());
									}
									return true;
								}
							}, IResource.DEPTH_ONE, IResource.NONE);
						}
					}
				}
			}
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}

	return result;
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:45,代码来源:ProjectUtil.java


示例12: endVisitWebComponent

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void endVisitWebComponent(IVirtualComponent component) throws CoreException
{
    // do nothing
}
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:8,代码来源:JettySourcePathComputerDelegate.java


示例13: endVisitEarComponent

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void endVisitEarComponent(IVirtualComponent component) throws CoreException
{
    // do nothing
}
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:8,代码来源:JettySourcePathComputerDelegate.java


示例14: handleClassButtonSelected

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
@Override
protected void handleClassButtonSelected()
{
    getControl().setCursor(new Cursor(getShell().getDisplay(),SWT.CURSOR_WAIT));
    try
    {
        IProject project = (IProject)model.getProperty(PROJECT);

        if (project == null)
        {
            // show info message
            return;
        }

        IVirtualComponent component = ComponentCore.createComponent(project);
        MultiSelectFilteredFileSelectionDialog ms = new MultiSelectFilteredFileSelectionDialog(getShell(),NEW_SERVLET_WIZARD_WINDOW_TITLE,
                CHOOSE_SERVLET_CLASS,JSPEXTENSIONS,false,project);
        IContainer root = component.getRootFolder().getUnderlyingFolder();
        ms.setInput(root);
        ms.open();
        if (ms.getReturnCode() == Window.OK)
        {
            String qualifiedClassName = ""; //$NON-NLS-1$
            if (ms.getSelectedItem() == MultiSelectFilteredFileSelectionDialog.JSP)
            {
                Object obj = ms.getFirstResult();
                if (obj != null)
                {
                    if (obj instanceof IFile)
                    {
                        IFile file = (IFile)obj;
                        IPath pFull = file.getFullPath();
                        IPath pBase = root.getFullPath();
                        IPath path = pFull.removeFirstSegments(pBase.segmentCount());
                        qualifiedClassName = path.makeAbsolute().toString();
                        model.setProperty(IS_SERVLET_TYPE, Boolean.valueOf(false));
                    }
                }
            }
            else
            {
                IType type = (IType)ms.getFirstResult();
                if (type != null)
                {
                    qualifiedClassName = type.getFullyQualifiedName();
                    model.setProperty(IS_SERVLET_TYPE,new Boolean(true));
                }
            }
            existingClassText.setText(qualifiedClassName);
        }
    }
    finally
    {
        getControl().setCursor(null);
    }
}
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:57,代码来源:NewWebSocketServletClassWizardPage.java


示例15: getAcceptableRootPathsP

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
static IPath[] getAcceptableRootPathsP(IProject project) {
	if (!ModuleCoreNature.isFlexibleProject(project)) {
		return new IPath[] { project.getFullPath() };
	}

	List paths = new ArrayList();
	IVirtualFolder componentFolder = ComponentCore.createFolder(project, Path.ROOT);
	if (componentFolder != null && componentFolder.exists()) {
		IContainer[] workspaceFolders = componentFolder.getUnderlyingFolders();
		for (int i = 0; i < workspaceFolders.length; i++) {
			if (workspaceFolders[i].getFolder(META_INF_RESOURCES_PATH).isAccessible())
				paths.add(workspaceFolders[i].getFullPath().append(META_INF_RESOURCES_PATH));
			else
				paths.add(workspaceFolders[i].getFullPath());
		}

		IVirtualReference[] references = ComponentCore.createComponent(project).getReferences();
		if (references != null) {
			for (int i = 0; i < references.length; i++) {
				IVirtualComponent referencedComponent = references[i].getReferencedComponent();
				if (referencedComponent == null)
					continue;
				IVirtualComponent component = referencedComponent.getComponent();
				if (component == null)
					continue;
				IVirtualFolder rootFolder = component.getRootFolder();
				if (rootFolder == null)
					continue;
				IPath referencedPathRoot = rootFolder.getWorkspaceRelativePath();
				/* http://bugs.eclipse.org/410161 */
				if (referencedPathRoot != null) {
					/*
					 * See Servlet 3.0, section 4.6 ; this is the only
					 * referenced module/component type we support
					 */
					IPath resources = referencedPathRoot.append(META_INF_RESOURCES);
					if (resources != null && component.getProject().findMember(resources.removeFirstSegments(1)) != null) {
						paths.add(resources);
					}
				}
			}
		}

	} else {
		paths.add(new IPath[] { project.getFullPath() });
	}
	return (IPath[]) paths.toArray(new IPath[paths.size()]);
}
 
开发者ID:eteration,项目名称:glassmaker,代码行数:49,代码来源:ProjectUtils.java


示例16: visitWebComponent

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
/**
 * Process web component
 * 
 * @param component
 *            web component to process
 * @throws CoreException
 */
void visitWebComponent(IVirtualComponent component) throws CoreException;
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:9,代码来源:IModuleVisitor.java


示例17: endVisitWebComponent

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
/**
 * Post process web component
 * 
 * @param component
 *            web component to process
 * @throws CoreException
 */
void endVisitWebComponent(IVirtualComponent component) throws CoreException;
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:9,代码来源:IModuleVisitor.java


示例18: endVisitEarComponent

import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; //导入依赖的package包/类
/**
 * Post process EAR resource.
 * 
 * @param component
 *            EAR component to process
 * @throws CoreException
 */
void endVisitEarComponent(IVirtualComponent component) throws CoreException;
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:9,代码来源:IModuleVisitor.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java CDONet4jSessionConfiguration类代码示例发布时间:2022-05-22
下一篇:
Java HashUtil类代码示例发布时间: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