Author: snjeza
Date: 2009-01-28 17:37:43 -0500 (Wed, 28 Jan 2009)
New Revision: 13313
Modified:
trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/internal/PortletRuntimeLibrariesContainerInitializer.java
Log:
JBIDE-3660 Portlet facet doesn't recognize JBoss Portal server within EPP
distribution
Modified:
trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/internal/PortletRuntimeLibrariesContainerInitializer.java
===================================================================
---
trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/internal/PortletRuntimeLibrariesContainerInitializer.java 2009-01-28
21:23:36 UTC (rev 13312)
+++
trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/internal/PortletRuntimeLibrariesContainerInitializer.java 2009-01-28
22:37:43 UTC (rev 13313)
@@ -18,6 +18,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.core.IAccessRule;
@@ -30,6 +31,8 @@
import org.jboss.ide.eclipse.as.classpath.core.jee.AbstractClasspathContainer;
import
org.jboss.ide.eclipse.as.classpath.core.jee.AbstractClasspathContainerInitializer;
import org.jboss.ide.eclipse.as.classpath.core.xpl.ClasspathDecorations;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.tools.portlet.core.IPortletConstants;
import org.jboss.tools.portlet.core.Messages;
import org.jboss.tools.portlet.core.PortletCoreActivator;
@@ -146,22 +149,52 @@
}
private File getLibDirectory(File location) {
- File libDirectory = getDirectory(location,
- IPortletConstants.SERVER_DEFAULT_DEPLOY_JBOSS_PORTAL_SAR);
- if (libDirectory != null) {
- libDirectory = new File(libDirectory, "lib"); //$NON-NLS-1$
- } else {
- libDirectory = getDirectory(location,
- IPortletConstants.SERVER_DEFAULT_DEPLOY_SIMPLE_PORTAL);
+ IJavaProject javaProject = getProject();
+ if (javaProject == null) {
+ return null;
+ }
+ IProject project = javaProject.getProject();
+ if (project == null) {
+ return null;
+ }
+ IRuntime runtime = null;
+ try {
+ runtime = J2EEProjectUtilities.getServerRuntime(project);
+ } catch (CoreException e) {
+ // ignore
+ }
+ if (runtime == null) {
+ return null;
+ }
+ File libDirectory = null;
+ IJBossServerRuntime jbossRuntime =
(IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, new
NullProgressMonitor());
+ if (jbossRuntime != null) {
+ // JBoss Portal server
+ IPath jbossLocation = runtime.getLocation();
+ IPath configPath =
jbossLocation.append(IJBossServerConstants.SERVER).append(jbossRuntime.getJBossConfiguration());
+ location = configPath.toFile();
+ libDirectory =
getDirectory(location,IPortletConstants.SERVER_DEFAULT_DEPLOY_JBOSS_PORTAL_SAR);
if (libDirectory != null) {
libDirectory = new File(libDirectory, "lib"); //$NON-NLS-1$
} else {
- // Tomcat adds portlet-api.jat automatically
- /*File tomcatLib = new File(location,
+ libDirectory = getDirectory(location,
+ IPortletConstants.SERVER_DEFAULT_DEPLOY_SIMPLE_PORTAL);
+ if (libDirectory != null) {
+ libDirectory = new File(libDirectory, "lib"); //$NON-NLS-1$
+ } else {
+ libDirectory = getDirectory(location,
+ IPortletConstants.SERVER_DEFAULT_DEPLOY_JBOSS_PORTAL_HA_SAR);
+ if (libDirectory != null) {
+ libDirectory = new File(libDirectory, "lib"); //$NON-NLS-1$
+ } else {
+ // Tomcat adds portlet-api.jat automatically
+ /*File tomcatLib = new File(location,
IPortletConstants.TOMCAT_LIB);
- if (tomcatLib != null && tomcatLib.isDirectory()) {
- libDirectory = tomcatLib;
- }*/
+ if (tomcatLib != null && tomcatLib.isDirectory()) {
+ libDirectory = tomcatLib;
+ }*/
+ }
+ }
}
}
return libDirectory;
Show replies by date