JBoss Tools SVN: r16661 - in branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda: impl and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2009-07-19 18:17:03 -0400 (Sun, 19 Jul 2009)
New Revision: 16661
Added:
branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResult.java
Removed:
branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ReflectServerOdaFactory.java
Modified:
branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/IOdaFactory.java
branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/AbstractOdaFactory.java
branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ConsoleConfigurationOdaFactory.java
branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateConnection.java
branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateOdaQuery.java
branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResultSet.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4149 Hibernate ODA errors on subreport on subsequent calls to Dataset
Modified: branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/IOdaFactory.java
===================================================================
--- branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/IOdaFactory.java 2009-07-19 01:55:04 UTC (rev 16660)
+++ branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/IOdaFactory.java 2009-07-19 22:17:03 UTC (rev 16661)
@@ -10,11 +10,11 @@
************************************************************************************/
package org.jboss.tools.birt.oda;
-import java.util.Iterator;
-import java.util.List;
-
import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
import org.jboss.tools.birt.oda.impl.HibernateOdaQuery;
+import org.jboss.tools.birt.oda.impl.HibernateResult;
import org.jboss.tools.birt.oda.impl.HibernateResultSetMetaData;
/**
@@ -31,12 +31,9 @@
void close();
boolean isOpen();
- HibernateResultSetMetaData prepare(String queryText) throws OdaException;
+ HibernateResultSetMetaData prepare(String queryText,Session session) throws OdaException;
void setMaxRows(int max);
int getMaxRows();
- void executeQuery(HibernateOdaQuery query) throws OdaException;
- Iterator getIterator();
- List getResult();
- Object getResult(int rstcol) throws OdaException;
- void next();
+ HibernateResult executeQuery(HibernateOdaQuery query,Session session) throws OdaException;
+ SessionFactory getSessionFactory();
}
Modified: branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/AbstractOdaFactory.java
===================================================================
--- branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/AbstractOdaFactory.java 2009-07-19 01:55:04 UTC (rev 16660)
+++ branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/AbstractOdaFactory.java 2009-07-19 22:17:03 UTC (rev 16661)
@@ -2,22 +2,17 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
-import org.eclipse.datatools.connectivity.oda.IParameterMetaData;
-import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.osgi.util.NLS;
-import org.hibernate.EntityMode;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.engine.query.HQLQueryPlan;
import org.hibernate.impl.SessionFactoryImpl;
-import org.hibernate.metadata.ClassMetadata;
import org.hibernate.type.Type;
import org.jboss.tools.birt.oda.IOdaFactory;
import org.jboss.tools.birt.oda.Messages;
@@ -26,40 +21,41 @@
protected SessionFactory sessionFactory;
private int maxRows;
- private List result;
- private Iterator iterator;
- private Type[] queryReturnTypes;
- private Object currentRow;
- private HibernateOdaQuery query;
- private Session session;
+ //private List result;
+ //private Iterator iterator;
+ //private Type[] queryReturnTypes;
+ //private Object currentRow;
+ //private HibernateOdaQuery query;
+ //private Session session;
private String queryText;
public void close() {
- sessionFactory = null;
- if (session != null) {
- session.close();
- session = null;
- }
+// if (session != null) {
+// session.close();
+// session = null;
+// }
}
+
+ public boolean isOpen() {
+ return getSessionFactory() != null;
+ }
public SessionFactory getSessionFactory() {
return sessionFactory;
}
- public HibernateResultSetMetaData prepare(String queryText) throws OdaException {
+ public HibernateResultSetMetaData prepare(String queryText,Session session) throws OdaException {
this.queryText = queryText;
- return parseQuery();
+ return parseQuery(session);
}
- private HibernateResultSetMetaData parseQuery()
+ private HibernateResultSetMetaData parseQuery(Session session)
throws OdaException {
List arColsType = new ArrayList();
List arCols = new ArrayList();
List arColClass = new ArrayList();
String[] props = null;
- Session session = null;
try {
- session = getSessionFactory().openSession();
Query query = session.createQuery(queryText);
int maxRows = getMaxRows();
if (maxRows > 0) {
@@ -112,10 +108,6 @@
.toArray(new String[arColClass.size()]));
} catch (Exception e) {
throw new OdaException(e.getLocalizedMessage());
- } finally {
- if (session != null) {
- session.close();
- }
}
}
@@ -156,10 +148,8 @@
this.maxRows = maxRows;
}
- public void executeQuery(HibernateOdaQuery query) throws OdaException {
- this.query = query;
+ public HibernateResult executeQuery(HibernateOdaQuery query,Session session) throws OdaException {
try {
- session = getSessionFactory().openSession();
Query q = session.createQuery(queryText);
HibernateParameterMetaData parameterMetaData = (HibernateParameterMetaData) query.getParameterMetaData();
List<Parameter> parameters = parameterMetaData.getParameters();
@@ -174,58 +164,11 @@
break;
}
}
- result = q.list();
- iterator = result.iterator();
- this.queryReturnTypes = q.getReturnTypes();
+ HibernateResult hibernateResult = new HibernateResult(q,this, query);
+ return hibernateResult;
} catch (HibernateException e) {
throw new OdaException(e.getLocalizedMessage());
}
}
-
- public Iterator getIterator() {
- return iterator;
- }
-
- public List getResult() {
- return result;
- }
-
- public Object getResult(int rstcol) throws OdaException {
- Object obj = this.currentRow;
- Object value = null;
- try {
- if (queryReturnTypes.length > 0
- && queryReturnTypes[0].isEntityType()) {
- String checkClass = ((HibernateResultSetMetaData) getMetaData())
- .getColumnClass(rstcol);
- SessionFactory sf = getSessionFactory();
- ClassMetadata metadata = sf.getClassMetadata(checkClass);
- if (metadata == null) {
- metadata = sf.getClassMetadata(obj.getClass());
- }
- value = metadata.getPropertyValue(obj, getMetaData()
- .getColumnName(rstcol), EntityMode.POJO);
- } else {
- if (getMetaData().getColumnCount() == 1) {
- value = obj;
- } else {
- Object[] values = (Object[]) obj;
- value = values[rstcol - 1];
- }
- }
- } catch (Exception e) {
- throw new OdaException(e.getLocalizedMessage());
- }
- return (value);
- }
-
- private IResultSetMetaData getMetaData() throws OdaException {
- return query.getMetaData();
- }
-
- public void next() {
- currentRow = getIterator().next();
- }
-
}
Modified: branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ConsoleConfigurationOdaFactory.java
===================================================================
--- branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ConsoleConfigurationOdaFactory.java 2009-07-19 01:55:04 UTC (rev 16660)
+++ branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ConsoleConfigurationOdaFactory.java 2009-07-19 22:17:03 UTC (rev 16661)
@@ -29,7 +29,7 @@
public class ConsoleConfigurationOdaFactory extends AbstractOdaFactory {
ConsoleConfiguration consoleConfiguration;
-
+
public ConsoleConfigurationOdaFactory(Properties properties) throws OdaException {
getSessionFactory(properties);
String maxRowString = properties.getProperty(IOdaFactory.MAX_ROWS);
@@ -49,7 +49,7 @@
break;
}
}
- if (isOpen()) {
+ if (!isOpen()) {
try {
sessionFactory = consoleConfiguration.getSessionFactory();
if (sessionFactory == null) {
@@ -65,14 +65,5 @@
}
return sessionFactory;
}
-
- @Override
- public void close() {
- consoleConfiguration = null;
- super.close();
- }
- public boolean isOpen() {
- return consoleConfiguration != null;
- }
}
Modified: branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateConnection.java
===================================================================
--- branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateConnection.java 2009-07-19 01:55:04 UTC (rev 16660)
+++ branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateConnection.java 2009-07-19 22:17:03 UTC (rev 16661)
@@ -16,6 +16,7 @@
import org.eclipse.datatools.connectivity.oda.IDataSetMetaData;
import org.eclipse.datatools.connectivity.oda.IQuery;
import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.hibernate.Session;
import org.jboss.tools.birt.oda.IOdaFactory;
import org.jboss.tools.birt.oda.Messages;
import org.osgi.framework.Bundle;
@@ -27,8 +28,10 @@
*/
public class HibernateConnection implements IConnection {
private IOdaFactory odaSessionFactory;
- private Map appContext;
+ private Session session;
+ //private Map appContext;
+
/*
* @see
* org.eclipse.datatools.connectivity.oda.IConnection#open(java.util.Properties
@@ -43,6 +46,7 @@
} else {
odaSessionFactory = new ServerOdaFactory(connProperties);
}
+ session = odaSessionFactory.getSessionFactory().openSession();
}
/*
@@ -54,21 +58,28 @@
if (!(context instanceof Map)) {
throw new OdaException(Messages.HibernateConnection_Invalid_AppContext);
}
- this.appContext = (Map) context;
+ //this.appContext = (Map) context;
}
/*
* @see org.eclipse.datatools.connectivity.oda.IConnection#close()
*/
public void close() throws OdaException {
- odaSessionFactory.close();
+ if (odaSessionFactory != null) {
+ odaSessionFactory.close();
+ odaSessionFactory = null;
+ }
+ if (session != null) {
+ session.close();
+ session = null;
+ }
}
/*
* @see org.eclipse.datatools.connectivity.oda.IConnection#isOpen()
*/
public boolean isOpen() throws OdaException {
- return odaSessionFactory != null && odaSessionFactory.isOpen();
+ return session != null && session.isOpen();
}
/*
@@ -114,13 +125,13 @@
// do nothing; assumes no transaction support needed
}
- /*
- * public SessionFactory getSessionFactory() { return
- * odaSessionFactory.getSessionFactory(); }
- */
-
public IOdaFactory getOdaSessionFactory() {
return odaSessionFactory;
}
+ public Session getSession() {
+ return session;
+ }
+
+
}
Modified: branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateOdaQuery.java
===================================================================
--- branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateOdaQuery.java 2009-07-19 01:55:04 UTC (rev 16660)
+++ branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateOdaQuery.java 2009-07-19 22:17:03 UTC (rev 16661)
@@ -20,7 +20,7 @@
import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.SortSpec;
-import org.jboss.tools.birt.oda.Messages;
+import org.hibernate.Session;
/**
* Implementation class of IQuery for an ODA runtime driver.
@@ -31,9 +31,11 @@
private HibernateConnection connection;
private HibernateResultSetMetaData resultSetMetaData;
private HibernateParameterMetaData parameterMetaData = new HibernateParameterMetaData();
+ private Session session;
public HibernateOdaQuery(HibernateConnection connection) {
this.connection = connection;
+ this.session = connection.getSession();
}
/*
@@ -42,7 +44,7 @@
*/
public void prepare(String queryText) throws OdaException {
this.resultSetMetaData = getConnection().getOdaSessionFactory()
- .prepare(queryText);
+ .prepare(queryText,session);
}
/*
Added: branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResult.java
===================================================================
--- branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResult.java (rev 0)
+++ branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResult.java 2009-07-19 22:17:03 UTC (rev 16661)
@@ -0,0 +1,82 @@
+package org.jboss.tools.birt.oda.impl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.hibernate.EntityMode;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.hibernate.metadata.ClassMetadata;
+import org.hibernate.type.Type;
+import org.jboss.tools.birt.oda.IOdaFactory;
+
+public class HibernateResult {
+
+ private List result;
+ private Iterator iterator;
+ private Type[] queryReturnTypes;
+ private Object currentRow;
+ private IOdaFactory odaFactory;
+ private HibernateOdaQuery query;
+
+ public HibernateResult(Query q, IOdaFactory odaFactory, HibernateOdaQuery query) {
+ this.result = q.list();
+ this.iterator = result.iterator();
+ this.queryReturnTypes = q.getReturnTypes();
+ this.odaFactory = odaFactory;
+ this.query = query;
+ }
+
+ public Iterator getIterator() {
+ return iterator;
+ }
+
+ public List getResult() {
+ return result;
+ }
+
+ public Object getResult(int rstcol) throws OdaException {
+ Object obj = this.currentRow;
+ Object value = null;
+ try {
+ if (queryReturnTypes.length > 0
+ && queryReturnTypes[0].isEntityType()) {
+ String checkClass = ((HibernateResultSetMetaData) getMetaData())
+ .getColumnClass(rstcol);
+ SessionFactory sf = odaFactory.getSessionFactory();
+ ClassMetadata metadata = sf.getClassMetadata(checkClass);
+ if (metadata == null) {
+ metadata = sf.getClassMetadata(obj.getClass());
+ }
+ value = metadata.getPropertyValue(obj, getMetaData()
+ .getColumnName(rstcol), EntityMode.POJO);
+ } else {
+ if (getMetaData().getColumnCount() == 1) {
+ value = obj;
+ } else {
+ Object[] values = (Object[]) obj;
+ value = values[rstcol - 1];
+ }
+ }
+ } catch (Exception e) {
+ throw new OdaException(e.getLocalizedMessage());
+ }
+ return (value);
+ }
+
+ public void next() {
+ currentRow = getIterator().next();
+ }
+
+ private IResultSetMetaData getMetaData() throws OdaException {
+ return query.getMetaData();
+ }
+
+ public void close() {
+ if (result != null) {
+ result.clear();
+ }
+ }
+}
Modified: branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResultSet.java
===================================================================
--- branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResultSet.java 2009-07-19 01:55:04 UTC (rev 16660)
+++ branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResultSet.java 2009-07-19 22:17:03 UTC (rev 16661)
@@ -25,6 +25,8 @@
import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.osgi.util.NLS;
+import org.hibernate.Session;
+import org.jboss.tools.birt.oda.IOdaFactory;
import org.jboss.tools.birt.oda.Messages;
/**
@@ -38,12 +40,16 @@
private int rowNumber = -1;
private boolean wasNull;
+ private HibernateResult hibernateResult;
private static DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); //$NON-NLS-1$
public HibernateResultSet(HibernateOdaQuery query) throws OdaException {
this.query = query;
- query.getConnection().getOdaSessionFactory().executeQuery(query);
+ HibernateConnection connection = query.getConnection();
+ IOdaFactory odaSessionFactory = connection.getOdaSessionFactory();
+ Session session = connection.getSession();
+ hibernateResult = odaSessionFactory.executeQuery(query,session);
}
/*
@@ -75,7 +81,7 @@
*/
public boolean next() throws OdaException {
if (getIterator().hasNext()) {
- query.getConnection().getOdaSessionFactory().next();
+ hibernateResult.next();
rowNumber++;
return true;
}
@@ -84,22 +90,18 @@
}
private Iterator getIterator() {
- return query.getConnection().getOdaSessionFactory().getIterator();
+ return hibernateResult.getIterator();
}
/*
* @see org.eclipse.datatools.connectivity.oda.IResultSet#close()
*/
public void close() throws OdaException {
- List result = getResult();
- if (result != null)
- result.clear();
- query.getConnection().getOdaSessionFactory().close();
- result = null;
+ hibernateResult.close();
}
private List getResult() {
- return query.getConnection().getOdaSessionFactory().getResult();
+ return hibernateResult.getResult();
}
/*
@@ -111,7 +113,7 @@
}
private Object getResult(int rstcol) throws OdaException {
- return query.getConnection().getOdaSessionFactory().getResult(rstcol);
+ return hibernateResult.getResult(rstcol);
}
/*
Deleted: branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ReflectServerOdaFactory.java
===================================================================
--- branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ReflectServerOdaFactory.java 2009-07-19 01:55:04 UTC (rev 16660)
+++ branches/jbosstools-3.0.x/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ReflectServerOdaFactory.java 2009-07-19 22:17:03 UTC (rev 16661)
@@ -1,336 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2008 JBoss, a division of Red Hat and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * JBoss, a division of Red Hat - Initial implementation.
- ************************************************************************************/
-package org.jboss.tools.birt.oda.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import javax.naming.InitialContext;
-
-import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
-import org.eclipse.datatools.connectivity.oda.OdaException;
-import org.eclipse.osgi.util.NLS;
-import org.hibernate.SessionFactory;
-import org.jboss.tools.birt.oda.Activator;
-import org.jboss.tools.birt.oda.IOdaFactory;
-import org.jboss.tools.birt.oda.Messages;
-
-/**
- *
- * @author snjeza
- *
- */
-public class ReflectServerOdaFactory implements IOdaFactory {
-
- private static final Integer INTZERO = new Integer(0);
- private static Class[] emptyClassArg = new Class[0];
- private static Object[] emptyObjectArg = new Object[0];
- private Object sessionFactory;
- private Integer maxRows;
- private String queryText;
- private List result;
- private Iterator iterator;
- private Object currentRow;
- private HibernateOdaQuery query;
- private Object session;
- private Object[] queryReturnTypes;
-
- public ReflectServerOdaFactory(Properties properties) throws OdaException {
- getSessionFactory(properties);
- String maxRowString = properties.getProperty(IOdaFactory.MAX_ROWS);
- try {
- maxRows = new Integer(maxRowString);
- } catch (NumberFormatException e) {
- // ignore
- }
- }
-
- public Object getSessionFactory(Properties properties)
- throws OdaException {
- String configurationName = properties.getProperty(CONFIGURATION);
- if (sessionFactory == null) {
- InitialContext ctx = null;
- try {
- ctx = new InitialContext();
- Object obj = ctx.lookup("java:/" + configurationName); //$NON-NLS-1$
- sessionFactory = obj;
- SessionFactory sf = (SessionFactory) obj;
- System.out.println(sf);
- } catch (Exception e) {
- e.printStackTrace();
- throw new OdaException(
- Messages.ReflectServerOdaFactory_Cannot_create_Hibernate_session_factory);
- }
-
- }
- return sessionFactory;
- }
-
- public Object getSessionFactory() {
- return sessionFactory;
- }
-
- public void close() {
- closeSession(session);
- }
-
- public boolean isOpen() {
- if (sessionFactory == null)
- return false;
- boolean isClosed = true;
- try {
- Method method = sessionFactory.getClass().getMethod("isClosed", new Class[0]); //$NON-NLS-1$
- if (method != null) {
- Object closed = method.invoke(sessionFactory, new Object[0]);
- isClosed = ((Boolean) closed).booleanValue();
- }
- } catch (Exception e) {
- // ignore
- }
- return !isClosed;
- }
-
- public int getMaxRows() {
- return maxRows;
- }
-
- public HibernateResultSetMetaData prepare(String queryText)
- throws OdaException {
- this.queryText = queryText;
- List arColsType = new ArrayList();
- List arCols = new ArrayList();
- List arColClass = new ArrayList();
- String[] props = null;
- Object session = null;
-
- try {
- session = openSession();
- Object query = createQuery(session, queryText);
- if (maxRows > 0) {
- Method setFirstResult = query.getClass().getMethod("setFirstResult", new Class[] {Integer.TYPE}); //$NON-NLS-1$
- setFirstResult.invoke(query, new Object[] {INTZERO});
- Method setMaxResults = query.getClass().getMethod("setMaxResults", new Class[] {Integer.TYPE}); //$NON-NLS-1$
- setMaxResults.invoke(query, new Object[] {new Integer(maxRows)});
- }
- Method getReturnTypes = query.getClass().getMethod("getReturnTypes", emptyClassArg); //$NON-NLS-1$
- Object returnType = getReturnTypes.invoke(query, emptyObjectArg);
- Object[] qryReturnTypes = (Object[]) returnType;
- if (checkEntityType(qryReturnTypes)) {
- for (int j = 0; j < qryReturnTypes.length; j++) {
- String clsName = getReturnTypeName(qryReturnTypes[j]);
- props = getHibernateProp(clsName);
- for (int x = 0; x < props.length; x++) {
- String propType = getHibernatePropTypes(clsName,
- props[x]);
- if (DataTypes.isValidType(propType)) {
- arColsType.add(propType);
- arCols.add(props[x]);
- arColClass.add(clsName);
- } else {
- arColsType.add(DataTypes.UNKNOWN);
- arCols.add(props[x]);
- arColClass.add("java.lang.String"); //$NON-NLS-1$
- }
- }
- }
- } else {
- props = extractColumns(queryText);
- for (int t = 0; t < qryReturnTypes.length; t++) {
- String typeName = getReturnTypeName(qryReturnTypes[t]);
- if (DataTypes.isValidType(typeName)) {
- arColsType.add(typeName);
- arCols.add(props[t]);
- } else {
- throw new OdaException(NLS.bind(Messages.ReflectServerOdaFactory_The_type_is_not_valid, typeName));
- }
- }
- }
- String[] arLabels = (String[]) arCols.toArray(new String[arCols
- .size()]);
- for (int j = 0; j < arLabels.length; j++) {
- arLabels[j] = arLabels[j].replace('.', ':');
- }
-
- return new HibernateResultSetMetaData(arLabels,
- (String[]) arColsType
- .toArray(new String[arColsType.size()]), arLabels,
- (String[]) arColClass
- .toArray(new String[arColClass.size()]));
- } catch (Exception e) {
- throw new OdaException(e.getLocalizedMessage());
- } finally {
- closeSession(session);
- }
- }
-
- private void closeSession(Object session) {
- if (session != null) {
- try {
- Method close = session.getClass().getMethod("close", emptyClassArg); //$NON-NLS-1$
- close.invoke(session, emptyObjectArg);
- session = null;
- } catch (Exception e) {
- // ignore
- }
- }
- }
-
- private boolean checkEntityType(Object[] qryReturnTypes) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
- Object first = qryReturnTypes[0];
- Method isEntityType = first.getClass().getMethod("isEntityType", emptyClassArg); //$NON-NLS-1$
- Object ret = isEntityType.invoke(first, emptyObjectArg);
- boolean isEntity = ((Boolean)ret).booleanValue();
- return qryReturnTypes.length > 0 && isEntity;
- }
-
- private Object createQuery(Object session, String queryText)
- throws NoSuchMethodException, IllegalAccessException,
- InvocationTargetException {
- Method createQuery = session.getClass().getMethod("createQuery", new Class[] {String.class}); //$NON-NLS-1$
- Object query = createQuery.invoke(session, new Object[] {queryText});
- return query;
- }
-
- private Object openSession() throws NoSuchMethodException,
- IllegalAccessException, InvocationTargetException {
- Object session;
- Method openSession = sessionFactory.getClass().getMethod("openSession", emptyClassArg); //$NON-NLS-1$
- session = openSession.invoke(sessionFactory, emptyObjectArg);
- return session;
- }
-
- private static String[] extractColumns(final String query) {
- int fromPosition = query.toLowerCase().indexOf("from"); //$NON-NLS-1$
- int selectPosition = query.toLowerCase().indexOf("select"); //$NON-NLS-1$
- if (selectPosition >= 0) {
- String columns = query.substring(selectPosition + 6, fromPosition);
- StringTokenizer st = new StringTokenizer(columns, ","); //$NON-NLS-1$
- List columnList = new ArrayList();
- while (st.hasMoreTokens()) {
- columnList.add(st.nextToken().trim());
- }
- return (String[]) columnList.toArray(new String[0]);
- } else {
- return null;
- }
- }
-
- private String getReturnTypeName(Object returnType) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
- Method getName = returnType.getClass().getMethod("getName", emptyClassArg); //$NON-NLS-1$
- Object name = getName.invoke(returnType, emptyObjectArg);
- return (String) name;
- }
-
- private String[] getHibernateProp(String className) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException{
- Object classMetadata = getClassMetadata(className);
- Method getPropertyNames = classMetadata.getClass().getMethod("getPropertyNames", emptyClassArg); //$NON-NLS-1$
- String[] properties = (String[]) getPropertyNames.invoke(classMetadata, emptyObjectArg);
- return properties;
- }
-
- private Object getClassMetadata(String className)
- throws NoSuchMethodException, IllegalAccessException,
- InvocationTargetException {
- Method getClassMetadata = sessionFactory.getClass().getMethod("getClassMetadata", new Class[] {String.class}); //$NON-NLS-1$
- Object classMetadata = getClassMetadata.invoke(sessionFactory, new Object[] {className});
- return classMetadata;
- }
-
- private Object getClassMetadata(Class clazz) throws NoSuchMethodException,
- IllegalAccessException, InvocationTargetException {
- Method getClassMetadata = sessionFactory.getClass().getMethod(
- "getClassMetadata", new Class[] { Class.class }); //$NON-NLS-1$
- Object classMetadata = getClassMetadata.invoke(sessionFactory,
- new Object[] { clazz });
- return classMetadata;
- }
-
- private String getHibernatePropTypes(String className, String property) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException{
- Object classMetadata = getClassMetadata(className);
- Method getPropertyType = classMetadata.getClass().getMethod("getPropertyType", new Class[] {String.class}); //$NON-NLS-1$
- Object type = getPropertyType.invoke(classMetadata, new Object[] {property});
- return getReturnTypeName(type);
- }
-
- public void setMaxRows(int max) {
- maxRows = max;
- }
-
- public void executeQuery(HibernateOdaQuery query) throws OdaException {
- this.query = query;
- try {
- session = openSession();
- Object q = createQuery(session,queryText);
- Method list = q.getClass().getMethod("list", emptyClassArg); //$NON-NLS-1$
- result = (List) list.invoke(q, emptyObjectArg);
- iterator = result.iterator();
- Method getReturnTypes = q.getClass().getMethod("getReturnTypes", emptyClassArg); //$NON-NLS-1$
- this.queryReturnTypes = (Object[]) getReturnTypes.invoke(q, emptyObjectArg);
- } catch (Exception e) {
- throw new OdaException(e.getLocalizedMessage());
- }
- }
-
- public Iterator getIterator() {
- return iterator;
- }
-
- public List getResult() {
- return result;
- }
-
- public Object getResult(int rstcol) throws OdaException {
- Object obj = this.currentRow;
- Object value = null;
- try {
- if (checkEntityType(queryReturnTypes)) {
- String checkClass = ((HibernateResultSetMetaData) getMetaData())
- .getColumnClass(rstcol);
- Object metadata = getClassMetadata(checkClass);
- if (metadata == null) {
- metadata = getClassMetadata(obj.getClass());
- }
- String className = "org.hibernate.EntityMode"; //$NON-NLS-1$
- Class pojo = Activator.classForName(className, getClass());
- Field pojoField = pojo.getField("POJO"); //$NON-NLS-1$
- Object POJO = pojoField.get(null);
- Class[] parameterTypes = new Class[] {Object.class,String.class, POJO.getClass()};
- Method getPropertyValue = metadata.getClass().getMethod("getPropertyValue", parameterTypes); //$NON-NLS-1$
- Object[] args = new Object[] {obj,getMetaData().getColumnName(rstcol),POJO};
- value = getPropertyValue.invoke(metadata, args);
- } else {
- if (getMetaData().getColumnCount() == 1) {
- value = obj;
- } else {
- Object[] values = (Object[]) obj;
- value = values[rstcol - 1];
- }
- }
- } catch (Exception e) {
- throw new OdaException(e.getLocalizedMessage());
- }
- return (value);
- }
-
- public void next() {
- currentRow = getIterator().next();
- }
-
- private IResultSetMetaData getMetaData() throws OdaException {
- return query.getMetaData();
- }
-}
16 years, 9 months
JBoss Tools SVN: r16660 - in trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui: META-INF and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-07-18 21:55:04 -0400 (Sat, 18 Jul 2009)
New Revision: 16660
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/schema/referenceWizardFragment.exsd
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/JarReferenceWizardFragment.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/NewReferenceRootWizardFragment.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/NewReferenceWizard.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/ProjectReferenceWizardFragment.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/AddModuleDependenciesPropertiesPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/ComponentDependencyContentProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/DependencyPageExtensionManager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/impl/EarModuleDependenciesPropertyPage.java
Log:
Making changes on a saturday, checking out a new look, checking it in to let WTP team have a glance if they choose
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/META-INF/MANIFEST.MF 2009-07-18 22:03:00 UTC (rev 16659)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/META-INF/MANIFEST.MF 2009-07-19 01:55:04 UTC (rev 16660)
@@ -21,6 +21,9 @@
org.eclipse.jem.util;bundle-version="2.0.200",
org.eclipse.jst.jee;bundle-version="1.0.200",
org.eclipse.jdt.ui;bundle-version="3.5.0",
- org.jboss.ide.eclipse.as.wtp.override.core;bundle-version="1.0.0"
+ org.jboss.ide.eclipse.as.wtp.override.core;bundle-version="1.0.0",
+ org.eclipse.wst.server.ui;bundle-version="1.1.102",
+ org.eclipse.wst.server.core;bundle-version="1.1.101",
+ org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.1.300"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/plugin.xml 2009-07-18 22:03:00 UTC (rev 16659)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/plugin.xml 2009-07-19 01:55:04 UTC (rev 16660)
@@ -2,6 +2,7 @@
<?eclipse version="3.4"?>
<plugin>
<extension-point id="moduleDependencyPropertyPage" name="org.jboss.ide.eclipse.as.wtp.override.moduleDependencyPropertyPage" schema="schema/moduleDependencyPropertyPage.exsd"/>
+ <extension-point id="referenceWizardFragment" name="referenceWizardFragment" schema="schema/referenceWizardFragment.exsd"/>
<extension point="org.eclipse.ui.propertyPages">
@@ -28,4 +29,27 @@
id="org.jboss.ide.eclipse.as.wtp.override.ui.earDependencyPage">
</dependencyPage>
</extension>
+ <extension
+ point="org.jboss.ide.eclipse.as.wtp.override.ui.referenceWizardFragment">
+ <referenceFragment
+ class="org.jboss.ide.eclipse.as.wtp.override.ui.propertypage.ProjectReferenceWizardFragment"
+ id="org.jboss.ide.eclipse.as.wtp.override.ui.newProjectReference"
+ name="Project">
+ </referenceFragment>
+ <referenceFragment
+ class="org.jboss.ide.eclipse.as.wtp.override.ui.propertypage.JarReferenceWizardFragment"
+ id="org.jboss.ide.eclipse.as.wtp.override.ui.jarReference"
+ name="Jar">
+ </referenceFragment>
+ <referenceFragment
+ class="org.jboss.ide.eclipse.as.wtp.override.ui.propertypage.ExternalJarReferenceWizardFragment"
+ id="org.jboss.ide.eclipse.as.wtp.override.ui.externalJarReference"
+ name="External Jar">
+ </referenceFragment>
+ <referenceFragment
+ class="org.jboss.ide.eclipse.as.wtp.override.ui.propertypage.VariableReferenceWizardFragment"
+ id="org.jboss.ide.eclipse.as.wtp.override.ui.variableReference"
+ name="Variable">
+ </referenceFragment>
+ </extension>
</plugin>
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/schema/referenceWizardFragment.exsd
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/schema/referenceWizardFragment.exsd (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/schema/referenceWizardFragment.exsd 2009-07-19 01:55:04 UTC (rev 16660)
@@ -0,0 +1,126 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.ide.eclipse.as.wtp.override.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.jboss.ide.eclipse.as.wtp.override.ui" id="referenceWizardFragment" name="referenceWizardFragment"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="referenceFragment"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="referenceFragment">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ The name will be displayed in the UI, inside the viewer
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="icon" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="resource"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.wst.server.ui.wizard.WizardFragment:"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/AddModuleDependenciesPropertiesPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-07-18 22:03:00 UTC (rev 16659)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-07-19 01:55:04 UTC (rev 16660)
@@ -12,15 +12,12 @@
*******************************************************************************/
package org.jboss.ide.eclipse.as.wtp.override.ui.propertypage;
-import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
@@ -33,31 +30,22 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
-import org.eclipse.jst.j2ee.internal.ManifestUIResourceHandler;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.project.facet.IJavaProjectMigrationDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.JavaProjectMigrationDataModelProvider;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
@@ -75,11 +63,8 @@
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
import org.eclipse.wst.common.componentcore.internal.operation.RemoveReferenceComponentsDataModelProvider;
@@ -108,10 +93,7 @@
protected Text componentNameText;
protected Label availableModules;
protected TableViewer availableComponentsViewer;
- protected Button projectButton, removeButton;
- protected Button projectJarButton;
- protected Button externalJarButton;
- protected Button addVariableButton;
+ protected Button referenceButton, removeButton;
protected Composite buttonColumn;
protected static final IStatus OK_STATUS = IDataModelProvider.OK_STATUS;
protected Listener tableListener;
@@ -120,7 +102,7 @@
protected HashMap<IVirtualComponent, String> oldComponentToRuntimePath = new HashMap<IVirtualComponent, String>();
// This should keep a list of all elements currently in the list (not removed)
- protected HashMap<Object, String> objectToRuntimePath = new HashMap<Object, String>();
+ protected HashMap<IVirtualComponent, String> objectToRuntimePath = new HashMap<IVirtualComponent, String>();
/**
* Constructor for AddModulestoEARPropertiesControl.
@@ -144,7 +126,7 @@
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
ModuleAssemblyRootPage.createDescriptionComposite(composite,
- ManifestUIResourceHandler.EAR_Modules_Desc);
+ "TODO Change this: Create and change packaging structure for this project ");
createListGroup(composite);
refresh();
Dialog.applyDialogFont(parent);
@@ -165,8 +147,7 @@
availableModules = new Label(listGroup, SWT.NONE);
gData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_FILL);
- availableModules.setText(J2EEUIMessages
- .getResourceString("AVAILABLE_J2EE_COMPONENTS")); //$NON-NLS-1$ = "Available dependent JARs:"
+ availableModules.setText("Available dependent modules"); //$NON-NLS-1$
availableModules.setLayoutData(gData);
createTableComposite(listGroup);
}
@@ -196,14 +177,9 @@
}
protected void createPushButtons() {
- projectButton = createPushButton(Messages.AddModuleDependenciesPropertiesPage_AddProjectButton);
- projectJarButton = createPushButton(J2EEUIMessages
- .getResourceString(J2EEUIMessages.PROJECT_JAR));
- externalJarButton = createPushButton(J2EEUIMessages
- .getResourceString(J2EEUIMessages.EXTERNAL_JAR));
- addVariableButton = createPushButton(J2EEUIMessages
- .getResourceString(J2EEUIMessages.ADDVARIABLE));
- removeButton = createPushButton(Messages.AddModuleDependenciesPropertiesPage_RemoveSelectedButton);
+ // TODO add the resource button
+ referenceButton = createPushButton("Add Reference...");
+ removeButton = createPushButton("Remove selected...");
}
protected Button createPushButton(String label) {
@@ -411,7 +387,7 @@
public void modify(Object element, String property, Object value) {
if (property.equals(DEPLOY_PATH_PROPERTY)) {
TableItem item = (TableItem) element;
- objectToRuntimePath.put(item.getData(), (String) value);
+ objectToRuntimePath.put((IVirtualComponent)item.getData(), (String) value);
refresh();
}
}
@@ -419,194 +395,133 @@
}
public void handleEvent(Event event) {
- if (event.widget == projectButton)
- handleSelectProjectButton();
- else if (event.widget == projectJarButton)
- handleSelectProjectJarButton();
- else if (event.widget == externalJarButton)
- handleSelectExternalJarButton();
- else if (event.widget == addVariableButton)
- handleSelectVariableButton();
+ if( event.widget == referenceButton)
+ handleAddReferenceButton();
else if( event.widget == removeButton )
handleRemoveSelectedButton();
}
- private void handleSelectProjectButton() {
- SelectProjectDialog d = new SelectProjectDialog(new Shell(),
- getProjectLabelProvider(), getProjectContentProvider());
- if (d.open() == Window.OK) {
- IProject selected = (IProject) d.getFirstResult();
- Object selected2 = ModuleCoreNature.isFlexibleProject(selected) ?
- ComponentCore.createComponent(selected) : selected;
- IPath path = new Path("/"); //$NON-NLS-1$
- path = path.append(selected2 instanceof IVirtualComponent ?
- getVirtualComponentNameWithExtension((IVirtualComponent)selected2) : selected.getName() + ".jar"); //$NON-NLS-1$
- objectToRuntimePath.put(selected2, path.toString());
- refresh();
- TableItem[] items = availableComponentsViewer.getTable().getItems();
- for (int i = 0; i < items.length; i++)
- if (items[i].getData().equals(selected2))
- items[i].setChecked(true);
- }
- }
+// /**
+// * [Bug 238264] Add an archive as a potential new reference for
+// * this.earComponent NOTE1: the given archive will not be added as a
+// * potential reference if there is already a reference to it NOTE2: the
+// * given archive will only be added as an actual reference when
+// * this.performOk is invoked
+// *
+// * @param archive
+// * the archive to add as a potential new reference in
+// * this.earComponent
+// *
+// */
+// private void addPotentialNewReference(IVirtualComponent archive) {
+// // check to see if a reference to the given archive already exists
+// IVirtualReference[] existingRefs = rootComponent.getReferences();
+// IVirtualComponent referencedComponent;
+// boolean refAlreadyExists = false;
+// for (int i = 0; i < existingRefs.length && !refAlreadyExists; i++) {
+// referencedComponent = existingRefs[i].getReferencedComponent();
+// refAlreadyExists = referencedComponent.equals(archive);
+// }
+//
+// // verify it's not already in the list... ugh
+// TableItem[] allItems = availableComponentsViewer.getTable().getItems();
+// for (int i = 0; i < allItems.length; i++) {
+// if (allItems[i].getData().equals(archive)) {
+// allItems[i].setChecked(true);
+// refAlreadyExists = true;
+// }
+// }
+//
+// // only add the archive as a potentialy new reference
+// // if it does not already exist
+// if (!refAlreadyExists) {
+// String name = new Path(archive.getName()).lastSegment();
+// if( archive instanceof VirtualArchiveComponent &&
+// ((VirtualArchiveComponent)archive).getArchiveType()
+// .equals(VirtualArchiveComponent.VARARCHIVETYPE)) {
+// File f = ((VirtualArchiveComponent)archive).getUnderlyingDiskFile();
+// if( f != null )
+// name = new Path(f.getAbsolutePath()).lastSegment();
+// }
+// this.objectToRuntimePath.put(archive, new Path("/").append(name).toString()); //$NON-NLS-1$
+// availableComponentsViewer.add(archive);
+// } else {
+// // TODO should inform user that they selected an already referenced
+// // archive?
+// }
+// }
+//
+// private void handleSelectExternalJarButton() {
+// IPath[] selected = BuildPathDialogAccess
+// .chooseExternalJAREntries(propPage.getShell());
+//
+// if (selected != null) {
+// for (int i = 0; i < selected.length; i++) {
+//
+// String type = VirtualArchiveComponent.LIBARCHIVETYPE
+// + IPath.SEPARATOR;
+// IVirtualComponent archive = ComponentCore
+// .createArchiveComponent(rootComponent.getProject(),
+// type + selected[i].toString());
+//
+// this.addPotentialNewReference(archive);
+// }
+// refresh();
+// }
+//
+// }
+//
+// private void handleSelectVariableButton() {
+// IPath existingPath[] = new Path[0];
+// IPath[] paths = BuildPathDialogAccess.chooseVariableEntries(propPage
+// .getShell(), existingPath);
+//
+// if (paths != null) {
+// refresh();
+// for (int i = 0; i < paths.length; i++) {
+// IPath resolvedPath = JavaCore.getResolvedVariablePath(paths[i]);
+//
+// java.io.File file = new java.io.File(resolvedPath.toOSString());
+// if (file.isFile() && file.exists()) {
+// String type = VirtualArchiveComponent.VARARCHIVETYPE
+// + IPath.SEPARATOR;
+//
+// IVirtualComponent archive = ComponentCore
+// .createArchiveComponent(rootComponent.getProject(),
+// type + paths[i].toString());
+//
+// this.addPotentialNewReference(archive);
+// } else {
+// // display error
+// }
+// }
+// refresh();
+// }
+// }
- protected class SelectProjectDialog extends ElementTreeSelectionDialog {
- public SelectProjectDialog(Shell parent, ILabelProvider labelProvider,
- ITreeContentProvider contentProvider) {
- super(parent, labelProvider, contentProvider);
- setAllowMultiple(false);
- setTitle(Messages.AddModuleDependenciesPropertiesPage_SelectAProjectTitle);
- setInput(ResourcesPlugin.getWorkspace());
- }
- }
-
- protected ILabelProvider getProjectLabelProvider() {
- return new LabelProvider() {
- public Image getImage(Object element) {
- if (element instanceof IProject)
- return PlatformUI.getWorkbench().getSharedImages()
- .getImage(ISharedImages.IMG_OBJ_PROJECT);
- return null;
+ protected void handleAddReferenceButton() {
+ NewReferenceWizard wizard = new NewReferenceWizard();
+ // fill the task model
+ wizard.getTaskModel().putObject(NewReferenceWizard.PROJECT, project);
+ wizard.getTaskModel().putObject(NewReferenceWizard.ROOT_COMPONENT, rootComponent);
+
+ WizardDialog wd = new WizardDialog(referenceButton.getShell(), wizard);
+ if( wd.open() != Window.CANCEL) {
+ Object c1 = wizard.getTaskModel().getObject(NewReferenceWizard.COMPONENT);
+ Object p1 = wizard.getTaskModel().getObject(NewReferenceWizard.COMPONENT_PATH);
+ IVirtualComponent[] compArr = c1 instanceof IVirtualComponent ?
+ new IVirtualComponent[] { (IVirtualComponent)c1 } :
+ (IVirtualComponent[])c1;
+ String[] pathArr = p1 instanceof String ?
+ new String[] { (String)p1 } :
+ (String[])p1;
+ for( int i = 0; i < compArr.length; i++ ) {
+ objectToRuntimePath.put(compArr[i], pathArr[i]);
}
-
- public String getText(Object element) {
- if (element instanceof IProject)
- return ((IProject) element).getName();
- return element == null ? "" : element.toString();//$NON-NLS-1$
- }
- };
- }
-
- protected ITreeContentProvider getProjectContentProvider() {
- return new ITreeContentProvider() {
- public Object[] getElements(Object inputElement) {
- return ResourcesPlugin.getWorkspace().getRoot().getProjects();
- }
-
- public Object[] getChildren(Object parentElement) {
- return null;
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return false;
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput,
- Object newInput) {
- }
-
- };
- }
-
- protected IProject[] filterAddProjectList(IProject[] list) {
- return list;
- }
-
- /**
- * [Bug 238264] Add an archive as a potential new reference for
- * this.earComponent NOTE1: the given archive will not be added as a
- * potential reference if there is already a reference to it NOTE2: the
- * given archive will only be added as an actual reference when
- * this.performOk is invoked
- *
- * @param archive
- * the archive to add as a potential new reference in
- * this.earComponent
- *
- */
- private void addPotentialNewReference(IVirtualComponent archive) {
- // check to see if a reference to the given archive already exists
- IVirtualReference[] existingRefs = rootComponent.getReferences();
- IVirtualComponent referencedComponent;
- boolean refAlreadyExists = false;
- for (int i = 0; i < existingRefs.length && !refAlreadyExists; i++) {
- referencedComponent = existingRefs[i].getReferencedComponent();
- refAlreadyExists = referencedComponent.equals(archive);
- }
-
- // verify it's not already in the list... ugh
- TableItem[] allItems = availableComponentsViewer.getTable().getItems();
- for (int i = 0; i < allItems.length; i++) {
- if (allItems[i].getData().equals(archive)) {
- allItems[i].setChecked(true);
- refAlreadyExists = true;
- }
- }
-
- // only add the archive as a potentialy new reference
- // if it does not already exist
- if (!refAlreadyExists) {
- String name = new Path(archive.getName()).lastSegment();
- if( archive instanceof VirtualArchiveComponent &&
- ((VirtualArchiveComponent)archive).getArchiveType()
- .equals(VirtualArchiveComponent.VARARCHIVETYPE)) {
- File f = ((VirtualArchiveComponent)archive).getUnderlyingDiskFile();
- if( f != null )
- name = new Path(f.getAbsolutePath()).lastSegment();
- }
- this.objectToRuntimePath.put(archive, new Path("/").append(name).toString()); //$NON-NLS-1$
- availableComponentsViewer.add(archive);
- } else {
- // TODO should inform user that they selected an already referenced
- // archive?
- }
- }
-
- private void handleSelectExternalJarButton() {
- IPath[] selected = BuildPathDialogAccess
- .chooseExternalJAREntries(propPage.getShell());
-
- if (selected != null) {
- for (int i = 0; i < selected.length; i++) {
-
- String type = VirtualArchiveComponent.LIBARCHIVETYPE
- + IPath.SEPARATOR;
- IVirtualComponent archive = ComponentCore
- .createArchiveComponent(rootComponent.getProject(),
- type + selected[i].toString());
-
- this.addPotentialNewReference(archive);
- }
refresh();
}
-
}
-
- private void handleSelectVariableButton() {
- IPath existingPath[] = new Path[0];
- IPath[] paths = BuildPathDialogAccess.chooseVariableEntries(propPage
- .getShell(), existingPath);
-
- if (paths != null) {
- refresh();
- for (int i = 0; i < paths.length; i++) {
- IPath resolvedPath = JavaCore.getResolvedVariablePath(paths[i]);
-
- java.io.File file = new java.io.File(resolvedPath.toOSString());
- if (file.isFile() && file.exists()) {
- String type = VirtualArchiveComponent.VARARCHIVETYPE
- + IPath.SEPARATOR;
-
- IVirtualComponent archive = ComponentCore
- .createArchiveComponent(rootComponent.getProject(),
- type + paths[i].toString());
-
- this.addPotentialNewReference(archive);
- } else {
- // display error
- }
- }
- refresh();
- }
- }
-
+
protected void handleRemoveSelectedButton() {
ISelection sel = availableComponentsViewer.getSelection();
if( sel instanceof IStructuredSelection ) {
@@ -654,26 +569,6 @@
}
}
- private void handleSelectProjectJarButton() {
- IPath[] selected = BuildPathDialogAccess.chooseJAREntries(propPage
- .getShell(), project.getLocation(), new IPath[0]);
-
- if (selected != null) {
- for (int i = 0; i < selected.length; i++) {
- // IPath fullPath = project.getFile(selected[i]).getFullPath();
- String type = VirtualArchiveComponent.LIBARCHIVETYPE
- + IPath.SEPARATOR;
- IVirtualComponent archive = ComponentCore
- .createArchiveComponent(rootComponent.getProject(),
- type + selected[i].makeRelative().toString());
-
- this.addPotentialNewReference(archive);
- }
- refresh();
- }
-
- }
-
/**
* This should only be called on changes, such as adding a project
* reference, adding a lib reference etc.
@@ -709,7 +604,6 @@
IVirtualComponent comp;
for( int i = 0; i < refs.length; i++ ) {
comp = refs[i].getReferencedComponent();
- String archiveName = refs[i].getArchiveName();
String val = refs[i].getRuntimePath().append(refs[i].getArchiveName()).toString();
objectToRuntimePath.put(comp, val);
oldComponentToRuntimePath.put((IVirtualComponent) comp, val);
@@ -760,17 +654,17 @@
public boolean performOk() {
// grab what's checked
- ArrayList<Object> checked = new ArrayList<Object>();
+ ArrayList<IVirtualComponent> checked = new ArrayList<IVirtualComponent>();
TableItem[] items = availableComponentsViewer.getTable().getItems();
for (int i = 0; i < items.length; i++)
- checked.add(items[i].getData());
+ checked.add((IVirtualComponent)items[i].getData());
// Fill our delta lists
- ArrayList<Object> added = new ArrayList<Object>();
+ ArrayList<IVirtualComponent> added = new ArrayList<IVirtualComponent>();
ArrayList<IVirtualComponent> removed = new ArrayList<IVirtualComponent>();
ArrayList<IVirtualComponent> changed = new ArrayList<IVirtualComponent>();
- Iterator j = oldComponentToRuntimePath.keySet().iterator();
+ Iterator<IVirtualComponent> j = oldComponentToRuntimePath.keySet().iterator();
Object key, val;
while (j.hasNext()) {
key = j.next();
@@ -785,7 +679,7 @@
while (j.hasNext()) {
key = j.next();
if (!oldComponentToRuntimePath.containsKey(key))
- added.add(key);
+ added.add((IVirtualComponent)key);
}
NullProgressMonitor monitor = new NullProgressMonitor();
@@ -798,18 +692,12 @@
// Now update the variables
oldComponentToRuntimePath.clear();
- ArrayList keys = new ArrayList();
+ ArrayList<IVirtualComponent> keys = new ArrayList<IVirtualComponent>();
keys.addAll(objectToRuntimePath.keySet());
- Iterator i = keys.iterator();
+ Iterator<IVirtualComponent> i = keys.iterator();
while(i.hasNext()) {
- Object component = i.next();
- IVirtualComponent vc = component instanceof IVirtualComponent ? (IVirtualComponent)component : null;
- String path = objectToRuntimePath.get(component);
- if( component instanceof IProject ) {
- objectToRuntimePath.remove(component);
- vc = ComponentCore.createComponent((IProject)component);
- objectToRuntimePath.put(vc, path);
- }
+ IVirtualComponent vc = i.next();
+ String path = objectToRuntimePath.get(vc);
oldComponentToRuntimePath.put(vc, path);
}
return subResult;
@@ -817,9 +705,9 @@
// Subclass can override if it has a good way to handle changed elements
protected void handleDeltas(ArrayList<IVirtualComponent> removed,
- ArrayList<IVirtualComponent> changed, ArrayList<Object> added) {
+ ArrayList<IVirtualComponent> changed, ArrayList<IVirtualComponent> added) {
ArrayList<IVirtualComponent> removed2 = new ArrayList<IVirtualComponent>();
- ArrayList<Object> added2 = new ArrayList<Object>();
+ ArrayList<IVirtualComponent> added2 = new ArrayList<IVirtualComponent>();
removed2.addAll(removed);
removed2.addAll(changed);
added2.addAll(added);
@@ -852,11 +740,11 @@
IDataModelProvider provider = getRemoveReferenceDataModelProvider(component);
IDataModel model = DataModelFactory.createDataModel(provider);
model.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, rootComponent);
- List modHandlesList = (List) model.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+ List<IVirtualComponent> modHandlesList = (List<IVirtualComponent>) model.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
modHandlesList.add(component);
model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modHandlesList);
model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, path);
- Map uriMap = new HashMap();
+ Map<IVirtualComponent, String> uriMap = new HashMap<IVirtualComponent, String>();
uriMap.put(component, archiveName);
model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, uriMap);
return model.getDefaultOperation();
@@ -880,24 +768,17 @@
}
}
- protected void handleAdded(ArrayList<Object> added) {
- final ArrayList<IProject> projects = new ArrayList<IProject>();
+ protected void handleAdded(ArrayList<IVirtualComponent> added) {
final ArrayList<IVirtualComponent> components = new ArrayList<IVirtualComponent>();
- Iterator i = added.iterator();
- Object o;
+ Iterator<IVirtualComponent> i = added.iterator();
+ IVirtualComponent o;
while(i.hasNext()) {
o = i.next();
- if( o instanceof IProject && !ModuleCoreNature.isFlexibleProject((IProject)o))
- projects.add((IProject)o);
- else if( o instanceof IProject )
- components.add(ComponentCore.createComponent(((IProject)o)));
- else if( o instanceof IVirtualComponent)
- components.add((IVirtualComponent)o);
+ components.add((IVirtualComponent)o);
}
IWorkspaceRunnable runnable = new IWorkspaceRunnable(){
public void run(IProgressMonitor monitor) throws CoreException{
- addProjects(projects);
addComponents(components);
}
};
@@ -907,49 +788,7 @@
J2EEUIPlugin.logError(e);
}
}
-
- protected void addProjects(ArrayList<IProject> projects) throws CoreException {
- // These projects need to be converted to utility projects first
- Iterator<IProject> i = projects.iterator();
- IProject proj;
- Set moduleProjects = new HashSet();
- String path, archiveName;
- while(i.hasNext()) {
- proj = i.next();
- path = new Path(objectToRuntimePath.get(proj)).removeLastSegments(1).toString();
- archiveName = new Path(objectToRuntimePath.get(proj)).lastSegment();
- try {
- moduleProjects.add(proj);
- IDataModel migrationdm = DataModelFactory.createDataModel(new JavaProjectMigrationDataModelProvider());
- migrationdm.setProperty(IJavaProjectMigrationDataModelProperties.PROJECT_NAME, proj.getName());
- migrationdm.getDefaultOperation().execute(new NullProgressMonitor(), null);
-
-
- IDataModel refdm = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider());
- List targetCompList = (List) refdm.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
-
- IVirtualComponent targetcomponent = ComponentCore.createComponent(proj);
- targetCompList.add(targetcomponent);
-
- refdm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, rootComponent);
- refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, targetCompList);
- refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, path);
-
- Map uriMap = new HashMap();
- uriMap.put(targetcomponent, archiveName);
- refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, uriMap);
-
- refdm.getDefaultOperation().execute(new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- J2EEUIPlugin.logError(e);
- }
- }
- postAddProjects(moduleProjects);
- }
- protected void postAddProjects(Set moduleProjects) throws CoreException {
- }
-
protected void addComponents(ArrayList<IVirtualComponent> components) throws CoreException {
Iterator<IVirtualComponent> i = components.iterator();
while(i.hasNext()) {
@@ -973,7 +812,7 @@
dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, Arrays.asList(component));
//[Bug 238264] the uri map needs to be manually set correctly
- Map uriMap = new HashMap();
+ Map<IVirtualComponent, String> uriMap = new HashMap<IVirtualComponent, String>();
uriMap.put(component, archiveName);
dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, uriMap);
dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, path);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/ComponentDependencyContentProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/ComponentDependencyContentProvider.java 2009-07-18 22:03:00 UTC (rev 16659)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/ComponentDependencyContentProvider.java 2009-07-19 01:55:04 UTC (rev 16660)
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.jboss.ide.eclipse.as.wtp.override.ui.propertypage;
-import java.io.File;
import java.util.HashMap;
import org.eclipse.core.resources.IProject;
@@ -39,13 +38,13 @@
final static String PATH_SEPARATOR = String.valueOf(IPath.SEPARATOR);
- private HashMap<Object, String> runtimePaths;
+ private HashMap<IVirtualComponent, String> runtimePaths;
public ComponentDependencyContentProvider() {
super();
}
- public void setRuntimePaths(HashMap<Object, String> paths) {
+ public void setRuntimePaths(HashMap<IVirtualComponent, String> paths) {
this.runtimePaths = paths;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/DependencyPageExtensionManager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/DependencyPageExtensionManager.java 2009-07-18 22:03:00 UTC (rev 16659)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/DependencyPageExtensionManager.java 2009-07-19 01:55:04 UTC (rev 16660)
@@ -1,5 +1,6 @@
package org.jboss.ide.eclipse.as.wtp.override.ui.propertypage;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -7,7 +8,9 @@
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
import org.jboss.ide.eclipse.as.wtp.override.ui.WTPOveridePlugin;
public class DependencyPageExtensionManager {
@@ -47,4 +50,48 @@
providers = temp;
}
+ public WizardFragment loadReferenceWizardFragment(String id) {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] cf = registry.getConfigurationElementsFor(
+ WTPOveridePlugin.PLUGIN_ID, "referenceWizardFragment"); //$NON-NLS-1$
+ for( int i = 0; i < cf.length; i++ ) {
+ if( cf[i].getAttribute("id").equals(id))
+ try {
+ return (WizardFragment)cf[i].createExecutableExtension("class");
+ } catch( CoreException ce) {}
+ }
+ return null;
+ }
+
+ public ReferenceExtension[] getReferenceExtensions() {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] cf = registry.getConfigurationElementsFor(
+ WTPOveridePlugin.PLUGIN_ID, "referenceWizardFragment"); //$NON-NLS-1$
+ ArrayList<ReferenceExtension> list = new ArrayList<ReferenceExtension>();
+ for( int i = 0; i < cf.length; i++ ) {
+ list.add(new ReferenceExtension(cf[i]));
+ }
+ return (ReferenceExtension[]) list
+ .toArray(new ReferenceExtension[list.size()]);
+ }
+
+ public class ReferenceExtension {
+ private String id, name, imageLoc;
+ private Image image;
+ public ReferenceExtension(IConfigurationElement element) {
+ this.id = element.getAttribute("id");
+ this.name = element.getAttribute("name");
+ this.imageLoc = element.getAttribute("icon");
+ }
+ public String getId() { return this.id;}
+ public String getName() { return this.name; }
+ public Image getImage() {
+ return null;
+ }
+ public void dispose() {
+ if( image != null ) {
+ image.dispose();
+ }
+ }
+ }
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/JarReferenceWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/JarReferenceWizardFragment.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/JarReferenceWizardFragment.java 2009-07-19 01:55:04 UTC (rev 16660)
@@ -0,0 +1,161 @@
+package org.jboss.ide.eclipse.as.wtp.override.ui.propertypage;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jst.j2ee.project.facet.IJavaProjectMigrationDataModelProperties;
+import org.eclipse.jst.j2ee.project.facet.JavaProjectMigrationDataModelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+import org.jboss.ide.eclipse.as.wtp.override.core.vcf.ComponentUtils;
+
+public class JarReferenceWizardFragment extends WizardFragment {
+ private LabelProvider labelProvider = null;
+ private ITreeContentProvider contentProvider = null;
+ private TreeViewer viewer;
+ private Button browse;
+ private IPath[] paths;
+ private IWizardHandle handle;
+ private IPath[] selected = new IPath[]{};
+ public boolean hasComposite() {
+ return true;
+ }
+
+ public Composite createComposite(Composite parent, IWizardHandle handle) {
+ this.handle = handle;
+ handle.setTitle("Add a Jar Reference");
+ handle.setDescription("Here you can reference a workspace Jar\n"
+ + "This is not a suggested use-case, but is here for backwards compatability.");
+
+ Composite c = new Composite(parent, SWT.NONE);
+ c.setLayout(new FormLayout());
+ viewer = new TreeViewer(c, SWT.SINGLE | SWT.BORDER);
+ viewer.setContentProvider(getContentProvider());
+ viewer.setLabelProvider(getLabelProvider());
+ viewer.setInput(ResourcesPlugin.getWorkspace());
+
+ browse = new Button(c, SWT.NONE);
+ browse.setText("Browse...");
+ FormData fd = new FormData();
+ fd.left = new FormAttachment(0, 5);
+ fd.bottom = new FormAttachment(100, -5);
+ browse.setLayoutData(fd);
+
+ fd = new FormData();
+ fd.left = new FormAttachment(0, 5);
+ fd.top = new FormAttachment(0, 5);
+ fd.right = new FormAttachment(100, -5);
+ fd.bottom = new FormAttachment(browse, -5);
+ viewer.getTree().setLayoutData(fd);
+
+ browse.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ buttonPressed();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+ return c;
+ }
+
+ private void buttonPressed() {
+ IProject project = (IProject)getTaskModel().getObject(NewReferenceWizard.PROJECT);
+ selected = BuildPathDialogAccess.chooseJAREntries(
+ browse.getShell(),
+ project.getLocation(), new IPath[0]);
+ viewer.refresh();
+ }
+
+ public void performFinish(IProgressMonitor monitor) throws CoreException {
+ IVirtualComponent rootComponent = (IVirtualComponent)getTaskModel().getObject(NewReferenceWizard.ROOT_COMPONENT);
+ if (selected != null && selected.length > 0) {
+ ArrayList<IVirtualComponent> compList = new ArrayList<IVirtualComponent>();
+ ArrayList<String> paths = new ArrayList<String>();
+ for (int i = 0; i < selected.length; i++) {
+ // IPath fullPath = project.getFile(selected[i]).getFullPath();
+ String type = VirtualArchiveComponent.LIBARCHIVETYPE
+ + IPath.SEPARATOR;
+ IVirtualComponent archive = ComponentCore
+ .createArchiveComponent(rootComponent.getProject(),
+ type + selected[i].makeRelative().toString());
+ compList.add(archive);
+ paths.add(selected[i].lastSegment());
+ }
+ IVirtualComponent[] components = (IVirtualComponent[]) compList.toArray(new IVirtualComponent[compList.size()]);
+ String[] paths2 = (String[]) paths.toArray(new String[paths.size()]);
+ getTaskModel().putObject(NewReferenceWizard.COMPONENT, components);
+ getTaskModel().putObject(NewReferenceWizard.COMPONENT_PATH, paths2);
+ }
+ }
+
+ protected LabelProvider getLabelProvider() {
+ if (labelProvider == null) {
+ labelProvider = new LabelProvider() {
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ public String getText(Object element) {
+ return element == null ? "" : element.toString();//$NON-NLS-1$
+ }
+ };
+ }
+ return labelProvider;
+ }
+
+ protected ITreeContentProvider getContentProvider() {
+ if (contentProvider == null) {
+ contentProvider = new ITreeContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ return selected == null ? new Object[]{} : selected;
+ }
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ public void dispose() {
+ }
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+ public Object getParent(Object element) {
+ return null;
+ }
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+ };
+ }
+ return contentProvider;
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/NewReferenceRootWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/NewReferenceRootWizardFragment.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/NewReferenceRootWizardFragment.java 2009-07-19 01:55:04 UTC (rev 16660)
@@ -0,0 +1,138 @@
+package org.jboss.ide.eclipse.as.wtp.override.ui.propertypage;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+import org.jboss.ide.eclipse.as.wtp.override.ui.propertypage.DependencyPageExtensionManager.ReferenceExtension;
+
+public class NewReferenceRootWizardFragment extends WizardFragment {
+ protected Map<String, WizardFragment> fragmentMap =
+ new HashMap<String, WizardFragment>();
+ private IWizardHandle wizard;
+ private TreeViewer viewer;
+ public boolean hasComposite() {
+ return true;
+ }
+
+ public Composite createComposite(Composite parent, IWizardHandle wizard) {
+ this.wizard = wizard;
+ wizard.setTitle("Select a reference type");
+ wizard.setDescription("Here you can select one of many types of references to add");
+ Composite c = new Composite(parent, SWT.NONE);
+ c.setLayout(new FillLayout());
+ viewer = new TreeViewer(c, SWT.SINGLE | SWT.BORDER);
+ viewer.setLabelProvider(getLabelProvider());
+ viewer.setContentProvider(getContentProvider());
+ viewer.setInput(ResourcesPlugin.getWorkspace());
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ viewerSelectionChanged();
+ }
+ });
+ return c;
+ }
+
+ protected void viewerSelectionChanged() {
+ wizard.update();
+ }
+
+ protected WizardFragment getWizardFragment(String extensionPointID) {
+ try {
+ WizardFragment fragment = fragmentMap.get(extensionPointID);
+ if (fragment != null)
+ return fragment;
+ } catch (Exception e) {
+ // ignore
+ }
+
+ WizardFragment fragment = DependencyPageExtensionManager.getManager().loadReferenceWizardFragment(extensionPointID);
+ if (fragment != null)
+ fragmentMap.put(extensionPointID, fragment);
+ return fragment;
+ }
+
+ public List getChildFragments() {
+ List<WizardFragment> listImpl = new ArrayList<WizardFragment>();
+ createChildFragments(listImpl);
+ return listImpl;
+ }
+
+ protected void createChildFragments(List<WizardFragment> list) {
+ // Instantiate and add the fragment for the current ID
+ if( viewer != null ) {
+ IStructuredSelection sel = (IStructuredSelection)viewer.getSelection();
+ ReferenceExtension selected = (ReferenceExtension)sel.getFirstElement();
+ if( selected != null ) {
+ WizardFragment child = getWizardFragment(selected.getId());
+ if( child != null )
+ list.add(child);
+ }
+ }
+ }
+
+ public boolean isComplete() {
+ return true;
+ }
+
+
+ private LabelProvider labelProvider = null;
+ private ITreeContentProvider contentProvider = null;
+ protected LabelProvider getLabelProvider() {
+ if( labelProvider == null ) {
+ labelProvider = new LabelProvider() {
+ public Image getImage(Object element) {
+ return null;
+ }
+ public String getText(Object element) {
+ if( element instanceof ReferenceExtension)
+ return ((ReferenceExtension)element).getName();
+ return element == null ? "" : element.toString();//$NON-NLS-1$
+ }
+ };
+ }
+ return labelProvider;
+ }
+
+ private ReferenceExtension[] extensions = null;
+ protected ITreeContentProvider getContentProvider() {
+ if( contentProvider == null ) {
+ contentProvider = new ITreeContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ if( extensions == null )
+ extensions = DependencyPageExtensionManager.getManager().getReferenceExtensions();
+ return extensions;
+ }
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ public void dispose() {
+ }
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+ public Object getParent(Object element) {
+ return null;
+ }
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+ };
+ }
+ return contentProvider;
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/NewReferenceWizard.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/NewReferenceWizard.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/NewReferenceWizard.java 2009-07-19 01:55:04 UTC (rev 16660)
@@ -0,0 +1,28 @@
+package org.jboss.ide.eclipse.as.wtp.override.ui.propertypage;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.wst.server.ui.internal.wizard.TaskWizard;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+
+public class NewReferenceWizard extends TaskWizard {
+
+ public static final String COMPONENT = "dependency.component";
+ public static final String COMPONENT_PATH = "dependency.component.path";
+ public static final String PROJECT = "root.project";
+ public static final String ROOT_COMPONENT = "root.component";
+
+ public NewReferenceWizard() {
+ super("New Reference Wizard", new WizardFragment() {
+ protected void createChildFragments(List<WizardFragment> list) {
+ list.add(new NewReferenceRootWizardFragment());
+ }
+ });
+ }
+
+ public void init(IWorkbench newWorkbench, IStructuredSelection newSelection) {
+ // do nothing
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/ProjectReferenceWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/ProjectReferenceWizardFragment.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/ProjectReferenceWizardFragment.java 2009-07-19 01:55:04 UTC (rev 16660)
@@ -0,0 +1,142 @@
+package org.jboss.ide.eclipse.as.wtp.override.ui.propertypage;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jst.j2ee.project.facet.IJavaProjectMigrationDataModelProperties;
+import org.eclipse.jst.j2ee.project.facet.JavaProjectMigrationDataModelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+import org.jboss.ide.eclipse.as.wtp.override.core.vcf.ComponentUtils;
+
+public class ProjectReferenceWizardFragment extends WizardFragment {
+ private LabelProvider labelProvider = null;
+ private ITreeContentProvider contentProvider = null;
+ private TreeViewer viewer;
+ private IProject selected;
+
+ public boolean hasComposite() {
+ return true;
+ }
+
+ public Composite createComposite(Composite parent, IWizardHandle handle) {
+ handle.setTitle("Add a Project Reference");
+ handle.setDescription("Here you can make a project into a reference.\n" +
+ "If the project is not already a flexible project, it will be converted into one.");
+
+ Composite c = new Composite(parent, SWT.NONE);
+ c.setLayout(new FillLayout());
+ viewer = new TreeViewer(c, SWT.SINGLE | SWT.BORDER);
+ viewer.setContentProvider(getContentProvider());
+ viewer.setLabelProvider(getLabelProvider());
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ selChanged();
+ }
+ });
+ viewer.setInput(ResourcesPlugin.getWorkspace());
+ return c;
+ }
+
+ private void selChanged() {
+ if( viewer != null ) {
+ IStructuredSelection sel = (IStructuredSelection)viewer.getSelection();
+ if( sel != null )
+ selected = (IProject)sel.getFirstElement();
+ }
+ }
+
+ public void performFinish(IProgressMonitor monitor) throws CoreException {
+ if( !ModuleCoreNature.isFlexibleProject(selected)) {
+ try {
+ IDataModel migrationdm = DataModelFactory.createDataModel(new JavaProjectMigrationDataModelProvider());
+ migrationdm.setProperty(IJavaProjectMigrationDataModelProperties.PROJECT_NAME, selected.getName());
+ migrationdm.getDefaultOperation().execute(new NullProgressMonitor(), null);
+ } catch( ExecutionException ee) {
+ // TODO something
+ }
+ }
+ IVirtualComponent comp = ComponentCore.createComponent(selected);
+ String path = selected.getName();
+ String extension = ComponentUtils.getDefaultProjectExtension(comp);
+ path += extension;
+
+ getTaskModel().putObject(NewReferenceWizard.COMPONENT, comp);
+ getTaskModel().putObject(NewReferenceWizard.COMPONENT_PATH, path);
+ }
+
+
+ protected LabelProvider getLabelProvider() {
+ if( labelProvider == null ) {
+ labelProvider = new LabelProvider() {
+ public Image getImage(Object element) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_PROJECT);
+ }
+ public String getText(Object element) {
+ if( element instanceof IProject )
+ return ((IProject)element).getName();
+ return element == null ? "" : element.toString();//$NON-NLS-1$
+ }
+ };
+ }
+ return labelProvider;
+ }
+
+ protected ITreeContentProvider getContentProvider() {
+ if( contentProvider == null ) {
+ contentProvider = new ITreeContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ ArrayList<IProject> list = new ArrayList<IProject>(Arrays.asList(projects));
+ Iterator<IProject> i = list.iterator();
+ IProject p;
+ while(i.hasNext()) {
+ p = i.next();
+ if( !p.isOpen())
+ i.remove();
+ }
+ return (IProject[]) list.toArray(new IProject[list.size()]);
+ }
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ public void dispose() {
+ }
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+ public Object getParent(Object element) {
+ return null;
+ }
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+ };
+ }
+ return contentProvider;
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/impl/EarModuleDependenciesPropertyPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/impl/EarModuleDependenciesPropertyPage.java 2009-07-18 22:03:00 UTC (rev 16659)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/impl/EarModuleDependenciesPropertyPage.java 2009-07-19 01:55:04 UTC (rev 16660)
@@ -188,9 +188,9 @@
return new RemoveComponentFromEnterpriseApplicationDataModelProvider();
}
- protected void postAddProjects(Set moduleProjects) throws CoreException {
- EarFacetRuntimeHandler.updateModuleProjectRuntime(rootComponent.getProject(), moduleProjects, new NullProgressMonitor());
- }
+// protected void postAddProjects(Set moduleProjects) throws CoreException {
+// EarFacetRuntimeHandler.updateModuleProjectRuntime(rootComponent.getProject(), moduleProjects, new NullProgressMonitor());
+// }
protected IDataModelProvider getAddReferenceDataModelProvider(IVirtualComponent component) {
return new AddComponentToEnterpriseApplicationDataModelProvider();
16 years, 9 months
JBoss Tools SVN: r16659 - in trunk/seam/plugins/org.jboss.tools.seam.core: templates/ear/EarContent/META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2009-07-18 18:03:00 -0400 (Sat, 18 Jul 2009)
New Revision: 16659
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear-seam2/EarContent/META-INF/application.xml
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4166 Seam Web EAR project using Seam 2.1.1.GA does not work on JBoss AS 4.2.3
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2009-07-18 22:02:34 UTC (rev 16658)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2009-07-18 22:03:00 UTC (rev 16659)
@@ -21,14 +21,30 @@
import org.apache.tools.ant.types.FilterSet;
import org.apache.tools.ant.types.FilterSetCollection;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
/**
* @author Alexey Kazakov
@@ -36,6 +52,9 @@
*/
public class Seam2ProjectCreator extends SeamProjectCreator {
+ private static final String STRICT = "strict";
+ private static final String MODULE_ORDER = "module-order";
+
// test/*.jar are duplicated here since the filtering seem to be assymetric when matching
private static AntCopyUtils.FileSet JBOSS_TEST_LIB_FILESET = new AntCopyUtils.FileSet()
.include("testng\\.jar") //$NON-NLS-1$
@@ -204,6 +223,75 @@
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "security.drl"), new File(ejbProjectFolder, "ejbModule/"), true); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Override
+ protected void configureJBossAppXml() {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(earProjectName);
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualFolder folder = component.getRootFolder();
+ IFolder rootFolder = (IFolder) folder.getUnderlyingFolder();
+ IResource jbossAppXml = rootFolder.findMember("META-INF/jboss-app.xml");
+ if(jbossAppXml==null || !(jbossAppXml instanceof IFile) || !jbossAppXml.exists()) {
+ return;
+ }
+
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if(manager == null) {
+ return;
+ }
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForEdit((IFile)jbossAppXml);
+ if (model instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) model;
+ IDOMDocument document = domModel.getDocument();
+ Element root = document.getDocumentElement();
+ if(root==null) {
+ return;
+ }
+ NodeList children = root.getChildNodes();
+ boolean strictAdded = false;
+ Node firstChild = null;
+ for(int i=0; i<children.getLength(); i++) {
+ Node currentNode = children.item(i);
+ if(Node.ELEMENT_NODE == currentNode.getNodeType() && firstChild == null) {
+ firstChild = currentNode;
+ }
+ if(Node.ELEMENT_NODE == currentNode.getNodeType() && MODULE_ORDER.equals(currentNode.getNodeName())) {
+ setValue(document,currentNode,STRICT);
+ strictAdded = true;
+ }
+ }
+ if (!strictAdded) {
+ Element moduleOrder = document.createElement(MODULE_ORDER);
+ setValue(document,moduleOrder,STRICT);
+ if (firstChild != null) {
+ root.insertBefore(moduleOrder, firstChild);
+ } else {
+ root.appendChild(moduleOrder);
+ }
+ }
+ model.save();
+ }
+ } catch (CoreException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ } catch (IOException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ } finally {
+ if (model != null) {
+ model.releaseFromEdit();
+ }
+ }
+ try {
+ new FormatProcessorXML().formatFile((IFile) jbossAppXml);
+ } catch (Exception ignore) {
+ }
+ }
+
+ private void setValue(Document document, Node node, String value) {
+ Text text = document.createTextNode(value);
+ node.appendChild(text);
+ }
+
protected AntCopyUtils.FileSet getJBossTestLibFileset() {
return JBOSS_TEST_LIB_FILESET;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2009-07-18 22:02:34 UTC (rev 16658)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2009-07-18 22:03:00 UTC (rev 16659)
@@ -270,6 +270,9 @@
WtpUtils.reconfigure(ejbProjectToBeImported,monitor);
IProject earProjectToBeImported = wsRoot.getProject(earProjectName);
ResourcesUtils.importExistingProject(earProjectToBeImported, wsPath + "/" + earProjectName, earProjectName, monitor, false);
+
+ configureJBossAppXml();
+
WtpUtils.reconfigure(earProjectToBeImported, monitor);
}
@@ -501,4 +504,8 @@
SeamCorePlugin.getPluginLog().logError(e);
}
}
+
+ protected void configureJBossAppXml() {
+ // Do nothing special for Seam 1.2
+ }
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml 2009-07-18 22:02:34 UTC (rev 16658)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml 2009-07-18 22:03:00 UTC (rev 16659)
@@ -6,7 +6,12 @@
<display-name>@projectName@-ear</display-name>
+ <!-- JBIDE-4166 Workaround - Make sure we deploy this first, since this is referenced in xxx-ejb.jar-->
<module>
+ <ejb>jboss-seam.jar</ejb>
+ </module>
+
+ <module>
<web>
<web-uri>@projectName@.war</web-uri>
<context-root>/@projectName@</context-root>
@@ -17,8 +22,4 @@
<ejb>@projectName(a)-ejb.jar</ejb>
</module>
- <module>
- <ejb>jboss-seam.jar</ejb>
- </module>
-
</application>
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear-seam2/EarContent/META-INF/application.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear-seam2/EarContent/META-INF/application.xml 2009-07-18 22:02:34 UTC (rev 16658)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear-seam2/EarContent/META-INF/application.xml 2009-07-18 22:03:00 UTC (rev 16659)
@@ -6,7 +6,12 @@
<display-name>@projectName@-ear</display-name>
+ <!-- JBIDE-4166 Workaround - Make sure we deploy this first, since this is referenced in xxx-ejb.jar-->
<module>
+ <ejb>jboss-seam.jar</ejb>
+ </module>
+
+ <module>
<web>
<web-uri>@projectName@.war</web-uri>
<context-root>/@projectName@</context-root>
@@ -17,8 +22,4 @@
<ejb>@projectName(a)-ejb.jar</ejb>
</module>
- <module>
- <ejb>jboss-seam.jar</ejb>
- </module>
-
</application>
16 years, 9 months
JBoss Tools SVN: r16658 - in branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core: templates/ear/EarContent/META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2009-07-18 18:02:34 -0400 (Sat, 18 Jul 2009)
New Revision: 16658
Modified:
branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/templates/ear-seam2/EarContent/META-INF/application.xml
branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4166 Seam Web EAR project using Seam 2.1.1.GA does not work on JBoss AS 4.2.3
Modified: branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
===================================================================
--- branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2009-07-18 13:44:04 UTC (rev 16657)
+++ branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2009-07-18 22:02:34 UTC (rev 16658)
@@ -14,32 +14,37 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
-import java.io.FilenameFilter;
import java.io.IOException;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
-import java.util.regex.Pattern;
import org.apache.tools.ant.types.FilterSet;
import org.apache.tools.ant.types.FilterSetCollection;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
/**
* @author Alexey Kazakov
@@ -47,6 +52,8 @@
*/
public class Seam2ProjectCreator extends SeamProjectCreator {
+ private static final String STRICT = "strict";
+ private static final String MODULE_ORDER = "module-order";
// test/*.jar are duplicated here since the filtering seem to be assymetric when matching
private static AntCopyUtils.FileSet JBOSS_TEST_LIB_FILESET = new AntCopyUtils.FileSet()
.include("testng\\.jar") //$NON-NLS-1$
@@ -209,88 +216,86 @@
}
@Override
- protected void fillManifests() {
- try {
- File[] earJars = earContentsFolder.listFiles(new FilenameFilter() {
- /* (non-Javadoc)
- * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
- */
- public boolean accept(File dir, String name) {
- return name.lastIndexOf(".jar") > 0; //$NON-NLS-1$
- }
- });
- String earJarsStrWar = ""; //$NON-NLS-1$
- String earJarsStrEjb = ""; //$NON-NLS-1$
- for (File file : earJars) {
- earJarsStrWar += " " + file.getName() + " \n"; //$NON-NLS-1$ //$NON-NLS-2$
- if (isJBossSeamJar(file)) {
- jbossSeamPath = file.getAbsolutePath();
- } else {
- earJarsStrEjb += " " + file.getName() + " \n"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
+ protected void createEjbProject() {
+ super.createEjbProject();
+ // Copy security.drl to source folder
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "security.drl"), new File(ejbProjectFolder, "ejbModule/"), true); //$NON-NLS-1$ //$NON-NLS-2$
+ }
- FilterSetCollection manifestFilterColWar = new FilterSetCollection(projectFilterSet);
- FilterSet manifestFilter = new FilterSet();
- manifestFilter.addFilter("earLibs", earJarsStrWar); //$NON-NLS-1$
- manifestFilterColWar.addFilterSet(manifestFilter);
+ @Override
+ protected void createEarProject() {
+ super.createEarProject();
- FilterSetCollection manifestFilterColEjb = new FilterSetCollection(projectFilterSet);
- FilterSet manifestFilterEjb = new FilterSet();
- manifestFilterEjb.addFilter("earLibs", earJarsStrEjb); //$NON-NLS-1$
- manifestFilterColEjb.addFilterSet(manifestFilterEjb);
- AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "war/META-INF/MANIFEST.MF"), webMetaInf, manifestFilterColWar, true); //$NON-NLS-1$
- AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "ejb/ejbModule/META-INF/MANIFEST.MF"), ejbMetaInf, manifestFilterColEjb, true); //$NON-NLS-1$
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
}
- private boolean isJBossSeamJar(File file) {
- String regex = "(jboss-seam){1}(-[0-9][0-9\\.]+){0,1}(.jar){1}";
- return Pattern.matches(regex, file.getName());
- }
-
@Override
- protected void configureEjbClassPath(IProject ejbProject, IProgressMonitor monitor) throws CoreException {
- if (jbossSeamPath != null && jbossSeamPath.trim().length() > 0
- && new File(jbossSeamPath).exists()) {
- IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
- IJavaProject ejbJavaProject = JavaCore
- .create(ejbProject);
- if (ejbJavaProject != null) {
- if (!ejbJavaProject.isOpen()) {
- ejbJavaProject.open(monitor);
+ protected void configureJBossAppXml() {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(earProjectName);
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualFolder folder = component.getRootFolder();
+ IFolder rootFolder = (IFolder) folder.getUnderlyingFolder();
+ IResource jbossAppXml = rootFolder.findMember("META-INF/jboss-app.xml");
+ if(jbossAppXml==null || !(jbossAppXml instanceof IFile) || !jbossAppXml.exists()) {
+ return;
+ }
+
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if(manager == null) {
+ return;
+ }
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForEdit((IFile)jbossAppXml);
+ if (model instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) model;
+ IDOMDocument document = domModel.getDocument();
+ Element root = document.getDocumentElement();
+ if(root==null) {
+ return;
}
- IClasspathEntry[] cps = ejbJavaProject.getRawClasspath();
- IClasspathEntry[] entries = new IClasspathEntry[cps.length + 1];
- for (int i = 0; i < cps.length; i++) {
- entries[i] = cps[i];
+ NodeList children = root.getChildNodes();
+ boolean strictAdded = false;
+ Node firstChild = null;
+ for(int i=0; i<children.getLength(); i++) {
+ Node currentNode = children.item(i);
+ if(Node.ELEMENT_NODE == currentNode.getNodeType() && firstChild == null) {
+ firstChild = currentNode;
+ }
+ if(Node.ELEMENT_NODE == currentNode.getNodeType() && MODULE_ORDER.equals(currentNode.getNodeName())) {
+ setValue(document,currentNode,STRICT);
+ strictAdded = true;
+ }
}
- IPath path = new Path(jbossSeamPath);
- IFile[] files = wsRoot.findFilesForLocation(path);
- IFile f = null;
- if (files != null && files.length > 0) {
- f=files[0];
- } else {
- f = wsRoot.getFile(path);
+ if (!strictAdded) {
+ Element moduleOrder = document.createElement(MODULE_ORDER);
+ setValue(document,moduleOrder,STRICT);
+ if (firstChild != null) {
+ root.insertBefore(moduleOrder, firstChild);
+ } else {
+ root.appendChild(moduleOrder);
+ }
}
- if (f.exists()) {
- path = f.getFullPath();
- }
- entries[cps.length] = JavaCore.newLibraryEntry(path, null,
- null);
- ejbJavaProject.setRawClasspath(entries, monitor);
+ model.save();
}
+ } catch (CoreException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ } catch (IOException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ } finally {
+ if (model != null) {
+ model.releaseFromEdit();
+ }
}
+ try {
+ new FormatProcessorXML().formatFile((IFile) jbossAppXml);
+ } catch (Exception ignore) {
+ }
}
-
- @Override
- protected void createEjbProject() {
- super.createEjbProject();
- // Copy security.drl to source folder
- AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "security.drl"), new File(ejbProjectFolder, "ejbModule/"), true); //$NON-NLS-1$ //$NON-NLS-2$
+
+ private void setValue(Document document, Node node, String value) {
+ Text text = document.createTextNode(value);
+ node.appendChild(text);
}
protected AntCopyUtils.FileSet getJBossTestLibFileset() {
Modified: branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
===================================================================
--- branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2009-07-18 13:44:04 UTC (rev 16657)
+++ branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2009-07-18 22:02:34 UTC (rev 16658)
@@ -108,7 +108,6 @@
protected File ejbMetaInf;
protected File droolsLibFolder;
- protected String jbossSeamPath;
/**
* @param model Seam facet data model
@@ -276,6 +275,8 @@
IProject earProjectToBeImported = wsRoot.getProject(earProjectName);
ResourcesUtils.importExistingProject(earProjectToBeImported, wsPath + "/" + earProjectName, earProjectName, monitor, false);
+ configureJBossAppXml();
+
configureEjbClassPath(ejbProjectToBeImported, monitor);
WtpUtils.reconfigure(ejbProjectToBeImported,monitor);
@@ -510,4 +511,8 @@
SeamCorePlugin.getPluginLog().logError(e);
}
}
+
+ protected void configureJBossAppXml() {
+ // Do nothing special for Seam 1.2
+ }
}
\ No newline at end of file
Modified: branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml
===================================================================
--- branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml 2009-07-18 13:44:04 UTC (rev 16657)
+++ branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml 2009-07-18 22:02:34 UTC (rev 16658)
@@ -6,7 +6,12 @@
<display-name>@projectName@-ear</display-name>
+ <!-- JBIDE-4166 Workaround - Make sure we deploy this first, since this is referenced in xxx-ejb.jar-->
<module>
+ <ejb>jboss-seam.jar</ejb>
+ </module>
+
+ <module>
<web>
<web-uri>@projectName@.war</web-uri>
<context-root>/@projectName@</context-root>
@@ -17,8 +22,4 @@
<ejb>@projectName(a)-ejb.jar</ejb>
</module>
- <module>
- <ejb>jboss-seam.jar</ejb>
- </module>
-
</application>
Modified: branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/templates/ear-seam2/EarContent/META-INF/application.xml
===================================================================
--- branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/templates/ear-seam2/EarContent/META-INF/application.xml 2009-07-18 13:44:04 UTC (rev 16657)
+++ branches/jbosstools-3.0.x/seam/plugins/org.jboss.tools.seam.core/templates/ear-seam2/EarContent/META-INF/application.xml 2009-07-18 22:02:34 UTC (rev 16658)
@@ -7,6 +7,10 @@
<display-name>@projectName@-ear</display-name>
<module>
+ <ejb>jboss-seam.jar</ejb>
+ </module>
+
+ <module>
<web>
<web-uri>@projectName@.war</web-uri>
<context-root>/@projectName@</context-root>
@@ -17,8 +21,4 @@
<ejb>@projectName(a)-ejb.jar</ejb>
</module>
- <module>
- <ejb>jboss-seam.jar</ejb>
- </module>
-
</application>
16 years, 9 months
JBoss Tools SVN: r16657 - trunk/hibernatetools/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-07-18 09:44:04 -0400 (Sat, 18 Jul 2009)
New Revision: 16657
Modified:
trunk/hibernatetools/docs/reference/en/modules/ant.xml
trunk/hibernatetools/docs/reference/en/modules/codegen.xml
trunk/hibernatetools/docs/reference/en/modules/codegenarchitecture.xml
trunk/hibernatetools/docs/reference/en/modules/plugins.xml
trunk/hibernatetools/docs/reference/en/modules/reverseengineering.xml
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-652-Hibernate Tools Reference Guide was checked and updated. </p>
</body></html>
Modified: trunk/hibernatetools/docs/reference/en/modules/ant.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en/modules/ant.xml 2009-07-17 22:37:13 UTC (rev 16656)
+++ trunk/hibernatetools/docs/reference/en/modules/ant.xml 2009-07-18 13:44:04 UTC (rev 16657)
@@ -51,11 +51,9 @@
classpathref="toolslib" />
]]></programlisting>
- <para>This <emphasis>
- <property>
- <literal><taskdef></literal>
- </property>
- </emphasis> defines an Ant task called <emphasis>
+ <para>This
+ <code><taskdef></code>
+ defines an Ant task called <emphasis>
<property> hibernatetool </property>
</emphasis> which now can be used anywhere in your ant <emphasis>
<property>build.xml</property>
@@ -203,9 +201,7 @@
<section>
<title>Basic examples</title>
- <para>The following example shows the most basic setup for generating pojo's via <emphasis>
- <property><hbm2java></property>
- </emphasis> from a normal <emphasis>
+ <para>The following example shows the most basic setup for generating pojo's via <code><hbm2java></code> from a normal <emphasis>
<property>
<literal>hibernate.cfg.xml</literal>
</property>. </emphasis> The output will be put in the <emphasis>
@@ -223,11 +219,8 @@
<para>The following example is similar, but now we are performing multiple exports from the
- same configuration. We are exporting the schema via <emphasis>
- <property><hbm2dll></property>, </emphasis> generates some DAO code via <emphasis>
- <property><hbm2dao></property>
- </emphasis> and finally runs a custom code generation via <emphasis>
- <property><hbmtemplate></property>. </emphasis> This is again from a normal <emphasis>
+ same configuration. We are exporting the schema via <code><hbm2dll></code>, generates some DAO code via <code><hbm2dao></code>
+ and finally runs a custom code generation via <code><hbmtemplate></code>. This is again from a normal <emphasis>
<property>hibernate.cfg.xml</property>
</emphasis> and the output is still put in the <emphasis>
<property>
@@ -258,13 +251,13 @@
<section>
<title>Hibernate Configurations</title>
- <para><literal>Hibernatetool</literal> supports four different Hibernate configurations: A
- standard Hibernate configuration <emphasis>
- (<property><configuration></property>), </emphasis> Annotation based
- configuration <emphasis> (<property><annotationconfiguration></property>),
- </emphasis> JPA persistence based configuration <emphasis>
- (<property><jpaconfiguration></property>) </emphasis> and a JDBC based
- configuration <emphasis> (<property><jdbcconfiguration></property>) </emphasis>
+ <para><emphasis>Hibernatetool</emphasis> supports four different Hibernate configurations: A
+ standard Hibernate configuration
+ (<code><configuration></code>), Annotation based
+ configuration (<code><annotationconfiguration></code>),
+ JPA persistence based configuration
+ (<code><jpaconfiguration></code>) and a JDBC based
+ configuration (<code><jdbcconfiguration></code>)
for use when reverse engineering.</para>
<para>Each have in common that they are able to build up a Hibernate Configuration object from
@@ -282,9 +275,9 @@
<section>
<title>Standard Hibernate Configuration (<configuration>)</title>
- <para>A <emphasis>
- <property><configuration></property>
- </emphasis> is used to define a standard Hibernate configuration. A standard Hibernate
+ <para>A
+ <code><configuration></code>
+ is used to define a standard Hibernate configuration. A standard Hibernate
configuration reads the mappings from a <emphasis>
<property>cfg.xml</property>
</emphasis> and/or a fileset.</para>
@@ -440,25 +433,25 @@
<section>
<title>Annotation based Configuration (<annotationconfiguration>)</title>
- <para>An <emphasis>
- <property><annotationconfiguration></property>
- </emphasis> is used when you want to read the metamodel from EJB3/Hibernate Annotations
+ <para>An
+ <code><annotationconfiguration></code>
+ is used when you want to read the metamodel from EJB3/Hibernate Annotations
based POJO's.</para>
<important>
<title>Important:</title>
<para>To use it remember to put the jar files needed for using hibernate annotations in the
- classpath of the <emphasis>
- <property><taskdef></property>, </emphasis> i. e.
+ classpath of the
+ <code><taskdef></code>, i. e.
hibernate-annotations.jar and hibernate-commons-annotations.jar.</para>
</important>
- <para>The <emphasis>
- <property><annotationconfiguration></property>
- </emphasis> supports the same attributes as a <emphasis>
- <property><configuration></property>
- </emphasis> except that the configurationfile attribute is now required as that is from
- where an <literal>AnnotationConfiguration</literal> gets the list of classes/packages it
+ <para>The
+ <code><annotationconfiguration></code>
+ supports the same attributes as a
+ <code><configuration></code>
+ except that the configurationfile attribute is now required as that is from
+ where an <emphasis>AnnotationConfiguration</emphasis> gets the list of classes/packages it
should load.</para>
<para>Thus the minimal usage is:</para>
@@ -477,9 +470,8 @@
<section>
<title>JPA based configuration (<jpaconfiguration>)</title>
- <para>A <emphasis>
- <property><jpaconfiguration></property>
- </emphasis> is used when you want to read the metamodel from JPA/Hibernate Annotation where
+ <para>A <code><jpaconfiguration></code>
+ is used when you want to read the metamodel from JPA/Hibernate Annotation where
you want to use the auto-scan configuration as defined in the JPA spec (part of EJB3). In
other words, when you do not have a <emphasis>
<property>hibernate.cfg.xml</property>, </emphasis> but instead have a setup where you use
@@ -487,9 +479,8 @@
<property>persistence.xml</property>
</emphasis> packaged in a JPA compliant manner.</para>
- <para>The <emphasis>
- <property><jpaconfiguration></property>
- </emphasis> will simply just try and auto-configure it self based on the available
+ <para>The <code><jpaconfiguration></code>
+ will simply just try and auto-configure it self based on the available
classpath, e.g. look for <emphasis>
<property>META-INF/persistence.xml</property>. </emphasis></para>
@@ -500,12 +491,9 @@
</emphasis> is specified it will automatically search for one and if a unique one is found,
use it, but if multiple persistence units are available it will error.</para>
- <para>To use a <emphasis>
- <property><jpaconfiguration></property>
- </emphasis> you will need to specify some additional jars from Hibernate EntityManager in
- the <emphasis>
- <property><taskdef></property>
- </emphasis> of the hibernatetool. The following shows a full setup:</para>
+ <para>To use a <code><jpaconfiguration></code>
+ you will need to specify some additional jars from Hibernate EntityManager in
+ the <code><taskdef></code> of the hibernatetool. The following shows a full setup:</para>
<programlisting role="XML"><![CDATA[<path id="ejb3toolslib">
<path refid="jpatoolslib"/> <!-- ref to previously defined toolslib -->
@@ -545,11 +533,7 @@
<section>
<title>JDBC Configuration for reverse engineering (<jdbcconfiguration>)</title>
- <para>A <emphasis>
- <property>
- <literal><jdbcconfiguration></literal>
- </property>
- </emphasis> is used to perform reverse engineering of the database from a JDBC connection.</para>
+ <para>A <code><jdbcconfiguration></code> is used to perform reverse engineering of the database from a JDBC connection.</para>
<para>This configuration works by reading the connection properties either from <emphasis>
<property>hibernate.cfg.xml</property>
@@ -557,15 +541,9 @@
<property>hibernate.properties</property>
</emphasis> with a fileset.</para>
- <para>The <emphasis>
- <property>
- <literal><jdbcconfiguration></literal>
- </property>
- </emphasis> has the same attributes as a <emphasis>
- <property>
- <literal><configuration></literal>
- </property>
- </emphasis> plus the following additional attributes:</para>
+ <para>The <code><jdbcconfiguration></code> has the same attributes as a
+ <code><configuration></code>
+ plus the following additional attributes:</para>
<programlisting role="XML"><![CDATA[<jdbcconfiguration
...
@@ -635,9 +613,8 @@
</entry>
<entry>
- <para>Name of a class that implements
- org.hibernate.cfg.reveng.ReverseEngineeringStrategy. Used for setting up the
- strategy the tools will use to control the reverse engineering, e.g. naming of
+ <para>Name of a class that implements org.hibernate.cfg.reveng.ReverseEngineeringStrategy.
+ Used for setting up the strategy the tools will use to control the reverse engineering, e.g. naming of
properties, which tables to include/exclude etc. Using a class instead of (or as
addition to) a reveng.xml file gives you full programmatic control of the reverse
engineering.</para>
@@ -673,7 +650,7 @@
<entry>
<para>If true, columns named VERSION or TIMESTAMP with appropriate types will be
mapped with the appropriate optimistic locking corresponding to
- <version> or <timestamp>.</para>
+ <code><version></code> or <code><timestamp></code>.</para>
</entry>
<entry>
@@ -689,12 +666,8 @@
<section>
<title>Example</title>
- <para>Here is an example of using <emphasis>
- <property>
- <literal><jdbcconfiguration></literal>
- </property>
- </emphasis> to generate Hibernate xml mappings via <emphasis>
- <property><hbm2hbmxml></property>.</emphasis> The connection settings here
+ <para>Here is an example of using <code><jdbcconfiguration></code> to generate Hibernate xml mappings via
+ <code><hbm2hbmxml></code>. The connection settings here
is read from a <emphasis>
<property> hibernate.properties </property>
</emphasis> file but could just as well have been read from a <emphasis>
@@ -715,18 +688,14 @@
<para>Exporters are the parts that do the actual job of converting the hibernate metamodel into
various artifacts, mainly code. The following section describes the current supported set of
exporters in the <property>Hibernate Tool</property> distribution. It is also possible for
- userdefined exporters, that is done through the <emphasis>
- <property>
- <literal><hbmtemplate></literal>
- </property>
- </emphasis> exporter.</para>
+ userdefined exporters, that is done through the
+ <code><hbmtemplate></code>
+ exporter.</para>
<section>
<title>Database schema exporter (<hbm2ddl>)</title>
- <para><emphasis>
- <property><hbm2ddl></property>
- </emphasis> lets you run schemaexport and schemaupdate which generates the appropriate SQL
+ <para><code><hbm2ddl></code> lets you run schemaexport and schemaupdate which generates the appropriate SQL
DDL and allow you to store the result in a file or export it directly to the database.
Remember that if a custom naming strategy is needed it is placed on the configuration
element.</para>
@@ -891,8 +860,7 @@
<section>
<title>Example</title>
- <para>Basic example of using <emphasis>
- <property><hbm2ddl></property>, </emphasis> which does not export to the
+ <para>Basic example of using <code><hbm2ddl></code>, which does not export to the
database but simply dumps the sql to a file named <emphasis>
<property>sql.ddl</property>. </emphasis></para>
@@ -904,11 +872,9 @@
</section>
<section>
- <title>POJO java code exporter (<literal><hbm2java></literal>)</title>
+ <title>POJO java code exporter (<hbm2java>)</title>
- <para><emphasis>
- <property><hbm2java></property>
- </emphasis> is a java codegenerator. Options for controlling whether JDK 5 syntax can be
+ <para><code><hbm2java></code> is a java codegenerator. Options for controlling whether JDK 5 syntax can be
used and whether the POJO should be annotated with EJB3/Hibernate Annotations.</para>
<programlisting role="XML"><![CDATA[<hbm2java
@@ -976,9 +942,7 @@
<section>
<title>Example</title>
- <para>Basic example of using <emphasis>
- <property><hbm2java></property>
- </emphasis> to generate POJO's that utilize jdk5 constructs.</para>
+ <para>Basic example of using <code><hbm2java></code> to generate POJO's that utilize jdk5 constructs.</para>
<programlisting role="XML"><![CDATA[<hibernatetool destdir="${build.dir}/generated">
<configuration configurationfile="hibernate.cfg.xml"/>
@@ -988,13 +952,11 @@
</section>
<section>
- <title>Hibernate Mapping files exporter (<literal><hbm2hbmxml></literal>)</title>
+ <title>Hibernate Mapping files exporter (<hbm2hbmxml>)</title>
- <para><emphasis>
- <property><hbm2hbmxml></property>
- </emphasis> generates a set of .hbm files. Intended to be used together with a <emphasis>
- <property><jdbcconfiguration></property>
- </emphasis> when performing reverse engineering, but can be used with any kind of
+ <para><code><hbm2hbmxml></code> generates a set of .hbm files. Intended to be used together with a
+ <code><jdbcconfiguration></code>
+ when performing reverse engineering, but can be used with any kind of
configuration. e.g. to convert from annotation based pojo's to <emphasis>
<property>hbm.xml</property>. </emphasis></para>
@@ -1009,23 +971,17 @@
<section>
<title>Example</title>
- <para>Basic usage of <emphasis>
- <property><hbm2hbmxml></property>. </emphasis></para>
+ <para>Basic usage of <code><hbm2hbmxml></code>. </para>
<programlisting role="XML"><![CDATA[<hibernatetool destdir="${build.dir}/generated">
<configuration configurationfile="hibernate.cfg.xml"/>
<hbm2hbmxml/>
</hibernatetool>]]></programlisting>
- <para><emphasis>
- <property><hbm2hbmxml></property>
- </emphasis> is normally used with a <emphasis>
- <property><jdbcconfiguration></property>
- </emphasis> like in the above example, but any other configuration can also be used to
+ <para><code><hbm2hbmxml></code> is normally used with a <code><jdbcconfiguration></code> like in the above example, but any other configuration can also be used to
convert between the different ways of performing mappings. Here is an example of that,
- using an <emphasis>
- <property><annotationconfiguration></property>
- </emphasis>.</para>
+ using an <code><annotationconfiguration></code>
+ .</para>
<note>
<title>Note:</title>
@@ -1041,17 +997,12 @@
</section>
<section>
- <title>Hibernate Configuration file exporter (<literal><hbm2cfgxml></literal>)</title>
+ <title>Hibernate Configuration file exporter (<hbm2cfgxml>)</title>
- <para><emphasis>
- <property><hbm2cfgxml></property>
- </emphasis> generates a <emphasis>
- <property>hibernate.cfg.xml</property>. </emphasis> Intended to be used together with a <emphasis>
- <property><jdbcconfiguration></property>
- </emphasis> when performing reverse engineering, but it can be used with any kind of
- configuration. The <emphasis>
- <property><hbm2cfgxml></property>
- </emphasis> will contain the properties used and adds mapping entries for each mapped class.</para>
+ <para><code><hbm2cfgxml></code> generates a <emphasis>
+ <property>hibernate.cfg.xml</property>. </emphasis> Intended to be used together with a <code><jdbcconfiguration></code>
+ when performing reverse engineering, but it can be used with any kind of
+ configuration. The <code><hbm2cfgxml></code> will contain the properties used and adds mapping entries for each mapped class.</para>
<programlisting role="XML"><![CDATA[<hbm2cfgxml
ejb3="true|false"
@@ -1105,11 +1056,10 @@
</section>
<section>
- <title>Documentation exporter (<literal><hbm2doc></literal>)</title>
+ <title>Documentation exporter (<hbm2doc>)</title>
- <para><emphasis>
- <property><hbm2doc></property>
- </emphasis> generates html documentation a'la javadoc for the database schema et.al.</para>
+ <para><code><hbm2doc></code>
+ generates html documentation a'la javadoc for the database schema et.al.</para>
<programlisting role="XML"><![CDATA[<hbm2doc/>]]></programlisting>
</section>
@@ -1117,9 +1067,7 @@
<section>
<title>Query exporter (<query>)</title>
- <para><emphasis>
- <property><query></property>
- </emphasis> is used to execute a HQL query statements and optionally sends the output to a
+ <para><code><query></code> is used to execute a HQL query statements and optionally sends the output to a
file. It can be used for verifying the mappings and for basic data extraction.</para>
<programlisting role="XML"><![CDATA[<query
@@ -1137,9 +1085,7 @@
<section>
<title>Examples</title>
- <para>The simplest usage of <emphasis>
- <property><query></property>
- </emphasis> will just execute the query without dumping to a file. This can be used to
+ <para>The simplest usage of <code><query></code> will just execute the query without dumping to a file. This can be used to
verify that queries can actually be performed.</para>
<programlisting role="XML"><![CDATA[<hibernatetool>
@@ -1147,9 +1093,8 @@
<query>from java.lang.Object</query>
</hibernatetool>]]></programlisting>
- <para>Multiple queries can be executed by nested <emphasis>
- <property><hql></property>
- </emphasis> elements. In this example we also let the output be dumped to <emphasis>
+ <para>Multiple queries can be executed by nested <code><hql></code> elements.
+ In this example we also let the output be dumped to <emphasis>
<property>queryresult.txt</property>. </emphasis></para>
<note>
@@ -1168,7 +1113,7 @@
</section>
<section id="hbmtemplate">
- <title>Generic Hibernate metamodel exporter (<literal><hbmtemplate></literal>)</title>
+ <title>Generic Hibernate metamodel exporter (<hbmtemplate>)</title>
<para>Generic exporter that can be controlled by a user provides a template or class.</para>
@@ -1187,11 +1132,9 @@
<section>
<title>Exporter via <hbmtemplate></title>
- <para>The following is an example of reverse engineering via <emphasis>
- <property><jdbcconfiguration></property>
- </emphasis> and usage of a custom Exporter via the <emphasis>
- <property><hbmtemplate></property>
- </emphasis>.</para>
+ <para>The following is an example of reverse engineering via
+ <code><jdbcconfiguration></code> and usage of a custom Exporter via the
+ <code><hbmtemplate></code>.</para>
<programlisting role="XML"><![CDATA[ <hibernatetool destdir="${destdir}">
<jdbcconfiguration
@@ -1227,68 +1170,45 @@
<section>
<title>Using properties to configure Exporters</title>
- <para>Exporters can be controlled by user properties. The user properties are specified via <emphasis>
- <property><property></property>
- </emphasis> or <emphasis>
- <property>
- <literal><propertyset></literal>
- </property>
- </emphasis> and each exporter will have access to them directly in the templates and via
+ <para>Exporters can be controlled by user properties. The user properties are specified via
+ <code><property></code>
+ or
+ <code><propertyset></code>
+ and each exporter will have access to them directly in the templates and via
<property>Exporter.setProperties()</property>.</para>
<section>
- <title><literal><property></literal> and
- <literal><propertyset></literal></title>
+ <title><property> and
+ <propertyset></title>
- <para>The <emphasis>
- <property><property></property>
- </emphasis> allows you bind a string value to a key. The value will be available in the
- templates via <emphasis>
- <property>$<key></property>
- </emphasis>. The following example will assign the string value <emphasis>
- <property>"true"</property>
- </emphasis> to the variable <emphasis>
- <property>$descriptors</property>
- </emphasis>.</para>
+ <para>The <code><property></code>
+ allows you bind a string value to a key. The value will be available in the
+ templates via <code>$<key></code>.
+ The following example will assign the string value
+ <code>"true"</code>
+ to the variable
+ <code>$descriptors</code>
+ .</para>
<programlisting role="XML"><![CDATA[<property key="descriptors" value="true"/>]]></programlisting>
- <para>Most times using <emphasis>
- <property>
- <literal><property></literal>
- </property>
- </emphasis> is enough for specifying the properties needed for the exporters. Still the ant
- tools supports the notion of <emphasis>
- <property>
- <literal><propertyset></literal>
- </property>
- </emphasis> that is used for grouping a set of properties. More about the functionality of <emphasis>
- <property>
- <literal><propertyset></literal>
- </property>
- </emphasis> is explained in detail in the <ulink url="http://ant.apache.org/manual/">Ant
+ <para>Most times using <code><property></code> is enough for specifying the properties needed for the exporters. Still the ant
+ tools supports the notion of <code><propertyset></code> that is used for grouping a set of properties. More about the functionality of <code><propertyset></code>
+ is explained in detail in the <ulink url="http://ant.apache.org/manual/">Ant
manual</ulink>.</para>
</section>
<section>
<title>Getting access to user specific classes</title>
- <para>If the templates need to access some user class it becomes possible by specifying a <emphasis>
- <property>"toolclass"</property>
- </emphasis> in the properties.</para>
+ <para>If the templates need to access some user class it becomes possible by specifying a <code>
+ "toolclass"</code> in the properties.</para>
<programlisting role="XML"><![CDATA[<property key="hibernatetool.sometool.toolclass" value="x.y.z.NameOfToolClass"/>
]]></programlisting>
- <para>Placing the above <emphasis>
- <property>
- <literal><property></literal>
- </property>
- </emphasis> tag in <emphasis>
- <property>
- <literal><hibernatetool></literal>
- </property>
- </emphasis> or inside any exporter will automatically create an instance of
+ <para>Placing the above <code><property></code> tag in <code><hibernatetool></code>
+ or inside any exporter will automatically create an instance of
<literal>x.y.z.NameOfToolClass</literal> and it will be available in the templates as
<literal>$sometool</literal>. This is useful to delegate logic and code generation to java
code instead of placing such logic in the templates.</para>
@@ -1296,14 +1216,11 @@
<section>
<title>Example</title>
- <para>Here is an example that uses <emphasis>
- <property><hbmtemplate></property>
- </emphasis> together with <emphasis>
- <property><property></property>
- </emphasis> which will be available to the templates/exporter. </para>
+ <para>Here is an example that uses <code><hbmtemplate></code>
+ together with <code><property></code> which will be available to the templates/exporter. </para>
<note>
<title>Note:</title>
- <para> This example actually simulates what <hbm2java> actually does.</para>
+ <para> This example actually simulates what <code><hbm2java></code> actually does.</para>
</note>
<programlisting role="XML"><![CDATA[<hibernatetool destdir="${build.dir}/generated">
Modified: trunk/hibernatetools/docs/reference/en/modules/codegen.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en/modules/codegen.xml 2009-07-17 22:37:13 UTC (rev 16656)
+++ trunk/hibernatetools/docs/reference/en/modules/codegen.xml 2009-07-18 13:44:04 UTC (rev 16657)
@@ -2,37 +2,28 @@
<chapter id="codegen">
<title>Controlling POJO code generation</title>
- <para>When using <emphasis>
- <property><hbm2java></property>
- </emphasis> or the eclipse plugin to generate POJO java code you have the possibility to control
- certain aspects of the code generation. This is primarily done with the <emphasis>
- <property><meta></property>
- </emphasis> tag in the mapping files. The following section describes the possible <emphasis>
- <property><meta></property>
- </emphasis> tags and their use.</para>
+ <para>When using <code><hbm2java></code> or the eclipse plugin to generate POJO java code you have the possibility to control
+ certain aspects of the code generation. This is primarily done with the <code><meta></code>
+ tag in the mapping files. The following section describes the possible <code>
+ <meta>
+ </code> tags and their use.</para>
<section>
- <title>The <literal><meta></literal> attribute</title>
+ <title>The <meta> attribute</title>
- <para>The <emphasis>
- <property><meta></property>
- </emphasis> tag is a simple way of annotating the <emphasis>
+ <para>The <code><meta></code> tag is a simple way of annotating the <emphasis>
<property>hbm.xml</property>
</emphasis> with information, so tools have a natural place to store/read information that is
not directly related to the Hibernate core.</para>
- <para>You can use the <emphasis>
- <property><meta></property>
- </emphasis> tag to e.g. tell <emphasis>
- <property><hbm2java></property>
- </emphasis> to only generate <emphasis>
+ <para>You can use the <code><meta></code> tag to e.g. tell <code><hbm2java></code>
+ to only generate <emphasis>
<property>"protected"</property>
</emphasis> setters, have classes always implement a certain set of interfaces or even have
them extend a certain base class and even more.</para>
- <para>The following example shows how to use various <emphasis>
- <property><meta></property>
- </emphasis> attributes and the resulting java code.</para>
+ <para>The following example shows how to use various <code><meta></code>
+ attributes and the resulting java code.</para>
<programlisting role="XML"><![CDATA[<class name="Person">
<meta attribute="class-description">
@@ -258,52 +249,49 @@
</tgroup>
</table>
- <para>Attributes declared via the <emphasis>
- <property><meta></property>
- </emphasis> tag are per default <emphasis>
+ <para>Attributes declared via the <code><meta></code>
+ tag are per default <emphasis>
<property>"inherited"</property>
</emphasis> inside an <emphasis>
<property>hbm.xml</property>
</emphasis> file.</para>
<para>What does that mean? It means that if you e.g want to have all your classes implement
- <literal>IAuditable</literal> then you just add an <emphasis> <meta
- attribute="implements">IAuditable</meta></emphasis> in the top of the <emphasis>
+ <property>IAuditable</property> then you just add an <code> <meta
+ attribute="implements">IAuditable</meta></code> in the top of the <emphasis>
<property>hbm.xml</property>
- </emphasis> file, just after <emphasis>
- <property><hibernate-mapping></property>. </emphasis> Now all classes defined
+ </emphasis> file, just after <code><hibernate-mapping></code>. Now all classes defined
in that <emphasis>
<property>hbm.xml</property>
- </emphasis> file will implement <literal>IAuditable</literal>!</para>
+ </emphasis> file will implement <property>IAuditable</property>!</para>
<note>
<title>Note:</title>
<para>This applies to <emphasis>all</emphasis>
- <literal><meta></literal>-tags. Thus it can also e.g. be used to specify that
+ <code><meta></code>-tags. Thus it can also e.g. be used to specify that
all fields should be declare protected, instead of the default private. This is done by
- adding <literal><meta
- attribute="scope-field">protected</meta></literal> at e.g. just under
- the <literal><class></literal> tag and all fields of that class will be
+ adding <code><meta
+ attribute="scope-field">protected</meta></code> at e.g. just under
+ the <code><class></code> tag and all fields of that class will be
protected.</para>
</note>
- <para>To avoid having a <emphasis>
- <property><meta></property>
- </emphasis> tag inherited then you can simply specify <emphasis> inherit = "false"</emphasis>
- for the attribute, e.g. <emphasis> <meta attribute = "scope-class" inherit =
- "false">public abstract</meta></emphasis> will restrict the <emphasis>
+ <para>To avoid having a <code><meta></code>
+ tag inherited then you can simply specify <code> inherit = "false"</code>
+ for the attribute, e.g. <code> <meta attribute = "scope-class" inherit =
+ "false">public abstract</meta></code> will restrict the <emphasis>
<property>"class-scope"</property>
</emphasis> to the current class, not the subclasses.</para>
<section>
<title>Recommendations</title>
- <para>The following are some good practices when using <emphasis>
- <property><meta></property>
- </emphasis> attributes.</para>
+ <para>The following are some good practices when using
+ <code><meta></code>
+ attributes.</para>
<section>
- <title>Dangers of a class level <literal>use-in-string and use-in-equals</literal> meta
+ <title>Dangers of a class level <property>use-in-string and use-in-equals</property> meta
attributes when having bi-directional associations</title>
<para>If we have two entities with a bi-directional association between them and define at
@@ -340,14 +328,13 @@
</class>
</hibernate-mapping>]]></programlisting>
- <para>Then <emphasis>
- <property><hbm2java></property>
- </emphasis> will assume you want to include all properties and collections in the
- <property>toString()/equals()</property> methods and this can result in infinite
+ <para>Then <code><hbm2java></code>
+ will assume you want to include all properties and collections in the
+ <code>toString()/equals()</code> methods and this can result in infinite
recursive calls.</para>
<para>To remedy this you have to decide which side of the association will include the other
- part (if at all) in the <property>toString()/equals()</property> methods. Therefore it is
+ part (if at all) in the <code>toString()/equals()</code> methods. Therefore it is
not a good practice to put at class scope such <emphasis>
<property>meta</property>
</emphasis> attributes, unless you are defining a class without bi-directional
@@ -398,10 +385,10 @@
</section>
<section>
- <title>Be aware of putting at class scope level <literal><meta></literal>
- attribute <literal>use-in-equals</literal></title>
+ <title>Be aware of putting at class scope level <meta>
+ attributeuse-in-equals</title>
- <para>For <property>equal()/hashCode()</property> method generation, you have to take into
+ <para>For <code>equal()/hashCode()</code> method generation, you have to take into
account that the attributes that participate on such method definition, should take into
account only attributes with business meaning (the name, social security number, etc, but
no generated id's, for example).</para>
@@ -413,9 +400,7 @@
set.</para>
<para>Therefore automatically configuration of the generation of
- <property>equals()/hashCode()</property> methods specifying at class scope level the <emphasis>
- <property><meta></property>
- </emphasis> attribute <emphasis>
+ <property>equals()/hashCode()</property> methods specifying at class scope level the <code><meta></code> attribute <emphasis>
<property>use-in-equals</property>
</emphasis> could be a dangerous decision that could produce non expected
side-effect.</para>
@@ -439,13 +424,12 @@
<section>
<title>Generate pre/post-conditions for methods</title>
- <para>With a <emphasis> <meta attribute="class-code"></emphasis>, you can add
- additional methods on a given class, nevertheless such <emphasis>
- <property><meta></property>
- </emphasis> attribute can not be used at a property scope level and <property>Hibernate
- Tools</property> does not provide such <emphasis>
- <property><meta></property>
- </emphasis> attributes.</para>
+ <para>With a <code> <meta attribute="class-code"></code>, you can add
+ additional methods on a given class, nevertheless such <code><meta></code>
+ attribute can not be used at a property scope level and <property>Hibernate
+ Tools</property> does not provide such <code>
+ ><meta>
+ </code> attributes.</para>
<para>A possible solution for this is to modify the freemarker templates responsible for
generating the POJO's. If you look inside <emphasis>
@@ -509,11 +493,11 @@
<property>.hbm.xml</property>
</emphasis> file we define the <emphasis>
<property><meta></property>
- </emphasis> attributes: <literal>pre-cond</literal> or <literal>post-cond</literal>, their
+ </emphasis> attributes: <code>pre-cond</code> or <code>post-cond</code>, their
contents will be generated into the body of the relevant <literal>set</literal>
method.</para>
- <para>As an example let us add a pre-condition for property <literal>name</literal>
+ <para>As an example let us add a pre-condition for property <code>name</code>
preventing no <property>Person</property> can have an empty name. Hence we have to modify
the <emphasis>
<property>Person.hbm.xml</property>
@@ -537,7 +521,7 @@
<note>
<title>Note:</title>
<para>I) To escape the & symbol we put &amp;. You can use
- <![CDATA[]]> instead.</para>
+ <code> <![CDATA[]]></code> instead.</para>
<para>II) Note that we are referring to "firstName" directly and this is the parameter
name not the actual field name. If you want to refer the field you have to use
"this.firstName" instead. </para>
@@ -546,9 +530,8 @@
<para>Finally we have to generate the <emphasis>
<property>Person.java</property>
</emphasis> class, for this we can use both Eclipse and Ant as long as you remember to set
- or fill in the templatepath setting. For Ant we configure <emphasis>
- <property><hibernatetool></property>
- </emphasis> task via <literal>the templatepath</literal> attribute as in:</para>
+ or fill in the templatepath setting. For Ant we configure <code><hibernatetool></code>
+ task via <literal>the templatepath</literal> attribute as in:</para>
<programlisting role="XML"><![CDATA[
<target name="hbm2java">
@@ -569,9 +552,8 @@
</hibernatetool>
</target>]]></programlisting>
- <para>Invoking the target <emphasis>
- <property><hbm2java></property>
- </emphasis> will generate on the <emphasis>
+ <para>Invoking the target <code><hbm2java></code>
+ will generate on the <emphasis>
<property>${hbm2java.dest.dir}</property>
</emphasis> the file <emphasis>
<property>Person.java</property>
Modified: trunk/hibernatetools/docs/reference/en/modules/codegenarchitecture.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en/modules/codegenarchitecture.xml 2009-07-17 22:37:13 UTC (rev 16656)
+++ trunk/hibernatetools/docs/reference/en/modules/codegenarchitecture.xml 2009-07-18 13:44:04 UTC (rev 16657)
@@ -12,10 +12,10 @@
<para>The meta model is the model used by Hibernate Core to perform its object relational
mapping. The model includes information about tables, columns, classes, properties,
components, values, collections etc. The API is in <literal>org.hibernate.mapping</literal>
- and its main entry point is the <literal>Configuration</literal> class, the same class that is
+ and its main entry point is the <property>Configuration</property> class, the same class that is
used to build a session factory.</para>
- <para>The model represented by the <literal>Configuration</literal> class can be build in many
+ <para>The model represented by the <property>Configuration</property> class can be build in many
ways. The following list the currently supported ones in <property>Hibernate Tools</property>. </para>
<para>
@@ -25,11 +25,9 @@
<property>hbm.xml</property>
</emphasis> files, requires a <emphasis>
<property>hibernate.cfg.xml</property>
- </emphasis>. Named core in Eclipse and <emphasis>
- <property>
- <literal><configuration></literal>
- </property>
- </emphasis> in ant.</para>
+ </emphasis>. Named core in Eclipse and
+ <code><configuration></code>
+ in ant.</para>
</listitem>
<listitem>
@@ -37,11 +35,9 @@
<property>hbm.xml</property>
</emphasis> and annotated classes, requires a <emphasis>
<property>hibernate.cfg.xml</property>
- </emphasis>. Named annotations in Eclipse and <emphasis>
- <property>
- <literal><annotationconfiguration></literal>
- </property>
- </emphasis> in ant.</para>
+ </emphasis>. Named annotations in Eclipse and
+ <code><annotationconfiguration></code>
+ in ant.</para>
</listitem>
<listitem>
@@ -49,22 +45,18 @@
<property>hbm.xml</property>
</emphasis> and annotated classes requires that the project has a <emphasis>
<property>META-INF/persistence.xml</property>
- </emphasis> in its classpath. Named JPA in Eclipse and <emphasis>
- <property>
- <literal><jpaconfiguration></literal>
- </property>
- </emphasis> in ant.</para>
+ </emphasis> in its classpath. Named JPA in Eclipse and
+ <code><jpaconfiguration></code>
+ in ant.</para>
</listitem>
<listitem>
<para>A JDBC configuration uses <property>Hibernate Tools</property> reverse engineering
and reads its mappings via JDBC metadata + additional reverse engineering files
(reveng.xml). Automatically used in Eclipse when doing reverse engineering from JDBC and
- named <emphasis>
- <property>
- <literal><jdbcconfiguration></literal>
- </property>
- </emphasis> in ant.</para>
+ named
+ <code><jdbcconfiguration></code>
+ in ant.</para>
</listitem>
</itemizedlist>
</para>
Modified: trunk/hibernatetools/docs/reference/en/modules/plugins.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en/modules/plugins.xml 2009-07-17 22:37:13 UTC (rev 16656)
+++ trunk/hibernatetools/docs/reference/en/modules/plugins.xml 2009-07-18 13:44:04 UTC (rev 16657)
@@ -811,7 +811,7 @@
mapping will always be created. If this option is enabled and there are matching
foreign-keys each key column is still considered a 'basic' scalar (string, long,
etc.) instead of a reference to an entity. If you disable this option a
- <key-many-to-one> instead. Note: a <many-to-one>
+ <code><key-many-to-one></code> instead. Note: a <code><many-to-one></code>
property is still created, but is simply marked as non-updatable and
non-insertable.</para>
</entry>
@@ -1281,13 +1281,11 @@
<title>Java property/class completion</title>
<para>Package, class, and field completion is enabled for relevant XML attributes. The
- auto-completion detects its context and limits the completion for e.g. <emphasis>
- <property><property></property>
- </emphasis> and only shows the properties/fields available in the enclosing <emphasis>
- <property><class></property>
- </emphasis>, <emphasis>
- <property><subclass></property>
- </emphasis> etc. It is also possible to navigate from the <emphasis>
+ auto-completion detects its context and limits the completion for e.g. <code><property></code> and only shows the properties/fields available in the enclosing
+ <code><class></code>
+ ,
+ <code><subclass></code>
+ etc. It is also possible to navigate from the <emphasis>
<property>hbm.xml</property>
</emphasis> files to the relevant class/field in java code.</para>
@@ -1365,9 +1363,7 @@
<para>In <emphasis>
<property>cfg.xml</property>
- </emphasis> code completion for the value of <emphasis>
- <property><property> name</property>
- </emphasis> attributes is available.</para>
+ </emphasis> code completion for the value of <code><property> name</code> attributes is available.</para>
<figure>
Modified: trunk/hibernatetools/docs/reference/en/modules/reverseengineering.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en/modules/reverseengineering.xml 2009-07-17 22:37:13 UTC (rev 16656)
+++ trunk/hibernatetools/docs/reference/en/modules/reverseengineering.xml 2009-07-18 13:44:04 UTC (rev 16657)
@@ -2,12 +2,9 @@
<chapter id="reverseengineering">
<title>Controlling reverse engineering</title>
- <para>When using the <emphasis>
- <property><jdbcconfiguration></property>, </emphasis> the ant task will read the
+ <para>When using the <code><jdbcconfiguration></code>, the ant task will read the
database metadata and thus will perform a reverse engineering of the database schema into a
- normal Hibernate Configuration. It is from this object e.g. <emphasis>
- <property><hbm2java></property>
- </emphasis>can generate other artifacts such as <emphasis>
+ normal Hibernate Configuration. It is from this object e.g. <code><hbm2java></code>can generate other artifacts such as <emphasis>
<property>.java</property>
</emphasis>, <emphasis>
<property>.hbm.xml</property>
@@ -46,7 +43,7 @@
<note>
<title>Note:</title>
<para>Many databases are case-sensitive with their names and thus if you cannot make some
- table match and you are sure it is not excluded by a <table-filter> then check
+ table match and you are sure it is not excluded by a <code><table-filter></code> then check
if the case matches; most databases stores table names in uppercase.</para>
</note>
@@ -109,26 +106,19 @@
<section>
<title>Schema Selection (<schema-selection>)</title>
- <para><emphasis>
- <property><schema-selection></property>
- </emphasis> is used to drive which schemas the reverse engineering will try and
+ <para><code><schema-selection></code> is used to drive which schemas the reverse engineering will try and
process.</para>
- <para>By default the reverse engineering will read all schemas and then use <emphasis>
- <property><table-filter></property>
- </emphasis> to decide which tables get reverse engineered and which do not; this makes it
+ <para>By default the reverse engineering will read all schemas and then use <code><table-filter></code>
+ to decide which tables get reverse engineered and which do not; this makes it
easy to get started but can be inefficient on databases with many schemas.</para>
- <para>With <emphasis>
- <property><schema-selection></property>
- </emphasis> it is thus possible to limit the actual processed schemas and thus significantly
- speed-up the reverse engineering. <emphasis>
- <property><table-filter></property>
- </emphasis> is still used to then decide which tables will be included/excluded.</para>
+ <para>With <code><schema-selection></code> it is thus possible to limit the actual processed schemas and thus significantly
+ speed-up the reverse engineering. <code><table-filter></code> is still used to then decide which tables will be included/excluded.</para>
<note>
<title>Note:</title>
- <para>If no <literal><schema-selection></literal> is specified, the reverse
+ <para>If no <code><schema-selection></code> is specified, the reverse
engineering works as if all schemas should be processed. This is equal to:
<![CDATA[<schema-selection/>]]>. Which in turn is equal to:
<![CDATA[<schema-selection match-catalog=".*" match-schema=".*" match-table=".*"/>]]></para>
@@ -164,9 +154,7 @@
<section id="type_map">
<title>Type mappings (<type-mapping>)</title>
- <para>The <emphasis>
- <property><type-mapping></property>
- </emphasis> section specifies how the JDBC types found in the database should be mapped to
+ <para>The <code><type-mapping></code> section specifies how the JDBC types found in the database should be mapped to
Hibernate types. e.g. <emphasis>
<property>java.sql.Types.VARCHAR</property></emphasis> with a length of 1 should be mapped to the
Hibernate type <emphasis>
@@ -358,9 +346,8 @@
<section>
<title>Table filters (<table-filter>)</title>
- <para>The <emphasis>
- <property><table-filter></property>
- </emphasis> let you specify matching rules for performing general filtering/setup for
+ <para>The <code><table-filter></code>
+ let you specify matching rules for performing general filtering/setup for
tables, e.g. let you include or exclude specific tables based on the schema or even a
specific prefix.</para>
@@ -446,9 +433,8 @@
<section id="tab_and_col">
<title>Specific table configuration (<table>)</title>
- <para><emphasis>
- <property><table></property>
- </emphasis> allows you to provide explicit configuration on how a table should be reverse
+ <para><code><table></code>
+ allows you to provide explicit configuration on how a table should be reverse
engineered. Amongst other things it allows controlling over the naming of a class for the
table, specifying which identifier generator should be used for the primary key etc.</para>
@@ -531,9 +517,7 @@
<section>
<title><primary-key></title>
- <para>A <emphasis>
- <property><primary-key></property>
- </emphasis> allows you to define a primary-key for tables that don't have it
+ <para>A <code><primary-key></code> allows you to define a primary-key for tables that don't have it
defined in the database, and probably more importantly it allows you to define which
identifier strategy should be used (even for already existing primary-key's).</para>
@@ -605,9 +589,7 @@
<section>
<title><column></title>
- <para>With a <emphasis>
- <property><column></property>
- </emphasis> it is possible to explicitly name the resulting property for a column. It is
+ <para>With a <code><column></code> it is possible to explicitly name the resulting property for a column. It is
also possible to redefine what jdbc and/or Hibernate type a column should be processed as
and finally it is possible to completely exclude a column from processing.</para>
@@ -696,9 +678,8 @@
<section>
<title><foreign-key></title>
- <para>The <emphasis>
- <property><foreign-key></property>
- </emphasis> has two purposes. One for allowing to define foreign-keys in databases that
+ <para>The <code><foreign-key></code>
+ has two purposes. One for allowing to define foreign-keys in databases that
does not support them or does not have them defined in their schema. Secondly, to allow
defining the name of the resulting properties (many-to-one, one-to-one and one-to-many's).</para>
16 years, 9 months
JBoss Tools SVN: r16656 - trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-07-17 18:37:13 -0400 (Fri, 17 Jul 2009)
New Revision: 16656
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/ELExprPartitionerTest.java
Log:
JsfTextExtAllTests: The message for assert is prepared more accurately due to help to find the reason of problem.
Modified: trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/ELExprPartitionerTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/ELExprPartitionerTest.java 2009-07-17 18:14:20 UTC (rev 16655)
+++ trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/ELExprPartitionerTest.java 2009-07-17 22:37:13 UTC (rev 16656)
@@ -121,7 +121,7 @@
JSPExprHyperlinkPartitioner elPartitioner = new JSPExprHyperlinkPartitioner();
- HashMap<Object, ArrayList> recognitionTest = new HashMap<Object, ArrayList>();
+ HashMap<Object, ArrayList<Region>> recognitionTest = new HashMap<Object, ArrayList<Region>>();
ArrayList<Region> regionList = new ArrayList<Region>();
regionList.add(new Region(623, 16));
@@ -156,17 +156,39 @@
String childPartitionType = elPartitioner.getChildPartitionType(testData.document, testData.getHyperlinkRegion());
if (childPartitionType != null) {
- ArrayList test = (ArrayList)recognitionTest.get(childPartitionType);
+ ArrayList<Region> test = (ArrayList<Region>)recognitionTest.get(childPartitionType);
boolean testResult = false;
- Iterator regions = test.iterator();
+ Iterator<Region> regions = test.iterator();
Region r = null;
while (!testResult && regions.hasNext()) {
- r = (Region)regions.next();
+ r = regions.next();
if (r.getOffset() <= testData.offset && testData.offset < (r.getOffset() + r.getLength()))
testResult = true;
}
- assertTrue("Wrong recognition for the region: " + testData.getHyperlinkRegion().toString()
- + " doesn't matches the region [" + r.getOffset() + "-" + (r.getOffset() + r.getLength()) + "]" , testResult);
+ StringBuffer assertMessage = new StringBuffer();
+ assertMessage.append("Wrong recognition for the region #")
+ .append(i)
+ .append(": ")
+ .append(testData.getHyperlinkRegion().toString())
+ .append(" doesn't matches the regions for PARTITION_TYPE '")
+ .append(childPartitionType)
+ .append("' {");
+ boolean first = true;
+ for (Region reg : test) {
+ if (!first) {
+ assertMessage.append(", ");
+ } else {
+ first = false;
+ }
+ assertMessage.append("[")
+ .append(reg.getOffset())
+ .append("-")
+ .append(reg.getOffset() + reg.getLength())
+ .append("]");
+ }
+ assertMessage.append("}");
+
+ assertTrue(assertMessage.toString() , testResult);
counter++;
} else {
recognized = false;
16 years, 9 months
JBoss Tools SVN: r16654 - in trunk/bpel: plugins/org.eclipse.bpel.apache.ode.deploy.model/META-INF and 11 other directories.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2009-07-17 13:03:35 -0400 (Fri, 17 Jul 2009)
New Revision: 16654
Modified:
trunk/bpel/features/org.jboss.tools.bpel.feature/feature.xml
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.model/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.common.model/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.common.ui/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.model/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.runtimes/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.ui/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.validator/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.wsil.model/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.xpath10/META-INF/MANIFEST.MF
trunk/bpel/tests/org.eclipse.tools.bpel.ui.test/META-INF/MANIFEST.MF
Log:
https://jira.jboss.org/jira/browse/JBIDE-4502 add .qualifier to versions
Modified: trunk/bpel/features/org.jboss.tools.bpel.feature/feature.xml
===================================================================
--- trunk/bpel/features/org.jboss.tools.bpel.feature/feature.xml 2009-07-17 14:26:08 UTC (rev 16653)
+++ trunk/bpel/features/org.jboss.tools.bpel.feature/feature.xml 2009-07-17 17:03:35 UTC (rev 16654)
@@ -2,7 +2,7 @@
<feature
id="org.jboss.tools.bpel.feature"
label="%featureName"
- version="1.0.0"
+ version="1.0.0.qualifier"
provider-name="%providerName">
<description>
Modified: trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.model/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.model/META-INF/MANIFEST.MF 2009-07-17 14:26:08 UTC (rev 16653)
+++ trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.model/META-INF/MANIFEST.MF 2009-07-17 17:03:35 UTC (rev 16654)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: ODE Deploy Descriptor EMF Model
Bundle-SymbolicName: org.eclipse.bpel.apache.ode.deploy.model; singleton:=true
-Bundle-Version: 0.4.0
+Bundle-Version: 0.4.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
Modified: trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/META-INF/MANIFEST.MF 2009-07-17 14:26:08 UTC (rev 16653)
+++ trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/META-INF/MANIFEST.MF 2009-07-17 17:03:35 UTC (rev 16654)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: ODE Deploy Descriptor UI Plug-in
Bundle-SymbolicName: org.eclipse.bpel.apache.ode.deploy.ui; singleton:=true
-Bundle-Version: 0.4.0
+Bundle-Version: 0.4.0.qualifier
Bundle-Activator: org.eclipse.bpel.apache.ode.deploy.ui.Activator
Require-Bundle: org.eclipse.ui;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
Modified: trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/META-INF/MANIFEST.MF 2009-07-17 14:26:08 UTC (rev 16653)
+++ trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/META-INF/MANIFEST.MF 2009-07-17 17:03:35 UTC (rev 16654)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Apache ODE Runtime Plug-in
Bundle-SymbolicName: org.eclipse.bpel.apache.ode.runtime;singleton:=true
-Bundle-Version: 0.4.0
+Bundle-Version: 0.4.0.qualifier
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui;bundle-version="[3.4.0,4.0.0)",
Modified: trunk/bpel/plugins/org.eclipse.bpel.common.model/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.common.model/META-INF/MANIFEST.MF 2009-07-17 14:26:08 UTC (rev 16653)
+++ trunk/bpel/plugins/org.eclipse.bpel.common.model/META-INF/MANIFEST.MF 2009-07-17 17:03:35 UTC (rev 16654)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Extension Model (Incubation)
Bundle-SymbolicName: org.eclipse.bpel.common.model; singleton:=true
-Bundle-Version: 0.4.0
+Bundle-Version: 0.4.0.qualifier
Bundle-Activator: org.eclipse.bpel.common.extension.model.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
Modified: trunk/bpel/plugins/org.eclipse.bpel.common.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.common.ui/META-INF/MANIFEST.MF 2009-07-17 14:26:08 UTC (rev 16653)
+++ trunk/bpel/plugins/org.eclipse.bpel.common.ui/META-INF/MANIFEST.MF 2009-07-17 17:03:35 UTC (rev 16654)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Common UI (Incubation)
Bundle-SymbolicName: org.eclipse.bpel.common.ui; singleton:=true
-Bundle-Version: 0.4.0
+Bundle-Version: 0.4.0.qualifier
Bundle-Activator: org.eclipse.bpel.common.ui.CommonUIPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui;bundle-version="[3.4.0,4.0.0)",
Modified: trunk/bpel/plugins/org.eclipse.bpel.model/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/META-INF/MANIFEST.MF 2009-07-17 14:26:08 UTC (rev 16653)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/META-INF/MANIFEST.MF 2009-07-17 17:03:35 UTC (rev 16654)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: BPEL Model (Incubation)
Bundle-SymbolicName: org.eclipse.bpel.model; singleton:=true
-Bundle-Version: 0.4.0
+Bundle-Version: 0.4.0.qualifier
Bundle-Activator: org.eclipse.bpel.model.BPELPlugin$Implementation
Bundle-Vendor: eclipse.org
Bundle-Localization: plugin
Modified: trunk/bpel/plugins/org.eclipse.bpel.runtimes/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.runtimes/META-INF/MANIFEST.MF 2009-07-17 14:26:08 UTC (rev 16653)
+++ trunk/bpel/plugins/org.eclipse.bpel.runtimes/META-INF/MANIFEST.MF 2009-07-17 17:03:35 UTC (rev 16654)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.bpel.runtimes; singleton:=true
-Bundle-Version: 0.4.0
+Bundle-Version: 0.4.0.qualifier
Bundle-Activator: org.eclipse.bpel.runtimes.RuntimesPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui;bundle-version="[3.4.0,4.0.0)",
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/META-INF/MANIFEST.MF 2009-07-17 14:26:08 UTC (rev 16653)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/META-INF/MANIFEST.MF 2009-07-17 17:03:35 UTC (rev 16654)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: BPEL Editor (Incubation)
Bundle-SymbolicName: org.eclipse.bpel.ui; singleton:=true
-Bundle-Version: 0.4.0
+Bundle-Version: 0.4.0.qualifier
Bundle-Activator: org.eclipse.bpel.ui.BPELUIPlugin
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/META-INF/MANIFEST.MF 2009-07-17 14:26:08 UTC (rev 16653)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/META-INF/MANIFEST.MF 2009-07-17 17:03:35 UTC (rev 16654)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Validator Plug-in (Incubation)
Bundle-SymbolicName: org.eclipse.bpel.validator;singleton:=true
-Bundle-Version: 0.4.0
+Bundle-Version: 0.4.0.qualifier
Bundle-Activator: org.eclipse.bpel.validator.Activator
Bundle-Vendor: Eclipse
Bundle-Localization: plugin
Modified: trunk/bpel/plugins/org.eclipse.bpel.wsil.model/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.wsil.model/META-INF/MANIFEST.MF 2009-07-17 14:26:08 UTC (rev 16653)
+++ trunk/bpel/plugins/org.eclipse.bpel.wsil.model/META-INF/MANIFEST.MF 2009-07-17 17:03:35 UTC (rev 16654)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: WSIL Model (Incubation)
Bundle-SymbolicName: org.eclipse.bpel.wsil.model; singleton:=true
-Bundle-Version: 0.4.0
+Bundle-Version: 0.4.0.qualifier
Bundle-ClassPath: bin
Bundle-Vendor: eclispe.org
Bundle-Localization: plugin
Modified: trunk/bpel/plugins/org.eclipse.bpel.xpath10/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.xpath10/META-INF/MANIFEST.MF 2009-07-17 14:26:08 UTC (rev 16653)
+++ trunk/bpel/plugins/org.eclipse.bpel.xpath10/META-INF/MANIFEST.MF 2009-07-17 17:03:35 UTC (rev 16654)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: XPath Parser 1.0 (Incubation)
Bundle-SymbolicName: org.eclipse.bpel.xpath10
-Bundle-Version: 0.4.0
+Bundle-Version: 0.4.0.qualifier
Bundle-ClassPath: bin/,
lib/antlr-runtime-3.0.1.jar
Export-Package: org.antlr.runtime;uses:="org.antlr.runtime.tree",
Modified: trunk/bpel/tests/org.eclipse.tools.bpel.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/tests/org.eclipse.tools.bpel.ui.test/META-INF/MANIFEST.MF 2009-07-17 14:26:08 UTC (rev 16653)
+++ trunk/bpel/tests/org.eclipse.tools.bpel.ui.test/META-INF/MANIFEST.MF 2009-07-17 17:03:35 UTC (rev 16654)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: org.jboss.tools.bpel.ui.test
Bundle-SymbolicName: org.jboss.tools.bpel.ui.test
-Bundle-Version: 1.0.0
+Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.jboss.tools.bpel.ui.test.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
16 years, 9 months
JBoss Tools SVN: r16653 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui: src/org/jboss/tools/hibernate/ui/view and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-17 10:26:08 -0400 (Fri, 17 Jul 2009)
New Revision: 16653
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/plugin.xml
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4618 - fixed
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/plugin.xml 2009-07-17 14:07:32 UTC (rev 16652)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/plugin.xml 2009-07-17 14:26:08 UTC (rev 16653)
@@ -13,12 +13,19 @@
</extension>
<extension point="org.eclipse.ui.popupMenus">
- <objectContribution id="diagramEditorAction" objectClass="org.hibernate.mapping.PersistentClass">
- <menu id="org.jboss.tools.hibernate.ui.view.openDiagram" label="Open Mapping Diagram" path="diagramEditorAction"/>
+ <objectContribution id="diagramEditorAction" objectClass="java.lang.Object">
+ <visibility>
+ <or>
+ <objectClass name="org.hibernate.cfg.Configuration"/>
+ <objectClass name="org.hibernate.console.ConsoleConfiguration"/>
+ <objectClass name="org.hibernate.mapping.PersistentClass"/>
+ </or>
+ </visibility>
<action
id="org.jboss.tools.hibernate.ui.view.openDiagramAction"
- label="Open Mapping Diagram"
- icon="images/hibernate_small_icon.gif"
+ label="Mapping Diagram"
+ icon="images/hibernate_small_icon.gif"
+ menubarPath="group.primalEditors.last"
class="org.jboss.tools.hibernate.ui.view.OpenDiagramActionDelegate">
</action>
</objectContribution>
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java 2009-07-17 14:07:32 UTC (rev 16652)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java 2009-07-17 14:26:08 UTC (rev 16653)
@@ -26,7 +26,9 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.internal.ObjectPluginAction;
+import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.execution.ExecutionContext;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass;
@@ -44,22 +46,51 @@
public void selectionChanged(IAction action, ISelection selection) {
}
+ @SuppressWarnings("unchecked")
public void run(IAction action) {
ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
Map<ConsoleConfiguration, Set<PersistentClass>> mapCC_PCs = new HashMap<ConsoleConfiguration, Set<PersistentClass>>();
TreePath[] paths = ((TreeSelection)objectPluginAction.getSelection()).getPaths();
for (int i = 0; i < paths.length; i++) {
+ final Object firstSegment = paths[i].getFirstSegment();
+ if (!(firstSegment instanceof ConsoleConfiguration)) {
+ continue;
+ }
+ final ConsoleConfiguration consoleConfig = (ConsoleConfiguration)(firstSegment);
+ Set<PersistentClass> setPC = mapCC_PCs.get(consoleConfig);
+ if (null == setPC) {
+ setPC = new HashSet<PersistentClass>();
+ mapCC_PCs.put(consoleConfig, setPC);
+ }
Object last_el = paths[i].getLastSegment();
if (last_el instanceof PersistentClass) {
PersistentClass persClass = (PersistentClass) last_el;
- ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)(paths[i].getFirstSegment());
- Set<PersistentClass> setPC = mapCC_PCs.get(consoleConfiguration);
- if (null == setPC) {
- setPC = new HashSet<PersistentClass>();
- mapCC_PCs.put(consoleConfiguration, setPC);
+ setPC.add(persClass);
+ } else if (last_el instanceof Configuration) {
+ Configuration config = (Configuration)last_el;
+ Iterator<PersistentClass> it = (Iterator<PersistentClass>)(config.getClassMappings());
+ while (it.hasNext()) {
+ setPC.add(it.next());
}
- setPC.add(persClass);
- }
+ } else if (last_el instanceof ConsoleConfiguration) {
+ Configuration config = consoleConfig.getConfiguration();
+ if (config == null) {
+ consoleConfig.build();
+ consoleConfig.execute( new ExecutionContext.Command() {
+ public Object execute() {
+ if(consoleConfig.hasConfiguration()) {
+ consoleConfig.getConfiguration().buildMappings();
+ }
+ return consoleConfig;
+ }
+ } );
+ config = consoleConfig.getConfiguration();
+ }
+ Iterator<PersistentClass> it = (Iterator<PersistentClass>)(config.getClassMappings());
+ while (it.hasNext()) {
+ setPC.add(it.next());
+ }
+ }
}
for (Iterator<ConsoleConfiguration> it = mapCC_PCs.keySet().iterator(); it.hasNext(); ) {
ConsoleConfiguration consoleConfiguration = it.next();
16 years, 9 months