JBoss Tools SVN: r26426 - trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/pages.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2010-11-10 13:59:13 -0500 (Wed, 10 Nov 2010)
New Revision: 26426
Modified:
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/pages/ProcessPage.java
Log:
REOPENED - issue JBIDE-7477: ODE deployment descriptor editor is not closed when deploy.xml file is deleted.
https://jira.jboss.org/browse/JBIDE-7477
Modified: trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/pages/ProcessPage.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/pages/ProcessPage.java 2010-11-10 18:56:20 UTC (rev 26425)
+++ trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/pages/ProcessPage.java 2010-11-10 18:59:13 UTC (rev 26426)
@@ -40,6 +40,7 @@
import org.eclipse.bpel.model.PartnerLinks;
import org.eclipse.bpel.model.Process;
import org.eclipse.bpel.model.Scope;
+import org.eclipse.bpel.ui.BPELMultipageEditorPart;
import org.eclipse.bpel.ui.BPELUIPlugin;
import org.eclipse.bpel.ui.IBPELUIConstants;
import org.eclipse.bpel.ui.util.BPELUtil;
@@ -100,6 +101,7 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.SectionPart;
import org.eclipse.ui.forms.editor.FormEditor;
@@ -845,6 +847,24 @@
}
});
}
+ // https://jira.jboss.org/browse/JBIDE-7477
+ // close editor when file is deleted
+ else {
+ IFile editorFile = ((IFileEditorInput)getEditorInput()).getFile();
+ IResource target = delta.getResource();
+ if (delta.getKind() == IResourceDelta.REMOVED &&
+ target instanceof IFile &&
+ editorFile.equals(target))
+ {
+ // Close the editor if its input file has been moved or deleted.
+ Display display = getSite().getShell().getDisplay();
+ display.asyncExec(new Runnable() {
+ public void run() {
+ getSite().getPage().closeEditor(ProcessPage.this.editor, false);
+ }
+ });
+ }
+ }
return true; // visit the children
}
15 years, 5 months
JBoss Tools SVN: r26425 - in trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext: config/requirement and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2010-11-10 13:56:20 -0500 (Wed, 10 Nov 2010)
New Revision: 26425
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/DBBean.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/PrepareDB.java
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/ConfiguredState.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.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/RequirementBase.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
Log:
Initial support implementation for Database requirements
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-11-10 18:45:12 UTC (rev 26424)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/Annotations.java 2010-11-10 18:56:20 UTC (rev 26425)
@@ -54,6 +54,12 @@
* setting this to false will disable this feature
* @return
*/
+ /**
+ * optionally require Database
+ * @return
+ */
+ DB db() default @DB (required = false);
+
boolean clearWorkspace() default true;
/**
* by default all projects are undeployed from pre-configured server & deleted before test runs
@@ -172,6 +178,24 @@
String operator() default "=";
}
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface DB {
+ /**
+ * true if DB is required ()
+ * @return
+ */
+ boolean required() default true;
+ /**
+ * version of database (use * for al)
+ * @return
+ */
+ String version() default "*";
+ /**
+ * defines operator for version version, possible values (=,<,>=<=,>=,!=) default =
+ * @return
+ */
+ String operator() default "=";
+ }
public enum ServerState {
/**
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ConfiguredState.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ConfiguredState.java 2010-11-10 18:45:12 UTC (rev 26424)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ConfiguredState.java 2010-11-10 18:56:20 UTC (rev 26425)
@@ -18,6 +18,7 @@
private Seam seam = new Seam();
private ESB esb = new ESB();
private JBPM jbpm = new JBPM();
+ private DB db = new DB();
private boolean viewsPrepared = false;
@@ -72,6 +73,13 @@
return jbpm;
}
+ /**
+ * gets configured database
+ */
+ public DB getDB() {
+ return db;
+ }
+
public class Server {
/**
* is server runtime & server added?
@@ -148,4 +156,20 @@
*/
public String name = null;
}
+
+
+ public class DB {
+ /**
+ * version of DB
+ */
+ public String version = null;
+ /**
+ * is configured?
+ */
+ public boolean isConfigured = false;
+ /**
+ * name of added runtime
+ */
+ public String name = null;
+ }
}
Added: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/DBBean.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/DBBean.java (rev 0)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/DBBean.java 2010-11-10 18:56:20 UTC (rev 26425)
@@ -0,0 +1,87 @@
+package org.jboss.tools.ui.bot.ext.config;
+
+import static org.junit.Assert.fail;
+
+import org.jboss.tools.ui.bot.ext.helper.DatabaseHelper.DBType;
+
+/**
+ * DB Bean class representing property string data
+ * @author jpeterka
+ *
+ */
+public class DBBean {
+ public String version;
+ public String jdbcString;
+ public String driverPath;
+ public String scriptPath;
+ public DBType dbType;
+
+ public static DBBean fromString(String propValue) throws Exception{
+ try {
+ if (propValue==null) {
+ return null;
+ }
+ String[] dbParams = propValue.split(",");
+ DBBean bean = new DBBean();
+ bean.dbType=getDBType(dbParams[0]);
+ bean.version = dbParams[1];
+ bean.driverPath=dbParams[2];
+ bean.jdbcString=dbParams[3];
+ bean.scriptPath=dbParams[4];
+
+
+ return bean;
+ }
+ catch (Exception ex) {
+ throw new Exception("Cannot parse DB property line",ex);
+ }
+ }
+ @Override
+ public String toString() {
+ return String.format("DB runtime version=%s, jdbc_string=%s, driver_path=%s ",
+ this.version, this.jdbcString, this.driverPath);
+ }
+
+ /**
+ * A common method for all enums since they can't have another base class
+ * @param <T> Enum type
+ * @param c enum type. All enums must be all caps.
+ * @param string case insensitive
+ * @return corresponding enum, or null
+ */
+ public static <T extends Enum<T>> T getEnumFromString(Class<T> c, String string)
+ {
+ if( c != null && string != null )
+ {
+ try
+ {
+ return Enum.valueOf(c, string.trim());
+ //return Enum.valueOf(c, string.trim().toUpperCase());
+ }
+ catch(IllegalArgumentException ex)
+ {
+ }
+ }
+ return null;
+ }
+ /**
+ * Validate given db type, fix lower/upper case if needed
+ */
+ private static DBType getDBType(String type) {
+ // list of supported database types (except hsql)
+ String[] valid = {"hsqldb18","db2_97","mssql2005","mssql2008","mysql50","mysql51","oracle10g",
+ "oracle11gR1","oracle11gR1RAC","oracle11gR2","oracle11gR2RAC","postgressql82","postgresql83",
+ "postgresql84","sybase15"};
+
+ for (String v : valid) {
+ if (v.equalsIgnoreCase(type)) {
+ return getEnumFromString(DBType.class, v);
+ }
+ }
+
+ fail("Database type is not valid");
+ throw new IllegalArgumentException("Can't get DB type");
+ }
+
+
+}
\ No newline at end of file
Property changes on: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/DBBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java 2010-11-10 18:45:12 UTC (rev 26424)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java 2010-11-10 18:56:20 UTC (rev 26425)
@@ -29,6 +29,7 @@
private ESBBean esb;
private JavaBean java;
private JBPMBean jbpm;
+ private DBBean db;
public TestConfiguration(String propName, String propFile) throws Exception {
this.propName = propName;
@@ -58,6 +59,7 @@
printConfig(Keys.ESB, esb);
jbpm = JBPMBean.fromString(getProperty(Keys.JBPM));
printConfig(Keys.JBPM, jbpm);
+ db = DBBean.fromString(getProperty(Keys.DB));
checkConfig();
}
@@ -80,6 +82,12 @@
checkDirExists(server.runtimeHome);
if (esb != null)
checkDirExists(esb.esbHome);
+ if (jbpm != null)
+ checkDirExists(jbpm.jbpmHome);
+ if (db != null) {
+ checkFileExists(db.driverPath);
+ checkFileExists(db.scriptPath);
+ }
// special checks capturing dependency of server on java
if (java == null
&& server != null
@@ -111,6 +119,12 @@
+ "' does not exist or is not directory");
}
}
+
+ private static void checkFileExists(String path) throws FileNotFoundException {
+ if (!new File(path).exists() || !new File(path).isFile()) {
+ throw new FileNotFoundException("File " + path + " not exist or is not file");
+ }
+ }
public ESBBean getEsb() {
return esb;
@@ -139,4 +153,8 @@
public JBPMBean getJBPM() {
return jbpm;
}
+
+ public DBBean getDB() {
+ return db;
+ }
}
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-11-10 18:45:12 UTC (rev 26424)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2010-11-10 18:56:20 UTC (rev 26425)
@@ -10,6 +10,7 @@
import java.util.Properties;
import org.apache.log4j.Logger;
+import org.jboss.tools.ui.bot.ext.config.Annotations.DB;
import org.jboss.tools.ui.bot.ext.config.Annotations.ESB;
import org.jboss.tools.ui.bot.ext.config.Annotations.JBPM;
import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
@@ -28,6 +29,7 @@
public static final String JAVA = "JAVA";
public static final String ESB = "ESB";
public static final String JBPM = "JBPM";
+ public static final String DB = "DB";
}
public class Values {
@@ -193,6 +195,16 @@
}
return RequirementBase.createAddJBPM();
}
+
+ private static RequirementBase getDBRequirement(DB d) {
+ if (!d.required() || currentConfig.getDB() == null) {
+ return null;
+ }
+ if (!matches(currentConfig.getDB().version, d.operator(), d.version())) {
+ return null;
+ }
+ return RequirementBase.prepareDB();
+ }
/**
* returns list of requirements if given class (Test) can run, all this is
@@ -238,6 +250,13 @@
}
reqs.add(req);
}
+ if (requies.db().required()) {
+ RequirementBase req = getDBRequirement(requies.db());
+ if (req == null) {
+ return null;
+ }
+ reqs.add(req);
+ }
if (!"".equals(requies.perspective())) {
reqs.add(RequirementBase.createSwitchPerspective(requies
Added: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/PrepareDB.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/PrepareDB.java (rev 0)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/PrepareDB.java 2010-11-10 18:56:20 UTC (rev 26425)
@@ -0,0 +1,72 @@
+package org.jboss.tools.ui.bot.ext.config.requirement;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.eclipse.datatools.connectivity.ConnectionProfileException;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.config.TestConfiguration;
+import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
+import org.jboss.tools.ui.bot.ext.helper.DatabaseHelper;
+import org.jboss.tools.ui.bot.ext.types.DriverEntity;
+import org.junit.Assert;
+
+public class PrepareDB extends RequirementBase {
+
+ @Override
+ public boolean checkFulfilled() {
+ return SWTTestExt.configuredState.getDB().isConfigured;
+ }
+
+ @Override
+ public void handle() {
+ TestConfiguration configuration = TestConfigurator.currentConfig;
+
+ // Define Driver Entity
+ DriverEntity entity = new DriverEntity();
+ entity.setDrvPath(configuration.getDB().driverPath);
+ entity.setJdbcString(configuration.getDB().jdbcString);
+ entity.setProfileName(configuration.getDB().dbType.toString());
+ entity.setUser("sa");
+ entity.setPassword("");
+ entity.setDriverTemplateDescId(DatabaseHelper.getDriverTemplate(configuration.getDB().dbType));
+
+ try {
+ DatabaseHelper.createDriver(entity);
+ } catch (ConnectionProfileException e) {
+ log.error("Unable to create HSQL Driver" + e);
+ Assert.fail();
+ }
+
+ File file = new File(configuration.getDB().scriptPath);
+ StringBuilder builder = new StringBuilder();
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new FileReader(file));
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ while(true) {
+ String line = null;
+ try {
+ line = reader.readLine();
+ if (line == null) break;
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ builder.append(line);
+ }
+ DatabaseHelper.openSQLEditor(configuration.getDB().dbType, configuration.getDB().dbType.toString(), "Default" );
+ DatabaseHelper.runSQLScript(builder.toString());
+
+ if (configuration.getDB().dbType.equals("HSQLDB_1.8")) {
+ // TODO
+ }
+ }
+
+}
Property changes on: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/PrepareDB.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/RequirementBase.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/RequirementBase.java 2010-11-10 18:45:12 UTC (rev 26424)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/RequirementBase.java 2010-11-10 18:56:20 UTC (rev 26425)
@@ -162,7 +162,10 @@
RequirementBase req = new RemoveServer();
return req;
}
-
-
+ public static RequirementBase prepareDB () {
+ RequirementBase req = new PrepareDB();
+ return req;
+ }
+
}
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2010-11-10 18:45:12 UTC (rev 26424)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2010-11-10 18:56:20 UTC (rev 26425)
@@ -1,5 +1,8 @@
package org.jboss.tools.ui.bot.ext.helper;
+import static org.eclipse.swtbot.eclipse.finder.matchers.WithPartName.withPartName;
+import static org.junit.Assert.fail;
+
import java.io.File;
import java.io.IOException;
import java.util.Properties;
@@ -18,12 +21,23 @@
import org.eclipse.datatools.connectivity.drivers.IPropertySet;
import org.eclipse.datatools.connectivity.drivers.PropertySetImpl;
import org.eclipse.datatools.connectivity.drivers.models.TemplateDescriptor;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.ui.IViewReference;
+import org.hamcrest.Matcher;
import org.jboss.tools.ui.bot.ext.Activator;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
import org.jboss.tools.ui.bot.ext.types.DriverEntity;
+import org.jboss.tools.ui.bot.ext.types.PerspectiveType;
+import org.jboss.tools.ui.bot.ext.types.ViewType;
public class DatabaseHelper {
-
+ public static int SLEEP = 1000;
+
/**
* Create HSQLDB Driver
* @throws ConnectionProfileException
@@ -93,5 +107,169 @@
public static void createDriver(DriverEntity entity) throws ConnectionProfileException {
createDriver(entity,"DefaultDS");
}
-
+ /**
+ *
+ */
+ public static void openSQLEditor(DBType type, String profile, String db) {
+ SWTEclipseExt eclipse = new SWTEclipseExt();
+ SWTWorkbenchBot bot = eclipse.getBot();
+
+ eclipse.openPerspective(PerspectiveType.DB_DEVELOPMENT);
+ eclipse.showView(ViewType.DATA_SOURCE_EXPLORER);
+
+ bot.saveAllEditors();
+ bot.closeAllEditors();
+
+ bot.sleep(SLEEP);
+
+ Matcher<IViewReference> matcher = withPartName("Data Source Explorer");
+ SWTBotView view = bot.view(matcher);
+
+ bot.sleep(SLEEP);
+ SWTBotTree tree = view.bot().tree();
+
+ // Open SQL Scrapbook
+ SWTBotTreeItem item = tree.expandNode("Database Connections")
+ .expandNode(profile);
+ item.contextMenu("Connect").click();
+ item.contextMenu("Open SQL Scrapbook").click();
+
+ // Set SQL Scrapbook
+ SWTBotEditor editor = bot.editorByTitle("SQL Scrapbook 0");
+ editor.setFocus();
+ bot.comboBoxWithLabelInGroup("Type:", "Connection profile")
+ .setSelection(getTypeCombo(type));
+ bot.comboBoxWithLabelInGroup("Name:", "Connection profile")
+ .setSelection(profile);
+ bot.comboBoxWithLabelInGroup("Database:", "Connection profile")
+ .setSelection(db);
+ }
+
+ /**
+ *
+ * @param script
+ */
+ public static void runSQLScript(String script) {
+ SWTEclipseExt eclipse = new SWTEclipseExt();
+ SWTWorkbenchBot bot = eclipse.getBot();
+
+ SWTBotEditor editor = bot.editorByTitle("SQL Scrapbook 0");
+ editor.toTextEditor().setText(script);
+
+ // Execute Script and close
+ bot.editorByTitle("SQL Scrapbook 0").toTextEditor()
+ .contextMenu("Execute All").click();
+ editor.close();
+ bot.sleep(SLEEP);
+ }
+
+ /**
+ * Database type enum
+ *
+ * @author jpeterka
+ *
+ */
+ public enum DBType {
+ hsqldb18, db2_97, mssql2005, mssql2008, mysql50, mysql51, oracle10g, oracle11gR1, oracle11gR1RAC, oracle11gR2, oracle11gR2RAC, postgresql82, postgresql83, postgresql84, sybase15
+ }
+
+ /**
+ * Return driver template for creating new connection
+ *
+ * @param type
+ * @return
+ */
+ public static String getDriverTemplate(DBType type) {
+ String ret = "";
+ switch (type) {
+ case hsqldb18:
+ ret = "org.eclipse.datatools.enablement.hsqldb.1_8.driver";
+ break;
+ case db2_97:
+ ret = "org.eclipse.datatools.enablement.ibm.db2.luw.driverTemplate";
+ break;
+ case mssql2005:
+ ret = "org.eclipse.datatools.enablement.msft.sqlserver.2005.driverTemplate";
+ break;
+ case mssql2008:
+ ret = "org.eclipse.datatools.enablement.msft.sqlserver.2008.driverTemplate";
+ break;
+ case mysql50:
+ ret = "org.eclipse.datatools.enablement.mysql.5_0.driverTemplate";
+ break;
+ case mysql51:
+ ret = "org.eclipse.datatools.enablement.mysql.5_1.driverTemplate";
+ break;
+ case oracle10g:
+ ret = "org.eclipse.datatools.enablement.oracle.10.driverTemplate";
+ break;
+ case oracle11gR1: // Intentionally empty
+ case oracle11gR1RAC: // Intentionally empty
+ case oracle11gR2: // Intentionally empty
+ case oracle11gR2RAC:
+ ret = "org.eclipse.datatools.enablement.oracle.11.driverTemplate";
+ break;
+ case postgresql82: // Intentionally empty
+ case postgresql83: // Intentionally empty
+ case postgresql84: // Intentionally empty
+ case sybase15:
+ ret = "org.eclipse.datatools.connectivity.db.sybase.ase.genericDriverTemplate_15";
+ break;
+ default:
+ fail("Unknown db type");
+ break;
+ }
+ return ret;
+ }
+
+ /**
+ * Resolves db type for eclipse usage in SQL editor
+ *
+ * @param type
+ * @return
+ */
+ public static String getTypeCombo(DBType type) {
+ String ret = "";
+ switch (type) {
+ case hsqldb18:
+ ret = "HSQLDB_1.8";
+ break;
+ case db2_97:
+ ret = "DB2 UDB_V9.1";
+ break;
+ case mssql2005:
+ ret = "SQL Server_2005";
+ break;
+ case mssql2008:
+ ret = "SQL Server_2008";
+ break;
+ case mysql50:
+ ret = "MySQL_5.0";
+ break;
+ case mysql51:
+ ret = "MySQL_5.1";
+ break;
+ case oracle10g:
+ ret = "Oracle_10";
+ break;
+ case oracle11gR1: // Intentionally empty
+ case oracle11gR1RAC: // Intentionally empty
+ case oracle11gR2: // Intentionally empty
+ case oracle11gR2RAC:
+ ret = "Oracle_11";
+ break;
+ case postgresql82: // Intentionally empty
+ case postgresql83: // Intentionally empty
+ case postgresql84:
+ ret = "postgres_8.x";
+ break;
+ case sybase15:
+ ret = "Sybase_ASE_15.x";
+ break;
+ default:
+ fail("Unknown db type");
+ break;
+ }
+ return ret;
+ }
}
15 years, 5 months
JBoss Tools SVN: r26424 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2010-11-10 13:45:12 -0500 (Wed, 10 Nov 2010)
New Revision: 26424
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
Log:
Spelling mistake fixed
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2010-11-10 18:13:11 UTC (rev 26423)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2010-11-10 18:45:12 UTC (rev 26424)
@@ -1216,7 +1216,7 @@
IDELabel.Menu.DEBUG_AS_DROOLS_APPLICATION).click();
}
/**
- * Returns true if parentNode contains Tree Item with nodeLabel
+ * Returns true if parentNode containss Tree Item with nodeLabel
* @param parentNode
* @param nodeLabel
* @return
15 years, 5 months
JBoss Tools SVN: r26423 - in trunk/smooks/plugins: org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2010-11-10 13:13:11 -0500 (Wed, 10 Nov 2010)
New Revision: 26423
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/ModelBuilder.java
trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XMLSampleModelBuilder.java
trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/template/Mapping.java
trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilder.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/RuntimeMetadata.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/Codegenerator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLObjectAnalyzer.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSDObjectAnalyzer.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/edimap/editor/Test.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/model/TreeNodeConnection.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/InputDataTreeNodeModel.java
Log:
https://jira.jboss.org/browse/JBIDE-7539
When mapping from input to template (xml to csv) get NPE
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/ModelBuilder.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/ModelBuilder.java 2010-11-10 16:45:43 UTC (rev 26422)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/ModelBuilder.java 2010-11-10 18:13:11 UTC (rev 26423)
@@ -198,6 +198,10 @@
}
public static boolean isCollection(Element element) {
+ if(element == null) {
+ return false;
+ }
+
int maxOccurs = getMaxOccurs(element);
return (maxOccurs > 1 || maxOccurs == -1);
@@ -288,6 +292,18 @@
return false;
}
+
+ /**
+ * Does the model element have child content of any kind.
+ * <p/>
+ * Does it have child elements or attributes.
+ *
+ * @param element The element to test.
+ * @return true if the element contains child content of any kind, otherwise false.
+ */
+ public static boolean hasChildContent(Element element) {
+ return (element.hasAttributes() || hasChildElements(element));
+ }
/**
* Set the model as being strict, or not.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XMLSampleModelBuilder.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XMLSampleModelBuilder.java 2010-11-10 16:45:43 UTC (rev 26422)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XMLSampleModelBuilder.java 2010-11-10 18:13:11 UTC (rev 26423)
@@ -23,9 +23,12 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -94,15 +97,30 @@
registerNamepsaces(documentElement);
}
- private void trimNonModelNodes(Element element) {
+ public static void trimNonModelNodes(Element element) {
NodeList children = element.getChildNodes();
List<Node> removeableChildren = new ArrayList<Node>();
+ Set<QName> childElementSet = new HashSet<QName>();
for(int i = 0; i < children.getLength(); i++) {
- Node child = children.item(i);
+ Node child = children.item(i);
if(child.getNodeType() == Node.ELEMENT_NODE) {
- trimNonModelNodes((Element) child);
+ Element childElement = (Element) child;
+ QName childElementQName;
+
+ if(childElement.getPrefix() != null) {
+ childElementQName = new QName(childElement.getNamespaceURI(), childElement.getLocalName(), childElement.getPrefix());
+ } else {
+ childElementQName = new QName(childElement.getNamespaceURI(), childElement.getTagName());
+ }
+
+ if(!childElementSet.contains(childElementQName)) {
+ childElementSet.add(childElementQName);
+ trimNonModelNodes((Element) child);
+ } else {
+ removeableChildren.add(child);
+ }
} else {
removeableChildren.add(child);
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/template/Mapping.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/template/Mapping.java 2010-11-10 16:45:43 UTC (rev 26422)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/template/Mapping.java 2010-11-10 18:13:11 UTC (rev 26423)
@@ -23,6 +23,8 @@
import java.util.List;
import org.eclipse.core.runtime.Assert;
+import org.jboss.tools.smooks.templating.model.ModelBuilder;
+import org.w3c.dom.Attr;
import org.w3c.dom.Node;
/**
@@ -74,13 +76,13 @@
}
public boolean isParentNodeMapping(Mapping mapping) {
- Node parentNode = mapping.getMappingNode().getParentNode();
+ Node parentNode = ModelBuilder.getParentNode(mapping.getMappingNode());
while(parentNode != null) {
if(parentNode == getMappingNode()) {
return true;
}
- parentNode = parentNode.getParentNode();
+ parentNode = ModelBuilder.getParentNode(parentNode);
}
return false;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilder.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilder.java 2010-11-10 16:45:43 UTC (rev 26422)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilder.java 2010-11-10 18:13:11 UTC (rev 26423)
@@ -143,12 +143,12 @@
TemplateBuilder.writeIndent(indent, templateWriter);
writeElementStart(element, templateWriter);
- if(writeElementChildren(element, indent + 1, templateWriter) > 0) {
+
+ ChildWriteHistory writeChildHistory = writeElementChildren(element, indent + 1, templateWriter);
+ if(writeChildHistory.numElementsWritten > 0) {
TemplateBuilder.writeIndent(indent, templateWriter);
- writeElementEnd(element, true, templateWriter);
- } else {
- writeElementEnd(element, false, templateWriter);
}
+ writeElementEnd(element, writeChildHistory.startClosed, templateWriter);
if(collectionMapping != null) {
templateWriter.write("\n"); //$NON-NLS-1$
@@ -206,15 +206,16 @@
templateWriter.write(quoteChar); //$NON-NLS-1$
}
- private int writeElementChildren(Element element, int indent, Writer templateWriter) throws IOException {
+ private ChildWriteHistory writeElementChildren(Element element, int indent, Writer templateWriter) throws IOException {
NodeList children = element.getChildNodes();
- int numElementsWritten = 0;
+ ChildWriteHistory writeHistory = new ChildWriteHistory();
if(children.getLength() == 0) {
Mapping mapping = getMapping(element);
- if(ModelBuilder.getElementType(element) == ElementType.simple) {
+ if(ModelBuilder.getElementType(element) == ElementType.simple && mapping instanceof ValueMapping) {
templateWriter.write(">"); //$NON-NLS-1$
+ writeHistory.startClosed = true;
if(mapping != null) {
templateWriter.write(FreeMarkerUtil.toFreeMarkerVariable((ValueMapping)mapping, isNodeModelSource()));
} else {
@@ -224,12 +225,17 @@
} else {
if(!ModelBuilder.isInReservedNamespace(element)) {
templateWriter.write(">"); //$NON-NLS-1$
+ writeHistory.startClosed = true;
}
for(int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if(child.getNodeType() == Node.ELEMENT_NODE) {
+ if(!writeHistory.startClosed) {
+ templateWriter.write(">"); //$NON-NLS-1$
+ writeHistory.startClosed = true;
+ }
writeElement((Element)child, indent, true, templateWriter);
- numElementsWritten++;
+ writeHistory.numElementsWritten++;
}
}
if(!ModelBuilder.isInReservedNamespace(element)) {
@@ -237,11 +243,16 @@
}
}
- return numElementsWritten;
+ return writeHistory;
}
+
+ private class ChildWriteHistory {
+ private int numElementsWritten = 0;
+ private boolean startClosed = false;
+ }
- private void writeElementEnd(Element element, boolean hasChildren, Writer templateWriter) throws IOException {
- if(hasChildren || ModelBuilder.getElementType(element) == ElementType.simple) {
+ private void writeElementEnd(Element element, boolean startClosed, Writer templateWriter) throws IOException {
+ if(startClosed) {
templateWriter.write("</"); //$NON-NLS-1$
templateWriter.write(element.getNodeName());
templateWriter.write(">"); //$NON-NLS-1$
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/RuntimeMetadata.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/RuntimeMetadata.java 2010-11-10 16:45:43 UTC (rev 26422)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/RuntimeMetadata.java 2010-11-10 18:13:11 UTC (rev 26423)
@@ -95,12 +95,16 @@
return Messages.RuntimeMetadata_Error_SmooksFile_Not_Valid;
} else if (inputFile == null) {
return Messages.RuntimeMetadata_Error_Input_Task_No_Input_File;
- } else if (!inputFile.exists()) {
- return Messages.RuntimeMetadata_Error_Input_Task_Input_File_Not_Found;
- } else if (!inputFile.isFile()) {
- return Messages.RuntimeMetadata_Error_Input_Task_Input_File_Cannot_Be_Read;
+ }
+
+ if(!SmooksModelUtils.INPUT_TYPE_JAVA.equals(inputType)) {
+ if (!inputFile.exists()) {
+ return Messages.RuntimeMetadata_Error_Input_Task_Input_File_Not_Found;
+ } else if (!inputFile.isFile()) {
+ return Messages.RuntimeMetadata_Error_Input_Task_Input_File_Cannot_Be_Read;
+ }
}
-
+
return ""; //$NON-NLS-1$
}
@@ -194,7 +198,7 @@
}
inputFile = new File(resolvedFilePath);
- if (inputFile.exists() && inputFile.isFile()) {
+ if (SmooksModelUtils.INPUT_TYPE_JAVA.equals(inputType) || (inputFile.exists() && inputFile.isFile())) {
isValidSmooksConfig = true;
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/Codegenerator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/Codegenerator.java 2010-11-10 16:45:43 UTC (rev 26422)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/Codegenerator.java 2010-11-10 18:13:11 UTC (rev 26423)
@@ -65,8 +65,8 @@
continue;
}
File file = new File(basePath + eClass.getName() + "UICreator.java"); //$NON-NLS-1$
- System.out.println("map.put(" + eClass.getName() + "Impl.class, new " //$NON-NLS-1$ //$NON-NLS-2$
- + eClass.getName() + "UICreator());"); //$NON-NLS-1$
+// System.out.println("map.put(" + eClass.getName() + "Impl.class, new " //$NON-NLS-1$ //$NON-NLS-2$
+// + eClass.getName() + "UICreator());"); //$NON-NLS-1$
if (!file.exists()) {
file.createNewFile();
FileWriter writer = new FileWriter(file);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLObjectAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLObjectAnalyzer.java 2010-11-10 16:45:43 UTC (rev 26422)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLObjectAnalyzer.java 2010-11-10 18:13:11 UTC (rev 26423)
@@ -19,6 +19,7 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
+import org.jboss.tools.smooks.templating.model.xml.XMLSampleModelBuilder;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -59,6 +60,9 @@
IOException {
DocumentBuilder builder = createDocumentBuildingFactory();
Document doc = builder.parse(stream);
+
+ XMLSampleModelBuilder.trimNonModelNodes(doc.getDocumentElement());
+
return analyze(doc, ignoreNodeNames, tagObjectClass);
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSDObjectAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSDObjectAnalyzer.java 2010-11-10 16:45:43 UTC (rev 26422)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSDObjectAnalyzer.java 2010-11-10 18:13:11 UTC (rev 26423)
@@ -208,7 +208,7 @@
resource.load(Collections.EMPTY_MAP);
XSDSchema schema = (XSDSchema) resource.getContents().get(0);
TagObject rootTag = new XSDObjectAnalyzer().loadElement(schema, "smooks-resource-list"); //$NON-NLS-1$
- System.out.println(rootTag);
+// System.out.println(rootTag);
// List<XSDElementDeclaration> elements =
// schema.getElementDeclarations();
// for (Iterator<?> iterator = elements.iterator(); iterator.hasNext();)
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/edimap/editor/Test.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/edimap/editor/Test.java 2010-11-10 16:45:43 UTC (rev 26422)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/edimap/editor/Test.java 2010-11-10 18:13:11 UTC (rev 26423)
@@ -72,8 +72,8 @@
generateChildrenTag(tag, ss, separators, 0);
}
}
-
- System.out.println(rootTag);
+//
+// System.out.println(rootTag);
}
private String getSeparator(String s){
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/model/TreeNodeConnection.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/model/TreeNodeConnection.java 2010-11-10 16:45:43 UTC (rev 26422)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/model/TreeNodeConnection.java 2010-11-10 18:13:11 UTC (rev 26423)
@@ -177,10 +177,12 @@
}
if(builder.length() > 0) {
- builder.insert(0, '.');
+ builder.insert(0, '/');
}
if(currentNode.getNodeType() == Node.ATTRIBUTE_NODE) {
builder.insert(0, "@" + ((Attr)currentNode).getNodeName());
+ currentNode = ((Attr)currentNode).getOwnerElement();
+ continue;
} else if(currentNode.getNodeType() == Node.ELEMENT_NODE) {
builder.insert(0, DomUtils.getName((Element)currentNode));
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/InputDataTreeNodeModel.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/InputDataTreeNodeModel.java 2010-11-10 16:45:43 UTC (rev 26422)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/InputDataTreeNodeModel.java 2010-11-10 18:13:11 UTC (rev 26423)
@@ -109,8 +109,10 @@
Object sourceData = AdapterFactoryEditingDomain.unwrap(this.getData());
if(sourceData instanceof AbstractXMLObject) {
Element sourceElement = ((AbstractXMLObject)sourceData).getReferenceElement();
- if(ModelBuilder.isCollection(sourceElement) || (!ModelBuilder.isStrictModel(sourceElement.getOwnerDocument()) && ModelBuilder.hasChildElements(sourceElement))) {
- return true;
+ if(sourceElement != null) {
+ if(ModelBuilder.isCollection(sourceElement) || (!ModelBuilder.isStrictModel(sourceElement.getOwnerDocument()) && ModelBuilder.hasChildContent(sourceElement))) {
+ return true;
+ }
}
}
return false;
15 years, 5 months
JBoss Tools SVN: r26422 - in trunk: vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-11-10 11:45:43 -0500 (Wed, 10 Nov 2010)
New Revision: 26422
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/SubstitutedELExressionsTest.java
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
Log:
Added Substituted EL Exressions Test
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-11-10 16:36:17 UTC (rev 26421)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-11-10 16:45:43 UTC (rev 26422)
@@ -154,6 +154,7 @@
public static final String USER_SPECIFIED_TAG_TEMPLATE = "User specified tag template";
public static final String PAGE_DESIGN_OPTIONS = "Page Design Options";
public static final String ADD_TAGLIB_REFRENCE = "Add Taglib Reference";
+ public static final String ADD_EL_REFERENCE = "Add EL Reference";
}
public class EntityGroup {
@@ -603,7 +604,10 @@
public static final String INCLUDED_TAG_LIBS_TAB = "Included tag libs";
public static final String INCLUDED_TAG_LIBS_URI = "URI*";
public static final String INCLUDED_TAG_LIBS_PREFIX = "Prefix";
-
+
+ public static final String SUBSTITUTED_EL_EXPRESSIONS_TAB = "Substituted EL expressions";
+ public static final String SUBSTITUTED_EL_EXPRESSIONS_EL_NAME = "El Name*";
+ public static final String SUBSTITUTED_EL_EXPRESSIONS_VALUE = "Value";
}
public static class AddTaglibReferenceDialog{
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2010-11-10 16:36:17 UTC (rev 26421)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2010-11-10 16:45:43 UTC (rev 26422)
@@ -15,6 +15,7 @@
import org.jboss.tools.vpe.ui.bot.test.editor.XhtmlFilePerformanceTest;
import org.jboss.tools.vpe.ui.bot.test.editor.pagedesign.AddSubstitutedELExpressionFolderScopeTest;
import org.jboss.tools.vpe.ui.bot.test.editor.pagedesign.IncludedTagLibsTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.pagedesign.SubstitutedELExressionsTest;
import org.jboss.tools.vpe.ui.bot.test.editor.pagedesign.ToolbarTextFormattingTest;
import org.jboss.tools.vpe.ui.bot.test.editor.preferences.AlwaysHideSelectionBarWithoutPromptTest;
import org.jboss.tools.vpe.ui.bot.test.editor.preferences.BorderForUnknownTagsTest;
@@ -76,6 +77,7 @@
suite.addTestSuite(TextEditingActionsTest.class);
suite.addTestSuite(PromptForTagAttributesDuringTagInsertTest.class);
suite.addTestSuite(IncludedTagLibsTest.class);
+ suite.addTestSuite(SubstitutedELExressionsTest.class);
return new TestSetup(suite);
}
}
Added: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/SubstitutedELExressionsTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/SubstitutedELExressionsTest.java (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/SubstitutedELExressionsTest.java 2010-11-10 16:45:43 UTC (rev 26422)
@@ -0,0 +1,103 @@
+/*******************************************************************************
+
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.bot.test.editor.pagedesign;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+
+/**
+ * Tests functionality of Substituted EL Expressions tab page of Page Design Options Dialog
+ * @author vlado pakan
+ *
+ */
+public class SubstitutedELExressionsTest extends PageDesignTestCase {
+
+ private SWTBot addELReferenceDialogBot = null;
+ private SWTBot optionsDialogBot = null;
+ private SWTBot editELReferenceDialogBot = null;
+
+ public void testIncludedTagLibs(){
+ openPage();
+ bot.toolbarButtonWithTooltip(PAGE_DESIGN).click();
+ optionsDialogBot = bot.shell(IDELabel.Shell.PAGE_DESIGN_OPTIONS).activate().bot();
+ optionsDialogBot.tabItem(IDELabel.PageDesignOptionsDialog.SUBSTITUTED_EL_EXPRESSIONS_TAB).activate();
+ optionsDialogBot.button(IDELabel.Button.ADD_WITHOUT_DOTS).click();
+ addELReferenceDialogBot = optionsDialogBot.shell(IDELabel.Shell.ADD_EL_REFERENCE).activate().bot();
+ SWTBotText txMessage = addELReferenceDialogBot.text(2);
+ SWTBotText txValue = addELReferenceDialogBot.textWithLabel(IDELabel.PageDesignOptionsDialog.SUBSTITUTED_EL_EXPRESSIONS_VALUE);
+ SWTBotText txName = addELReferenceDialogBot.textWithLabel(IDELabel.PageDesignOptionsDialog.SUBSTITUTED_EL_EXPRESSIONS_EL_NAME);
+ // Tests default message
+ final String defaultMessage = txMessage.getText();
+ final String defaultMessageStartsWith = "Add El variable";
+ assertTrue("Default Dialog Message has to start with '" + defaultMessageStartsWith + "' but is: " + defaultMessage,
+ defaultMessage.startsWith(defaultMessageStartsWith));
+ // Tests properly set Value
+ final String testName = "page.consist";
+ txName.setText(testName);
+ assertTrue("Dialog Message has to be '" + defaultMessage + "' but is: " + txMessage.getText(),
+ txMessage.getText().equals(defaultMessage));
+ // Tests incorrect name message
+ txName.setText(testName + " error");
+ final String invalidELNameMessage = " Invalid EL expression.";
+ assertTrue("Dialog Message has to be '" + invalidELNameMessage + "' but is: " + txMessage.getText(),
+ txMessage.getText().equals(invalidELNameMessage));
+ // Tests properly set Name and Value
+ txName.setText(testName);
+ final String testValue = "test value";
+ txValue.setText(testValue);
+ assertTrue("Dialog Message has to be '" + defaultMessage + "' but is: " + txMessage.getText(),
+ txMessage.getText().equals(defaultMessage));
+ addELReferenceDialogBot.button(IDELabel.Button.FINISH).click();
+ addELReferenceDialogBot = null;
+ // Reopens dialog and tests saved values
+ optionsDialogBot.button(IDELabel.Button.EDIT_WITHOUT_DOTS).click();
+ editELReferenceDialogBot = optionsDialogBot.shell(IDELabel.Shell.ADD_EL_REFERENCE).activate().bot();
+ txMessage = editELReferenceDialogBot.text(2);
+ txName = editELReferenceDialogBot.textWithLabel(IDELabel.PageDesignOptionsDialog.SUBSTITUTED_EL_EXPRESSIONS_EL_NAME);
+ txValue = editELReferenceDialogBot.textWithLabel(IDELabel.PageDesignOptionsDialog.SUBSTITUTED_EL_EXPRESSIONS_VALUE);
+ assertTrue("Dialog Message has to be '" + defaultMessage + "' but is: " + txMessage.getText(),
+ txMessage.getText().equals(defaultMessage));
+ assertTrue("Value has to be'" + testValue + "' but is: " + txValue.getText(),
+ txValue.getText().equals(testValue));
+ assertTrue("Name value has to be'" + testName + "' but is: " + txName.getText(),
+ txName.getText().equals(testName));
+ editELReferenceDialogBot.button(IDELabel.Button.CANCEL).click();
+ editELReferenceDialogBot = null;
+ optionsDialogBot.button(IDELabel.Button.OK).click();
+ optionsDialogBot = null;
+ }
+
+ @Override
+ protected void closeUnuseDialogs() {
+ if (addELReferenceDialogBot != null){
+ addELReferenceDialogBot.button(IDELabel.Button.CANCEL).click();
+ addELReferenceDialogBot = null;
+ }
+ if (editELReferenceDialogBot != null){
+ editELReferenceDialogBot.button(IDELabel.Button.CANCEL).click();
+ editELReferenceDialogBot = null;
+ }
+ if (optionsDialogBot != null){
+ optionsDialogBot.button(IDELabel.Button.OK).click();
+ optionsDialogBot = null;
+ }
+ }
+
+ @Override
+ protected boolean isUnuseDialogOpened() {
+ return optionsDialogBot != null
+ || addELReferenceDialogBot != null
+ || editELReferenceDialogBot != null;
+ }
+
+}
Property changes on: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/SubstitutedELExressionsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 5 months
JBoss Tools SVN: r26421 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-11-10 11:36:17 -0500 (Wed, 10 Nov 2010)
New Revision: 26421
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowTextFormattingHandler.java
Log:
https://jira.jboss.org/browse/JBIDE-7531
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java 2010-11-10 16:18:35 UTC (rev 26420)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java 2010-11-10 16:36:17 UTC (rev 26421)
@@ -81,12 +81,6 @@
}
/**
- * The constructor.
- */
- public RotateEditorsHandler() {
- }
-
- /**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
@@ -111,7 +105,13 @@
preferences.setValue(
IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING,
newOrientation);
-
+ IEditorReference[] openedEditors = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage()
+ .getEditorReferences();
+ for (IEditorReference openedEditor : openedEditors) {
+ IEditorPart editor = openedEditor.getEditor(true);
+ rotateEditor(editor, newOrientation);
+ }
Command command = event.getCommand();
ICommandService commandService = (ICommandService) PlatformUI
.getWorkbench().getService(ICommandService.class);
@@ -120,7 +120,6 @@
}
public void updateElement(UIElement element, Map parameters) {
- super.updateElement(element, parameters);
IPreferenceStore preferences = JspEditorPlugin.getDefault()
.getPreferenceStore();
String orientation = preferences
@@ -141,17 +140,6 @@
element.setTooltip(orientationName);
element.setText(orientationName);
- /*
- * Call <code>filContainer()</code> from VpeEditorPart to redraw
- * CustomSashForm with new layout.
- */
- IEditorReference[] openedEditors = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage()
- .getEditorReferences();
- for (IEditorReference openedEditor : openedEditors) {
- IEditorPart editor = openedEditor.getEditor(true);
- rotateEditor(editor, orientation);
- }
}
private void rotateEditor(IEditorPart editor, String orientation) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowTextFormattingHandler.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowTextFormattingHandler.java 2010-11-10 16:18:35 UTC (rev 26420)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowTextFormattingHandler.java 2010-11-10 16:36:17 UTC (rev 26421)
@@ -41,27 +41,13 @@
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
- boolean oldToggleState = HandlerUtil.toggleCommandState(event
+ boolean toggleState = !HandlerUtil.toggleCommandState(event
.getCommand());
JspEditorPlugin
.getDefault()
.getPreferenceStore()
.setValue(IVpePreferencesPage.SHOW_TEXT_FORMATTING,
- !oldToggleState);
-
- Command command = event.getCommand();
- ICommandService commandService = (ICommandService) PlatformUI
- .getWorkbench().getService(ICommandService.class);
- commandService.refreshElements(command.getId(), null);
-
- return null;
- }
-
- public void updateElement(UIElement element, Map parameters) {
- super.updateElement(element, parameters);
- boolean toggleState = JspEditorPlugin.getDefault().getPreferenceStore()
- .getBoolean(IVpePreferencesPage.SHOW_TEXT_FORMATTING);
-
+ toggleState);
IEditorReference[] openedEditors = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage()
.getEditorReferences();
@@ -69,7 +55,7 @@
IEditorPart editor = openedEditor.getEditor(true);
toggleShowTextFormatting(editor, toggleState);
}
-
+ return null;
}
private void toggleShowTextFormatting(IEditorPart editor,
15 years, 5 months
JBoss Tools SVN: r26420 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper.
by jbosstools-commits@lists.jboss.org
Author: psrna
Date: 2010-11-10 11:18:35 -0500 (Wed, 10 Nov 2010)
New Revision: 26420
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
Log:
* modification of createDriver method which is now more general
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2010-11-10 16:16:04 UTC (rev 26419)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2010-11-10 16:18:35 UTC (rev 26420)
@@ -41,10 +41,10 @@
DriverInstance driver = DriverManager.getInstance().getDriverInstanceByName(entity.getInstanceName());
if (driver == null) {
- TemplateDescriptor descr = TemplateDescriptor.getDriverTemplateDescriptor("org.eclipse.datatools.enablement.hsqldb.1_8.driver");
- IPropertySet instance = new PropertySetImpl(entity.getInstanceName(), "DriverDefn.Hypersonic DB");
+ TemplateDescriptor descr = TemplateDescriptor.getDriverTemplateDescriptor(entity.getDriverTemplateDescId());
+ IPropertySet instance = new PropertySetImpl(entity.getInstanceName(), entity.getDriverDefId());
instance.setName(entity.getInstanceName());
- instance.setID("DriverDefn.Hypersonic DB");
+ instance.setID(entity.getDriverDefId());
Properties props = new Properties();
IConfigurationElement[] template = descr.getProperties();
@@ -70,15 +70,15 @@
if (driver != null && ProfileManager.getInstance().getProfileByName(profileName) == null) { //$NON-NLS-1$
// create profile
Properties props = new Properties();
- props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID, "DriverDefn.Hypersonic DB");
+ props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID, entity.getDriverDefId());
props.setProperty(IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID, ""); //$NON-NLS-1$
props.setProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID));
props.setProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID));
props.setProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID));
props.setProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID, entity.getDatabaseName()); //$NON-NLS-1$
- props.setProperty(IDBDriverDefinitionConstants.PASSWORD_PROP_ID, ""); //$NON-NLS-1$
- props.setProperty(IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, "false"); //$NON-NLS-1$
- props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID));
+ props.setProperty(IDBDriverDefinitionConstants.PASSWORD_PROP_ID, entity.getPassword()); //$NON-NLS-1$ //my
+ props.setProperty(IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, "false"); //$NON-NLS-1$
+ props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID, entity.getUser()/*driver.getProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID)*/);
props.setProperty(IDBDriverDefinitionConstants.URL_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID));
ProfileManager.getInstance().createProfile(entity.getProfileName(), entity.getProfileDescription(), IDBConnectionProfileConstants.CONNECTION_PROFILE_ID, props, "", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
15 years, 5 months
JBoss Tools SVN: r26419 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types.
by jbosstools-commits@lists.jboss.org
Author: psrna
Date: 2010-11-10 11:16:04 -0500 (Wed, 10 Nov 2010)
New Revision: 26419
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/DriverEntity.java
Log:
* driver entity extended
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/DriverEntity.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/DriverEntity.java 2010-11-10 15:49:09 UTC (rev 26418)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/DriverEntity.java 2010-11-10 16:16:04 UTC (rev 26419)
@@ -16,12 +16,19 @@
*
*/
public class DriverEntity {
+ /*
+ * Defaults for Hibernate
+ */
String instanceName = "Hypersonic DB";
String drvPath = "";
String jdbcString = "";
String profileName = "DefaultDS";
String profileDescription = "Hypersonic embedded database";
String databaseName = "Default";
+ String user = "sa";
+ String pwd = "";
+ String driverTemplateDescId = "org.eclipse.datatools.enablement.hsqldb.1_8.driver";
+ String driverDefId = "DriverDefn.Hypersonic DB";
public String getInstanceName() {
return instanceName;
@@ -44,6 +51,18 @@
public String getProfileName() {
return profileName;
}
+ public String getUser(){
+ return user;
+ }
+ public String getPassword(){
+ return pwd;
+ }
+ public String getDriverTemplateDescId(){
+ return driverTemplateDescId;
+ }
+ public String getDriverDefId(){
+ return driverDefId;
+ }
public void setProfileName(String profileName) {
this.profileName = profileName;
}
@@ -59,6 +78,17 @@
public void setDatabaseName(String databaseName) {
this.databaseName = databaseName;
}
+ public void setPassword(String pwd){
+ this.pwd = pwd;
+ }
+ public void setUser(String user){
+ this.user = user;
+ }
+ public void setDriverTemplateDescId(String id){
+ this.driverTemplateDescId = id;
+ }
+ public void setDriverDefId(String id){
+ this.driverDefId = id;
+ }
-
}
15 years, 5 months
JBoss Tools SVN: r26418 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2010-11-10 10:49:09 -0500 (Wed, 10 Nov 2010)
New Revision: 26418
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
Log:
JBIDE-7289
Visual Page Editor cannot be opened on deleted resource by pressing Alt-Left or "Back to ..." button on toolbar
Issue is fixed
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2010-11-10 15:38:07 UTC (rev 26417)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2010-11-10 15:49:09 UTC (rev 26418)
@@ -459,7 +459,11 @@
break;
}
}
- new ResourceChangeListener(this, getContainer());
+
+ IFile f = getFile();
+ if (f != null && f.exists()) {
+ new ResourceChangeListener(this, getContainer());
+ }
if (getModelObject() != null) {
getModelObject().getModel().addModelTreeListener(syncListener);
}
@@ -904,10 +908,8 @@
return;
IPath path = getPathChange(event, f);
if (path == null) {
-// if (f != null && !f.exists())
-// closeEditor(); // Fix for JBIDE-7289: we don't close the editor here
- // due to let eclipse to show error dialog and
- // default view for the corrupted editor
+ if (f != null && !f.exists())
+ closeEditor();
return;
}
f = ModelPlugin.getWorkspace().getRoot().getFile(path);
15 years, 5 months