JBoss Tools SVN: r7320 - trunk/jsf/docs/jsf_tools_ref_guide/en.
by jbosstools-commits@lists.jboss.org
Author: afedosik
Date: 2008-04-04 07:44:22 -0400 (Fri, 04 Apr 2008)
New Revision: 7320
Modified:
trunk/jsf/docs/jsf_tools_ref_guide/en/master.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-292 guide version update according JBoosTools 2.0.1GA release
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en/master.xml
===================================================================
--- trunk/jsf/docs/jsf_tools_ref_guide/en/master.xml 2008-04-04 09:37:57 UTC (rev 7319)
+++ trunk/jsf/docs/jsf_tools_ref_guide/en/master.xml 2008-04-04 11:44:22 UTC (rev 7320)
@@ -19,7 +19,7 @@
<holder>Red Hat</holder>
</copyright>
<releaseinfo>
- <para>Version: 2.0.0.GA</para>
+ <para>Version: 2.0.1.GA</para>
</releaseinfo>
</bookinfo>
17 years, 8 months
JBoss Tools SVN: r7319 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-04-04 05:37:57 -0400 (Fri, 04 Apr 2008)
New Revision: 7319
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TemplateManagingUtil.java
Log:
code adjustment
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TemplateManagingUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TemplateManagingUtil.java 2008-04-04 09:37:14 UTC (rev 7318)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TemplateManagingUtil.java 2008-04-04 09:37:57 UTC (rev 7319)
@@ -271,7 +271,7 @@
if (selection.getFocusNode() != null) {
if ((selection.getFocusNode().getNodeType() != nsIDOMNode.TEXT_NODE)
- && (selection.getFocusOffset() != 0) && (selection.getIsCollapsed())) {
+ && (selection.getFocusOffset() != 0)) {
return selection.getFocusNode().getChildNodes().item(
selection.getFocusOffset() - 1);
17 years, 8 months
JBoss Tools SVN: r7318 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-04 05:37:14 -0400 (Fri, 04 Apr 2008)
New Revision: 7318
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/AnyElementForm.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormAttributeData.java
Log:
JBIDE-1998
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/AnyElementForm.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/AnyElementForm.java 2008-04-04 09:37:02 UTC (rev 7317)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/AnyElementForm.java 2008-04-04 09:37:14 UTC (rev 7318)
@@ -171,7 +171,7 @@
}
class TableProviderImpl implements XTableProvider {
- String[] header = new String[]{"name", "value"};
+ String[] header = new String[]{"Name", "Value"};
String[][] attributes = null;
public int getColumnCount() {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormAttributeData.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormAttributeData.java 2008-04-04 09:37:02 UTC (rev 7317)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormAttributeData.java 2008-04-04 09:37:14 UTC (rev 7318)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.forms;
+import org.jboss.tools.common.meta.key.WizardKeys;
+
/**
* @author Igels
*
@@ -64,7 +66,7 @@
* For use only as table column name
*/
public String getDisplayName() {
- return (displayName == null) ? name : displayName;
+ return (displayName == null) ? WizardKeys.toDisplayName(name) : displayName;
}
public ILayoutDataFactory getLayoutDataFactory() {
17 years, 8 months
JBoss Tools SVN: r7317 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2008-04-04 05:37:02 -0400 (Fri, 04 Apr 2008)
New Revision: 7317
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml
Log:
JBIDE-1178 removed/commented out non-complete Generate entities action
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml 2008-04-04 09:36:17 UTC (rev 7316)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml 2008-04-04 09:37:02 UTC (rev 7317)
@@ -656,33 +656,14 @@
</extension>
<extension
point="org.eclipse.ui.popupMenus">
- <!--objectContribution
- id="org.hibernate.eclipse.console.objectContribution1"
- objectClass="org.eclipse.datatools.connectivity.sqm.core.rte.jdbc.JDBCTable">
- <action
- class="org.hibernate.eclipse.console.GenerateSeamEntities3"
- id="org.hibernate.eclipse.console.action2"
- label="Generate Seam Entities">
- </action>
- </objectContribution-->
- <objectContribution
+ <!--<objectContribution
id="org.hibernate.eclipse.console.objectContribution2"
objectClass="org.hibernate.mapping.Table">
<action
class="org.hibernate.eclipse.console.GenerateEntitiesAction"
id="org.hibernate.eclipse.console.action1"
label="%GenerateEntities">
- </action>
- </objectContribution>
- <!--objectContribution
- id="org.hibernate.eclipse.console.objectContribution2"
- objectClass="org.hibernate.eclipse.console.workbench.TableContainer">
- <action
- class="org.hibernate.eclipse.console.GenerateSeamEntities"
- id="org.hibernate.eclipse.console.action1"
- label="Generate Seam Entities">
- </action>
- </objectContribution-->
+ </action>-->
</extension>
<!-- <extension
point="org.eclipse.ui.themes">
17 years, 8 months
JBoss Tools SVN: r7316 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-04 05:36:17 -0400 (Fri, 04 Apr 2008)
New Revision: 7316
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/WizardKeys.java
Log:
JBIDE-1998
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/WizardKeys.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/WizardKeys.java 2008-04-04 09:35:55 UTC (rev 7315)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/WizardKeys.java 2008-04-04 09:36:17 UTC (rev 7316)
@@ -105,7 +105,8 @@
static {
String[] lcw = new String[]{"the", "web.xml", "for"};
- String[] ucw = new String[]{"tld", "uri", "jsp", "html", "url", "jsf", "xml"};
+ String[] ucw = new String[]{"tld", "uri", "jsp", "html", "url", "jsf", "xml",
+ "id", "jms", "esb", "ftp", "jbr", "fs"};
for (int i = 0; i < lcw.length; i++) LOWER_CASE_WORDS.add(lcw[i]);
for (int i = 0; i < ucw.length; i++) UPPER_CASE_WORDS.add(ucw[i]);
}
17 years, 8 months
JBoss Tools SVN: r7315 - trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-04 05:35:55 -0400 (Fri, 04 Apr 2008)
New Revision: 7315
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBListsFormLayoutData.java
Log:
JBIDE-1998
Modified: trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBListsFormLayoutData.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBListsFormLayoutData.java 2008-04-04 09:32:11 UTC (rev 7314)
+++ trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBListsFormLayoutData.java 2008-04-04 09:35:55 UTC (rev 7315)
@@ -25,7 +25,8 @@
static IFormData ESB_PROPERTY_LIST_DEFINITION = new FormData(
"Properties", //$NON-NLS-1$
ModelFormLayoutData.EMPTY_DESCRIPTION,
- new FormAttributeData[]{new FormAttributeData(ATTR_NAME, 100)},
+ //TODO maybe special ATTR_PRESENTATION needed as value may be inner XML
+ new FormAttributeData[]{new FormAttributeData(ATTR_NAME, 35), new FormAttributeData(ATTR_VALUE, 65, "Value")},
new String[]{ENT_ESB_PROPERTY},
FormLayoutDataUtil.createDefaultFormActionData("CreateActions.AddProperty") //$NON-NLS-1$
);
17 years, 8 months
JBoss Tools SVN: r7314 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-04-04 05:32:11 -0400 (Fri, 04 Apr 2008)
New Revision: 7314
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TemplateManagingUtil.java
Log:
code adjustment
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TemplateManagingUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TemplateManagingUtil.java 2008-04-04 09:32:08 UTC (rev 7313)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TemplateManagingUtil.java 2008-04-04 09:32:11 UTC (rev 7314)
@@ -271,7 +271,7 @@
if (selection.getFocusNode() != null) {
if ((selection.getFocusNode().getNodeType() != nsIDOMNode.TEXT_NODE)
- && (selection.getFocusOffset() != 0)) {
+ && (selection.getFocusOffset() != 0) && (selection.getIsCollapsed())) {
return selection.getFocusNode().getChildNodes().item(
selection.getFocusOffset() - 1);
17 years, 8 months
JBoss Tools SVN: r7313 - in trunk/seam/plugins: org.jboss.tools.seam.core/src/org/jboss/tools/seam/core and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-04-04 05:32:08 -0400 (Fri, 04 Apr 2008)
New Revision: 7313
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamContextValidationHelper.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationHelper.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationHelper.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidatorManager.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1003
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2008-04-04 08:46:10 UTC (rev 7312)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2008-04-04 09:32:08 UTC (rev 7313)
@@ -260,7 +260,7 @@
markerIdValue="seamProblem">
</markerId>
<helper
- class="org.jboss.tools.seam.internal.core.validation.SeamValidationHelper">
+ class="org.jboss.tools.seam.internal.core.validation.SeamContextValidationHelper">
</helper>
<run
class="org.jboss.tools.seam.internal.core.validation.SeamValidatorManager"
@@ -272,7 +272,24 @@
</dependentValidator>
</validator>
</extension>
-
+
+ <extension
+ point="org.eclipse.wst.validation.validator"
+ id="SeamProjectPropertyValidator"
+ name="Seam Project Property Validator">
+ <validator>
+ <filter objectClass="org.eclipse.core.resources.IFolder" nameFilter="*"/>
+ <filter objectClass="org.eclipse.core.resources.IProject" nameFilter="*"/>
+ <helper class="org.jboss.tools.seam.internal.core.validation.SeamValidationHelper"/>
+ <markerId markerIdValue="seamProblem"/>
+ <run
+ class="org.jboss.tools.seam.internal.core.validation.SeamProjectPropertyValidator"
+ incremental="true"
+ fullBuild="true"
+ />
+ </validator>
+ </extension>
+
<extension
id="seamProblem"
name="Seam Problem"
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java 2008-04-04 08:46:10 UTC (rev 7312)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java 2008-04-04 09:32:08 UTC (rev 7313)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.core;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -118,40 +119,43 @@
*
* @return the action folder (this folder is not guaranteed to exist!)
*/
- public IFolder getActionFolder() {
+ public IContainer getActionFolder() {
String folderPath = null;
if(prefs!=null) {
folderPath = prefs.get(ISeamFacetDataModelProperties.SESSION_BEAN_SOURCE_FOLDER, null);
}
- if(folderPath==null) {
+ if(folderPath==null || folderPath.length()==0) {
return getSourceFolder();
}
- return (IFolder)ResourcesPlugin.getWorkspace().getRoot().findMember(folderPath);
+ return (IContainer)ResourcesPlugin.getWorkspace().getRoot().findMember(folderPath);
}
/**
*
* @return the model folder if exists (this folder is not guaranteed to exist!)
*/
- public IFolder getModelFolder() {
+ public IContainer getModelFolder() {
String folderPath = null;
if(prefs!=null) {
folderPath = prefs.get(ISeamFacetDataModelProperties.ENTITY_BEAN_SOURCE_FOLDER, null);
}
- if(folderPath==null) {
+ if(folderPath==null || folderPath.length()==0) {
return getSourceFolder();
}
- return (IFolder)ResourcesPlugin.getWorkspace().getRoot().findMember(folderPath);
+ return (IContainer)ResourcesPlugin.getWorkspace().getRoot().findMember(folderPath);
}
- private IFolder getSourceFolder() {
+ private IContainer getSourceFolder() {
IFolder webSrcFolder = findWebSrcFolder();
if(webSrcFolder!=null) {
return webSrcFolder;
}
IJavaProject javaProject = EclipseResourceUtil.getJavaProject(war);
+ if(javaProject==null) {
+ return war;
+ }
try {
IPackageFragmentRoot[] roots = javaProject.getPackageFragmentRoots();
for (int i = 0; i < roots.length; i++) {
@@ -169,12 +173,12 @@
* Returns web contents folder.
* @return
*/
- public IFolder getViewsFolder() {
+ public IContainer getViewsFolder() {
String folderPath = null;
if(prefs!=null) {
folderPath = prefs.get(ISeamFacetDataModelProperties.WEB_CONTENTS_FOLDER, null);
}
- if(folderPath==null) {
+ if(folderPath==null || folderPath.length()==0) {
IVirtualComponent com = ComponentCore.createComponent(war);
if(com!=null) {
IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
@@ -182,26 +186,26 @@
return (IFolder)webRootFolder.getUnderlyingFolder();
}
}
- return null;
+ return getWarProject();
}
- return (IFolder)ResourcesPlugin.getWorkspace().getRoot().findMember(folderPath);
+ return (IContainer)ResourcesPlugin.getWorkspace().getRoot().findMember(folderPath);
}
/**
* Returns source folder for test cases.
* @return
*/
- public IFolder getTestsFolder() {
+ public IContainer getTestsFolder() {
String folderPath = null;
if(prefs!=null) {
folderPath = prefs.get(ISeamFacetDataModelProperties.TEST_SOURCE_FOLDER, null);
}
- if(folderPath==null) {
+ if(folderPath==null || folderPath.length()==0) {
return getSourceFolder();
}
- return (IFolder)ResourcesPlugin.getWorkspace().getRoot().findMember(folderPath);
+ return (IContainer)ResourcesPlugin.getWorkspace().getRoot().findMember(folderPath);
}
public String getEntityPackage(){
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2008-04-04 08:46:10 UTC (rev 7312)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2008-04-04 09:32:08 UTC (rev 7313)
@@ -55,6 +55,7 @@
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.internal.core.el.VariableResolver;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
import org.jboss.tools.seam.internal.core.scanner.lib.ClassPath;
import org.jboss.tools.seam.internal.core.validation.SeamValidationContext;
@@ -72,8 +73,6 @@
// boolean useDefaultRuntime = false;
- String runtimeName = null;
-
Set<IPath> sourcePaths = new HashSet<IPath>();
Map<IPath, LoadedDeclarations> sourcePaths2 = new HashMap<IPath, LoadedDeclarations>();
@@ -136,11 +135,8 @@
*
*/
public String getRuntimeName() {
- SeamRuntime runtime = getRuntime();
- if(runtime!=null) {
- return runtime.getName();
- }
- return runtimeName;
+ IEclipsePreferences p = getSeamPreferences();
+ return p.get(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, null);
}
/**
@@ -154,6 +150,7 @@
ISeamProject sp = SeamCorePlugin.getSeamProject(p, false);
return sp == null ? null : sp.getRuntime();
}
+ String runtimeName = getRuntimeName();
return runtimeName == null ? null : SeamRuntimeManager.getInstance().findRuntimeByName(runtimeName);
}
@@ -170,17 +167,21 @@
}
public void setRuntimeName(String runtimeName) {
- if(this.runtimeName == runtimeName) return;
- if(this.runtimeName != null && this.runtimeName.equals(runtimeName)) return;
- SeamRuntime d = SeamRuntimeManager.getInstance().getRuntimeForProject(project);
+ IEclipsePreferences prefs = getSeamPreferences();
+ String storedRuntimeName = getRuntimeName();
+ boolean changed = (storedRuntimeName == null) ? runtimeName != null : !storedRuntimeName.equals(runtimeName);
+ if(!changed) return;
- boolean useDefaultRuntime = d != null && d.getName().equals(runtimeName);
- if(useDefaultRuntime) {
- this.runtimeName = null;
+ if(runtimeName == null) {
+ prefs.remove(RUNTIME_NAME);
} else {
- this.runtimeName = runtimeName;
+ prefs.put(RUNTIME_NAME, runtimeName);
+ }
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
}
- storeRuntime();
}
/**
@@ -247,34 +248,9 @@
setSourcePath(project.getFullPath());
resource = project;
classPath.init();
- loadRuntime();
// load();
}
- /**
- *
- */
- void loadRuntime() {
- IEclipsePreferences prefs = getSeamPreferences();
- if(prefs == null) return;
- runtimeName = prefs.get(RUNTIME_NAME, null);
- if(runtimeName != null) {
- } else {
- storeRuntime();
- }
-// SeamCorePlugin.getDefault().getPluginPreferences().addPropertyChangeListener(new Preferences.IPropertyChangeListener() {
-// public void propertyChange(Preferences.PropertyChangeEvent event) {
-// if(SeamProjectPreferences.RUNTIME_LIST.equals(event.getProperty())) {
-// SeamRuntime d = SeamRuntimeManager.getInstance().getDefaultRuntime();
-// if(d != null && d.getName().equals(runtimeName)) {
-// runtimeName = null;
-// storeRuntime();
-// }
-// }
-// }
-// });
- }
-
IEclipsePreferences preferences = null;
/**
@@ -481,28 +457,7 @@
XMLUtilities.serialize(root, file.getAbsolutePath());
}
-
- /**
- *
- */
- void storeRuntime() {
- IEclipsePreferences prefs = getSeamPreferences();
- String runtimeName = prefs.get(RUNTIME_NAME, null);
- boolean changed = (this.runtimeName == null) ? runtimeName != null : !this.runtimeName.equals(runtimeName);
- if(!changed) return;
-
- if(this.runtimeName == null) {
- prefs.remove(RUNTIME_NAME);
- } else {
- prefs.put(RUNTIME_NAME, this.runtimeName);
- }
- try {
- prefs.flush();
- } catch (BackingStoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- }
-
+
/*
*
*/
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2008-04-04 08:46:10 UTC (rev 7312)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2008-04-04 09:32:08 UTC (rev 7313)
@@ -86,6 +86,11 @@
String SEAM_SETTINGS_VERSION = "seam.project.settings.version";
/**
+ * Seam settings version 1.0.
+ */
+ String SEAM_SETTINGS_VERSION_1_0 = "1.0";
+
+ /**
* Seam settings version 1.1.
*/
String SEAM_SETTINGS_VERSION_1_1 = "1.1";
Copied: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamContextValidationHelper.java (from rev 7241, trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationHelper.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamContextValidationHelper.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamContextValidationHelper.java 2008-04-04 09:32:08 UTC (rev 7313)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.validation;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.ui.editors.text.TextFileDocumentProvider;
+import org.jboss.tools.seam.internal.core.SeamProject;
+
+/**
+ * Helper for Seam Validators that use Seam Validator Context.
+ * @author Alexey Kazakov
+ */
+public class SeamContextValidationHelper extends SeamValidationHelper {
+
+ protected SeamValidationContext validationContext;
+ protected TextFileDocumentProvider documentProvider = new TextFileDocumentProvider();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.operations.WorkbenchContext#registerResource(org.eclipse.core.resources.IResource)
+ */
+ @Override
+ public void registerResource(IResource resource) {
+ if(resource instanceof IFile) {
+ IFile file = (IFile)resource;
+ if(!file.exists()) {
+ getValidationContext().addRemovedFile(file);
+ } else {
+ getValidationContext().registerFile(file);
+ }
+ }
+ }
+
+ /**
+ * @return Set of changed resources
+ */
+ public Set<IFile> getChangedFiles() {
+ Set<IFile> result = new HashSet<IFile>();
+ String[] uris = getURIs();
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ for (int i = 0; i < uris.length; i++) {
+ IFile currentFile = root.getFile(new Path(uris[i]));
+ result.add(currentFile);
+ }
+ result.addAll(getValidationContext().getRemovedFiles());
+ return result;
+ }
+
+ public SeamValidationContext getValidationContext() {
+ if(validationContext==null) {
+ validationContext = ((SeamProject)getSeamProject()).getValidationContext();
+ }
+ return validationContext;
+ }
+
+ public TextFileDocumentProvider getDocumentProvider(){
+ return documentProvider;
+ }
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2008-04-04 08:46:10 UTC (rev 7312)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2008-04-04 09:32:08 UTC (rev 7313)
@@ -94,7 +94,7 @@
protected static final String VALIDATING_CLASS_MESSAGE_ID = "VALIDATING_CLASS";
public SeamCoreValidator(SeamValidatorManager validatorManager,
- SeamValidationHelper coreHelper, IReporter reporter,
+ SeamContextValidationHelper coreHelper, IReporter reporter,
SeamValidationContext validationContext, ISeamProject project) {
super(validatorManager, coreHelper, reporter, validationContext, project);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-04-04 08:46:10 UTC (rev 7312)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-04-04 09:32:08 UTC (rev 7313)
@@ -76,7 +76,7 @@
private ElVarSearcher elVarSearcher;
public SeamELValidator(SeamValidatorManager validatorManager,
- SeamValidationHelper coreHelper, IReporter reporter,
+ SeamContextValidationHelper coreHelper, IReporter reporter,
SeamValidationContext validationContext, ISeamProject project) {
super(validatorManager, coreHelper, reporter, validationContext, project);
elVarSearcher = new ElVarSearcher(project, engine);
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java 2008-04-04 09:32:08 UTC (rev 7313)
@@ -0,0 +1,185 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.validation;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jdt.core.JavaConventions;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.internal.core.refactoring.SeamProjectChange;
+
+/**
+ * Validates seam project properties.
+ * @author Alexey Kazakov
+ */
+public class SeamProjectPropertyValidator implements IValidatorJob {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#getSchedulingRule(org.eclipse.wst.validation.internal.provisional.core.IValidationContext)
+ */
+ public ISchedulingRule getSchedulingRule(IValidationContext helper) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#validateInJob(org.eclipse.wst.validation.internal.provisional.core.IValidationContext, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
+ SeamValidationHelper seamHelper = (SeamValidationHelper)helper;
+ IProject project = seamHelper.getProject();
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, false);
+ if(seamProject!=null) {
+ validateSeamProject(project);
+ }
+
+ IProject[] ps = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ String projectName = project.getName();
+ for (int i = 0; i < ps.length; i++) {
+ if(ps[i]!=project) {
+ validateProject(projectName, ps[i]);
+ }
+ }
+
+ return OK_STATUS;
+ }
+
+ private void validateProject(String nameOfChangedProject, IProject checkingProject) {
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(checkingProject, false);
+ if(seamProject==null) {
+ return;
+ }
+ IEclipsePreferences pref = SeamCorePlugin.getSeamPreferences(checkingProject);
+ for (int i = 0; i < SeamProjectChange.PROJECT_NAME_PROPERTIES.length; i++) {
+ if(nameOfChangedProject.equals(pref.get(SeamProjectChange.PROJECT_NAME_PROPERTIES[i], null))) {
+ validateSeamProject(checkingProject);
+ return;
+ }
+ }
+ for (int i = 0; i < SeamProjectChange.FOLDER_PROPERTIES.length; i++) {
+ if(pref.get(SeamProjectChange.FOLDER_PROPERTIES[i], "").startsWith("/" + nameOfChangedProject + "/")) {
+ validateSeamProject(checkingProject);
+ return;
+ }
+ }
+ }
+
+ private void validateProjectName(String projectName, boolean canBeEmpty) {
+ if((canBeEmpty || (projectName!=null && projectName.length()==0)) && new Path("/").isValidSegment(projectName)) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if(project.exists()) {
+ return;
+ }
+ }
+ // Mark invalid project name
+ // TODO
+ }
+
+ private boolean isFolderPathValid(String folderPath, boolean canBeEmpty) {
+ if((canBeEmpty || (folderPath!=null && folderPath.length()==0)) && new Path("/").isValidSegment(folderPath)) {
+ IResource folder = ResourcesPlugin.getWorkspace().getRoot().findMember(folderPath);
+ if(folder!=null && (folder instanceof IContainer) && folder.exists()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void validateSorceFolder(String folderPath, String packageName) {
+ if(isFolderPathValid(folderPath, true)) {
+ if(!isPackageNameValid(packageName)) {
+ // Mark invalid source folder path
+ // TODO
+ }
+ return;
+ }
+ // Mark invalid source folder path
+ // TODO
+ }
+
+ private boolean isPackageNameValid(String packageName) {
+ if(packageName==null || packageName.length()==0) {
+ return false;
+ }
+ IStatus status = JavaConventions.validatePackageName(packageName, CompilerOptions.VERSION_1_5, CompilerOptions.VERSION_1_5);
+ if(status.getSeverity()==IStatus.ERROR) {
+ return false;
+ }
+ return true;
+ }
+
+ private boolean validateSeamProject(IProject project) {
+ IEclipsePreferences pref = SeamCorePlugin.getSeamPreferences(project);
+ String parentProject = pref.get(ISeamFacetDataModelProperties.SEAM_PARENT_PROJECT, null);
+ if(parentProject!=null) {
+ // EJB or Test project
+ validateProjectName(parentProject, false);
+ } else {
+ // War project
+ String settingVersion = pref.get(ISeamFacetDataModelProperties.SEAM_SETTINGS_VERSION, ISeamFacetDataModelProperties.SEAM_SETTINGS_VERSION_1_0);
+ String seamRuntimeName = pref.get(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, null);
+ if(seamRuntimeName==null || seamRuntimeName.length()==0 || (SeamRuntimeManager.getInstance().findRuntimeByName(seamRuntimeName) == null)) {
+ // Mark unknown runtime
+ // TODO
+ }
+
+ if(ISeamFacetDataModelProperties.DEPLOY_AS_EAR.equals(pref.get(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS, null))) {
+ validateProjectName(pref.get(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT, null), true);
+ }
+ String viewFolder = pref.get(ISeamFacetDataModelProperties.WEB_CONTENTS_FOLDER, null);
+ if(isFolderPathValid(viewFolder, true)) {
+ // Mark unknown View folder
+ // TODO
+ }
+ validateSorceFolder(pref.get(ISeamFacetDataModelProperties.ENTITY_BEAN_SOURCE_FOLDER, null),
+ pref.get(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME, null));
+
+ validateSorceFolder(pref.get(ISeamFacetDataModelProperties.SESSION_BEAN_SOURCE_FOLDER, null),
+ pref.get(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME, null));
+
+ String createTestString = pref.get(ISeamFacetDataModelProperties.TEST_CREATING, null);
+ if(settingVersion.equals(ISeamFacetDataModelProperties.SEAM_SETTINGS_VERSION_1_0) ||
+ "true".equals(createTestString)) {
+ validateProjectName(pref.get(ISeamFacetDataModelProperties.SEAM_TEST_PROJECT, null), true);
+ validateSorceFolder(pref.get(ISeamFacetDataModelProperties.TEST_SOURCE_FOLDER, null),
+ pref.get(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME, null));
+ }
+ }
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidator#cleanup(org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ public void cleanup(IReporter reporter) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidator#validate(org.eclipse.wst.validation.internal.provisional.core.IValidationContext, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
+ validateInJob(helper, reporter);
+ }
+}
\ No newline at end of file
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationHelper.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationHelper.java 2008-04-04 08:46:10 UTC (rev 7312)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationHelper.java 2008-04-04 09:32:08 UTC (rev 7313)
@@ -1,286 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.internal.core.validation;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.ui.editors.text.TextFileDocumentProvider;
-import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.seam.core.ISeamComponent;
-import org.jboss.tools.seam.core.ISeamElement;
-import org.jboss.tools.seam.core.ISeamProject;
-import org.jboss.tools.seam.core.ISeamTextSourceReference;
-import org.jboss.tools.seam.core.SeamCoreMessages;
-import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.internal.core.AbstractContextVariable;
-import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
-import org.jboss.tools.seam.internal.core.SeamProject;
-
-/**
- * Base Helper for Seam Validators.
- * @author Alexey Kazakov
- */
-public class SeamValidationHelper extends WorkbenchContext {
-
- protected SeamValidationContext validationContext;
- protected TextFileDocumentProvider documentProvider = new TextFileDocumentProvider();
-
- /**
- * @return Seam project
- */
- public ISeamProject getSeamProject() {
- ISeamProject project = null;
- try {
- project = SeamCorePlugin.getSeamProject(getProject(), true);
- } catch (Exception e) {
- SeamCorePlugin.getDefault().logError(SeamCoreMessages.SEAM_VALIDATION_HELPER_CANNOT_GET_SEAM_PROJECT, e);
- }
- return project;
- }
-
- /**
- * @return Java project
- */
- public IJavaProject getJavaProject() {
- return EclipseResourceUtil.getJavaProject(getProject());
- }
-
- /**
- * @param element
- * @return Resource of seam model element
- */
- public IResource getComponentResourceWithName(ISeamElement element) {
- if(element instanceof ISeamComponent) {
- Set declarations = ((ISeamComponent)element).getAllDeclarations();
- for (Object o : declarations) {
- SeamComponentDeclaration d = (SeamComponentDeclaration)o;
- if(d.getLocationFor(SeamComponentDeclaration.PATH_OF_NAME)!=null) {
- return d.getResource();
- }
- }
- }
- return element.getResource();
- }
-
- /**
- * @param seam model element
- * @return location of name attribute
- */
- public ISeamTextSourceReference getLocationOfName(ISeamElement element) {
- return getLocationOfAttribute(element, SeamComponentDeclaration.PATH_OF_NAME);
- }
-
- /**
- * @param seam model element
- * @return location of attribute
- */
- public ISeamTextSourceReference getLocationOfAttribute(ISeamElement element, String attributeName) {
- ISeamTextSourceReference location = null;
- if(element instanceof AbstractContextVariable) {
- location = ((AbstractContextVariable)element).getLocationFor(attributeName);
- } else if(element instanceof ISeamComponent) {
- Set declarations = ((ISeamComponent)element).getAllDeclarations();
- for (Object d : declarations) {
- location = ((SeamComponentDeclaration)d).getLocationFor(attributeName);
- if(location!=null) {
- break;
- }
- }
- } else if(element instanceof SeamComponentDeclaration) {
- location = ((SeamComponentDeclaration)element).getLocationFor(attributeName);
- }
- if(location==null && element instanceof ISeamTextSourceReference) {
- location = (ISeamTextSourceReference)element;
- }
- return location;
- }
-
- /**
- * @param resource
- * @return true if resource is Jar file
- */
- public boolean isJar(IPath path) {
- if(path == null) {
- throw new IllegalArgumentException(SeamCoreMessages.SEAM_VALIDATION_HELPER_RESOURCE_MUST_NOT_BE_NULL);
- }
- String ext = path.getFileExtension();
- return ext != null && ext.equalsIgnoreCase("jar"); //$NON-NLS-1$
- }
-
- /**
- * @param element
- * @return true if seam element packed in Jar file
- */
- public boolean isJar(ISeamElement element) {
- return isJar(element.getSourcePath());
- }
-
- /**
- * @param componentXmlFile
- * @return IType of component for <ComponentName>.component.xml
- */
- public IType getClassTypeForComponentXml(IFile componentXmlFile) {
- String className = getClassNameForComponentXml(componentXmlFile);
- if(className==null) {
- return null;
- }
- return findType(className);
- }
-
- /**
- * @param type name
- * @return IType
- */
- public IType findType(String fullyQualifiedName) {
- IProject p = getProject().getProject();
- try {
- IJavaProject jp = EclipseResourceUtil.getJavaProject(p);
- return jp.findType(fullyQualifiedName);
- } catch (JavaModelException e) {
- SeamCorePlugin.getDefault().logError(e);
- return null;
- }
- }
-
- /**
- * @param componentXmlFile
- * @return name of component class for <ComponentName>.component.xml
- */
- public String getClassNameForComponentXml(IFile componentXmlFile) {
- String fileName = componentXmlFile.getName();
- int firstDot = fileName.indexOf('.');
- if(firstDot==-1) {
- return null;
- }
- String className = fileName.substring(0, firstDot);
- IProject p = getProject().getProject();
- try {
- IJavaProject jp = EclipseResourceUtil.getJavaProject(p);
- IPackageFragment packageFragment = jp.findPackageFragment(componentXmlFile.getFullPath().removeLastSegments(1));
- if(packageFragment==null) {
- return null;
- }
- return packageFragment.getElementName() + "." + className; //$NON-NLS-1$
- } catch (JavaModelException e) {
- SeamCorePlugin.getDefault().logError(e);
- return null;
- }
- }
-
- /**
- * Find setter for property
- * @param type
- * @param propertyName
- * @return
- */
- public IMethod findSetter(IType type, String propertyName) {
- if(propertyName == null || propertyName.length()==0) {
- return null;
- }
- String firstLetter = propertyName.substring(0, 1).toUpperCase();
- String nameWithoutFirstLetter = propertyName.substring(1);
- String setterName = "set" + firstLetter + nameWithoutFirstLetter; //$NON-NLS-1$
- try {
- return findSetterInHierarchy(type, setterName);
- } catch (JavaModelException e) {
- SeamCorePlugin.getDefault().logError(e);
- }
- return null;
- }
-
- private IMethod findSetterInHierarchy(IType type, String setterName) throws JavaModelException {
- IMethod[] methods = type.getMethods();
- for (int i = 0; i < methods.length; i++) {
- if(methods[i].getElementName().equals(setterName) && methods[i].getParameterNames().length==1) {
- return methods[i];
- }
- }
- String superclassName = type.getSuperclassName();
- if(superclassName!=null) {
- String[][] packages = type.resolveType(superclassName);
- if(packages!=null) {
- for (int i = 0; i < packages.length; i++) {
- String packageName = packages[i][0];
- if(packageName!=null && packageName.length()>0) {
- packageName = packageName + "."; //$NON-NLS-1$
- } else {
- packageName = ""; //$NON-NLS-1$
- }
- String qName = packageName + packages[i][1];
- IType superclass = type.getJavaProject().findType(qName);
- if(superclass!=null) {
- IMethod method = findSetterInHierarchy(superclass, setterName);
- if(method!=null) {
- return method;
- }
- }
- }
- }
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.wst.validation.internal.operations.WorkbenchContext#registerResource(org.eclipse.core.resources.IResource)
- */
- @Override
- public void registerResource(IResource resource) {
- if(resource instanceof IFile) {
- IFile file = (IFile)resource;
- if(!file.exists()) {
- getValidationContext().addRemovedFile(file);
- } else {
- getValidationContext().registerFile(file);
- }
- }
- }
-
- /**
- * @return Set of changed resources
- */
- public Set<IFile> getChangedFiles() {
- Set<IFile> result = new HashSet<IFile>();
- String[] uris = getURIs();
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- for (int i = 0; i < uris.length; i++) {
- IFile currentFile = root.getFile(new Path(uris[i]));
- result.add(currentFile);
- }
- result.addAll(getValidationContext().getRemovedFiles());
- return result;
- }
-
- public SeamValidationContext getValidationContext() {
- if(validationContext==null) {
- validationContext = ((SeamProject)getSeamProject()).getValidationContext();
- }
- return validationContext;
- }
-
- public TextFileDocumentProvider getDocumentProvider(){
- return documentProvider;
- }
-}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationHelper.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationHelper.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationHelper.java 2008-04-04 09:32:08 UTC (rev 7313)
@@ -0,0 +1,236 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.validation;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamElement;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.ISeamTextSourceReference;
+import org.jboss.tools.seam.core.SeamCoreMessages;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.AbstractContextVariable;
+import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
+
+/**
+ * Base Helper for Seam Validators.
+ * @author Alexey Kazakov
+ */
+public class SeamValidationHelper extends WorkbenchContext {
+
+ /**
+ * @return Seam project
+ */
+ public ISeamProject getSeamProject() {
+ ISeamProject project = null;
+ try {
+ project = SeamCorePlugin.getSeamProject(getProject(), true);
+ } catch (Exception e) {
+ SeamCorePlugin.getDefault().logError(SeamCoreMessages.SEAM_VALIDATION_HELPER_CANNOT_GET_SEAM_PROJECT, e);
+ }
+ return project;
+ }
+
+ /**
+ * @return Java project
+ */
+ public IJavaProject getJavaProject() {
+ return EclipseResourceUtil.getJavaProject(getProject());
+ }
+
+ /**
+ * @param element
+ * @return Resource of seam model element
+ */
+ public IResource getComponentResourceWithName(ISeamElement element) {
+ if(element instanceof ISeamComponent) {
+ Set<ISeamComponentDeclaration> declarations = ((ISeamComponent)element).getAllDeclarations();
+ for (Object o : declarations) {
+ SeamComponentDeclaration d = (SeamComponentDeclaration)o;
+ if(d.getLocationFor(SeamComponentDeclaration.PATH_OF_NAME)!=null) {
+ return d.getResource();
+ }
+ }
+ }
+ return element.getResource();
+ }
+
+ /**
+ * @param seam model element
+ * @return location of name attribute
+ */
+ public ISeamTextSourceReference getLocationOfName(ISeamElement element) {
+ return getLocationOfAttribute(element, SeamComponentDeclaration.PATH_OF_NAME);
+ }
+
+ /**
+ * @param seam model element
+ * @return location of attribute
+ */
+ public ISeamTextSourceReference getLocationOfAttribute(ISeamElement element, String attributeName) {
+ ISeamTextSourceReference location = null;
+ if(element instanceof AbstractContextVariable) {
+ location = ((AbstractContextVariable)element).getLocationFor(attributeName);
+ } else if(element instanceof ISeamComponent) {
+ Set<ISeamComponentDeclaration> declarations = ((ISeamComponent)element).getAllDeclarations();
+ for (ISeamComponentDeclaration d : declarations) {
+ location = ((SeamComponentDeclaration)d).getLocationFor(attributeName);
+ if(location!=null) {
+ break;
+ }
+ }
+ } else if(element instanceof SeamComponentDeclaration) {
+ location = ((SeamComponentDeclaration)element).getLocationFor(attributeName);
+ }
+ if(location==null && element instanceof ISeamTextSourceReference) {
+ location = (ISeamTextSourceReference)element;
+ }
+ return location;
+ }
+
+ /**
+ * @param resource
+ * @return true if resource is Jar file
+ */
+ public boolean isJar(IPath path) {
+ if(path == null) {
+ throw new IllegalArgumentException(SeamCoreMessages.SEAM_VALIDATION_HELPER_RESOURCE_MUST_NOT_BE_NULL);
+ }
+ String ext = path.getFileExtension();
+ return ext != null && ext.equalsIgnoreCase("jar"); //$NON-NLS-1$
+ }
+
+ /**
+ * @param element
+ * @return true if seam element packed in Jar file
+ */
+ public boolean isJar(ISeamElement element) {
+ return isJar(element.getSourcePath());
+ }
+
+ /**
+ * @param componentXmlFile
+ * @return IType of component for <ComponentName>.component.xml
+ */
+ public IType getClassTypeForComponentXml(IFile componentXmlFile) {
+ String className = getClassNameForComponentXml(componentXmlFile);
+ if(className==null) {
+ return null;
+ }
+ return findType(className);
+ }
+
+ /**
+ * @param type name
+ * @return IType
+ */
+ public IType findType(String fullyQualifiedName) {
+ IProject p = getProject().getProject();
+ try {
+ IJavaProject jp = EclipseResourceUtil.getJavaProject(p);
+ return jp.findType(fullyQualifiedName);
+ } catch (JavaModelException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ return null;
+ }
+ }
+
+ /**
+ * @param componentXmlFile
+ * @return name of component class for <ComponentName>.component.xml
+ */
+ public String getClassNameForComponentXml(IFile componentXmlFile) {
+ String fileName = componentXmlFile.getName();
+ int firstDot = fileName.indexOf('.');
+ if(firstDot==-1) {
+ return null;
+ }
+ String className = fileName.substring(0, firstDot);
+ IProject p = getProject().getProject();
+ try {
+ IJavaProject jp = EclipseResourceUtil.getJavaProject(p);
+ IPackageFragment packageFragment = jp.findPackageFragment(componentXmlFile.getFullPath().removeLastSegments(1));
+ if(packageFragment==null) {
+ return null;
+ }
+ return packageFragment.getElementName() + "." + className; //$NON-NLS-1$
+ } catch (JavaModelException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ return null;
+ }
+ }
+
+ /**
+ * Find setter for property
+ * @param type
+ * @param propertyName
+ * @return
+ */
+ public IMethod findSetter(IType type, String propertyName) {
+ if(propertyName == null || propertyName.length()==0) {
+ return null;
+ }
+ String firstLetter = propertyName.substring(0, 1).toUpperCase();
+ String nameWithoutFirstLetter = propertyName.substring(1);
+ String setterName = "set" + firstLetter + nameWithoutFirstLetter; //$NON-NLS-1$
+ try {
+ return findSetterInHierarchy(type, setterName);
+ } catch (JavaModelException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ }
+ return null;
+ }
+
+ private IMethod findSetterInHierarchy(IType type, String setterName) throws JavaModelException {
+ IMethod[] methods = type.getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ if(methods[i].getElementName().equals(setterName) && methods[i].getParameterNames().length==1) {
+ return methods[i];
+ }
+ }
+ String superclassName = type.getSuperclassName();
+ if(superclassName!=null) {
+ String[][] packages = type.resolveType(superclassName);
+ if(packages!=null) {
+ for (int i = 0; i < packages.length; i++) {
+ String packageName = packages[i][0];
+ if(packageName!=null && packageName.length()>0) {
+ packageName = packageName + "."; //$NON-NLS-1$
+ } else {
+ packageName = ""; //$NON-NLS-1$
+ }
+ String qName = packageName + packages[i][1];
+ IType superclass = type.getJavaProject().findType(qName);
+ if(superclass!=null) {
+ IMethod method = findSetterInHierarchy(superclass, setterName);
+ if(method!=null) {
+ return method;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2008-04-04 08:46:10 UTC (rev 7312)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2008-04-04 09:32:08 UTC (rev 7313)
@@ -39,14 +39,14 @@
"org.eclipse.wst.validation", 0, "OK", null); //$NON-NLS-1$ //$NON-NLS-2$
protected SeamValidatorManager validationManager;
- protected SeamValidationHelper coreHelper;
+ protected SeamContextValidationHelper coreHelper;
protected IReporter reporter;
protected SeamValidationContext validationContext;
protected ISeamProject project;
protected String projectName;
public SeamValidator(SeamValidatorManager validatorManager,
- SeamValidationHelper coreHelper, IReporter reporter,
+ SeamContextValidationHelper coreHelper, IReporter reporter,
SeamValidationContext validationContext, ISeamProject project) {
this.validationManager = validatorManager;
this.coreHelper = coreHelper;
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidatorManager.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidatorManager.java 2008-04-04 08:46:10 UTC (rev 7312)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidatorManager.java 2008-04-04 09:32:08 UTC (rev 7313)
@@ -47,7 +47,7 @@
* @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#validateInJob(org.eclipse.wst.validation.internal.provisional.core.IValidationContext, org.eclipse.wst.validation.internal.provisional.core.IReporter)
*/
public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
- SeamValidationHelper coreHelper = (SeamValidationHelper)helper;
+ SeamContextValidationHelper coreHelper = (SeamContextValidationHelper)helper;
ISeamProject project = coreHelper.getSeamProject();
if(project==null) {
return OK_STATUS;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2008-04-04 08:46:10 UTC (rev 7312)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2008-04-04 09:32:08 UTC (rev 7313)
@@ -421,10 +421,12 @@
}
private boolean warning;
+ private boolean error;
private void validate() {
warning = false;
+ error = false;
if(!isSeamSupported()) {
setValid(true);
@@ -449,57 +451,64 @@
boolean deployAsEar = ISeamFacetDataModelProperties.DEPLOY_AS_EAR.equals(getValue(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS));
if(deployAsEar && !validateProjectName(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_EJB_PROJECT_DOES_NOT_EXIST,
ISeamFacetDataModelProperties.SEAM_EJB_PROJECT)) {
- return;
+// return;
}
String viewFolder = getValue(ISeamFacetDataModelProperties.WEB_CONTENTS_FOLDER).trim();
if(viewFolder.length()>0) {
IResource folder = ResourcesPlugin.getWorkspace().getRoot().findMember(viewFolder);
if(folder==null || !folder.exists()) {
- setErrorMessage(NLS.bind(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_VIEW_FOLDER_DOES_NOT_EXIST, new String[]{viewFolder}));
+ if(!error) {
+ setErrorMessage(NLS.bind(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_VIEW_FOLDER_DOES_NOT_EXIST, new String[]{viewFolder}));
+ }
+ error = true;
setValid(false);
- return;
+// return;
}
}
if(!validateSourceFolder(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_MODEL_SOURCE_FOLDER_DOES_NOT_EXIST,
ISeamFacetDataModelProperties.ENTITY_BEAN_SOURCE_FOLDER,
ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME)) {
- return;
+// return;
}
if(!validateJavaPackageName(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_MODEL_PACKAGE_IS_NOT_VALID,
SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_MODEL_PACKAGE_HAS_WARNING,
ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME)) {
- return;
+// return;
}
if(!validateSourceFolder(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_ACTION_SOURCE_FOLDER_DOES_NOT_EXIST,
ISeamFacetDataModelProperties.SESSION_BEAN_SOURCE_FOLDER,
ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME)) {
- return;
+// return;
}
if(!validateJavaPackageName(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_ACTION_PACKAGE_IS_NOT_VALID,
SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_ACTION_PACKAGE_HAS_WARNING,
ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME)) {
- return;
+// return;
}
if(isTestEnabled()) {
if(!validateSourceFolder(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_TEST_SOURCE_FOLDER_DOES_NOT_EXIST,
ISeamFacetDataModelProperties.TEST_SOURCE_FOLDER,
ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME)){
- return;
+// return;
}
if(!validateProjectName(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_TEST_PROJECT_DOES_NOT_EXIST, ISeamFacetDataModelProperties.SEAM_TEST_PROJECT)) {
- return;
+// return;
}
if(!validateJavaPackageName(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_TEST_PACKAGE_IS_NOT_VALID,
SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_TEST_PACKAGE_HAS_WARNING,
ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME)) {
- return;
+// return;
}
}
+ if(error) {
+ return;
+ }
+
setValid(true);
setErrorMessage(null);
if(!warning) {
@@ -512,12 +521,17 @@
String packageName = getValue(editorName).trim();
IStatus status = JavaConventions.validatePackageName(packageName, CompilerOptions.VERSION_1_5, CompilerOptions.VERSION_1_5);
if(status.getSeverity()==IStatus.ERROR) {
- setErrorMessage(NLS.bind(errorMessageKey, new String[]{status.getMessage()}));
+ if(!error) {
+ setErrorMessage(NLS.bind(errorMessageKey, new String[]{status.getMessage()}));
+ }
+ error = true;
setValid(false);
return false;
}
if(status.getSeverity()==IStatus.WARNING) {
- setMessage(NLS.bind(warningMessageKey, new String[]{status.getMessage()}), IMessageProvider.WARNING);
+ if(!error) {
+ setMessage(NLS.bind(warningMessageKey, new String[]{status.getMessage()}), IMessageProvider.WARNING);
+ }
warning = true;
return true;
}
@@ -529,7 +543,10 @@
String projectName = getValue(editorName).trim();
if(projectName.length()>0) {
if(!ResourcesPlugin.getWorkspace().getRoot().getProject(projectName).exists()) {
- setErrorMessage(NLS.bind(errorMessageKey, new String[]{projectName}));
+ if(!error) {
+ setErrorMessage(NLS.bind(errorMessageKey, new String[]{projectName}));
+ }
+ error = true;
setValid(false);
return false;
}
@@ -543,7 +560,10 @@
IResource folder = ResourcesPlugin.getWorkspace().getRoot().findMember(sourceFolder);
if(folder==null || !(folder instanceof IFolder) || !folder.exists()) {
editorRegistry.get(packageEditorName).setEnabled(false);
- setErrorMessage(NLS.bind(errorMessageKey, new String[]{sourceFolder}));
+ if(!error) {
+ setErrorMessage(NLS.bind(errorMessageKey, new String[]{sourceFolder}));
+ }
+ error = true;
setValid(false);
return false;
} else {
@@ -565,7 +585,7 @@
private String getSeamProjectName() {
return warProject!=null ? warProject.getName() : project.getName();
}
-
+
private String getTestProjectName() {
String projectName = "";
if(preferences!=null) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java 2008-04-04 08:46:10 UTC (rev 7312)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java 2008-04-04 09:32:08 UTC (rev 7313)
@@ -186,7 +186,7 @@
IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
if (resource!=null) {
IProject project = resource.getProject();
- if (project.getProject().isOpen()) {
+ if (project!=null && project.isOpen()) {
IJavaProject javaProject = EclipseResourceUtil.getJavaProject(project);
try {
IPackageFragmentRoot[] roots = javaProject.getPackageFragmentRoots();
17 years, 8 months
JBoss Tools SVN: r7312 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-04-04 04:46:10 -0400 (Fri, 04 Apr 2008)
New Revision: 7312
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1488
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-04-04 03:20:36 UTC (rev 7311)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-04-04 08:46:10 UTC (rev 7312)
@@ -11,7 +11,7 @@
</vpe:tag>
<vpe:tag name="f:verbatim" case-sensitive="yes">
- <vpe:if test="(@escape='false')">
+ <vpe:if test="(@escape='true')">
<vpe:template children="no" modify="yes"
class="org.jboss.tools.jsf.vpe.jsf.template.JsfVerbatim">
<vpe:dnd>
17 years, 8 months
JBoss Tools SVN: r7311 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core: util/internal and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-04-03 23:20:36 -0400 (Thu, 03 Apr 2008)
New Revision: 7311
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/GenerateArchivesTask.java
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntVariables.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java
Log:
JBIDE-1987 - reinstated the old archives ant code, and tested. Still requires unit testing but it seems to work just as it did in the last version.
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntVariables.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntVariables.java 2008-04-03 22:37:14 UTC (rev 7310)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntVariables.java 2008-04-04 03:20:36 UTC (rev 7311)
@@ -18,10 +18,13 @@
public Task getCurrentTask() { return currentTask; }
public IPath getProjectPath(String projectName) {
- HashMap<Object, Object> map = ResourceModel.getDefault().getTaskEnvironment(currentTask);
- if( map.containsKey(projectName)) return new Path((String)map.get(projectName));
- if( map.containsKey(IPath.SEPARATOR + projectName)) return new Path((String)map.get(IPath.SEPARATOR + projectName));
-
+// HashMap<Object, Object> map = ResourceModel.getDefault().getTaskEnvironment(currentTask);
+// if( map.containsKey(projectName)) return new Path((String)map.get(projectName));
+// if( map.containsKey(IPath.SEPARATOR + projectName)) return new Path((String)map.get(IPath.SEPARATOR + projectName));
+ projectName = projectName.replace(' ', '_');
+ String projectPath = System.getProperty(projectName + ".dir");
+ if (projectPath != null)
+ return new Path(projectPath);
return null;
}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/GenerateArchivesTask.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/GenerateArchivesTask.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/GenerateArchivesTask.java 2008-04-04 03:20:36 UTC (rev 7311)
@@ -0,0 +1,86 @@
+/**
+ * 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.archives.core.ant;
+
+import java.util.Iterator;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModelCore;
+
+/**
+ * @author rob.stryker <rob.stryker(a)redhat.com>
+ *
+ */
+public class GenerateArchivesTask extends Task {
+
+ private String projectPath;
+
+ public void init() throws BuildException {
+ // Force standalone mode
+ ArchivesCore standalone = new AntArchivesCore();
+ ArchivesCore.setInstance(standalone);
+ }
+
+ public void execute() throws BuildException {
+ ClassLoader original = Thread.currentThread().getContextClassLoader();
+ try {
+ IPath projectPath = new Path(this.projectPath);
+ IProgressMonitor monitor = new NullProgressMonitor();
+
+ for (Iterator iter = getProject().getProperties().keySet().iterator(); iter.hasNext(); )
+ {
+ String property = (String) iter.next();
+ if (property.endsWith(".dir")) {
+ System.setProperty(property, getProject().getProperty(property));
+ }
+ }
+
+ // needed so the correct XML binding / TrueZIP jars are loaded
+ ClassLoader myCL = getClass().getClassLoader();
+ Thread.currentThread().setContextClassLoader(myCL);
+
+ ArchivesModel.instance().registerProject(projectPath, monitor);
+ ArchivesModelCore.buildProject(projectPath, monitor);
+ } catch(RuntimeException e ) {
+ e.printStackTrace();
+ throw e;
+ }
+ finally {
+ Thread.currentThread().setContextClassLoader(original);
+ }
+ }
+
+ public String getProjectPath() {
+ return projectPath;
+ }
+
+ public void setProjectPath(String projectPath) {
+ this.projectPath = projectPath;
+ }
+}
\ No newline at end of file
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java 2008-04-03 22:37:14 UTC (rev 7310)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java 2008-04-04 03:20:36 UTC (rev 7311)
@@ -238,8 +238,11 @@
IArchive node2 = ((IArchive)node);
boolean exploded = ((IArchive)node).isExploded();
ArchiveDetector detector = exploded ? ArchiveDetector.NULL : TrueZipUtil.getJarArchiveDetector();
- if( parentFile == null )
- return new File(node2.getGlobalDestinationPath().append(node2.getName()).toOSString(), detector);
+ if( parentFile == null ) {
+ IPath p = node2.getGlobalDestinationPath();
+ if( p == null ) return null;
+ return new File(p.append(node2.getName()).toOSString(), detector);
+ }
return new File(parentFile, node2.getName(), detector);
}
if( node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER ) {
17 years, 8 months