JBoss Tools SVN: r10933 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-10-17 12:40:54 -0400 (Fri, 17 Oct 2008)
New Revision: 10933
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2731
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java 2008-10-17 16:35:57 UTC (rev 10932)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java 2008-10-17 16:40:54 UTC (rev 10933)
@@ -189,9 +189,9 @@
}
}
- public static void copyFiles(File source, File dest, FileFilter filter) {
+ public static void copyFiles(File source, File dest, FileFilter filter, boolean override) {
dest.mkdir();
-
+
File[] listFiles = source.listFiles(filter);
if(listFiles==null) {
throw new IllegalArgumentException(NLS.bind(SeamCoreMessages.ANT_COPY_UTILS_COULD_NOT_FIND_FOLDER,source));
@@ -199,12 +199,16 @@
for (File file:listFiles) {
if(file.isDirectory())continue;
try {
- FileUtils.getFileUtils().copyFile(file, new File(dest,file.getName()),new FilterSetCollection(),true);
+ FileUtils.getFileUtils().copyFile(file, new File(dest, file.getName()), new FilterSetCollection(), override);
} catch (IOException e) {
SeamCorePlugin.getPluginLog().logError(e);
}
}
}
+
+ public static void copyFiles(File source, File dest, FileFilter filter) {
+ copyFiles(source, dest, filter, true);
+ }
public static void copyFiles(String[] files, File dest) {
copyFiles(files,dest, true);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2008-10-17 16:35:57 UTC (rev 10932)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2008-10-17 16:40:54 UTC (rev 10933)
@@ -13,8 +13,6 @@
import java.io.File;
import java.util.Iterator;
-import org.apache.tools.ant.types.FilterSet;
-import org.apache.tools.ant.types.FilterSetCollection;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -36,7 +34,17 @@
// TODO: why not just *one* global filter set to avoid any missing names ? (assert for it in our unittests!
public class Seam2FacetInstallDelegate extends SeamFacetAbstractInstallDelegate{
- public static AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_WAR_CONFIG = new AntCopyUtils.FileSet()
+ public static final AntCopyUtils.FileSet JBOSS_EAR_CONTENT = new AntCopyUtils.FileSet()
+ .include("antlr-runtime.jar") //$NON-NLS-1$
+ .include("drools-compiler.*\\.jar") //$NON-NLS-1$
+ .include("drools-core.*\\.jar") //$NON-NLS-1$
+ .include("jboss-seam.jar") //$NON-NLS-1$
+ .include("jboss-el.*.jar") //$NON-NLS-1$
+ .include("mvel.*\\.jar") //$NON-NLS-1$
+ .include("jbpm-jpdl.*\\.jar") //$NON-NLS-1$
+ .include("richfaces-api.*\\.jar"); //$NON-NLS-1$
+
+ public static final AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_WAR_CONFIG = new AntCopyUtils.FileSet()
.include("ajax4jsf.*\\.jar") //$NON-NLS-1$
.include("richfaces.*\\.jar")
.include("antlr-runtime.*\\.jar") //$NON-NLS-1$
@@ -63,7 +71,7 @@
.include("mvel.*\\.jar") //$NON-NLS-1$
.include("jboss-el.jar"); //$NON-NLS-1$
- public static AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_EAR_CONFIG = new AntCopyUtils.FileSet()
+ public static final AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_EAR_CONFIG = new AntCopyUtils.FileSet()
.include("richfaces-impl\\.jar") //$NON-NLS-1$
.include("richfaces-ui\\.jar") //$NON-NLS-1$
.include("commons-beanutils\\.jar") //$NON-NLS-1$
@@ -85,14 +93,7 @@
@Override
protected void doExecuteForEjb(final IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException {
- FilterSet jdbcFilterSet = SeamFacetFilterSetFactory.createJdbcFilterSet(model);
- FilterSet projectFilterSet = SeamFacetFilterSetFactory.createProjectFilterSet(model);
- ejbViewFilterSetCollection = new FilterSetCollection();
- ejbViewFilterSetCollection.addFilterSet(jdbcFilterSet);
- ejbViewFilterSetCollection.addFilterSet(projectFilterSet);
-
super.doExecuteForEjb(project, fv, model, monitor);
-
IResource src = getSrcFolder(project);
if(src!=null && seamHomeFolder!=null) {
File srcFile = src.getLocation().toFile();
@@ -125,6 +126,20 @@
/*
* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#fillEarContents()
+ */
+ @Override
+ protected void fillEarContents() {
+ final File droolsLibFolder = new File(seamHomePath, DROOLS_LIB_SEAM_RELATED_PATH);
+ AntCopyUtils.copyFiles(seamHomeFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamHomeFolder)), false);
+ AntCopyUtils.copyFiles(seamLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)), false);
+ AntCopyUtils.copyFiles(droolsLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(droolsLibFolder)), false);
+ AntCopyUtils.copyFiles(seamLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)), false);
+ AntCopyUtils.copyFiles(seamGenResFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamGenResFolder)), false);
+ }
+
+ /*
+ * (non-Javadoc)
* @see org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#configureFacesConfigXml(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IProgressMonitor, java.lang.String)
*/
@Override
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2008-10-17 16:35:57 UTC (rev 10932)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2008-10-17 16:40:54 UTC (rev 10933)
@@ -48,16 +48,6 @@
.exclude(".*/CVS") //$NON-NLS-1$
.exclude(".*/\\.svn"); //$NON-NLS-1$
- private static AntCopyUtils.FileSet JBOSS_EAR_CONTENT = new AntCopyUtils.FileSet()
- .include("antlr-runtime.jar") //$NON-NLS-1$
- .include("drools-compiler.*\\.jar") //$NON-NLS-1$
- .include("drools-core.*\\.jar") //$NON-NLS-1$
- .include("jboss-seam.jar") //$NON-NLS-1$
- .include("jboss-el.*.jar") //$NON-NLS-1$
- .include("mvel.*\\.jar") //$NON-NLS-1$
- .include("jbpm-jpdl.*\\.jar") //$NON-NLS-1$
- .include("richfaces-api.*\\.jar"); //$NON-NLS-1$
-
/**
* @param model Seam facet data model
* @param seamWebProject Seam web project
@@ -186,6 +176,6 @@
}
protected AntCopyUtils.FileSet getJbossEarContent() {
- return JBOSS_EAR_CONTENT;
+ return Seam2FacetInstallDelegate.JBOSS_EAR_CONTENT;
}
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-10-17 16:35:57 UTC (rev 10932)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-10-17 16:40:54 UTC (rev 10933)
@@ -326,19 +326,8 @@
*/
protected void copyFilesToWarProject(IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException {
- final FilterSet jdbcFilterSet = SeamFacetFilterSetFactory.createJdbcFilterSet(model);
- final FilterSet projectFilterSet = SeamFacetFilterSetFactory.createProjectFilterSet(model);
- final FilterSet filtersFilterSet = SeamFacetFilterSetFactory.createFiltersFilterSet(model);
- // ****************************************************************
- // Copy view folder from seam-gen installation to WebContent folder
- // ****************************************************************
final AntCopyUtils.FileSet viewFileSet = new AntCopyUtils.FileSet(VIEW_FILESET).dir(seamGenViewSource);
- final FilterSetCollection viewFilterSetCollection = new FilterSetCollection();
- viewFilterSetCollection.addFilterSet(jdbcFilterSet);
- viewFilterSetCollection.addFilterSet(projectFilterSet);
- viewFilterSetCollection.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
-
AntCopyUtils.copyFilesAndFolders(
seamGenViewSource,
webContentFolder,
@@ -436,6 +425,8 @@
}
}
+ protected File earContentsFolder;
+
/**
*
* @param project
@@ -446,61 +437,50 @@
*/
protected void doExecuteForEar(IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException {
-/*
if(seamHomePath==null) {
return;
}
model.setProperty(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT, project.getName());
IVirtualComponent component = ComponentCore.createComponent(project);
IVirtualFolder rootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
- IContainer earContentsContainer = rootVirtFolder.getUnderlyingFolder();
- File earContentsFolder = earContentsFolder.getAbsoluteFile();
+ earContentsFolder = rootVirtFolder.getUnderlyingFolder().getLocation().toFile();
+ File metaInfFolder = new File(earContentsFolder, "META-INF"); //$NON-NLS-1$
+ File applicationXml = new File(metaInfFolder, "application.xml");
File earProjectFolder = project.getLocation().toFile();
- File ejbTemplateDir;
- AntCopyUtils.FileSet excludeCvsSvn;
-
- try {
- ejbTemplateDir = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "ejb");
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- excludeCvsSvn = new AntCopyUtils.FileSet(SeamFacetAbstractInstallDelegate.CVS_SVN).dir(ejbTemplateDir);
-
FilterSet earFilterSet = new FilterSet();
earFilterSet.addFilter("projectName", project.getName() + ".ear"); //$NON-NLS-1$ //$NON-NLS-2$
AntCopyUtils.copyFileToFolder(
new File(seamGenResFolder, "META-INF/jboss-app.xml"), //$NON-NLS-1$
- new File(earContentsFolder, "META-INF"), //$NON-NLS-1$
- new FilterSetCollection(earFilterSet), false);
+ metaInfFolder, new FilterSetCollection(earFilterSet), false);
+ if(!applicationXml.exists()) {
+ // TODO configure application.xml
+ }
// Copy configuration files from template
try {
AntCopyUtils.copyFilesAndFolders(
new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "ear"), //$NON-NLS-1$
- earProjectFolder, new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
- new FilterSetCollection(ejbFilterSet), true);
+ earProjectFolder, new FilterSetCollection(ejbFilterSet), false);
} catch (IOException e) {
SeamCorePlugin.getPluginLog().logError(e);
}
- // Fill ear contents
- AntCopyUtils.copyFiles(seamHomeFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(getJbossEarContent()).dir(seamHomeFolder)));
- AntCopyUtils.copyFiles(seamLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(getJbossEarContent()).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(droolsLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(getJbossEarContent()).dir(droolsLibFolder)));
- AntCopyUtils.copyFiles(seamLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(getJbossEarContent()).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(seamGenResFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(getJbossEarContent()).dir(seamGenResFolder)));
+ fillEarContents();
File resources = new File(earProjectFolder, "resources");
AntCopyUtils.copyFileToFile(
- dataSourceDsFile,
- new File(resources, seamWebProject.getName() + "-ds.xml"), //$NON-NLS-1$ //$NON-NLS-2$
- viewFilterSetCollection, true);
-*/
+ dataSourceDsFile, new File(resources, project.getName() + "-ds.xml"), //$NON-NLS-1$
+ viewFilterSetCollection, false);
}
+ /**
+ * Fill ear contents
+ */
+ abstract protected void fillEarContents();
+
protected IResource getSrcFolder(IProject project) throws JavaModelException {
IJavaProject javaProject = EclipseResourceUtil.getJavaProject(project);
@@ -517,8 +497,6 @@
return null;
}
- protected FilterSetCollection ejbViewFilterSetCollection;
-
/**
*
* @param project
@@ -545,11 +523,9 @@
IResource src = getSrcFolder(project);
if(src!=null) {
- if(ejbViewFilterSetCollection==null) {
- ejbViewFilterSetCollection = new FilterSetCollection();
- ejbViewFilterSetCollection.addFilterSet(jdbcFilterSet);
- ejbViewFilterSetCollection.addFilterSet(projectFilterSet);
- }
+ viewFilterSetCollection = new FilterSetCollection();
+ viewFilterSetCollection.addFilterSet(jdbcFilterSet);
+ viewFilterSetCollection.addFilterSet(projectFilterSet);
File srcFile = src.getLocation().toFile();
// Copy sources to EJB project in case of EAR configuration
@@ -561,7 +537,7 @@
File persistentXml = new File(srcFile, "META-INF/persistence.xml"); //$NON-NLS-1$
if(!persistentXml.exists()) {
AntCopyUtils.copyFileToFile(persistenceFile, new File(srcFile, "META-INF/persistence.xml"), //$NON-NLS-1$
- ejbViewFilterSetCollection, false);
+ viewFilterSetCollection, false);
} else {
// TODO modify persistence.xml
}
@@ -572,18 +548,16 @@
}
AntCopyUtils.FileSet ejbSrcResourcesSet = new AntCopyUtils.FileSet(JBOOS_EJB_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
- AntCopyUtils.copyFilesAndFolders(seamGenResFolder, srcFile, new AntCopyUtils.FileSetFileFilter(ejbSrcResourcesSet), ejbViewFilterSetCollection, false);
+ AntCopyUtils.copyFilesAndFolders(seamGenResFolder, srcFile, new AntCopyUtils.FileSetFileFilter(ejbSrcResourcesSet), viewFilterSetCollection, false);
File ejbJarXml = new File(srcFile, "META-INF/ejb-jar.xml");
if(!ejbJarXml.exists()) {
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "META-INF/ejb-jar.xml"), //$NON-NLS-1$
- new File(srcFile, "META-INF"), ejbViewFilterSetCollection, false); //$NON-NLS-1$
+ new File(srcFile, "META-INF"), viewFilterSetCollection, false); //$NON-NLS-1$
} else {
// TODO modify ejb-jar.xml
}
}
- FilterSet ejbFilterSet = new FilterSet();
- ejbFilterSet.addFilter("projectName", ejbProjectFolder.getName()); //$NON-NLS-1$
AntCopyUtils.copyFileToFile(hibernateConsoleLaunchFile, new File(
ejbProjectFolder, ejbProjectFolder.getName() + ".launch"), //$NON-NLS-1$
@@ -600,6 +574,11 @@
}
protected ProjectType projectType;
+ protected FilterSet ejbFilterSet;
+ protected FilterSetCollection viewFilterSetCollection;
+ protected FilterSet jdbcFilterSet;
+ protected FilterSet projectFilterSet;
+ protected FilterSet filtersFilterSet;
/**
*
@@ -611,7 +590,6 @@
*/
public void doExecute(final IProject project, IProjectFacetVersion fv,
Object config, IProgressMonitor monitor) throws CoreException {
- ejbViewFilterSetCollection = null;
final IDataModel model = (IDataModel)config;
IFacetedProject facetedProject = ProjectFacetsManager.create(project);
IProjectFacetVersion ejbVersion = facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.EJB_FACET);
@@ -631,6 +609,19 @@
model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO, "create-drop"); //$NON-NLS-1$
}
+ jdbcFilterSet = SeamFacetFilterSetFactory.createJdbcFilterSet(model);
+ projectFilterSet = SeamFacetFilterSetFactory.createProjectFilterSet(model);
+ filtersFilterSet = SeamFacetFilterSetFactory.createFiltersFilterSet(model);
+
+ // ****************************************************************
+ // Copy view folder from seam-gen installation to WebContent folder
+ // ****************************************************************
+ final AntCopyUtils.FileSet viewFileSet = new AntCopyUtils.FileSet(VIEW_FILESET).dir(seamGenViewSource);
+ viewFilterSetCollection = new FilterSetCollection();
+ viewFilterSetCollection.addFilterSet(jdbcFilterSet);
+ viewFilterSetCollection.addFilterSet(projectFilterSet);
+ viewFilterSetCollection.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
+
Object runtimeName = model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME);
if(runtimeName!=null) {
final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(runtimeName.toString());
@@ -650,6 +641,19 @@
hibernateConsolePropsFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.properties"); //$NON-NLS-1$
//final File hibernateConsolePref = new File(seamGenHomeFolder, "hibernatetools/.settings/org.hibernate.eclipse.console.prefs"); //$NON-NLS-1$
persistenceFile = new File(seamGenResFolder, "META-INF/persistence-" + (isWarConfiguration(model) ? DEV_WAR_PROFILE : DEV_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ ejbFilterSet = new FilterSet();
+ ejbFilterSet.addFilter("projectName", project.getName()); //$NON-NLS-1$
+ String serverRuntimeName = WtpUtils.getServerRuntimeName(project);
+ if(serverRuntimeName!=null) {
+ ejbFilterSet.addFilter("runtimeName", serverRuntimeName); //$NON-NLS-1$
+ }
+ if (model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH) != null) {
+ File driver = new File(((String[]) model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH))[0]);
+ ejbFilterSet.addFilter("driverJar", " " + driver.getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ ejbFilterSet.addFilter("driverJar", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
} else {
seamHomePath = null;
}
@@ -665,9 +669,11 @@
doExecuteForEar(project, fv, model, monitor);
}
- ClasspathHelper.addClasspathEntries(project, fv);
- createSeamProjectPreferenes(project, model);
- EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
+ if(projectType != ProjectType.EAR) {
+ ClasspathHelper.addClasspathEntries(project, fv);
+ createSeamProjectPreferenes(project, model);
+ EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
+ }
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
@@ -749,9 +755,6 @@
*/
protected void createSeamProjectPreferenes(final IProject project,
final IDataModel model) {
- if(projectType == ProjectType.EAR) {
- return;
- }
IScopeContext projectScope = new ProjectScope(project);
IEclipsePreferences prefs = projectScope.getNode(SeamCorePlugin.PLUGIN_ID);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2008-10-17 16:35:57 UTC (rev 10932)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2008-10-17 16:40:54 UTC (rev 10933)
@@ -48,6 +48,20 @@
private static final String ORG_AJAX4JSF_SKIN = "org.ajax4jsf.SKIN";
+ public static final AntCopyUtils.FileSet JBOSS_EAR_CONTENT = new AntCopyUtils.FileSet()
+ .include("antlr.*\\.jar") //$NON-NLS-1$
+ .include("commons-jci-core.*\\.jar") //$NON-NLS-1$
+ .include("commons-jci-janino.*\\.jar") //$NON-NLS-1$
+ .include("drools-compiler.*\\.jar") //$NON-NLS-1$
+ .include("drools-core.*\\.jar") //$NON-NLS-1$
+ .include("janino.*\\.jar") //$NON-NLS-1$
+ .include("jboss-seam.jar") //$NON-NLS-1$
+ .include("jbpm.*\\.jar") //$NON-NLS-1$
+ .include("security\\.drl") //$NON-NLS-1$
+ .include("stringtemplate.*\\.jar") //$NON-NLS-1$
+ // el-ri needed for JBIDE-939
+ .include("el-ri.*\\.jar"); //$NON-NLS-1$
+
public static final AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_WAR_CONFIG = new AntCopyUtils.FileSet()
.include("ajax4jsf.*\\.jar") //$NON-NLS-1$
.include("richfaces.*\\.jar") //$NON-NLS-1$
@@ -74,7 +88,7 @@
// el-ri needed for JBIDE-939
.include("el-ri.*\\.jar"); //$NON-NLS-1$
- public static AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_EAR_CONFIG = new AntCopyUtils.FileSet()
+ public static final AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_EAR_CONFIG = new AntCopyUtils.FileSet()
.include("ajax4jsf.*\\.jar") //$NON-NLS-1$
.include("richfaces.*\\.jar") //$NON-NLS-1$
.include("commons-beanutils.*\\.jar") //$NON-NLS-1$
@@ -125,6 +139,20 @@
/*
* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#fillEarContents()
+ */
+ @Override
+ protected void fillEarContents() {
+ final File droolsLibFolder = new File(seamHomePath, DROOLS_LIB_SEAM_RELATED_PATH);
+ AntCopyUtils.copyFiles(seamHomeFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamHomeFolder)), false);
+ AntCopyUtils.copyFiles(seamLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)), false);
+ AntCopyUtils.copyFiles(droolsLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(droolsLibFolder)), false);
+ AntCopyUtils.copyFiles(seamLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)), false);
+ AntCopyUtils.copyFiles(seamGenResFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamGenResFolder)), false);
+ }
+
+ /*
+ * (non-Javadoc)
* @see org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#configureFacesConfigXml(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IProgressMonitor, java.lang.String)
*/
@Override
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2008-10-17 16:35:57 UTC (rev 10932)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2008-10-17 16:40:54 UTC (rev 10933)
@@ -63,20 +63,6 @@
.exclude(".*/CVS") //$NON-NLS-1$
.exclude(".*/\\.svn"); //$NON-NLS-1$
- private static AntCopyUtils.FileSet JBOSS_EAR_CONTENT = new AntCopyUtils.FileSet()
- .include("antlr.*\\.jar") //$NON-NLS-1$
- .include("commons-jci-core.*\\.jar") //$NON-NLS-1$
- .include("commons-jci-janino.*\\.jar") //$NON-NLS-1$
- .include("drools-compiler.*\\.jar") //$NON-NLS-1$
- .include("drools-core.*\\.jar") //$NON-NLS-1$
- .include("janino.*\\.jar") //$NON-NLS-1$
- .include("jboss-seam.jar") //$NON-NLS-1$
- .include("jbpm.*\\.jar") //$NON-NLS-1$
- .include("security\\.drl") //$NON-NLS-1$
- .include("stringtemplate.*\\.jar") //$NON-NLS-1$
- // el-ri needed for JBIDE-939
- .include("el-ri.*\\.jar"); //$NON-NLS-1$
-
protected IDataModel model;
protected IProject seamWebProject;
protected SeamRuntime seamRuntime;
@@ -198,7 +184,7 @@
}
protected AntCopyUtils.FileSet getJbossEarContent() {
- return JBOSS_EAR_CONTENT;
+ return SeamFacetInstallDelegate.JBOSS_EAR_CONTENT;
}
/**
16 years, 2 months
JBoss Tools SVN: r10932 - trunk/jsf/features/org.jboss.tools.richfaces.feature.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-10-17 12:35:57 -0400 (Fri, 17 Oct 2008)
New Revision: 10932
Modified:
trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml
Log:
Unshared plugin jsf.ext.text.richfaces removed from build to keep it running
Modified: trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml
===================================================================
--- trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml 2008-10-17 15:31:50 UTC (rev 10931)
+++ trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml 2008-10-17 16:35:57 UTC (rev 10932)
@@ -307,12 +307,6 @@
version="0.0.0"/>
<plugin
- id="org.jboss.tools.jsf.text.ext.richfaces"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
id="org.jboss.tools.jsf.ui"
download-size="0"
install-size="0"
16 years, 2 months
JBoss Tools SVN: r10931 - trunk/seam/docs/reference/en/images/crud_database_application.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-10-17 11:31:50 -0400 (Fri, 17 Oct 2008)
New Revision: 10931
Added:
trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_14.png
Log:
https://jira.jboss.org/jira/browse/JBDS-446 - adding new screen;
Added: trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_14.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_14.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 2 months
JBoss Tools SVN: r10930 - trunk/seam/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-10-17 11:29:08 -0400 (Fri, 17 Oct 2008)
New Revision: 10930
Modified:
trunk/seam/docs/reference/en/modules/crud_database_application.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-446 - adding new screen;
Modified: trunk/seam/docs/reference/en/modules/crud_database_application.xml
===================================================================
--- trunk/seam/docs/reference/en/modules/crud_database_application.xml 2008-10-17 15:17:31 UTC (rev 10929)
+++ trunk/seam/docs/reference/en/modules/crud_database_application.xml 2008-10-17 15:29:08 UTC (rev 10930)
@@ -286,7 +286,18 @@
</emphasis> will be created.</para>
</listitem>
</itemizedlist>
-
+
+ <figure>
+ <title>CRUDAPP Seam Project</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata
+ fileref="images/crud_database_application/crud_database_application_14.png"
+ />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
<itemizedlist>
<listitem>
<para>Have a look at the created projects. You can expand
16 years, 2 months
JBoss Tools SVN: r10929 - trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2008-10-17 11:17:31 -0400 (Fri, 17 Oct 2008)
New Revision: 10929
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java
Log:
JBIDE-2922
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java 2008-10-17 14:38:07 UTC (rev 10928)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java 2008-10-17 15:17:31 UTC (rev 10929)
@@ -21,12 +21,19 @@
import org.eclipse.core.internal.resources.File;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.internal.core.JavaElement;
+import org.eclipse.jdt.internal.core.JavaElementInfo;
+import org.eclipse.jdt.internal.core.JavaProject;
+import org.eclipse.jdt.internal.core.PackageFragment;
+import org.eclipse.jdt.internal.core.PackageFragmentRoot;
import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextSelection;
@@ -193,37 +200,85 @@
Iterator it = treeSelection.iterator();
while (it.hasNext()) {
Object obj = it.next();
- if (obj instanceof ICompilationUnit) {
- ICompilationUnit cu = (ICompilationUnit)obj;
- addCompilationUnit(cu);
- }
- else if (obj instanceof File) {
- File file = (File)obj;
- if (file != null && file.getProject() != null) {
- IJavaProject javaProject = JavaCore.create(file.getProject());
- ICompilationUnit[] cus = Utils.findCompilationUnits(javaProject,
- file.getFullPath());
- if (cus != null) {
- for (int i = 0; i < cus.length; i++) {
- addCompilationUnit(cus[i]);
- }
- }
+ processJavaElements(obj);
+ }
+ }
+ else {
+ //System.out.println("2 Blah! " + selection); //$NON-NLS-1$
+ selection = null;
+ }
+ }
+
+ protected void processJavaElements(Object obj) {
+ if (obj instanceof ICompilationUnit) {
+ ICompilationUnit cu = (ICompilationUnit)obj;
+ addCompilationUnit(cu);
+ }
+ else if (obj instanceof File) {
+ File file = (File)obj;
+ if (file != null && file.getProject() != null) {
+ IJavaProject javaProject = JavaCore.create(file.getProject());
+ ICompilationUnit[] cus = Utils.findCompilationUnits(javaProject,
+ file.getFullPath());
+ if (cus != null) {
+ for (int i = 0; i < cus.length; i++) {
+ addCompilationUnit(cus[i]);
}
}
- else if (obj instanceof JavaElement) {
- JavaElement javaElement = (JavaElement)obj;
- ICompilationUnit cu = javaElement.getCompilationUnit();
- addCompilationUnit(cu);
+ }
+ }
+ else if (obj instanceof JavaProject) {
+ JavaProject javaProject = (JavaProject)obj;
+ IPackageFragmentRoot[] pfr = null;
+ try {
+ pfr = javaProject.getAllPackageFragmentRoots();
+ } catch (JavaModelException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
+ }
+ if (pfr != null) {
+ for (int i = 0; i < pfr.length; i++) {
+ processJavaElements(pfr[i]);
}
- else {
- // ignore
- //System.out.println("1 Blah! " + selection); //$NON-NLS-1$
+ }
+ }
+ else if (obj instanceof PackageFragment) {
+ PackageFragment packageFragment = (PackageFragment)obj;
+ ICompilationUnit[] cus = null;
+ try {
+ cus = packageFragment.getCompilationUnits();
+ } catch (JavaModelException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
+ }
+ if (cus != null) {
+ for (int i = 0; i < cus.length; i++) {
+ addCompilationUnit(cus[i]);
}
}
}
+ else if (obj instanceof PackageFragmentRoot) {
+ PackageFragmentRoot packageFragmentRoot = (PackageFragmentRoot)obj;
+ JavaElement javaElement = (JavaElement)obj;
+ JavaElementInfo javaElementInfo = null;
+ try {
+ javaElementInfo = (JavaElementInfo)javaElement.getElementInfo();
+ } catch (JavaModelException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
+ }
+ if (javaElementInfo != null) {
+ IJavaElement[] je = javaElementInfo.getChildren();
+ for (int i = 0; i < je.length; i++) {
+ processJavaElements(je[i]);
+ }
+ }
+ }
+ else if (obj instanceof JavaElement) {
+ JavaElement javaElement = (JavaElement)obj;
+ ICompilationUnit cu = javaElement.getCompilationUnit();
+ addCompilationUnit(cu);
+ }
else {
- //System.out.println("2 Blah! " + selection); //$NON-NLS-1$
- selection = null;
+ // ignore
+ //System.out.println("1 Blah! " + selection); //$NON-NLS-1$
}
}
}
16 years, 2 months
JBoss Tools SVN: r10928 - trunk/jsf/features/org.jboss.tools.jsf.feature.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-10-17 10:38:07 -0400 (Fri, 17 Oct 2008)
New Revision: 10928
Modified:
trunk/jsf/features/org.jboss.tools.jsf.feature/feature.xml
Log:
Share project 'org.jboss.tools.jsf.text.ext.richfaces' into 'https://svn.jboss.org/repos/jbosstools/trunk'
JBIDE-1898 OpenOns for attributes of richfaces tags
JBIDE-2406 openon doesn't work for "viewId" attribute of <a4j:include> component.
Added to the org.jboss.tools.jsf.feature feature
Modified: trunk/jsf/features/org.jboss.tools.jsf.feature/feature.xml
===================================================================
--- trunk/jsf/features/org.jboss.tools.jsf.feature/feature.xml 2008-10-17 14:21:42 UTC (rev 10927)
+++ trunk/jsf/features/org.jboss.tools.jsf.feature/feature.xml 2008-10-17 14:38:07 UTC (rev 10928)
@@ -250,6 +250,12 @@
version="0.0.0"/>
<plugin
+ id="org.jboss.tools.jsf.text.ext.richfaces"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
id="org.jboss.tools.jsf.vpe.facelets"
download-size="0"
install-size="0"
16 years, 2 months
JBoss Tools SVN: r10927 - trunk/jsf/features/org.jboss.tools.richfaces.feature.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-10-17 10:21:42 -0400 (Fri, 17 Oct 2008)
New Revision: 10927
Modified:
trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml
Log:
Share project 'org.jboss.tools.jsf.text.ext.richfaces' into 'https://svn.jboss.org/repos/jbosstools/trunk'
JBIDE-1898 OpenOns for attributes of richfaces tags
JBIDE-2406 openon doesn't work for "viewId" attribute of <a4j:include> component.
Added to the org.jboss.tools.richfaces.feature feature
Modified: trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml
===================================================================
--- trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml 2008-10-17 14:00:17 UTC (rev 10926)
+++ trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml 2008-10-17 14:21:42 UTC (rev 10927)
@@ -307,6 +307,12 @@
version="0.0.0"/>
<plugin
+ id="org.jboss.tools.jsf.text.ext.richfaces"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
id="org.jboss.tools.jsf.ui"
download-size="0"
install-size="0"
16 years, 2 months
JBoss Tools SVN: r10926 - trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-10-17 10:00:17 -0400 (Fri, 17 Oct 2008)
New Revision: 10926
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamBigProjectTest.java
Log:
JBIDE-1982
Added performance test for validating a long page in a large project.
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamBigProjectTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamBigProjectTest.java 2008-10-17 13:49:56 UTC (rev 10925)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamBigProjectTest.java 2008-10-17 14:00:17 UTC (rev 10926)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.core.test;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.net.URL;
@@ -18,19 +19,23 @@
import junit.framework.TestCase;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.common.test.util.TestProjectProvider;
+import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.test.util.JUnitUtils;
import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
import org.osgi.framework.Bundle;
/**
@@ -102,6 +107,8 @@
+ "of seam model loading than in the beginning.\n"
+ "That implies that time depends as N*N on the number of components N.");
}
+
+ generateLongXHTML(cs);
}
@@ -125,4 +132,43 @@
provider.dispose();
}
+ private void generateLongXHTML(Set<ISeamComponent> cs) {
+ StringBuffer sb = new StringBuffer();
+
+ IFolder webContent = project.getFolder("WebContent");
+ IFile tmpl = webContent.getFile("login.xhtml");
+ String s = FileUtil.readFile(tmpl.getLocation().toFile());
+ int i = s.indexOf("<h:form");
+ int j = s.indexOf(">", i) + 1;
+ sb.append(s.substring(0, j));
+
+ int k = 0;
+ for (ISeamComponent c: cs) {
+ k++;
+ String n = c.getName();
+ if(!n.startsWith("x")) continue;
+ String q = "\n<h:inputText id=\"k" + k + "\" " +
+ "value=\"#{" + n + ".value}\"/>\n";
+ sb.append(q);
+ }
+
+ sb.append(s.substring(j));
+ IFile file = webContent.getFile("long.xhtml");
+ try {
+ boolean save = ResourcesUtils.setBuildAutomatically(false);
+ file.create(new ByteArrayInputStream(sb.toString().getBytes()), true, new NullProgressMonitor());
+ long time = System.currentTimeMillis();
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
+
+ long dt = System.currentTimeMillis() - time;
+ System.out.println("validated in " + dt);
+
+ ResourcesUtils.setBuildAutomatically(save);
+
+ assertTrue("Validator takes more than 5s (" + (dt/1000d) + ") for validating generated long.xhtml", dt < 5000);
+ } catch (CoreException e) {
+ JUnitUtils.fail("", e);
+ }
+ }
+
}
16 years, 2 months
JBoss Tools SVN: r10925 - trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2008-10-17 09:49:56 -0400 (Fri, 17 Oct 2008)
New Revision: 10925
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java
Log:
replace ugly text field with java label tabel view for entities going to be changed.
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java 2008-10-17 13:42:06 UTC (rev 10924)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java 2008-10-17 13:49:56 UTC (rev 10925)
@@ -30,10 +30,20 @@
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
import org.eclipse.jdt.internal.ui.refactoring.RefactoringSaveHelper;
import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter;
+import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider;
+import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.DocumentChange;
@@ -42,8 +52,11 @@
import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.text.edits.MalformedTreeException;
@@ -57,14 +70,14 @@
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.Utils;
/**
- *
- *
+ *
+ *
* @author Vitali
*/
public class AllEntitiesProcessor {
protected IJavaProject javaProject;
-
+
protected class ChangeStructure {
public String fullyQualifiedName;
public IPath path;
@@ -75,14 +88,14 @@
};
protected ArrayList<ChangeStructure> changes = new ArrayList<ChangeStructure>();
- public void modify(IJavaProject project, Map<String, EntityInfo> entities,
+ public void modify(IJavaProject project, Map<String, EntityInfo> entities,
boolean askConfirmation) {
changes.clear();
setJavaProject(project);
// get the buffer manager
ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
Iterator<Map.Entry<String, EntityInfo>> it = entities.entrySet().iterator();
- String outText = ""; //$NON-NLS-1$
+ /*String outText = ""; //$NON-NLS-1$
String ls = System.getProperties().getProperty("line.separator", "\n"); //$NON-NLS-1$//$NON-NLS-2$
while (it.hasNext()) {
Map.Entry<String, EntityInfo> entry = it.next();
@@ -93,16 +106,16 @@
// TODO: save entity name as has compiler problems
}
outText += entry.getKey() + (it.hasNext() ? ls : ""); //$NON-NLS-1$
- }
+ }*/
boolean performChange = true;
int res = 0;
if (askConfirmation) {
/** /
final String outText2 = outText;
- MessageDialog dialog = new MessageDialog(JavaPlugin.getActiveWorkbenchShell(),
- JdtUiMessages.AllEntitiesProcessor_header, null,
- JdtUiMessages.AllEntitiesProcessor_message,
- MessageDialog.QUESTION,
+ MessageDialog dialog = new MessageDialog(JavaPlugin.getActiveWorkbenchShell(),
+ JdtUiMessages.AllEntitiesProcessor_header, null,
+ JdtUiMessages.AllEntitiesProcessor_message,
+ MessageDialog.QUESTION,
new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0) {
protected Control createCustomArea(Composite parent) {
Text messageText = new Text(parent, SWT.WRAP | SWT.V_SCROLL);
@@ -151,7 +164,7 @@
}
//
if (askConfirmation) {
- if (!showRefactoringDialog(outText)) {
+ if (!showRefactoringDialog(entities)) {
performChange = false;
}
}
@@ -194,7 +207,7 @@
}
}
- public void collectModification(ITextFileBufferManager bufferManager, String fullyQualifiedName,
+ public void collectModification(ITextFileBufferManager bufferManager, String fullyQualifiedName,
EntityInfo entityInfo) throws CoreException {
ChangeStructure cs = new ChangeStructure();
@@ -224,9 +237,9 @@
HibernateConsolePlugin.getDefault().logErrorMessage("MalformedTreeException: ", e); //$NON-NLS-1$
}
}
-
- public boolean showRefactoringDialog(final String text) {
+ public boolean showRefactoringDialog(final Map<String, EntityInfo> entities) {
+
final String wizard_title = JdtUiMessages.AllEntitiesProcessor_header;
Refactoring ref = new Refactoring(){
@@ -277,19 +290,66 @@
Label label = new Label(container, SWT.NULL);
label.setText(JdtUiMessages.AllEntitiesProcessor_message);
- Text messageText = new Text(container, SWT.WRAP | SWT.V_SCROLL);
- messageText.setText(text);
- messageText.setEditable(false);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL)
+ TableViewer listViewer = new TableViewer(container, SWT.SINGLE | SWT.H_SCROLL
+ | SWT.V_SCROLL | SWT.BORDER);
+ //listViewer.setComparator(getViewerComparator());
+ Control control = listViewer.getControl();
+ GridData data = new GridData(GridData.FILL_BOTH
+ | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
+ data.heightHint = convertHeightInCharsToPixels(10);
+ control.setLayoutData(data);
+ listViewer.setContentProvider(new IStructuredContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ return entities.values().toArray();
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+
+ }
+ });
+
+ listViewer.setLabelProvider(new LabelProvider() {
+
+ private Image classImage;
+
+ {
+ classImage = JavaElementImageProvider.getTypeImageDescriptor(false, false, 0, false).createImage();
+
+ }
+ @Override
+ public String getText(Object element) {
+ EntityInfo info = (EntityInfo) element;
+ return info.getFullyQualifiedName();
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return classImage;
+ }
+
+ @Override
+ public void dispose() {
+ classImage.dispose();
+ super.dispose();
+ }
+ });
+
+ listViewer.setInput(entities);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL)
.grab(true, true)
.hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),
- convertHorizontalDLUsToPixels(2 * IDialogConstants.BUTTON_BAR_HEIGHT)).applyTo(messageText);
+ convertHorizontalDLUsToPixels(2 * IDialogConstants.BUTTON_BAR_HEIGHT)).applyTo(listViewer.getControl());
setControl(container);
}
};
addPage(page);
}
-
+
};
wizard.setWindowTitle(wizard_title);
16 years, 2 months
JBoss Tools SVN: r10924 - in trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa: collect and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2008-10-17 09:42:06 -0400 (Fri, 17 Oct 2008)
New Revision: 10924
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionDelegate.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionPulldownDelegate.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java
Log:
JBIDE-2077 popup menu enable bugfix, null pointer bugfix
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionDelegate.java 2008-10-17 13:36:44 UTC (rev 10923)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionDelegate.java 2008-10-17 13:42:06 UTC (rev 10924)
@@ -31,7 +31,7 @@
public class JPAMapToolActionDelegate implements IObjectActionDelegate,
IEditorActionDelegate, IViewActionDelegate, IHandler {
- public JPAMapToolActor actor = new JPAMapToolActor();
+ public JPAMapToolActor actor = JPAMapToolActor.getInstance();
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionPulldownDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionPulldownDelegate.java 2008-10-17 13:36:44 UTC (rev 10923)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionPulldownDelegate.java 2008-10-17 13:42:06 UTC (rev 10924)
@@ -42,7 +42,7 @@
private Menu fMenu;
protected boolean fRecreateMenu = false;
- public JPAMapToolActor actor = new JPAMapToolActor();
+ public JPAMapToolActor actor = JPAMapToolActor.getInstance();
public Menu getMenu(Menu parent) {
setMenu(new Menu(parent));
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java 2008-10-17 13:36:44 UTC (rev 10923)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java 2008-10-17 13:42:06 UTC (rev 10924)
@@ -48,11 +48,21 @@
*/
public class JPAMapToolActor {
+ protected static JPAMapToolActor actor = null;
protected Set<ICompilationUnit> selectionCU = new HashSet<ICompilationUnit>();
protected AllEntitiesInfoCollector collector = new AllEntitiesInfoCollector();
protected AllEntitiesProcessor processor = new AllEntitiesProcessor();
+ protected JPAMapToolActor() {
+ }
+ public static JPAMapToolActor getInstance() {
+ if (actor == null) {
+ actor = new JPAMapToolActor();
+ }
+ return actor;
+ }
+
protected org.eclipse.jdt.core.dom.CompilationUnit getCompilationUnit(ICompilationUnit source) {
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(source);
@@ -127,7 +137,7 @@
return selectionCU.size();
}
- public void updateSelectedItems(ISelection selection) {
+ synchronized public void updateSelectedItems(ISelection selection) {
//System.out.println("Blah! " + selection); //$NON-NLS-1$
if (selection instanceof TextSelection) {
String fullyQualifiedName = ""; //$NON-NLS-1$
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java 2008-10-17 13:36:44 UTC (rev 10923)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java 2008-10-17 13:42:06 UTC (rev 10924)
@@ -216,17 +216,19 @@
Type superType = node.getSuperclassType();
if (superType != null) {
ITypeBinding tb = superType.resolveBinding();
- String entityFullyQualifiedName = ""; //$NON-NLS-1$
- if (tb.getJavaElement() instanceof SourceType) {
- SourceType sourceT = (SourceType)tb.getJavaElement();
- try {
- entityFullyQualifiedName = sourceT.getFullyQualifiedParameterizedName();
- } catch (JavaModelException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("error", e);
+ if (tb != null) {
+ String entityFullyQualifiedName = ""; //$NON-NLS-1$
+ if (tb.getJavaElement() instanceof SourceType) {
+ SourceType sourceT = (SourceType)tb.getJavaElement();
+ try {
+ entityFullyQualifiedName = sourceT.getFullyQualifiedParameterizedName();
+ } catch (JavaModelException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("error", e);
+ }
}
+ entityInfo.addDependency(entityFullyQualifiedName);
+ entityInfo.setFullyQualifiedParentName(entityFullyQualifiedName);
}
- entityInfo.addDependency(entityFullyQualifiedName);
- entityInfo.setFullyQualifiedParentName(entityFullyQualifiedName);
}
List superInterfaces = node.superInterfaceTypes();
Iterator it = superInterfaces.iterator();
@@ -266,33 +268,35 @@
} else if (node.getType().isSimpleType()) {
SimpleType st = (SimpleType)node.getType();
ITypeBinding tb = st.resolveBinding();
- String entityFullyQualifiedName = ""; //$NON-NLS-1$
- if (tb.getJavaElement() instanceof SourceType) {
- SourceType sourceT = (SourceType)tb.getJavaElement();
- try {
- entityFullyQualifiedName = sourceT.getFullyQualifiedParameterizedName();
- } catch (JavaModelException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
- }
- entityInfo.addDependency(entityFullyQualifiedName);
- Iterator itVarNames = node.fragments().iterator();
- while (itVarNames.hasNext()) {
- VariableDeclarationFragment var = (VariableDeclarationFragment)itVarNames.next();
- String name = var.getName().getIdentifier();
- entityInfo.addReference(name, entityFullyQualifiedName, RefType.ONE2ONE);
- }
- }
- else if (tb.getJavaElement() instanceof BinaryType) {
- ITypeBinding tbParent = tb.getTypeDeclaration().getSuperclass();
- if (tbParent != null && "java.lang.Number".equals(tbParent.getBinaryName())) { //$NON-NLS-1$
- // this is candidate for primary id
+ if (tb != null) {
+ String entityFullyQualifiedName = ""; //$NON-NLS-1$
+ if (tb.getJavaElement() instanceof SourceType) {
+ SourceType sourceT = (SourceType)tb.getJavaElement();
+ try {
+ entityFullyQualifiedName = sourceT.getFullyQualifiedParameterizedName();
+ } catch (JavaModelException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
+ }
+ entityInfo.addDependency(entityFullyQualifiedName);
Iterator itVarNames = node.fragments().iterator();
while (itVarNames.hasNext()) {
VariableDeclarationFragment var = (VariableDeclarationFragment)itVarNames.next();
String name = var.getName().getIdentifier();
- entityInfo.addPrimaryIdCandidate(name);
+ entityInfo.addReference(name, entityFullyQualifiedName, RefType.ONE2ONE);
}
}
+ else if (tb.getJavaElement() instanceof BinaryType) {
+ ITypeBinding tbParent = tb.getTypeDeclaration().getSuperclass();
+ if (tbParent != null && "java.lang.Number".equals(tbParent.getBinaryName())) { //$NON-NLS-1$
+ // this is candidate for primary id
+ Iterator itVarNames = node.fragments().iterator();
+ while (itVarNames.hasNext()) {
+ VariableDeclarationFragment var = (VariableDeclarationFragment)itVarNames.next();
+ String name = var.getName().getIdentifier();
+ entityInfo.addPrimaryIdCandidate(name);
+ }
+ }
+ }
}
} else if (node.getType().isArrayType()) {
ArrayType at = (ArrayType)node.getType();
@@ -301,38 +305,40 @@
ParameterizedType pt = (ParameterizedType)node.getType();
Type type = (Type)pt.getType();
ITypeBinding tb = type.resolveBinding();
- ITypeBinding[] interfaces = tb.getTypeDeclaration().getInterfaces();
- String fullyQualifiedNameTypeName = ""; //$NON-NLS-1$
- for (int i = 0; i < interfaces.length; i++) {
- if (interfaces[i].getJavaElement() instanceof BinaryType) {
- BinaryType binaryT = (BinaryType)interfaces[i].getJavaElement();
- String tmp = binaryT.getFullyQualifiedName('.');
- if (0 == "java.util.Collection".compareTo(tmp)) { //$NON-NLS-1$
- fullyQualifiedNameTypeName = tmp;
- break;
+ if (tb != null) {
+ ITypeBinding[] interfaces = tb.getTypeDeclaration().getInterfaces();
+ String fullyQualifiedNameTypeName = ""; //$NON-NLS-1$
+ for (int i = 0; i < interfaces.length; i++) {
+ if (interfaces[i].getJavaElement() instanceof BinaryType) {
+ BinaryType binaryT = (BinaryType)interfaces[i].getJavaElement();
+ String tmp = binaryT.getFullyQualifiedName('.');
+ if (0 == "java.util.Collection".compareTo(tmp)) { //$NON-NLS-1$
+ fullyQualifiedNameTypeName = tmp;
+ break;
+ }
}
}
- }
- if (fullyQualifiedNameTypeName.length() > 0) {
- Iterator typeArgsIt = pt.typeArguments().iterator();
- while (typeArgsIt.hasNext()) {
- type = (Type)typeArgsIt.next();
- tb = type.resolveBinding();
- String entityFullyQualifiedName = ""; //$NON-NLS-1$
- if (tb.getJavaElement() instanceof SourceType) {
- SourceType sourceT = (SourceType)tb.getJavaElement();
- try {
- entityFullyQualifiedName = sourceT.getFullyQualifiedParameterizedName();
- } catch (JavaModelException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
+ if (fullyQualifiedNameTypeName.length() > 0) {
+ Iterator typeArgsIt = pt.typeArguments().iterator();
+ while (typeArgsIt.hasNext()) {
+ type = (Type)typeArgsIt.next();
+ tb = type.resolveBinding();
+ String entityFullyQualifiedName = ""; //$NON-NLS-1$
+ if (tb.getJavaElement() instanceof SourceType) {
+ SourceType sourceT = (SourceType)tb.getJavaElement();
+ try {
+ entityFullyQualifiedName = sourceT.getFullyQualifiedParameterizedName();
+ } catch (JavaModelException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
+ }
+ entityInfo.addDependency(entityFullyQualifiedName);
+ Iterator itVarNames = node.fragments().iterator();
+ while (itVarNames.hasNext()) {
+ VariableDeclarationFragment var = (VariableDeclarationFragment)itVarNames.next();
+ String name = var.getName().getIdentifier();
+ entityInfo.addReference(name, entityFullyQualifiedName, RefType.ONE2MANY);
+ }
}
- entityInfo.addDependency(entityFullyQualifiedName);
- Iterator itVarNames = node.fragments().iterator();
- while (itVarNames.hasNext()) {
- VariableDeclarationFragment var = (VariableDeclarationFragment)itVarNames.next();
- String name = var.getName().getIdentifier();
- entityInfo.addReference(name, entityFullyQualifiedName, RefType.ONE2MANY);
- }
}
}
}
16 years, 2 months