本文整理汇总了Java中org.eclipse.wst.common.componentcore.ComponentCore类的典型用法代码示例。如果您正苦于以下问题:Java ComponentCore类的具体用法?Java ComponentCore怎么用?Java ComponentCore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComponentCore类属于org.eclipse.wst.common.componentcore包,在下文中一共展示了ComponentCore类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: validateJsp
import org.eclipse.wst.common.componentcore.ComponentCore; //导入依赖的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.ComponentCore; //导入依赖的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.ComponentCore; //导入依赖的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.ComponentCore; //导入依赖的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.ComponentCore; //导入依赖的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.ComponentCore; //导入依赖的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.ComponentCore; //导入依赖的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: getWebContentPath
import org.eclipse.wst.common.componentcore.ComponentCore; //导入依赖的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
示例9: getRootContainerForPath
import org.eclipse.wst.common.componentcore.ComponentCore; //导入依赖的package包/类
static IPath getRootContainerForPath(IProject project, IPath path) {
if (ModuleCoreNature.isFlexibleProject(project)) {
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].getFullPath().isPrefixOf(path)) {
return workspaceFolders[i].getFullPath();
}
}
}
}
return null;
}
开发者ID:eteration,项目名称:glassmaker,代码行数:15,代码来源:ProjectUtils.java
示例10: getDefaultRoot
import org.eclipse.wst.common.componentcore.ComponentCore; //导入依赖的package包/类
static IPath getDefaultRoot(IProject project) {
if (ModuleCoreNature.isFlexibleProject(project)) {
IVirtualFolder componentFolder = ComponentCore.createFolder(project, Path.ROOT);
if (componentFolder != null && componentFolder.exists()) {
return componentFolder.getWorkspaceRelativePath();
}
}
return null;
}
开发者ID:eteration,项目名称:glassmaker,代码行数:10,代码来源:ProjectUtils.java
示例11: WarPatchCreator
import org.eclipse.wst.common.componentcore.ComponentCore; //导入依赖的package包/类
public WarPatchCreator() {
//throw error if org.eclipse.wst.common.** cannot be load...
if (ComponentCore.class.getName() == null) {
throw new RuntimeException("Required optional package: org.eclipse.wst.common.modulecore");
}
}
开发者ID:BeckYang,项目名称:TeamFileList,代码行数:7,代码来源:WarPatchCreator.java
示例12: findTemplateFoldersNames
import org.eclipse.wst.common.componentcore.ComponentCore; //导入依赖的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
示例13: handleClassButtonSelected
import org.eclipse.wst.common.componentcore.ComponentCore; //导入依赖的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
示例14: getAcceptableRootPathsP
import org.eclipse.wst.common.componentcore.ComponentCore; //导入依赖的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
注:本文中的org.eclipse.wst.common.componentcore.ComponentCore类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论