summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetya Sabeva2013-04-12 09:39:53 (EDT)
committer Petya Sabeva2013-04-12 09:39:53 (EDT)
commitcaf89660e28ce77dd32fbb9d2cc5ffd482ba57eb (patch)
treee838ca7a344b8f2297bfcf208936d09c3e9d55be
parent9705150c7191bf81fe290a28f935b7a6b4977dcf (diff)
downloadwebtools.dali-caf89660e28ce77dd32fbb9d2cc5ffd482ba57eb.zip
webtools.dali-caf89660e28ce77dd32fbb9d2cc5ffd482ba57eb.tar.gz
webtools.dali-caf89660e28ce77dd32fbb9d2cc5ffd482ba57eb.tar.bz2
Install jpa tests project facet through IFacetedProjectWorkingCopy.
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/internal/JPACreateFactory.java29
1 files changed, 25 insertions, 4 deletions
diff --git a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/internal/JPACreateFactory.java b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/internal/JPACreateFactory.java
index 410620c..eae3cea 100644
--- a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/internal/JPACreateFactory.java
+++ b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/internal/JPACreateFactory.java
@@ -55,6 +55,7 @@ import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
@@ -100,8 +101,13 @@ public class JPACreateFactory {
if (jpaConfig != null) {
jpaFacetVersion = jpaConfig.getStringProperty(IFacetDataModelProperties.FACET_VERSION_STR);
}
- installFacet(facetedProject, "jst.utility", "1.0");
- installFacet(facetedProject, "jpt.jpa", jpaFacetVersion, jpaConfig);
+
+// installFacet(facetedProject, "jst.utility", "1.0");
+// installFacet(facetedProject, "jpt.jpa", jpaFacetVersion, jpaConfig);
+
+ addProjectFacet("jst.utility", "1.0");
+ addProjectFacet("jpt.jpa", jpaFacetVersion);
+
addPersistenceJarIntoProject(javaProject);
int cnt = 0;
JpaProject jpaProject = null;
@@ -188,17 +194,32 @@ public class JPACreateFactory {
}
private IFacetedProject createFacetedProject(IProject project) throws CoreException {
- return ProjectFacetsManager.create(project, true, null); // true = "convert if necessary"
+ Utils.printlnFormatted("------> Start convertion of the project to faceted project!");
+ IFacetedProject fp = ProjectFacetsManager.create(project, true, null); // true = "convert if necessary"
+ Utils.printlnFormatted("------> End convertion of the project to faceted project!");
+ return fp;
}
public IJavaProject createJavaProject(IProject project,
boolean autoBuild) throws CoreException {
facetedProject = createFacetedProject(project);
- installFacet(facetedProject, "jst.java", "6.0");
+ addProjectFacet("jst.java", "6.0");
javaProject = JavaCore.create(project);
//sourceFolder = javaProject.getPackageFragmentRoot(project.getFolder("src"));
return javaProject;
}
+
+ private void addProjectFacet(String facetName, String facetVersion) throws CoreException {
+ Utils.printlnFormatted("----> Start instalation of " + facetName + "project facet version " + facetVersion);
+ IProjectFacetVersion javaFacet60 = ProjectFacetsManager.getProjectFacet
+ (facetName).getVersion(facetVersion);
+ IFacetedProjectWorkingCopy fcpwc = facetedProject.createWorkingCopy();
+ fcpwc.addProjectFacet(javaFacet60);
+ fcpwc.commitChanges(new NullProgressMonitor());
+
+ Utils.printlnFormatted("----> End instalation of " + facetName + "project facet version " + facetVersion);
+
+ }
public static String jpaJarName() {
return getSystemProperty(JPA_JAR_NAME_SYSTEM_PROPERTY);