use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class EntityGenerationFactory method generateJPAEntities.
/**
* Creates JPA entities from database by using Hibernate JPA entity generation facility
* @param cfg database configuration
* @param prj project
* @param pkg package where entities will be located
* @param hbVersion hibernate version
*/
public static void generateJPAEntities(DatabaseConfiguration cfg, String prj, String pkg, String hbVersion, boolean useConsole) {
ProjectExplorer pe = new ProjectExplorer();
pe.open();
pe.selectProjects(prj);
GenerateEntitiesWizard w = new GenerateEntitiesWizard();
w.open();
GenerateEntitiesWizardPage p = new GenerateEntitiesWizardPage(w);
p.setUseConsole(useConsole);
p.setPackage(pkg);
if (!useConsole) {
p.setHibernateVersion(hbVersion);
p.setDatabaseConnection(cfg.getProfileName());
}
w.finish();
}
use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class ProjectConfigurationFactory method setProjectFacetForDB.
/**
* Sets JPA project facets for given database configuration
* @param prj given project
* @param cfg given database configuration
* @param jpaVersion JPA version (2.0 or 2.1 is supported)
*/
public static void setProjectFacetForDB(String prj, DatabaseConfiguration cfg, String jpaVersion) {
ProjectExplorer pe = new ProjectExplorer();
pe.open();
PropertyDialog pd = pe.getProject(prj).openProperties();
boolean javaFacet = false;
FacetsPropertyPage pp = new FacetsPropertyPage(pd);
pd.select(pp);
for (TreeItem t : getFacets(pd.getShell())) {
if (t.getText().equals("Java")) {
javaFacet = true;
break;
}
}
if (!javaFacet) {
pp.selectFacet("Java");
DefaultHyperlink hyperlink = new DefaultHyperlink();
hyperlink.activate();
Shell s = new DefaultShell("Modify Faceted Project");
new OkButton().click();
new WaitWhile(new ShellIsAvailable(s));
}
pp.selectFacet("JPA");
pp.selectVersion("JPA", jpaVersion);
addFurtherJPAConfiguration(jpaVersion, !javaFacet);
closePreferences(pd);
new WorkbenchShell().setFocus();
pe.open();
pe.selectProjects(prj);
pd.open();
// TODO Why this takes so long ?
pd.select("JPA");
JpaFacetInstallPage jpaPage = new JpaFacetInstallPage(pd);
jpaPage.setConnectionProfile(cfg.getProfileName());
jpaPage.setAutoDiscovery(true);
closePreferences(pd);
new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
checkPersistenceXML(prj);
}
use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class CodeGenerationConfigurationTest method createRevengFile.
private void createRevengFile() {
ProjectExplorer pe = new ProjectExplorer();
pe.open();
pe.selectProjects(prj);
NewReverseEngineeringFileWizard wizard = new NewReverseEngineeringFileWizard();
wizard.open();
wizard.next();
TableFilterWizardPage page = new TableFilterWizardPage(wizard);
page.setConsoleConfiguration(prj);
page.refreshDatabaseSchema();
page.pressInclude();
wizard.finish();
EditorHandler.getInstance().closeAll(false);
pe.open();
pe.getProject(prj).getProjectItem("hibernate.reveng.xml").open();
new DefaultEditor("Hibernate Reverse Engineering Editor").activate();
ReverseEngineeringEditor re = new ReverseEngineeringEditor();
re.activateDesignTab();
re.activateOverviewTab();
re.activateTableFiltersTab();
re.activateTypeMappingsTab();
re.activateTableAndColumnsTab();
try {
re.selectAllTables("SAKILA.PUBLIC");
} catch (WaitTimeoutExpiredException e) {
fail("Cannot add tables - known issue(s) - JBIDE-19443");
}
re.activateSourceTab();
re.save();
}
use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class CodeGenerationKeyWordsTest method createRevengFile.
private void createRevengFile() {
ProjectExplorer pe = new ProjectExplorer();
pe.open();
pe.selectProjects(prj);
NewReverseEngineeringFileWizard wizard = new NewReverseEngineeringFileWizard();
wizard.open();
wizard.next();
TableFilterWizardPage page = new TableFilterWizardPage(wizard);
page.setConsoleConfiguration(prj);
page.refreshDatabaseSchema();
page.pressInclude();
wizard.finish();
ReverseEngineeringEditor re = new ReverseEngineeringEditor();
re.activateSourceTab();
DefaultStyledText ds = new DefaultStyledText();
ds.selectPosition(ds.getPositionOfText("</hibernate-reverse-engineering>"));
ds.insertText("<table catalog=\"SAKILA\" schema=\"PUBLIC\" name=\"ACTOR\">" + "<column name=\"FIRST_NAME\" property=\"implements\" type=\"string\" /></table>");
re.save();
}
use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class JpaAnnotationGenerationTest method prepare.
@Before
public void prepare() {
importMavenProject(prj);
try {
Path dogLocation = new File("resources/classes/Dog.java").toPath();
Path ownerLocation = new File("resources/classes/Owner.java").toPath();
new File("target/" + prj + "/src/main/java/org/test").mkdirs();
Files.copy(dogLocation, new FileOutputStream("target/" + prj + "/src/main/java/org/test/Dog.java"));
Files.copy(ownerLocation, new FileOutputStream("target/" + prj + "/src/main/java/org/test/Owner.java"));
} catch (IOException e) {
e.printStackTrace();
fail("Unable to find pom " + prj);
}
ProjectExplorer pe = new ProjectExplorer();
pe.open();
pe.getProject(prj).refresh();
}
Aggregations