JBoss Tools SVN: r25791 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-10-13 10:58:31 -0400 (Wed, 13 Oct 2010)
New Revision: 25791
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
Log:
JBIDE-7319
https://jira.jboss.org/browse/JBIDE-7319
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 2010-10-13 14:57:46 UTC (rev 25790)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2010-10-13 14:58:31 UTC (rev 25791)
@@ -2376,18 +2376,14 @@
Map<IPath, Boolean> paths = new HashMap<IPath, Boolean>();
public boolean isThisProject(IPath path) {
- if(path.toString().equals("/seam77")) {
- System.out.println("hh");
- }
Boolean b = paths.get(path);
if(b == null) {
- IFile f = null;
- try {
- f = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- } catch (Exception e) {
- System.out.println("Bad path=" + path);
+ if(path != null && path.toString().endsWith(".jar")) { //$NON-NLS-1$
+ b = true;
+ } else {
+ IFile f = path.segmentCount() < 2 ? null : ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ b = !(f != null && f.exists() && f.getProject() != project);
}
- b = !(f != null && f.exists() && f.getProject() != project);
paths.put(path, b);
}
return b.booleanValue();
15 years, 6 months
JBoss Tools SVN: r25790 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-10-13 10:57:46 -0400 (Wed, 13 Oct 2010)
New Revision: 25790
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
Log:
JBIDE-7319
https://jira.jboss.org/browse/JBIDE-7319
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2010-10-13 14:21:53 UTC (rev 25789)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2010-10-13 14:57:46 UTC (rev 25790)
@@ -539,8 +539,6 @@
System.out.println("--->" + statistics.size() + " " + (t2 - t1)); //$NON-NLS-1$ //$NON-NLS-2$
System.out.println("stop"); //$NON-NLS-1$
}
- } else {
- System.out.println((t2 - t1));
}
}
}
15 years, 6 months
JBoss Tools SVN: r25789 - in trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb: internal and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-10-13 10:21:53 -0400 (Wed, 13 Oct 2010)
New Revision: 25789
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/WebKbPlugin.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
Log:
JBIDE-7319
https://jira.jboss.org/browse/JBIDE-7319
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/WebKbPlugin.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/WebKbPlugin.java 2010-10-13 14:10:07 UTC (rev 25788)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/WebKbPlugin.java 2010-10-13 14:21:53 UTC (rev 25789)
@@ -1,6 +1,18 @@
package org.jboss.tools.jst.web.kb;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ISaveContext;
+import org.eclipse.core.resources.ISaveParticipant;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.jboss.tools.common.log.BaseUIPlugin;
+import org.jboss.tools.jst.web.kb.internal.KbProject;
import org.osgi.framework.BundleContext;
/**
@@ -27,8 +39,76 @@
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+
+ ResourcesPlugin.getWorkspace().addSaveParticipant(PLUGIN_ID, new ISaveParticipant() {
+
+ public void saving(ISaveContext context)
+ throws CoreException {
+ switch (context.getKind()) {
+ case ISaveContext.SNAPSHOT:
+ case ISaveContext.FULL_SAVE:
+ IProject[] ps = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for (IProject p: ps) {
+ KbProject sp = (KbProject)KbProjectFactory.getKbProject(p, false);
+ if(sp != null && sp.getModificationsSinceLastStore() > 0) {
+// sp.printModifications();
+ try {
+ sp.store();
+ } catch (IOException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ }
+ }
+ break;
+ case ISaveContext.PROJECT_SAVE:
+ KbProject sp = (KbProject)KbProjectFactory.getKbProject(context.getProject(), false);
+ try {
+ if(sp != null && sp.getModificationsSinceLastStore() > 0) {
+// sp.printModifications();
+ //Not any project is a seam project
+ sp.store();
+ }
+ } catch (IOException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ break;
+ }
+
+ cleanObsoleteFiles();
+ }
+
+ public void rollback(ISaveContext context) {
+
+ }
+
+ public void prepareToSave(ISaveContext context) throws CoreException {
+ }
+
+ public void doneSaving(ISaveContext context) {
+ }
+ });
}
+ private void cleanObsoleteFiles() {
+ IProject[] ps = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ Set<String> projectNames = new HashSet<String>();
+ for (IProject p: ps) projectNames.add(p.getName());
+ IPath path = WebKbPlugin.getDefault().getStateLocation();
+ File file = new File(path.toFile(), "projects"); //$NON-NLS-1$
+ if(!file.isDirectory()) return;
+ File[] fs = file.listFiles();
+ if(fs != null) for (File f: fs) {
+ String name = f.getName();
+ if(name.endsWith(".xml")) { //$NON-NLS-1$
+ name = name.substring(0, name.length() - 4);
+ if(!projectNames.contains(name)) {
+ f.delete();
+ }
+ }
+ }
+
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java 2010-10-13 14:10:07 UTC (rev 25788)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java 2010-10-13 14:21:53 UTC (rev 25789)
@@ -114,11 +114,11 @@
}
long end = System.currentTimeMillis();
sp.fullBuildTime += end - begin;
- try {
- sp.store();
- } catch (IOException e) {
- WebModelPlugin.getPluginLog().logError(e);
- }
+// try {
+// sp.store();
+// } catch (IOException e) {
+// WebModelPlugin.getPluginLog().logError(e);
+// }
// sp.postBuild();
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2010-10-13 14:10:07 UTC (rev 25788)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2010-10-13 14:21:53 UTC (rev 25789)
@@ -81,6 +81,8 @@
LibraryStorage libraries = new LibraryStorage();
ProjectValidationContext validationContext;
+
+ int modifications = 0;
public KbProject() {}
@@ -229,6 +231,7 @@
*/
public void removeKbProject(KbProject p) {
if(!dependsOn.contains(p)) return;
+ modifications++;
p.removeDependentKbProject(this);
removeUsedKbProject(p);
IPath[] ps = null;
@@ -309,6 +312,8 @@
} finally {
fireChanges();
+
+ modifications = 0;
}
}
@@ -369,6 +374,11 @@
return end - begin;
}
+ public int getModificationsSinceLastStore() {
+ return modifications +
+ (validationContext == null ? 0 : validationContext.getModificationsSinceLastStore());
+ }
+
/**
* Stores results of last build, so that on exit/enter Eclipse
* load them without rebuilding project
@@ -391,6 +401,8 @@
if(validationContext != null) validationContext.store(root);
XMLUtilities.serialize(root, file.getAbsolutePath());
+
+ modifications = 0;
}
/*
@@ -527,6 +539,8 @@
System.out.println("--->" + statistics.size() + " " + (t2 - t1)); //$NON-NLS-1$ //$NON-NLS-2$
System.out.println("stop"); //$NON-NLS-1$
}
+ } else {
+ System.out.println((t2 - t1));
}
}
}
@@ -657,6 +671,7 @@
* @param source
*/
public void registerComponents(LoadedDeclarations ds, IPath source) {
+ boolean isThisProject = pathCheck.isThisProject(source);
ITagLibrary[] libraries = ds.getLibraries().toArray(new ITagLibrary[0]);
if(libraries.length == 0) {
@@ -695,7 +710,7 @@
if(uriChanged) {
this.libraries.addLibrary(current);
}
- fireChanges(changes);
+ fireChanges(changes, isThisProject);
continue;
}
if(((KbObject)library).getParent() == null) {
@@ -704,7 +719,7 @@
this.libraries.addLibrary(library);
addedLibraries = Change.addChange(addedLibraries, new Change(this, null, null, loaded));
}
- fireChanges(addedLibraries);
+ fireChanges(addedLibraries, isThisProject);
libraryDeclarationsRemoved(currentLibraries);
@@ -771,8 +786,9 @@
Set<ITagLibrary> ls = libraries.removePath(source);
if(ls != null) for (ITagLibrary l: ls) {
changes = Change.addChange(changes, new Change(this, null, l, null));
+ if(l.getResource() != null && l.getResource().getProject() == project) modifications++;
}
- fireChanges(changes);
+ fireChanges(changes, false);
firePathRemovedToDependentProjects(source);
}
@@ -816,7 +832,7 @@
libraries.removeLibrary(c);
changes = Change.addChange(changes, new Change(this, null, c, null));
}
- fireChanges(changes);
+ fireChanges(changes, false);
}
List<Change> postponedChanges = null;
@@ -831,15 +847,16 @@
if(postponedChanges == null) return;
List<Change> changes = postponedChanges;
postponedChanges = null;
- fireChanges(changes);
+ fireChanges(changes, false);
}
/**
*
* @param changes
*/
- void fireChanges(List<Change> changes) {
+ void fireChanges(List<Change> changes, boolean increaseModification) {
if(changes == null || changes.isEmpty()) return;
+ if(increaseModification) modifications++;
if(postponedChanges != null) {
postponedChanges.addAll(changes);
return;
@@ -954,4 +971,33 @@
m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
return m;
}
+
+ PathCheck pathCheck = new PathCheck();
+
+ class PathCheck {
+ Map<IPath, Boolean> paths = new HashMap<IPath, Boolean>();
+
+ public boolean isThisProject(IPath path) {
+ Boolean b = paths.get(path);
+ if(b == null) {
+ if(path != null && path.toString().endsWith(".jar")) { //$NON-NLS-1$
+ b = true;
+ } else {
+ IFile f = path.segmentCount() < 2 ? null : ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ b = !(f != null && f.exists() && f.getProject() != project);
+ }
+ paths.put(path, b);
+ }
+ return b.booleanValue();
+ }
+
+ }
+
+ public void printModifications() {
+ System.out.println(project.getName());
+ System.out.println("" + modifications);
+ if(validationContext != null)
+ System.out.println("validationContext " + validationContext.getModificationsSinceLastStore());
+ }
+
}
\ No newline at end of file
15 years, 6 months
JBoss Tools SVN: r25788 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view.
by jbosstools-commits@lists.jboss.org
Author: lzoubek(a)redhat.com
Date: 2010-10-13 10:10:07 -0400 (Wed, 13 Oct 2010)
New Revision: 25788
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ProblemsView.java
Log:
SWTBot ext:small fix in ProblemsView
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ProblemsView.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ProblemsView.java 2010-10-13 14:09:31 UTC (rev 25787)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ProblemsView.java 2010-10-13 14:10:07 UTC (rev 25788)
@@ -10,7 +10,9 @@
******************************************************************************/
package org.jboss.tools.ui.bot.ext.view;
+import java.util.ArrayList;
import java.util.LinkedList;
+import java.util.List;
import org.apache.log4j.Logger;
import org.eclipse.swtbot.swt.finder.SWTBot;
@@ -20,6 +22,8 @@
import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
import org.jboss.tools.ui.bot.ext.SWTEclipseExt.StringConditionType;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.gen.IView;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.types.ViewType;
/**
@@ -35,7 +39,7 @@
public static final int PROBLEMS_TYPE_COLUMN_INDEX = 4;
Logger log = Logger.getLogger(ProblemsView.class);
public ProblemsView() {
-
+ viewObject = ActionItem.View.GeneralProblems.LABEL;
}
/**
@@ -90,6 +94,7 @@
return errorsTreeItems;
}
+
/**
* Returns Errors Node from Problems View static version
15 years, 6 months
JBoss Tools SVN: r25787 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext.
by jbosstools-commits@lists.jboss.org
Author: lzoubek(a)redhat.com
Date: 2010-10-13 10:09:31 -0400 (Wed, 13 Oct 2010)
New Revision: 25787
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java
Log:
SWTBot ext: simplified method isJBDSRun()
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java 2010-10-13 14:06:37 UTC (rev 25786)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java 2010-10-13 14:09:31 UTC (rev 25787)
@@ -14,6 +14,7 @@
import static org.jboss.tools.ui.bot.ext.SWTTestExt.eclipse;
import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.IProduct;
import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
@@ -52,25 +53,10 @@
* @return
*/
public boolean isJBDSRun (){
- return SWTJBTExt.isJBDSRun(bot);
+ IProduct prod = Platform.getProduct();
+ return prod != null;
}
- /**
- * Check if JBoss Developer Studio Is Running
- * @param bot
- * @return
- */
- public static boolean isJBDSRun (SWTWorkbenchBot bot){
- boolean jbdsIsRunning = false;
- try{
- bot.menu(IDELabel.Menu.HELP).menu(IDELabel.Menu.ABOUT_JBOSS_DEVELOPER_STUDIO);
- jbdsIsRunning = true;
- }catch (WidgetNotFoundException wnfe){
- // do nothing
- }
-
- return jbdsIsRunning;
-
- }
+
/**
* Returns JBT version (taken from version of org.jboss.tools.common plugin version)
* @return
15 years, 6 months
JBoss Tools SVN: r25786 - in trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config: requirement and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: lzoubek(a)redhat.com
Date: 2010-10-13 10:06:37 -0400 (Wed, 13 Oct 2010)
New Revision: 25786
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/Annotations.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java
Log:
SWBot ext: added new server annotation
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/Annotations.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/Annotations.java 2010-10-13 14:05:59 UTC (rev 25785)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/Annotations.java 2010-10-13 14:06:37 UTC (rev 25786)
@@ -148,6 +148,10 @@
}
public enum ServerState {
/**
+ * server is present, no matter if runs or not
+ */
+ Present,
+ /**
* server will run
*/
Running,
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2010-10-13 14:05:59 UTC (rev 25785)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2010-10-13 14:06:37 UTC (rev 25786)
@@ -137,11 +137,14 @@
removeServer.getDependsOn().add(RequirementBase.createStopServer());
return removeServer;
}
- if (ServerState.NotRunning.equals(s.state())) {
+ else if (ServerState.NotRunning.equals(s.state())) {
RequirementBase stopServer = RequirementBase.createStopServer();
stopServer.getDependsOn().add(RequirementBase.createAddServer());
return stopServer;
}
+ else if (ServerState.Present.equals(s.state())) {
+ return RequirementBase.createAddServer();
+ }
return RequirementBase.createStartServer();
}
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java 2010-10-13 14:05:59 UTC (rev 25785)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java 2010-10-13 14:06:37 UTC (rev 25786)
@@ -67,6 +67,9 @@
if ("5.0".equals(TestConfigurator.currentConfig.getServer().version)) {
SWTTestExt.configuredState.getServer().bundledESBVersion="4.7";
}
+ if ("5.1".equals(TestConfigurator.currentConfig.getServer().version)) {
+ SWTTestExt.configuredState.getServer().bundledESBVersion="4.9";
+ }
}
}
@@ -125,6 +128,10 @@
return new ServerInfo(JBossEnterpriseMiddlewareJBossEnterpriseApplicationPlatform50Runtime.LABEL,
JBossEnterpriseMiddlewareJBossEnterpriseApplicationPlatform50.LABEL);
}
+ if ("5.1".equals(version)) {
+ return new ServerInfo(JBossEnterpriseMiddlewareJBossEnterpriseApplicationPlatform50Runtime.LABEL,
+ JBossEnterpriseMiddlewareJBossEnterpriseApplicationPlatform50.LABEL);
+ }
}
else if (TestConfigurator.Values.SERVER_TYPE_JBOSSAS.equals(serverType)) {
15 years, 6 months
JBoss Tools SVN: r25785 - in trunk/jsf/plugins/org.jboss.tools.jsf: src/org/jboss/tools/jsf/model/handlers/bean and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-10-13 10:05:59 -0400 (Wed, 13 Oct 2010)
New Revision: 25785
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldChange.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldHelper.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldParticipant.java
Log:
JBIDE-7299
https://jira.jboss.org/browse/JBIDE-7299
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2010-10-13 13:40:15 UTC (rev 25784)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2010-10-13 14:05:59 UTC (rev 25785)
@@ -58,6 +58,7 @@
<with variable="element">
<or>
<instanceof value="org.eclipse.jdt.core.IField"/>
+ <instanceof value="org.eclipse.jdt.core.IMethod"/>
<instanceof value="org.jboss.tools.jsf.model.impl.ManagedPropertyObjectImpl"/>
</or>
</with>
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldChange.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldChange.java 2010-10-13 13:40:15 UTC (rev 25784)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldChange.java 2010-10-13 14:05:59 UTC (rev 25785)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.*;
import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMember;
import org.jboss.tools.common.model.*;
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
@@ -27,7 +28,7 @@
super(beanProperty.getModel(), newName, JSFRenameFieldHelper.getReplacements(beanProperty, newName));
}
- private static XModel getModel(IField field) {
+ static XModel getModel(IMember field) {
if(field == null || field.getJavaProject() == null) return null;
IProject project = field.getJavaProject().getProject();
if(!JSFNature.hasJSFNature(project)) return null;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldHelper.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldHelper.java 2010-10-13 13:40:15 UTC (rev 25784)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldHelper.java 2010-10-13 14:05:59 UTC (rev 25785)
@@ -13,6 +13,7 @@
import java.util.Properties;
import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMember;
import org.jboss.tools.common.model.*;
import org.jboss.tools.jsf.model.pv.*;
@@ -42,7 +43,7 @@
return p;
}
- public static XModelObject[] getBeanList(XModel model, IField field) {
+ public static XModelObject[] getBeanList(XModel model, IMember field) {
String clsname = field.getDeclaringType().getFullyQualifiedName();
JSFProjectsRoot root = JSFProjectsTree.getProjectsRoot(model);
JSFProjectBeans beans = (root == null) ? null : (JSFProjectBeans)root.getChildByPath(JSFProjectTreeConstants.BEANS);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldParticipant.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldParticipant.java 2010-10-13 13:40:15 UTC (rev 25784)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldParticipant.java 2010-10-13 14:05:59 UTC (rev 25785)
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import org.eclipse.core.runtime.*;
import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
import org.eclipse.ltk.core.refactoring.*;
import org.eclipse.ltk.core.refactoring.participants.*;
import org.jboss.tools.common.model.*;
@@ -20,9 +21,10 @@
import org.jboss.tools.common.model.refactoring.RenameModelObjectChange;
import org.jboss.tools.common.model.refactoring.RenameProcessorRunner;
-public class JSFRenameFieldParticipant extends RenameParticipant {
+public class JSFRenameFieldParticipant extends RenameParticipant implements ISharableParticipant {
public static final String PARTICIPANT_NAME="jsf-RenameFieldParticipant"; //$NON-NLS-1$
private IField field;
+ private IMethod method;
private XModelObject object;
public JSFRenameFieldParticipant() {}
@@ -32,10 +34,17 @@
field = (IField)element;
} else if(element instanceof XModelObject) {
this.object = (XModelObject)element;
+ } else if(element instanceof IMethod) {
+ method = (IMethod)element;
}
- return field != null || object != null;
+ return field != null || object != null || method != null;
}
+ public void addElement(Object element, RefactoringArguments arguments) {
+ // TODO Auto-generated method stub
+
+ }
+
public String getName() {
return PARTICIPANT_NAME;
}
@@ -57,6 +66,8 @@
XModelObject[] os = JSFRenameFieldHelper.getBeanList(model, field);
os = getProperties(os, field.getElementName());
RenameModelObjectChange c1 = RenameModelObjectChange.createChange(os, newName, "property-name"); //$NON-NLS-1$
+
+ c2 = null;
if(c1 == null) return c2;
if(c2 == null) return c1;
@@ -64,6 +75,16 @@
if(c1 != null) change.add(c1);
if(c2 != null) change.add(c2);
return change;
+ } else if(method != null) {
+ XModel model = JSFRenameFieldChange.getModel(method);
+ if(model == null) return null;
+ XModelObject[] os = JSFRenameFieldHelper.getBeanList(model, method);
+ String name = method.getElementName();
+ if(!name.startsWith("get") && !name.startsWith("set")) return null;
+ name = name.substring(3, 4).toLowerCase() + name.substring(4);
+ os = getProperties(os, name);
+ RenameModelObjectChange c1 = RenameModelObjectChange.createChange(os, newName, "property-name"); //$NON-NLS-1$
+ return c1;
} else if(object != null) {
RenameModelObjectChange c1 = RenameModelObjectChange.createChange(new XModelObject[]{object}, getArguments().getNewName(), "property-name"); //$NON-NLS-1$
15 years, 6 months
JBoss Tools SVN: r25784 - trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-10-13 09:40:15 -0400 (Wed, 13 Oct 2010)
New Revision: 25784
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/Flasher.java
Log:
JBIDE-7295
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/Flasher.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/Flasher.java 2010-10-13 12:50:09 UTC (rev 25783)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/Flasher.java 2010-10-13 13:40:15 UTC (rev 25784)
@@ -16,6 +16,7 @@
*/
public class Flasher {
private inIFlasher iFlasher;
+ private static final boolean IS_OPEN_JDK = (System.getProperty("java.runtime.name")!=null&&System.getProperty("java.runtime.name").contains("OpenJDK")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// added by Maksim Areshkau as element for which we
// have drowed border. When we draw new border,
@@ -29,10 +30,11 @@
iFlasher = (inIFlasher) serviceManager.getServiceByContractID(
XPCOM.IN_FLASHER_CONTRACTID, inIFlasher.INIFLASHER_IID);
iFlasher.setThickness(2);
- if (Platform.OS_MACOSX.equals(Platform.getOS())) {
+ //fix for JBIDE-7295, added by Maksim Areshkau
+ if (Platform.OS_MACOSX.equals(Platform.getOS())
+ ||IS_OPEN_JDK) {
drawOutline = new DrawOutlineInterface() {
private nsIDOMElement lastBorderedElement = null;
- @Override
public void drawElementOutline(nsIDOMElement domElement) {
if (this.lastBorderedElement != null
&& this.lastBorderedElement.getAttribute(XulRunnerEditor.STYLE_ATTR) != null) {
15 years, 6 months
JBoss Tools SVN: r25783 - in trunk/hibernatetools/tests/org.hibernate.eclipse.console.test: src/org/hibernate/eclipse/console/test and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-10-13 08:50:09 -0400 (Wed, 13 Oct 2010)
New Revision: 25783
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/testLaunchCfg_0.launch
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/testLaunchCfg_1.launch
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ExporterAttributesTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/LaunchConfigTestProject.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ResourceReadUtils.java
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestWorkingCopy.java
Log:
https://jira.jboss.org/browse/JBIDE-7285 - fixed
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/testLaunchCfg_0.launch
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/testLaunchCfg_0.launch (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/testLaunchCfg_0.launch 2010-10-13 12:50:09 UTC (rev 25783)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.hibernate.eclipse.launch.CodeGenerationLaunchConfigurationType">
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.hibernate.eclipse.launch.CodeGenerationLaunchGroup"/>
+<listEntry value="org.hibernate.eclipse.launch.ConsoleConfigurationLaunchGroup"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.hibernate.codegen.CodeGenMain"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="..../AppData/Local/Temp/codegenbuildxml/4fbe6bbb-9013-4ef2-8175-5b13f714ae00/build.xml"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="qwert"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-cp ....\hibernate_eclipse_plugins_short\z-codegen\target\org.hibernate.codegen-1.0.0.GA.jar"/>
+<stringAttribute key="org.hibernate.tools.buildXml" value="\qwert\target\build.xml"/>
+<stringAttribute key="org.hibernate.tools.codeGenLaunchJar" value="....\trunk\hibernatetools\plugins\org.hibernate.eclipse\lib\extern\org.hibernate.codegen.jar"/>
+<stringAttribute key="org.hibernate.tools.configurationname" value="qwert"/>
+<booleanAttribute key="org.hibernate.tools.ejb3" value="true"/>
+<listAttribute key="org.hibernate.tools.exporters">
+<listEntry value="org.hibernate.tools.hbm2java"/>
+<listEntry value="org.hibernate.tools.hbm2hbmxml"/>
+<listEntry value="org.hibernate.tools.hbm2dao"/>
+<listEntry value="org.hibernate.tools.hbmtemplate"/>
+<listEntry value="org.hibernate.tools.hbm2cfgxml"/>
+<listEntry value="org.hibernate.tools.hbm2doc"/>
+<listEntry value="org.hibernate.tools.hbm2ddl"/>
+<listEntry value="8"/>
+<listEntry value="9"/>
+<listEntry value="10"/>
+<listEntry value="11"/>
+<listEntry value="12"/>
+<listEntry value="13"/>
+<listEntry value="14"/>
+<listEntry value="15"/>
+</listAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.10" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.10.extension_id" value="org.hibernate.tools.hbm2java"/>
+<booleanAttribute key="org.hibernate.tools.exporters.11" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.11.extension_id" value="org.hibernate.tools.hbmtemplate"/>
+<booleanAttribute key="org.hibernate.tools.exporters.12" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.12.extension_id" value="org.hibernate.tools.hbm2cfgxml"/>
+<booleanAttribute key="org.hibernate.tools.exporters.13" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.13.extension_id" value="org.hibernate.tools.hbm2hbmxml"/>
+<booleanAttribute key="org.hibernate.tools.exporters.14" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.14.extension_id" value="org.hibernate.tools.hbm2doc"/>
+<booleanAttribute key="org.hibernate.tools.exporters.15" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.15.extension_id" value="org.hibernate.tools.hbm2ddl"/>
+<booleanAttribute key="org.hibernate.tools.exporters.8" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.8.extension_id" value="org.hibernate.tools.hbmtemplate"/>
+<mapAttribute key="org.hibernate.tools.exporters.8.properties">
+<mapEntry key="file_pattern" value="{package-name}/{class-name}.java"/>
+<mapEntry key="for_each" value="11111111111111"/>
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+<mapEntry key="template_name" value="pojo/Pojo.ftl"/>
+<mapEntry key="template_path" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.9" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.9.extension_id" value="org.hibernate.tools.hbm2dao"/>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2cfgxml" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2cfgxml.extension_id" value="org.hibernate.tools.hbm2cfgxml"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2cfgxml.properties">
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2dao" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2dao.extension_id" value="org.hibernate.tools.hbm2dao"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2dao.properties">
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2ddl" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2ddl.extension_id" value="org.hibernate.tools.hbm2ddl"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2ddl.properties">
+<mapEntry key="outputFileName" value="schema.sql"/>
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+<mapEntry key="schemaUpdate" value="true"/>
+<mapEntry key="scriptToConsole" value="true"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2doc" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2doc.extension_id" value="org.hibernate.tools.hbm2doc"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2doc.properties">
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2hbmxml" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2hbmxml.extension_id" value="org.hibernate.tools.hbm2hbmxml"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2hbmxml.properties">
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2java" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2java.extension_id" value="org.hibernate.tools.hbm2java"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2java.properties">
+<mapEntry key="destdir" value="qwerty"/>
+<mapEntry key="destdir2" value="qw"/>
+<mapEntry key="ejb3" value="true"/>
+<mapEntry key="jdk5" value="true"/>
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbmtemplate" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbmtemplate.extension_id" value="org.hibernate.tools.hbmtemplate"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbmtemplate.properties">
+<mapEntry key="file_pattern" value="${package-name}/${class-name}.java"/>
+<mapEntry key="for_each" value="entity"/>
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+<mapEntry key="template_name" value="pojo/Pojo.ftl"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.jdk5" value="true"/>
+<stringAttribute key="org.hibernate.tools.outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+<stringAttribute key="org.hibernate.tools.package" value="qqqqqqqqqqqqqqqqqqqqqqqqqqqq"/>
+<booleanAttribute key="org.hibernate.tools.prefercompositeids" value="true"/>
+<booleanAttribute key="org.hibernate.tools.reveng.detect_many_to_many" value="false"/>
+<booleanAttribute key="org.hibernate.tools.reveng.detect_one_to_one" value="false"/>
+<booleanAttribute key="org.hibernate.tools.reveng.detect_optimistc_lock" value="false"/>
+<stringAttribute key="org.hibernate.tools.revengfile" value="\qwert\src\hibernate.reveng.xml"/>
+<booleanAttribute key="org.hibernate.tools.schema2hbm" value="true"/>
+<booleanAttribute key="org.hibernate.tools.useExternalProcess" value="true"/>
+<booleanAttribute key="org.hibernate.tools.useOwnTemplates" value="false"/>
+</launchConfiguration>
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/testLaunchCfg_1.launch
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/testLaunchCfg_1.launch (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/testLaunchCfg_1.launch 2010-10-13 12:50:09 UTC (rev 25783)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.hibernate.eclipse.launch.CodeGenerationLaunchConfigurationType">
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.hibernate.eclipse.launch.CodeGenerationLaunchGroup"/>
+<listEntry value="org.hibernate.eclipse.launch.ConsoleConfigurationLaunchGroup"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.hibernate.codegen.CodeGenMain"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="...../AppData/Local/Temp/codegenbuildxml/4fbe6bbb-9013-4ef2-8175-5b13f714ae00/build.xml"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="qwert"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-cp ....\hibernate_eclipse_plugins_short\z-codegen\target\org.hibernate.codegen-1.0.0.GA.jar"/>
+<stringAttribute key="org.hibernate.tools.buildXml" value="\qwert\target\build.xml"/>
+<stringAttribute key="org.hibernate.tools.codeGenLaunchJar" value="....\trunk\hibernatetools\plugins\org.hibernate.eclipse\lib\extern\org.hibernate.codegen.jar"/>
+<stringAttribute key="org.hibernate.tools.configurationname" value="qwert"/>
+<booleanAttribute key="org.hibernate.tools.ejb3" value="true"/>
+<listAttribute key="org.hibernate.tools.exporters">
+<listEntry value="org.hibernate.tools.hbm2java"/>
+<listEntry value="org.hibernate.tools.hbm2hbmxml"/>
+<listEntry value="org.hibernate.tools.hbm2dao"/>
+<listEntry value="org.hibernate.tools.hbmtemplate"/>
+<listEntry value="org.hibernate.tools.hbm2cfgxml"/>
+<listEntry value="org.hibernate.tools.hbm2doc"/>
+<listEntry value="org.hibernate.tools.hbm2ddl"/>
+<listEntry value="8"/>
+<listEntry value="9"/>
+<listEntry value="10"/>
+<listEntry value="11"/>
+<listEntry value="12"/>
+<listEntry value="13"/>
+<listEntry value="14"/>
+<listEntry value="15"/>
+</listAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.10" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.10.extension_id" value="org.hibernate.tools.hbm2java"/>
+<booleanAttribute key="org.hibernate.tools.exporters.11" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.11.extension_id" value="org.hibernate.tools.hbmtemplate"/>
+<booleanAttribute key="org.hibernate.tools.exporters.12" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.12.extension_id" value="org.hibernate.tools.hbm2cfgxml"/>
+<booleanAttribute key="org.hibernate.tools.exporters.13" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.13.extension_id" value="org.hibernate.tools.hbm2hbmxml"/>
+<booleanAttribute key="org.hibernate.tools.exporters.14" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.14.extension_id" value="org.hibernate.tools.hbm2doc"/>
+<booleanAttribute key="org.hibernate.tools.exporters.15" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.15.extension_id" value="org.hibernate.tools.hbm2ddl"/>
+<booleanAttribute key="org.hibernate.tools.exporters.8" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.8.extension_id" value="org.hibernate.tools.hbmtemplate"/>
+<mapAttribute key="org.hibernate.tools.exporters.8.properties">
+<mapEntry key="file_pattern" value="{package-name}/{class-name}.java"/>
+<mapEntry key="for_each" value="11111111111111"/>
+<mapEntry key="outputdir" value="temp_test_out_folder"/>
+<mapEntry key="template_name" value="pojo/Pojo.ftl"/>
+<mapEntry key="template_path" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.9" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.9.extension_id" value="org.hibernate.tools.hbm2dao"/>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2cfgxml" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2cfgxml.extension_id" value="org.hibernate.tools.hbm2cfgxml"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2cfgxml.properties">
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2dao" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2dao.extension_id" value="org.hibernate.tools.hbm2dao"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2dao.properties">
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2ddl" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2ddl.extension_id" value="org.hibernate.tools.hbm2ddl"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2ddl.properties">
+<mapEntry key="outputFileName" value="schema.sql"/>
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+<mapEntry key="schemaUpdate" value="true"/>
+<mapEntry key="scriptToConsole" value="true"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2doc" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2doc.extension_id" value="org.hibernate.tools.hbm2doc"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2doc.properties">
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2hbmxml" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2hbmxml.extension_id" value="org.hibernate.tools.hbm2hbmxml"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2hbmxml.properties">
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2java" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2java.extension_id" value="org.hibernate.tools.hbm2java"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbm2java.properties">
+<mapEntry key="destdir" value="qwerty"/>
+<mapEntry key="destdir2" value="qw"/>
+<mapEntry key="ejb3" value="true"/>
+<mapEntry key="jdk5" value="true"/>
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbmtemplate" value="true"/>
+<stringAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbmtemplate.extension_id" value="org.hibernate.tools.hbmtemplate"/>
+<mapAttribute key="org.hibernate.tools.exporters.org.hibernate.tools.hbmtemplate.properties">
+<mapEntry key="file_pattern" value="${package-name}/${class-name}.java"/>
+<mapEntry key="for_each" value="entity"/>
+<mapEntry key="outputdir" value="\LaunchConfigTestProject\temp_test_out_folder"/>
+<mapEntry key="template_name" value="pojo/Pojo.ftl"/>
+</mapAttribute>
+<booleanAttribute key="org.hibernate.tools.jdk5" value="true"/>
+<stringAttribute key="org.hibernate.tools.outputdir" value="temp_test_out_folder_not_exist"/>
+<stringAttribute key="org.hibernate.tools.package" value="qqqqqqqqqqqqqqqqqqqqqqqqqqqq"/>
+<booleanAttribute key="org.hibernate.tools.prefercompositeids" value="true"/>
+<booleanAttribute key="org.hibernate.tools.reveng.detect_many_to_many" value="false"/>
+<booleanAttribute key="org.hibernate.tools.reveng.detect_one_to_one" value="false"/>
+<booleanAttribute key="org.hibernate.tools.reveng.detect_optimistc_lock" value="false"/>
+<stringAttribute key="org.hibernate.tools.revengfile" value="\qwert\src\hibernate.reveng.xml"/>
+<booleanAttribute key="org.hibernate.tools.schema2hbm" value="true"/>
+<booleanAttribute key="org.hibernate.tools.useExternalProcess" value="true"/>
+<booleanAttribute key="org.hibernate.tools.useOwnTemplates" value="false"/>
+</launchConfiguration>
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java 2010-10-13 11:56:09 UTC (rev 25782)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java 2010-10-13 12:50:09 UTC (rev 25783)
@@ -10,10 +10,7 @@
******************************************************************************/
package org.hibernate.eclipse.console.test;
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
@@ -26,22 +23,18 @@
import java.util.Properties;
import java.util.TreeMap;
-import org.dom4j.Document;
-import org.dom4j.DocumentException;
-import org.dom4j.DocumentHelper;
-import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.datatools.connectivity.IConnectionProfile;
import org.eclipse.datatools.connectivity.internal.ConnectionProfile;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.hibernate.console.ConfigurationXMLFactory;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.ExtensionManager;
import org.hibernate.eclipse.console.model.impl.ExporterDefinition;
import org.hibernate.eclipse.console.model.impl.ExporterFactoryStrings;
import org.hibernate.eclipse.console.test.launchcfg.TestConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.test.launchcfg.TestLaunchConfig;
+import org.hibernate.eclipse.console.test.utils.ResourceReadUtils;
import org.hibernate.eclipse.launch.CodeGenXMLFactory;
import org.hibernate.eclipse.launch.CodeGenerationStrings;
import org.hibernate.eclipse.launch.ExporterAttributes;
@@ -53,10 +46,6 @@
* @author Vitali Yemialyanchyk
*/
public class CodeGenXMLFactoryTest extends TestCase {
-
- public static final String LN_1 = "\n"; //$NON-NLS-1$
- public static final String LN_2 = "\r\n"; //$NON-NLS-1$
-
public static final String SAMPLE_PATH = "res/sample/"; //$NON-NLS-1$
public static final String PROJECT_LIB_PATH = "res/project/lib/"; //$NON-NLS-1$
@@ -242,28 +231,6 @@
}
}
- /**
- * Parse, i.e. adjust xml text so attributes for same xml
- * will be in one order.
- *
- * @param sample
- * @return adjusted xml
- */
- public String adjustXmlText(String sample) {
- Document doc = null;
- try {
- doc = DocumentHelper.parseText(sample);
- } catch (DocumentException e) {
- // ignore
- }
- if (doc == null) {
- return sample;
- }
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ConfigurationXMLFactory.dump(baos, doc.getRootElement());
- return baos.toString().trim();
- }
-
public void testCodeGenXMLFactoryRevengAll() {
TestLaunchConfig testLaunchConfig = createTestLaunchConfig(true, true, false);
CodeGenXMLFactory codeGenFactory = new CodeGenXMLFactory4TestSimple(testLaunchConfig);
@@ -494,41 +461,12 @@
return testLaunchConfig;
}
-
public String getSample(String fileName) {
- File resourceFile = null;
- try {
- resourceFile = getResourceItem(SAMPLE_PATH + fileName);
- } catch (IOException e1) {
- }
- if (resourceFile == null || !resourceFile.exists()) {
- return null;
- }
- StringBuffer cbuf = new StringBuffer((int) resourceFile.length());
- try {
- String ls = System.getProperties().getProperty("line.separator", LN_1); //$NON-NLS-1$
- BufferedReader in = new BufferedReader(new FileReader(resourceFile));
- String str;
- while ((str = in.readLine()) != null) {
- cbuf.append(str + ls);
- }
- in.close();
- } catch (IOException e) {
- }
- return adjustXmlText(cbuf.toString());
+ return ResourceReadUtils.getSample(SAMPLE_PATH + fileName);
}
- protected File getResourceItem(String strResPath) throws IOException {
- IPath resourcePath = new Path(strResPath);
- File resourceFolder = resourcePath.toFile();
- URL entry = HibernateConsoleTestPlugin.getDefault().getBundle().getEntry(
- strResPath);
- String tplPrjLcStr = strResPath;
- if (entry != null) {
- URL resProject = FileLocator.resolve(entry);
- tplPrjLcStr = FileLocator.resolve(resProject).getFile();
- }
- resourceFolder = new File(tplPrjLcStr);
- return resourceFolder;
+ public String adjustXmlText(String sample) {
+ return ResourceReadUtils.adjustXmlText(sample);
}
+
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2010-10-13 11:56:09 UTC (rev 25782)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2010-10-13 12:50:09 UTC (rev 25783)
@@ -34,6 +34,9 @@
// https://jira.jboss.org/browse/JBIDE-6838
suite.addTestSuite(CodeGenXMLFactoryTest.class);
+ // https://jira.jboss.org/browse/JBIDE-7285
+ suite.addTestSuite(ExporterAttributesTest.class);
+
// core tests
//Properties properties = new Properties();
//properties.load(ConsolePluginAllTests.class.getResourceAsStream("plugintest-hibernate.properties"));
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ExporterAttributesTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ExporterAttributesTest.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ExporterAttributesTest.java 2010-10-13 12:50:09 UTC (rev 25783)
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.console.test;
+
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.internal.core.LaunchManager;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import org.hibernate.eclipse.console.model.impl.ExporterFactory;
+import org.hibernate.eclipse.console.model.impl.ExporterFactoryStrings;
+import org.hibernate.eclipse.console.test.launchcfg.TestConsoleConfigurationPreferences;
+import org.hibernate.eclipse.console.test.project.LaunchConfigTestProject;
+import org.hibernate.eclipse.console.test.utils.ResourceReadUtils;
+import org.hibernate.eclipse.launch.CodeGenerationStrings;
+import org.hibernate.eclipse.launch.ExporterAttributes;
+import org.hibernate.tool.hbm2x.ArtifactCollector;
+import org.hibernate.tool.hbm2x.Exporter;
+import org.hibernate.tool.hbm2x.GenericExporter;
+import org.hibernate.tool.hbm2x.Hbm2DDLExporter;
+import org.hibernate.tool.hbm2x.QueryExporter;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Vitali Yemialyanchyk
+ */
+@SuppressWarnings("restriction")
+public class ExporterAttributesTest extends TestCase {
+
+ private ConsoleConfiguration consoleCfg;
+ private LaunchConfigTestProject project;
+ private LaunchManager launchManager = new LaunchManager();
+
+ public ExporterAttributesTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ this.project = new LaunchConfigTestProject();
+
+ TestConsoleConfigurationPreferences cfgprefs = new TestConsoleConfigurationPreferences();
+ consoleCfg = new ConsoleConfiguration(cfgprefs);
+ KnownConfigurations.getInstance().addConfiguration(consoleCfg, true);
+ }
+
+ protected void tearDown() throws Exception {
+ this.project.deleteIProject();
+ this.project = null;
+
+ KnownConfigurations.getInstance().removeAllConfigurations();
+ consoleCfg = null;
+ }
+
+ public void testExporterAttributes() {
+ final String fileName_0 = LaunchConfigTestProject.LAUNCH_TEST_FILE_0;
+ checkCorrectLaunchConfigurationFile(fileName_0);
+ final String fileName_1 = LaunchConfigTestProject.LAUNCH_TEST_FILE_1;
+ checkIncorrectLaunchConfigurationFile(fileName_1);
+ }
+
+ @SuppressWarnings({ "rawtypes", "unused" })
+ public void checkCorrectLaunchConfigurationFile(final String fileName) {
+ // IWorkspace ws = ResourcesPlugin.getWorkspace();
+ String str1, str2;
+ ILaunchConfiguration launchConfig = loadLaunchConfigFromFile(fileName);
+ Map attrMap = null;
+ try {
+ attrMap = launchConfig.getAttributes();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ assertNotNull(attrMap);
+ ExporterAttributes exporterAttributes = null;
+ try {
+ exporterAttributes = new ExporterAttributes(launchConfig);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ assertNotNull(exporterAttributes);
+ // check is configuration correct
+ assertNull(exporterAttributes.checkExporterAttributes());
+ List<ExporterFactory> exporterFactories = exporterAttributes.getExporterFactories();
+ Set<ExporterFactory> selectedExporters = new HashSet<ExporterFactory>();
+ selectedExporters.addAll(exporterFactories);
+ Set<String> deletedExporterIds = new HashSet<String>();
+ ILaunchConfigurationWorkingCopy launchConfigWC = null;
+ try {
+ launchConfigWC = launchConfig.getWorkingCopy();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ assertNotNull(launchConfigWC);
+ //
+ str1 = getProject().getSample(fileName);
+ str1 = ResourceReadUtils.adjustXmlText(str1);
+ //
+ assertNotNull(getProject());
+ assertNotNull(getProject().getIProject());
+ assertNotNull(getProject().getIProject().getFile(fileName));
+ //
+ InputStream is = null;
+ try {
+ is = getProject().getIProject().getFile(fileName).getContents();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ assertNotNull(is);
+ str2 = ResourceReadUtils.readStream(is);
+ str2 = ResourceReadUtils.adjustXmlText(str2);
+ assertEquals(str1, str2);
+ // update and save lc - so fileName from the project updated
+ try {
+ ExporterAttributes.saveExporterFactories(launchConfigWC, exporterFactories,
+ selectedExporters, deletedExporterIds);
+ launchConfigWC.doSave();
+ } catch (CoreException e) {
+ fail(e.getMessage());
+ }
+ //
+ is = null;
+ try {
+ is = getProject().getIProject().getFile(fileName).getContents();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ assertNotNull(is);
+ str2 = ResourceReadUtils.readStream(is);
+ str2 = ResourceReadUtils.adjustXmlText(str2);
+ assertEquals(str1, str2);
+ //
+ ArtifactCollector artifactCollector = new ArtifactCollector();
+ ExporterAttributes expAttr = exporterAttributes;
+ // Global properties
+ Properties props = new Properties();
+ props.put(CodeGenerationStrings.EJB3, "" + expAttr.isEJB3Enabled()); //$NON-NLS-1$
+ props.put(CodeGenerationStrings.JDK5, "" + expAttr.isJDK5Enabled()); //$NON-NLS-1$
+ consoleCfg.build();
+ Configuration cfg = consoleCfg.getConfiguration();
+ assertNotNull(cfg);
+ Set<String> outputDirectories = new HashSet<String>();
+ for (int i = 0; i < exporterFactories.size(); i++) {
+ Properties globalProperties = new Properties();
+ globalProperties.putAll(props);
+ ExporterFactory ef = exporterFactories.get(i);
+ //
+ Properties propsForTesting = new Properties();
+ propsForTesting.putAll(globalProperties);
+ propsForTesting.putAll(ef.getProperties());
+ //
+ Exporter exporter = null;
+ outputDirectories.clear();
+ try {
+ exporter = ef.createConfiguredExporter(cfg,
+ expAttr.getOutputPath(), expAttr.getTemplatePath(), globalProperties,
+ outputDirectories, artifactCollector);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ assertNotNull(exporter);
+ assertTrue(outputDirectories.size() > 0);
+ Properties propsFromExporter = exporter.getProperties();
+ String exporterDefinitionId = ef.getExporterDefinitionId();
+ // test special handling for GenericExporter
+ if (exporterDefinitionId.equals("org.hibernate.tools.hbmtemplate")) { //$NON-NLS-1$
+ assertTrue(exporter instanceof GenericExporter);
+ assertNull(propsFromExporter.getProperty(ExporterFactoryStrings.FILE_PATTERN));
+ assertNull(propsFromExporter.getProperty(ExporterFactoryStrings.TEMPLATE_NAME));
+ assertNull(propsFromExporter.getProperty(ExporterFactoryStrings.FOR_EACH));
+ GenericExporter ge = (GenericExporter) exporter;
+ assertEquals(propsForTesting.getProperty(ExporterFactoryStrings.FILE_PATTERN), ge.getFilePattern());
+ assertEquals(propsForTesting.getProperty(ExporterFactoryStrings.TEMPLATE_NAME), ge.getTemplateName());
+ // to test GenericExporter should provide public getter but it doesn't
+ //assertEquals(propsForTesting.getProperty(ExporterFactoryStrings.FOR_EACH), ge.getForEach());
+ }
+ // test special handling for Hbm2DDLExporter
+ if (exporterDefinitionId.equals("org.hibernate.tools.hbm2ddl")) { //$NON-NLS-1$
+ assertTrue(exporter instanceof Hbm2DDLExporter);
+ assertNull(propsFromExporter.getProperty(ExporterFactoryStrings.EXPORTTODATABASE));
+ Hbm2DDLExporter ddlExporter = (Hbm2DDLExporter) exporter;
+ // to test Hbm2DDLExporter should provide public getter but it doesn't
+ //assertEquals(propsForTesting.getProperty(ExporterFactoryStrings.EXPORTTODATABASE), ddlExporter.getExport());
+ }
+ // test special handling for QueryExporter
+ if (exporterDefinitionId.equals("org.hibernate.tools.query")) { //$NON-NLS-1$
+ assertTrue(exporter instanceof QueryExporter);
+ assertNull(propsFromExporter.getProperty(ExporterFactoryStrings.QUERY_STRING));
+ assertNull(propsFromExporter.getProperty(ExporterFactoryStrings.OUTPUTFILENAME));
+ QueryExporter queryExporter = (QueryExporter)exporter;
+ // to test QueryExporter should provide public getter but it doesn't
+ //List<String> queryStrings = queryExporter.getQueries();
+ //assertEquals(1, queryStrings.size());
+ //assertEquals(propsForTesting.getProperty(ExporterFactoryStrings.QUERY_STRING), queryStrings.get(0));
+ //assertEquals(propsForTesting.getProperty(ExporterFactoryStrings.OUTPUTFILENAME), queryExporter.getFileName());
+ }
+ //try {
+ // exporter.start();
+ //} catch (HibernateException he) {
+ // he.printStackTrace();
+ //}
+ }
+ assertTrue(artifactCollector.getFileTypes().size() == 0);
+ }
+
+ @SuppressWarnings({ "rawtypes" })
+ public void checkIncorrectLaunchConfigurationFile(final String fileName) {
+ ILaunchConfiguration launchConfig = loadLaunchConfigFromFile(fileName);
+ Map attrMap = null;
+ try {
+ attrMap = launchConfig.getAttributes();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ assertNotNull(attrMap);
+ ExporterAttributes exporterAttributes = null;
+ try {
+ exporterAttributes = new ExporterAttributes(launchConfig);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ assertNotNull(exporterAttributes);
+ // check is configuration correct
+ assertNotNull(exporterAttributes.checkExporterAttributes());
+ }
+
+ protected LaunchConfigTestProject getProject() {
+ return this.project;
+ }
+
+ public ILaunchConfiguration loadLaunchConfigFromFile(String fileName) {
+ IPath path = new Path(fileName);
+ IFile ifile = getProject().getIProject().getFile(path);
+ ILaunchConfiguration launchConfig = launchManager.getLaunchConfiguration((IFile) ifile);
+ return launchConfig;
+ }
+}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestWorkingCopy.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestWorkingCopy.java 2010-10-13 11:56:09 UTC (rev 25782)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestWorkingCopy.java 2010-10-13 12:50:09 UTC (rev 25783)
@@ -93,11 +93,11 @@
}
public void setAttribute(String attributeName, boolean value) {
- Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ attributes.put(attributeName, value);
}
- public void setAttributes(Map attributes) {
- Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ public void setAttributes(Map attribs) {
+ attributes.putAll(attribs);
}
public void setContainer(IContainer container) {
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/LaunchConfigTestProject.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/LaunchConfigTestProject.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/LaunchConfigTestProject.java 2010-10-13 12:50:09 UTC (rev 25783)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.console.test.project;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaModelException;
+import org.hibernate.eclipse.console.test.utils.ResourceReadUtils;
+
+/**
+ * @author Vitali Yemialyanchyk
+ */
+public class LaunchConfigTestProject extends TestProject {
+
+ public static final String TEST_TMP_OUT_FOLDER = "temp_test_out_folder"; //$NON-NLS-1$
+ public static final String PROJECT_PATH = "res/project/"; //$NON-NLS-1$
+ public static final String LAUNCH_TEST_FILE_0 = "testLaunchCfg_0.launch"; //$NON-NLS-1$
+ public static final String LAUNCH_TEST_FILE_1 = "testLaunchCfg_1.launch"; //$NON-NLS-1$
+
+ public LaunchConfigTestProject() {
+ super("LaunchConfigTestProject"); //$NON-NLS-1$
+ }
+
+ public LaunchConfigTestProject(String projectName) {
+ super(projectName);
+ }
+
+ protected void buildProject() throws JavaModelException, CoreException, IOException {
+ super.buildProject();
+ IPackageFragmentRoot tst = createFolder(TEST_TMP_OUT_FOLDER);
+ tst.getResource().refreshLocal(IResource.DEPTH_INFINITE, null);
+ importLaunchConfigFileToProject(LAUNCH_TEST_FILE_0);
+ importLaunchConfigFileToProject(LAUNCH_TEST_FILE_1);
+ }
+
+ public String getSample(String fileName) {
+ return ResourceReadUtils.getSample(PROJECT_PATH + fileName);
+ }
+
+ public void importLaunchConfigFileToProject(String fileName) throws CoreException {
+ getIProject().getFile(fileName).create(
+ new ByteArrayInputStream(getSample(fileName).getBytes()),
+ false, new NullProgressMonitor());
+ }
+}
+
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ResourceReadUtils.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ResourceReadUtils.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ResourceReadUtils.java 2010-10-13 12:50:09 UTC (rev 25783)
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.console.test.utils;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.hibernate.console.ConfigurationXMLFactory;
+import org.hibernate.eclipse.console.test.HibernateConsoleTestPlugin;
+
+/**
+ * @author Vitali Yemialyanchyk
+ */
+public class ResourceReadUtils {
+
+ public static final String LN_1 = "\n"; //$NON-NLS-1$
+ public static final String LN_2 = "\r\n"; //$NON-NLS-1$
+
+ /**
+ * Parse, i.e. adjust xml text so attributes for same xmls
+ * will be in one order.
+ *
+ * @param sample
+ * @return adjusted xml
+ */
+ public static String adjustXmlText(String sample) {
+ Document doc = null;
+ try {
+ doc = DocumentHelper.parseText(sample);
+ } catch (DocumentException e) {
+ // ignore
+ }
+ if (doc == null) {
+ return sample;
+ }
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ConfigurationXMLFactory.dump(baos, doc.getRootElement());
+ return baos.toString().trim();
+ }
+
+ public static String getSample(String fileName) {
+ File resourceFile = null;
+ try {
+ resourceFile = getResourceItem(fileName);
+ } catch (IOException e1) {
+ }
+ if (resourceFile == null || !resourceFile.exists()) {
+ return null;
+ }
+ StringBuffer cbuf = new StringBuffer((int) resourceFile.length());
+ try {
+ String ls = System.getProperties().getProperty("line.separator", LN_1); //$NON-NLS-1$
+ BufferedReader in = new BufferedReader(new FileReader(resourceFile));
+ String str;
+ while ((str = in.readLine()) != null) {
+ cbuf.append(str + ls);
+ }
+ in.close();
+ } catch (IOException e) {
+ }
+ return adjustXmlText(cbuf.toString());
+ }
+
+ public static File getResourceItem(String strResPath) throws IOException {
+ IPath resourcePath = new Path(strResPath);
+ File resourceFolder = resourcePath.toFile();
+ URL entry = HibernateConsoleTestPlugin.getDefault().getBundle().getEntry(
+ strResPath);
+ String tplPrjLcStr = strResPath;
+ if (entry != null) {
+ URL resProject = FileLocator.resolve(entry);
+ tplPrjLcStr = FileLocator.resolve(resProject).getFile();
+ }
+ resourceFolder = new File(tplPrjLcStr);
+ return resourceFolder;
+ }
+
+ public static String readStream(InputStream is) {
+ StringBuffer sb = new StringBuffer(""); //$NON-NLS-1$
+ try {
+ byte[] b = new byte[4096];
+ while (true) {
+ int l = is.read(b, 0, b.length);
+ if (l < 0) {
+ break;
+ }
+ sb.append(new String(b, 0, l));
+ }
+ is.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return sb.toString();
+ }
+}
+
15 years, 6 months
JBoss Tools SVN: r25782 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-13 07:56:09 -0400 (Wed, 13 Oct 2010)
New Revision: 25782
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
Log:
[JBIDE-7326] added cloud removal (was missing in new code)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-10-13 11:38:50 UTC (rev 25781)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-10-13 11:56:09 UTC (rev 25782)
@@ -14,6 +14,7 @@
import java.util.List;
import java.util.Map;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -523,9 +524,18 @@
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
, ((IStructuredSelection) viewer.getSelection()).toList());
if (Dialog.OK == dialog.open()) {
- viewer.remove(dialog.getResult());
+ removeCloudViewElements(dialog.getResult());
}
}
+
+ private void removeCloudViewElements(Object[] cloudViewerElements) {
+ viewer.remove(cloudViewerElements);
+ for (Object cloudViewElement : cloudViewerElements) {
+ Assert.isTrue(cloudViewElement instanceof CloudViewElement);
+ DeltaCloud deltaCloud = (DeltaCloud) ((CloudViewElement) cloudViewElement).getElement();
+ DeltaCloudManager.getDefault().removeCloud(deltaCloud);
+ }
+ }
};
removeCloud.setText(CVMessages.getString(REMOVE_CLOUD));
removeCloud.setToolTipText(CVMessages.getString(REMOVE_CLOUD));
15 years, 6 months