List of usage examples for org.springframework.ide.eclipse.core.java JdtUtils isJavaProject
public static boolean isJavaProject(IResource resource)
From source file:org.eclipse.virgo.ide.facet.core.FacetUtils.java
/** * Checks if a given {@link IResource} has the bundle facet. */// w w w.j ava2 s. c o m public static boolean isBundleProject(IResource resource) { return JdtUtils.isJavaProject(resource) && hasProjectFacet(resource, FacetCorePlugin.BUNDLE_FACET_ID); }
From source file:org.eclipse.virgo.ide.jdt.core.ServerClasspathContainerPropertyTester.java
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (receiver instanceof IResource && "isEnabled".equals(property)) { if (JdtUtils.isJavaProject((IResource) receiver)) return ClasspathUtils.hasClasspathContainer(JdtUtils.getJavaProject((IResource) receiver)); }//from w ww. ja v a 2 s . c o m return false; }
From source file:org.eclipse.virgo.ide.module.core.ServerModuleFactoryDelegate.java
/** * {@inheritDoc}/* w w w. java2 s.c o m*/ */ @Override protected IModule[] createModules(final IProject project) { final Set<IModule> modules = new HashSet<IModule>(); if (FacetUtils.isBundleProject(project)) { // Add module for bundle deployment modules.add(createModule(project.getName(), project.getName(), FacetCorePlugin.BUNDLE_FACET_ID, "1.0", project)); // Add module for par deployment for (IProject parProject : FacetUtils.getParProjects(project)) { modules.add(createModule(parProject.getName() + "$" + project.getName(), project.getName(), FacetCorePlugin.BUNDLE_FACET_ID, "1.0", project)); } } else if (FacetUtils.isParProject(project)) { modules.add(createModule(project.getName(), project.getName(), FacetCorePlugin.PAR_FACET_ID, "1.0", project)); } // Every project can also be a plan project if (FacetUtils.isPlanProject(project)) { // Collect output locations if java project final Set<IPath> outputLocations = new HashSet<IPath>(); if (JdtUtils.isJavaProject(project)) { IJavaProject je = JdtUtils.getJavaProject(project); try { outputLocations.add(je.getOutputLocation()); for (IClasspathEntry entry : je.getRawClasspath()) { if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { if (entry.getOutputLocation() != null) { outputLocations.add(entry.getOutputLocation()); } } } } catch (JavaModelException e) { } } try { project.accept(new IResourceVisitor() { public boolean visit(IResource resource) throws CoreException { if (resource instanceof IFile && resource.getName().endsWith(".plan")) { modules.add(createModule(resource.getFullPath().toString(), resource.getProject().getName() + "/" + resource.getProjectRelativePath().toString(), FacetCorePlugin.PLAN_FACET_ID, "2.0", project)); } else if (resource instanceof IContainer) { IPath path = ((IContainer) resource).getFullPath(); for (IPath outputLocation : outputLocations) { if (outputLocation.isPrefixOf(path)) { return false; } } return true; } return true; } }); } catch (CoreException e) { // TODO CD log exception } } return (IModule[]) modules.toArray(new IModule[modules.size()]); }
From source file:org.eclipse.virgo.ide.runtime.internal.core.ServerBehaviour.java
public URL getModuleRootURL(IModule module) { try {//from w w w. ja va 2 s .com // check pre condition; only dynamic web projects and java projects are allowed IProject project = module.getProject(); if (!SpringCoreUtils.hasProjectFacet(project, FacetCorePlugin.WEB_FACET_ID) || !JdtUtils.isJavaProject(project)) { return null; } String contextPath = null; BundleManifest bundleManifest = BundleManifestCorePlugin.getBundleManifestManager() .getBundleManifest(JdtUtils.getJavaProject(project)); if (bundleManifest != null) { Dictionary<String, String> manifest = bundleManifest.toDictionary(); if (manifest != null && manifest.get(WEB_CONTEXT_PATH_MANIFEST_HEADER) != null) { contextPath = manifest.get(WEB_CONTEXT_PATH_MANIFEST_HEADER); } } if (contextPath == null) { contextPath = module.getName(); } // TODO: CD make port configurable int port = 8080; StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append("http://localhost:"); urlBuilder.append(port); urlBuilder.append("/"); urlBuilder.append(contextPath); String url = urlBuilder.toString(); if (!url.endsWith("/")) { urlBuilder.append("/"); } return new URL(urlBuilder.toString()); } catch (Exception e) { return null; } }