List of usage examples for org.springframework.ide.eclipse.core SpringCoreUtils hasProjectFacet
public static boolean hasProjectFacet(IResource resource, String facetId)
From source file:org.eclipse.virgo.ide.runtime.internal.ui.actions.OpenManifestAction.java
public void run(IAction action) { IProject project = selectedModule.getProject(); if (FacetUtils.isBundleProject(project)) { openResource(BundleManifestUtils.locateManifest(JdtUtils.getJavaProject(project), false)); } else if (FacetUtils.isParProject(project)) { openResource(project.findMember(BundleManifestCorePlugin.MANIFEST_FILE_LOCATION)); } else if (SpringCoreUtils.hasProjectFacet(project, FacetCorePlugin.WEB_FACET_ID)) { openResource(BundleManifestUtils.locateManifest(JdtUtils.getJavaProject(project), false)); }//from w w w . ja v a2 s . com }
From source file:org.eclipse.virgo.ide.runtime.internal.core.Server.java
@Override public IStatus canModifyModules(IModule[] add, IModule[] remove) { if (add != null) { int size = add.length; for (int i = 0; i < size; i++) { IModule module = add[i];/*from w w w. j a v a 2 s . c o m*/ if (!FacetCorePlugin.WEB_FACET_ID.equals(module.getModuleType().getId()) && !FacetCorePlugin.BUNDLE_FACET_ID.equals(module.getModuleType().getId()) && !FacetCorePlugin.PAR_FACET_ID.equals(module.getModuleType().getId()) && !FacetCorePlugin.PLAN_FACET_ID.equals(module.getModuleType().getId())) { return new Status(IStatus.ERROR, ServerCorePlugin.PLUGIN_ID, 0, "SpringSource par or bundle projects only", null); } IProject project = module.getProject(); // Check that nested par module is not displayed if (module.getId().endsWith("$" + project.getName())) { return new Status(IStatus.ERROR, ServerCorePlugin.PLUGIN_ID, 0, "No nested par modules allowed", null); } // Check that shared war is only deployed as WAR if (SpringCoreUtils.hasProjectFacet(project, FacetCorePlugin.WEB_FACET_ID) && FacetUtils.isBundleProject(project) && FacetCorePlugin.BUNDLE_FACET_ID.equals(module.getModuleType().getId())) { return new Status(IStatus.ERROR, ServerCorePlugin.PLUGIN_ID, 0, "Shared WAR deploy only as jst.web modules", null); } if (getVersionHandler() == null) { return new Status(IStatus.ERROR, ServerCorePlugin.PLUGIN_ID, 0, "No " + getServerName() + " runtime configured", null); } IStatus status = getVersionHandler().canAddModule(module); if (status != null && !status.isOK()) { return status; } if (module.getProject() == null || !module.getProject().isAccessible()) { return new Status(IStatus.ERROR, ServerCorePlugin.PLUGIN_ID, 0, "Project not accessible", null); } status = FacetUtil.verifyFacets(module.getProject(), getServer()); if (status != null && !status.isOK()) { return status; } } } return Status.OK_STATUS; }
From source file:org.eclipse.virgo.ide.runtime.internal.core.ServerBehaviour.java
public URL getModuleRootURL(IModule module) { try {/* w ww. j av a2 s .co m*/ // 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; } }