JBoss Tools SVN: r2949 - in trunk/seam/plugins: org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-08-07 21:40:53 -0400 (Tue, 07 Aug 2007)
New Revision: 2949
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelSynchronizer.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelValidatorDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/IValidator.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-643
Java comments where added
Typo mentione on JBoss Tools Forum is fixed
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-08-07 21:48:36 UTC (rev 2948)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-08-08 01:40:53 UTC (rev 2949)
@@ -313,13 +313,12 @@
protected IStatus run(IProgressMonitor monitor) {
IProject ear = WtpUtils.createEclipseProject(model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ear", monitor);
-
- try {
+ IProject ejb = WtpUtils.createEclipseProject(model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ejb", monitor); try {
FilterSet filterSet = new FilterSet();
filterSet.addFilter("projectName", project.getName());
- filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimename(project));
+ filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(project));
- IProject ejb = WtpUtils.createEclipseProject(model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ejb", monitor);
+
AntCopyUtils.copyFilesAndFolders(
new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ejb"),
@@ -362,7 +361,6 @@
new File(ejb.getLocation().toFile(),ejb.getName()+".launch"),
new FilterSetCollection(projectFilterSet), true);
- ejb.refreshLocal(IResource.DEPTH_INFINITE, monitor);
File earContentsFolder = new File(ear.getLocation().toFile(),"EarContent");
File earContentsMetaInfFolder = new File(earContentsFolder,"META-INF");
@@ -387,14 +385,17 @@
AntCopyUtils.copyFiles(seamGenResFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamGenResFolder)));
// Copy JDBC driver if there is any
- AntCopyUtils.copyFiles((String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH), earContentsFolder);
-
- ear.refreshLocal(IResource.DEPTH_INFINITE, monitor);
-
+ if(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH)!=null)
+ AntCopyUtils.copyFiles((String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH), earContentsFolder);
} catch (IOException e) {
SeamCorePlugin.getPluginLog().logError(e);
- } catch (CoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
+ } finally {
+ try {
+ ejb.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ ear.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ } catch(CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
}
return Status.OK_STATUS;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java 2007-08-07 21:48:36 UTC (rev 2948)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java 2007-08-08 01:40:53 UTC (rev 2949)
@@ -97,7 +97,7 @@
}
}
- public static String getServerRuntimename(IProject project) {
+ public static String getServerRuntimeName(IProject project) {
IJavaProject javaProject = JavaCore.create(project);
if(javaProject!=null) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelSynchronizer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelSynchronizer.java 2007-08-07 21:48:36 UTC (rev 2948)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelSynchronizer.java 2007-08-08 01:40:53 UTC (rev 2949)
@@ -19,31 +19,34 @@
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
/**
- *
+ * It is intended to collect all changes from Wizard Page and put it to
+ * IDataModel instance behind it.
* @author eskimo
*
*/
public class DataModelSynchronizer implements PropertyChangeListener {
/**
- *
+ * Target IDataModel instance
*/
protected IDataModel model;
/**
- *
+ * Map allows get particular IFieldEditor instance by its name.
+ * It is used by register(IFieldEditor) method.
*/
Map<String,IFieldEditor> editors = new HashMap<String,IFieldEditor>();
/**
*
- * @param model
+ * @param model is a target IDataModel instance
*/
public DataModelSynchronizer(IDataModel model) {
this.model = model;
}
/**
- *
+ * This class implements PropertyChangeListener interface from Java Beans
+ * API to receive property change events from registered IFieldEditors.
*/
public void propertyChange(PropertyChangeEvent evt) {
model.setProperty(evt.getPropertyName(), evt.getNewValue());
@@ -51,16 +54,17 @@
/**
*
- * @param name
- * @return
+ * @param name - name of property from IDataModel instance
+ * @return IFieldEditor used to edit property with given name
*/
public IFieldEditor getNamedElement(String name) {
return editors.get(name);
}
/**
- *
- * @param editor
+ * Registers a editor used to edit IDataModel property.
+ * The name of editor and model property should be the same.
+ * @param editor - instance of IFiedEditor placed on IWizardPage
*/
public void register(IFieldEditor editor) {
editors.put(editor.getName(), editor);
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelValidatorDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelValidatorDelegate.java 2007-08-07 21:48:36 UTC (rev 2948)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelValidatorDelegate.java 2007-08-08 01:40:53 UTC (rev 2949)
@@ -20,24 +20,27 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
/**
+ * Delegate class used during validation process in wizard dialog. It contains
+ * map from property name to IValidator instance. It is triggered by property
+ * change event from any registered property editor
+ *
* @author eskimo
*
*/
public class DataModelValidatorDelegate implements IDataModelListener {
/**
- *
+ * Target IDataModel instance
*/
protected IDataModel model = null;
-
/**
- *
+ * WizardPage instance that should be validated
*/
protected WizardPage page = null;
/**
- *
+ * Map from property name to IValidator instance
*/
protected Map<String,IValidator> mapPropToValidator = new HashMap<String,IValidator>();
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/IValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/IValidator.java 2007-08-07 21:48:36 UTC (rev 2948)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/IValidator.java 2007-08-08 01:40:53 UTC (rev 2949)
@@ -15,7 +15,7 @@
import org.eclipse.core.runtime.IAdaptable;
/**
- *
+ * Simple validator interface
* @author eskimo
*
*/
@@ -24,10 +24,10 @@
public static final String DEFAULT_ERROR = "default.error";
/**
- *
- * @param value
- * @param context
- * @return
+ * Method perform validation of given value against a provided context.
+ * @param value - an object that should be validated against context
+ * @param context - a contextual data that can be used during validation
+ * @return map from editor name to error text
*/
Map<String,String> validate(Object value, Object context);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-08-07 21:48:36 UTC (rev 2948)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-08-08 01:40:53 UTC (rev 2949)
@@ -7,7 +7,7 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.seam.ui.internal.project.facet;
import java.util.ArrayList;
@@ -51,108 +51,139 @@
/**
* @author eskimo
- *
+ *
*/
-public class SeamInstallWizardPage extends AbstractFacetWizardPage implements IFacetWizardPage, IDataModelListener{
+public class SeamInstallWizardPage extends AbstractFacetWizardPage implements
+ IFacetWizardPage, IDataModelListener {
/**
+ *
+ */
+ boolean seamHomeRequiresSave = SeamFacetPreference.getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER).equals("");
+ /**
*
*/
DriverClassHelpers HIBERNATE_HELPER = new DriverClassHelpers();
-
+
/**
*
*/
IDataModel model = null;
-
+
/**
*
*/
DataModelValidatorDelegate validatorDelegate;
-
- IFieldEditor jBossSeamHomeEditor = IFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
- ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
- "JBoss Seam Home Folder:",SeamFacetPreference.getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER));
- boolean seamHomeRequiresSave = SeamFacetPreference.getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER).equals("");
-
- IFieldEditor jBossAsDeployAsEditor = IFieldEditorFactory.INSTANCE.createComboEditor(
- ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
- "Deploy as:",Arrays.asList(new String[]{"war","ear"}),"war",false);
-
+ IFieldEditor jBossSeamHomeEditor = IFieldEditorFactory.INSTANCE
+ .createBrowseFolderEditor(
+ ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
+ "JBoss Seam Home Folder:",
+ SeamFacetPreference
+ .getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER));
+ IFieldEditor jBossAsDeployAsEditor = IFieldEditorFactory.INSTANCE
+ .createComboEditor(
+ ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
+ "Deploy as:", Arrays.asList(new String[] { "war", "ear" }),
+ "war", false);
+
String lastCreatedCPName = "";
-
+
// Database group
- IFieldEditor connProfileSelEditor = IFieldEditorFactory.INSTANCE.createComboWithTwoButtons(
- ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE, "Connection profile",
- getProfileNameList(), "", true,
- new EditConnectionProfileAction(),
- new NewConnectionProfileAction(),
- ValidatorFactory.NO_ERRORS_VALIDATOR);
- IFieldEditor jBossAsDbTypeEditor = IFieldEditorFactory.INSTANCE.createComboEditor(
- ISeamFacetDataModelProperties.DB_TYPE,
- "Database Type:",Arrays.asList(HIBERNATE_HELPER.getDialectNames()),"HSQL",true);
- IFieldEditor jBossHibernateDialectEditor = IFieldEditorFactory.INSTANCE.createUneditableTextEditor(
- ISeamFacetDataModelProperties.HIBERNATE_DIALECT,
- "Hibernate Dialect:",HIBERNATE_HELPER.getDialectClass("HSQL"));
-
- ITaggedFieldEditor jdbcDriverClassname = IFieldEditorFactory.INSTANCE.createComboEditor(
- ISeamFacetDataModelProperties.JDBC_DRIVER_CLASS_NAME,
- "JDBC Driver Class for Your Database:",Arrays.asList(HIBERNATE_HELPER.getDriverClasses(HIBERNATE_HELPER.getDialectClass("HSQL"))),HIBERNATE_HELPER.getDriverClasses(HIBERNATE_HELPER.getDialectClass("HSQL"))[0]);
- ITaggedFieldEditor jdbcUrlForDb = IFieldEditorFactory.INSTANCE.createComboEditor(
- ISeamFacetDataModelProperties.JDBC_URL_FOR_DB,
- "JDBC Url for Your Database:",
- Arrays.asList(HIBERNATE_HELPER.getConnectionURLS(HIBERNATE_HELPER.getDriverClasses(
- HIBERNATE_HELPER.getDialectClass("HSQL"))[0])),
- HIBERNATE_HELPER.getConnectionURLS(HIBERNATE_HELPER.getDriverClasses(HIBERNATE_HELPER.getDialectClass("HSQL"))[0])[0].replace("<", "").replace(">", ""));
+ IFieldEditor connProfileSelEditor = IFieldEditorFactory.INSTANCE
+ .createComboWithTwoButtons(
+ ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
+ "Connection profile", getProfileNameList(), "", true,
+ new EditConnectionProfileAction(),
+ new NewConnectionProfileAction(),
+ ValidatorFactory.NO_ERRORS_VALIDATOR);
+ IFieldEditor jBossAsDbTypeEditor = IFieldEditorFactory.INSTANCE
+ .createComboEditor(ISeamFacetDataModelProperties.DB_TYPE,
+ "Database Type:", Arrays.asList(HIBERNATE_HELPER
+ .getDialectNames()), "HSQL", true);
+ IFieldEditor jBossHibernateDialectEditor = IFieldEditorFactory.INSTANCE
+ .createUneditableTextEditor(
+ ISeamFacetDataModelProperties.HIBERNATE_DIALECT,
+ "Hibernate Dialect:", HIBERNATE_HELPER
+ .getDialectClass("HSQL"));
+
+ ITaggedFieldEditor jdbcDriverClassname = IFieldEditorFactory.INSTANCE
+ .createComboEditor(
+ ISeamFacetDataModelProperties.JDBC_DRIVER_CLASS_NAME,
+ "JDBC Driver Class for Your Database:", Arrays
+ .asList(HIBERNATE_HELPER
+ .getDriverClasses(HIBERNATE_HELPER
+ .getDialectClass("HSQL"))),
+ HIBERNATE_HELPER.getDriverClasses(HIBERNATE_HELPER
+ .getDialectClass("HSQL"))[0]);
+ ITaggedFieldEditor jdbcUrlForDb = IFieldEditorFactory.INSTANCE
+ .createComboEditor(ISeamFacetDataModelProperties.JDBC_URL_FOR_DB,
+ "JDBC Url for Your Database:",
+ Arrays.asList(HIBERNATE_HELPER
+ .getConnectionURLS(HIBERNATE_HELPER
+ .getDriverClasses(HIBERNATE_HELPER
+ .getDialectClass("HSQL"))[0])),
+ HIBERNATE_HELPER.getConnectionURLS(HIBERNATE_HELPER
+ .getDriverClasses(HIBERNATE_HELPER
+ .getDialectClass("HSQL"))[0])[0].replace(
+ "<", "").replace(">", ""));
IFieldEditor dbUserName = IFieldEditorFactory.INSTANCE.createTextEditor(
- ISeamFacetDataModelProperties.DB_USER_NAME,
- "Database User Name:", "username");
- IFieldEditor dbUserPassword = IFieldEditorFactory.INSTANCE.createTextEditor(
- ISeamFacetDataModelProperties.DB_USERP_PASSWORD,
- "User Password:", "password");
+ ISeamFacetDataModelProperties.DB_USER_NAME, "Database User Name:",
+ "username");
+ IFieldEditor dbUserPassword = IFieldEditorFactory.INSTANCE
+ .createTextEditor(ISeamFacetDataModelProperties.DB_USERP_PASSWORD,
+ "User Password:", "password");
IFieldEditor dbSchemaName = IFieldEditorFactory.INSTANCE.createTextEditor(
- ISeamFacetDataModelProperties.DB_SCHEMA_NAME,
+ ISeamFacetDataModelProperties.DB_SCHEMA_NAME,
"Database Schema Name:", "");
IFieldEditor dbCatalogName = IFieldEditorFactory.INSTANCE.createTextEditor(
- ISeamFacetDataModelProperties.DB_CATALOG_NAME,
+ ISeamFacetDataModelProperties.DB_CATALOG_NAME,
"Database Catalog Name:", "");
- IFieldEditor dbTablesExists = IFieldEditorFactory.INSTANCE.createCheckboxEditor(
- ISeamFacetDataModelProperties. DB_ALREADY_EXISTS,
- "DB Tables already exists in database:", false);
- IFieldEditor recreateTablesOnDeploy = IFieldEditorFactory.INSTANCE.createCheckboxEditor(
- ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY,
- "Recreate database tables and data on deploy:", false);
- IFieldEditor pathToJdbcDriverJar = IFieldEditorFactory.INSTANCE.createBrowseFileEditor(
- ISeamFacetDataModelProperties. JDBC_DRIVER_JAR_PATH,
- "JDBC Driver jar:", "");
-
+ IFieldEditor dbTablesExists = IFieldEditorFactory.INSTANCE
+ .createCheckboxEditor(
+ ISeamFacetDataModelProperties.DB_ALREADY_EXISTS,
+ "DB Tables already exists in database:", false);
+ IFieldEditor recreateTablesOnDeploy = IFieldEditorFactory.INSTANCE
+ .createCheckboxEditor(
+ ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY,
+ "Recreate database tables and data on deploy:", false);
+ IFieldEditor pathToJdbcDriverJar = IFieldEditorFactory.INSTANCE
+ .createBrowseFileEditor(
+ ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH,
+ "JDBC Driver jar:", "");
+
// Code generation group
- IFieldEditor sessionBeanPkgNameditor = IFieldEditorFactory.INSTANCE.createTextEditor(
- ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME,
- "Session Bean Package Name:","");
- IFieldEditor entityBeanPkgNameditor = IFieldEditorFactory.INSTANCE.createTextEditor(
- ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME,
- "Entity Bean Package Name:","com.mydomain.projectname.entity");
- IFieldEditor testsPkgNameditor = IFieldEditorFactory.INSTANCE.createTextEditor(
- ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME,
- "Session Bean Package Name:","com.mydomain.projectname.test");
-
+ IFieldEditor sessionBeanPkgNameditor = IFieldEditorFactory.INSTANCE
+ .createTextEditor(
+ ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME,
+ "Session Bean Package Name:", "");
+ IFieldEditor entityBeanPkgNameditor = IFieldEditorFactory.INSTANCE
+ .createTextEditor(
+ ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME,
+ "Entity Bean Package Name:",
+ "com.mydomain.projectname.entity");
+ IFieldEditor testsPkgNameditor = IFieldEditorFactory.INSTANCE
+ .createTextEditor(
+ ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME,
+ "Test Package Name:",
+ "com.mydomain.projectname.test");
+
/**
*
*/
public SeamInstallWizardPage() {
super("Seam Facet");
setTitle("Seam Facet");
- setImageDescriptor(ImageDescriptor.createFromFile(SeamFormWizard.class, "SeamWebProjectWizBan.png"));
+ setImageDescriptor(ImageDescriptor.createFromFile(SeamFormWizard.class,
+ "SeamWebProjectWizBan.png"));
setDescription("Configure Seam Facest Settings");
}
-
+
/**
*
*/
private DataModelSynchronizer sync;
-
+
/**
*
*/
@@ -160,17 +191,16 @@
public void setWizard(IWizard newWizard) {
super.setWizard(newWizard);
}
-
+
/**
*
*/
public void setConfig(Object config) {
- model = (IDataModel)config;
+ model = (IDataModel) config;
sync = new DataModelSynchronizer(model);
- validatorDelegate = new DataModelValidatorDelegate(model,this);
model.addListener(this);
}
-
+
/**
* Finish has been pressed.
*/
@@ -183,81 +213,81 @@
/**
- *
+ * Registers editor in data synchronizer and put SWT controls for it at
+ * wizard page.
* @param editor
* @param parent
* @param columns
*/
- public void registerEditor(IFieldEditor editor,Composite parent,int columns) {
+ protected void registerEditor(IFieldEditor editor, Composite parent,
+ int columns) {
sync.register(editor);
editor.doFillIntoGrid(parent);
}
-
+
/**
- *
+ * Creates Seam Facet Wizard Page contents
*/
public void createControl(Composite parent) {
initializeDialogUnits(parent);
-
+
Composite root = new Composite(parent, SWT.NONE);
GridData gd = new GridData();
-
- gd.horizontalSpan = 1;
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = false;
+ gd.horizontalSpan = 1;
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ gd.grabExcessVerticalSpace = false;
+
GridLayout gridLayout = new GridLayout(1, false);
root.setLayout(gridLayout);
- Group generalGroup = new Group(root,SWT.NONE);
+ Group generalGroup = new Group(root, SWT.NONE);
generalGroup.setLayoutData(gd);
generalGroup.setText("General");
gridLayout = new GridLayout(3, false);
-
+
generalGroup.setLayout(gridLayout);
- registerEditor(jBossSeamHomeEditor,generalGroup, 3);
- registerEditor(jBossAsDeployAsEditor,generalGroup, 3);
-
+ registerEditor(jBossSeamHomeEditor, generalGroup, 3);
+ registerEditor(jBossAsDeployAsEditor, generalGroup, 3);
+
gd = new GridData();
- gd.horizontalSpan = 1;
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = false;
-
- Group databaseGroup = new Group(root,SWT.NONE);
+ gd.horizontalSpan = 1;
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ gd.grabExcessVerticalSpace = false;
+
+ Group databaseGroup = new Group(root, SWT.NONE);
databaseGroup.setLayoutData(gd);
databaseGroup.setText("Database");
gridLayout = new GridLayout(4, false);
databaseGroup.setLayout(gridLayout);
- registerEditor(jBossAsDbTypeEditor,databaseGroup, 4);
- registerEditor(jBossHibernateDialectEditor,databaseGroup, 4);
- registerEditor(connProfileSelEditor,databaseGroup,4);
- registerEditor(dbSchemaName,databaseGroup, 4);
- registerEditor(dbCatalogName,databaseGroup, 4);
- registerEditor(dbTablesExists,databaseGroup, 4);
- registerEditor(recreateTablesOnDeploy,databaseGroup, 4);
- //registerEditor(pathToJdbcDriverJar,databaseGroup, 4);
+ registerEditor(jBossAsDbTypeEditor, databaseGroup, 4);
+ registerEditor(jBossHibernateDialectEditor, databaseGroup, 4);
+ registerEditor(connProfileSelEditor, databaseGroup, 4);
+ registerEditor(dbSchemaName, databaseGroup, 4);
+ registerEditor(dbCatalogName, databaseGroup, 4);
+ registerEditor(dbTablesExists, databaseGroup, 4);
+ registerEditor(recreateTablesOnDeploy, databaseGroup, 4);
+ // registerEditor(pathToJdbcDriverJar,databaseGroup, 4);
- Group generationGroup = new Group(root,SWT.NONE);
+ Group generationGroup = new Group(root, SWT.NONE);
gd = new GridData();
- gd.horizontalSpan = 1;
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = false;
-
+ gd.horizontalSpan = 1;
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ gd.grabExcessVerticalSpace = false;
+
generationGroup.setLayoutData(gd);
generationGroup.setText("Code Generation");
gridLayout = new GridLayout(3, false);
generationGroup.setLayout(gridLayout);
- registerEditor(sessionBeanPkgNameditor,generationGroup, 3);
- registerEditor(entityBeanPkgNameditor,generationGroup, 3);
- registerEditor(testsPkgNameditor,generationGroup, 3);
-
+ registerEditor(sessionBeanPkgNameditor, generationGroup, 3);
+ registerEditor(entityBeanPkgNameditor, generationGroup, 3);
+ registerEditor(testsPkgNameditor, generationGroup, 3);
+
setControl(root);
-
- validatorDelegate.addValidatorForProperty(jBossSeamHomeEditor.getName(), ValidatorFactory.JBOSS_SEAM_HOME_FOLDER_VALIDATOR);
- validatorDelegate.addValidatorForProperty(pathToJdbcDriverJar.getName(), ValidatorFactory.FILESYSTEM_FILE_EXISTS_VALIDATOR);
- validatorDelegate.addValidatorForProperty(connProfileSelEditor.getName(),ValidatorFactory.CONNECTION_PROFILE_IS_NOT_SELECTED);
+
+
setMessage(null);
setErrorMessage(null);
}
@@ -266,27 +296,32 @@
*
*/
public void propertyChanged(DataModelEvent event) {
- if(event.getPropertyName().equals(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER)) {
- model.setStringProperty(ISeamFacetDataModelProperties.WEB_CONTENTS_FOLDER, event.getProperty()
- .toString());
- } if (event.getPropertyName().equals(ISeamFacetDataModelProperties.DB_TYPE)) {
-
+ if (event.getPropertyName().equals(
+ IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER)) {
+ model.setStringProperty(
+ ISeamFacetDataModelProperties.WEB_CONTENTS_FOLDER, event
+ .getProperty().toString());
}
+ if (event.getPropertyName().equals(
+ ISeamFacetDataModelProperties.DB_TYPE)) {
+
+ }
}
-
- // Utils method
+ // Utils method
private List<String> getProfileNameList() {
- IConnectionProfile[] profiles = ProfileManager.getInstance().getProfilesByCategory(ProfileSelectionComposite.JDBC_CATEGORY);
+ IConnectionProfile[] profiles = ProfileManager.getInstance()
+ .getProfilesByCategory(ProfileSelectionComposite.JDBC_CATEGORY);
List<String> names = new ArrayList<String>();
for (IConnectionProfile connectionProfile : profiles) {
names.add(connectionProfile.getName());
}
return names;
}
-
- public class EditConnectionProfileAction extends ButtonFieldEditor.ButtonPressedAction {
-
+
+ public class EditConnectionProfileAction extends
+ ButtonFieldEditor.ButtonPressedAction {
+
/**
* @param label
*/
@@ -296,22 +331,37 @@
@Override
public void run() {
- IConnectionProfile selectedProfile = ProfileManager.getInstance().getProfileByName(getFieldEditor().getValue().toString());
+ IConnectionProfile selectedProfile = ProfileManager.getInstance()
+ .getProfileByName(getFieldEditor().getValue().toString());
String oldName = getFieldEditor().getValue().toString();
- if(selectedProfile==null) return;
- PropertyDialog.createDialogOn(Display.getCurrent().getActiveShell(),
- "org.eclipse.datatools.connectivity.db.generic.profileProperties", selectedProfile).open();
-
- if(!oldName.equals(selectedProfile.getName())) {
+ if (selectedProfile == null)
+ return;
+ PropertyDialog
+ .createDialogOn(
+ Display.getCurrent().getActiveShell(),
+ "org.eclipse.datatools.connectivity.db.generic.profileProperties",
+ selectedProfile).open();
+
+ if (!oldName.equals(selectedProfile.getName())) {
getFieldEditor().setValue(selectedProfile.getName());
- ((ITaggedFieldEditor)((CompositeEditor)connProfileSelEditor).getEditors().get(1)).setTags(getProfileNameList().toArray(new String[0]));
+ ((ITaggedFieldEditor) ((CompositeEditor) connProfileSelEditor)
+ .getEditors().get(1)).setTags(getProfileNameList()
+ .toArray(new String[0]));
oldName = selectedProfile.getName();
}
}
};
-
- public class NewConnectionProfileAction extends ButtonFieldEditor.ButtonPressedAction {
+
+ /**
+ * Handler for ButtonFieldEditor that shows Property Editor dialog for
+ * selected ConnectionProfile
+ *
+ * @author eskimo
+ *
+ */
+ public class NewConnectionProfileAction extends
+ ButtonFieldEditor.ButtonPressedAction {
/**
* @param label
*/
@@ -322,46 +372,81 @@
@Override
public void run() {
NewConnectionProfileWizard wizard = new NewConnectionProfileWizard() {
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.datatools.connectivity.ui.wizards.NewConnectionProfileWizard#performFinish()
*/
@Override
public boolean performFinish() {
- // create profile only
+ // create profile only
try {
ProfileManager.getInstance().createProfile(
- getProfileName()==null?"":getProfileName(),
- getProfileDescription()==null?"":getProfileDescription(),
+ getProfileName() == null ? ""
+ : getProfileName(),
+ getProfileDescription() == null ? ""
+ : getProfileDescription(),
mProviderID,
- getProfileProperties(),
- mProfilePage.getRepository()==null?"":mProfilePage.getRepository().getName(),
- false);
+ getProfileProperties(),
+ mProfilePage.getRepository() == null ? ""
+ : mProfilePage.getRepository()
+ .getName(), false);
lastCreatedCPName = getProfileName();
} catch (ConnectionProfileException e) {
SeamCorePlugin.getPluginLog().logError(e);
}
-
+
return true;
- }};
- wizard.initProviderID(IDBConnectionProfileConstants.CONNECTION_PROFILE_ID);
- WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(),wizard);
+ }
+ };
+ wizard
+ .initProviderID(IDBConnectionProfileConstants.CONNECTION_PROFILE_ID);
+ WizardDialog wizardDialog = new WizardDialog(Display.getCurrent()
+ .getActiveShell(), wizard);
wizardDialog.open();
-
- if(wizardDialog.getReturnCode() != WizardDialog.CANCEL) {
+
+ if (wizardDialog.getReturnCode() != WizardDialog.CANCEL) {
getFieldEditor().setValue(lastCreatedCPName);
- ((ITaggedFieldEditor)((CompositeEditor)connProfileSelEditor).getEditors().get(1)).setTags(getProfileNameList().toArray(new String[0]));
+ ((ITaggedFieldEditor) ((CompositeEditor) connProfileSelEditor)
+ .getEditors().get(1)).setTags(getProfileNameList()
+ .toArray(new String[0]));
}
}
}
+ /**
+ * It is overridden to fill Code Generation group with the default package
+ * names
+ */
@Override
public void setVisible(boolean visible) {
- NewProjectDataModelFacetWizard wizard = (NewProjectDataModelFacetWizard)getWizard();
+ NewProjectDataModelFacetWizard wizard = (NewProjectDataModelFacetWizard) getWizard();
+
IDataModel model = wizard.getDataModel();
- sessionBeanPkgNameditor.setValue("org.domain."+model.getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME)+".session");
- entityBeanPkgNameditor.setValue("org.domain."+model.getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME)+".entity");
- testsPkgNameditor.setValue("org.domain."+model.getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME)+".test");
+ sessionBeanPkgNameditor
+ .setValue("org.domain."
+ + model
+ .getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME)
+ + ".session");
+ entityBeanPkgNameditor
+ .setValue("org.domain."
+ + model
+ .getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME)
+ + ".entity");
+ testsPkgNameditor
+ .setValue("org.domain."
+ + model
+ .getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME)
+ + ".test");
+
+ validatorDelegate = new DataModelValidatorDelegate(model, this);
+ validatorDelegate.addValidatorForProperty(
+ jBossSeamHomeEditor.getName(),
+ ValidatorFactory.JBOSS_SEAM_HOME_FOLDER_VALIDATOR);
+ validatorDelegate
+ .addValidatorForProperty(connProfileSelEditor.getName(),
+ ValidatorFactory.CONNECTION_PROFILE_IS_NOT_SELECTED);
super.setVisible(visible);
};
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2007-08-07 21:48:36 UTC (rev 2948)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2007-08-08 01:40:53 UTC (rev 2949)
@@ -7,7 +7,7 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.seam.ui.internal.project.facet;
import java.io.File;
@@ -38,22 +38,21 @@
/**
*
* @author eskimo
- *
+ *
*/
public class ValidatorFactory {
-
-
-
+
/**
*
*/
- static public Map<String,IValidator> validators = new HashMap<String, IValidator>();
-
+ static public Map<String, IValidator> validators = new HashMap<String, IValidator>();
+
/**
*
*/
- static public Map<String,String> NO_ERRORS = Collections.unmodifiableMap(new HashMap<String,String>());
-
+ static public Map<String, String> NO_ERRORS = Collections
+ .unmodifiableMap(new HashMap<String, String>());
+
/**
*
*/
@@ -63,7 +62,7 @@
return NO_ERRORS;
}
};
-
+
/**
*
* @param id
@@ -71,174 +70,186 @@
*/
public static IValidator getValidator(String id) {
IValidator validator = validators.get(id);
- return validator==null?NO_ERRORS_VALIDATOR:validator;
+ return validator == null ? NO_ERRORS_VALIDATOR : validator;
}
-
+
/**
*
* @return
*/
- public static Map<String,String> createErrorMap() {
- return new HashMap<String,String>();
+ public static Map<String, String> createErrorMap() {
+ return new HashMap<String, String>();
}
-
+
/**
*
* @param text
* @return
*/
- public static Map<String,String> createErrormessage(String text) {
- Map<String,String> map = createErrorMap();
+ public static Map<String, String> createErrormessage(String text) {
+ Map<String, String> map = createErrorMap();
map.put(IValidator.DEFAULT_ERROR, text);
return map;
}
-
+
/**
*
*/
public static final IValidator FILE_SYSTEM_FOLDER_EXISTS = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
- if(value == null)
- throw new IllegalArgumentException("Path to a folder cannot be null");
+ if (value == null)
+ throw new IllegalArgumentException(
+ "Path to a folder cannot be null");
String folderPath = value.toString();
File folder = new File(folderPath);
if (!folder.exists())
- return createErrormessage("Folder '" + folderPath +"' doesn't exists");
- if(!folder.isDirectory())
- return createErrormessage("Path '" + folderPath +"' points to file");
+ return createErrormessage("Folder '" + folderPath
+ + "' doesn't exists");
+ if (!folder.isDirectory())
+ return createErrormessage("Path '" + folderPath
+ + "' points to file");
return NO_ERRORS;
}
-
+
};
-
+
/**
*
*/
public static IValidator JBOSS_SEAM_HOME_FOLDER_VALIDATOR = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
- Map<String,String> errors = FILE_SYSTEM_FOLDER_EXISTS.validate(value, context);
- if(errors.size()>0) {
+ Map<String, String> errors = FILE_SYSTEM_FOLDER_EXISTS.validate(
+ value, context);
+ if (errors.size() > 0) {
errors = createErrorMap();
- errors.put(
- ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
- "Seam Home folder doesn't exist"
- );
+ errors.put(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
+ "Seam Home folder doesn't exist");
return errors;
}
- if(!new File(value.toString(),"seam").isFile()) {
- errors = createErrormessage(
- "Seam Home Folde field points to location that doesn't look like seam home folder");
-
+ if (!new File(value.toString(), "seam").isFile()) {
+ errors = createErrormessage("Seam Home Folde field points to location that doesn't look like seam home folder");
+
}
return errors;
}
};
-
+
/**
*
*/
public static IValidator JBOSS_AS_HOME_FOLDER_VALIDATOR = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
- Map<String,String> errors = FILE_SYSTEM_FOLDER_EXISTS.validate(value, context);
- if(errors.size()>0) {
+ Map<String, String> errors = FILE_SYSTEM_FOLDER_EXISTS.validate(
+ value, context);
+ if (errors.size() > 0) {
errors = createErrorMap();
- errors.put(
- ISeamFacetDataModelProperties.JBOSS_AS_HOME,
- "JBoss AS Home folder doesn't exist"
- );
+ errors.put(ISeamFacetDataModelProperties.JBOSS_AS_HOME,
+ "JBoss AS Home folder doesn't exist");
return errors;
}
- if(!new File(value.toString(),"bin/twiddle.jar").isFile()) {
- errors.put(
- ISeamFacetDataModelProperties.JBOSS_AS_HOME,
- "JBoss AS Home Folde field points to location that doesn't look like JBoss AS home folder");
+ if (!new File(value.toString(), "bin/twiddle.jar").isFile()) {
+ errors
+ .put(
+ ISeamFacetDataModelProperties.JBOSS_AS_HOME,
+ "JBoss AS Home Folde field points to location that doesn't look like JBoss AS home folder");
}
return errors;
}
};
-
+
/**
*
*/
public static IValidator CLASS_QNAME_VALIDATOR = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
String classDecl = "class " + value.toString() + " {}";
- ASTParser parser= ASTParser.newParser(AST.JLS3);
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(classDecl.toCharArray());
- parser.setProject((IJavaProject)context);
- CompilationUnit compilationUnit= (CompilationUnit) parser.createAST(null);
- IProblem[] problems= compilationUnit.getProblems();
+ parser.setProject((IJavaProject) context);
+ CompilationUnit compilationUnit = (CompilationUnit) parser
+ .createAST(null);
+ IProblem[] problems = compilationUnit.getProblems();
if (problems.length > 0) {
- return createErrormessage(Messages.format("Component name is not invalid.", problems[0].getMessage()));
- }
+ return createErrormessage(Messages.format(
+ "Component name is not invalid.", problems[0]
+ .getMessage()));
+ }
return ValidatorFactory.NO_ERRORS;
}
};
-
+
/**
*
*/
public static IValidator FILESYSTEM_FILE_EXISTS_VALIDATOR = new IValidator() {
- public java.util.Map<String,String> validate(Object value, Object context) {
+ public java.util.Map<String, String> validate(Object value,
+ Object context) {
return ValidatorFactory.NO_ERRORS;
};
};
/**
*
* @author eskimo
- *
+ *
*/
public static IValidator SEAM_COMPONENT_NAME_VALIDATOR = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
String targetName = null;
IProject project = null;
- if(context instanceof Object[]) {
- Object[] contextArray = ((Object[])context);
+ if (context instanceof Object[]) {
+ Object[] contextArray = ((Object[]) context);
targetName = contextArray[0].toString();
- project = (IProject)contextArray[1];
+ project = (IProject) contextArray[1];
}
-
- // to allow qualified names for component use import statement as target
- String classDecl = "import " + value.toString() +"; class Dummy {}";
- ASTParser parser= ASTParser.newParser(AST.JLS3);
+
+ // to allow qualified names for component use import statement as
+ // target
+ String classDecl = "import " + value.toString()
+ + "; class Dummy {}";
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(classDecl.toCharArray());
parser.setProject(JavaCore.create(project));
- CompilationUnit compilationUnit= (CompilationUnit) parser.createAST(null);
- IProblem[] problems= compilationUnit.getProblems();
-
+ CompilationUnit compilationUnit = (CompilationUnit) parser
+ .createAST(null);
+ IProblem[] problems = compilationUnit.getProblems();
+
if (problems.length > 0) {
return createErrormessage(targetName + " name is not valid.");
- }
-
+ }
+
return NO_ERRORS;
}
};
-
+
/**
*
* @author eskimo
- *
+ *
*/
public static IValidator SEAM_JAVA_INTEFACE_NAME_CONVENTION_VALIDATOR = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
String targetName = null;
IProject project = null;
- if(context instanceof Object[]) {
- Object[] contextArray = ((Object[])context);
+ if (context instanceof Object[]) {
+ Object[] contextArray = ((Object[]) context);
targetName = contextArray[0].toString();
- project = (IProject)contextArray[1];
+ project = (IProject) contextArray[1];
}
IJavaProject jProject = JavaCore.create(project);
-
- String sourceLevel= jProject.getOption(JavaCore.COMPILER_SOURCE, true);
- String compliance= jProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
- IStatus status = JavaConventions.validateJavaTypeName(value.toString(), sourceLevel, compliance);
- if(status.getSeverity() == IStatus.WARNING) {
- return createErrormessage("Local Interface name is not valid.\n" + status.getMessage());
+
+ String sourceLevel = jProject.getOption(JavaCore.COMPILER_SOURCE,
+ true);
+ String compliance = jProject.getOption(
+ JavaCore.COMPILER_COMPLIANCE, true);
+ IStatus status = JavaConventions.validateJavaTypeName(value
+ .toString(), sourceLevel, compliance);
+ if (status.getSeverity() == IStatus.WARNING) {
+ return createErrormessage("Local Interface name is not valid.\n"
+ + status.getMessage());
}
return NO_ERRORS;
}
@@ -249,24 +260,26 @@
public Map<String, String> validate(Object value, Object context) {
String targetName = null;
IProject project = null;
-
- if(context instanceof Object[]) {
- Object[] contextArray = ((Object[])context);
+
+ if (context instanceof Object[]) {
+ Object[] contextArray = ((Object[]) context);
targetName = contextArray[0].toString();
- project = (IProject)contextArray[1];
+ project = (IProject) contextArray[1];
}
-
- String classDecl = "class ClassName {public void " + value.toString() + "() {}}";
- ASTParser parser= ASTParser.newParser(AST.JLS3);
+
+ String classDecl = "class ClassName {public void "
+ + value.toString() + "() {}}";
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(classDecl.toCharArray());
parser.setProject(JavaCore.create(project));
- CompilationUnit compilationUnit= (CompilationUnit) parser.createAST(null);
- IProblem[] problems= compilationUnit.getProblems();
-
+ CompilationUnit compilationUnit = (CompilationUnit) parser
+ .createAST(null);
+ IProblem[] problems = compilationUnit.getProblems();
+
if (problems.length > 0) {
return createErrormessage(targetName + " name is not valid.");
- }
-
+ }
+
return NO_ERRORS;
}
};
@@ -276,15 +289,16 @@
public Map<String, String> validate(Object value, Object context) {
String targetName = null;
IProject project = null;
-
- if(context instanceof Object[]) {
- Object[] contextArray = ((Object[])context);
+
+ if (context instanceof Object[]) {
+ Object[] contextArray = ((Object[]) context);
targetName = contextArray[0].toString();
- project = (IProject)contextArray[1];
+ project = (IProject) contextArray[1];
}
- if("".equals(value) || !project.getLocation().isValidSegment(value.toString()))
- return createErrormessage(targetName + " name is not valid.");
-
+ if ("".equals(value)
+ || !project.getLocation().isValidSegment(value.toString()))
+ return createErrormessage(targetName + " name is not valid.");
+
return NO_ERRORS;
}
};
@@ -292,14 +306,18 @@
public static IValidator SEAM_PROJECT_NAME_VALIDATOR = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
- IResource project = ResourcesPlugin.getWorkspace().getRoot().findMember(value.toString());
-
- if(project==null || !(project instanceof IProject) || !project.exists()) {
- return createErrormessage("Project '" + value + "' does'n exist.");
+ IResource project = ResourcesPlugin.getWorkspace().getRoot()
+ .findMember(value.toString());
+
+ if (project == null || !(project instanceof IProject)
+ || !project.exists()) {
+ return createErrormessage("Project '" + value
+ + "' does'n exist.");
} else {
try {
- if(!((IProject)project).hasNature(ISeamProject.NATURE_ID)) {
- return createErrormessage("Project '" + project.getName()+ "' has no Seam nature.");
+ if (!((IProject) project).hasNature(ISeamProject.NATURE_ID)) {
+ return createErrormessage("Project '"
+ + project.getName() + "' has no Seam nature.");
}
} catch (CoreException e) {
SeamCorePlugin.getPluginLog().logError(e);
@@ -311,7 +329,7 @@
public static IValidator CONNECTION_PROFILE_IS_NOT_SELECTED = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
- if(value==null || "".equals(value.toString().trim())) {
+ if (value == null || "".equals(value.toString().trim())) {
return createErrormessage("Connection profile is not selected.");
}
return NO_ERRORS;
18 years, 4 months
JBoss Tools SVN: r2948 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-08-07 17:48:36 -0400 (Tue, 07 Aug 2007)
New Revision: 2948
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
Log:
JBIDE-659 added some tiny logic to save the seam home.
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-08-07 20:46:36 UTC (rev 2947)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-08-07 21:48:36 UTC (rev 2948)
@@ -74,6 +74,8 @@
IFieldEditor jBossSeamHomeEditor = IFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
"JBoss Seam Home Folder:",SeamFacetPreference.getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER));
+ boolean seamHomeRequiresSave = SeamFacetPreference.getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER).equals("");
+
IFieldEditor jBossAsDeployAsEditor = IFieldEditorFactory.INSTANCE.createComboEditor(
ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
"Deploy as:",Arrays.asList(new String[]{"war","ear"}),"war",false);
@@ -170,11 +172,15 @@
}
/**
- *
+ * Finish has been pressed.
*/
public void transferStateToConfig() {
+ if( seamHomeRequiresSave) {
+ SeamCorePlugin.getDefault().getPluginPreferences().setValue(
+ SeamFacetPreference.SEAM_HOME_FOLDER, jBossSeamHomeEditor.getValueAsString());
+ }
+ }
- }
/**
*
18 years, 4 months
JBoss Tools SVN: r2947 - trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-08-07 16:46:36 -0400 (Tue, 07 Aug 2007)
New Revision: 2947
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ProjectRuntimeClasspathProvider.java
Log:
libraries moved to classpath.core
adds more libraries than needed now by default.
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java 2007-08-07 20:46:36 UTC (rev 2947)
@@ -0,0 +1,85 @@
+package org.jboss.ide.eclipse.as.classpath.core.runtime;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate;
+import org.eclipse.wst.server.core.IRuntime;
+import org.jboss.ide.eclipse.as.core.runtime.server.AbstractJBossServerRuntime;
+
+public class ClientAllRuntimeClasspathProvider extends
+ RuntimeClasspathProviderDelegate {
+
+ public ClientAllRuntimeClasspathProvider() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public IClasspathEntry[] resolveClasspathContainer(IProject project, IRuntime runtime) {
+ AbstractJBossServerRuntime ajbsrt = (AbstractJBossServerRuntime)runtime.loadAdapter(AbstractJBossServerRuntime.class, new NullProgressMonitor());
+ IPath loc = runtime.getLocation();
+ String config = ajbsrt.getJBossConfiguration();
+ if( runtime.getRuntimeType().getId().endsWith("32")) {
+ return get32(loc, config);
+ } else if( runtime.getRuntimeType().getId().endsWith("40")) {
+ return get40(loc, config);
+ } else if( runtime.getRuntimeType().getId().endsWith("42")) {
+ return get42(loc, config);
+ }
+ return null;
+ }
+
+ protected IClasspathEntry[] get32(IPath location, String config) {
+ ArrayList list = new ArrayList();
+ IPath configPath = location.append("server").append("config");
+ addEntries(location.append("client"), list);
+ addEntries(location.append("lib"), list);
+ addEntries(configPath.append("lib"), list);
+ return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
+ }
+
+ protected IClasspathEntry[] get40(IPath location, String config) {
+ ArrayList list = new ArrayList();
+ IPath configPath = location.append("server").append("config");
+ IPath deployPath = location.append("deploy");
+ addEntries(location.append("client"), list);
+ addEntries(location.append("lib"), list);
+ addEntries(configPath.append("lib"), list);
+ addEntries(deployPath.append("jboss-web.deployer").append("jsf-libs"), list);
+ addEntries(deployPath.append("jboss-aop-jdk50.deployer"), list);
+ addEntries(deployPath.append("ejb3.deployer"), list);
+ return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
+ }
+
+ protected IClasspathEntry[] get42(IPath location, String config) {
+ ArrayList list = new ArrayList();
+ IPath configPath = location.append("server").append("config");
+ IPath deployPath = location.append("deploy");
+ addEntries(location.append("client"), list);
+ addEntries(location.append("lib"), list);
+ addEntries(configPath.append("lib"), list);
+ addEntries(deployPath.append("jboss-web.deployer").append("jsf-libs"), list);
+ addEntries(deployPath.append("jboss-aop-jdk50.deployer"), list);
+ addEntries(deployPath.append("ejb3.deployer"), list);
+ return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
+ }
+
+
+ protected IClasspathEntry getEntry(IPath path) {
+ return JavaRuntime.newArchiveRuntimeClasspathEntry(path).getClasspathEntry();
+ }
+ protected void addEntries(IPath folder, ArrayList list) {
+ if( folder.toFile().exists()) {
+ String[] files = folder.toFile().list();
+ for( int i = 0; i < files.length; i++ ) {
+ if( files[i].endsWith(".jar")) {
+ list.add(getEntry(folder.append(files[i])));
+ }
+ }
+ }
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ProjectRuntimeClasspathProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ProjectRuntimeClasspathProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ProjectRuntimeClasspathProvider.java 2007-08-07 20:46:36 UTC (rev 2947)
@@ -0,0 +1,132 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.classpath.core.runtime;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.ClasspathContainerInitializer;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.common.project.facet.core.IClasspathProvider;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.classpath.core.runtime.WebtoolsProjectJBossClasspathContainerInitializer.WebtoolsProjectJBossClasspathContainer;
+
+/**
+ * This class acts as a front to add whatever entries are available
+ * in the client all runtime classpath provider, unless it's
+ * a java facet being added in which case it does the right thing.
+ * @author rob
+ *
+ */
+public class ProjectRuntimeClasspathProvider implements IClasspathProvider {
+ private IRuntimeComponent rc;
+
+ public ProjectRuntimeClasspathProvider() {
+ }
+
+ public ProjectRuntimeClasspathProvider(final IRuntimeComponent rc) {
+ this.rc = rc;
+ }
+
+ public List getClasspathEntries(final IProjectFacetVersion fv) {
+ IPath path;
+ if( fv.getProjectFacet().getId().equals("jst.java") ) {
+ path = new Path("org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectInitializer");
+ path = path.append(rc.getProperty("id"));
+ path = path.append(fv.getProjectFacet().getId());
+ path = path.append(fv.getVersionString());
+ IClasspathEntry[] entries =
+ new WebtoolsProjectJBossClasspathContainer(path).getClasspathEntries();
+ return Arrays.asList(entries);
+ } else {
+ String id = rc.getProperty("id");
+ IPath containerPath = new Path("org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectRuntimeInitializer");
+ path = containerPath.append(id);
+ }
+
+ IClasspathEntry cpentry = JavaCore.newContainerEntry(path);
+ return Collections.singletonList(cpentry);
+ }
+
+ public static final class Factory implements IAdapterFactory {
+ private static final Class[] ADAPTER_TYPES = { IClasspathProvider.class };
+
+ public Object getAdapter(final Object adaptable, final Class adapterType) {
+ IRuntimeComponent rc = (IRuntimeComponent) adaptable;
+ return new ProjectRuntimeClasspathProvider(rc);
+ }
+
+ public Class[] getAdapterList() {
+ return ADAPTER_TYPES;
+ }
+ }
+
+
+
+ public static class RuntimeClasspathContainerInitializer extends ClasspathContainerInitializer {
+ public void initialize(IPath containerPath, IJavaProject project)
+ throws CoreException {
+ RuntimeClasspathContainer container = new RuntimeClasspathContainer(containerPath);
+
+ JavaCore.setClasspathContainer(containerPath,
+ new IJavaProject[] {project}, new IClasspathContainer[] {container}, null);
+ }
+ }
+
+ public static class RuntimeClasspathContainer implements IClasspathContainer {
+ private IPath path;
+ private IRuntime rt;
+
+ public RuntimeClasspathContainer(IPath path) {
+ this.path = path;
+ this.rt = ServerCore.findRuntime(path.segment(1));
+ }
+
+ public IClasspathEntry[] getClasspathEntries() {
+ return new ClientAllRuntimeClasspathProvider().resolveClasspathContainer(null, rt);
+ }
+
+ public String getDescription() {
+ return "All JBoss Libraries [" + rt.getName() + "]";
+ }
+
+ public int getKind() {
+ return IClasspathEntry.CPE_CONTAINER;
+ }
+
+ public IPath getPath() {
+ return path;
+ }
+
+ }
+}
18 years, 4 months
JBoss Tools SVN: r2946 - in trunk/as/plugins: org.jboss.ide.eclipse.as.classpath.core/META-INF and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-08-07 16:41:35 -0400 (Tue, 07 Aug 2007)
New Revision: 2946
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB30SupportVerifier.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/WebtoolsProjectJBossClasspathContainerInitializer.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/EJB30SupportVerifier.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/internal/ClientAllRuntimeClasspathProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/internal/ProjectRuntimeClasspathProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/internal/WebtoolsProjectJBossClasspathContainerInitializer.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/ejb3/JBossEJB3LibrariesPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/.classpath
trunk/as/plugins/org.jboss.ide.eclipse.as.core/.settings/org.eclipse.jdt.core.prefs
trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
libraries moved to classpath.core
adds more libraries than needed now by default.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/META-INF/MANIFEST.MF 2007-08-07 17:38:23 UTC (rev 2945)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/META-INF/MANIFEST.MF 2007-08-07 20:41:35 UTC (rev 2946)
@@ -5,11 +5,14 @@
Bundle-Version: 1.0.0
Bundle-Activator: org.jboss.ide.eclipse.as.classpath.core.ClasspathCorePlugin
Require-Bundle: org.eclipse.core.runtime,
- org.jboss.ide.eclipse.as.core,
org.eclipse.jdt.core,
org.eclipse.wst.server.core,
org.eclipse.core.resources,
- org.eclipse.jdt.launching
+ org.eclipse.jdt.launching,
+ org.eclipse.jst.server.core,
+ org.eclipse.wst.common.project.facet.core,
+ org.eclipse.jst.common.project.facet.core,
+ org.jboss.ide.eclipse.as.core
Eclipse-LazyStart: true
Export-Package: org.jboss.ide.eclipse.as.classpath.core,
org.jboss.ide.eclipse.as.classpath.core.ejb3
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml 2007-08-07 17:38:23 UTC (rev 2945)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml 2007-08-07 20:41:35 UTC (rev 2946)
@@ -7,4 +7,54 @@
class="org.jboss.ide.eclipse.as.classpath.core.ejb3.EJB3ClasspathContainerInitializer"
id="org.jboss.ide.eclipse.as.classpath.core.ejb3.classpathContainer"/>
</extension>
+
+
+ <extension
+ point="org.eclipse.wst.common.project.facet.core.runtimes">
+
+ <adapter>
+ <runtime-component
+ id="org.jboss.ide.eclipse.as.runtime.component.32" version="3.2"/>
+ <factory class="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectRuntimeClasspathProvider$Factory"/>
+ <type class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
+ </adapter>
+
+ <adapter>
+ <runtime-component
+ id="org.jboss.ide.eclipse.as.runtime.component.40" version="4.0"/>
+ <factory class="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectRuntimeClasspathProvider$Factory"/>
+ <type class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
+ </adapter>
+
+ <adapter>
+ <runtime-component
+ id="org.jboss.ide.eclipse.as.runtime.component.42" version="4.2"/>
+ <factory class="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectRuntimeClasspathProvider$Factory"/>
+ <type class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
+ </adapter>
+ </extension>
+
+ <extension
+ point="org.eclipse.jdt.core.classpathContainerInitializer">
+ <classpathContainerInitializer
+ class="org.jboss.ide.eclipse.as.classpath.core.runtime.WebtoolsProjectJBossClasspathContainerInitializer"
+ id="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectInitializer"/>
+ </extension>
+
+
+
+ <extension point="org.eclipse.jst.server.core.runtimeClasspathProviders">
+ <runtimeClasspathProvider
+ id="org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget"
+ runtimeTypeIds="org.jboss.ide.eclipse.as.runtime.32, org.jboss.ide.eclipse.as.runtime.40, org.jboss.ide.eclipse.as.runtime.42"
+ class="org.jboss.ide.eclipse.as.classpath.core.runtime.ClientAllRuntimeClasspathProvider"/>
+ </extension>
+ <extension
+ point="org.eclipse.jdt.core.classpathContainerInitializer">
+ <classpathContainerInitializer
+ class="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectRuntimeClasspathProvider$RuntimeClasspathContainerInitializer"
+ id="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectRuntimeInitializer">
+ </classpathContainerInitializer>
+ </extension>
+
</plugin>
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB30SupportVerifier.java (from rev 2945, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/EJB30SupportVerifier.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB30SupportVerifier.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB30SupportVerifier.java 2007-08-07 20:41:35 UTC (rev 2946)
@@ -0,0 +1,32 @@
+package org.jboss.ide.eclipse.as.classpath.core.ejb3;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.wst.server.core.IRuntime;
+import org.jboss.ide.eclipse.as.classpath.core.runtime.WebtoolsProjectJBossClasspathContainerInitializer.WebtoolsProjectJBossClasspathContainer;
+import org.jboss.ide.eclipse.as.core.runtime.server.AbstractJBossServerRuntime;
+
+public class EJB30SupportVerifier {
+ public static boolean verify(IRuntime rt) {
+ AbstractJBossServerRuntime ajbsr = (AbstractJBossServerRuntime)rt.loadAdapter(AbstractJBossServerRuntime.class, null);
+ // i refuse to verify. if they say they support, believe them
+ if( ajbsr == null ) return true;
+
+ // one of ours. verify
+ IPath path = new Path("org.jboss.ide.eclipse.as.core.runtime.ProjectInitializer");
+ path = path.append(rt.getId()).append("jst.ejb").append("3.0");
+
+ WebtoolsProjectJBossClasspathContainer container =
+ new WebtoolsProjectJBossClasspathContainer(path);
+ IClasspathEntry[] entries = container.getClasspathEntries();
+ if( entries.length == 0 ) return false;
+ IPath p;
+ for( int i = 0; i < entries.length; i++ ) {
+ p = entries[i].getPath();
+ if( !p.toFile().exists())
+ return false;
+ }
+ return true;
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java 2007-08-07 17:38:23 UTC (rev 2945)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java 2007-08-07 20:41:35 UTC (rev 2946)
@@ -23,7 +23,6 @@
import java.util.ArrayList;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -32,8 +31,6 @@
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.internal.core.ClasspathEntry;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerCore;
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/WebtoolsProjectJBossClasspathContainerInitializer.java (from rev 2945, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/internal/WebtoolsProjectJBossClasspathContainerInitializer.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/WebtoolsProjectJBossClasspathContainerInitializer.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/WebtoolsProjectJBossClasspathContainerInitializer.java 2007-08-07 20:41:35 UTC (rev 2946)
@@ -0,0 +1,284 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.classpath.core.runtime;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.ClasspathContainerInitializer;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+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;
+import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.core.runtime.server.AbstractJBossServerRuntime;
+
+
+public class WebtoolsProjectJBossClasspathContainerInitializer extends
+ ClasspathContainerInitializer {
+
+ private static final IProjectFacet JST_JAVA_FACET = ProjectFacetsManager.getProjectFacet("jst.java");
+ private static final IProjectFacet WEB_FACET = ProjectFacetsManager.getProjectFacet("jst.web");
+ private static final IProjectFacet EJB_FACET = ProjectFacetsManager.getProjectFacet("jst.ejb");
+ private static final IProjectFacet EAR_FACET = ProjectFacetsManager.getProjectFacet("jst.ear");
+ private static final IProjectFacet UTILITY_FACET = ProjectFacetsManager.getProjectFacet("jst.utility");
+ private static final IProjectFacet CONNECTOR_FACET = ProjectFacetsManager.getProjectFacet("jst.connector");
+ private static final IProjectFacet APP_CLIENT_FACET = ProjectFacetsManager.getProjectFacet("jst.appclient");
+
+
+ public WebtoolsProjectJBossClasspathContainerInitializer() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public void initialize(IPath containerPath, IJavaProject project)
+ throws CoreException {
+ WebtoolsProjectJBossClasspathContainer container = new WebtoolsProjectJBossClasspathContainer(containerPath);
+
+ JavaCore.setClasspathContainer(containerPath,
+ new IJavaProject[] {project}, new IClasspathContainer[] {container}, null);
+ }
+
+ public IClasspathEntry[] getEntries(IPath path) {
+ return new WebtoolsProjectJBossClasspathContainer(path).getClasspathEntries();
+ }
+
+
+
+
+ public static class WebtoolsProjectJBossClasspathContainer implements IClasspathContainer {
+ private IPath path;
+ private IClasspathEntry[] entries = null;
+
+ public WebtoolsProjectJBossClasspathContainer(IPath path) {
+ this.path = path;
+ }
+
+ public String getDescription() {
+ if( path.segmentCount() < 4 ) return "JBoss Runtimes";
+ return "JBoss Runtimes (" + path.segment(2) + " : " + path.segment(3) + ")";
+ }
+
+ public int getKind() {
+ return IClasspathContainer.K_APPLICATION;
+ }
+
+ public IPath getPath() {
+ return path;
+ }
+
+
+
+ public IClasspathEntry[] getClasspathEntries() {
+ if( entries == null ) {
+ loadClasspathEntries();
+ if( entries == null )
+ return new IClasspathEntry[0];
+ }
+ return entries;
+ }
+
+ private void loadClasspathEntries() {
+ if( path.segmentCount() < 4 ) return;
+ String runtimeId = path.segment(1);
+ String facetId = path.segment(2);
+ String facetVersion = path.segment(3);
+
+
+ if( runtimeId == null ) return;
+
+ IRuntime runtime = ServerCore.findRuntime(runtimeId);
+ if( runtime == null ) return;
+
+ Object serverRuntime = runtime.loadAdapter(AbstractJBossServerRuntime.class, null);
+
+ if( serverRuntime == null ) return;
+ AbstractJBossServerRuntime jbRuntime = (AbstractJBossServerRuntime)serverRuntime;
+
+ String serverHome = runtime.getLocation().toOSString();
+ String configName = jbRuntime.getJBossConfiguration();
+
+ String jbossVersion = jbRuntime.getId();
+
+ entries = loadClasspathEntries2(runtimeId, facetId, facetVersion,
+ serverHome, configName, jbossVersion, jbRuntime);
+ }
+
+ protected IClasspathEntry[] loadClasspathEntries2(String runtimeId, String facetId,
+ String facetVersion, String serverHome, String configName, String jbVersion,
+ AbstractJBossServerRuntime jbsRuntime) {
+ if( facetId.equals(JST_JAVA_FACET.getId())) {
+ return loadJREClasspathEntries(jbsRuntime);
+ } else if( jbVersion.equals("4.2")) {
+ return loadClasspathEntries42(facetId, facetVersion, serverHome, configName);
+ } else if( jbVersion.equals("4.0"))
+ return loadClasspathEntries40(facetId, facetVersion, serverHome, configName);
+ if( jbVersion.equals("3.2"))
+ return loadClasspathEntries32( facetId, facetVersion, serverHome, configName);
+ return loadClasspathEntriesDefault(facetId, facetVersion, serverHome, configName);
+ }
+
+ protected boolean isEjb30(String facetId, String facetVersion) {
+ if( facetId.equals(EJB_FACET.getId()) && facetVersion.equals("3.0"))
+ return true;
+ return false;
+ }
+
+ protected IClasspathEntry getEntry(IPath path) {
+ return JavaRuntime.newArchiveRuntimeClasspathEntry(path).getClasspathEntry();
+ }
+ protected IClasspathEntry[] getEntries(IPath folder) {
+ String[] files = folder.toFile().list();
+ ArrayList list = new ArrayList();
+ for( int i = 0; i < files.length; i++ ) {
+ if( files[i].endsWith(".jar")) {
+ list.add(getEntry(folder.append(files[i])));
+ }
+ }
+ return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
+ }
+ protected IClasspathEntry[] loadJREClasspathEntries(AbstractJBossServerRuntime jbsRuntime) {
+ IVMInstall vmInstall = jbsRuntime.getVM();
+ if (vmInstall != null) {
+ String name = vmInstall.getName();
+ String typeId = vmInstall.getVMInstallType().getId();
+ return new IClasspathEntry[] { JavaCore.newContainerEntry(new Path(JavaRuntime.JRE_CONTAINER).append(typeId).append(name)) };
+ }
+ return null;
+ }
+
+ protected IClasspathEntry[] loadClasspathEntries42(String facetId, String facetVersion, String serverHome, String configName) {
+ IPath homePath = new Path(serverHome);
+ IPath configPath = homePath.append("server").append(configName);
+ ArrayList list = new ArrayList();
+ if (facetId.equals(WEB_FACET.getId())) {
+ IPath jsfDir = configPath.append("deploy").append("jboss-web.deployer").append("jsf-libs");
+ list.add(getEntry(configPath.append("lib").append("jsp-api.jar")));
+ list.add(getEntry(homePath.append("client").append("servlet-api.jar")));
+ list.add(getEntry(jsfDir.append("jsf-api.jar")));
+ list.add(getEntry(jsfDir.append("jsf-impl.jar")));
+ } else if( facetId.equals(EJB_FACET.getId()) && !isEjb30(facetId, facetVersion)) {
+ list.add(getEntry(homePath.append("client").append("jboss-j2ee.jar")));
+ } else if( isEjb30(facetId, facetVersion)) {
+ // path roots
+ IPath deploy = configPath.append("deploy");
+ IPath deployer = deploy.append("ejb3.deployer");
+ IPath aopDeployer = deploy.append("jboss-aop-jdk50.deployer");
+ IPath client = homePath.append("client");
+
+ list.add(getEntry(configPath.append("lib").append("jboss-ejb3x.jar")));
+ list.add(getEntry(deployer.append("jboss-ejb3.jar")));
+ list.add(getEntry(deployer.append("jboss-annotations-ejb3.jar")));
+
+ // aop
+ list.add(getEntry(aopDeployer.append("jboss-aop-jdk50.jar")));
+ list.add(getEntry(aopDeployer.append("jboss-aspect-library-jdk50.jar")));
+
+ // hibernate
+ list.add(getEntry(homePath.append("client").append("hibernate-client.jar")));
+
+ // persistence jar
+ list.add(getEntry(client.append("ejb3-persistence.jar")));
+
+ } else if( facetId.equals(EAR_FACET.getId())) {
+ list.add(getEntry(homePath.append("client").append("jboss-j2ee.jar")));
+ } else if( facetId.equals(APP_CLIENT_FACET.getId())) {
+ list.add(getEntry(homePath.append("client").append("jbossall-client.jar")));
+ }
+ return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
+ }
+
+ protected IClasspathEntry[] loadClasspathEntries40(String facetId, String facetVersion, String serverHome, String configName) {
+ IPath homePath = new Path(serverHome);
+ IPath configPath = homePath.append("server").append(configName);
+ ArrayList list = new ArrayList();
+ if (facetId.equals(WEB_FACET.getId())) {
+ IPath jsfDir = configPath.append("deploy").append("jbossweb-tomcat55.sar").append("jsf-libs");
+ list.add(getEntry(configPath.append("lib").append("javax.servlet.jsp.jar")));
+ list.add(getEntry(homePath.append("client").append("javax.servlet.jar")));
+ list.addAll(Arrays.asList(getEntries(jsfDir)));
+ } else if( facetId.equals(EJB_FACET.getId()) && !isEjb30(facetId, facetVersion)) {
+ list.add(getEntry(homePath.append("client").append("jboss-j2ee.jar")));
+ } else if( isEjb30(facetId, facetVersion)) {
+ // path roots
+ IPath deploy = configPath.append("deploy");
+ IPath deployer = deploy.append("ejb3.deployer");
+ IPath aopDeployer = deploy.append("jboss-aop-jdk50.deployer");
+
+ // ejb3
+ list.add(getEntry(deployer.append("jboss-ejb3x.jar")));
+ list.add(getEntry(deployer.append("jboss-ejb3.jar")));
+ list.add(getEntry(deployer.append("jboss-annotations-ejb3.jar")));
+
+ // aop
+ list.add(getEntry(aopDeployer.append("jboss-aop-jdk50.jar")));
+ list.add(getEntry(aopDeployer.append("jboss-aspect-library-jdk50.jar")));
+
+ // hibernate
+ list.add(getEntry(homePath.append("client").append("hibernate-client.jar")));
+
+ } else if( facetId.equals(EAR_FACET.getId())) {
+ list.add(getEntry(homePath.append("client").append("jboss-j2ee.jar")));
+ } else if( facetId.equals(APP_CLIENT_FACET.getId())) {
+ list.add(JavaRuntime.newArchiveRuntimeClasspathEntry(homePath.append("client").append("jbossall-client.jar")).getClasspathEntry());
+ }
+ return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
+ }
+
+
+ protected IClasspathEntry[] loadClasspathEntries32(String facetId, String facetVersion, String serverHome, String configName) {
+ IPath homePath = new Path(serverHome);
+ IPath configPath = homePath.append("server").append(configName);
+ ArrayList list = new ArrayList();
+ if (facetId.equals(WEB_FACET.getId())) {
+ IPath p = configPath.append("deploy").append("jbossweb-tomcat50.sar");
+ list.add(getEntry(p.append("jsp-api.jar")));
+ list.add(getEntry(p.append("servlet-api.jar")));
+ } else if( (facetId.equals(EJB_FACET.getId()) && !isEjb30(facetId, facetVersion))
+ || facetId.equals(EAR_FACET.getId()) ) {
+ list.add(getEntry(homePath.append("client").append("jboss-j2ee.jar")));
+ } else if( facetId.equals(APP_CLIENT_FACET.getId())) {
+ list.add(getEntry(homePath.append("client").append("jbossall-client.jar")));
+ }
+ return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
+ }
+ protected IClasspathEntry[] loadClasspathEntriesDefault(String facetId, String facetVersion, String serverHome, String configName) {
+ return new IClasspathEntry[0];
+ }
+
+ protected IClasspathEntry[] pathsAsEntries(IPath[] paths) {
+ IClasspathEntry[] entries = new IClasspathEntry[paths.length];
+ for( int i = 0; i < paths.length; i++ )
+ entries[i] = getEntry(paths[i]);
+ return entries;
+ }
+
+ }
+
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/ejb3/JBossEJB3LibrariesPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/ejb3/JBossEJB3LibrariesPage.java 2007-08-07 17:38:23 UTC (rev 2945)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/ejb3/JBossEJB3LibrariesPage.java 2007-08-07 20:41:35 UTC (rev 2946)
@@ -25,9 +25,9 @@
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
+import org.jboss.ide.eclipse.as.classpath.core.ejb3.EJB30SupportVerifier;
import org.jboss.ide.eclipse.as.classpath.core.ejb3.EJB3ClasspathContainer;
import org.jboss.ide.eclipse.as.classpath.ui.ClasspathUIPlugin;
-import org.jboss.ide.eclipse.as.core.runtime.EJB30SupportVerifier;
import org.jboss.ide.eclipse.as.core.server.JBossServer;
public class JBossEJB3LibrariesPage extends JBossSelectionPage implements IClasspathContainerPage
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/.classpath
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/.classpath 2007-08-07 17:38:23 UTC (rev 2945)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/.classpath 2007-08-07 20:41:35 UTC (rev 2946)
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="jbosscore"/>
- <classpathentry exported="true" kind="lib" path="getopt.jar"/>
<classpathentry exported="true" kind="lib" path="dom4j-1.6.1.jar"/>
<classpathentry exported="true" kind="lib" path="jaxen-1.1-beta-6.jar"/>
+ <classpathentry exported="true" kind="lib" path="getopt.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/.settings/org.eclipse.jdt.core.prefs 2007-08-07 17:38:23 UTC (rev 2945)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/.settings/org.eclipse.jdt.core.prefs 2007-08-07 20:41:35 UTC (rev 2946)
@@ -1,12 +1,7 @@
-#Wed Aug 30 12:03:28 EDT 2006
+#Tue Aug 07 15:28:54 EDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2007-08-07 17:38:23 UTC (rev 2945)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2007-08-07 20:41:35 UTC (rev 2946)
@@ -28,7 +28,6 @@
org.jboss.ide.eclipse.as.core.packages.types,
org.jboss.ide.eclipse.as.core.publishers,
org.jboss.ide.eclipse.as.core.runtime,
- org.jboss.ide.eclipse.as.core.runtime.internal,
org.jboss.ide.eclipse.as.core.runtime.server,
org.jboss.ide.eclipse.as.core.runtime.server.polling,
org.jboss.ide.eclipse.as.core.server,
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/EJB30SupportVerifier.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/EJB30SupportVerifier.java 2007-08-07 17:38:23 UTC (rev 2945)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/EJB30SupportVerifier.java 2007-08-07 20:41:35 UTC (rev 2946)
@@ -1,30 +0,0 @@
-package org.jboss.ide.eclipse.as.core.runtime;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.wst.server.core.IRuntime;
-import org.jboss.ide.eclipse.as.core.runtime.internal.WebtoolsProjectJBossClasspathContainerInitializer.WebtoolsProjectJBossClasspathContainer;
-import org.jboss.ide.eclipse.as.core.runtime.server.AbstractJBossServerRuntime;
-
-public class EJB30SupportVerifier {
- public static boolean verify(IRuntime rt) {
- AbstractJBossServerRuntime ajbsr = (AbstractJBossServerRuntime)rt.loadAdapter(AbstractJBossServerRuntime.class, null);
- // i refuse to verify. if they say they support, believe them
- if( ajbsr == null ) return true;
-
- // one of ours. verify
- IPath path = new Path("junk").append(rt.getId()).append("jst.ejb").append("3.0");
- WebtoolsProjectJBossClasspathContainer container =
- new WebtoolsProjectJBossClasspathContainer(path);
- IClasspathEntry[] entries = container.getClasspathEntries();
- if( entries.length == 0 ) return false;
- IPath p;
- for( int i = 0; i < entries.length; i++ ) {
- p = entries[i].getPath();
- if( !p.toFile().exists())
- return false;
- }
- return true;
- }
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/internal/ClientAllRuntimeClasspathProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/internal/ClientAllRuntimeClasspathProvider.java 2007-08-07 17:38:23 UTC (rev 2945)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/internal/ClientAllRuntimeClasspathProvider.java 2007-08-07 20:41:35 UTC (rev 2946)
@@ -1,27 +0,0 @@
-package org.jboss.ide.eclipse.as.core.runtime.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate;
-import org.eclipse.wst.server.core.IRuntime;
-import org.jboss.ide.eclipse.as.core.runtime.server.AbstractJBossServerRuntime;
-
-public class ClientAllRuntimeClasspathProvider extends RuntimeClasspathProviderDelegate {
-
- public IClasspathEntry[] resolveClasspathContainer(IProject project, IRuntime runtime) {
- AbstractJBossServerRuntime rt = ((AbstractJBossServerRuntime) (runtime.loadAdapter(AbstractJBossServerRuntime.class, new NullProgressMonitor())));
- String id = rt == null ? "" : rt.getId();
- IPath loc = runtime.getLocation();
- if( id.indexOf("4.2") > -1 ) {
- return new IClasspathEntry[] { JavaCore.newLibraryEntry(loc.append("client").append("jbossall-client.jar"), null, null) };
- } else if( id.indexOf("4.0") > -1 ) {
- return new IClasspathEntry[] { JavaCore.newLibraryEntry(loc.append("client").append("jbossall-client.jar"), null, null) };
- } else if( id.indexOf("3.2") > -1 ) {
- return new IClasspathEntry[] { JavaCore.newLibraryEntry(loc.append("client").append("jbossall-client.jar"), null, null) };
- }
- return null;
- }
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/internal/ProjectRuntimeClasspathProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/internal/ProjectRuntimeClasspathProvider.java 2007-08-07 17:38:23 UTC (rev 2945)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/internal/ProjectRuntimeClasspathProvider.java 2007-08-07 20:41:35 UTC (rev 2946)
@@ -1,89 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
-* This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.runtime.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jst.common.project.facet.core.IClasspathProvider;
-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.runtime.IRuntimeComponent;
-import org.jboss.ide.eclipse.as.core.runtime.internal.WebtoolsProjectJBossClasspathContainerInitializer.WebtoolsProjectJBossClasspathContainer;
-
-public class ProjectRuntimeClasspathProvider implements IClasspathProvider {
- private IRuntimeComponent rc;
-
- public ProjectRuntimeClasspathProvider() {
-
- }
-
- public ProjectRuntimeClasspathProvider(final IRuntimeComponent rc) {
- this.rc = rc;
- }
-
- public List getClasspathEntries(final IProjectFacetVersion fv) {
- IProjectFacet pf = fv.getProjectFacet();
- if (pf == null)
- return null;
-
-
- // initializer/runtimeId/facetId/facetVersion
- IPath path = new Path("org.jboss.ide.eclipse.as.core.runtime.ProjectInitializer");
- path = path.append(rc.getProperty("id"));
- path = path.append(fv.getProjectFacet().getId());
- path = path.append(fv.getVersionString());
-
- WebtoolsProjectJBossClasspathContainer temp = new WebtoolsProjectJBossClasspathContainer(path);
- // If we're a java runtime, just return that.
- if( temp.getClasspathEntries().length == 1 && fv.getProjectFacet().getId().equals("jst.java")) {
- return Arrays.asList(temp.getClasspathEntries());
- }
-
- // Otherwise just return the path to it, unless its empty in which case dont even include it
- if( temp.getClasspathEntries().length != 0 ) {
- IClasspathEntry cpentry = JavaCore.newContainerEntry(path);
- return Collections.singletonList(cpentry);
- }
- return new ArrayList();
- }
-
- public static final class Factory implements IAdapterFactory {
- private static final Class[] ADAPTER_TYPES = { IClasspathProvider.class };
-
- public Object getAdapter(final Object adaptable, final Class adapterType) {
- IRuntimeComponent rc = (IRuntimeComponent) adaptable;
- return new ProjectRuntimeClasspathProvider(rc);
- }
-
- public Class[] getAdapterList() {
- return ADAPTER_TYPES;
- }
- }
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/internal/WebtoolsProjectJBossClasspathContainerInitializer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/internal/WebtoolsProjectJBossClasspathContainerInitializer.java 2007-08-07 17:38:23 UTC (rev 2945)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/internal/WebtoolsProjectJBossClasspathContainerInitializer.java 2007-08-07 20:41:35 UTC (rev 2946)
@@ -1,282 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
-* This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.runtime.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.ClasspathContainerInitializer;
-import org.eclipse.jdt.core.IClasspathContainer;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.JavaRuntime;
-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;
-import org.eclipse.wst.server.core.ServerCore;
-import org.jboss.ide.eclipse.as.core.runtime.server.AbstractJBossServerRuntime;
-
-
-public class WebtoolsProjectJBossClasspathContainerInitializer extends
- ClasspathContainerInitializer {
-
- private static final IProjectFacet JST_JAVA_FACET = ProjectFacetsManager.getProjectFacet("jst.java");
- private static final IProjectFacet WEB_FACET = ProjectFacetsManager.getProjectFacet("jst.web");
- private static final IProjectFacet EJB_FACET = ProjectFacetsManager.getProjectFacet("jst.ejb");
- private static final IProjectFacet EAR_FACET = ProjectFacetsManager.getProjectFacet("jst.ear");
- private static final IProjectFacet UTILITY_FACET = ProjectFacetsManager.getProjectFacet("jst.utility");
- private static final IProjectFacet CONNECTOR_FACET = ProjectFacetsManager.getProjectFacet("jst.connector");
- private static final IProjectFacet APP_CLIENT_FACET = ProjectFacetsManager.getProjectFacet("jst.appclient");
-
-
- public WebtoolsProjectJBossClasspathContainerInitializer() {
- // TODO Auto-generated constructor stub
- }
-
- public void initialize(IPath containerPath, IJavaProject project)
- throws CoreException {
- WebtoolsProjectJBossClasspathContainer container = new WebtoolsProjectJBossClasspathContainer(containerPath);
-
- JavaCore.setClasspathContainer(containerPath,
- new IJavaProject[] {project}, new IClasspathContainer[] {container}, null);
- }
-
-
-
-
-
-
- public static class WebtoolsProjectJBossClasspathContainer implements IClasspathContainer {
- private IPath path;
- private IClasspathEntry[] entries = null;
-
- public WebtoolsProjectJBossClasspathContainer(IPath path) {
- this.path = path;
- }
-
- public String getDescription() {
- if( path.segmentCount() < 4 ) return "JBoss Runtimes";
- return "JBoss Runtimes (" + path.segment(2) + " : " + path.segment(3) + ")";
- }
-
- public int getKind() {
- return IClasspathContainer.K_APPLICATION;
- }
-
- public IPath getPath() {
- return path;
- }
-
-
-
- public IClasspathEntry[] getClasspathEntries() {
- if( entries == null ) {
- loadClasspathEntries();
- if( entries == null )
- return new IClasspathEntry[0];
- }
- return entries;
- }
-
- private void loadClasspathEntries() {
- if( path.segmentCount() < 4 ) return;
- String runtimeId = path.segment(1);
- String facetId = path.segment(2);
- String facetVersion = path.segment(3);
-
-
- if( runtimeId == null ) return;
-
- IRuntime runtime = ServerCore.findRuntime(runtimeId);
- if( runtime == null ) return;
-
- Object serverRuntime = runtime.loadAdapter(AbstractJBossServerRuntime.class, null);
-
- if( serverRuntime == null ) return;
- AbstractJBossServerRuntime jbRuntime = (AbstractJBossServerRuntime)serverRuntime;
-
- String serverHome = runtime.getLocation().toOSString();
- String configName = jbRuntime.getJBossConfiguration();
-
- String jbossVersion = jbRuntime.getId();
-
- entries = loadClasspathEntries2(runtimeId, facetId, facetVersion,
- serverHome, configName, jbossVersion, jbRuntime);
- }
-
- protected IClasspathEntry[] loadClasspathEntries2(String runtimeId, String facetId,
- String facetVersion, String serverHome, String configName, String jbVersion,
- AbstractJBossServerRuntime jbsRuntime) {
- if( facetId.equals(JST_JAVA_FACET.getId())) {
- return loadJREClasspathEntries(jbsRuntime);
- } else if( jbVersion.equals("4.2")) {
- return loadClasspathEntries42(facetId, facetVersion, serverHome, configName);
- } else if( jbVersion.equals("4.0"))
- return loadClasspathEntries40(facetId, facetVersion, serverHome, configName);
- if( jbVersion.equals("3.2"))
- return loadClasspathEntries32( facetId, facetVersion, serverHome, configName);
- return loadClasspathEntriesDefault(facetId, facetVersion, serverHome, configName);
- }
-
- protected boolean isEjb30(String facetId, String facetVersion) {
- if( facetId.equals(EJB_FACET.getId()) && facetVersion.equals("3.0"))
- return true;
- return false;
- }
-
- protected IClasspathEntry getEntry(IPath path) {
- return JavaRuntime.newArchiveRuntimeClasspathEntry(path).getClasspathEntry();
- }
- protected IClasspathEntry[] getEntries(IPath folder) {
- String[] files = folder.toFile().list();
- ArrayList list = new ArrayList();
- for( int i = 0; i < files.length; i++ ) {
- if( files[i].endsWith(".jar")) {
- list.add(getEntry(folder.append(files[i])));
- }
- }
- return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
- }
- protected IClasspathEntry[] loadJREClasspathEntries(AbstractJBossServerRuntime jbsRuntime) {
- IVMInstall vmInstall = jbsRuntime.getVM();
- if (vmInstall != null) {
- String name = vmInstall.getName();
- String typeId = vmInstall.getVMInstallType().getId();
- return new IClasspathEntry[] { JavaCore.newContainerEntry(new Path(JavaRuntime.JRE_CONTAINER).append(typeId).append(name)) };
- }
- return null;
- }
-
- protected IClasspathEntry[] loadClasspathEntries42(String facetId, String facetVersion, String serverHome, String configName) {
- IPath homePath = new Path(serverHome);
- IPath configPath = homePath.append("server").append(configName);
- ArrayList list = new ArrayList();
- if (facetId.equals(WEB_FACET.getId())) {
- IPath jsfDir = configPath.append("deploy").append("jboss-web.deployer").append("jsf-libs");
- list.add(getEntry(configPath.append("lib").append("jsp-api.jar")));
- list.add(getEntry(homePath.append("client").append("servlet-api.jar")));
- list.add(getEntry(jsfDir.append("jsf-api.jar")));
- list.add(getEntry(jsfDir.append("jsf-impl.jar")));
- } else if( facetId.equals(EJB_FACET.getId()) && !isEjb30(facetId, facetVersion)) {
- list.add(getEntry(homePath.append("client").append("jboss-j2ee.jar")));
- } else if( isEjb30(facetId, facetVersion)) {
- // path roots
- IPath deploy = configPath.append("deploy");
- IPath deployer = deploy.append("ejb3.deployer");
- IPath aopDeployer = deploy.append("jboss-aop-jdk50.deployer");
- IPath client = homePath.append("client");
-
- list.add(getEntry(configPath.append("lib").append("jboss-ejb3x.jar")));
- list.add(getEntry(deployer.append("jboss-ejb3.jar")));
- list.add(getEntry(deployer.append("jboss-annotations-ejb3.jar")));
-
- // aop
- list.add(getEntry(aopDeployer.append("jboss-aop-jdk50.jar")));
- list.add(getEntry(aopDeployer.append("jboss-aspect-library-jdk50.jar")));
-
- // hibernate
- list.add(getEntry(homePath.append("client").append("hibernate-client.jar")));
-
- // persistence jar
- list.add(getEntry(client.append("ejb3-persistence.jar")));
-
- } else if( facetId.equals(EAR_FACET.getId())) {
- list.add(getEntry(homePath.append("client").append("jboss-j2ee.jar")));
- } else if( facetId.equals(APP_CLIENT_FACET.getId())) {
- list.add(getEntry(homePath.append("client").append("jbossall-client.jar")));
- }
- return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
- }
-
- protected IClasspathEntry[] loadClasspathEntries40(String facetId, String facetVersion, String serverHome, String configName) {
- IPath homePath = new Path(serverHome);
- IPath configPath = homePath.append("server").append(configName);
- ArrayList list = new ArrayList();
- if (facetId.equals(WEB_FACET.getId())) {
- IPath jsfDir = configPath.append("deploy").append("jbossweb-tomcat55.sar").append("jsf-libs");
- list.add(getEntry(configPath.append("lib").append("javax.servlet.jsp.jar")));
- list.add(getEntry(homePath.append("client").append("javax.servlet.jar")));
- list.addAll(Arrays.asList(getEntries(jsfDir)));
- } else if( facetId.equals(EJB_FACET.getId()) && !isEjb30(facetId, facetVersion)) {
- list.add(getEntry(homePath.append("client").append("jboss-j2ee.jar")));
- } else if( isEjb30(facetId, facetVersion)) {
- // path roots
- IPath deploy = configPath.append("deploy");
- IPath deployer = deploy.append("ejb3.deployer");
- IPath aopDeployer = deploy.append("jboss-aop-jdk50.deployer");
-
- // ejb3
- list.add(getEntry(deployer.append("jboss-ejb3x.jar")));
- list.add(getEntry(deployer.append("jboss-ejb3.jar")));
- list.add(getEntry(deployer.append("jboss-annotations-ejb3.jar")));
-
- // aop
- list.add(getEntry(aopDeployer.append("jboss-aop-jdk50.jar")));
- list.add(getEntry(aopDeployer.append("jboss-aspect-library-jdk50.jar")));
-
- // hibernate
- list.add(getEntry(homePath.append("client").append("hibernate-client.jar")));
-
- } else if( facetId.equals(EAR_FACET.getId())) {
- list.add(getEntry(homePath.append("client").append("jboss-j2ee.jar")));
- } else if( facetId.equals(APP_CLIENT_FACET.getId())) {
- list.add(JavaRuntime.newArchiveRuntimeClasspathEntry(homePath.append("client").append("jbossall-client.jar")).getClasspathEntry());
- }
- return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
- }
-
-
- protected IClasspathEntry[] loadClasspathEntries32(String facetId, String facetVersion, String serverHome, String configName) {
- IPath homePath = new Path(serverHome);
- IPath configPath = homePath.append("server").append(configName);
- ArrayList list = new ArrayList();
- if (facetId.equals(WEB_FACET.getId())) {
- IPath p = configPath.append("deploy").append("jbossweb-tomcat50.sar");
- list.add(getEntry(p.append("jsp-api.jar")));
- list.add(getEntry(p.append("servlet-api.jar")));
- } else if( (facetId.equals(EJB_FACET.getId()) && !isEjb30(facetId, facetVersion))
- || facetId.equals(EAR_FACET.getId()) ) {
- list.add(getEntry(homePath.append("client").append("jboss-j2ee.jar")));
- } else if( facetId.equals(APP_CLIENT_FACET.getId())) {
- list.add(getEntry(homePath.append("client").append("jbossall-client.jar")));
- }
- return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
- }
- protected IClasspathEntry[] loadClasspathEntriesDefault(String facetId, String facetVersion, String serverHome, String configName) {
- return new IClasspathEntry[0];
- }
-
- protected IClasspathEntry[] pathsAsEntries(IPath[] paths) {
- IClasspathEntry[] entries = new IClasspathEntry[paths.length];
- for( int i = 0; i < paths.length; i++ )
- entries[i] = getEntry(paths[i]);
- return entries;
- }
-
- }
-
-}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-08-07 17:38:23 UTC (rev 2945)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-08-07 20:41:35 UTC (rev 2946)
@@ -338,53 +338,10 @@
<facet id="jst.ear" version="1.2,1.3,1.4"/>
<facet id="jst.appclient" version="1.2,1.3,1.4"/>
</supported>
-
- <adapter>
- <runtime-component
- id="org.jboss.ide.eclipse.as.runtime.component.32"
- version="3.2"/>
- <factory
- class="org.jboss.ide.eclipse.as.core.runtime.internal.ProjectRuntimeClasspathProvider$Factory"/>
- <type
- class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
- </adapter>
-
- <adapter>
- <runtime-component
- id="org.jboss.ide.eclipse.as.runtime.component.40"
- version="4.0"/>
- <factory
- class="org.jboss.ide.eclipse.as.core.runtime.internal.ProjectRuntimeClasspathProvider$Factory"/>
- <type
- class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
- </adapter>
-
- <adapter>
- <runtime-component
- id="org.jboss.ide.eclipse.as.runtime.component.42"
- version="4.2"/>
- <factory
- class="org.jboss.ide.eclipse.as.core.runtime.internal.ProjectRuntimeClasspathProvider$Factory"/>
- <type
- class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
- </adapter>
</extension>
<extension
- point="org.eclipse.jdt.core.classpathContainerInitializer">
- <classpathContainerInitializer
- class="org.jboss.ide.eclipse.as.core.runtime.internal.WebtoolsProjectJBossClasspathContainerInitializer"
- id="org.jboss.ide.eclipse.as.core.runtime.ProjectInitializer"/>
- </extension>
-
- <extension point="org.eclipse.jst.server.core.runtimeClasspathProviders">
- <runtimeClasspathProvider
- id="org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget"
- runtimeTypeIds="org.jboss.ide.eclipse.as.runtime.32, org.jboss.ide.eclipse.as.runtime.40, org.jboss.ide.eclipse.as.runtime.42"
- class="org.jboss.ide.eclipse.as.core.runtime.internal.ClientAllRuntimeClasspathProvider"/>
- </extension>
- <extension
point="org.eclipse.wst.server.core.moduleTypes">
<moduleType
id="jboss.package"
18 years, 4 months
JBoss Tools SVN: r2945 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-08-07 13:38:23 -0400 (Tue, 07 Aug 2007)
New Revision: 2945
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationJSP.java
Log:
Rollback to 2434 version. It seems Viktor broke JSP Configuration.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationJSP.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationJSP.java 2007-08-07 17:06:07 UTC (rev 2944)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationJSP.java 2007-08-07 17:38:23 UTC (rev 2945)
@@ -48,8 +48,7 @@
// to define them in plugin.xml file of their
// plugins using extention point
// "org.jboss.tools.common.text.xml.contentAssistProcessor"
- IContentAssistProcessor[] superProcessors = super.getContentAssistProcessors(sourceViewer, partitionType);
-
+
ContentAssistProcessorDefinition[] defs = ContentAssistProcessorBuilder.getInstance().getContentAssistProcessorDefinitions(partitionType);
if(defs==null) return null;
@@ -70,11 +69,10 @@
(partitionType == IJSPPartitions.JSP_DEFAULT_EL) ||
(partitionType == IJSPPartitions.JSP_DEFAULT_EL2)) {
processors.add(new RedHatJSPContentAssistProcessor());
+ return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
}
- if (superProcessors != null && superProcessors.length > 0)
- processors.add(superProcessors);
- return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
+ return super.getContentAssistProcessors(sourceViewer, partitionType);
}
/*
18 years, 4 months
JBoss Tools SVN: r2944 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-08-07 13:06:07 -0400 (Tue, 07 Aug 2007)
New Revision: 2944
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java
Log:
Source path set to factory in TypeScanner.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java 2007-08-07 16:55:51 UTC (rev 2943)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java 2007-08-07 17:06:07 UTC (rev 2944)
@@ -196,6 +196,7 @@
}
SeamAnnotatedFactory factory = new SeamAnnotatedFactory();
factory.setParentDeclaration(component);
+ factory.setSourcePath(component.getSourcePath());
ds.getFactories().add(factory);
IMethod im = findIMethod(component, m);
18 years, 4 months
JBoss Tools SVN: r2943 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-08-07 12:55:51 -0400 (Tue, 07 Aug 2007)
New Revision: 2943
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
Log:
JBIDE-672
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2007-08-07 16:45:19 UTC (rev 2942)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2007-08-07 16:55:51 UTC (rev 2943)
@@ -115,10 +115,8 @@
List list = seamPromptingProvider.getList(null, "seam.is_seam_project", null, p);
if(list != null) {
AttributeValueResource resource = AttributeValueResourceFactory.getInstance().createResource(editorInput, wtpTextJspKbConnector, root, "seamVariables");
-
- System.out.println("is seam project" + getProject());
- } else {
- System.out.println("is not seam project" + getProject());
+ resource.setQuery(query, this);
+ elements.add(resource);
}
}
return root;
18 years, 4 months
JBoss Tools SVN: r2942 - trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-08-07 12:45:19 -0400 (Tue, 07 Aug 2007)
New Revision: 2942
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
Log:
JBIDE-672
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2007-08-07 16:43:48 UTC (rev 2941)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2007-08-07 16:45:19 UTC (rev 2942)
@@ -24,7 +24,6 @@
org.jboss.tools.common.text.xml,
org.jboss.tools.common.model.ui,
org.jboss.tools.jst.web,
- org.jboss.tools.seam.ui,
org.eclipse.jface,
org.eclipse.jface.text,
org.eclipse.swt,
18 years, 4 months
JBoss Tools SVN: r2941 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-08-07 12:43:48 -0400 (Tue, 07 Aug 2007)
New Revision: 2941
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariableElement.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariablesResourceElement.java
Log:
JBIDE-672
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariableElement.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariableElement.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariableElement.java 2007-08-07 16:43:48 UTC (rev 2941)
@@ -0,0 +1,27 @@
+package org.jboss.tools.jst.jsp.drop.treeviewer.model;
+
+public class SeamVariableElement extends ModelElement implements IAttributeValueContainer, IAttributeValue {
+
+ public SeamVariableElement(String name, ModelElement parent) {
+ super(name, parent);
+ }
+
+ public ModelElement[] getChildren() {
+ return new ModelElement[0];
+ }
+
+ /**
+ * @see IAttributeValue#getValue()
+ */
+ public String getValue() {
+ return "#{" + getFullName() + "}";
+ }
+
+ /**
+ * @see ModelElement#getComparedValue()
+ */
+ protected String getComparedValue() {
+ return "#{" + getFullName();
+ }
+
+}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariablesResourceElement.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariablesResourceElement.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariablesResourceElement.java 2007-08-07 16:43:48 UTC (rev 2941)
@@ -0,0 +1,39 @@
+package org.jboss.tools.jst.jsp.drop.treeviewer.model;
+
+
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.ui.IEditorInput;
+import org.jboss.tools.jst.jsp.outline.ValueHelper;
+
+public class SeamVariablesResourceElement extends AttributeValueResource {
+ IEditorInput editorInput;
+
+ SeamVariableElement[] elements = null;
+
+ public SeamVariablesResourceElement(IEditorInput editorInput, String name, ModelElement parent) {
+ super(name, parent);
+ this.editorInput = editorInput;
+ }
+
+ public ModelElement[] getChildren() {
+ if(elements != null) {
+ return elements;
+ }
+ Properties p = new Properties();
+ p.put("file", valueHelper.getFile());
+ List list = ValueHelper.seamPromptingProvider.getList(null, "seam.variables", "", p);
+ if(list == null) return EMPTY_LIST;
+ SeamVariableElement[] es = new SeamVariableElement[list.size()];
+ for (int i = 0; i < es.length; i++) {
+ es[i] = new SeamVariableElement(list.get(i).toString(), this);
+ }
+ return elements = es;
+ }
+
+ public String getName() {
+ return "Seam Variables";
+ }
+
+}
18 years, 4 months
JBoss Tools SVN: r2940 - in trunk/jst/plugins/org.jboss.tools.jst.jsp: src/org/jboss/tools/jst/jsp/drop/treeviewer/model and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-08-07 12:43:15 -0400 (Tue, 07 Aug 2007)
New Revision: 2940
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/AttributeValueResourceFactory.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/RootElement.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/ui/AttributeValueLabelProvider.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
Log:
JBIDE-672
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2007-08-07 16:35:13 UTC (rev 2939)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2007-08-07 16:43:15 UTC (rev 2940)
@@ -24,6 +24,7 @@
org.jboss.tools.common.text.xml,
org.jboss.tools.common.model.ui,
org.jboss.tools.jst.web,
+ org.jboss.tools.seam.ui,
org.eclipse.jface,
org.eclipse.jface.text,
org.eclipse.swt,
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/AttributeValueResourceFactory.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/AttributeValueResourceFactory.java 2007-08-07 16:35:13 UTC (rev 2939)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/AttributeValueResourceFactory.java 2007-08-07 16:43:15 UTC (rev 2940)
@@ -50,6 +50,8 @@
return new JsfVariablesResourceElement(name, root);
} else if(KbDinamicResource.IMAGE_FILE_TYPE.equals(type)) {
return new ImageFileResourceElement(editorInput, root);
+ } else if("seamVariables".equals(type)) {
+ return new SeamVariablesResourceElement(editorInput, "Seam Variables", root);
}
return new UnknownAttributeValueResource("Unknown resource type: " + type, root);
// throw new RuntimeException("Unknown resource type:" + type);
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/RootElement.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/RootElement.java 2007-08-07 16:35:13 UTC (rev 2939)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/RootElement.java 2007-08-07 16:43:15 UTC (rev 2940)
@@ -10,14 +10,17 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.drop.treeviewer.model;
+import java.util.List;
+
+
/**
* @author Igels
*/
public class RootElement extends ModelElement implements IAttributeValueContainer {
- private AttributeValueResource[] children;
+ private List<AttributeValueResource> children;
- public RootElement(String name, AttributeValueResource[] children) {
+ public RootElement(String name, List<AttributeValueResource> children) {
super(name, null);
this.children = children;
}
@@ -26,7 +29,7 @@
* @see IAttributeValueContainer#getChildren()
*/
public ModelElement[] getChildren() {
- return children;
+ return children.toArray(new AttributeValueResource[0]);
}
/**
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/ui/AttributeValueLabelProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/ui/AttributeValueLabelProvider.java 2007-08-07 16:35:13 UTC (rev 2939)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/ui/AttributeValueLabelProvider.java 2007-08-07 16:43:15 UTC (rev 2940)
@@ -37,6 +37,8 @@
import org.jboss.tools.jst.jsp.drop.treeviewer.model.ManagedBeanPropertyElement;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.ManagedBeansPropertiesResourceElement;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.ModelElement;
+import org.jboss.tools.jst.jsp.drop.treeviewer.model.SeamVariableElement;
+import org.jboss.tools.jst.jsp.drop.treeviewer.model.SeamVariablesResourceElement;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.ViewActionElement;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.ViewActionsResorceElement;
@@ -75,8 +77,11 @@
imagesPathes.put(ImageFileResourceElement.class, "images/struts/web_root.gif");
imagesPathes.put(ImageFolderElement.class, "images/file/closed_folder.gif");
imagesPathes.put(ImageFileElement.class, "images/file/unknow_file.gif");
- }
+ imagesPathes.put(SeamVariablesResourceElement.class, "images/seam/variables_folder.gif");
+ imagesPathes.put(SeamVariableElement.class, "images/seam/variable.gif");
+}
+
private static Map texts = new HashMap();
static {
texts.put(BundlesNameResourceElement.class, TreeViewerMessages.getString("BundlesNameResourceElement.name"));
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2007-08-07 16:35:13 UTC (rev 2939)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2007-08-07 16:43:15 UTC (rev 2940)
@@ -43,7 +43,9 @@
import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.model.project.IPromptingProvider;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.util.ModelFeatureFactory;
import org.jboss.tools.jst.jsp.support.kb.WTPTextJspKbConnector;
import org.jboss.tools.jst.web.tld.TaglibMapping;
import org.jboss.tools.jst.web.tld.VpeTaglibManager;
@@ -51,6 +53,16 @@
public class ValueHelper {
private IEditorInput editorInput = null;
private WTPTextJspKbConnector wtpTextJspKbConnector = null;
+
+ public static IPromptingProvider seamPromptingProvider;
+
+ static {
+ Object o = ModelFeatureFactory.getInstance().createFeatureInstance("org.jboss.tools.seam.internal.core.el.SeamPromptingProvider");
+ if(o instanceof IPromptingProvider) {
+ seamPromptingProvider = (IPromptingProvider)o;
+ }
+ }
+
// VpePageContext
IVisualContext pageContext = null;
WtpKbConnector pageConnector = null;
@@ -87,16 +99,28 @@
public ModelElement getInitalInput(String query) {
AttributeDescriptor descriptor = getAttributeDescriptor(query);
- if(descriptor == null) return new RootElement("root", new AttributeValueResource[0]);
+ if(descriptor == null) return new RootElement("root", new ArrayList<AttributeValueResource>());
AttributeValueDescriptor[] valueDescriptors = descriptor.getValueDesriptors();
- AttributeValueResource[] elements = new AttributeValueResource[valueDescriptors.length];
+ List<AttributeValueResource> elements = new ArrayList<AttributeValueResource>();
ModelElement root = new RootElement("root", elements);
for (int i = 0; i < valueDescriptors.length; i++) {
AttributeValueResource resource = AttributeValueResourceFactory.getInstance().createResource(editorInput, wtpTextJspKbConnector, root, valueDescriptors[i].getType());
resource.setParams(valueDescriptors[i].getParams());
resource.setQuery(query, this);
- elements[i] = resource;
+ elements.add(resource);
}
+ if(seamPromptingProvider != null && getFile() != null) {
+ Properties p = new Properties();
+ p.put("file", getFile());
+ List list = seamPromptingProvider.getList(null, "seam.is_seam_project", null, p);
+ if(list != null) {
+ AttributeValueResource resource = AttributeValueResourceFactory.getInstance().createResource(editorInput, wtpTextJspKbConnector, root, "seamVariables");
+
+ System.out.println("is seam project" + getProject());
+ } else {
+ System.out.println("is not seam project" + getProject());
+ }
+ }
return root;
}
@@ -131,6 +155,11 @@
public IEditorInput getEditorInput() {
return editorInput;
}
+
+ public IFile getFile() {
+ if(!(editorInput instanceof IFileEditorInput)) return null;
+ return ((IFileEditorInput)editorInput).getFile();
+ }
public IProject getProject() {
if(!(editorInput instanceof IFileEditorInput)) return null;
18 years, 4 months