Author: dennyxu
Date: 2008-10-07 04:46:38 -0400 (Tue, 07 Oct 2008)
New Revision: 10703
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/ESBProjectConstant.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUI.properties
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUIMessages.java
Removed:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/ESBProjectUtilities.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUI.properties
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUIMessages.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/messages/
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/IJBossESBFacetDataModelProperties.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossClassPathCommand.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetDataModelProvider.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/messages/JBossFacetCore.properties
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/messages/JBossFacetCoreMessages.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModule.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleDelegate.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleFactory.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntime.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeClassPathInitializer.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeListConverter.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeManager.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.xml
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/BaseFieldEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ButtonFieldEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/CompositeEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossESBRuntimePreferencePage.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossLibraryListFieldEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossRuntimeListFieldEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/TextFieldEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/ESBProjectWizard.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBProjectFirstPage.java
Log:
JBIDE-2864: Add the support of getting ESB runtime from the project target runtime
Copied:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/ESBProjectConstant.java
(from rev 10017,
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/ESBProjectUtilities.java)
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/ESBProjectConstant.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/ESBProjectConstant.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -0,0 +1,13 @@
+package org.jboss.tools.esb.core;
+
+public class ESBProjectConstant {
+
+ public final static String ESB_PROJECT_FACET = "jst.jboss.esb";
+ public final static String ESB_PROJECT_FACET_TEMPLATE =
"template.jst.jboss.esb";
+ public final static String BUILD_CLASSES = "build/classes";
+ public final static String META_INF = "META-INF";
+
+ public final static String ESB_DEPLOYMENT_FILE_NAME =
"META-INF/deployment.xml";
+
+ public final static String ESB_PROJECT_NATURE =
"org.jboss.tools.esb.project.ESBNature";
+}
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/ESBProjectUtilities.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/ESBProjectUtilities.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/ESBProjectUtilities.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -1,10 +0,0 @@
-package org.jboss.tools.esb.core;
-
-public class ESBProjectUtilities {
-
- public final static String ESB_PROJECT_FACET = "jst.jboss.esb";
- public final static String ESB_PROJECT_FACET_TEMPLATE =
"template.jst.jboss.esb";
- public final static String BUILD_CLASSES = "build/classes";
-
- public final static String ESB_PROJECT_NATURE =
"org.jboss.tools.esb.project.ESBNature";
-}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/IJBossESBFacetDataModelProperties.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/IJBossESBFacetDataModelProperties.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/IJBossESBFacetDataModelProperties.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -1,9 +1,9 @@
package org.jboss.tools.esb.core.facet;
import org.eclipse.core.runtime.QualifiedName;
-import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-public interface IJBossESBFacetDataModelProperties extends
IFacetProjectCreationDataModelProperties {
+public interface IJBossESBFacetDataModelProperties extends IFacetDataModelProperties {
public static final String USER_DEFINED_LOCATION =
"IProjectCreationPropertiesNew.USER_DEFINED_LOCATION"; //$NON-NLS-1$
public static final String DEFAULT_LOCATION =
"IProjectCreationPropertiesNew.DEFAULT_LOCATION"; //$NON-NLS-1$
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossClassPathCommand.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossClassPathCommand.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossClassPathCommand.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -15,6 +15,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -27,17 +28,21 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
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.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
import org.jboss.tools.esb.core.StatusUtils;
import org.jboss.tools.esb.core.messages.JBossFacetCoreMessages;
import org.jboss.tools.esb.core.runtime.JBossRuntimeClassPathInitializer;
/**
- * @author Grid Qian
+ * @author Denny Xu
*/
public class JBossClassPathCommand extends AbstractDataModelOperation {
IProject project;
private IDataModel model;
+ private String serverRuntimeId;
public JBossClassPathCommand(IProject project, IDataModel model) {
this.project = project;
@@ -54,43 +59,58 @@
try {
// store runtime name and runtime location to the project
-
- String runtimeName = model
- .getStringProperty(IJBossESBFacetDataModelProperties.RUNTIME_ID);
- String runtimeLocation = model
- .getStringProperty(IJBossESBFacetDataModelProperties.RUNTIME_HOME);
- String esbcontentFolder =
model.getStringProperty(IJBossESBFacetDataModelProperties.ESB_CONTENT_FOLDER);
- project
- .setPersistentProperty(
- IJBossESBFacetDataModelProperties.PERSISTENCE_PROPERTY_QNAME_RUNTIME_NAME,
- runtimeName);
- project
- .setPersistentProperty(
- IJBossESBFacetDataModelProperties.PERSISTENCE_PROPERTY_RNTIME_LOCATION,
- runtimeLocation);
- project.setPersistentProperty(IJBossESBFacetDataModelProperties.QNAME_ESB_CONTENT_FOLDER,
esbcontentFolder);
- status = addClassPath(project, runtimeName);
+ boolean isServerSupplied =
model.getBooleanProperty(IJBossESBFacetDataModelProperties.RUNTIME_IS_SERVER_SUPPLIED);
+ if(isServerSupplied){
+ serverRuntimeId = getProjectTargetRuntimeID(project);
+ String[] segments = new
String[]{JBossRuntimeClassPathInitializer.JBOSS_ESB_RUNTIME_CLASSPATH_SERVER_SUPPLIED,
+ serverRuntimeId};
+ status = addClassPath(project, segments);
+ }else{
+ String runtimeName = model
+ .getStringProperty(IJBossESBFacetDataModelProperties.RUNTIME_ID);
+ String runtimeLocation = model
+ .getStringProperty(IJBossESBFacetDataModelProperties.RUNTIME_HOME);
+ String esbcontentFolder =
model.getStringProperty(IJBossESBFacetDataModelProperties.ESB_CONTENT_FOLDER);
+ project
+ .setPersistentProperty(
+ IJBossESBFacetDataModelProperties.PERSISTENCE_PROPERTY_QNAME_RUNTIME_NAME,
+ runtimeName);
+ project
+ .setPersistentProperty(
+ IJBossESBFacetDataModelProperties.PERSISTENCE_PROPERTY_RNTIME_LOCATION,
+ runtimeLocation);
+ project.setPersistentProperty(IJBossESBFacetDataModelProperties.QNAME_ESB_CONTENT_FOLDER,
esbcontentFolder);
+ status = addClassPath(project, new String[]{runtimeName});
+ }
+
} catch (CoreException e) {
status = StatusUtils.errorStatus(
- JBossFacetCoreMessages.Error_Add_Facet_JBossWS, e);
+ JBossFacetCoreMessages.Error_Add_Facet_JBossESB, e);
}
return status;
}
- public IStatus addClassPath(IProject project, String segment) {
+ private String getProjectTargetRuntimeID(IProject project) throws CoreException{
+ IFacetedProject fp = ProjectFacetsManager.create(project);
+ IRuntime runtime = fp.getPrimaryRuntime();
+ return runtime.getProperty("id");
+
+ }
+
+ public IStatus addClassPath(IProject project, String[] segments) {
IStatus status = Status.OK_STATUS;
try {
IClasspathEntry newClasspath;
IJavaProject javaProject = JavaCore.create(project);
+ IPath path = new
Path(JBossRuntimeClassPathInitializer.JBOSS_ESB_RUNTIME_CLASSPATH_CONTAINER_ID);
+ for(String segment: segments ){
+ path = path.append(segment);
+ }
+ newClasspath = JavaCore.newContainerEntry(path);
- newClasspath = JavaCore
- .newContainerEntry(new Path(
- JBossRuntimeClassPathInitializer.JBOSS_ESB_RUNTIME_CLASSPATH_CONTAINER_ID)
- .append(segment));
-
IClasspathEntry[] oldClasspathEntries = javaProject
.readRawClasspath();
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetDataModelProvider.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetDataModelProvider.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetDataModelProvider.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -19,6 +19,7 @@
names.add(IJBossESBFacetDataModelProperties.ESB_SOURCE_FOLDER);
names.add(RUNTIME_ID);
names.add(RUNTIME_HOME);
+ names.add(RUNTIME_IS_SERVER_SUPPLIED);
return names;
}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -63,13 +63,11 @@
String runtimeId = model
.getStringProperty(IJBossESBFacetDataModelProperties.RUNTIME_ID);
- if (runtimeId != null && !runtimeId.equals("")) {
- JBossClassPathCommand command = new JBossClassPathCommand(project,
+ JBossClassPathCommand command = new JBossClassPathCommand(project,
model);
- IStatus status = command.executeOverride(monitor);
- if (!status.equals(Status.OK_STATUS)) {
- throw new CoreException(status);
- }
+ IStatus status = command.executeOverride(monitor);
+ if (!status.equals(Status.OK_STATUS)) {
+ throw new CoreException(status);
}
ClasspathHelper.removeClasspathEntries(project, fv);
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/messages/JBossFacetCore.properties
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/messages/JBossFacetCore.properties 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/messages/JBossFacetCore.properties 2008-10-07
08:46:38 UTC (rev 10703)
@@ -6,9 +6,9 @@
Dir_Web_Content=WebContent
Error_Copy=Exception while copy runtime jars
ESB_Location=jbossesbruntimelocation
-JBossWS_Runtime=JBoss ESB Runtime
+JBoss_Runtime=JBoss ESB Runtime
JBossAS=JBOSS
Error_WS_Location=The JBoss ESB Runtime Location is NULL
Error_WS_Classpath=A error comes up when create JBoss ESB runtime Classpath
-Error_Add_Facet_JBossWS=Exception while install JBoss ESB facet
+Error_Add_Facet_JBossESB=Exception while install JBoss ESB facet
Error_Remove_Facet_JBossWS=Exception while uninstall JBoss ESB facet
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/messages/JBossFacetCoreMessages.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/messages/JBossFacetCoreMessages.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/messages/JBossFacetCoreMessages.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -32,11 +32,11 @@
public static String Dir_Web_Content;
public static String Error_Copy;
public static String ESB_Location;
- public static String JBossWS_Runtime;
+ public static String JBoss_Runtime;
public static String JBossAS;
public static String Error_WS_Location;
public static String Error_WS_Classpath;
- public static String Error_Add_Facet_JBossWS;
+ public static String Error_Add_Facet_JBossESB;
public static String Error_Remove_Facet_JBossWS;
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModule.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModule.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModule.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -9,13 +9,11 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IModuleType;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.internal.ModuleFactory;
import org.eclipse.wst.server.core.internal.ModuleType;
import org.eclipse.wst.server.core.model.ModuleDelegate;
import org.eclipse.wst.server.core.model.ModuleFactoryDelegate;
-import org.jboss.tools.esb.core.ESBProjectUtilities;
+import org.jboss.tools.esb.core.ESBProjectConstant;
+import org.jboss.tools.esb.core.ESBProjectCorePlugin;
public class JBossESBModule implements IModule{
@@ -29,7 +27,6 @@
}
public Object getAdapter(Class adapter) {
- // TODO Auto-generated method stub
return null;
}
@@ -44,11 +41,11 @@
if (facetPrj == null) {
return null;
}
- final IProjectFacet esbfacet =
ProjectFacetsManager.getProjectFacet(ESBProjectUtilities.ESB_PROJECT_FACET);
+ final IProjectFacet esbfacet =
ProjectFacetsManager.getProjectFacet(ESBProjectConstant.ESB_PROJECT_FACET);
final IProjectFacetVersion fv = facetPrj.getInstalledVersion(esbfacet);
return ModuleType.getModuleType(esbfacet.getId(), fv.getVersionString());
} catch (CoreException e) {
- e.printStackTrace();
+ ESBProjectCorePlugin.getDefault().getLog().log(e.getStatus());
}
return null;
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleDelegate.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleDelegate.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleDelegate.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -14,11 +14,8 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.internal.core.JavaProject;
import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.internal.ModuleResourceDelta;
import org.eclipse.wst.server.core.model.IModuleResource;
-import org.eclipse.wst.server.core.model.ModuleDelegate;
import org.eclipse.wst.server.core.util.ModuleFile;
import org.eclipse.wst.server.core.util.ModuleFolder;
import org.eclipse.wst.server.core.util.ProjectModule;
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleFactory.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleFactory.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleFactory.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -7,9 +7,9 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.model.ModuleDelegate;
-import org.eclipse.wst.server.core.util.ProjectModule;
import org.eclipse.wst.server.core.util.ProjectModuleFactoryDelegate;
-import org.jboss.tools.esb.core.ESBProjectUtilities;
+import org.jboss.tools.esb.core.ESBProjectConstant;
+import org.jboss.tools.esb.core.ESBProjectCorePlugin;
public class JBossESBModuleFactory extends ProjectModuleFactoryDelegate {
@@ -32,13 +32,14 @@
if (facetProject == null) {
return null;
}
- IProjectFacet esbFacet =
ProjectFacetsManager.getProjectFacet(ESBProjectUtilities.ESB_PROJECT_FACET);
+ IProjectFacet esbFacet =
ProjectFacetsManager.getProjectFacet(ESBProjectConstant.ESB_PROJECT_FACET);
+
if(facetProject.hasProjectFacet(esbFacet)){
JBossESBModule module = new JBossESBModule(project, this, this.getId());
return new IModule[]{ module };
}
} catch (CoreException e) {
- e.printStackTrace();
+ ESBProjectCorePlugin.getDefault().getLog().log(e.getStatus());
}
return null;
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntime.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntime.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntime.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -15,7 +15,7 @@
import java.util.List;
/**
- * @author Grid Qian
+ * @author Denny Xu
*/
public class JBossRuntime {
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeClassPathInitializer.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeClassPathInitializer.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeClassPathInitializer.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -16,6 +16,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.ClasspathContainerInitializer;
import org.eclipse.jdt.core.IClasspathContainer;
@@ -23,50 +24,70 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.tools.esb.core.ESBProjectCorePlugin;
+import org.jboss.tools.esb.core.StatusUtils;
import org.jboss.tools.esb.core.messages.JBossFacetCoreMessages;
/**
- * @author Grid Qian
+ * @author Denny Xu
*/
public class JBossRuntimeClassPathInitializer extends
ClasspathContainerInitializer {
public final static String JBOSS_ESB_RUNTIME_CLASSPATH_CONTAINER_ID =
"org.jboss.esb.runtime.classpath";
+ public final static String JBOSS_ESB_RUNTIME_CLASSPATH_SERVER_SUPPLIED =
"server.supplied";
public JBossRuntimeClassPathInitializer() {
}
private String segment;
+ private boolean isServerSupplied = false;
+ private IJavaProject javaProject;
@Override
public void initialize(IPath containerPath, IJavaProject project)
throws CoreException {
-
+ this.javaProject = project;
if (containerPath.segment(0).equals(
JBOSS_ESB_RUNTIME_CLASSPATH_CONTAINER_ID)) {
+ if(containerPath.segmentCount() == 3
+ &&
containerPath.segment(1).equals(JBOSS_ESB_RUNTIME_CLASSPATH_SERVER_SUPPLIED)){
+ segment = containerPath.segment(2);
+ isServerSupplied = true;
+ }else{
+ segment = containerPath.segment(1);
+ isServerSupplied = false;
+ }
+
JBossRuntimeClasspathContainer container = new JBossRuntimeClasspathContainer(
- containerPath);
- segment = containerPath.segment(1);
+ containerPath, project, isServerSupplied);
JavaCore.setClasspathContainer(containerPath,
new IJavaProject[] { project },
- new IClasspathContainer[] { container }, null);
+ new IClasspathContainer[] { container }, null);
}
}
public IClasspathEntry[] getEntries(IPath path) {
- return new JBossRuntimeClasspathContainer(path).getClasspathEntries();
+ return new JBossRuntimeClasspathContainer(path, javaProject,
isServerSupplied).getClasspathEntries();
}
public class JBossRuntimeClasspathContainer implements
IClasspathContainer {
private IPath path;
+ private boolean isFromServer = false;
private IClasspathEntry[] entries = null;
+ private IJavaProject jproject;
+ private List<String> jars;
- public JBossRuntimeClasspathContainer(IPath path) {
+ public JBossRuntimeClasspathContainer(IPath path, IJavaProject project, boolean
isFromServer) {
this.path = path;
+ this.isFromServer = isFromServer;
+ this.jproject = project;
}
public String getDescription() {
- return JBossFacetCoreMessages.JBossWS_Runtime;
+ return JBossFacetCoreMessages.JBoss_Runtime;
}
public int getKind() {
@@ -80,18 +101,35 @@
public IClasspathEntry[] getClasspathEntries() {
if (entries == null) {
ArrayList<IClasspathEntry> entryList = new ArrayList<IClasspathEntry>();
- JBossRuntime jbws = JBossRuntimeManager.getInstance()
- .findRuntimeByName(segment);
- if (jbws != null) {
-
- List<String> jars =
JBossRuntimeManager.getInstance().getAllRuntimeJars(jbws);
- for (String jar : jars) {
- entryList.add(getEntry(new Path(jar)));
+ if (isFromServer) {
+ IRuntime serverRuntime = ServerCore.findRuntime(segment);
+
+ if(serverRuntime == null){
+ IStatus status = StatusUtils.errorStatus("Can not find the runtime: "+
segment);
+ ESBProjectCorePlugin.getDefault().getLog().log(status);
+ }
+ String runtimeLocation = serverRuntime.getLocation().toOSString();
+ jars = JBossRuntimeManager.getInstance().getAllRuntimeJars(runtimeLocation);
+
+ } else {
+
+ JBossRuntime jbws = JBossRuntimeManager.getInstance()
+ .findRuntimeByName(segment);
+ if (jbws != null) {
+ jars = JBossRuntimeManager.getInstance()
+ .getAllRuntimeJars(jbws);
}
- entries = entryList.toArray(new IClasspathEntry[entryList.size()]);
- if (entries == null)
- return new IClasspathEntry[0];
}
+
+ if(jars == null) return new IClasspathEntry[0];
+
+ for (String jar : jars) {
+ entryList.add(getEntry(new Path(jar)));
+ }
+ entries = entryList.toArray(new IClasspathEntry[entryList
+ .size()]);
+ if (entries == null)
+ return new IClasspathEntry[0];
}
return entries;
}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeListConverter.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeListConverter.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeListConverter.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -10,7 +10,7 @@
/**
*
- * @author Grid Qian
+ * @author Denny Xu
*
*/
public class JBossRuntimeListConverter {
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeManager.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeManager.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeManager.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -34,7 +34,7 @@
import org.jboss.tools.esb.core.messages.JBossFacetCoreMessages;
/**
- * @author Grid Qian
+ * @author Denny Xu
*/
public class JBossRuntimeManager {
@@ -158,36 +158,42 @@
} else {
- IPath rtHome = new Path(rt.getHomeDir());
- IPath deployPath =
rtHome.append("server").append("default").append("deploy");
-
- IPath esbPath = deployPath.append(JBOSSESB_ESB);
- IPath sarPath = deployPath.append(JBOSSESB_SAR);
-
- IPath libPath = rtHome.append("lib");
-
- if (!esbPath.toFile().exists() || !sarPath.toFile().exists()) {
- esbPath = libPath.append(JBOSSESB_ESB);
- sarPath = libPath.append(JBOSSESB_SAR);
-
- }
-
- List<File> esblibs = getJarsOfFolder(esbPath.toFile());
- IPath sarLibPath = sarPath.append("lib");
- List<File> sarJars = getJarsOfFolder(sarLibPath.toFile());
- ///List<File> commonLibs = getJarsOfFolder(libPath.toFile());
- //List<File> tmpLibs = mergeTwoFileList(esblibs, sarJars);
- //libs.addAll(commonLibs);
-
- jarList = mergeTwoList(esblibs, sarJars);
-
+ jarList = getAllRuntimeJars(rt.getHomeDir());
}
}
return jarList;
}
+ public List<String> getAllRuntimeJars(String runtimeLocation) {
+ List<String> jarList = new ArrayList<String>();
+ IPath rtHome = new Path(runtimeLocation);
+ IPath deployPath =
rtHome.append("server").append("default").append(
+ "deploy");
+
+ IPath esbPath = deployPath.append(JBOSSESB_ESB);
+ IPath sarPath = deployPath.append(JBOSSESB_SAR);
+
+ IPath libPath = rtHome.append("lib");
+
+ if (!esbPath.toFile().exists() || !sarPath.toFile().exists()) {
+ esbPath = libPath.append(JBOSSESB_ESB);
+ sarPath = libPath.append(JBOSSESB_SAR);
+
+ }
+
+ List<File> esblibs = getJarsOfFolder(esbPath.toFile());
+ IPath sarLibPath = sarPath.append("lib");
+ List<File> sarJars = getJarsOfFolder(sarLibPath.toFile());
+ // /List<File> commonLibs = getJarsOfFolder(libPath.toFile());
+ // List<File> tmpLibs = mergeTwoFileList(esblibs, sarJars);
+ // libs.addAll(commonLibs);
+
+ jarList = mergeTwoList(esblibs, sarJars);
+
+ return jarList;
+ }
private List<File> getJarsOfFolder(File folder){
List<File> jars = new ArrayList<File>();
@@ -376,8 +382,7 @@
try {
facetedProjects = ProjectFacetsManager.getFacetedProjects(facet);
} catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ return false;
}
for (IFacetedProject facetedProject : facetedProjects) {
QualifiedName qRuntimeName =
IJBossESBFacetDataModelProperties.PERSISTENCE_PROPERTY_QNAME_RUNTIME_NAME;
@@ -402,5 +407,42 @@
runtimes = converter.getMap(runtimeListString);
}
+
+ public static boolean isValidESBServer(String path){
+ IPath serverLocation = new Path(path);
+
+ String esbLcoationSeg = "server" + File.separator + "default"
+ + File.separator + "deploy" + File.separator
+ + "jbossesb.esb";
+ String sarLocationSeg = "server" + File.separator + "default"
+ + File.separator + "deploy" + File.separator
+ + "jbossesb.sar";
+ IPath esbLocation = serverLocation.append(esbLcoationSeg);
+ IPath sarLocation = serverLocation.append(sarLocationSeg);
+
+ if(!esbLocation.toFile().isDirectory()){
+ return false;
+ }
+ if(!sarLocation.toFile().isDirectory()){
+ return false;
+ }
+
+
+ return true;
+ }
+
+ public static boolean isValidESBStandaloneRuntimeDir(String path) {
+ IPath location = new Path(path);
+ IPath esblocation = location.append("lib").append("jbossesb.esb");
+ IPath sarLocation = location.append("lib").append("jbossesb.sar");
+ if (!esblocation.toFile().isDirectory()) {
+ return false;
+ }
+ if (!sarLocation.toFile().isDirectory()) {
+ return false;
+ }
+ return true;
+ }
+
}
\ No newline at end of file
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.xml
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.xml 2008-10-07 07:18:37 UTC
(rev 10702)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.xml 2008-10-07 08:46:38 UTC
(rev 10703)
@@ -1,21 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
- <extension-point id="org.jboss.tools.esb.project.ui.template"
name="ESB Template"
schema="schema/org.jboss.tools.esb.project.ui.template.exsd"/>
<extension
point="org.eclipse.ui.newWizards">
<wizard
- category="org.jboss.tools.esb.category1"
+ category="org.jboss.tools.esb.ui"
class="org.jboss.tools.esb.project.ui.wizards.ESBProjectWizard"
icon="$nl$/icons/wizards/esb.gif"
id="JBoss.ESB.Project.Wizard"
- name="ESB Project Wizard"
+ name="ESB Project"
project="true">
</wizard>
- <category
- id="org.jboss.tools.esb.category1"
- name="ESB Wizard">
- </category>
</extension>
<extension
Copied:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages
(from rev 10374,
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/messages)
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUI.properties
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/messages/JBossESBUI.properties 2008-09-19
05:42:06 UTC (rev 10374)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUI.properties 2008-10-07
08:46:38 UTC (rev 10703)
@@ -1,32 +0,0 @@
-Label_JBoss_Runtime_Load_Error=Error occurred while loading JBoss ESB runtime. Please
select a correct JBoss ESB runtime or JBoss ESB server location
-
-Error_JBoss_Basic_Editor_Composite=Parent control should be Composite
-Error_JBoss_Basic_Editor_Support=Editor supports only grid layout
-Error_JBoss_Basic_Editor_Different=Parent for label is different
-JBoss_Runtime_List_Field_Editor_Name=Name
-JBoss_Runtime_List_Field_Editor_Version=Version
-JBoss_Runtime_List_Field_Editor_Path=Path
-JBoss_Runtime_List_Field_Editor_Inputelement_Must_Be=inputElement must be
-JBoss_Runtime_List_Field_Editor_An_Instance_Of_List=an instance of
List<JBossRuntime>.
-JBoss_Runtime_Delete_Confirm_Title=Confirm Runtime Delete
-JBoss_Runtime_Delete_Used_Confirm=Runtime ''{0}'' is used by JBoss ESB
projects. Are you sure you want to delete it?
-JBoss_Runtime_Delete_Not_Used_Confirm=Are you sure you want to delete runtime
''{0}''?
-JBoss_Runtime_List_Field_Editor_Edit_Runtime=Edit JBoss ESB Runtime
-JBoss_Runtime_List_Field_Editor_Modify_Runtime=Input new values
-JBoss_Runtime_List_Field_Editor_New_Runtime=New JBoss ESB Runtime
-Error_JBoss_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty=Path to JBoss
ESB runtime home directory cannot be empty
-JBoss_Runtime_List_Field_Editor_Already_Exists=' already exists
-JBoss_Runtime_List_Field_Editor_Runtime=JBoss ESB Runtime
-Error_JBoss_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct=Runtime name is not
correct
-Error_JBoss_Runtime_List_Field_Editor_Name_Cannot_Be_Empty=Name cannot be empty
-Error_JBoss_Runtime_List_Field_Editor_Version_Cannot_Be_Empty=Version cannot be empty
-JBoss_Runtime_List_Field_Editor_Create_A_Runtime=Create a JBoss ESB Runtime
-JBoss_Runtime_List_Field_Editor_Home_Folder=Home Folder:
-JBoss_Composite_Editor_This_Method_Can_Be_Invoked=This metod can be invoked after
getEditorControls(parent) only
-JBoss_Button_Field_Editor_Browse=Browse...
-Error_JBoss_Button_Field_Editor_Not_Implemented_Yet=Not implemented yet. Please setup
real acion for editor.
-JBoss_SWT_Field_Editor_Factory_Browse=Browse...
-JBoss_SWT_Field_Editor_Factory_Select_Home_Folder=Select JBoss ESB runtime Home Folder
-JBoss_Runtime_List_Field_Editor_Name2=Name:
-JBoss_Runtime_Check_Field_Default_Classpath=Customize JBoss ESB runtime jars
-JBoss_Preference_Page_Runtimes=JBoss ESB Runtimes
\ No newline at end of file
Copied:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUI.properties
(from rev 10702,
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/messages/JBossESBUI.properties)
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUI.properties
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUI.properties 2008-10-07
08:46:38 UTC (rev 10703)
@@ -0,0 +1,56 @@
+Label_JBoss_Runtime_Load_Error=Error occurred while loading JBoss ESB runtime. Please
select a correct JBoss ESB runtime or JBoss ESB server location
+
+Error_JBoss_Basic_Editor_Composite=Parent control should be Composite
+Error_JBoss_Basic_Editor_Support=Editor supports only grid layout
+Error_JBoss_Basic_Editor_Different=Parent for label is different
+JBoss_Runtime_List_Field_Editor_Name=Name
+JBoss_Runtime_List_Field_Editor_Version=Version
+JBoss_Runtime_List_Field_Editor_Path=Path
+JBoss_Runtime_List_Field_Editor_Inputelement_Must_Be=inputElement must be
+JBoss_Runtime_List_Field_Editor_An_Instance_Of_List=an instance of
List<JBossRuntime>.
+JBoss_Runtime_Delete_Confirm_Title=Confirm Runtime Delete
+JBoss_Runtime_Delete_Used_Confirm=Runtime ''{0}'' is used by JBoss ESB
projects. Are you sure you want to delete it?
+JBoss_Runtime_Delete_Not_Used_Confirm=Are you sure you want to delete runtime
''{0}''?
+JBoss_Runtime_List_Field_Editor_Edit_Runtime=Edit JBoss ESB Runtime
+JBoss_Runtime_List_Field_Editor_Modify_Runtime=Input new values
+JBoss_Runtime_List_Field_Editor_New_Runtime=New JBoss ESB Runtime
+Error_JBoss_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty=Path to JBoss
ESB runtime home directory cannot be empty
+JBoss_Runtime_List_Field_Editor_Already_Exists=' already exists
+JBoss_Runtime_List_Field_Editor_Runtime=JBoss ESB Runtime
+Error_JBoss_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct=Runtime name is not
correct
+Error_JBoss_Runtime_List_Field_Editor_Name_Cannot_Be_Empty=Name cannot be empty
+Error_JBoss_Runtime_List_Field_Editor_Version_Cannot_Be_Empty=Version cannot be empty
+JBoss_Runtime_List_Field_Editor_Create_A_Runtime=Create a JBoss ESB Runtime
+JBoss_Runtime_List_Field_Editor_Home_Folder=Home Folder:
+JBoss_Composite_Editor_This_Method_Can_Be_Invoked=This method can be invoked after
getEditorControls(parent) only
+JBoss_Button_Field_Editor_Browse=Browse...
+Error_JBoss_Button_Field_Editor_Not_Implemented_Yet=Not implemented yet. Please setup
real acion for editor.
+JBoss_SWT_Field_Editor_Factory_Browse=Browse...
+JBoss_SWT_Field_Editor_Factory_Select_Home_Folder=Select JBoss ESB runtime Home Folder
+JBoss_Runtime_List_Field_Editor_Name2=Name:
+JBoss_Runtime_Check_Field_Default_Classpath=Customize JBoss ESB runtime jars
+JBoss_Preference_Page_Runtimes=JBoss ESB Runtimes
+
+
+ESBFacetInstallationPage_Button_Text_New=New
+ESBFacetInstallationPage_Default_SRC_Folder=src
+ESBFacetInstallationPage_Description=Configure project structure and classpath
+ESBFacetInstallationPage_Error_Message_Have_Not_Set_Target_Runtime=Please specify Target
Runtime at the first wizard page.
+ESBFacetInstallationPage_Error_Message_Invalid_ESB_Runtime=The specified target runtime
does not contain a valid ESB runtime.
+ESBFacetInstallationPage_Error_Message_No_Target_Runtime=No target runtime was
specified.
+ESBFacetInstallationPage_Error_Message_Specify_Content_Folder=Please specify a valid
content folder.
+ESBFacetInstallationPage_Error_Message_Specify_ESB_Runtime=Please specify a ESB runtime
+ESBFacetInstallationPage_Error_Message_Specify_Source_Folder=Please specify a valid
source folder.
+ESBFacetInstallationPage_Group_Runtime_Text=JBoss ESB Runtime
+ESBFacetInstallationPage_Group_Text_Folder=Project Folders
+ESBFacetInstallationPage_Label_Content_Directory=Content Directory
+ESBFacetInstallationPage_Label_Server_Supplied_Runtime=Server supplied ESB Runtime
+ESBFacetInstallationPage_Label_Source_Directory=Java Source Directory
+ESBFacetInstallationPage_Title=Install ESB Facet
+
+
+ESBProjectFirstPage_Description=Create a new JBoss ESB project.
+ESBProjectFirstPage_Title=JBoss ESB Project
+
+
+ESBProjectWizard_Title=New ESB Project Wizard
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUIMessages.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/messages/JBossESBUIMessages.java 2008-09-19
05:42:06 UTC (rev 10374)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUIMessages.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.esb.project.ui.preference.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * @author Grid Qian
- */
-public final class JBossESBUIMessages extends NLS {
-
- private static final String BUNDLE_NAME =
- "org.jboss.tools.esb.project.ui.preference.messages.JBossESBUI"; //$NON-NLS-1$
-
- private JBossESBUIMessages() {
- // Do not instantiate
- }
-
- public static String Label_JBoss_Runtime_Load_Error;
-
- public static String Error_JBoss_Basic_Editor_Composite;
- public static String Error_JBoss_Basic_Editor_Support;
- public static String Error_JBoss_Basic_Editor_Different;
- public static String JBoss_Runtime_List_Field_Editor_Name;
- public static String JBoss_Runtime_List_Field_Editor_Version;
- public static String JBoss_Runtime_List_Field_Editor_Path;
- public static String JBoss_Runtime_List_Field_Editor_Inputelement_Must_Be;
- public static String JBoss_Runtime_List_Field_Editor_An_Instance_Of_List;
- public static String JBoss_Runtime_Delete_Confirm_Title;
- public static String JBoss_Runtime_Delete_Used_Confirm;
- public static String JBoss_Runtime_Delete_Not_Used_Confirm;
- public static String JBoss_Runtime_List_Field_Editor_Edit_Runtime;
- public static String JBoss_Runtime_List_Field_Editor_Modify_Runtime;
- public static String JBoss_Runtime_List_Field_Editor_New_Runtime;
- public static String
Error_JBoss_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty;
- public static String JBoss_Runtime_List_Field_Editor_Already_Exists;
- public static String JBoss_Runtime_List_Field_Editor_Runtime;
- public static String Error_JBoss_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct;
- public static String Error_JBoss_Runtime_List_Field_Editor_Name_Cannot_Be_Empty;
- public static String Error_JBoss_Runtime_List_Field_Editor_Version_Cannot_Be_Empty;
- public static String JBoss_Runtime_List_Field_Editor_Create_A_Runtime;
- public static String JBoss_Runtime_List_Field_Editor_Home_Folder;
- public static String JBoss_Composite_Editor_This_Method_Can_Be_Invoked;
- public static String JBoss_Button_Field_Editor_Browse;
- public static String Error_JBoss_Button_Field_Editor_Not_Implemented_Yet;
- public static String JBoss_SWT_Field_Editor_Factory_Browse;
- public static String JBoss_SWT_Field_Editor_Factory_Select_Home_Folder;
- public static String JBoss_Runtime_List_Field_Editor_Name2;
- public static String JBoss_Runtime_Check_Field_Default_Classpath;
- public static String JBoss_Preference_Page_Runtimes;
-
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, JBossESBUIMessages.class);
- }
-}
Copied:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUIMessages.java
(from rev 10702,
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/messages/JBossESBUIMessages.java)
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUIMessages.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUIMessages.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.esb.project.ui.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Grid Qian
+ */
+public final class JBossESBUIMessages extends NLS {
+
+ private static final String BUNDLE_NAME =
+ "org.jboss.tools.esb.project.ui.messages.JBossESBUI"; //$NON-NLS-1$
+
+ private JBossESBUIMessages() {
+ // Do not instantiate
+ }
+
+ public static String Label_JBoss_Runtime_Load_Error;
+
+ public static String Error_JBoss_Basic_Editor_Composite;
+ public static String Error_JBoss_Basic_Editor_Support;
+ public static String Error_JBoss_Basic_Editor_Different;
+ public static String JBoss_Runtime_List_Field_Editor_Name;
+ public static String JBoss_Runtime_List_Field_Editor_Version;
+ public static String JBoss_Runtime_List_Field_Editor_Path;
+ public static String JBoss_Runtime_List_Field_Editor_Inputelement_Must_Be;
+ public static String JBoss_Runtime_List_Field_Editor_An_Instance_Of_List;
+ public static String JBoss_Runtime_Delete_Confirm_Title;
+ public static String JBoss_Runtime_Delete_Used_Confirm;
+ public static String JBoss_Runtime_Delete_Not_Used_Confirm;
+ public static String JBoss_Runtime_List_Field_Editor_Edit_Runtime;
+ public static String JBoss_Runtime_List_Field_Editor_Modify_Runtime;
+ public static String JBoss_Runtime_List_Field_Editor_New_Runtime;
+ public static String
Error_JBoss_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty;
+ public static String JBoss_Runtime_List_Field_Editor_Already_Exists;
+ public static String JBoss_Runtime_List_Field_Editor_Runtime;
+ public static String Error_JBoss_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct;
+ public static String Error_JBoss_Runtime_List_Field_Editor_Name_Cannot_Be_Empty;
+ public static String Error_JBoss_Runtime_List_Field_Editor_Version_Cannot_Be_Empty;
+ public static String JBoss_Runtime_List_Field_Editor_Create_A_Runtime;
+ public static String JBoss_Runtime_List_Field_Editor_Home_Folder;
+ public static String JBoss_Composite_Editor_This_Method_Can_Be_Invoked;
+ public static String JBoss_Button_Field_Editor_Browse;
+ public static String Error_JBoss_Button_Field_Editor_Not_Implemented_Yet;
+ public static String JBoss_SWT_Field_Editor_Factory_Browse;
+ public static String JBoss_SWT_Field_Editor_Factory_Select_Home_Folder;
+ public static String JBoss_Runtime_List_Field_Editor_Name2;
+ public static String JBoss_Runtime_Check_Field_Default_Classpath;
+ public static String JBoss_Preference_Page_Runtimes;
+
+
+ //esb facet messages
+ public static String ESBFacetInstallationPage_Button_Text_New;
+
+ public static String ESBFacetInstallationPage_Default_SRC_Folder;
+
+ public static String ESBFacetInstallationPage_Description;
+
+ public static String
ESBFacetInstallationPage_Error_Message_Have_Not_Set_Target_Runtime;
+
+ public static String ESBFacetInstallationPage_Error_Message_Invalid_ESB_Runtime;
+
+ public static String ESBFacetInstallationPage_Error_Message_No_Target_Runtime;
+
+ public static String ESBFacetInstallationPage_Error_Message_Specify_Content_Folder;
+
+ public static String ESBFacetInstallationPage_Error_Message_Specify_ESB_Runtime;
+
+ public static String ESBFacetInstallationPage_Error_Message_Specify_Source_Folder;
+
+ public static String ESBFacetInstallationPage_Group_Runtime_Text;
+
+ public static String ESBFacetInstallationPage_Group_Text_Folder;
+
+ public static String ESBFacetInstallationPage_Label_Content_Directory;
+
+ public static String ESBFacetInstallationPage_Label_Server_Supplied_Runtime;
+
+ public static String ESBFacetInstallationPage_Label_Source_Directory;
+
+ public static String ESBFacetInstallationPage_Title;
+
+
+
+
+ public static String ESBProjectFirstPage_Description;
+
+ public static String ESBProjectFirstPage_Title;
+
+ public static String ESBProjectWizard_Title;
+
+
+
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, JBossESBUIMessages.class);
+ }
+}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/BaseFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/BaseFieldEditor.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/BaseFieldEditor.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -26,7 +26,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
-import org.jboss.tools.esb.project.ui.preference.messages.JBossESBUIMessages;
+import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
/**
* @author Grid Qian
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ButtonFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ButtonFieldEditor.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ButtonFieldEditor.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -16,7 +16,7 @@
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.jboss.tools.esb.project.ui.preference.messages.JBossESBUIMessages;
+import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
/**
* @author Grid Qian
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/CompositeEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/CompositeEditor.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/CompositeEditor.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -27,7 +27,7 @@
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.jboss.tools.esb.project.ui.preference.messages.JBossESBUIMessages;
+import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
/**
* @author Grid Qian
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossESBRuntimePreferencePage.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossESBRuntimePreferencePage.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossESBRuntimePreferencePage.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -24,7 +24,7 @@
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.jboss.tools.esb.core.runtime.JBossRuntime;
import org.jboss.tools.esb.core.runtime.JBossRuntimeManager;
-import org.jboss.tools.esb.project.ui.preference.messages.JBossESBUIMessages;
+import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
/**
* @author Grid Qian
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossLibraryListFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossLibraryListFieldEditor.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossLibraryListFieldEditor.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -49,8 +49,8 @@
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.jboss.tools.esb.core.runtime.JBossRuntime;
+import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
import org.jboss.tools.esb.project.ui.preference.JBossESBUIPlugin;
-import org.jboss.tools.esb.project.ui.preference.messages.JBossESBUIMessages;
/**
* @author Grid Qian
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossRuntimeListFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossRuntimeListFieldEditor.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossRuntimeListFieldEditor.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -60,10 +60,10 @@
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.jboss.tools.esb.core.ESBProjectUtilities;
+import org.jboss.tools.esb.core.ESBProjectConstant;
import org.jboss.tools.esb.core.runtime.JBossRuntime;
import org.jboss.tools.esb.core.runtime.JBossRuntimeManager;
-import org.jboss.tools.esb.project.ui.preference.messages.JBossESBUIMessages;
+import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
/**
* @author Grid Qian
@@ -578,7 +578,7 @@
private List<String> getESBFacetVersions(){
List<String> versions = new ArrayList<String>();
- IProjectFacet esbfacet =
ProjectFacetsManager.getProjectFacet(ESBProjectUtilities.ESB_PROJECT_FACET);
+ IProjectFacet esbfacet =
ProjectFacetsManager.getProjectFacet(ESBProjectConstant.ESB_PROJECT_FACET);
for(IProjectFacetVersion version: esbfacet.getVersions()){
versions.add(version.getVersionString());
}
@@ -661,8 +661,8 @@
if (!jbosswsHomeDir.isDirectory())
return false;
- if(!isValidESBStandaloneRuntimeDir(path)
- && !isValidESBServer(path)){
+ if(!JBossRuntimeManager.isValidESBStandaloneRuntimeDir(path)
+ && !JBossRuntimeManager.isValidESBServer(path)){
return false;
}
@@ -670,42 +670,7 @@
return true;
}
- private boolean isValidESBStandaloneRuntimeDir(String path) {
- IPath location = new Path(path);
- IPath esblocation =
location.append("lib").append("jbossesb.esb");
- IPath sarLocation =
location.append("lib").append("jbossesb.sar");
- if (!esblocation.toFile().isDirectory()) {
- return false;
- }
- if (!sarLocation.toFile().isDirectory()) {
- return false;
- }
-
- return true;
- }
- private boolean isValidESBServer(String path){
- IPath serverLocation = new Path(path);
-
- String esbLcoationSeg = "server" + File.separator + "default"
- + File.separator + "deploy" + File.separator
- + "jbossesb.esb";
- String sarLocationSeg = "server" + File.separator + "default"
- + File.separator + "deploy" + File.separator
- + "jbossesb.sar";
- IPath esbLocation = serverLocation.append(esbLcoationSeg);
- IPath sarLocation = serverLocation.append(sarLocationSeg);
-
- if(!esbLocation.toFile().isDirectory()){
- return false;
- }
- if(!sarLocation.toFile().isDirectory()){
- return false;
- }
-
-
- return true;
- }
}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/TextFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/TextFieldEditor.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/TextFieldEditor.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -22,7 +22,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.esb.project.ui.preference.messages.JBossESBUIMessages;
+import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
/**
*
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/ESBProjectWizard.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/ESBProjectWizard.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/ESBProjectWizard.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -9,20 +9,21 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard;
import org.jboss.tools.common.model.ui.ModelUIImages;
-import org.jboss.tools.esb.core.ESBProjectUtilities;
+import org.jboss.tools.esb.core.ESBProjectConstant;
+import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
import org.jboss.tools.esb.project.ui.wizards.pages.ESBProjectFirstPage;
public class ESBProjectWizard extends NewProjectDataModelFacetWizard implements
INewWizard {
public ESBProjectWizard() {
- setWindowTitle("New ESB Project Wizard");
+ setWindowTitle(JBossESBUIMessages.ESBProjectWizard_Title);
setDefaultPageImageDescriptor(ModelUIImages.getImageDescriptor(ModelUIImages.WIZARD_NEW_PROJECT));
}
public ESBProjectWizard(IDataModel model) {
super(model);
- setWindowTitle("New ESB Project Wizard");
+ setWindowTitle(JBossESBUIMessages.ESBProjectWizard_Title);
setDefaultPageImageDescriptor(ModelUIImages.getImageDescriptor(ModelUIImages.WIZARD_NEW_PROJECT));
}
@@ -34,7 +35,7 @@
@Override
protected IWizardPage createFirstPage() {
- return new ESBProjectFirstPage(model, "first.page");
+ return new ESBProjectFirstPage(model, "first.page"); //$NON-NLS-1$
}
@Override
@@ -44,7 +45,7 @@
@Override
protected IFacetedProjectTemplate getTemplate() {
- return
ProjectFacetsManager.getTemplate(ESBProjectUtilities.ESB_PROJECT_FACET_TEMPLATE);
+ return
ProjectFacetsManager.getTemplate(ESBProjectConstant.ESB_PROJECT_FACET_TEMPLATE);
}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -2,8 +2,11 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.EventObject;
import java.util.List;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
@@ -14,6 +17,8 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
@@ -34,12 +39,16 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
-import org.jboss.tools.esb.core.ESBProjectUtilities;
+import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.tools.esb.core.ESBProjectConstant;
import org.jboss.tools.esb.core.facet.IJBossESBFacetDataModelProperties;
import org.jboss.tools.esb.core.runtime.JBossRuntime;
import org.jboss.tools.esb.core.runtime.JBossRuntimeManager;
+import org.jboss.tools.esb.project.ui.ESBProjectPlugin;
+import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
import org.jboss.tools.esb.project.ui.preference.controls.JBossRuntimeListFieldEditor;
public class ESBFacetInstallationPage extends AbstractFacetWizardPage implements
IFacetWizardPage, IJBossESBFacetDataModelProperties {
@@ -51,20 +60,23 @@
private IDataModel model;
private boolean hasValidContentFolder = true;
private boolean hasValidSrc = true;
- private boolean hasRuntime = true;
+ private boolean hasRuntime = false;
private Combo cmbRuntimes;
+ private Button btnUserSupplied;
+ private Button btnServerSupplied;
+ private Button btnNew;
public ESBFacetInstallationPage() {
super( "esb.facet.install.page"); //$NON-NLS-1$
- setTitle("Install ESB Facet");
- setDescription("Configure project structure and classpath");
+ setTitle(JBossESBUIMessages.ESBFacetInstallationPage_Title);
+ setDescription(JBossESBUIMessages.ESBFacetInstallationPage_Description);
}
private void setDefaultOutputFolder(){
JavaFacetInstallConfig cfg = findJavaFacetInstallConfig();
if(cfg != null){
- cfg.setDefaultOutputFolder(new Path(ESBProjectUtilities.BUILD_CLASSES));
+ cfg.setDefaultOutputFolder(new Path(ESBProjectConstant.BUILD_CLASSES));
}
}
@@ -75,7 +87,7 @@
createProjectGroup(composite);
createRuntimeGroup(composite);
-
+ setPageComplete(false);
setDefaultOutputFolder();
//synchHelper.synchText(configFolder, CONTENT_DIR, null);
@@ -86,7 +98,7 @@
fpwc.addListener(new IFacetedProjectListener(){
public void handleEvent(IFacetedProjectEvent event) {
- IProjectFacet facet =
ProjectFacetsManager.getProjectFacet(ESBProjectUtilities.ESB_PROJECT_FACET);
+ IProjectFacet facet =
ProjectFacetsManager.getProjectFacet(ESBProjectConstant.ESB_PROJECT_FACET);
final IProjectFacetVersion version = fpwc.getProjectFacetVersion(facet);
Display.getDefault().syncExec(new Runnable() {
@@ -109,13 +121,13 @@
private void createProjectGroup(Composite parent){
Group prjGroup = new Group(parent, SWT.BORDER);
- prjGroup.setText("Project Folders");
+ prjGroup.setText(JBossESBUIMessages.ESBFacetInstallationPage_Group_Text_Folder);
prjGroup.setLayout(new GridLayout(1, false));
prjGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
this.contextRootLabel = new Label(prjGroup, SWT.NONE);
- this.contextRootLabel.setText("Content Directory");
+ this.contextRootLabel.setText(JBossESBUIMessages.ESBFacetInstallationPage_Label_Content_Directory);
this.contextRootLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
this.contentFolder = new Text(prjGroup, SWT.BORDER);
@@ -125,7 +137,7 @@
contentFolder.addModifyListener(new ModifyListener(){
public void modifyText(ModifyEvent e){
String content = contentFolder.getText();
- if(content != null && !content.equals("")){
+ if(content != null && !content.equals("")){ //$NON-NLS-1$
model.setProperty(ESB_CONTENT_FOLDER, content);
}
changePageStatus();
@@ -133,17 +145,17 @@
});
configFolderLabel = new Label(prjGroup, SWT.NONE);
- configFolderLabel.setText("Java Source Directory");
+ configFolderLabel.setText(JBossESBUIMessages.ESBFacetInstallationPage_Label_Source_Directory);
configFolderLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
configFolder = new Text(prjGroup, SWT.BORDER);
configFolder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
configFolder.setData("label", configFolderLabel); //$NON-NLS-1$
- configFolder.setText("src");
+ configFolder.setText(JBossESBUIMessages.ESBFacetInstallationPage_Default_SRC_Folder);
configFolder.addModifyListener(new ModifyListener(){
public void modifyText(ModifyEvent e){
String srcFolder = configFolder.getText();
- if(srcFolder != null && !srcFolder.equals("")){
+ if(srcFolder != null && !srcFolder.equals("")){ //$NON-NLS-1$
model.setProperty(ESB_SOURCE_FOLDER, srcFolder);
setConfigFolder(srcFolder);
}
@@ -197,26 +209,40 @@
private void createRuntimeGroup(Composite parent){
Group runtimeGroup = new Group(parent, SWT.BORDER);
- runtimeGroup.setText("JBoss ESB Runtime");
- runtimeGroup.setLayout(new GridLayout(2, false));
+ runtimeGroup.setText(JBossESBUIMessages.ESBFacetInstallationPage_Group_Runtime_Text);
+ runtimeGroup.setLayout(new GridLayout(3, false));
runtimeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- /* Button btnServerSupplied = new Button(runtimeGroup, SWT.RADIO);
-
+ btnServerSupplied = new Button(runtimeGroup, SWT.RADIO);
+ btnServerSupplied.addMouseListener(new MouseAdapter(){
+ public void mouseDown(MouseEvent e) {
+ setServerSuppliedSelection(e);
+ }
+ });
GridData gd = new GridData();
gd.horizontalSpan = 1;
- btnServerSupplied.setLayoutData(gd);*/
+ btnServerSupplied.setLayoutData(gd);
- /*Label lblServerSupplied = new Label(runtimeGroup, SWT.NONE);
+ Label lblServerSupplied = new Label(runtimeGroup, SWT.NONE);
+ lblServerSupplied.addMouseListener(new MouseAdapter(){
+ public void mouseDown(MouseEvent e) {
+ btnServerSupplied.setSelection(true);
+ setServerSuppliedSelection(e);
+ }
+ });
- lblServerSupplied.setText("Server supplied ESB Runtime");
+ lblServerSupplied.setText(JBossESBUIMessages.ESBFacetInstallationPage_Label_Server_Supplied_Runtime);
gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 3;
+ gd.horizontalSpan = 2;
lblServerSupplied.setLayoutData(gd);
- Button btnUserSupplied = new Button(runtimeGroup, SWT.RADIO);*/
-
+ btnUserSupplied = new Button(runtimeGroup, SWT.RADIO);
+ btnUserSupplied.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ setUserSuppliedSelection(e);
+ }
+ });
cmbRuntimes = new Combo(runtimeGroup, SWT.READ_ONLY);
cmbRuntimes.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -225,50 +251,129 @@
String runtimeName = cmbRuntimes.getText();
JBossRuntime jr = (JBossRuntime) cmbRuntimes
.getData(runtimeName);
- saveJBosswsRuntimeToModel(jr);
+ saveJBossESBRuntimeToModel(jr);
+ changePageStatus();
}
});
initializeRuntimesCombo(cmbRuntimes, null);
- Button btnNew = new Button(runtimeGroup, SWT.NONE);
- btnNew.setText("New");
+ btnNew = new Button(runtimeGroup, SWT.NONE);
+ btnNew.setText(JBossESBUIMessages.ESBFacetInstallationPage_Button_Text_New);
btnNew.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- newJBossWSRuntime();
+ newJBossRuntime();
changePageStatus();
}
});
- if("".equals(cmbRuntimes.getText())){
+ if("".equals(cmbRuntimes.getText())){ //$NON-NLS-1$
hasRuntime = false;
}
- /*Composite chkcom = new Composite(runtimeGroup, SWT.NONE);
- chkcom.setLayout(new GridLayout(3, true));
- chkcom.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Button jbpm = new Button(chkcom, SWT.CHECK);
- jbpm.setText("Depends on jbpm.esb");
- Button smooks = new Button(chkcom, SWT.CHECK);
- smooks.setText("Depends on Smooks.esb");
-
- Button jbrules = new Button(chkcom, SWT.CHECK);
- jbrules.setText("Depends on jrules.esb");
+ }
+
+ protected void setServerSuppliedSelection(EventObject e) {
+ btnServerSupplied.setSelection(true);
+ btnUserSupplied.setSelection(false);
+ model
+ .setBooleanProperty(
+ IJBossESBFacetDataModelProperties.RUNTIME_IS_SERVER_SUPPLIED,
+ true);
+ //remove user supplied properties
+ model.setStringProperty(
+ IJBossESBFacetDataModelProperties.RUNTIME_ID, null);
+ model.setStringProperty(
+ IJBossESBFacetDataModelProperties.RUNTIME_HOME, null);
+ enableUserSupplied(false);
+ //checkServerSuppliedESBRuntime();
+ changePageStatus();
- Button spring = new Button(chkcom, SWT.CHECK);
- spring.setText("Depends on spring.esb");
+ }
+
+ protected void setUserSuppliedSelection(EventObject e) {
+ btnServerSupplied.setSelection(false);
+ btnUserSupplied.setSelection(true);
+ model
+ .setBooleanProperty(
+ IJBossESBFacetDataModelProperties.RUNTIME_IS_SERVER_SUPPLIED,
+ false);
+ String runtimename = cmbRuntimes.getText();
+ if(runtimename == null || runtimename.equals("")){ //$NON-NLS-1$
+ hasRuntime = false;
+ }
+ JBossRuntime jbRuntime =
JBossRuntimeManager.getInstance().findRuntimeByName(runtimename);
- Button soap = new Button(chkcom, SWT.CHECK);
- soap.setText("Depends on soap.esb");*/
+ if (jbRuntime != null) {
+ saveJBossESBRuntimeToModel(jbRuntime);
+ }
+ enableUserSupplied(true);
+ changePageStatus();
+
}
-
+
+ private void checkServerSuppliedESBRuntime() {
+ String prjname = model.getStringProperty(FACET_PROJECT_NAME);
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ prjname);
+ try {
+ IFacetedProject fp = ProjectFacetsManager.create(project);
+ if (fp != null) {
+ IRuntime runtime = fp.getPrimaryRuntime();
+ if (runtime == null) {
+ setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_No_Target_Runtime);
+ hasRuntime = false;
+ setPageComplete(isPageComplete());
+ return;
+ }
+ org.eclipse.wst.server.core.IRuntime serverRuntime = ServerCore
+ .findRuntime(runtime.getProperty("id"));
+ if (!JBossRuntimeManager.isValidESBServer(serverRuntime
+ .getLocation().toOSString())) {
+ setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_Invalid_ESB_Runtime);
+ hasRuntime = false;
+ setPageComplete(isPageComplete());
+ return;
+ }
+ } else {
+ IFacetedProjectWorkingCopy ifpwc = getFacetedProjectWorkingCopy();
+ IRuntime runtime = ifpwc.getPrimaryRuntime();
+ if (runtime == null) {
+ setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_Have_Not_Set_Target_Runtime);
+ hasRuntime = false;
+ setPageComplete(isPageComplete());
+ return;
+ }
+
+ org.eclipse.wst.server.core.IRuntime serverRuntime = ServerCore
+ .findRuntime(runtime.getProperty("id")); //$NON-NLS-1$
+ if (!JBossRuntimeManager.isValidESBServer(serverRuntime
+ .getLocation().toOSString())) {
+ hasRuntime = false;
+ setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_Invalid_ESB_Runtime);
+ setPageComplete(isPageComplete());
+ return;
+ }
+ }
+
+ } catch (CoreException e) {
+ ESBProjectPlugin.getDefault().getLog().log(e.getStatus());
+ }
+
+ }
+
+
+ private void enableUserSupplied(boolean enabled){
+ cmbRuntimes.setEnabled(enabled);
+ btnNew.setEnabled(enabled);
+ }
/*
- * create a new jbossws runtime and set user supplied runtime to the new one
+ * create a new jboss ESB runtime and set user supplied runtime to the new one
*/
- protected void newJBossWSRuntime() {
+ protected void newJBossRuntime() {
List<JBossRuntime> exists = new
ArrayList<JBossRuntime>(Arrays.asList(JBossRuntimeManager.getInstance().getRuntimes()));
List<JBossRuntime> added = new ArrayList<JBossRuntime>();
@@ -291,13 +396,13 @@
}
protected void initializeRuntimesCombo(Combo cmRuntime, String runtimeName, String
version) {
- JBossRuntime selectedJbws = null;
+ JBossRuntime selectedJbRuntime = null;
JBossRuntime defaultJbws = null;
int selectIndex = 0;
int defaultIndex = 0;
cmRuntime.removeAll();
- if(runtimeName == null || "".equals(runtimeName)){
+ if(runtimeName == null || "".equals(runtimeName)){ //$NON-NLS-1$
runtimeName = model.getStringProperty(IJBossESBFacetDataModelProperties.RUNTIME_ID);
}
JBossRuntime[] runtimes = JBossRuntimeManager.getInstance()
@@ -308,7 +413,7 @@
cmRuntime.setData(jr.getName(), jr);
if(jr.getName().equals(runtimeName)){
- selectedJbws = jr;
+ selectedJbRuntime = jr;
selectIndex = i;
}
// get default jbossws runtime
@@ -318,12 +423,12 @@
}
}
- if(selectedJbws != null){
+ if(selectedJbRuntime != null){
cmRuntime.select(selectIndex);
- saveJBosswsRuntimeToModel(selectedJbws);
+ saveJBossESBRuntimeToModel(selectedJbRuntime);
}else if(defaultJbws != null){
cmRuntime.select(defaultIndex);
- saveJBosswsRuntimeToModel(defaultJbws);
+ saveJBossESBRuntimeToModel(defaultJbws);
}
}
@@ -334,13 +439,13 @@
initializeRuntimesCombo(cmbRuntimes, null, version.getVersionString());
}else{
- initializeRuntimesCombo(cmbRuntimes, null, "");
+ initializeRuntimesCombo(cmbRuntimes, null, ""); //$NON-NLS-1$
}
}
private IProjectFacetVersion getSelectedESBVersion(){
IFacetedProjectWorkingCopy fpwc = getFacetedProjectWorkingCopy();
- IProjectFacet facet =
ProjectFacetsManager.getProjectFacet(ESBProjectUtilities.ESB_PROJECT_FACET);
+ IProjectFacet facet =
ProjectFacetsManager.getProjectFacet(ESBProjectConstant.ESB_PROJECT_FACET);
if(fpwc != null){
return fpwc.getProjectFacetVersion(facet);
}else{
@@ -349,14 +454,8 @@
}
- protected void saveJBosswsRuntimeToModel(JBossRuntime jbws) {
- /* String duplicateMsg = "";
- try {
- duplicateMsg = ESBProjectUtil.getDuplicateJars(model, jbws.getName());
- } catch (JavaModelException e1) {
- JBossESBPlugin.getDefault().getLog().log(
- StatusUtils.errorStatus(e1));
- }*/
+ protected void saveJBossESBRuntimeToModel(JBossRuntime jbws) {
+
if (jbws != null) {
model.setStringProperty(
IJBossESBFacetDataModelProperties.RUNTIME_HOME,
@@ -385,18 +484,20 @@
StatusUtils.errorStatus(e1));
}*/
- if(contentFolder.getText().trim().equals("")){
- setErrorMessage("Please specify a valid content folder.");
+ if(contentFolder.getText().trim().equals("")){ //$NON-NLS-1$
+ setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_Specify_Content_Folder);
hasValidContentFolder = false;
setPageComplete(isPageComplete());
}
- else if(configFolder.getText().trim().equals("")){
- setErrorMessage("Please specify a valid source folder.");
+ else if(configFolder.getText().trim().equals("")){ //$NON-NLS-1$
+ setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_Specify_Source_Folder);
hasValidSrc = false;
setPageComplete(isPageComplete());
- }else if(!hasRuntime){
- setErrorMessage("Please specify a ESB runtime");
+ }else if(btnUserSupplied.getSelection() && !hasRuntime){
+ setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_Specify_ESB_Runtime);
setPageComplete(isPageComplete());
+ }else if(btnServerSupplied.getSelection()){
+ checkServerSuppliedESBRuntime();
}
/* else if (!duplicateMsg.equals("")) {
setErrorMessage("Duplicated jar on classpath:" + duplicateMsg);
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBProjectFirstPage.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBProjectFirstPage.java 2008-10-07
07:18:37 UTC (rev 10702)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBProjectFirstPage.java 2008-10-07
08:46:38 UTC (rev 10703)
@@ -6,18 +6,19 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetCreationWizardPage;
-import org.jboss.tools.esb.core.ESBProjectUtilities;
+import org.jboss.tools.esb.core.ESBProjectConstant;
+import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
public class ESBProjectFirstPage extends DataModelFacetCreationWizardPage {
public ESBProjectFirstPage(IDataModel dataModel, String pageName) {
super(dataModel, pageName);
- setTitle("JBoss ESB Project");
- setDescription("Create a new JBoss ESB project.");
+ setTitle(JBossESBUIMessages.ESBProjectFirstPage_Title);
+ setDescription(JBossESBUIMessages.ESBProjectFirstPage_Description);
}
protected String getModuleTypeID() {
- return ESBProjectUtilities.ESB_PROJECT_FACET;
+ return ESBProjectConstant.ESB_PROJECT_FACET;
}
protected void createPresetPanel(Composite top) {