Author: snjeza
Date: 2010-05-12 19:01:17 -0400 (Wed, 12 May 2010)
New Revision: 22045
Modified:
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/PortletUIActivator.java
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletbridgeRuntimeProviderInstallPanel.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6223 EPP 5.0 as Portlet Target Runtime Provider
Modified:
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/PortletUIActivator.java
===================================================================
---
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/PortletUIActivator.java 2010-05-12
22:53:22 UTC (rev 22044)
+++
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/PortletUIActivator.java 2010-05-12
23:01:17 UTC (rev 22045)
@@ -18,6 +18,7 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.server.core.IRuntime;
@@ -115,23 +116,7 @@
IProject project = ProjectUtilities.getProject(projectName);
try {
IFacetedProject facetedProject = ProjectFacetsManager.create(project);
- if (facetedProject != null) {
- org.eclipse.wst.common.project.facet.core.runtime.IRuntime facetRuntime =
facetedProject.getPrimaryRuntime();
- if (facetRuntime == null) {
- return null;
- }
- IRuntime runtime = PortletCoreActivator.getRuntime(facetRuntime);
- if (runtime == null) {
- return null;
- }
- IJBossServerRuntime jbossRuntime =
(IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, new
NullProgressMonitor());
- if (jbossRuntime == null) {
- return null;
- }
- IPath jbossLocation = runtime.getLocation();
- IPath configPath =
jbossLocation.append(IJBossServerConstants.SERVER).append(jbossRuntime.getJBossConfiguration());
- return configPath;
- }
+ return getJBossConfigPath(facetedProject);
} catch (CoreException e) {
PortletUIActivator.log(e);
}
@@ -139,6 +124,27 @@
return null;
}
+ public static IPath getJBossConfigPath(IFacetedProjectBase facetedProject) {
+ if (facetedProject != null) {
+ org.eclipse.wst.common.project.facet.core.runtime.IRuntime facetRuntime =
facetedProject.getPrimaryRuntime();
+ if (facetRuntime == null) {
+ return null;
+ }
+ IRuntime runtime = PortletCoreActivator.getRuntime(facetRuntime);
+ if (runtime == null) {
+ return null;
+ }
+ IJBossServerRuntime jbossRuntime =
(IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, new
NullProgressMonitor());
+ if (jbossRuntime == null) {
+ return null;
+ }
+ IPath jbossLocation = runtime.getLocation();
+ IPath configPath =
jbossLocation.append(IJBossServerConstants.SERVER).append(jbossRuntime.getJBossConfiguration());
+ return configPath;
+ }
+ return null;
+ }
+
public static boolean isJBossPortalRuntime(IDataModel model) {
IPath configPath = getJBossConfigPath(model);
if (configPath == null) {
Modified:
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletbridgeRuntimeProviderInstallPanel.java
===================================================================
---
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletbridgeRuntimeProviderInstallPanel.java 2010-05-12
22:53:22 UTC (rev 22044)
+++
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletbridgeRuntimeProviderInstallPanel.java 2010-05-12
23:01:17 UTC (rev 22045)
@@ -1,8 +1,10 @@
package org.jboss.tools.portlet.ui.internal.libprov;
+import java.io.File;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -16,6 +18,7 @@
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
import org.jboss.tools.portlet.core.IPortletConstants;
import
org.jboss.tools.portlet.core.libprov.JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig;
import org.jboss.tools.portlet.ui.Messages;
@@ -68,6 +71,22 @@
}
config.setPortletbridgeHome(portletbridgeRuntime);
}
+ if (portletbridgeRuntime == null || portletbridgeRuntime.length() == 0 ) {
+ IFacetedProjectBase facetedProject = config.getFacetedProject();
+ IPath configPath = PortletUIActivator.getJBossConfigPath(facetedProject);
+ if (configPath != null) {
+ IPath portalPath =
configPath.append(IPortletConstants.SERVER_DEFAULT_DEPLOY_GATEIN);
+ File portalFile = portalPath.toFile();
+ if (portalFile != null && portalFile.exists()) {
+ IPath eppHome = configPath.removeLastSegments(3);
+ IPath pbPath = eppHome.append("portletbridge"); //$NON-NLS-1$
+ File pbFile = pbPath.toFile();
+ if (pbFile != null && pbFile.exists()) {
+ portletbridgeRuntime = pbFile.getAbsolutePath();
+ }
+ }
+ }
+ }
folderText.setText(portletbridgeRuntime);
Button folderButton = new Button(portletBridgeGroup, SWT.PUSH);