<plugin
id="net.sourceforge.phpeclipse.css.core"
name="PHPeclipse Web Development Tools CSS Core"
- version="1.1.0"
+ version="1.1.1"
provider-name="WDTE Project/PHPeclipse.de"
class="net.sourceforge.phpeclipse.css.core.CssCore">
<plugin
id="net.sourceforge.phpeclipse.css.ui"
name="%pluginName"
- version="1.1.0"
+ version="1.1.1"
provider-name="%providerName"
class="net.sourceforge.phpeclipse.css.ui.CssUI">
<plugin
id="net.sourceforge.phpeclipse.html.ui"
name="%pluginName"
- version="1.1.0"
+ version="1.1.1"
provider-name="%providerName"
class="net.sourceforge.phpeclipse.html.ui.HTMLUI">
<plugin
id="net.sourceforge.phpeclipse.js.core"
name="%pluginName"
- version="1.1.0"
+ version="1.1.1"
provider-name="%providerName"
class="net.sourceforge.phpeclipse.js.core.JSCorePlugin">
<plugin
id="net.sourceforge.phpeclipse.js.ui"
name="%pluginName"
- version="1.1.0"
+ version="1.1.1"
provider-name="%providerName"
class="net.sourceforge.phpeclipse.js.ui.JSUIPlugin">
<plugin
id="net.sourceforge.phpeclipse.news"
name="PHPeclipse RSS News"
- version="3.0.3"
+ version="1.1.1"
provider-name="phpeclipse.de"
class="net.sourceforge.phpeclipse.news.Plugin">
package net.sourceforge.phpeclipse.news;
+import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Timer;
*/
protected void initializeDefaultPreferences(IPreferenceStore store) {
store.setDefault(REFRESH_INTERVAL_PREFERENCE, DEFAULT_REFRESH_INTERVAL);
- store.setDefault(BROWSER_PREFERENCE, DEFAULT_BROWSER);
+ File file = new File(DEFAULT_BROWSER);
+ if (file.exists()) {
+ store.setDefault(BROWSER_PREFERENCE, DEFAULT_BROWSER);
+ }
store.setDefault(BANNED_ITEMS_PREFERENCE, DEFAULT_BANNED_ITEMS);
store.setDefault(FORCE_CACHE_PREFERENCE, DEFAULT_FORCE_CACHE);
}
quantum.name = Quantum DB Utility
-perspective.name = Quantum DB
+perspective.name = PHP SQL (Quantum)
sqllogview.name = Quantum SQL Log
driverview.name = JDBC Driver View
tableview.name = Quantum Table View
<plugin
id="net.sourceforge.phpeclipse.quantum.sql"
name="%quantum.name"
- version="2.4.2"
+ version="2.4.4"
provider-name="The QuantumDB Development Team"
class="com.quantum.QuantumPlugin">
</library>
</runtime>
<requires>
- <import plugin="org.eclipse.core.runtime.compatibility"/>
- <import plugin="org.eclipse.ui.ide"/>
- <import plugin="org.eclipse.ui.views"/>
- <import plugin="org.eclipse.jface.text"/>
- <import plugin="org.eclipse.ui.workbench.texteditor"/>
- <import plugin="org.eclipse.ui.editors"/>
<import plugin="org.eclipse.core.boot"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.swt"/>
<import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.jface.text"/>
+ <import plugin="org.eclipse.ui.editors"/>
+ <import plugin="org.eclipse.ui.workbench.texteditor"/>
+ <import plugin="org.eclipse.ui.views"/>
</requires>
public static final String SUBSET = "subset";
public static final String SUCCESS = "success";
public static final String TABLE = "bigtable";
+ public static final String SYNONYM_TABLE = "big_syn_table";
public static final String TABLE_DETAILS = "table_details";
public static final String TEMPLATE = "template";
public static final String TRIGGER = "trigger";
addImage(plugin, registry, url, SUBSET);
addImage(plugin, registry, url, SUCCESS);
addImage(plugin, registry, url, TABLE);
+ addImage(plugin, registry, url, SYNONYM_TABLE);
addImage(plugin, registry, url, TABLE_DETAILS);
addImage(plugin, registry, url, TEMPLATE);
addImage(plugin, registry, url, TRIGGER);
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import com.quantum.model.BookmarkCollection;
-import com.quantum.util.xml.XMLHelper;
-import com.quantum.view.subset.SubsetContentProvider;
-
import org.eclipse.core.resources.ISavedState;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
+import com.quantum.model.BookmarkCollection;
+import com.quantum.util.xml.XMLHelper;
+import com.quantum.view.subset.SubsetContentProvider;
+
/**
* Main class of the quantum plugin, sets defaults, saves and recovers state.
* @author root
* @param descriptor
*/
public QuantumPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
+ this();
+ }
+ /**
+ * This version is recommended for eclipse3.0 and above
+ */
+ public QuantumPlugin(){
+ super();
plugin = this;
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugin#startup()
+ * This method is deprecated in Eclipse3.0 we must use start(BundleContext context):
+ * Migration completed.
*/
public void startup() throws CoreException {
super.startup();
+ startupMigrationTempMethod(); // To be removed later
+ }
+
+ /**
+ * Used during startup Eclipse3.0 compatible
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ startupMigrationTempMethod(); // To be removed later
+ }
+ private void startupMigrationTempMethod() throws CoreException {
+ // the contents of this.startup() is moved to here to avoid code duplication - see this.start(BundleContext)
ISavedState lastState =
ResourcesPlugin.getWorkspace().addSaveParticipant(
this,
* @throws MalformedURLException
*/
private URL getIconLocation() throws MalformedURLException {
- URL installURL = getDescriptor().getInstallURL();
+// URL installURL = getDescriptor().getInstallURL();
+ URL installURL = getBundle().getEntry("/");
return new URL(installURL, "icons/");
}
}
\ No newline at end of file
com.quantum.actions.DisconnectAction.text = Disconnect
com.quantum.actions.DisconnectAction.message = Disconnected
com.quantum.actions.ViewTableAction.text = View Table
+com.quantum.actions.OpenDataEditorAction.text = Edit Table
+com.quantum.actions.OpenDataVEditorAction.text = VEdit Table
com.quantum.actions.OpenQueryAction.text = Open
com.quantum.actions.RefreshBookmarkAction.text = Refresh
com.quantum.actions.NextSequenceAction.text = Increment Sequence Value
com.quantum.adapters.DatabaseAdapter.POINTBASE = Pointbase
com.quantum.adapters.DatabaseAdapter.JDBC_ODBC_BRIDGE = JDBC-ODBC Bridge
com.quantum.adapters.DatabaseAdapter.MS_SQL_SERVER = Microsoft SQL Server
+com.quantum.adapters.DatabaseAdapter.DERBY = Apache Derby (Cloudscape)
com.quantum.util.connection.ConnectionUtil.title = Connection Not Established
com.quantum.util.connection.ConnectionUtil.message = The bookmark could not be connected.
com.quantum.actions.ExecuteAction.parsing=Parsing sql script...
com.quantum.actions.ExecuteAction.autocommitTitle=Autocommit changed
com.quantum.actions.ExecuteAction.autocommitMessage=The autocommit setting of the bookmark, {0} has been changed.
+com.quantum.actions.CustomCopyAction.text = Custom Copy
com.quantum.view.bookmark.CopyAction.text = Copy
com.quantum.view.bookmark.DeleteAction.text = Delete
com.quantum.view.bookmark.QuickListNode.labelName=Quick List
com.quantum.view.bookmark.QueryListNode.labelName=Recent SQL Statements
com.quantum.view.bookmark.RenameAction.text = Rename
+com.quantum.view.bookmark.exportDataCSVAction.text=CSV Format
com.quantum.view.bookmark.BookmarkViewActionGroup.sqlAction.text = SQL Statements
com.quantum.view.tableview.PreviousPageAction.text=Previous
com.quantum.view.tableview.RefreshTableAction.text=Refresh
com.quantum.view.tableview.ChangeEncodingAction.default=Default encoding
-com.quantum.view.tableview.ChangeEncodingAction.utf8=UTF-8 encoding
-com.quantum.view.tableview.ChangeEncodingAction.utf16=UTF-16 encoding
+com.quantum.view.tableview.ChangeEncodingAction.encoding=encoding
com.quantum.view.tableview.CloseResultSetAction.text=Close Result Set
com.quantum.view.tableview.CloseAllResultSetsAction.text=Close All Result Sets
com.quantum.view.tableview.CopyAction.text=Copy
com.quantum.view.tableview.ResultSetViewer.position = {0} to {1} of {2} rows.
com.quantum.view.tableview.ResultSetViewer.unknown = <unknown>
+com.quantum.view.tableview.TableViewActionGroup.otherEncodingsAction.text = Other Encodings...
+
com.quantum.wizards.URLSetupControl.text=JDBC Connection URL
com.quantum.wizards.URLSetupControl.hostname=Host name:
com.quantum.wizards.URLSetupControl.port=Port:
import java.sql.SQLException;
import java.util.Iterator;
+import com.quantum.Messages;
import com.quantum.QuantumPlugin;
import com.quantum.model.Column;
import com.quantum.model.EntityHolder;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.ui.IViewPart;
import org.eclipse.ui.actions.SelectionListenerAction;
public class CustomCopyAction extends SelectionListenerAction {
private final int ind;
- /**
- * @param BookmarkView
- */
- public CustomCopyAction(IViewPart view, int ind) {
- super(null);
+ public CustomCopyAction( int ind ) {
+ super(Messages.getString(CustomCopyAction.class.getName() + ".text"));
this.ind = ind;
}
public void run() {
String copyText = "";
- Iterator iter = getSelectedNonResources().iterator();
+ Iterator iter = getSelectedNonResources().iterator();
NthLevelConverter converter = new NthLevelConverter();
// Fill up the converter. We iterate the selection items
while (iter.hasNext()) {
new Object[] { copyText },
new Transfer[] { TextTransfer.getInstance()});
}
+
}
public static final String SYBASE = "SYBASE"; //$NON-NLS-1$
public static final String JDBC_ODBC_BRIDGE = "JDBC_ODBC_BRIDGE"; //$NON-NLS-1$
public static final String MS_SQL_SERVER = "MS_SQL_SERVER"; //$NON-NLS-1$
+ public static final String DERBY = "DERBY"; //$NON-NLS-1$
private static final Map DRIVER_MAP = Collections.synchronizedMap(new HashMap());
static {
DRIVER_MAP.put("com.ddtek.jdbc.informix.InformixDriver", new DriverInfo(INFORMIX));
DRIVER_MAP.put("com.ddtek.jdbc.db2.DB2Driver", new DriverInfo(DB2, "jdbc:datadirect:db2://${hostname}:${port};DatabaseName=${dbname}"));
- DRIVER_MAP.put("com.ddtek.jdbc.oracle.OracleDriver", new DriverInfo(ORACLE));
+ DRIVER_MAP.put("com.ddtek.jdbc.oracle.OracleDriver", new DriverInfo(ORACLE ,"jdbc:oracle:thin:@{hostname}:{port}:{dbname}"));
DRIVER_MAP.put("com.ddtek.jdbc.sqlserver.SQLServerDriver", new DriverInfo(GENERIC));
DRIVER_MAP.put("com.ddtek.jdbc.sybase.SybaseDriver", new DriverInfo(SYBASE));
DRIVER_MAP.put("com.ibm.as400.access.AS400JDBCDriver", new DriverInfo(DB2AS400));
DRIVER_MAP.put("COM.ibm.db2.jdbc.app.DB2Driver", new DriverInfo(DB2, "jdbc:db2:{dbname}"));
DRIVER_MAP.put("COM.ibm.db2.jdbc.net.DB2Driver", new DriverInfo(DB2, "jdbc:db2://{hostname}:{port}/{dbname}"));
- DRIVER_MAP.put("com.inet.ora.OraDriver", new DriverInfo(ORACLE));
+ DRIVER_MAP.put("com.inet.ora.OraDriver", new DriverInfo(ORACLE ,"jdbc:oracle:thin:@{hostname}:{port}:{dbname}"));
DRIVER_MAP.put("com.inet.drda.DRDADriver", new DriverInfo(DB2, "jdbc:inetdb2:{hostname}:{port}?database={dbname}"));
DRIVER_MAP.put("com.inet.syb.SybDriver", new DriverInfo(SYBASE));
DRIVER_MAP.put("com.inet.tds.TdsDriver", new DriverInfo(MS_SQL_SERVER));
DRIVER_MAP.put("com.sybase.jdbc2.jdbc.SybDriver", new DriverInfo(SYBASE, "jdbc:sybase:Tds:{hostname}:{port}/{dbname}"));
DRIVER_MAP.put("com.sybase.jdbcx.SybDriver", new DriverInfo(SYBASE, "jdbc:sybase:Tds:{hostname}:{port}/{dbname}"));
DRIVER_MAP.put("net.sourceforge.jtds.jdbc.Driver", new DriverInfo(MS_SQL_SERVER));
- DRIVER_MAP.put("oracle.jdbc.driver.OracleDriver", new DriverInfo(ORACLE));
+ DRIVER_MAP.put("oracle.jdbc.driver.OracleDriver", new DriverInfo(ORACLE ,"jdbc:oracle:thin:@{hostname}:{port}:{dbname}"));
+ DRIVER_MAP.put("oracle.jdbc.OracleDriver", new DriverInfo(ORACLE ,"jdbc:oracle:thin:@{hostname}:{port}:{dbname}"));
DRIVER_MAP.put("org.gjt.mm.mysql.Driver", new DriverInfo(MYSQL, "jdbc:mysql://{hostname}:{port}/{dbname}"));
DRIVER_MAP.put("org.hsqldb.jdbcDriver", new DriverInfo(HSQLDB));
DRIVER_MAP.put("org.postgresql.Driver", new DriverInfo(POSTGRES, "jdbc:postgresql://{hostname}:{port}/{dbname}"));
DRIVER_MAP.put("sun.jdbc.odbc.JdbcOdbcDriver", new DriverInfo(JDBC_ODBC_BRIDGE, "jdbc:odbc:{datasource}"));
DRIVER_MAP.put("weblogic.jdbc.informix.InformixDriver", new DriverInfo(INFORMIX));
DRIVER_MAP.put("weblogic.jdbc.sqlserver.SybaseDriver", new DriverInfo(SYBASE));
+ DRIVER_MAP.put("org.apache.derby.jdbc.driver20", new DriverInfo(DERBY, "jdbc:derby:{dbname}"));
+ DRIVER_MAP.put("org.apache.derby.jdbc.driver30", new DriverInfo(DERBY, "jdbc:derby:{dbname}"));
+ DRIVER_MAP.put("org.apache.derby.jdbc.EmbeddedDriver", new DriverInfo(DERBY, "jdbc:derby:{dbname}"));
+
}
private static AdapterFactory instance;
addAdapter(new GenericAdapter(POINTBASE));
addAdapter(new GenericAdapter(JDBC_ODBC_BRIDGE));
addAdapter(new MSSQLServerAdapter());
+ addAdapter(new GenericAdapter(DERBY));
}
private void addAdapter(DatabaseAdapter adapter) {
this.adapters.put(adapter.getType(), adapter);
} else if (type == java.sql.Types.DATE || type == java.sql.Types.TIMESTAMP){
string = string.trim();
//Check if we have to strip the millisecods
- String sub = string.substring(string.length() - 2, string.length() - 1);
- if (string.length() > 1 && sub.equals(".")) //$NON-NLS-1$
- string = string.substring(0, string.length() - 2); // strip the milliseconds
+ if (string.length() > 2) {
+ String sub = string.substring(string.length() - 2, string.length() - 1);
+ if (string.length() > 1 && sub.equals(".")) //$NON-NLS-1$
+ string = string.substring(0, string.length() - 2); // strip the milliseconds
+ }
return "'" + string + "'"; //$NON-NLS-1$ //$NON-NLS-2$
public Map getDefaultConnectionParameters() {
return new HashMap();
}
+
+ /**
+ * Returns the SQL Query to get a list of the Sysnonyms for the current user (schema), of the given type
+ * @param schema The schema to get the query for
+ * @param type The type of the synonym to get. Types can be one from the Entity types
+ * @return - A String with the SQL query
+ */
+ public String getShowSynonymsQuery(String schema, String type) {
+ return null;
+ }
}
\ No newline at end of file
package com.quantum.adapters;
+import java.util.HashMap;
+import java.util.Map;
+
import com.quantum.Messages;
import com.quantum.util.QuantumUtil;
return "SELECT SEQUENCE_OWNER, SEQUENCE_NAME FROM ALL_SEQUENCES WHERE SEQUENCE_OWNER = '" + qualifier + "'"; //$NON-NLS-1$
}
public String getPrevValue(String sequence, String owner) {
- return "SELECT LAST_NUMBER FROM ALL_SEQUENCES WHERE SEQUENCE_OWNER = '" + owner + "' AND SEQUENCE_NAME = '" + sequence + "'"; //$NON-NLS-1$ //$NON-NLS-2$
+ return "SELECT " + getQualifiedName(owner, sequence) + ".CURRVAL FROM DUAL";
}
public String getNextValue(String sequence, String owner) {
return "SELECT " + getQualifiedName(owner, sequence) + ".NEXTVAL FROM DUAL";
public String quote(String string, int type, String typeString) {
if (type == java.sql.Types.DATE || type == java.sql.Types.TIMESTAMP) {
string = string.trim();
- String sub = string.substring(string.length()-2, string.length()-1);
- if (string.length() > 1 && sub.equals(Messages.getString("OracleAdapter.._3"))) //$NON-NLS-1$
- string = string.substring(0,string.length()-2);
+ // Eliminate the fractions of seconds, if present
+ if (string.length() > 1) {
+ // If the third character from the end is a dot, it means it has fractions
+ String sub = string.substring(string.length()-2, string.length()-1);
+ if ( sub.equals(Messages.getString("."))) //$NON-NLS-1$
+ string = string.substring(0,string.length()-2);
+ }
return "TO_DATE('" + string + "','yyyy-mm-dd hh24:mi:ss')"; //$NON-NLS-1$ //$NON-NLS-2$
}
// use the default (upper type)
public String getDefaultSchema(String userid) {
return super.getDefaultSchema(userid).toUpperCase();
}
-
+
+ public Map getDefaultConnectionParameters() {
+ Map map = new HashMap();
+ map.put("port", "1521");
+ map.put("hostname", "localhost");
+ return map;
+ }
+
+ /* (non-Javadoc)
+ * @see com.quantum.adapters.DatabaseAdapter#getShowSynonymsQuery(java.lang.String, java.lang.String)
+ */
+ public String getShowSynonymsQuery(String schema, String type) {
+ // The type string is the same as the one needed by Oracle. If it changes a switch would be needed.
+ return "select SYNONYM_NAME from ALL_SYNONYMS, ALL_OBJECTS where " +
+ " ALL_SYNONYMS.OWNER = '" + schema + "'" +
+ " and ALL_SYNONYMS.TABLE_OWNER = ALL_OBJECTS.OWNER" +
+ " and ALL_SYNONYMS.TABLE_NAME = ALL_OBJECTS.OBJECT_NAME" +
+ " and ALL_OBJECTS.OBJECT_TYPE = '" + type + "'" ;
+ }
}
\ No newline at end of file
}
public String getTableQuery(String table) {
- return "SELECT OID, * FROM " + filterTableName(table); //$NON-NLS-1$
+ return "SELECT * FROM " + filterTableName(table); //$NON-NLS-1$
}
/**
* @see com.quantum.adapters.DatabaseAdapter#filterTableName(java.lang.String)
*/
public String filterTableName(String tableName) {
// If there is no mixed case, better not quote, it's prettier on display
- if (tableName.equals(tableName.toUpperCase())) return tableName;
- // We quote the table name (and only the table name) because it has mixed case
+ // Postgresql defaults to lower case identifiers
+ if (tableName.equals(tableName.toLowerCase())) return tableName;
+ // We quote the table name because it has mixed case
if (QuantumUtil.getSchemaName(tableName).equals("")) {
- return "\"" + tableName +"\""; //$NON-NLS-1$
+ return "\"" + tableName + "\""; //$NON-NLS-1$
} else {
- return QuantumUtil.getSchemaName(tableName) + ".\"" +
+ return "\"" + QuantumUtil.getSchemaName(tableName) + "\".\"" +
QuantumUtil.getTableName(tableName) + "\"";
}
}
this.propertyChangeSupport.removePropertyChangeListener(listener);
}
- public void addQuickListEntry(String type, String schemaName, String name) {
- Entity entity = EntityFactory.getInstance().create(this, schemaName, name, type);
+ public void addQuickListEntry(String type, String schemaName, String name, boolean isSynonym) {
+ Entity entity = EntityFactory.getInstance().create(this, schemaName, name, type, isSynonym);
this.quickList.put(entity.getQualifiedName(), entity);
this.propertyChangeSupport.firePropertyChange("quickList", null, null);
this.changed = true;
}
public void addQuickListEntry(Entity entity) {
- addQuickListEntry(entity.getType(), entity.getSchema(), entity.getName());
+ addQuickListEntry(entity.getType(), entity.getSchema(), entity.getName(), entity.isSynonym());
}
public void removeQuickListEntry(Entity entity) {
if (Node.ELEMENT_NODE == childNodes.item(k).getNodeType()) {
Element entity = (Element) childNodes.item(k);
bookmark.addQuickListEntry(entity.getTagName(),
- entity.getAttribute("schema"), entity.getAttribute("name"));
+ entity.getAttribute("schema"), entity.getAttribute("name"), entity.getAttribute("isSynonym").equals("true") );
}
}
}
* @author bcholmes
*/
public interface Column {
- public int getSize();
+ public long getSize();
public int getPrimaryKeyOrder();
public boolean isPrimaryKey();
public String getName();
*/
class ColumnImpl implements Column, Comparable {
- private int size;
+ private long size;
private boolean nullable;
private int primaryKeyOrder;
private String name;
private String remarks;
ColumnImpl(Entity entity, String name, String typeName, int type,
- int size, int numberOfFractionalDigits, boolean nullable, int position,
+ long size, int numberOfFractionalDigits, boolean nullable, int position,
String remarks) {
this.entity = entity;
/**
* @return
*/
- public int getSize() {
+ public long getSize() {
return size;
}
public class DataType {
private final int javaType;
private final String databaseTypeName;
- private final int precision;
+ private final long precision;
private final String literalPrefix;
private final String literalSuffix;
private final String createParameters;
* @param createParameters
*/
public DataType(final int javaType, final String databaseTypeName,
- final int precision, final String literalPrefix, final String literalSuffix,
+ final long precision, final String literalPrefix, final String literalSuffix,
final String createParameters) {
super();
this.javaType = javaType;
public String getLiteralSuffix() {
return this.literalSuffix;
}
- public int getPrecision() {
+ public long getPrecision() {
return this.precision;
}
}
for (int i = 0; i < types.length; i++) {
list.addAll(getEntitiesList(bookmark, connection, types[i], schema));
+ // TODO: This should be polished so that synonyms can be shown with different icons as regular Entities
+ list.addAll(getSynonymsList(bookmark, connection, types[i], schema));
}
return (Entity[]) list.toArray(new Entity[list.size()]);
tableName = (tableName == null) ? "" : tableName.trim();
if (tableName != null && tableName.length() > 0) {
- Entity entity = EntityFactory.getInstance().create(bookmark, tempSchema, tableName, type);
+ Entity entity = EntityFactory.getInstance().create(bookmark, tempSchema, tableName, type, false);
if (entity != null) {
list.add(entity);
}
: results.getElement(2, i).toString();
if (tableName != null && tableName.length() > 0) {
Entity entity = EntityFactory.getInstance().create(
- bookmark, schemaName, tableName, type);
+ bookmark, schemaName, tableName, type, false);
if (entity != null) {
list.add(entity);
}
}
return list;
}
+ /**
+ * Returns a list with the synonym objects of the given type, using a query
+ * @param bookmark
+ * @param connection
+ * @param type
+ * @param schema
+ * @return
+ * @throws SQLException
+ */
+ protected List getSynonymsList(Bookmark bookmark, Connection connection, String type, Schema schema)
+ throws SQLException {
+
+ List list = new ArrayList();
+ // We try first the JDBC driver
+ DatabaseMetaData metaData = connection.getMetaData();
+ SQLResultSetResults results = null;
+ // Get the proper sql query to the appropiate type of entity
+ String sql = this.databaseAdapter.getShowSynonymsQuery(schema.getName(), type);
+ // If nothing returned, too bad, it seems there is no sql query for that database and entity type
+ if (sql != null) {
+ results = (SQLResultSetResults) MultiSQLServer.getInstance().execute(
+ bookmark, connection, sql, Integer.MAX_VALUE);
+ for (int i = 1, size = (results == null) ? 0 : results.getRowCount(); i <= size; i++) {
+ String schemaName = results.getColumnCount() == 1
+ ? schema.getName() : results.getElement(1, i).toString();
+ if (schemaName != null) {
+ schemaName = schemaName.trim();
+ }
+ String tableName = results.getColumnCount() == 1
+ ? results.getElement(1, i).toString()
+ : results.getElement(2, i).toString();
+ if (tableName != null && tableName.length() > 0) {
+ Entity entity = EntityFactory.getInstance().create(
+ bookmark, schemaName, tableName, type, true);
+ if (entity != null) {
+ list.add(entity);
+ }
+ }
+ }
+ }
+ return list;
+}
public DataType[] getTypes() throws NotConnectedException, SQLException {
DatabaseMetaData metaData = getMetaData();
list.add(new DataType(
results.getInt(TYPE_INFO_METADATA_DATA_TYPE),
results.getString(TYPE_INFO_METADATA_TYPE_NAME),
- results.getInt(TYPE_INFO_METADATA_PRECISION),
+ results.getLong(TYPE_INFO_METADATA_PRECISION),
results.getString(TYPE_INFO_METADATA_LITERAL_PREFIX),
results.getString(TYPE_INFO_METADATA_LITERAL_SUFFIX),
results.getString(TYPE_INFO_METADATA_CREATE_PARMS)
public String getName();
public String getSchema();
public String getType();
+ public boolean isSynonym();
+
public Column[] getColumns() throws NotConnectedException, SQLException;
public Index[] getIndexes() throws NotConnectedException, SQLException;
public Column getColumn(String columnName) throws NotConnectedException, SQLException;
return EntityFactory.instance;
}
- public Entity create(Bookmark bookmark, String schema, String name, String type) {
+ public Entity create(Bookmark bookmark, String schema, String name, String type, boolean isSynonym) {
if (type != null) {
type = type.toUpperCase().trim();
}
if (Entity.TABLE_TYPE.equals(type)) {
- return new TableImpl(bookmark, schema, name);
+ return new TableImpl(bookmark, schema, name, isSynonym);
} else if (Entity.VIEW_TYPE.equals(type)) {
- return new ViewImpl(bookmark, schema, name);
+ return new ViewImpl(bookmark, schema, name, isSynonym);
} else if (Entity.SEQUENCE_TYPE.equals(type)) {
- return new SequenceImpl(bookmark, schema, name);
+ return new SequenceImpl(bookmark, schema, name, isSynonym);
} else {
return null;
// throw new IllegalArgumentException("Unknown type: " + type);
private String type;
private Bookmark bookmark;
private Boolean exists = Boolean.TRUE;
+ private boolean isSynonym = false; // Tells if its a synonym or not
+ // Columns will be cached in this array, as sometimes asking for them to the JDBC driver is very costy
+ // (for example in Oracle when synonyms and remarks are asked for )
+ private Column[] columns = null;
- public EntityImpl(Bookmark bookmark, String schema, String name, String type) {
+ public EntityImpl(Bookmark bookmark, String schema, String name, String type, boolean isSynonym) {
this.schema = schema;
this.name = name;
this.type = type;
this.bookmark = bookmark;
+ this.isSynonym = isSynonym;
}
public Bookmark getBookmark() {
return this.bookmark;
}
public Column getColumn(String columnName) throws NotConnectedException, SQLException {
Column column = null;
- Column[] columns = getColumns();
- for (int i = 0, length = (columns == null) ? 0 : columns.length;
+ if (this.columns == null) this.columns = getColumns();
+ for (int i = 0, length = (this.columns == null) ? 0 : this.columns.length;
column == null && i < length;
i++) {
- if (columnName != null && columnName.equals(columns[i].getName())) {
- column = columns[i];
+ if (columnName != null && columnName.equals(this.columns[i].getName())) {
+ column = this.columns[i];
}
}
return column;
}
public Column[] getColumns() throws NotConnectedException, SQLException {
-
+ if (this.columns != null) return this.columns;
Connection connection = this.bookmark.getConnection();
try {
- return getColumnsFromMetaData(connection);
+ this.columns = getColumnsFromMetaData(connection);
+ return this.columns;
} catch (SQLException e) {
if (SQLStates.ODBC_DRIVER_NOT_CAPABLE.equals(e.getSQLState())
&& AdapterFactory.JDBC_ODBC_BRIDGE.equals(
getBookmark().getJDBCDriver().getType())) {
- return getColumnsFromQuery(connection);
+ this.columns = getColumnsFromQuery(connection);
+ return this.columns;
} else {
throw e;
}
resultSet.getInt(COLUMN_METADATA_DECIMAL_DIGITS),
"YES".equalsIgnoreCase(resultSet.getString(COLUMN_METADATA_IS_NULLABLE)),
resultSet.getInt(COLUMN_METADATA_ORDINAL_POSITION),
- getComments(
- resultSet.getString(COLUMN_METADATA_REMARKS),
- getQualifiedName(),
- resultSet.getString(COLUMN_METADATA_COLUMN_NAME))
+ resultSet.getString(COLUMN_METADATA_REMARKS)
);
temp.put(column.getName(), column);
}
(String) rows[i].get(1),
(String) rows[i].get(2),
((Integer) rows[i].get(7)).intValue(),
- ((Integer) rows[i].get(3)).intValue(),
+ ((Long) rows[i].get(3)).longValue(),
((Integer) rows[i].get(4)).intValue(),
"Nullable".equalsIgnoreCase((String) rows[i].get(5)),
i+1, "");
* @param iniComment The already got comment
* @param tableName The fully qualified table name
* @param columnName The column name
+ *
+ * NO LONGER USED, there is a parameter (remarksReporting) in the JDBC connection that makes ORACLE return the
+ * remarks for tables and columns. Is slower, so an option will be used.
+ *
+ * The function is kept in case other JDBC drivers have the same problem
*/
private String getComments( String iniComment, String tableName, String columnName) {
if (iniComment != null && iniComment.length() > 0)
return this.getQualifiedName().compareTo(that.getQualifiedName());
}
}
+
+ /**
+ * @return Returns the isSynonym.
+ */
+ public boolean isSynonym() {
+ return isSynonym;
+ }
+
}
\ No newline at end of file
package com.quantum.model;
class SequenceImpl extends EntityImpl implements Sequence {
- public SequenceImpl(Bookmark bookmark, String schema, String name) {
- super(bookmark, schema, name, SEQUENCE_TYPE);
+ public SequenceImpl(Bookmark bookmark, String schema, String name, boolean isSynonym) {
+ super(bookmark, schema, name, SEQUENCE_TYPE, isSynonym);
}
public Column[] getColumns() {
return new Column[0];
class TableImpl extends EntityImpl implements Table {
- public TableImpl(Bookmark bookmark, String schema, String name) {
- super(bookmark, schema, name, TABLE_TYPE);
+ public TableImpl(Bookmark bookmark, String schema, String name, boolean isSynonym) {
+ super(bookmark, schema, name, TABLE_TYPE, isSynonym);
}
public Integer getSize() {
class ViewImpl extends EntityImpl implements View {
- public ViewImpl(Bookmark bookmark, String schema, String name) {
- super(bookmark, schema, name, VIEW_TYPE);
+ public ViewImpl(Bookmark bookmark, String schema, String name, boolean isSynonym) {
+ super(bookmark, schema, name, VIEW_TYPE, isSynonym);
}
public Integer getSize() {
if (entity.getSchema() != null) {
element.setAttribute("schema", entity.getSchema());
}
+ element.setAttribute("isSynonym", entity.isSynonym() ? "true" : "false");
if (recurse) {
try {
convert(element, entity.getColumns());
import java.util.Properties;
import com.quantum.Messages;
+import com.quantum.adapters.AdapterFactory;
import com.quantum.adapters.DatabaseAdapter;
import com.quantum.model.Bookmark;
import com.quantum.model.ConnectionException;
import com.quantum.model.Entity;
import com.quantum.model.JDBCDriver;
import com.quantum.model.PasswordFinder;
+import com.quantum.util.sql.SQLInstructionBuilder;
import com.quantum.view.LogProxy;
log.addText(LogProxy.QUERY, "Connecting to: " + bookmark.getName()); //$NON-NLS-1$
try {
JDBCDriver jdbcDriver = bookmark.getJDBCDriver();
- Driver driver = jdbcDriver.getDriver();
+ Driver driver = jdbcDriver.getDriver();
if (driver != null) {
Properties props = new Properties();
props.put(USERNAME, bookmark.getUsername());
props.put(PASSWORD, password);
+ // TODO: This kind of things should really be made general-purpose
+ if (jdbcDriver.getType().equals(AdapterFactory.ORACLE)){
+ // remarksReporting will make the JDBC driver return the remarks for the tables and
+ // the columns. It'll make getting the tables and columns much slower, so it should
+ // really be made into an option
+ // TODO: Make remark reporting into an option
+ props.put("remarksReporting", "true");
+ // includeSynonyms will make the JDBC driver return the proper columns when querying
+ // about a synonym. If not given, synonyms will appear with no columns, exports of data
+ // containing synonyms will break, etc.n So it's needed from the moment you add the synonyms
+ // with the getSynonymsList() in the Database.getEntities() function. That could also be
+ // made into an option, but more logically when more databases are addedd
+ // TODO: Make including synonyms into an option
+ props.put("includeSynonyms", "true");
+ }
Connection connection =
driver.connect(bookmark.getConnect(), props);
if (connection == null) {
return connection;
} else {
throw new ConnectionException(Messages.getString(
- ConnectionException.class, "couldNotInstaniateDriver",
+ ConnectionException.class, "couldNotInstantiateDriver",
new Object[] { jdbcDriver.getClassName(), bookmark.getName() }));
}
} catch (SQLException e) {
}
public SQLResultSetResults getMetaData(Entity entity, Connection connection) throws SQLException {
- String query = "SELECT * FROM " + entity.getQuotedTableName() + " WHERE (1 = 0)"; //$NON-NLS-1$ //$NON-NLS-2$
+ String query = SQLInstructionBuilder.buildSelectAllColumnsNoRows(entity);
SQLResultSetResults results = null;
if (connection != null) {
Statement statement = connection.createStatement();
long startTime = System.currentTimeMillis();
System.out.println("Executing"); //$NON-NLS-1$
LogProxy log = LogProxy.getInstance();
- log.addText(LogProxy.QUERY, "Executing Request [" + sql + "]"); //$NON-NLS-1$ //$NON-NLS-2$
+ log.addText(LogProxy.QUERY, "SQL (" + bookmark.getName() + ") [" + sql + "]"); //$NON-NLS-1$ //$NON-NLS-2$
Statement statement = con.createStatement();
try {
SQLResults results;
Vector row = new Vector();
row.addElement(metaData.getColumnName(i));
row.addElement(metaData.getColumnTypeName(i));
- int precision = metaData.getPrecision(i);
+ long precision = 0;
+ try {
+ precision = metaData.getPrecision(i);
+ } catch (Throwable t) {
+ // Do nothing. An exception can be generated by some very large row sizes, like BLOB in Oracle.
+ // Then getPrecision() will generate an exception. So we ignore it and go on.
+ }
if (precision == 0) {
precision = metaData.getColumnDisplaySize(i);
}
int scale = metaData.getScale(i);
- row.addElement(new Integer(precision));
+ row.addElement(new Long(precision));
row.addElement(new Integer(scale));
int nullable = metaData.isNullable(i);
+++ /dev/null
-package com.quantum.sql;
-
-import java.util.Vector;
-
-import com.quantum.sql.parser.SQLLexx;
-import com.quantum.sql.parser.Token;
-
-public class SQLParser {
-
- /**
- * Parses a query string into executable units.
- * @param query
- * @return a Vector of Strings, with the individual executable units.
- */
- public static Vector parse(String query) {
- Vector commands = new Vector();
- Vector groups = new Vector();
- try {
- Vector tokens = SQLLexx.parse(query);
- StringBuffer buffer = new StringBuffer();
- StringBuffer groupBuffer = new StringBuffer();
- for (int i = 0; i < tokens.size(); i++) {
- Token t = (Token) tokens.elementAt(i);
- if (t.getType() == Token.COMMENT) {
- // ignore comments
- } else if (t.getType() == Token.SEPARATOR) {
- groupBuffer.append(t.getValue());
- String newCommand = buffer.toString().trim();
- if (!newCommand.equals("")) { //$NON-NLS-1$
- commands.addElement(newCommand);
- }
- buffer = new StringBuffer();
- } else if (t.getType() == Token.GROUP) {
- // We don't append the group token because it may be misinterpreted
- //groupBuffer.append(t.getValue());
- String newGroup = groupBuffer.toString().trim();
- if (!newGroup.equals("")) { //$NON-NLS-1$
- groups.addElement(newGroup);
- //Groups have precedence over commands, so the preceding commands are erased
- commands.clear();
- }
- groupBuffer = new StringBuffer();
- } else {
- // We append the tokens to the buffer until it's a separator or group.
- buffer.append(t.getValue());
- groupBuffer.append(t.getValue());
- }
- }
- String newCommand = buffer.toString().trim();
- if (!newCommand.equals("")) { //$NON-NLS-1$
- commands.addElement(newCommand);
- }
- } catch (Throwable e) {
- e.printStackTrace();
- }
- Vector result = new Vector();
- result.addAll(groups);
- result.addAll(commands);
- return result;
- }
-}
\ No newline at end of file
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.sql.Connection;
List row = new ArrayList();
for (int i = 1, length = columns.size(); i <= length; i++) {
String value = null;
- if (getColumn(i).getSize() < MAX_COLUMN_WIDTH) {
- value = getEncodedString(set, getEncoding(), i);
- } else {
- try {
+ try {
+ if (set.getMetaData().getColumnType(i) == java.sql.Types.LONGVARBINARY) {
+ value = getEncodedStringFromBinaryStream(set, getEncoding(), i);
+ } else if (getColumn(i).getSize() < MAX_COLUMN_WIDTH) {
+ value = getEncodedString(set, getEncoding(), i);
+ } else {
if ("".equals(getEncoding())) { //$NON-NLS-1$
value = getStringFromCharacterSteam(set, i);
} else {
value = getEncodedStringFromBinaryStream(set, getEncoding(), i);
}
- } catch (IOException e) {
- value = set.getString(i);
- } catch (RuntimeException e) {
- // hack for mysql which doesn't implement
- // character streams
- value = set.getString(i);
}
+ } catch (IOException e) {
+ value = set.getString(i);
+ } catch (RuntimeException e) {
+ // hack for mysql which doesn't implement
+ // character streams
+ value = set.getString(i);
}
if (value == null && !set.wasNull()) {
value = set.getString(i);
} finally {
binaryStream.close();
}
- return new String(baos.toByteArray(), encoding);
+ if ("".equals(encoding))
+ return new String(baos.toByteArray());
+ else
+ return new String(baos.toByteArray(), encoding);
} else {
return null;
}
}
}
-
/**
* @param set
* @param encoding
private String getEncodedString(ResultSet set, String encoding, int index)
throws SQLException {
try {
- return encoding == null || encoding.trim().length() == 0
- ? set.getString(index)
- : new String(set.getBytes(index), encoding);
+ if (encoding == null || encoding.trim().length() == 0) {
+ return set.getString(index);
+ }
+ byte[] colBytes = set.getBytes(index);
+ if (colBytes == null) return null;
+ else return new String(colBytes, encoding);
} catch (UnsupportedEncodingException e) {
return set.getString(index);
}
--- /dev/null
+/*
+ * Created on 20.08.2004
+ *
+ * A Virtual Result Set. It's virtual because it doesn't has cache,
+ * but rather is tightly coupled with its RecordSet object,
+ * and mainly gives some added functionality, for use in
+ * virtual tables. It has SQLResults as a superclass mainly
+ * for conceptual reasons, it could be standalone.
+ */
+package com.quantum.sql;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import com.quantum.model.Column;
+import com.quantum.model.Entity;
+import com.quantum.model.NotConnectedException;
+import com.quantum.util.StringMatrix;
+import com.quantum.util.sql.SQLInstructionBuilder;
+
+/**
+ * @author Julen
+ *
+ */
+public class SQLVirtualResultSet extends SQLResults {
+ // The resultSet will be based on a query, that can be changed
+ private String query = "";
+ private ResultSet resultSet = null;
+ private int knownNumberOfRows = 0;
+
+
+ /* (non-Javadoc)
+ * @see com.quantum.sql.SQLResults#isResultSet()
+ */
+ public SQLVirtualResultSet(Entity entity) {
+ try {
+ // Cannot use "SELECT *" because that is not updatable, at least in some JDBC drivers
+ Initialize(SQLInstructionBuilder.buildSelect(entity, entity.getColumns(), null),
+ entity.getBookmark().getConnection(),
+ ResultSet.TYPE_SCROLL_SENSITIVE,
+ ResultSet.CONCUR_UPDATABLE);
+
+ } catch (NotConnectedException e) {
+ e.printStackTrace();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ public SQLVirtualResultSet(Entity entity, int type, int concurrency) {
+ try {
+ // Cannot use "SELECT *" because that is not updatable, at least in some JDBC drivers
+ Initialize(SQLInstructionBuilder.buildSelect(entity, entity.getColumns(), null),
+ entity.getBookmark().getConnection(),
+ type,
+ concurrency);
+
+ } catch (NotConnectedException e) {
+ e.printStackTrace();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ /**
+ * @param string
+ * @param connection
+ */
+ private void Initialize(String query, Connection connection, int type, int concurrency) {
+ if (connection == null) return;
+ this.query = query;
+ try {
+ Statement statement = connection.createStatement(type, concurrency);
+ resultSet = statement.executeQuery(query);
+ // If the recordset is not empty, we know there is at least one row. This call may fall also
+ // because the recordset is not of the correct type to run isLast, so the resultSet may be valid.
+ if (!resultSet.isLast())
+ knownNumberOfRows = 1;
+ } catch (SQLException e) {
+ return;
+ }
+
+
+ }
+
+ public boolean isResultSet() {
+ return true;
+ }
+
+ /**
+ * @return If the resultSet is open, that is, connected to a data source
+ */
+ public boolean isOpen() {
+ return (resultSet != null);
+ }
+
+
+ /**
+ * @return Returns the knowNumberOfRows.
+ */
+ public int getKnownNumberOfRows() {
+ return knownNumberOfRows;
+ }
+ /**
+ * @param index
+ * @param i
+ * @return
+ */
+ public String getStringValue(int row, int column) {
+ if (resultSet == null) return null;
+ try {
+ // Rows and columns in resultSets are 1-based
+ resultSet.absolute(row+1);
+ actKnownNumberOfRows();
+ return resultSet.getString(column+1);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ /**
+ *
+ */
+ private void actKnownNumberOfRows() {
+ if (resultSet == null) return;
+ int nRowsNow;
+ try {
+ nRowsNow = resultSet.getRow() + (resultSet.isLast() ? 0 : 1);
+ knownNumberOfRows = Math.max( nRowsNow, knownNumberOfRows);
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ /**
+ * @param index
+ * @return
+ */
+ public String[] getRowAsStringArray(int row) {
+ if (resultSet == null) return null;
+ try {
+ resultSet.absolute(row+1);
+ actKnownNumberOfRows();
+ return getRowAsStringArray();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * @return
+ *
+ */
+ public String[] getRowAsStringArray() {
+ String[] resultArray = null;
+ int numColumns;
+ try {
+ numColumns = resultSet.getMetaData().getColumnCount();
+ resultArray = new String[numColumns];
+ for (int i = 0; i < numColumns; i++) {
+ // Rows and columns in resultSets are 1-based
+ resultArray[i] = resultSet.getString(i+1);
+ }
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return resultArray;
+ }
+
+ /**
+ *
+ */
+ public boolean next(){
+ try {
+ return resultSet.next();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return false;
+ }
+ }
+ public boolean isLast() {
+ try {
+ return resultSet.isLast();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ return true;
+ }
+ }
+ /**
+ * @return Names of the Columns of the ResultSet, in the order given
+ */
+ public String[] getColumnNames() {
+ if (resultSet == null) return null;
+ String resultArray[] = null;
+ try {
+ int numColumns = resultSet.getMetaData().getColumnCount();
+ resultArray = new String[numColumns];
+ for (int i = 0; i < numColumns; i++) {
+ // Rows and columns in resultSets are 1-based
+ resultArray[i] = resultSet.getMetaData().getColumnName(i+1);
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return resultArray;
+ }
+ /**
+ * @param columnIndex
+ * @param valueStr
+ */
+ public boolean update(int row, int columnIndex, String valueStr) {
+ if (row < 0 || columnIndex < 0 ) return false;
+ try {
+ resultSet.absolute(row+1);
+ resultSet.updateString(columnIndex+1, valueStr);
+ resultSet.updateRow();
+ return true;
+ } catch (SQLException e) {
+ e.printStackTrace();
+ return false;
+ }
+
+ }
+ public void close(){
+ try {
+ resultSet.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+}
* <a href="http://www.scifi.com/lexx/">Lexx</a> TV series.
*/
public class SQLLexx {
- private static String endline = ";"; //$NON-NLS-1$
- private static String dash = "-"; //$NON-NLS-1$
- private static String group = "/"; //$NON-NLS-1$
+ private final static char CHAR_EOL = '\n';
+ private final static char CHAR_DASH = '-';
+ private final static char CHAR_ESCAPE = '\\';
+ private final static char CHAR_SEPARATOR = ';';
+
+ private final static int CONDITION_WHITESPACE = 1;
+ private final static int CONDITION_IDENTIFIER = 2;
+ private final static int CONDITION_IDENTIFIER_INITIAL = 3;
+ private final static int CONDITION_LITERAL_SIMPLE_QUOTE = 4;
+ private final static int CONDITION_LITERAL_DOUBLE_QUOTE = 5;
+ private final static int CONDITION_NUMERIC = 6;
+ private final static int CONDITION_EOL = 7;
+
+
/**
* Parses a SQL text into tokens.
* @param text
int offset = p.getOffset();
char c = p.getNext();
// Adds END_OF_LINE token
- if (c == '\n') {
- tokens.addElement(new Token(Token.END_OF_LINE, "\n", offset, offset + 1));
+ if (c == CHAR_EOL) {
+ tokens.addElement(new Token(Token.END_OF_LINE, CHAR_EOL, offset));
}
// Adds WHITESPACE token;
- else if (Character.isWhitespace(c)) {
- StringBuffer value = new StringBuffer();
- while (Character.isWhitespace(c) && !p.isDone()) {
- value.append(c);
- c = p.getNext();
- }
- // done because of is done
- if (Character.isWhitespace(c)) {
- value.append(c);
- } else if (!p.isDone()){
- p.back();
- }
+ else if (CheckCondition( c, CONDITION_WHITESPACE))
+ {
+ StringBuffer value = AddTokenWhile(p, c, CONDITION_WHITESPACE);
tokens.addElement(new Token(Token.WHITESPACE, value.toString(), offset, offset + value.length()));
// Adds IDENTIFIER token (can be reserved SQL word or not);
- } else if (Character.isLetter(c) || c == '_' || c == '$') {
- StringBuffer value = new StringBuffer();
- while ((Character.isLetterOrDigit(c) || c == '_' || c == '$') && !p.isDone()) {
- value.append(c);
- c = p.getNext();
- }
- if ((Character.isLetterOrDigit(c) || c == '_')) {
- value.append(c);
- } else if (!p.isDone()){
- p.back();
- }
+ } else if (CheckCondition( c , CONDITION_IDENTIFIER_INITIAL))
+ {
+ StringBuffer value = AddTokenWhile(p, c, CONDITION_IDENTIFIER);
tokens.addElement(new Token(Token.IDENTIFIER, value.toString(), offset, offset + value.length()));
// Adds LITERAL token;
- } else if (c == '\'') {
- StringBuffer value = new StringBuffer();
- value.append(c);
- if (!p.isDone()) {
- c = p.getNext();
- while (c != '\'' && c != '\n' && !p.isDone()) {
- value.append(c);
- c = p.getNext();
- }
- if (c == '\'' || p.isDone()) {
- value.append(c);
- } else if (!p.isDone()){
- p.back();
- }
- }
+ } else if (CheckCondition(c, CONDITION_LITERAL_SIMPLE_QUOTE)) {
+ StringBuffer value = AddTokenUntil(p, c, CONDITION_LITERAL_SIMPLE_QUOTE);
+ tokens.addElement(new Token(Token.LITERAL, value.toString(), offset, offset + value.length()));
+ // Adds LITERAL token;
+ } else if (CheckCondition(c, CONDITION_LITERAL_DOUBLE_QUOTE)) {
+ StringBuffer value = AddTokenUntil(p, c, CONDITION_LITERAL_SIMPLE_QUOTE);
tokens.addElement(new Token(Token.LITERAL, value.toString(), offset, offset + value.length()));
- // Adds COMMENT token (or SYMBOL (dash) if only one dash);
- } else if (c == '-') {
- p.mark();
+ // Adds NUMERIC token;
+ } else if (Character.isDigit(c)) {
+ StringBuffer value = AddTokenWhile(p, c, CONDITION_NUMERIC);
+ tokens.addElement(new Token(Token.NUMERIC, value.toString(), offset, offset + value.length()));
+ // Adds COMMENT token if two dashes (or SYMBOL (dash) if only one dash);
+ } else if (c == CHAR_DASH) {
if (p.isDone()) {
- tokens.addElement(new Token(Token.SYMBOL, dash, offset, offset + 1));
+ tokens.addElement(new Token(Token.SYMBOL, new Character(CHAR_DASH).toString(), offset, offset + 1));
} else {
- char next = p.getNext();
- if (next == '-') {
- StringBuffer value = new StringBuffer("--"); //$NON-NLS-1$
- if (!p.isDone()) {
- c = p.getNext();
- while (c != '\n' && !p.isDone()) {
- value.append(c);
- c = p.getNext();
- }
- if (p.isDone()) {
- value.append(c);
- } else {
- p.back();
- }
- }
+ char next = p.peek();
+ if (next == CHAR_DASH) {
+ StringBuffer value = AddTokenUntil(p, CHAR_DASH, CONDITION_EOL);
tokens.addElement(new Token(Token.COMMENT, value.toString(), offset, offset + value.length()));
} else {
- tokens.addElement(new Token(Token.SYMBOL, dash, offset, offset + 1));
- p.reset();
+ tokens.addElement(new Token(Token.SYMBOL, new Character(CHAR_DASH).toString(), offset, offset + 1));
}
+ }
+ // Determine if the ';' is escaped or not
+ } else if (c == CHAR_ESCAPE) {
+ if (p.peek() == CHAR_SEPARATOR) {
+ p.getNext(); // We advance the pointer so the separator is not marked again
+ // We DON´T SAVE the scape character in the tokens.
+ // For correct sintax highlighting we set the offset to +2
+ // This is so far the only case when a character is eliminated and not saved to the tokens.
+ // That means it won´t be sent to the database when executed.
+ // This is to allow definitions of procedures with ';' as an end-of-sentence,
+ // not as an execution symbol for SQL.
+ tokens.addElement(new Token(Token.SYMBOL, new Character(CHAR_SEPARATOR).toString() , offset, offset + 2));
+ } else {
+ tokens.addElement(new Token(Token.SYMBOL, new Character(CHAR_ESCAPE).toString() , offset, offset + 1));
}
// Adds SEPARATOR token (;), considers the rest of the line as COMMENT token;
- } else if (c == ';') {
- tokens.addElement(new Token(Token.SEPARATOR, endline, offset, offset + 1));
- StringBuffer value = new StringBuffer();
+ } else if (c == CHAR_SEPARATOR) {
+ tokens.addElement(new Token(Token.SEPARATOR, new Character(CHAR_SEPARATOR).toString(), offset, offset + 1));
+ // The rest of the line will be a comment
if (!p.isDone()) {
- c = p.getNext();
- while (c != '\n' && !p.isDone()) {
- value.append(c);
- c = p.getNext();
- }
- if (p.isDone()) {
- value.append(c);
- } else {
- p.back();
- }
- // We add to the offset so as to skip the initial ';'
+ StringBuffer value = AddTokenUntil(p, "", CONDITION_EOL);
+ // We add to the offset so as to skip the initial ';'
offset++;
tokens.addElement(new Token(Token.COMMENT, value.toString(), offset, offset + value.length()));
}
- // Adds NUMERIC token;
- } else if (Character.isDigit(c)) {
- StringBuffer value = new StringBuffer();
- while ((Character.isDigit(c) || c == '.') && !p.isDone()) {
- value.append(c);
- c = p.getNext();
- }
- if ((Character.isDigit(c) || c == '.')) {
- value.append(c);
- } else {
- p.back();
- }
- tokens.addElement(new Token(Token.NUMERIC, value.toString(), offset, offset + value.length()));
- // Adds COMMENT token (or GROUP (slash) if only one slash);
+ // Adds COMMENT token, for several lines;
} else if (c == '/') {
- p.mark();
// If we have '/*', it's a comment till '*/' found or eof
if (p.peek() == '*') {
tokens.addElement(tokenizeComment(p, offset));
} else {
- // It's not '/*' , so it's a group token
- // BCH ??? what's this business about groups?
- // Shouldn't '/' be a divide operator?
- tokens.addElement(new Token(Token.SYMBOL, new String(new char[] {c}) /*group*/, offset, offset + 1));
- p.reset();
+ tokens.addElement(new Token(Token.SYMBOL, new String(new char[] {c}) , offset, offset + 1));
}
// Adds SYMBOL token;
} else {
return tokens;
}
/**
+ * Searchs for a token end, UNTIL the condition is true, or a newline, or the end of the StringPointer
+ * The end character is also addedd to the StringBuffer
+ * @param p
+ * @param s A string with the first character from the token, already extracted from the StringPointer
+ * @param condition
+ * @return a StringBuffer with the complete token
+ */
+ private static StringBuffer AddTokenUntil(StringPointer p, String s, int condition) {
+ StringBuffer value = new StringBuffer(s);
+ if (p.isDone()) return value;
+ for(;;) {
+ char c = p.getNext();
+ if (c != CHAR_EOL) value.append(c);
+ if (CheckCondition (c, condition) || c == CHAR_EOL || p.isDone()) {
+ break;
+ }
+ }
+ return value;
+ }
+ private static StringBuffer AddTokenUntil(StringPointer p, char c, int condition) {
+ return AddTokenUntil(p, new Character(c).toString(), condition);
+ }
+ /**
+ * Searchs for a token end, WHILE the condition is true, or the end or the StringPointer.
+ * @param p The StringPointer where the original stream is
+ * @param s A string with the first character from the token, already extracted from the StringPointer
+ * @param condition The condition to end the token
+ * @return a StringBuffer with the complete token
+ */
+ private static StringBuffer AddTokenWhile(StringPointer p, String s, int condition) {
+ StringBuffer value = new StringBuffer(s);
+ if (p.isDone()) return value;
+ for(;;) {
+ char c = p.getNext();
+ if (CheckCondition (c, condition)) {
+ value.append(c);
+ if (p.isDone()) break;
+ }
+ else
+ {
+ p.back();
+ break;
+ }
+ }
+ return value;
+ }
+ private static StringBuffer AddTokenWhile(StringPointer p, char c, int condition) {
+ return AddTokenWhile(p, new Character(c).toString(), condition);
+ }
+ /**
+ * Returns true if the character meets the condition, and false if not.
+ * New conditions should be defined in this function
+ * @param c The character to check the condition
+ * @param condition The condition to check
+ * @return
+ */
+ private static boolean CheckCondition(char c, int condition) {
+ switch (condition) {
+ case CONDITION_WHITESPACE:
+ return Character.isWhitespace(c);
+ case CONDITION_IDENTIFIER_INITIAL:
+ return (Character.isLetter(c) || c == '$' || c == '#');
+ case CONDITION_IDENTIFIER:
+ return (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '$' || c == '#');
+ case CONDITION_LITERAL_SIMPLE_QUOTE:
+ return (c == '\'');
+ case CONDITION_LITERAL_DOUBLE_QUOTE:
+ return (c == '\"');
+ case CONDITION_NUMERIC:
+ return (Character.isDigit(c) || c == '.');
+ case CONDITION_EOL:
+ return (c == CHAR_EOL);
+ default:
+ break;
+ }
+ return false;
+ }
+ /**
* @param tokens
* @param p
* @param offset
commands.addElement(newCommand);
}
buffer = new StringBuffer();
- } else if (t.getType() == Token.GROUP) {
- // We don't append the group token because it may be misinterpreted
- //groupBuffer.append(t.getValue());
- String newGroup = groupBuffer.toString().trim();
- if (!newGroup.equals("")) { //$NON-NLS-1$
- groups.addElement(newGroup);
- //Groups have precedence over commands, so the preceding commands are erased
- commands.clear();
- }
- groupBuffer = new StringBuffer();
} else {
// We append the tokens to the buffer until it's a separator or group.
buffer.append(t.getValue());
public static final char COMMENT = 'C';
public static final char WHITESPACE = 'W';
public static final char NUMERIC = 'N';
- public static final char GROUP = 'G';
public static final char END_OF_LINE = 'E';
private char type;
private int start;
private int end;
private String value;
+
+ public Token(char type, char value, int start) {
+ this.type = type;
+ this.value = new Character(value).toString();
+ this.start = start;
+ this.end = start + 1;
+ }
public Token(char type, String value, int start, int end) {
this.type = type;
this.value = value;
*
* @param parentShell -
* the parent shell of the dialog, or <code>null</code> if none
- * @param dialogTitle the title to use for this dialog,
+ * @param title the title to use for this dialog,
* or <code>null</code> to indicate that the default title should be used
* @param message the message to show in this dialog,
* or <code>null</code> to indicate that the error's message should be shown
/**
* @author jparrai
* Generic class to hold a Matrix of Strings, that is a Vector of Vectors of Strings.
- * The first Vector "line" is supposed to have headers to the values of the rest.
+ * The first StringMatrix "line" is supposed to have headers to the values of the rest.
* Those headers will always be case insensitive
+ * Rows start at 0
*/
public class StringMatrix {
private final int DEFAULT_COLUMNS = 10;
matrix.clear();
}
/**
- * Adds a String to the row indicated, to the column that matches the key
+ * Adds a String to the row indicated, to the column that matches the key
+ * The matrix will grow to acomodate the indexes, so be careful
* @param value : The string to be added
- * @param row : The row to
+ * @param row : The row to update
*/
public void addAt(String key, String value, int row) {
grow(row);
Vector rowVector = (Vector) matrix.get(row);
int ind = header.indexOf(key);
if (ind < 0) return;
- if (rowVector.size() < ind+1) rowVector.setSize(ind);
+ if (rowVector.size() <= ind) rowVector.setSize(ind);
rowVector.add(ind, value);
}
/**
+ * Adds a String in the location specified.
+ * The matrix will grow to acomodate the indexes, so be careful
+ * @param column Column selected
+ * @param row row selected
+ * @param value value to add
+ */
+ public void addAt(int column, int row, String value) {
+ grow(row);
+ Vector rowVector = (Vector) matrix.get(row);
+ if (column >= rowVector.size()) rowVector.setSize(column);
+ rowVector.add(column, value);
+ }
+ /**
* Adds a whole vector to the end of the row indicated
* @param value : The vector to be added
* @param row : The row to
* @param row : 0-index column
* @return
*/
- private String get(int col, int row){
+ public String get(int col, int row){
if (col < 0 || row < 0) return null;
Vector rowVector = (Vector) matrix.get(row);
if (rowVector == null) return null;
- return (String) rowVector.get(col);
+ if (col < rowVector.size())
+ return (String) rowVector.get(col);
+ else return null;
}
// Generic interfaces
public int size() {
return matrix.size();
}
+ /**
+ * @return The number of columns of the StringMatrix
+ */
public int getNumColumns() {
return header.size();
}
+ /**
+ * @param i
+ * @return The name of the header column in the "i" position. Null if no such position.
+ */
public String getHeaderColumn(int i){
- return (String) header.get(i);
+ if (i < header.size())
+ return (String) header.get(i);
+ return null;
}
+ /**
+ * Deletes the row number i
+ * @param i
+ */
public void deleteRow(int i){
- matrix.remove(i);
+ if (i < matrix.size())
+ matrix.remove(i);
}
--- /dev/null
+/*
+ * Created on 12.08.2004
+ *
+ */
+package com.quantum.util.sql;
+
+import java.sql.SQLException;
+
+import com.quantum.adapters.DatabaseAdapter;
+import com.quantum.model.Bookmark;
+import com.quantum.model.Column;
+import com.quantum.model.Entity;
+import com.quantum.model.NotConnectedException;
+import com.quantum.util.StringMatrix;
+
+/**
+ * Functions to build SQL instructions adapted to the particular database
+ *
+ * @author Julen
+ */
+public class SQLInstructionBuilder {
+
+ /**
+ * Generates an Insert SQL instruction for each row of data in an StrigMatrix
+ * @param entity The entity to generate the instruction for
+ * @param columns A StringMatrix holding the names and values of the columns to insert
+ * @return A String with the insert sentences generated
+ */
+ public static String buildInsert(Entity entity, StringMatrix columns)
+ {
+ if (entity == null || columns == null ) return "";
+ StringBuffer valuesClause = new StringBuffer();
+ StringBuffer namesClause = new StringBuffer();
+ String insertSentences = "";
+
+ // We generate an update sentence for each row in the StringMatrix
+ for (int iRow = 0; iRow < columns.size(); iRow++) {
+ for (int iCol = 0; iCol < columns.getNumColumns(); iCol++) {
+ if (iCol > 0) {
+ namesClause.append(", "); //$NON-NLS-1$
+ valuesClause.append(", "); //$NON-NLS-1$
+ }
+ namesClause.append(columns.getHeaderColumn(iCol));
+ valuesClause.append(quoteValue( entity, columns.getHeaderColumn(iCol), columns.get(iCol, iRow)));
+ }
+ if (iRow > 0) insertSentences += ";\n";
+ insertSentences += "INSERT INTO " + entity.getQuotedTableName(); //$NON-NLS-1$
+ insertSentences += "(" + namesClause + " )"; //$NON-NLS-1$
+ insertSentences += " VALUES " + " ( " + valuesClause + " )" ; //$NON-NLS-1$
+ }
+ return insertSentences;
+ }
+
+ /**
+ * Generates an UPDATE SQL instruction for each row of data in an StrigMatrix
+ * @param entity The entity to generate the instruction for
+ * @param columns A StringMatrix holding the names and values of the columns to insert
+ * @param key A StringMatrix holding the names and values of the columns of the key
+ * @return A String with the insert sentences generated
+ */
+ public static String buildUpdate(Entity entity, StringMatrix columns, StringMatrix key)
+ {
+ if (entity == null || columns == null ) return "";
+ StringBuffer setClause = new StringBuffer();
+ String whereClause = "";
+ String updateSentences = "";
+
+ // We generate an update sentence for each row in the StringMatrix
+ for (int iRow = 0; iRow < columns.size(); iRow++) {
+ for (int iCol = 0; iCol < columns.getNumColumns(); iCol++) {
+ if (iCol > 0) setClause.append(", "); //$NON-NLS-1$
+ setClause.append(columns.getHeaderColumn(iCol));
+ setClause.append(" = "); //$NON-NLS-1$
+ setClause.append(quoteValue( entity, columns.getHeaderColumn(iCol), columns.get(iCol, iRow)));
+ }
+ if (key != null && iRow < key.size()) {
+ whereClause = getWhereClause(entity, key, iRow);
+ }
+ if (iRow > 0) updateSentences += ";\n";
+ updateSentences += "UPDATE " + entity.getQuotedTableName(); //$NON-NLS-1$
+ updateSentences += " SET " + setClause.toString(); //$NON-NLS-1$
+ if (whereClause.length() > 0)
+ updateSentences += " WHERE " + whereClause; //$NON-NLS-1$
+ }
+ return updateSentences;
+ }
+ /**
+ * @param entity
+ * @param key
+ * @return
+ */
+ public static String buildDelete(Entity entity, StringMatrix key)
+ {
+ if (entity == null ) return "";
+ String deleteSentences = "";
+ String whereClause = "";
+
+ // We generate an update sentence for each row in the StringMatrix
+ if (key == null) return "DELETE FROM " + entity.getQuotedTableName(); //$NON-NLS-1$
+
+ for (int iRow = 0; iRow < key.size(); iRow++) {
+ if (key != null && iRow < key.size()) {
+ whereClause = getWhereClause(entity, key, iRow);
+ }
+ if (iRow > 0) deleteSentences += ";\n";
+ deleteSentences += "DELETE FROM " + entity.getQuotedTableName(); //$NON-NLS-1$
+ if (whereClause.length() > 0)
+ deleteSentences += " WHERE " + whereClause; //$NON-NLS-1$
+ }
+ return deleteSentences;
+ }
+ /**
+ * Builds a Select query with all columns and no rows (useful for structure querying)
+ * @param entity
+ * @return
+ */
+ public static String buildSelectAllColumnsNoRows(Entity entity) {
+ return "SELECT * FROM " + entity.getQuotedTableName() + " WHERE (1 = 0)"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ /**
+ * Builds a Select query with all columns and no rows (useful for structure querying)
+ * @param entity
+ * @return
+ */
+ public static String buildSelectAllColumnsAllRows(Entity entity) {
+ return "SELECT * FROM " + entity.getQuotedTableName() ; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ /**
+ * Builds a Select query with the selected columns and the selected rows (useful for structure querying)
+ * @param entity
+ * @param columns Selected columns.
+ * @param key Selected key and values, in row 0. Only 1 select query will be generated.
+ * @return
+ */
+ public static String buildSelect(Entity entity, Column[] columns, StringMatrix key) {
+ if (entity == null || columns == null ) return "";
+ StringBuffer columnsList = new StringBuffer();
+ String whereClause = "";
+ String selectQuery = "";
+
+ for (int iCol = 0; iCol < columns.length; iCol++) {
+ if (iCol > 0) columnsList.append(", "); //$NON-NLS-1$
+ columnsList.append(columns[iCol].getName());
+ }
+ if (key != null) {
+ whereClause = getWhereClause(entity, key, 0);
+ }
+ selectQuery += "SELECT " + columnsList; //$NON-NLS-1$
+ selectQuery += " FROM " + entity.getQuotedTableName(); //$NON-NLS-1$
+ if (whereClause.length() > 0)
+ selectQuery += " WHERE " + whereClause; //$NON-NLS-1$
+
+ return selectQuery;
+
+ }
+
+ /**
+ * @param entity The entity to get the where clause for
+ * @param key A StringMatrix with the colums that form the key and rows with the values
+ * @param iRow The key to the row that contains the values we are interested in
+ * @return A String with where clause (without the 'WHERE' reserved word), adapted to the database of the entity
+ */
+ public static String getWhereClause(Entity entity, StringMatrix key, int iRow) {
+ StringBuffer whereClause = new StringBuffer();
+ for (int iKey = 0; iKey < key.getNumColumns(); iKey++) {
+ if (iKey > 0) whereClause.append(" AND "); //$NON-NLS-1$
+ whereClause.append("("); //$NON-NLS-1$
+ whereClause.append(key.getHeaderColumn(iKey));
+ whereClause.append(" = "); //$NON-NLS-1$
+ whereClause.append(quoteValue( entity, key.getHeaderColumn(iKey), key.get(iKey, iRow)));
+ whereClause.append(")"); //$NON-NLS-1$
+ }
+ return whereClause.toString();
+ }
+ /**
+ * Default-value function.
+ * Generates a whereClause adapted to the entity´s database
+ * with the data of the first row of the StringMatrix (row 0).
+ * @see com.quantum.util.sql.SQLInstructionBuilder#getWhereClause
+ */
+ public static String getWhereClause(Entity entity, StringMatrix key) {
+ return getWhereClause(entity, key, 0);
+ }
+
+ /**
+ * Quotes the 'value' according with the type of the column and the database
+ * @param entity Entity
+ * @param columnName Name of the column in the Entity
+ * @param value Value of the column, to be quoted
+ */
+ public static String quoteValue(Entity entity, String columnName, String value) {
+ Bookmark bookmark = entity.getBookmark();
+ DatabaseAdapter adapter = bookmark.getAdapter();
+
+ if (adapter != null && entity != null && getColumn(entity, columnName) != null) {
+ Column column = getColumn(entity, columnName);
+ return adapter.quote(value, column.getType(), column.getTypeName());
+ } else {
+ return value;
+ }
+}
+ /**
+ * Wrapper function to avoid exception handling
+ * @param entity The entity that has the column
+ * @param columnName The column name
+ * @return A Column object from that entity, with the given name. null if not found or not connected.
+ */
+ public static Column getColumn(Entity entity, String columnName) {
+ try {
+ return entity == null ? null : entity.getColumn(columnName);
+ } catch (NotConnectedException e) {
+ return null;
+ } catch (SQLException e) {
+ return null;
+ }
+ }
+
+}
* @return
*/
public static boolean isText(int type) {
- return (type == CLOB || type == VARBINARY || type ==VARCHAR
- || type == CHAR || type == LONGVARCHAR );
+ return ( type == CHAR || type == VARCHAR || type == LONGVARCHAR
+ || type == BINARY || type == VARBINARY || type == LONGVARBINARY
+ || type == CLOB || type == BLOB);
}
}
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ExportResourcesAction;
+import org.eclipse.ui.actions.ImportResourcesAction;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.part.WorkbenchPart;
return action;
}
+ public static ImportResourcesAction createImportResourcesAction(IWorkbenchWindow window) {
+ ImportResourcesAction action = null;
+
+ try {
+ if (isEclipse21OrHigher()) {
+ Constructor constructor = ImportResourcesAction.class.getConstructor(
+ new Class[] { IWorkbenchWindow.class });
+ action = (ImportResourcesAction) constructor.newInstance(
+ new Object[] { window });
+ } else {
+ Constructor constructor = ImportResourcesAction.class.getConstructor(
+ new Class[] { IWorkbench.class });
+ action = (ImportResourcesAction) constructor.newInstance(
+ new Object[] { window.getWorkbench() });
+ }
+ } catch (NoSuchMethodException e) {
+ // should not happen
+ } catch (IllegalArgumentException e) {
+ // should not happen
+ } catch (IllegalAccessException e) {
+ // should not happen
+ } catch (InvocationTargetException e) {
+ // should not happen
+ } catch (InstantiationException e) {
+ // should not happen
+ }
+ return action;
+ }
+
public static void registerActionToKeyBindingService(
IWorkbenchPartSite site, String[] scopes, IAction action) {
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
-import java.util.Vector;
-
-import com.quantum.ImageStore;
-import com.quantum.Messages;
-import com.quantum.PluginPreferences;
-import com.quantum.QuantumPlugin;
-import com.quantum.actions.ExecuteAction;
-import com.quantum.actions.ExportQueryAction;
-import com.quantum.actions.ImportQueryAction;
-import com.quantum.editors.ColorManager;
-import com.quantum.model.Bookmark;
-import com.quantum.model.BookmarkCollection;
-import com.quantum.model.NotConnectedException;
-import com.quantum.sql.MultiSQLServer;
-import com.quantum.sql.SQLGrammar;
-import com.quantum.sql.parser.SQLLexx;
-import com.quantum.sql.parser.Token;
-import com.quantum.ui.dialog.ExceptionDisplayDialog;
-import com.quantum.ui.dialog.SQLExceptionDialog;
-import com.quantum.util.versioning.VersioningHelper;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.swt.custom.ExtendedModifyListener;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.part.ViewPart;
+import com.quantum.ImageStore;
+import com.quantum.Messages;
+import com.quantum.PluginPreferences;
+import com.quantum.QuantumPlugin;
+import com.quantum.actions.ExecuteAction;
+import com.quantum.actions.ExportQueryAction;
+import com.quantum.actions.ImportQueryAction;
+import com.quantum.editors.ColorManager;
+import com.quantum.model.Bookmark;
+import com.quantum.model.BookmarkCollection;
+import com.quantum.model.NotConnectedException;
+import com.quantum.sql.MultiSQLServer;
+import com.quantum.sql.SQLGrammar;
+import com.quantum.sql.parser.SQLLexx;
+import com.quantum.sql.parser.Token;
+import com.quantum.ui.dialog.ExceptionDisplayDialog;
+import com.quantum.ui.dialog.SQLExceptionDialog;
+import com.quantum.util.versioning.VersioningHelper;
+
public class SQLQueryView extends ViewPart {
private class ClearAction extends Action {
this.executeAction);
}
- /**
- * @param widget2
- */
private void setFont() {
FontData font = PreferenceConverter.getFontData(
QuantumPlugin.getDefault().getPreferenceStore(),
actionBars.getMenuManager().add(this.commitAction);
}
+ /**
+ * Returns the query to be executed. The query is either 1) the
+ * text currently highlighted/selected in the editor or 2) all of
+ * the text in the editor.
+ * @return query string to be executed
+ */
public String getQuery() {
- return widget.getText();
+ String query;
+
+ if (widget.getSelectionText().length() > 0)
+ query = widget.getSelectionText();
+ else
+ query = widget.getText();
+
+ return query;
}
public void setQuery(String text) {
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.StructuredSelection;
IPreferenceStore store = QuantumPlugin.getDefault().getPreferenceStore();
String text1 = store.getString("customCopyName1");
if (text1 != null && text1.trim().length() > 0) {
- this.customCopyAction1 = new CustomCopyAction(this,1); // 1 is unused, just in case more custom copies are defined
+ this.customCopyAction1 = new CustomCopyAction(1); // 1 is unused, just in case more custom copies are defined
this.customCopyAction1.setText(text1); //$NON-NLS-1$
this.customCopyAction1.setImageDescriptor(
ImageStore.getImageDescriptor(ImageStore.COPY)); //$NON-NLS-1$
}
String text2 = store.getString("customCopyName2");
if (text2 != null && text1.trim().length() > 0) {
- this.customCopyAction2 = new CustomCopyAction(this,2); // 1 is unused, just in case more custom copies are defined
+ this.customCopyAction2 = new CustomCopyAction(2); // 1 is unused, just in case more custom copies are defined
this.customCopyAction2.setText(text2); //$NON-NLS-1$
this.customCopyAction2.setImageDescriptor(
ImageStore.getImageDescriptor(ImageStore.COPY)); //$NON-NLS-1$
}
String text3 = store.getString("customCopyName3");
if (text3 != null && text1.trim().length() > 0) {
- this.customCopyAction3 = new CustomCopyAction(this,3); // 1 is unused, just in case more custom copies are defined
+ this.customCopyAction3 = new CustomCopyAction(3); // 1 is unused, just in case more custom copies are defined
this.customCopyAction3.setText(text3); //$NON-NLS-1$
this.customCopyAction3.setImageDescriptor(
ImageStore.getImageDescriptor(ImageStore.COPY)); //$NON-NLS-1$
mgr.add(new Separator());
MenuManager subMenu = new MenuManager(Messages.getString("bookmarkview.customCopyAction"));
if (this.customCopyAction1 != null) {
+ customCopyAction1.selectionChanged(selection);
subMenu.add(customCopyAction1);
}
if (this.customCopyAction2 != null) {
+ customCopyAction2.selectionChanged(selection);
subMenu.add(customCopyAction2);
}
if (this.customCopyAction3 != null) {
+ customCopyAction3.selectionChanged(selection);
subMenu.add(customCopyAction3);
}
mgr.add(subMenu);
|| this.customCopyAction3 != null)) {
MenuManager subMenu = new MenuManager(Messages.getString("bookmarkview.customCopyAction"));
if (this.customCopyAction1 != null) {
- subMenu.add(customCopyAction1);
+ customCopyAction1.selectionChanged(selection);
+ subMenu.add(customCopyAction1);
}
if (this.customCopyAction2 != null) {
+ customCopyAction2.selectionChanged(selection);
subMenu.add(customCopyAction2);
}
if (this.customCopyAction3 != null) {
+ customCopyAction3.selectionChanged(selection);
subMenu.add(customCopyAction3);
}
mgr.add(subMenu);
import com.quantum.actions.ViewTableAction;
import com.quantum.actions.ViewTableDetailsAction;
import com.quantum.model.Bookmark;
+import com.quantum.model.Entity;
import com.quantum.util.versioning.VersioningHelper;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.actions.ExportResourcesAction;
+import org.eclipse.ui.actions.ImportResourcesAction;
import org.eclipse.ui.actions.SelectionListenerAction;
import org.eclipse.ui.actions.SelectionProviderAction;
import org.eclipse.ui.dialogs.PropertyDialogAction;
private SelectionListenerAction renameAction;
private ExportResourcesAction exportAction;
+ private ImportResourcesAction importAction;
private SelectionProviderAction propertiesAction;
this.exportAction = VersioningHelper.createExportResourcesAction(
this.viewPart.getViewSite().getWorkbenchWindow());
this.exportAction.setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.EXPORT));
+ this.importAction = VersioningHelper.createImportResourcesAction(
+ this.viewPart.getViewSite().getWorkbenchWindow());
+ this.importAction.setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.IMPORT));
this.dropAction = new DropEntityAction(this.viewPart);
this.exportAction.selectionChanged(getStructuredSelection());
menu.add(this.exportAction);
}
-
- if (getStructuredSelection().size() == 1 &&
- isEverySelectionInstanceof(BookmarkNode.class)) {
+ if (this.importAction != null) {
+ this.importAction.selectionChanged(getStructuredSelection());
+ menu.add(this.importAction);
}
+
if (isEverySelectionInstanceof(QueryNode.class)) {
if (getStructuredSelection().size() == 1) {
addToMenu(menu, this.openQueryAction);
return result;
}
+ private boolean isEverySelectedGroupOfType(String type) {
+ boolean result = true;
+ IStructuredSelection selection = getStructuredSelection();
+ for (Iterator i = selection.iterator(); result && i.hasNext(); ) {
+ Object object = i.next();
+ result &= (( object instanceof GroupNode ) &&
+ ((GroupNode)object).getType().equals(type));
+ }
+
+ return result;
+ }
+ private boolean isEverySelectedEntityTable() {
+ boolean result = true;
+ IStructuredSelection selection = getStructuredSelection();
+ for (Iterator i = selection.iterator(); result && i.hasNext(); ) {
+ Object object = i.next();
+ result &= (( object instanceof EntityNode ) &&
+ ((EntityNode)object).isTable());
+ }
+
+ return result;
+ }
+ private boolean isEverySelectedEntityView() {
+ boolean result = true;
+ IStructuredSelection selection = getStructuredSelection();
+ for (Iterator i = selection.iterator(); result && i.hasNext(); ) {
+ Object object = i.next();
+ result &= (( object instanceof EntityNode ) &&
+ ((EntityNode)object).isView());
+ }
+ return result;
+ }
public IAction getOpenAction() {
if (isEverySelectionInstanceof(BookmarkNode.class)) {
String label = getName() + " : " + this.column.getTypeName(); //$NON-NLS-1$
if (this.column.isNumeric()) {
if (this.column.getSize() > 0 || this.column.getNumberOfFractionalDigits() > 0) {
- label += "(" + Integer.toString(this.column.getSize()); //$NON-NLS-1$
+ label += "(" + Long.toString(this.column.getSize()); //$NON-NLS-1$
if (this.column.getNumberOfFractionalDigits() > 0) {
label += "," + Integer.toString(this.column.getNumberOfFractionalDigits()); //$NON-NLS-1$
}
label += ")"; //$NON-NLS-1$
}
} else if (this.column.getSize() > 0) {
- label += "(" + Integer.toString(this.column.getSize()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ label += "(" + Long.toString(this.column.getSize()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
return label;
}
} else if (isView()) {
return "view.gif";
} else {
- return (this.entity.exists() == null || this.entity.exists().booleanValue())
- ? "bigtable.gif" : "missingtable.gif";
+ if (this.entity.exists() == null || this.entity.exists().booleanValue()){
+ if (this.entity.isSynonym())
+ return "big_syn_table.gif";
+ else
+ return "bigtable.gif";
+ } else
+ return "missingtable.gif";
+
+
}
}
// TODO Auto-generated method stub
return null;
}
+
+ /* (non-Javadoc)
+ * @see com.quantum.model.Entity#isSynonym()
+ */
+ public boolean isSynonym() {
+ return false;
+ }
}
ImageStore.getImageDescriptor(ImageStore.XML));
exportXMLAction.init(this);
- this.customCopyAction = new CustomCopyAction(this,1); // 1 is unused, just in case more custom copies are defined
+ this.customCopyAction = new CustomCopyAction(1); // 1 is unused, just in case more custom copies are defined
this.customCopyAction.setText(Messages.getString("bookmarkview.customCopyAction")); //$NON-NLS-1$
this.customCopyAction.setImageDescriptor(
ImageStore.getImageDescriptor(ImageStore.COPY));
public ChangeEncodingAction(IViewPart view, ISelectionProvider selectionProvider, String encoding, String key) {
super(view, selectionProvider);
this.encoding = encoding;
- setText(Messages.getString(getClass(), key));
- setToolTipText(Messages.getString(getClass(), key));
+ setText(key + " " + Messages.getString(getClass(), "encoding"));
+ setToolTipText(key + " " + Messages.getString(getClass(), "encoding"));
}
/* (non-Javadoc)
package com.quantum.wizards;
import java.sql.SQLException;
-import java.util.Arrays;
import com.quantum.adapters.DatabaseAdapter;
import com.quantum.model.Bookmark;
import com.quantum.util.connection.ConnectionUtil;
import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
/**
* @author BC Holmes
- * @author Sirkware
*/
public abstract class BaseSQLPage extends WizardPage implements SQLPage {
this.results = results;
this.row = row;
}
-
- /**
- * @param table
- * @param colName
- * @param style
- * @param pos
- * @param width
- */
- protected void createTableColumn(Table table, String colName, int style, int pos, int width) {
- TableColumn column = new TableColumn(table, style, pos);
- column.setText(colName);
- column.setWidth(width);
- }
-
- /**
- * @param columnNames
- * @return
- */
- protected java.util.List getColumnNamesAsList(String[] columnNames) {
- return Arrays.asList(columnNames);
- }
}
boolean complete = true;
complete &= (this.connectionURL != null
&& this.connectionURL.trim().length() > 0);
- complete &= (this.userid != null
- && this.userid.trim().length() > 0);
+ // Some databases don't use user id
+ //complete &= (this.userid != null
+ // && this.userid.trim().length() > 0);
setPageComplete(complete);
}
/**
--- /dev/null
+package com.quantum.wizards;
+
+import java.util.Arrays;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+/**
+ * @author Elvin E. Ebora
+ */
+
+public class CommonWizardUI {
+
+ /**
+ * constructor
+ */
+ public CommonWizardUI() {}
+
+ /**
+ * Creates a standard Table UI for wizard implementation
+ * @param composite
+ * @return Table
+ */
+ protected Table createTablePage(Composite composite) {
+ int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
+ Table table = new Table(composite, style);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ table.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
+ return table;
+ }
+
+ /**
+ * Creates a standard TableColumn UI for wizard implementation
+ * @param table
+ * @param colName
+ * @param style
+ * @param pos
+ * @param width
+ */
+ protected void createTableColumn(Table table, String colName, int style, int pos, int width) {
+ TableColumn column = new TableColumn(table, style, pos);
+ column.setText(colName);
+ column.setWidth(width);
+ }
+
+ /**
+ * Creates a standard GridData UI for wizard implementation
+ * @param horzSpan
+ * @param alignment
+ * @return GridData
+ */
+ protected GridData createGridData(int horzSpan, int alignment) {
+ GridData gridData = new GridData();
+ gridData.horizontalSpan = horzSpan;
+ gridData.horizontalAlignment = alignment;
+ gridData.verticalAlignment = alignment;
+ return gridData;
+ }
+
+ /**
+ * Returns a List implementation of an array of string input
+ * @param columnNames
+ * @return java.util.List
+ */
+ protected java.util.List getColumnNamesAsList(String[] columnNames) {
+ return Arrays.asList(columnNames);
+ }
+}
\ No newline at end of file
package com.quantum.wizards;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CheckboxCellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import com.quantum.ImageStore;
import com.quantum.Messages;
-import com.quantum.adapters.DatabaseAdapter;
-import com.quantum.model.Bookmark;
import com.quantum.model.Column;
import com.quantum.model.Entity;
+import com.quantum.util.StringMatrix;
+import com.quantum.util.sql.SQLInstructionBuilder;
+/**
+ * @author BC Holmes
+ * @author Elvin E. Ebora
+ */
public class DeleteRowPage extends BaseSQLPage implements SQLPage {
+
+ class DeleteRowPageValues {
+ private String sColNames = null;
+ private String sValues = null;
+ private boolean bPrimary = false;
+
+ public DeleteRowPageValues() {
+ }
+ /**
+ * @return Returns the bPrimary.
+ */
+ public boolean isBPrimary() {
+ return bPrimary;
+ }
+ /**
+ * @param primary The bPrimary to set.
+ */
+ public void setBPrimary(boolean primary) {
+ bPrimary = primary;
+ }
+ /**
+ * @return Returns the sColNames.
+ */
+ public String getSColNames() {
+ return sColNames;
+ }
+ /**
+ * @param colNames The sColNames to set.
+ */
+ public void setSColNames(String colNames) {
+ sColNames = colNames;
+ }
+ /**
+ * @return Returns the sValues.
+ */
+ public String getSValues() {
+ return sValues;
+ }
+ /**
+ * @param values The sValues to set.
+ */
+ public void setSValues(String values) {
+ sValues = values;
+ }
+ }
+
+ class LabelProviderImpl implements ITableLabelProvider {
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 2) {
+ return ((DeleteRowPageValues)element).isBPrimary() ? imgCheck : imgUncheck;
+ } else {
+ return null;
+ }
+ }
+ public String getColumnText(Object element, int columnIndex) {
+ String sReturn = "";
+ DeleteRowPageValues deleteRow = (DeleteRowPageValues)element;
+ switch (columnIndex) {
+ case 0: // column names
+ sReturn = deleteRow.getSColNames();
+ break;
+ case 1: // values
+ sReturn = deleteRow.getSValues();
+ break;
+ case 2: // set checkbox
+ break;
+ default:
+ break;
+ }
+ return sReturn;
+ }
+ public void addListener(ILabelProviderListener listener) {}
+ public void dispose() {}
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+ public void removeListener(ILabelProviderListener listener) {}
+ }
+
+ class ContentProviderImpl implements IStructuredContentProvider {
+ public Object[] getElements(Object inputElement) {
+ return deleteTable;
+ }
+
+ public void dispose() {}
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+ }
+
+ class CellModifierImpl implements ICellModifier {
+
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+
+ public Object getValue(Object element, String property) {
+ System.out.println("getValue called");
+
+ // Find the index of the column
+ int colIndx = comUI.getColumnNamesAsList(colNames).indexOf(property);
+ System.out.println("colIndx : " + colIndx);
+
+ Object rResult = null;
+ DeleteRowPageValues deleteVal = (DeleteRowPageValues)element;
+
+ switch (colIndx) {
+ case 0: // column names
+ rResult = deleteVal.getSColNames();
+ break;
+ case 1: // values
+ rResult = deleteVal.getSValues();
+ break;
+ case 2: // checkbox
+ rResult = new Boolean(deleteVal.isBPrimary());
+ break;
+ default:
+ break;
+ }
+
+ return rResult;
+ }
+
+ public void modify(Object element, String property, Object value) {
+ int colIndx = comUI.getColumnNamesAsList(colNames).indexOf(property);
+
+ TableItem item = (TableItem) element;
+ DeleteRowPageValues deleteVal = (DeleteRowPageValues)item.getData();
+
+ switch (colIndx) {
+ case 0: // column names
+ break;
+ case 1: // values
+ deleteVal.setSValues(value.toString());
+ break;
+ case 2: // checkbox
+ deleteVal.setBPrimary(((Boolean)value).booleanValue());
+ break;
+ default:
+ break;
+ }
+
+ updateView();
+ updateQuery();
+ }
+ }
+
String[] columnNames;
- Text[] values;
- Button[] whereValues;
- Text query;
+ String[] colNames;
+ Label query;
+ DeleteRowPageValues[] deleteTable = null;
+ CommonWizardUI comUI;
+ TableViewer tableViewer = null;
+ static Image imgCheck = null;
+ static Image imgUncheck = null;
+
+ static {
+ imgCheck = ImageStore.getImage(ImageStore.CHECKED);
+ imgUncheck = ImageStore.getImage(ImageStore.UNCHECKED);
+ }
public DeleteRowPage(String pageName) {
super(pageName);
public void createControl(Composite parent) {
System.out.println("page create control"); //$NON-NLS-1$
- Composite container = new Composite(parent, SWT.V_SCROLL);
- GridLayout layout = new GridLayout();
- container.setLayout(layout);
- layout.numColumns = 3;
+ Composite container = new Composite(parent, SWT.NULL);
+ container.setLayout(new GridLayout());
+ container.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
Entity entity = this.results.getEntity();
+
+ comUI = new CommonWizardUI();
+
+ // init values to be displayed on the table
columnNames = this.results.getColumnNames();
-
- values = new Text[columnNames.length];
- whereValues = new Button[columnNames.length];
- new Label(container, SWT.NULL).setText(Messages.getString("DeleteRowPage.ColumnName")); //$NON-NLS-1$
- new Label(container, SWT.NULL).setText(Messages.getString("DeleteRowPage.Value")); //$NON-NLS-1$
- new Label(container, SWT.NULL).setText(Messages.getString("DeleteRowPage.IncludeIn")); //$NON-NLS-1$
- for (int i = 0; i < columnNames.length; i++) {
- Label label = new Label(container, SWT.NULL);
- label.setText(columnNames[i]);
- values[i] = new Text(container, SWT.BORDER | SWT.SINGLE);
- Object object = this.row == null ? null : this.row.get(i+1);
- values[i].setText(object == null ? "" : object.toString());
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = 150;
- values[i].setLayoutData(gridData);
- values[i].addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- updateQuery();
- }
- });
-
- whereValues[i] = new Button(container, SWT.CHECK);
- whereValues[i].setText(Messages.getString("DeleteRowPage.WhereClause")); //$NON-NLS-1$
- // we check if it's a primary key to select it in the WHERE clause
- Column column = getColumn(entity, columnNames[i]);
- whereValues[i].setSelection(column == null ? false : column.isPrimaryKey());
- whereValues[i].addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- updateQuery();
- }
- });
+ int nLen = columnNames.length;
+ deleteTable = new DeleteRowPageValues[nLen];
+
+ for(int nCtr=0; nCtr<nLen; nCtr++) {
+ deleteTable[nCtr] = new DeleteRowPageValues();
+ deleteTable[nCtr].setSColNames(columnNames[nCtr]);
+ Object data = this.row == null ? null : this.row.get(nCtr+1);
+ deleteTable[nCtr].setSValues(data == null ? "" : data.toString());
+ Column column = (entity == null) ? null : getColumn(entity, columnNames[nCtr]);
+ if (column != null && column.isPrimaryKey()) {
+ deleteTable[nCtr].setBPrimary(true);
+ }
}
- query = new Text(container, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
- GridData gridData = new GridData();
- gridData.horizontalSpan = layout.numColumns;
- gridData.verticalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- query.setLayoutData(gridData);
+
+ createTable(container);
+
+ query = new Label(container, SWT.WRAP);
+ query.setLayoutData(comUI.createGridData(1, GridData.FILL));
setControl(container);
updateQuery();
}
public void updateQuery() {
System.out.println(Messages.getString("DeleteRowPage.UpdatingQuery")); //$NON-NLS-1$
- StringBuffer whereClause = new StringBuffer();
- Bookmark bookmark = this.results.getBookmark();
- Entity entity = this.results.getEntity();
- DatabaseAdapter adapter = bookmark.getAdapter();
-
- int numSelected = 0;
+ StringMatrix key = new StringMatrix();
for (int i = 0; i < columnNames.length; i++) {
- if (whereValues[i].getSelection()) {
- if (numSelected > 0) whereClause.append(" AND "); //$NON-NLS-1$
- numSelected++;
- whereClause.append("("); //$NON-NLS-1$
- whereClause.append(columnNames[i]);
- whereClause.append(" = "); //$NON-NLS-1$
- appendColumn(whereClause, entity, columnNames[i], adapter, values[i].getText());
- whereClause.append(")"); //$NON-NLS-1$
+ if (deleteTable[i].isBPrimary()) {
+ key.addHeader( deleteTable[i].getSColNames() );
+ key.add( deleteTable[i].getSValues() , 0 );
}
}
- String query = "DELETE FROM " + this.results.getEntity().getQuotedTableName(); //$NON-NLS-1$
- if (numSelected > 0) {
- query += " WHERE " + whereClause.toString(); //$NON-NLS-1$
- }
- if (numSelected > 0) {
- setMessage(""); //$NON-NLS-1$
- } else {
- setMessage(Messages.getString("DeleteRowPage.WarningNoWhere")); //$NON-NLS-1$
- }
- this.query.setText(query);
+ this.query.setText(SQLInstructionBuilder.buildDelete(this.results.getEntity(), key));
}
protected String getQueryText() {
return query.getText();
}
+
+ private void updateView() {
+ this.tableViewer.update(deleteTable, null);
+ }
+
+ private void createTable(Composite composite) {
+ System.out.println("Creating table...");
+ Table table = comUI.createTablePage(composite);
+ colNames = new String[] { Messages.getString("DeleteRowPage.ColumnName"), Messages.getString("DeleteRowPage.Value"), "Where" };
+
+ comUI.createTableColumn(table, colNames[0], SWT.LEFT, 0, 150);
+ comUI.createTableColumn(table, colNames[1], SWT.LEFT, 1, 300);
+ comUI.createTableColumn(table, colNames[2], SWT.CENTER, 2, 60);
+ this.tableViewer = new TableViewer(table);
+ this.tableViewer.setColumnProperties(colNames);
+
+ CellEditor[] editor = new CellEditor[colNames.length];
+ TextCellEditor txtEditorField = new TextCellEditor(table);
+ txtEditorField.getControl().setEnabled(false);
+ editor[0] = txtEditorField;
+
+ TextCellEditor txtEditorFieldValue = new TextCellEditor(table);
+ editor[1] = txtEditorFieldValue;
+
+ editor[2] = new CheckboxCellEditor(table, SWT.NULL);
+
+ this.tableViewer.setCellEditors(editor);
+ this.tableViewer.setLabelProvider(new LabelProviderImpl());
+ this.tableViewer.setContentProvider(new ContentProviderImpl());
+ this.tableViewer.setCellModifier(new CellModifierImpl());
+ this.tableViewer.setInput(deleteTable);
+ }
}
\ No newline at end of file
package com.quantum.wizards;
-import java.util.Arrays;
-
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
import com.quantum.Messages;
-import com.quantum.adapters.DatabaseAdapter;
-import com.quantum.model.Bookmark;
-import com.quantum.model.Entity;
-import com.quantum.sql.SQLResultSetResults;
+import com.quantum.util.StringMatrix;
+import com.quantum.util.sql.SQLInstructionBuilder;
+/**
+ * @author BC Holmes
+ * @author Elvin E. Ebora
+ */
public class InsertRowPage extends BaseSQLPage implements SQLPage {
class InsertRowTableValues {
System.out.println("getValue called");
// Find the index of the column
- int colIndx = getColumnNamesAsList(colNames).indexOf(property);
+ int colIndx = comUI.getColumnNamesAsList(colNames).indexOf(property);
System.out.println("colIndx : " + colIndx);
Object rResult = null;
}
public void modify(Object element, String property, Object value) {
- int colIndx = getColumnNamesAsList(colNames).indexOf(property);
+ int colIndx = comUI.getColumnNamesAsList(colNames).indexOf(property);
TableItem item = (TableItem) element;
InsertRowTableValues insertVal = (InsertRowTableValues)item.getData();
String[] columnNames;
String[] colNames;
- Text[] values;
Label query;
InsertRowTableValues[] insertTable = null;
+ CommonWizardUI comUI;
TableViewer tableViewer = null;
int numColumns = 0;
Composite container = new Composite(parent, SWT.NULL);
container.setLayout(new GridLayout());
container.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
+
+ comUI = new CommonWizardUI();
// init values to be displayed on the table
columnNames = this.results.getColumnNames();
createTable(container);
query = new Label(container, SWT.WRAP);
- GridData gridData = new GridData();
- gridData.horizontalSpan = 1;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- query.setLayoutData(gridData);
+ query.setLayoutData(comUI.createGridData(1, GridData.FILL));
setControl(container);
updateQuery();
}
public void updateQuery() {
System.out.println("Updating query"); //$NON-NLS-1$
- StringBuffer valuesClause = new StringBuffer();
- StringBuffer namesClause = new StringBuffer();
- Bookmark bookmark = this.results.getBookmark();
- Entity entity = this.results.getEntity();
- DatabaseAdapter adapter = bookmark.getAdapter();
- numColumns = 0;
+ StringMatrix columns = new StringMatrix();
for (int i = 0; i < columnNames.length; i++) {
- String name = insertTable[i].getColNames();
- String value = insertTable[i].getValues();
- if (value != null && value.length() > 0) {
- if (numColumns > 0) {
- valuesClause.append(", "); //$NON-NLS-1$
- namesClause.append(", ");
- }
- appendColumn(valuesClause, entity, name, adapter, value);
- namesClause.append(name);
- numColumns++;
- }
+ columns.addHeader( insertTable[i].getColNames() );
+ columns.add( insertTable[i].getValues() , 0 );
}
-
- String query = "INSERT INTO " + this.results.getEntity().getQuotedTableName(); //$NON-NLS-1$
- if (numColumns > 0) {
- query += " (" + namesClause + ")";
- query += " VALUES " + "(" + valuesClause; //$NON-NLS-1$
- query += " )"; //$NON-NLS-1$
- }
- this.query.setText(query);
+ this.query.setText(SQLInstructionBuilder.buildInsert(this.results.getEntity(), columns));
}
/* (non-Javadoc)
* @see com.quantum.wizards.BaseSQLPage#getQueryText()
private void createTable(Composite composite) {
System.out.println("Creating table...");
- int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
- Table table = new Table(composite, style);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- table.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
-
+ Table table = comUI.createTablePage(composite);
colNames = new String[] { Messages.getString("InsertRowPage.ColumnName"), Messages.getString("InsertRowPage.Value") };
- createTableColumn(table, colNames[0], SWT.LEFT, 0, 200);
- createTableColumn(table, colNames[1], SWT.LEFT, 1, 500);
+ comUI.createTableColumn(table, colNames[0], SWT.LEFT, 0, 200);
+ comUI.createTableColumn(table, colNames[1], SWT.LEFT, 1, 500);
this.tableViewer = new TableViewer(table);
this.tableViewer.setColumnProperties(colNames);
import java.sql.SQLException;
+import com.quantum.ImageStore;
+import com.quantum.model.Column;
+import com.quantum.model.Entity;
+import com.quantum.model.NotConnectedException;
import com.quantum.sql.FilterSort;
import com.quantum.sql.SQLResultSetResults;
import com.quantum.ui.dialog.SQLExceptionDialog;
import com.quantum.util.connection.ConnectionUtil;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CheckboxCellEditor;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
public class SortFilterPage extends WizardPage implements SQLPage {
- Button[] filter;
- Combo[] operator;
- Text[] filterValues;
- Button[] stringFlags;
- Button[] sort;
- Combo[] ascDesc;
- private SQLResultSetResults.Row row;
+ class SortFilterTableValues {
+ private String colNames = null;
+ private boolean isWhere = false;
+ private String operators = "";
+ private String values = null;
+ private boolean isString = false;
+ private boolean isOrderBy = false;
+ private String sorter = "";
+
+ /**
+ * @return Returns the isOrderBy.
+ */
+ public boolean isOrderBy() {
+ return isOrderBy;
+ }
+ /**
+ * @param isOrderBy The isOrderBy to set.
+ */
+ public void setOrderBy(boolean isOrderBy) {
+ this.isOrderBy = isOrderBy;
+ }
+ /**
+ * @return Returns the isString.
+ */
+ public boolean isString() {
+ return isString;
+ }
+ /**
+ * @param isString The isString to set.
+ */
+ public void setString(boolean isString) {
+ this.isString = isString;
+ }
+ /**
+ * @return Returns the isWhere.
+ */
+ public boolean isWhere() {
+ return isWhere;
+ }
+ /**
+ * @param isWhere The isWhere to set.
+ */
+ public void setWhere(boolean isWhere) {
+ this.isWhere = isWhere;
+ }
+ /**
+ * @return Returns the operators.
+ */
+ public String getOperators() {
+ return operators;
+ }
+ /**
+ * @param operators The operators to set.
+ */
+ public void setOperators(String operators) {
+ this.operators = operators;
+ }
+ /**
+ * @return Returns the sorter.
+ */
+ public String getSorter() {
+ return sorter;
+ }
+ /**
+ * @param sorter The sorter to set.
+ */
+ public void setSorter(String sorter) {
+ this.sorter = sorter;
+ }
+ /**
+ * @return Returns the values.
+ */
+ public String getValues() {
+ return values;
+ }
+ /**
+ * @param values The values to set.
+ */
+ public void setValues(String values) {
+ this.values = values;
+ }
+ /**
+ * @return Returns the colNames.
+ */
+ public String getColNames() {
+ return colNames;
+ }
+ /**
+ * @param colNames The colNames to set.
+ */
+ public void setColNames(String colNames) {
+ this.colNames = colNames;
+ }
+ }
+
+ class LabelProviderImpl implements ITableLabelProvider {
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ return ((SortFilterTableValues)element).isWhere() ? imgCheck : imgUncheck;
+ } else if (columnIndex == 3) {
+ return ((SortFilterTableValues)element).isString() ? imgCheck : imgUncheck;
+ } else if (columnIndex == 4) {
+ return ((SortFilterTableValues)element).isOrderBy() ? imgCheck : imgUncheck;
+ } else {
+ return null;
+ }
+ }
+ public String getColumnText(Object element, int columnIndex) {
+ String sReturn = "";
+ SortFilterTableValues sortFilterRow = (SortFilterTableValues)element;
+
+ switch (columnIndex) {
+ case 0: // isWhere
+ sReturn = sortFilterRow.getColNames();
+ break;
+ case 1: // operators
+ sReturn = sortFilterRow.getOperators();
+ break;
+ case 2: // values
+ sReturn = sortFilterRow.getValues();
+ break;
+ case 3: // isString
+ break;
+ case 4: // isOrderBy
+ sReturn = sortFilterRow.getColNames();
+ break;
+ case 5: // sorter
+ sReturn = sortFilterRow.getSorter();
+ break;
+ default:
+ break;
+ }
+ return sReturn;
+ }
+ public void addListener(ILabelProviderListener listener) {}
+ public void dispose() {}
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+ public void removeListener(ILabelProviderListener listener) {}
+ }
+
+ class ContentProviderImpl implements IStructuredContentProvider {
+ public Object[] getElements(Object inputElement) {
+ return sortFilterValues;
+ }
+
+ public void dispose() {}
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+ }
+
+ class CellModifierImpl implements ICellModifier {
+
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+
+ public Object getValue(Object element, String property) {
+ System.out.println("getValue called");
+
+ // Find the index of the column
+ int colIndx = comUI.getColumnNamesAsList(colNames).indexOf(property);
+ System.out.println("colIndx : " + colIndx);
+
+ Object rResult = null;
+ SortFilterTableValues sortFilterVal = (SortFilterTableValues)element;
+
+ switch (colIndx) {
+ case 0: // isWhere
+ rResult = new Boolean(sortFilterVal.isWhere());
+ break;
+ case 1: // operators
+ String sTemp = sortFilterVal.getOperators();
+ int nIndex = comUI.getColumnNamesAsList(oper).indexOf(sTemp);
+ rResult = new Integer(nIndex);
+ break;
+ case 2: // values
+ rResult = sortFilterVal.getValues();
+ break;
+ case 3: // isString
+ rResult = new Boolean(sortFilterVal.isString());
+ break;
+ case 4: // isOrderBy
+ rResult = new Boolean(sortFilterVal.isOrderBy());
+ break;
+ case 5: // sorter
+ String sTemp2 = sortFilterVal.getSorter();
+ int nIndx = comUI.getColumnNamesAsList(order).indexOf(sTemp2);
+ rResult = new Integer(nIndx);
+ break;
+ default:
+ rResult = "";
+ break;
+ }
+
+ return rResult;
+ }
+
+ public void modify(Object element, String property, Object value) {
+ int colIndx = comUI.getColumnNamesAsList(colNames).indexOf(property);
+
+ TableItem item = (TableItem) element;
+ SortFilterTableValues sortFilterVal = (SortFilterTableValues)item.getData();
+
+ switch (colIndx) {
+ case 0: // isWhere
+ sortFilterVal.setWhere(((Boolean)value).booleanValue());
+ break;
+ case 1: // operators
+ int nIdx = ((Integer)value).intValue();
+ if (nIdx != -1)
+ sortFilterVal.setOperators(oper[nIdx]);
+ else
+ sortFilterVal.setOperators("");
+
+ break;
+ case 2: // values
+ sortFilterVal.setValues(value.toString());
+ break;
+ case 3: // isString
+ sortFilterVal.setString(((Boolean)value).booleanValue());
+ break;
+ case 4: // isOrderBy
+ sortFilterVal.setOrderBy(((Boolean)value).booleanValue());
+ break;
+ case 5: // sorter
+ int nId = ((Integer)value).intValue();
+ if (nId != -1)
+ sortFilterVal.setSorter(order[nId]);
+ else
+ sortFilterVal.setSorter("");
+
+ break;
+ default:
+ break;
+ }
+
+ updateView();
+ updateQuery();
+ }
+ }
+
+ private SQLResultSetResults.Row row;
private ConnectionUtil connectionUtil = new ConnectionUtil();
+ CommonWizardUI comUI;
+ SortFilterTableValues[] sortFilterValues;
+ TableViewer tableViewer = null;
+ static Image imgCheck = null;
+ static Image imgUncheck = null;
String columnNames[];
Label query;
FilterSort filterSort = new FilterSort();
private SQLResultSetResults results;
+
+ static {
+ imgCheck = ImageStore.getImage(ImageStore.CHECKED);
+ imgUncheck = ImageStore.getImage(ImageStore.UNCHECKED);
+ }
+
+ // constant declarations
+ String[] colNames = new String[] { "Where", "Operator", "Values", "Is String", "Order By", "Sorter" };
+ String[] oper = new String[] { "=", "<>", "<", ">" };
+ String[] order = new String[] { "", "ASC", "DESC" };
+
public SortFilterPage(String pageName) {
super(pageName);
}
public void init(SQLResultSetResults results, SQLResultSetResults.Row row) {
this.results = results;
- this.row = row;
+ this.row = row;
}
public void createControl(Composite parent) {
System.out.println("page create control"); //$NON-NLS-1$
-
+
Composite container = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- container.setLayout(layout);
- int layoutColumns = 6;
- layout.numColumns = layoutColumns;
-
- columnNames = this.results.getColumnNames();
+ container.setLayout(new GridLayout());
+ container.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
- int size = this.results.getColumnCount();
- filter = new Button[size];
- operator = new Combo[size];
- filterValues = new Text[size];
- stringFlags = new Button[size];
- sort = new Button[size];
- ascDesc = new Combo[size];
- for (int i = 0; i < size; i++) {
- filter[i] = new Button(container, SWT.CHECK);
- filter[i].setText(columnNames[i]);
- filter[i].addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- updateQuery();
- }
- });
-
- operator[i] = new Combo(container, SWT.SINGLE | SWT.READ_ONLY);
- operator[i].add("="); //$NON-NLS-1$
- operator[i].add("<>"); //$NON-NLS-1$
- operator[i].add("<"); //$NON-NLS-1$
- operator[i].add(">"); //$NON-NLS-1$
- operator[i].addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- updateQuery();
- }
- });
-
- filterValues[i] = new Text(container, SWT.BORDER);
- Object data = this.row == null ? null : this.row.get(i+1);
- filterValues[i].setText(data == null ? "" : data.toString());
- filterValues[i].addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateQuery();
- }
- });
-
- stringFlags[i] = new Button(container, SWT.CHECK);
- stringFlags[i].setText("String"); //$NON-NLS-1$
- stringFlags[i].addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- updateQuery();
- }
- });
+ comUI = new CommonWizardUI();
+
+ columnNames = this.results.getColumnNames();
+ int nLen = columnNames.length;
+ sortFilterValues = new SortFilterTableValues[nLen];
+
+ for (int nCtr = 0; nCtr < nLen; nCtr++) {
+ sortFilterValues[nCtr] = new SortFilterTableValues();
+ sortFilterValues[nCtr].setColNames(columnNames[nCtr]);
- final int index = i;
- sort[i] = new Button(container, SWT.CHECK);
- sort[i].setText(columnNames[i]);
- sort[i].addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- if (sort[index].getSelection()) {
- filterSort.addSort(columnNames[index], ascDesc[index].getText());
- } else {
- filterSort.removeSort(columnNames[index]);
- }
- updateQuery();
- }
- });
-
- ascDesc[i] = new Combo(container, SWT.SINGLE | SWT.READ_ONLY);
- ascDesc[i].add(""); //$NON-NLS-1$
- ascDesc[i].add("ASC"); //$NON-NLS-1$
- ascDesc[i].add("DESC"); //$NON-NLS-1$
- ascDesc[i].addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- if (sort[index].getSelection()) {
- filterSort.addSort(columnNames[index], ascDesc[index].getText());
- } else {
- filterSort.removeSort(columnNames[index]);
- }
- updateQuery();
- }
- });
+ Object data = this.row == null ? null : this.row.get(nCtr+1);
+ sortFilterValues[nCtr].setValues(data == null ? "" : data.toString());
}
+
+ createTable(container);
+
query = new Label(container, SWT.WRAP);
- GridData gridData = new GridData();
- gridData.horizontalSpan = layoutColumns;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- query.setLayoutData(gridData);
+ query.setLayoutData(comUI.createGridData(1, GridData.FILL));
- setControl(container);
-
+ setControl(container);
setPageComplete(true);
}
public void updateQuery() {
filterSort.clearFilters();
- for (int i = 0; i < filter.length; i++) {
- if (filter[i].getSelection()) {
- filterSort.addFilter(filter[i].getText(), operator[i].getText(), filterValues[i].getText(), stringFlags[i].getSelection());
+
+ int nLen = columnNames.length;
+ for (int nCtr = 0; nCtr < nLen; nCtr++) {
+ if (sortFilterValues[nCtr].isWhere()) {
+ filterSort.addFilter(columnNames[nCtr], sortFilterValues[nCtr].getOperators(), sortFilterValues[nCtr].getValues(), sortFilterValues[nCtr].isString());
+ }
+ if (sortFilterValues[nCtr].isOrderBy()) {
+ filterSort.addSort(columnNames[nCtr], sortFilterValues[nCtr].getSorter());
+ } else {
+ filterSort.removeSort(columnNames[nCtr]);
}
}
+
query.setText(filterSort.toString());
}
return false;
}
}
+
+ private void updateView() {
+ this.tableViewer.update(sortFilterValues, null);
+ }
+
+ /**
+ * @param entity
+ * @param columnName
+ * @return
+ * @throws NotConnectedException
+ * @throws SQLException
+ */
+ protected Column getColumn(Entity entity, String columnName) {
+ try {
+ return entity == null ? null : entity.getColumn(columnName);
+ } catch (NotConnectedException e) {
+ return null;
+ } catch (SQLException e) {
+ return null;
+ }
+ }
+
+ private void createTable(Composite composite) {
+ System.out.println("Creating table...");
+ Table table = comUI.createTablePage(composite);
+
+ comUI.createTableColumn(table, colNames[0], SWT.LEFT, 0, 150); // isWhere
+ comUI.createTableColumn(table, colNames[1], SWT.CENTER, 1, 70); // operator
+ comUI.createTableColumn(table, colNames[2], SWT.LEFT, 2, 150); // values
+ comUI.createTableColumn(table, colNames[3], SWT.LEFT, 3, 70); // isString
+ comUI.createTableColumn(table, colNames[4], SWT.LEFT, 4, 150); // isOrderBy
+ comUI.createTableColumn(table, colNames[5], SWT.CENTER, 5, 70); // sorter
+ this.tableViewer = new TableViewer(table);
+ this.tableViewer.setColumnProperties(colNames);
+
+ CellEditor[] editor = new CellEditor[colNames.length];
+
+ editor[0] = new CheckboxCellEditor(table, SWT.NULL);
+
+ editor[1] = new ComboBoxCellEditor(table, oper, SWT.READ_ONLY);
+
+ editor[2] = new TextCellEditor(table);
+
+ editor[3] = new CheckboxCellEditor(table, SWT.NULL);
+
+ editor[4] = new CheckboxCellEditor(table, SWT.NULL);
+
+ editor[5] = new ComboBoxCellEditor(table, order, SWT.READ_ONLY);
+
+ this.tableViewer.setCellEditors(editor);
+ this.tableViewer.setLabelProvider(new LabelProviderImpl());
+ this.tableViewer.setContentProvider(new ContentProviderImpl());
+ this.tableViewer.setCellModifier(new CellModifierImpl());
+ this.tableViewer.setInput(sortFilterValues);
+ }
}
package com.quantum.wizards;
-import java.util.Arrays;
-
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckboxCellEditor;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
import com.quantum.ImageStore;
import com.quantum.Messages;
-import com.quantum.adapters.DatabaseAdapter;
-import com.quantum.model.Bookmark;
import com.quantum.model.Column;
import com.quantum.model.Entity;
-import com.quantum.wizards.InsertRowPage.CellModifierImpl;
-import com.quantum.wizards.InsertRowPage.ContentProviderImpl;
-import com.quantum.wizards.InsertRowPage.InsertRowTableValues;
-import com.quantum.wizards.InsertRowPage.LabelProviderImpl;
+import com.quantum.util.StringMatrix;
+import com.quantum.util.sql.SQLInstructionBuilder;
+/**
+ * @author BC Holmes
+ * @author Elvin E. Ebora
+ */
public class UpdateRowPage extends BaseSQLPage implements SQLPage {
class UpdateRowTableValues {
System.out.println("getValue called");
// Find the index of the column
- int colIndx = getColumnNamesAsList(colNames).indexOf(property);
+ int colIndx = comUI.getColumnNamesAsList(colNames).indexOf(property);
System.out.println("colIndx : " + colIndx);
Object rResult = null;
}
public void modify(Object element, String property, Object value) {
- int colIndx = getColumnNamesAsList(colNames).indexOf(property);
+ int colIndx = comUI.getColumnNamesAsList(colNames).indexOf(property);
TableItem item = (TableItem) element;
UpdateRowTableValues updateVal = (UpdateRowTableValues)item.getData();
String[] columnNames;
String[] colNames;
- Text[] oldValues;
- Text[] newValues;
- Button[] primaryKeys;
- Button[] setValues;
Label query;
UpdateRowTableValues[] updateTable = null;
+ CommonWizardUI comUI;
TableViewer tableViewer = null;
static Image imgCheck = null;
static Image imgUncheck = null;
Entity entity = this.results.getEntity();
+ comUI = new CommonWizardUI();
+
// init values to be displayed on the table
columnNames = this.results.getColumnNames();
int nLen = columnNames.length;
createTable(container);
- query = new Label(container, SWT.WRAP);
- GridData gridData = new GridData();
- gridData.horizontalSpan = 1;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- query.setLayoutData(gridData);
+ query = new Label(container, SWT.WRAP);
+ query.setLayoutData(comUI.createGridData(1, GridData.FILL));
setControl(container);
updateQuery();
}
public void updateQuery() {
System.out.println("Updating query"); //$NON-NLS-1$
- StringBuffer setClause = new StringBuffer();
- StringBuffer whereClause = new StringBuffer();
- Bookmark bookmark = this.results.getBookmark();
- Entity entity = this.results.getEntity();
- DatabaseAdapter adapter = bookmark.getAdapter();
- int numValuesSet = 0;
- int numValuesWhere = 0;
- for (int nCtr = 0; nCtr < columnNames.length; nCtr++) {
- if (updateTable[nCtr].isBPrimary()) {
- String value = updateTable[nCtr].getSOldValue();
- if (numValuesWhere > 0) whereClause.append(" AND "); //$NON-NLS-1$
- whereClause.append("("); //$NON-NLS-1$
- whereClause.append(updateTable[nCtr].getSColNames());
- whereClause.append(" = "); //$NON-NLS-1$
- appendColumn(whereClause, entity, updateTable[nCtr].getSColNames(), adapter, value);
- whereClause.append(")"); //$NON-NLS-1$
- numValuesWhere++;
- }
- if (updateTable[nCtr].isBSetValue()) {
- String value = updateTable[nCtr].getSNewValue();
- if (numValuesSet > 0) setClause.append(", "); //$NON-NLS-1$
- setClause.append(updateTable[nCtr].getSColNames());
- setClause.append(" = "); //$NON-NLS-1$
- appendColumn(setClause, entity, updateTable[nCtr].getSColNames(), adapter, value);
- numValuesSet++;
+ StringMatrix columns = new StringMatrix();
+ for (int i = 0; i < columnNames.length; i++) {
+ if (updateTable[i].isBSetValue()) {
+ columns.addHeader( updateTable[i].getSColNames() );
+ columns.add( updateTable[i].getSNewValue(), 0 );
}
}
-
- String query = "UPDATE " + this.results.getEntity().getQuotedTableName(); //$NON-NLS-1$
- query += " SET " + setClause.toString(); //$NON-NLS-1$
- query += " WHERE " + whereClause.toString(); //$NON-NLS-1$
- this.query.setText(query);
+ StringMatrix key = new StringMatrix();
+ for (int i = 0; i < columnNames.length; i++) {
+ if (updateTable[i].isBPrimary()) {
+ key.addHeader( updateTable[i].getSColNames() );
+ // It's an old value because it't the key.
+ key.add( updateTable[i].getSOldValue() , 0 );
+ }
+ }
+ this.query.setText(SQLInstructionBuilder.buildUpdate(this.results.getEntity(), columns, key));
}
/* (non-Javadoc)
}
private void createTable(Composite composite) {
- System.out.println("Creating table...");
- int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
- Table table = new Table(composite, style);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- table.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
-
+ System.out.println("Creating table...");
+ Table table = comUI.createTablePage(composite);
colNames = new String[] { Messages.getString("UpdateRowPage.ColumnName"), Messages.getString("UpdateRowPage.OldValue"),
"Where", Messages.getString("UpdateRowPage.NewValue"), Messages.getString("UpdateRowPage.SetValue") };
- createTableColumn(table, colNames[0], SWT.LEFT, 0, 150);
- createTableColumn(table, colNames[1], SWT.LEFT, 1, 300);
- createTableColumn(table, colNames[2], SWT.CENTER, 2, 60);
- createTableColumn(table, colNames[3], SWT.LEFT, 3, 300);
- createTableColumn(table, colNames[4], SWT.CENTER, 4, 70);
+ comUI.createTableColumn(table, colNames[0], SWT.LEFT, 0, 150);
+ comUI.createTableColumn(table, colNames[1], SWT.LEFT, 1, 300);
+ comUI.createTableColumn(table, colNames[2], SWT.CENTER, 2, 60);
+ comUI.createTableColumn(table, colNames[3], SWT.LEFT, 3, 300);
+ comUI.createTableColumn(table, colNames[4], SWT.CENTER, 4, 70);
this.tableViewer = new TableViewer(table);
this.tableViewer.setColumnProperties(colNames);
<plugin
id="net.sourceforge.phpeclipse.core"
name="PHPeclipse Web Development Tools Core"
- version="1.1.0"
+ version="1.1.1"
provider-name="WDTE Project/PHPeclipse"
class="net.sourceforge.phpeclipse.core.WebCore">
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="net.sourceforge.phpeclipse.debug.core" default="build.jars" basedir=".">
-
- <property name="bootclasspath" value=""/>
- <property name="basews" value="${ws}"/>
- <property name="baseos" value="${os}"/>
- <property name="basearch" value="${arch}"/>
- <property name="basenl" value="${nl}"/>
- <property name="javacFailOnError" value="false"/>
- <property name="javacDebugInfo" value="on"/>
- <property name="javacVerbose" value="true"/>
- <property name="javacSource" value="1.3"/>
- <property name="javacTarget" value="1.2"/>
- <property name="compilerArg" value=""/>
-
- <target name="init" depends="properties">
- <condition property="pluginTemp" value="${buildTempFolder}/plugins">
- <isset property="buildTempFolder"/>
- </condition>
- <property name="pluginTemp" value="${basedir}"/>
- <condition property="build.result.folder" value="${pluginTemp}/net.sourceforge.phpeclipse.debug.core">
- <isset property="buildTempFolder"/>
- </condition>
- <property name="build.result.folder" value="${basedir}"/>
- <property name="temp.folder" value="${basedir}/temp.folder"/>
- <property name="plugin.destination" value="${basedir}"/>
- </target>
-
- <target name="properties" if="eclipse.running">
- <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
- </target>
-
- <target name="build.update.jar" depends="init" description="Build the plug-in: net.sourceforge.phpeclipse.debug.core for an update site.">
- <delete dir="${temp.folder}"/>
- <mkdir dir="${temp.folder}"/>
- <antcall target="build.jars"/>
- <antcall target="gather.bin.parts">
- <param name="destination.temp.folder" value="${temp.folder}/"/>
- </antcall>
- <zip zipfile="${plugin.destination}/net.sourceforge.phpeclipse.debug.core_1.1.0.jar" basedir="${temp.folder}/net.sourceforge.phpeclipse.debug.core_1.1.0" filesonly="false" whenempty="skip" update="false"/>
- <delete dir="${temp.folder}"/>
- </target>
-
- <target name="core.jar" depends="init" unless="core.jar" description="Create jar: core.jar.">
- <delete dir="${temp.folder}/core.jar.bin"/>
- <mkdir dir="${temp.folder}/core.jar.bin"/>
- <!-- compile the source code -->
- <javac destdir="${temp.folder}/core.jar.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bootclasspath}" source="${javacSource}" target="${javacTarget}" >
- <compilerarg line="${compilerArg}"/>
- <classpath>
- <pathelement path="../../plugins/org.eclipse.ui_3.0.0/ui.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.runtime_3.0.0/runtime.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/core.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/console.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/osgi.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/resolver.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/defaultAdaptor.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/eclipseAdaptor.jar"/>
- <pathelement path="../../plugins/org.eclipse.help_3.0.0/help.jar"/>
- <pathelement path="../../plugins/org.eclipse.swt_3.0.0/ws/${basews}/swt.jar"/>
- <pathelement path="../../plugins/org.eclipse.swt.win32_3.0.0/ws/${basews}/swt.jar"/>
- <pathelement path="../../plugins/org.eclipse.swt.win32_3.0.0"/>
- <pathelement path="../../plugins/org.eclipse.jface_3.0.0/jface.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench_3.0.0/compatibility.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench_3.0.0/workbench.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench.compatibility_3.0.0/compatibility.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench.compatibility_3.0.0/workbench.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.expressions_3.0.0/expressions.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.resources_3.0.0/resources.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.resources.win32_3.0.0/resources.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.resources.win32_3.0.0/resources-win32.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.runtime.compatibility_3.0.0/compatibility.jar"/>
- <pathelement path="../../plugins/org.eclipse.update.configurator_3.0.0/configurator.jar"/>
- <pathelement path="../../plugins/org.eclipse.debug.core_3.0.0/dtcore.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.variables_3.0.0/variables.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse/phpeclipse.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.console_3.0.0/console.jar"/>
- <pathelement path="../../plugins/org.eclipse.jface.text_3.0.0/jfacetext.jar"/>
- <pathelement path="../../plugins/org.eclipse.text_3.0.0/text.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench.texteditor_3.0.0/texteditor.jar"/>
- <pathelement path="../../plugins/org.eclipse.search_3.0.0/search.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.filebuffers_3.0.0/filebuffers.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.ide_3.0.0/ide.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.win32_3.0.0/ide.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.win32_3.0.0/workbenchwin32.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.views_3.0.0/views.jar"/>
- <pathelement path="../../plugins/org.eclipse.update.core_3.0.0/updatecore.jar"/>
- <pathelement path="../../plugins/org.eclipse.update.core.win32_3.0.0/updatecore.jar"/>
- <pathelement path="../../plugins/org.eclipse.update.ui_3.0.0/updateui.jar"/>
- <pathelement path="../../plugins/org.eclipse.help.base_3.0.0/helpbase.jar"/>
- <pathelement path="../../plugins/org.apache.lucene_1.3.0/parser.jar"/>
- <pathelement path="../../plugins/org.apache.lucene_1.3.0/lucene-1.3-final.jar"/>
- <pathelement path="../../plugins/org.eclipse.help.appserver_3.0.0/appserver.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.forms_3.0.0/forms.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.editors_3.0.0/editors.jar"/>
- <pathelement path="../../plugins/org.eclipse.debug.ui_3.0.0/dtui.jar"/>
- <pathelement path="../../plugins/org.eclipse.compare_3.0.0/compare.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.externaltools_3.0.0/externaltools.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.quantum.sql/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.quantum.sql/quantum.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.webbrowser/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.webbrowser/webbrowser.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.core/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.core/webcore.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.ui/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.ui/wdtui.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.xml.ui/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.xml.ui/xmlui.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.xml.core/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.xml.core/xmlcore.jar"/>
- </classpath>
- <src path="src/" />
- </javac>
- <!-- Copy necessary resources -->
- <copy todir="${temp.folder}/core.jar.bin" failonerror="true">
- <fileset dir="src/" excludes="**/*.java, **/package.htm*" />
- </copy>
- <mkdir dir="${build.result.folder}"/>
- <jar jarfile="${build.result.folder}/core.jar" basedir="${temp.folder}/core.jar.bin"/>
- <delete dir="${temp.folder}/core.jar.bin"/>
- </target>
-
- <target name="coresrc.zip" depends="init" unless="coresrc.zip">
- <mkdir dir="${build.result.folder}"/>
- <zip zipfile="${build.result.folder}/coresrc.zip" filesonly="false" whenempty="skip" update="false">
- <fileset dir="src/" includes="**/*.java" />
- </zip>
- </target>
-
- <target name="build.jars" depends="init" description="Build all the jars for the plug-in: net.sourceforge.phpeclipse.debug.core.">
- <available property="core.jar" file="${build.result.folder}/core.jar"/>
- <antcall target="core.jar"/>
- </target>
-
- <target name="build.sources" depends="init">
- <available property="coresrc.zip" file="${build.result.folder}/coresrc.zip"/>
- <antcall target="coresrc.zip"/>
- </target>
-
- <target name="gather.bin.parts" depends="init" if="destination.temp.folder">
- <mkdir dir="${destination.temp.folder}/net.sourceforge.phpeclipse.debug.core_1.1.0"/>
- <copy todir="${destination.temp.folder}/net.sourceforge.phpeclipse.debug.core_1.1.0" failonerror="true">
- <fileset dir="${build.result.folder}" includes="core.jar" />
- </copy>
- <copy todir="${destination.temp.folder}/net.sourceforge.phpeclipse.debug.core_1.1.0" failonerror="true">
- <fileset dir="${basedir}" includes="core.jar,.classpath,.project,.template,os/,plugin.properties,plugin.xml" />
- </copy>
- </target>
-
- <target name="build.zips" depends="init">
- </target>
-
- <target name="gather.sources" depends="init" if="destination.temp.folder">
- <mkdir dir="${destination.temp.folder}/net.sourceforge.phpeclipse.debug.core_1.1.0"/>
- <copy file="${build.result.folder}/coresrc.zip" todir="${destination.temp.folder}/net.sourceforge.phpeclipse.debug.core_1.1.0" failonerror="false"/>
- <copy todir="${destination.temp.folder}/net.sourceforge.phpeclipse.debug.core_1.1.0" failonerror="false">
- <fileset dir="${basedir}" includes="src/ " />
- </copy>
- </target>
-
- <target name="gather.logs" depends="init" if="destination.temp.folder">
- <mkdir dir="${destination.temp.folder}/net.sourceforge.phpeclipse.debug.core_1.1.0"/>
- <copy file="${temp.folder}/core.jar.bin.log" todir="${destination.temp.folder}/net.sourceforge.phpeclipse.debug.core_1.1.0" failonerror="false"/>
- </target>
-
- <target name="clean" depends="init" description="Clean the plug-in: net.sourceforge.phpeclipse.debug.core of all the zips, jars and logs created.">
- <delete file="${build.result.folder}/core.jar"/>
- <delete file="${build.result.folder}/coresrc.zip"/>
- <delete file="${plugin.destination}/net.sourceforge.phpeclipse.debug.core_1.1.0.jar"/>
- <delete file="${plugin.destination}/net.sourceforge.phpeclipse.debug.core_1.1.0.zip"/>
- <delete dir="${temp.folder}"/>
- </target>
-
- <target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder.">
- <eclipse.convertPath fileSystemPath="C:/eclipse3/workspace/net.sourceforge.phpeclipse.debug.core" property="resourcePath"/>
- <eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/>
- </target>
-
- <target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: net.sourceforge.phpeclipse.debug.core.">
- <delete dir="${temp.folder}"/>
- <mkdir dir="${temp.folder}"/>
- <antcall target="build.jars"/>
- <antcall target="build.sources"/>
- <antcall target="gather.bin.parts">
- <param name="destination.temp.folder" value="${temp.folder}/"/>
- </antcall>
- <antcall target="gather.sources">
- <param name="destination.temp.folder" value="${temp.folder}/"/>
- </antcall>
- <delete>
- <fileset dir="${temp.folder}" includes="**/*.bin.log" />
- </delete>
- <zip zipfile="${plugin.destination}/net.sourceforge.phpeclipse.debug.core_1.1.0.zip" basedir="${temp.folder}" filesonly="true" whenempty="skip" update="false"/>
- <delete dir="${temp.folder}"/>
- </target>
-
-</project>
<plugin
id="net.sourceforge.phpeclipse.debug.core"
name="%Plugin.name"
- version="1.1.0"
+ version="1.1.1"
provider-name="phpeclipse.de"
class="net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin">
<plugin
id="net.sourceforge.phpeclipse.debug.ui"
name="%Plugin.name"
- version="1.1.0"
+ version="1.1.1"
provider-name="phpeclipse.de"
class="net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin">
<feature
id="net.sourceforge.phpeclipse"
label="net.sourceforge.phpeclipse"
- version="1.1.0"
+ version="1.1.1"
provider-name="www.phpeclipse.de"
image="phpeclipse.jpeg">
id="net.sourceforge.phpdt.smarty.ui"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.core"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.css.core"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.css.ui"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.debug.core"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.debug.ui"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.html.ui"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.js.core"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.js.ui"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.launching"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.phphelp"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.phpunit"
id="net.sourceforge.phpeclipse.quantum.sql"
download-size="0"
install-size="0"
- version="2.4.2"/>
+ version="2.4.4"/>
<plugin
id="net.sourceforge.phpeclipse.ui"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.webbrowser"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.xml.core"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
<plugin
id="net.sourceforge.phpeclipse.xml.ui"
download-size="0"
install-size="0"
- version="1.1.0"/>
+ version="1.1.1"/>
+ <plugin
+ id="net.sourceforge.phpeclipse.news"
+ download-size="0"
+ install-size="0"
+ version="1.1.1"/>
</feature>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="net.sourceforge.phpeclipse.launching" default="build.jars" basedir=".">
-
- <property name="bootclasspath" value=""/>
- <property name="basews" value="${ws}"/>
- <property name="baseos" value="${os}"/>
- <property name="basearch" value="${arch}"/>
- <property name="basenl" value="${nl}"/>
- <property name="javacFailOnError" value="false"/>
- <property name="javacDebugInfo" value="on"/>
- <property name="javacVerbose" value="true"/>
- <property name="javacSource" value="1.3"/>
- <property name="javacTarget" value="1.2"/>
- <property name="compilerArg" value=""/>
-
- <target name="init" depends="properties">
- <condition property="pluginTemp" value="${buildTempFolder}/plugins">
- <isset property="buildTempFolder"/>
- </condition>
- <property name="pluginTemp" value="${basedir}"/>
- <condition property="build.result.folder" value="${pluginTemp}/net.sourceforge.phpeclipse.launching">
- <isset property="buildTempFolder"/>
- </condition>
- <property name="build.result.folder" value="${basedir}"/>
- <property name="temp.folder" value="${basedir}/temp.folder"/>
- <property name="plugin.destination" value="${basedir}"/>
- </target>
-
- <target name="properties" if="eclipse.running">
- <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
- </target>
-
- <target name="build.update.jar" depends="init" description="Build the plug-in: net.sourceforge.phpeclipse.launching for an update site.">
- <delete dir="${temp.folder}"/>
- <mkdir dir="${temp.folder}"/>
- <antcall target="build.jars"/>
- <antcall target="gather.bin.parts">
- <param name="destination.temp.folder" value="${temp.folder}/"/>
- </antcall>
- <zip zipfile="${plugin.destination}/net.sourceforge.phpeclipse.launching_1.1.0.jar" basedir="${temp.folder}/net.sourceforge.phpeclipse.launching_1.1.0" filesonly="false" whenempty="skip" update="false"/>
- <delete dir="${temp.folder}"/>
- </target>
-
- <target name="launch.jar" depends="init" unless="launch.jar" description="Create jar: launch.jar.">
- <delete dir="${temp.folder}/launch.jar.bin"/>
- <mkdir dir="${temp.folder}/launch.jar.bin"/>
- <!-- compile the source code -->
- <javac destdir="${temp.folder}/launch.jar.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bootclasspath}" source="${javacSource}" target="${javacTarget}" >
- <compilerarg line="${compilerArg}"/>
- <classpath>
- <pathelement path="../../plugins/org.eclipse.core.runtime_3.0.0/runtime.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/core.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/console.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/osgi.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/resolver.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/defaultAdaptor.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/eclipseAdaptor.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.resources_3.0.0/resources.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.resources.win32_3.0.0/resources.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.resources.win32_3.0.0/resources-win32.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.runtime.compatibility_3.0.0/compatibility.jar"/>
- <pathelement path="../../plugins/org.eclipse.update.configurator_3.0.0/configurator.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui_3.0.0/ui.jar"/>
- <pathelement path="../../plugins/org.eclipse.help_3.0.0/help.jar"/>
- <pathelement path="../../plugins/org.eclipse.swt_3.0.0/ws/${basews}/swt.jar"/>
- <pathelement path="../../plugins/org.eclipse.swt.win32_3.0.0/ws/${basews}/swt.jar"/>
- <pathelement path="../../plugins/org.eclipse.swt.win32_3.0.0"/>
- <pathelement path="../../plugins/org.eclipse.jface_3.0.0/jface.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench_3.0.0/compatibility.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench_3.0.0/workbench.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench.compatibility_3.0.0/compatibility.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench.compatibility_3.0.0/workbench.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.expressions_3.0.0/expressions.jar"/>
- <pathelement path="../../plugins/org.eclipse.debug.core_3.0.0/dtcore.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.variables_3.0.0/variables.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse/phpeclipse.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.console_3.0.0/console.jar"/>
- <pathelement path="../../plugins/org.eclipse.jface.text_3.0.0/jfacetext.jar"/>
- <pathelement path="../../plugins/org.eclipse.text_3.0.0/text.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench.texteditor_3.0.0/texteditor.jar"/>
- <pathelement path="../../plugins/org.eclipse.search_3.0.0/search.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.filebuffers_3.0.0/filebuffers.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.ide_3.0.0/ide.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.win32_3.0.0/ide.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.win32_3.0.0/workbenchwin32.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.views_3.0.0/views.jar"/>
- <pathelement path="../../plugins/org.eclipse.update.core_3.0.0/updatecore.jar"/>
- <pathelement path="../../plugins/org.eclipse.update.core.win32_3.0.0/updatecore.jar"/>
- <pathelement path="../../plugins/org.eclipse.update.ui_3.0.0/updateui.jar"/>
- <pathelement path="../../plugins/org.eclipse.help.base_3.0.0/helpbase.jar"/>
- <pathelement path="../../plugins/org.apache.lucene_1.3.0/parser.jar"/>
- <pathelement path="../../plugins/org.apache.lucene_1.3.0/lucene-1.3-final.jar"/>
- <pathelement path="../../plugins/org.eclipse.help.appserver_3.0.0/appserver.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.forms_3.0.0/forms.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.editors_3.0.0/editors.jar"/>
- <pathelement path="../../plugins/org.eclipse.debug.ui_3.0.0/dtui.jar"/>
- <pathelement path="../../plugins/org.eclipse.compare_3.0.0/compare.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.externaltools_3.0.0/externaltools.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.quantum.sql/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.quantum.sql/quantum.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.webbrowser/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.webbrowser/webbrowser.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.core/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.core/webcore.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.ui/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.ui/wdtui.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.xml.ui/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.xml.ui/xmlui.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.xml.core/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.xml.core/xmlcore.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.debug.core/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.debug.core/core.jar"/>
- </classpath>
- <src path="src/" />
- </javac>
- <!-- Copy necessary resources -->
- <copy todir="${temp.folder}/launch.jar.bin" failonerror="true">
- <fileset dir="src/" excludes="**/*.java, **/package.htm*" />
- </copy>
- <mkdir dir="${build.result.folder}"/>
- <jar jarfile="${build.result.folder}/launch.jar" basedir="${temp.folder}/launch.jar.bin"/>
- <delete dir="${temp.folder}/launch.jar.bin"/>
- </target>
-
- <target name="launchsrc.zip" depends="init" unless="launchsrc.zip">
- <mkdir dir="${build.result.folder}"/>
- <zip zipfile="${build.result.folder}/launchsrc.zip" filesonly="false" whenempty="skip" update="false">
- <fileset dir="src/" includes="**/*.java" />
- </zip>
- </target>
-
- <target name="build.jars" depends="init" description="Build all the jars for the plug-in: net.sourceforge.phpeclipse.launching.">
- <available property="launch.jar" file="${build.result.folder}/launch.jar"/>
- <antcall target="launch.jar"/>
- </target>
-
- <target name="build.sources" depends="init">
- <available property="launchsrc.zip" file="${build.result.folder}/launchsrc.zip"/>
- <antcall target="launchsrc.zip"/>
- </target>
-
- <target name="gather.bin.parts" depends="init" if="destination.temp.folder">
- <mkdir dir="${destination.temp.folder}/net.sourceforge.phpeclipse.launching_1.1.0"/>
- <copy todir="${destination.temp.folder}/net.sourceforge.phpeclipse.launching_1.1.0" failonerror="true">
- <fileset dir="${build.result.folder}" includes="launch.jar" />
- </copy>
- <copy todir="${destination.temp.folder}/net.sourceforge.phpeclipse.launching_1.1.0" failonerror="true">
- <fileset dir="${basedir}" includes="plugin.xml,plugin.properties,.classpath,.project,.template,cpl-v10.html,launch.jar" />
- </copy>
- </target>
-
- <target name="build.zips" depends="init">
- </target>
-
- <target name="gather.sources" depends="init" if="destination.temp.folder">
- <mkdir dir="${destination.temp.folder}/net.sourceforge.phpeclipse.launching_1.1.0"/>
- <copy file="${build.result.folder}/launchsrc.zip" todir="${destination.temp.folder}/net.sourceforge.phpeclipse.launching_1.1.0" failonerror="false"/>
- <copy todir="${destination.temp.folder}/net.sourceforge.phpeclipse.launching_1.1.0" failonerror="false">
- <fileset dir="${basedir}" includes="src/" />
- </copy>
- </target>
-
- <target name="gather.logs" depends="init" if="destination.temp.folder">
- <mkdir dir="${destination.temp.folder}/net.sourceforge.phpeclipse.launching_1.1.0"/>
- <copy file="${temp.folder}/launch.jar.bin.log" todir="${destination.temp.folder}/net.sourceforge.phpeclipse.launching_1.1.0" failonerror="false"/>
- </target>
-
- <target name="clean" depends="init" description="Clean the plug-in: net.sourceforge.phpeclipse.launching of all the zips, jars and logs created.">
- <delete file="${build.result.folder}/launch.jar"/>
- <delete file="${build.result.folder}/launchsrc.zip"/>
- <delete file="${plugin.destination}/net.sourceforge.phpeclipse.launching_1.1.0.jar"/>
- <delete file="${plugin.destination}/net.sourceforge.phpeclipse.launching_1.1.0.zip"/>
- <delete dir="${temp.folder}"/>
- </target>
-
- <target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder.">
- <eclipse.convertPath fileSystemPath="C:/eclipse3/workspace/net.sourceforge.phpeclipse.launching" property="resourcePath"/>
- <eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/>
- </target>
-
- <target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: net.sourceforge.phpeclipse.launching.">
- <delete dir="${temp.folder}"/>
- <mkdir dir="${temp.folder}"/>
- <antcall target="build.jars"/>
- <antcall target="build.sources"/>
- <antcall target="gather.bin.parts">
- <param name="destination.temp.folder" value="${temp.folder}/"/>
- </antcall>
- <antcall target="gather.sources">
- <param name="destination.temp.folder" value="${temp.folder}/"/>
- </antcall>
- <delete>
- <fileset dir="${temp.folder}" includes="**/*.bin.log" />
- </delete>
- <zip zipfile="${plugin.destination}/net.sourceforge.phpeclipse.launching_1.1.0.zip" basedir="${temp.folder}" filesonly="true" whenempty="skip" update="false"/>
- <delete dir="${temp.folder}"/>
- </target>
-
-</project>
<plugin
id="net.sourceforge.phpeclipse.launching"
name="%Plugin.name"
- version="1.1.0"
+ version="1.1.1"
provider-name="phpeclipse.de"
class="net.sourceforge.phpdt.internal.launching.PHPLaunchingPlugin">
<plugin
id="net.sourceforge.phpeclipse.phphelp"
name="%pluginName"
- version="1.1.0"
+ version="1.1.1"
provider-name="%providerName"
class="net.sourceforge.phpdt.phphelp.PHPHelpPlugin">
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="net.sourceforge.phpdt.smarty.ui" default="build.jars" basedir=".">
-
- <property name="bootclasspath" value=""/>
- <property name="basews" value="${ws}"/>
- <property name="baseos" value="${os}"/>
- <property name="basearch" value="${arch}"/>
- <property name="basenl" value="${nl}"/>
- <property name="javacFailOnError" value="false"/>
- <property name="javacDebugInfo" value="on"/>
- <property name="javacVerbose" value="true"/>
- <property name="javacSource" value="1.3"/>
- <property name="javacTarget" value="1.2"/>
- <property name="compilerArg" value=""/>
-
- <target name="init" depends="properties">
- <condition property="pluginTemp" value="${buildTempFolder}/plugins">
- <isset property="buildTempFolder"/>
- </condition>
- <property name="pluginTemp" value="${basedir}"/>
- <condition property="build.result.folder" value="${pluginTemp}/net.sourceforge.phpeclipse.smarty.ui">
- <isset property="buildTempFolder"/>
- </condition>
- <property name="build.result.folder" value="${basedir}"/>
- <property name="temp.folder" value="${basedir}/temp.folder"/>
- <property name="plugin.destination" value="${basedir}"/>
- </target>
-
- <target name="properties" if="eclipse.running">
- <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
- </target>
-
- <target name="build.update.jar" depends="init" description="Build the plug-in: net.sourceforge.phpdt.smarty.ui for an update site.">
- <delete dir="${temp.folder}"/>
- <mkdir dir="${temp.folder}"/>
- <antcall target="build.jars"/>
- <antcall target="gather.bin.parts">
- <param name="destination.temp.folder" value="${temp.folder}/"/>
- </antcall>
- <zip zipfile="${plugin.destination}/net.sourceforge.phpdt.smarty.ui_1.1.0.jar" basedir="${temp.folder}/net.sourceforge.phpdt.smarty.ui_1.1.0" filesonly="false" whenempty="skip" update="false"/>
- <delete dir="${temp.folder}"/>
- </target>
-
- <target name="smartyui.jar" depends="init" unless="smartyui.jar" description="Create jar: smartyui.jar.">
- <delete dir="${temp.folder}/smartyui.jar.bin"/>
- <mkdir dir="${temp.folder}/smartyui.jar.bin"/>
- <!-- compile the source code -->
- <javac destdir="${temp.folder}/smartyui.jar.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bootclasspath}" source="${javacSource}" target="${javacTarget}" >
- <compilerarg line="${compilerArg}"/>
- <classpath>
- <pathelement path="../net.sourceforge.phpeclipse.xml.ui/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.xml.ui/xmlui.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.core/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.core/webcore.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.runtime_3.0.0/runtime.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/core.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/console.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/osgi.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/resolver.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/defaultAdaptor.jar"/>
- <pathelement path="../../plugins/org.eclipse.osgi_3.0.0/eclipseAdaptor.jar"/>
- <pathelement path="../../plugins/org.eclipse.text_3.0.0/text.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.xml.core/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.xml.core/xmlcore.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.resources_3.0.0/resources.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.resources.win32_3.0.0/resources.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.resources.win32_3.0.0/resources-win32.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.runtime.compatibility_3.0.0/compatibility.jar"/>
- <pathelement path="../../plugins/org.eclipse.update.configurator_3.0.0/configurator.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.ui/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.ui/wdtui.jar"/>
- <pathelement path="../../plugins/org.eclipse.jface.text_3.0.0/jfacetext.jar"/>
- <pathelement path="../../plugins/org.eclipse.swt_3.0.0/ws/${basews}/swt.jar"/>
- <pathelement path="../../plugins/org.eclipse.swt.win32_3.0.0/ws/${basews}/swt.jar"/>
- <pathelement path="../../plugins/org.eclipse.swt.win32_3.0.0"/>
- <pathelement path="../../plugins/org.eclipse.jface_3.0.0/jface.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui_3.0.0/ui.jar"/>
- <pathelement path="../../plugins/org.eclipse.help_3.0.0/help.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench_3.0.0/compatibility.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench_3.0.0/workbench.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench.compatibility_3.0.0/compatibility.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench.compatibility_3.0.0/workbench.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.expressions_3.0.0/expressions.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.editors_3.0.0/editors.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.ide_3.0.0/ide.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.win32_3.0.0/ide.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.win32_3.0.0/workbenchwin32.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.views_3.0.0/views.jar"/>
- <pathelement path="../../plugins/org.eclipse.update.core_3.0.0/updatecore.jar"/>
- <pathelement path="../../plugins/org.eclipse.update.core.win32_3.0.0/updatecore.jar"/>
- <pathelement path="../../plugins/org.eclipse.update.ui_3.0.0/updateui.jar"/>
- <pathelement path="../../plugins/org.eclipse.help.base_3.0.0/helpbase.jar"/>
- <pathelement path="../../plugins/org.apache.lucene_1.3.0/parser.jar"/>
- <pathelement path="../../plugins/org.apache.lucene_1.3.0/lucene-1.3-final.jar"/>
- <pathelement path="../../plugins/org.eclipse.help.appserver_3.0.0/appserver.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.forms_3.0.0/forms.jar"/>
- <pathelement path="../../plugins/org.eclipse.ui.workbench.texteditor_3.0.0/texteditor.jar"/>
- <pathelement path="../../plugins/org.eclipse.core.filebuffers_3.0.0/filebuffers.jar"/>
- <pathelement path="../net.sourceforge.phpeclipse.webbrowser/bin"/>
- <pathelement path="../net.sourceforge.phpeclipse.webbrowser/webbrowser.jar"/>
- <pathelement path="../../plugins/org.eclipse.compare_3.0.0/compare.jar"/>
- </classpath>
- <src path="src/" />
- </javac>
- <!-- Copy necessary resources -->
- <copy todir="${temp.folder}/smartyui.jar.bin" failonerror="true">
- <fileset dir="src/" excludes="**/*.java, **/package.htm*" />
- </copy>
- <mkdir dir="${build.result.folder}"/>
- <jar jarfile="${build.result.folder}/smartyui.jar" basedir="${temp.folder}/smartyui.jar.bin"/>
- <delete dir="${temp.folder}/smartyui.jar.bin"/>
- </target>
-
- <target name="smartyuisrc.zip" depends="init" unless="smartyuisrc.zip">
- <mkdir dir="${build.result.folder}"/>
- <zip zipfile="${build.result.folder}/smartyuisrc.zip" filesonly="false" whenempty="skip" update="false">
- <fileset dir="src/" includes="**/*.java" />
- </zip>
- </target>
-
- <target name="build.jars" depends="init" description="Build all the jars for the plug-in: net.sourceforge.phpdt.smarty.ui.">
- <available property="smartyui.jar" file="${build.result.folder}/smartyui.jar"/>
- <antcall target="smartyui.jar"/>
- </target>
-
- <target name="build.sources" depends="init">
- <available property="smartyuisrc.zip" file="${build.result.folder}/smartyuisrc.zip"/>
- <antcall target="smartyuisrc.zip"/>
- </target>
-
- <target name="gather.bin.parts" depends="init" if="destination.temp.folder">
- <mkdir dir="${destination.temp.folder}/net.sourceforge.phpdt.smarty.ui_1.1.0"/>
- <copy todir="${destination.temp.folder}/net.sourceforge.phpdt.smarty.ui_1.1.0" failonerror="true">
- <fileset dir="${build.result.folder}" includes="smartyui.jar" />
- </copy>
- <copy todir="${destination.temp.folder}/net.sourceforge.phpdt.smarty.ui_1.1.0" failonerror="true">
- <fileset dir="${basedir}" includes="plugin.xml,icons/,cpl-v10.html,smartyui.jar" />
- </copy>
- </target>
-
- <target name="build.zips" depends="init">
- </target>
-
- <target name="gather.sources" depends="init" if="destination.temp.folder">
- <mkdir dir="${destination.temp.folder}/net.sourceforge.phpdt.smarty.ui_1.1.0"/>
- <copy file="${build.result.folder}/smartyuisrc.zip" todir="${destination.temp.folder}/net.sourceforge.phpdt.smarty.ui_1.1.0" failonerror="false"/>
- <copy todir="${destination.temp.folder}/net.sourceforge.phpdt.smarty.ui_1.1.0" failonerror="false">
- <fileset dir="${basedir}" includes="src/,.classpath,.cvsignore,.project" />
- </copy>
- </target>
-
- <target name="gather.logs" depends="init" if="destination.temp.folder">
- <mkdir dir="${destination.temp.folder}/net.sourceforge.phpdt.smarty.ui_1.1.0"/>
- <copy file="${temp.folder}/smartyui.jar.bin.log" todir="${destination.temp.folder}/net.sourceforge.phpdt.smarty.ui_1.1.0" failonerror="false"/>
- </target>
-
- <target name="clean" depends="init" description="Clean the plug-in: net.sourceforge.phpdt.smarty.ui of all the zips, jars and logs created.">
- <delete file="${build.result.folder}/smartyui.jar"/>
- <delete file="${build.result.folder}/smartyuisrc.zip"/>
- <delete file="${plugin.destination}/net.sourceforge.phpdt.smarty.ui_1.1.0.jar"/>
- <delete file="${plugin.destination}/net.sourceforge.phpdt.smarty.ui_1.1.0.zip"/>
- <delete dir="${temp.folder}"/>
- </target>
-
- <target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder.">
- <eclipse.convertPath fileSystemPath="C:/eclipse3/workspace/net.sourceforge.phpeclipse.smarty.ui" property="resourcePath"/>
- <eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/>
- </target>
-
- <target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: net.sourceforge.phpdt.smarty.ui.">
- <delete dir="${temp.folder}"/>
- <mkdir dir="${temp.folder}"/>
- <antcall target="build.jars"/>
- <antcall target="build.sources"/>
- <antcall target="gather.bin.parts">
- <param name="destination.temp.folder" value="${temp.folder}/"/>
- </antcall>
- <antcall target="gather.sources">
- <param name="destination.temp.folder" value="${temp.folder}/"/>
- </antcall>
- <delete>
- <fileset dir="${temp.folder}" includes="**/*.bin.log" />
- </delete>
- <zip zipfile="${plugin.destination}/net.sourceforge.phpdt.smarty.ui_1.1.0.zip" basedir="${temp.folder}" filesonly="true" whenempty="skip" update="false"/>
- <delete dir="${temp.folder}"/>
- </target>
-
-</project>
<plugin
id="net.sourceforge.phpdt.smarty.ui"
name="PHPeclipse Smarty UI"
- version="1.1.0"
+ version="1.1.1"
provider-name="PHPeclipse.de"
class="net.sourceforge.phpdt.smarty.ui.SmartyUI">
<plugin id="net.sourceforge.phpeclipse.webbrowser"
name="%pluginName"
- version="1.1.0"
+ version="1.1.1"
provider-name="%providerName"
class="net.sourceforge.phpeclipse.webbrowser.internal.WebBrowserUIPlugin">
<plugin
id="net.sourceforge.phpeclipse.xml.core"
name="%pluginName"
- version="1.1.0"
+ version="1.1.1"
provider-name="%providerName"
class="">
<plugin
id="net.sourceforge.phpeclipse.xml.ui"
name="%pluginName"
- version="1.1.0"
+ version="1.1.1"
provider-name="%providerName"
class="net.sourceforge.phpeclipse.xml.ui.XMLPlugin">
<plugin
id="net.sourceforge.phpeclipse"
name="%pluginName"
- version="1.1.0"
+ version="1.1.1"
provider-name="%providerName"
class="net.sourceforge.phpeclipse.PHPeclipsePlugin">
<extension
point="org.eclipse.ui.popupMenus">
- <objectContribution
+ <!-- <objectContribution
objectClass="org.eclipse.core.resources.IProject"
id="net.sourceforge.phpeclipse.actions.PHPDocumentorAction">
<action
menubarPath="additions"
id="net.sourceforge.phpeclipse.actions.PHPDocumentorAction">
</action>
- </objectContribution>
+ </objectContribution> -->
<objectContribution
objectClass="org.eclipse.core.resources.IFile"
nameFilter="*.php"