You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(22) |
Nov
(308) |
Dec
(131) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(369) |
Feb
(171) |
Mar
(236) |
Apr
(187) |
May
(218) |
Jun
(217) |
Jul
(127) |
Aug
(448) |
Sep
(270) |
Oct
(231) |
Nov
(422) |
Dec
(255) |
2004 |
Jan
(111) |
Feb
(73) |
Mar
(338) |
Apr
(351) |
May
(349) |
Jun
(495) |
Jul
(394) |
Aug
(1048) |
Sep
(499) |
Oct
(142) |
Nov
(269) |
Dec
(638) |
2005 |
Jan
(825) |
Feb
(1272) |
Mar
(593) |
Apr
(690) |
May
(950) |
Jun
(958) |
Jul
(767) |
Aug
(839) |
Sep
(525) |
Oct
(449) |
Nov
(585) |
Dec
(455) |
2006 |
Jan
(603) |
Feb
(656) |
Mar
(195) |
Apr
(114) |
May
(136) |
Jun
(100) |
Jul
(128) |
Aug
(68) |
Sep
(7) |
Oct
(1) |
Nov
(1) |
Dec
(8) |
2007 |
Jan
(4) |
Feb
(3) |
Mar
(8) |
Apr
(16) |
May
(5) |
Jun
(4) |
Jul
(6) |
Aug
(23) |
Sep
(15) |
Oct
(5) |
Nov
(7) |
Dec
(5) |
2008 |
Jan
(5) |
Feb
(1) |
Mar
(1) |
Apr
(5) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <max...@us...> - 2006-02-13 18:00:45
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22948/META-INF Modified Files: Tag: TOOLS_3_1_0_BETA4_branch MANIFEST.MF Log Message: bump version number for fixed beta4 with correct annotations lib Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/META-INF/MANIFEST.MF,v retrieving revision 1.31 retrieving revision 1.31.2.1 diff -u -d -r1.31 -r1.31.2.1 --- MANIFEST.MF 29 Jan 2006 18:25:19 -0000 1.31 +++ MANIFEST.MF 13 Feb 2006 18:00:34 -0000 1.31.2.1 @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Hibernate Core Plugin Bundle-SymbolicName: org.hibernate.eclipse -Bundle-Version: 3.1.0.beta4 +Bundle-Version: 3.1.0.beta4a Bundle-ClassPath: org.hibernate.eclipse.jar, lib/tools/hibernateconsole.jar, lib/hibernate/asm.jar, |
From: <max...@us...> - 2006-02-13 18:00:41
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.feature In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22874 Modified Files: Tag: TOOLS_3_1_0_BETA4_branch feature.xml Log Message: bump version number for fixed beta4 with correct annotations lib Index: feature.xml =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.feature/feature.xml,v retrieving revision 1.25 retrieving revision 1.25.2.1 diff -u -d -r1.25 -r1.25.2.1 --- feature.xml 29 Jan 2006 18:22:22 -0000 1.25 +++ feature.xml 13 Feb 2006 18:00:29 -0000 1.25.2.1 @@ -2,7 +2,7 @@ <feature id="org.hibernate.eclipse.feature" label="Hibernate Tools" - version="3.1.0.beta4" + version="3.1.0.beta4a" provider-name="Hibernate Team"> <description url="http://tools.hibernate.org"> @@ -452,116 +452,110 @@ id="org.eclipse.gef" download-size="0" install-size="0" - version="0.0.0" + version="3.1.1" unpack="false"/> <plugin id="org.eclipse.wst.sse.core" download-size="0" install-size="0" - version="0.0.0" + version="1.0.0" unpack="false"/> <plugin id="org.eclipse.wst.sse.ui" download-size="0" install-size="0" - version="0.0.0" + version="1.0.0" unpack="false"/> <plugin id="org.eclipse.wst.xml.core" download-size="0" install-size="0" - version="0.0.0" + version="1.0.0" unpack="false"/> <plugin id="org.eclipse.wst.xml.ui" download-size="0" install-size="0" - version="0.0.0" + version="1.0.0" unpack="false"/> <plugin id="org.eclipse.emf.common" download-size="0" install-size="0" - version="0.0.0" + version="2.1.0" unpack="false"/> <plugin id="org.eclipse.wst.common.frameworks" download-size="0" install-size="0" - version="0.0.0" + version="1.0.0" unpack="false"/> <plugin id="org.eclipse.wst.common.ui" download-size="0" install-size="0" - version="0.0.0" + version="1.0.0" unpack="false"/> <plugin id="org.eclipse.wst.common.uriresolver" download-size="0" install-size="0" - version="0.0.0" + version="1.0.0" unpack="false"/> <plugin id="org.eclipse.wst.validation" download-size="0" install-size="0" - version="0.0.0" + version="1.0.0" unpack="false"/> <plugin id="org.apache.xerces" download-size="0" install-size="0" - version="0.0.0"/> + version="2.7.0"/> <plugin id="org.eclipse.jem.util" download-size="0" install-size="0" - version="0.0.0"/> + version="1.1.0.1"/> <plugin id="org.eclipse.emf.ecore" download-size="0" install-size="0" - version="0.0.0" + version="2.1.0" unpack="false"/> <plugin id="org.eclipse.emf.ecore.xmi" download-size="0" install-size="0" - version="0.0.0" + version="2.1.0" unpack="false"/> <plugin id="org.eclipse.wst.dtd.core" download-size="0" install-size="0" - version="0.0.0" + version="1.0.0" unpack="false"/> <plugin id="org.hibernate.eclipse" download-size="0" install-size="0" - version="3.1.0.beta4"/> - - <plugin - id="org.hibernate.eclipse.console" - download-size="0" - install-size="0" - version="3.1.0.beta4"/> + version="3.1.0.beta4a"/> <plugin id="org.hibernate.eclipse.help" @@ -579,28 +573,34 @@ id="org.eclipse.draw2d" download-size="0" install-size="0" - version="0.0.0" + version="3.1.1" unpack="false"/> <plugin id="org.eclipse.wst.validation.ui" download-size="0" install-size="0" - version="0.0.0" + version="1.0.0" unpack="false"/> <plugin id="org.eclipse.wst.common.environment" download-size="0" install-size="0" - version="0.0.0" + version="1.0.0" unpack="false"/> <plugin id="org.eclipse.wst.common.frameworks.ui" download-size="0" install-size="0" - version="0.0.0" + version="1.0.0" unpack="false"/> + <plugin + id="org.hibernate.eclipse.console" + download-size="0" + install-size="0" + version="3.1.0.beta4"/> + </feature> |
From: <max...@us...> - 2006-02-13 17:52:57
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/lib/annotations In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20177/lib/annotations Modified Files: Tag: TOOLS_3_1_0_BETA4_branch hibernate-annotations.jar Log Message: fix annotations lib Index: hibernate-annotations.jar =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/lib/annotations/hibernate-annotations.jar,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -d -r1.7 -r1.7.2.1 Binary files /tmp/cvs9OBhKL and /tmp/cvsKTAl6e differ |
From: <ste...@us...> - 2006-02-13 16:57:31
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31018/src/org/hibernate/cache Modified Files: NonstrictReadWriteCache.java TransactionalCache.java Log Message: oops! Index: NonstrictReadWriteCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/cache/NonstrictReadWriteCache.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- NonstrictReadWriteCache.java 9 Feb 2006 20:48:42 -0000 1.9 +++ NonstrictReadWriteCache.java 13 Feb 2006 16:57:22 -0000 1.10 @@ -13,19 +13,20 @@ * version available in the database. Configure your cache timeout accordingly! * This is an "asynchronous" concurrency strategy. * - * @see ReadWriteCache for a much stricter algorithm * @author Gavin King + * @see ReadWriteCache for a much stricter algorithm */ public class NonstrictReadWriteCache implements CacheConcurrencyStrategy { private Cache cache; - private static final Log log = LogFactory.getLog(NonstrictReadWriteCache.class); + private static final Log log = LogFactory.getLog( NonstrictReadWriteCache.class ); - public NonstrictReadWriteCache() {} + public NonstrictReadWriteCache() { + } public void setCache(Cache cache) { - this.cache=cache; + this.cache = cache; } public Cache getCache() { @@ -36,14 +37,16 @@ * Get the most recent version, if available. */ public Object get(Object key, long txTimestamp) throws CacheException { - if ( log.isDebugEnabled() ) log.debug("Cache lookup: " + key); + if ( log.isDebugEnabled() ) { + log.debug( "Cache lookup: " + key ); + } - Object result = cache.get(key); - if ( result!=null ) { - log.debug("Cache hit"); + Object result = cache.get( key ); + if ( result != null ) { + log.debug( "Cache hit" ); } else { - log.debug("Cache miss"); + log.debug( "Cache miss" ); } return result; } @@ -52,26 +55,30 @@ * Add an item to the cache. */ public boolean put( - Object key, - Object value, - long txTimestamp, - Object version, - Comparator versionComparator, - boolean minimalPut) - throws CacheException { - if ( minimalPut && cache.get(key)!=null ) { - if ( log.isDebugEnabled() ) log.debug("item already cached: " + key); - return false; - } - if ( log.isDebugEnabled() ) log.debug("Caching: " + key); - - cache.put(key, value); + Object key, + Object value, + long txTimestamp, + Object version, + Comparator versionComparator, + boolean minimalPut) throws CacheException { + if ( minimalPut && cache.get( key ) != null ) { + if ( log.isDebugEnabled() ) { + log.debug( "item already cached: " + key ); + } + return false; + } + if ( log.isDebugEnabled() ) { + log.debug( "Caching: " + key ); + } + + cache.put( key, value ); return true; } /** * Do nothing. + * * @return null, no lock */ public SoftLock lock(Object key, Object version) throws CacheException { @@ -79,12 +86,16 @@ } public void remove(Object key) throws CacheException { - if ( log.isDebugEnabled() ) log.debug("Removing: " + key); - cache.remove(key); + if ( log.isDebugEnabled() ) { + log.debug( "Removing: " + key ); + } + cache.remove( key ); } public void clear() throws CacheException { - if ( log.isDebugEnabled() ) log.debug("Clearing"); + if ( log.isDebugEnabled() ) { + log.debug( "Clearing" ); + } cache.clear(); } @@ -92,8 +103,8 @@ try { cache.destroy(); } - catch (Exception e) { - log.warn("could not destroy cache", e); + catch ( Exception e ) { + log.warn( "could not destroy cache", e ); } } @@ -101,16 +112,17 @@ * Invalidate the item */ public void evict(Object key) throws CacheException { - if ( log.isDebugEnabled() ) log.debug("Invalidating: " + key); + if ( log.isDebugEnabled() ) { + log.debug( "Invalidating: " + key ); + } - cache.remove(key); + cache.remove( key ); } /** * Invalidate the item */ public boolean insert(Object key, Object value, Object currentVersion) { - evict(key); return false; } @@ -118,6 +130,7 @@ * Do nothing. */ public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) { + evict( key ); return false; } @@ -125,16 +138,18 @@ * Invalidate the item (again, for safety). */ public void release(Object key, SoftLock lock) throws CacheException { - if ( log.isDebugEnabled() ) log.debug("Invalidating (again): " + key); + if ( log.isDebugEnabled() ) { + log.debug( "Invalidating (again): " + key ); + } - cache.remove(key); + cache.remove( key ); } /** * Invalidate the item (again, for safety). */ public boolean afterUpdate(Object key, Object value, Object version, SoftLock lock) throws CacheException { - release(key, lock); + release( key, lock ); return false; } @@ -142,16 +157,13 @@ * Do nothing. */ public boolean afterInsert(Object key, Object value, Object version) throws CacheException { - //if ( log.isDebugEnabled() ) log.debug("Adding new: " + key); - - //cache.put(key, value); return false; } public String getRegionName() { return cache.getRegionName(); } - + public String toString() { return cache + "(nonstrict-read-write)"; } Index: TransactionalCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/cache/TransactionalCache.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- TransactionalCache.java 9 Feb 2006 20:48:42 -0000 1.11 +++ TransactionalCache.java 13 Feb 2006 16:57:22 -0000 1.12 @@ -11,43 +11,46 @@ * JBoss TreeCache. Note that this might be a less scalable * concurrency strategy than <tt>ReadWriteCache</tt>. This is * a "synchronous" concurrency strategy. - * + * * @author Gavin King */ public class TransactionalCache implements CacheConcurrencyStrategy { - - private static final Log log = LogFactory.getLog(TransactionalCache.class); + + private static final Log log = LogFactory.getLog( TransactionalCache.class ); private Cache cache; public String getRegionName() { return cache.getRegionName(); } - + public Object get(Object key, long txTimestamp) throws CacheException { - if ( log.isDebugEnabled() ) log.debug("cache lookup: " + key); - Object result = cache.read(key); if ( log.isDebugEnabled() ) { - log.debug( result==null ? "cache miss" : "cache hit" ); + log.debug( "cache lookup: " + key ); + } + Object result = cache.read( key ); + if ( log.isDebugEnabled() ) { + log.debug( result == null ? "cache miss" : "cache hit" ); } return result; } public boolean put( - Object key, - Object value, - long txTimestamp, - Object version, - Comparator versionComparator, - boolean minimalPut) - throws CacheException { - - if ( minimalPut && cache.read(key)!=null ) { - if ( log.isDebugEnabled() ) log.debug("item already cached: " + key); + Object key, + Object value, + long txTimestamp, + Object version, + Comparator versionComparator, + boolean minimalPut) throws CacheException { + if ( minimalPut && cache.read( key ) != null ) { + if ( log.isDebugEnabled() ) { + log.debug( "item already cached: " + key ); + } return false; } - if ( log.isDebugEnabled() ) log.debug("caching: " + key); -// cache.put(key, value); + if ( log.isDebugEnabled() ) { + log.debug( "caching: " + key ); + } if ( cache instanceof OptimisticCache ) { ( ( OptimisticCache ) cache ).writeLoad( key, value, version ); } @@ -72,9 +75,13 @@ //noop } - public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) { + public boolean update( + Object key, + Object value, + Object currentVersion, + Object previousVersion) throws CacheException { if ( log.isDebugEnabled() ) { - log.debug("updating: " + key); + log.debug( "updating: " + key ); } if ( cache instanceof OptimisticCache ) { ( ( OptimisticCache ) cache ).writeUpdate( key, value, currentVersion, previousVersion ); @@ -85,9 +92,12 @@ return true; } - public boolean insert(Object key, Object value, Object currentVersion) throws CacheException { + public boolean insert( + Object key, + Object value, + Object currentVersion) throws CacheException { if ( log.isDebugEnabled() ) { - log.debug("inserting: " + key); + log.debug( "inserting: " + key ); } if ( cache instanceof OptimisticCache ) { ( ( OptimisticCache ) cache ).writeInsert( key, value, currentVersion ); @@ -98,55 +108,19 @@ return true; } - public boolean update(Object key, Object value) throws CacheException { -// if ( log.isDebugEnabled() ) log.debug("updating: " + key); -// cache.update(key, value); -// return true; - if ( log.isDebugEnabled() ) { - log.debug("updating: " + key); - } - if ( cache instanceof OptimisticCache ) { - // todo : need to call writeUpdate() instead - // but that requires this method to take previous and current versions - // ( ( OptimisticCache ) cache ).writeUpdate( key, value, currentVersion, previousVersion ); - ( ( OptimisticCache ) cache ).update( key, value ); - } - else { - cache.update( key, value ); - } - return true; - } - - public boolean insert(Object key, Object value) throws CacheException { -// if ( log.isDebugEnabled() ) log.debug("inserting: " + key); -// cache.update(key, value); -// return true; - if ( log.isDebugEnabled() ) { - log.debug("inserting: " + key); - } - if ( cache instanceof OptimisticCache ) { - // todo : need to call writeInsert() instead - // but that requires this method to take current version - // ( ( OptimisticCache ) cache ).writeInsert( key, value, currentVersion ); - ( ( OptimisticCache ) cache ).update( key, value ); - } - else { - cache.update( key, value ); - } - return true; - } - public void evict(Object key) throws CacheException { - cache.remove(key); + cache.remove( key ); } public void remove(Object key) throws CacheException { - if ( log.isDebugEnabled() ) log.debug("removing: " + key); - cache.remove(key); + if ( log.isDebugEnabled() ) { + log.debug( "removing: " + key ); + } + cache.remove( key ); } public void clear() throws CacheException { - log.debug("clearing"); + log.debug( "clearing" ); cache.clear(); } @@ -154,8 +128,8 @@ try { cache.destroy(); } - catch (Exception e) { - log.warn("could not destroy cache", e); + catch ( Exception e ) { + log.warn( "could not destroy cache", e ); } } @@ -170,19 +144,24 @@ /** * Do nothing. */ - public boolean afterInsert(Object key, Object value, Object version) - throws CacheException { + public boolean afterInsert( + Object key, + Object value, + Object version) throws CacheException { return false; } /** * Do nothing. */ - public boolean afterUpdate(Object key, Object value, Object version, SoftLock clientLock) - throws CacheException { + public boolean afterUpdate( + Object key, + Object value, + Object version, + SoftLock clientLock) throws CacheException { return false; } - + public String toString() { return cache + "(transactional)"; } |
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/registry In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9600/src/org/hibernate/eclipse/mapper/registry Modified Files: AdapterFactoryProviderForREVENGXML.java AdapterFactoryProviderForHBMXML.java Log Message: fix license issues Index: AdapterFactoryProviderForREVENGXML.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/registry/AdapterFactoryProviderForREVENGXML.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- AdapterFactoryProviderForREVENGXML.java 8 Jun 2005 10:39:28 -0000 1.3 +++ AdapterFactoryProviderForREVENGXML.java 13 Feb 2006 15:56:00 -0000 1.4 @@ -6,10 +6,6 @@ public class AdapterFactoryProviderForREVENGXML extends AdapterFactoryProviderForXML { - public AdapterFactoryProviderForREVENGXML() { - - } - public boolean isFor(IDocumentTypeHandler contentTypeDescription) { return (contentTypeDescription instanceof ModelHandlerForREVENGXML); } Index: AdapterFactoryProviderForHBMXML.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/registry/AdapterFactoryProviderForHBMXML.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- AdapterFactoryProviderForHBMXML.java 9 Jul 2005 22:31:44 -0000 1.6 +++ AdapterFactoryProviderForHBMXML.java 13 Feb 2006 15:56:00 -0000 1.7 @@ -10,7 +10,7 @@ * @see AdapterFactoryProvider#isFor(ContentTypeDescription) */ public boolean isFor(IDocumentTypeHandler contentTypeDescription) { - if(contentTypeDescription.getId().equals(ModelHandlerForHBMXML.ModelHandlerID)) { + if(contentTypeDescription.getId().equals(ModelHandlerForHBMXML.MODELHANDLER_ID)) { return true; } else { return false; |
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9600/src/org/hibernate/eclipse/mapper/editors/reveng Modified Files: TablePropertiesBlock.java TypeMappingView.java IFormTextEntryListener.java FormTextEntryListenerAdapter.java ColumnDetailsPage.java GeneratorDetailsPage.java ParamDetailsPage.java TableDetailsPage.java Removed Files: FormTextEntry.java Log Message: fix license issues Index: TablePropertiesBlock.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/TablePropertiesBlock.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TablePropertiesBlock.java 7 Oct 2005 10:26:25 -0000 1.3 +++ TablePropertiesBlock.java 13 Feb 2006 15:55:59 -0000 1.4 @@ -36,9 +36,9 @@ import org.hibernate.eclipse.console.model.IRevEngColumn; import org.hibernate.eclipse.console.model.IRevEngTable; import org.hibernate.eclipse.console.model.IReverseEngineeringDefinition; -import org.hibernate.eclipse.console.workbench.AnyAdaptableLabelProvider; import org.hibernate.eclipse.console.workbench.DeferredContentProvider; import org.hibernate.eclipse.console.workbench.LazyDatabaseSchema; +import org.hibernate.eclipse.console.workbench.xpl.AnyAdaptableLabelProvider; import org.hibernate.eclipse.mapper.editors.ReverseEngineeringEditor; import org.hibernate.eclipse.mapper.model.RevEngColumnAdapter; import org.hibernate.eclipse.mapper.model.RevEngGeneratorAdapter; Index: TypeMappingView.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/TypeMappingView.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- TypeMappingView.java 7 Feb 2006 16:17:59 -0000 1.7 +++ TypeMappingView.java 13 Feb 2006 15:55:59 -0000 1.8 @@ -20,9 +20,9 @@ import org.hibernate.eclipse.console.wizards.TypeMappingCellModifier; import org.hibernate.eclipse.console.wizards.TypeMappingContentProvider; import org.hibernate.eclipse.console.wizards.TypeMappingLabelProvider; -import org.hibernate.eclipse.console.workbench.AnyAdaptableLabelProvider; import org.hibernate.eclipse.console.workbench.DeferredContentProvider; import org.hibernate.eclipse.console.workbench.LazyDatabaseSchema; +import org.hibernate.eclipse.console.workbench.xpl.AnyAdaptableLabelProvider; import org.hibernate.mapping.Column; import org.hibernate.mapping.PrimaryKey; Index: IFormTextEntryListener.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/IFormTextEntryListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IFormTextEntryListener.java 23 Sep 2005 15:50:31 -0000 1.1 +++ IFormTextEntryListener.java 13 Feb 2006 15:55:59 -0000 1.2 @@ -1,6 +1,7 @@ package org.hibernate.eclipse.mapper.editors.reveng; import org.eclipse.ui.forms.events.IHyperlinkListener; +import org.hibernate.eclipse.mapper.editors.reveng.xpl.FormTextEntry; public interface IFormTextEntryListener extends IHyperlinkListener { /** Index: FormTextEntryListenerAdapter.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/FormTextEntryListenerAdapter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FormTextEntryListenerAdapter.java 23 Sep 2005 15:50:31 -0000 1.1 +++ FormTextEntryListenerAdapter.java 13 Feb 2006 15:55:59 -0000 1.2 @@ -1,6 +1,7 @@ package org.hibernate.eclipse.mapper.editors.reveng; import org.eclipse.ui.forms.events.HyperlinkEvent; +import org.hibernate.eclipse.mapper.editors.reveng.xpl.FormTextEntry; public class FormTextEntryListenerAdapter implements IFormTextEntryListener { Index: ColumnDetailsPage.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/ColumnDetailsPage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ColumnDetailsPage.java 23 Sep 2005 15:50:31 -0000 1.1 +++ ColumnDetailsPage.java 13 Feb 2006 15:55:59 -0000 1.2 @@ -16,6 +16,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; import org.hibernate.eclipse.console.model.IRevEngColumn; +import org.hibernate.eclipse.mapper.editors.reveng.xpl.FormTextEntry; public class ColumnDetailsPage extends RevEngDetailsPage implements IDetailsPage, PropertyChangeListener { Index: GeneratorDetailsPage.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/GeneratorDetailsPage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- GeneratorDetailsPage.java 7 Oct 2005 10:26:25 -0000 1.1 +++ GeneratorDetailsPage.java 13 Feb 2006 15:55:59 -0000 1.2 @@ -12,6 +12,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; import org.hibernate.eclipse.console.model.IRevEngGenerator; +import org.hibernate.eclipse.mapper.editors.reveng.xpl.FormTextEntry; public class GeneratorDetailsPage extends RevEngDetailsPage implements IDetailsPage, PropertyChangeListener { Index: ParamDetailsPage.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/ParamDetailsPage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ParamDetailsPage.java 7 Oct 2005 10:26:25 -0000 1.1 +++ ParamDetailsPage.java 13 Feb 2006 15:55:59 -0000 1.2 @@ -12,6 +12,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; import org.hibernate.eclipse.console.model.IRevEngParameter; +import org.hibernate.eclipse.mapper.editors.reveng.xpl.FormTextEntry; public class ParamDetailsPage extends RevEngDetailsPage implements IDetailsPage, PropertyChangeListener { Index: TableDetailsPage.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/TableDetailsPage.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- TableDetailsPage.java 7 Feb 2006 16:17:59 -0000 1.4 +++ TableDetailsPage.java 13 Feb 2006 15:55:59 -0000 1.5 @@ -15,6 +15,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; import org.hibernate.eclipse.console.model.IRevEngTable; +import org.hibernate.eclipse.mapper.editors.reveng.xpl.FormTextEntry; public class TableDetailsPage extends RevEngDetailsPage implements IDetailsPage, PropertyChangeListener { --- FormTextEntry.java DELETED --- |
From: <max...@us...> - 2006-02-13 15:56:22
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9600/src/org/hibernate/eclipse/mapper/editors Modified Files: ReverseEngineeringEditor.java HibernateContentAssistProcessor.java HBMXMLStructuredTextViewerConfiguration.java ReverseEngineeringEditorContributor.java HBMXMLHyperlinkDetector.java Removed Files: XMLFormEditorPart.java Log Message: fix license issues Index: ReverseEngineeringEditor.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ReverseEngineeringEditor.java 7 Feb 2006 16:17:59 -0000 1.12 +++ ReverseEngineeringEditor.java 13 Feb 2006 15:55:59 -0000 1.13 @@ -29,6 +29,7 @@ import org.hibernate.eclipse.mapper.editors.reveng.RevEngTableFilterPage; import org.hibernate.eclipse.mapper.editors.reveng.RevEngTablesPage; import org.hibernate.eclipse.mapper.editors.reveng.RevEngTypeMappingPage; +import org.hibernate.eclipse.mapper.editors.xpl.XMLFormEditorPart; import org.hibernate.eclipse.mapper.model.DOMReverseEngineeringDefinition; import org.hibernate.eclipse.nature.HibernateNature; import org.w3c.dom.Document; Index: HibernateContentAssistProcessor.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/HibernateContentAssistProcessor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- HibernateContentAssistProcessor.java 29 Nov 2005 17:24:08 -0000 1.5 +++ HibernateContentAssistProcessor.java 13 Feb 2006 15:55:59 -0000 1.6 @@ -1,21 +1,10 @@ package org.hibernate.eclipse.mapper.editors; -import java.util.Iterator; -import java.util.List; - import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; -import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentAssistProcessor; - -public abstract class HibernateContentAssistProcessor extends XMLContentAssistProcessor { +import org.hibernate.eclipse.mapper.editors.xpl.BaseXMLContentAssistProcessor; +public abstract class HibernateContentAssistProcessor extends BaseXMLContentAssistProcessor { public HibernateContentAssistProcessor() { @@ -25,54 +14,4 @@ return CFGXMLStructuredTextViewerConfiguration.findJavaProject(contentAssistRequest); } - protected void addAttributeValueProposals(ContentAssistRequest contentAssistRequest) { - super.addAttributeValueProposals(contentAssistRequest); - - IDOMNode node = (IDOMNode) contentAssistRequest.getNode(); - - // Find the attribute region and name for which this position should have a value proposed - IStructuredDocumentRegion open = node.getFirstStructuredDocumentRegion(); - ITextRegionList openRegions = open.getRegions(); - int i = openRegions.indexOf(contentAssistRequest.getRegion() ); - if (i < 0) - return; - ITextRegion nameRegion = null; - while (i >= 0) { - nameRegion = openRegions.get(i--); - if (nameRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) - break; - } - - String matchString = contentAssistRequest.getMatchString(); - int offset = contentAssistRequest.getReplacementBeginPosition(); - if (matchString == null) { - matchString = ""; //$NON-NLS-1$ - } - if (matchString.length() > 0 && (matchString.startsWith("\"") || matchString.startsWith("'") ) ) {//$NON-NLS-2$//$NON-NLS-1$ - matchString = matchString.substring(1); - offset = offset+1; - } - - if (nameRegion != null) { - String attributeName = open.getText(nameRegion); - - List attributeValueProposals = getAttributeValueProposals(attributeName, matchString, offset, contentAssistRequest); - if(attributeValueProposals!=null) { - for (Iterator iter = attributeValueProposals.iterator(); iter.hasNext();) { - ICompletionProposal element = (ICompletionProposal) iter.next(); - contentAssistRequest.addProposal(element); - } - } - - } - - } - - abstract protected List getAttributeValueProposals(String attributeName, String matchString, int offset, ContentAssistRequest contentAssistRequest); - - public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { - return super.computeCompletionProposals(viewer, offset); - - } - } Index: HBMXMLStructuredTextViewerConfiguration.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/HBMXMLStructuredTextViewerConfiguration.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- HBMXMLStructuredTextViewerConfiguration.java 7 Feb 2006 16:17:59 -0000 1.9 +++ HBMXMLStructuredTextViewerConfiguration.java 13 Feb 2006 15:55:59 -0000 1.10 @@ -1,7 +1,9 @@ package org.hibernate.eclipse.mapper.editors; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.text.hyperlink.IHyperlinkDetector; @@ -14,34 +16,44 @@ public class HBMXMLStructuredTextViewerConfiguration extends StructuredTextViewerConfigurationXML { - protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) { - IContentAssistProcessor[] processors = null; - - if ((partitionType == IStructuredPartitionTypes.DEFAULT_PARTITION) || (partitionType == IXMLPartitions.XML_DEFAULT)) { - processors = new IContentAssistProcessor[]{new HBMXMLContentAssistProcessor()}; // TODO: return cached one ? - } - else if (partitionType == IStructuredPartitionTypes.UNKNOWN_PARTITION) { - processors = new IContentAssistProcessor[]{new NoRegionContentAssistProcessor()}; - } + static Map partitionToContentAssist = new HashMap(); + static { + IContentAssistProcessor[] contentAssistProcessor = new IContentAssistProcessor[] { new HBMXMLContentAssistProcessor() }; + partitionToContentAssist.put(IStructuredPartitionTypes.DEFAULT_PARTITION, contentAssistProcessor); + partitionToContentAssist.put(IXMLPartitions.XML_DEFAULT, contentAssistProcessor); - return processors; + contentAssistProcessor = new IContentAssistProcessor[] { new NoRegionContentAssistProcessor() }; + partitionToContentAssist.put(IStructuredPartitionTypes.UNKNOWN_PARTITION, contentAssistProcessor ); + } + + protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) { + return (IContentAssistProcessor[]) partitionToContentAssist.get(partitionType); } public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { - if (sourceViewer == null || !fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED) ) + if (sourceViewer == null || hyperLinksEnabled() ) { return null; + } - List allDetectors = new ArrayList(0); - allDetectors.add(new HBMXMLHyperlinkDetector() ); + IHyperlinkDetector[] baseDetectors = super.getHyperlinkDetectors(sourceViewer); + HBMXMLHyperlinkDetector hyperlinkDetector = new HBMXMLHyperlinkDetector(); - IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer); - for (int m = 0; m < superDetectors.length; m++) { - IHyperlinkDetector detector = superDetectors[m]; - if (!allDetectors.contains(detector) ) { - allDetectors.add(detector); + if(baseDetectors==null || baseDetectors.length==0) { + return new IHyperlinkDetector[] { hyperlinkDetector }; + } else { + IHyperlinkDetector[] result = new IHyperlinkDetector[baseDetectors.length+1]; + result[0] = hyperlinkDetector; + for (int i = 0; i < baseDetectors.length; i++) { + result[i+1] = baseDetectors[i]; } + return result; } - return (IHyperlinkDetector[]) allDetectors.toArray(new IHyperlinkDetector[0]); + + } + + + private boolean hyperLinksEnabled() { + return !fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED); } } Index: ReverseEngineeringEditorContributor.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditorContributor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ReverseEngineeringEditorContributor.java 29 Nov 2005 17:24:08 -0000 1.2 +++ ReverseEngineeringEditorContributor.java 13 Feb 2006 15:55:59 -0000 1.3 @@ -1,207 +1,17 @@ package org.hibernate.eclipse.mapper.editors; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorActionBarContributor; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.part.MultiPageEditorActionBarContributor; -import org.eclipse.wst.sse.ui.StructuredTextEditor; -import org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder; -import org.eclipse.wst.sse.ui.internal.IExtendedContributor; -import org.eclipse.wst.sse.ui.internal.ISourceViewerActionBarContributor; -import org.eclipse.wst.xml.ui.internal.tabletree.IDesignViewerActionBarContributor; -import org.eclipse.wst.xml.ui.internal.tabletree.SourcePageActionContributor; -import org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart; +import org.hibernate.eclipse.mapper.editors.reveng.xpl.MultiPageEditorContributor; /** * Manages the installation/deinstallation of global actions for multi-page editors. * Responsible for the redirection of global actions to the active editor. * Multi-page contributor replaces the contributors for the individual editors in the multi-page editor. */ -public class ReverseEngineeringEditorContributor extends MultiPageEditorActionBarContributor { - protected IEditorActionBarContributor designViewerActionBarContributor = null; - protected IEditorActionBarContributor sourceViewerActionContributor = null; - protected XMLMultiPageEditorPart multiPageEditor = null; - - // EditorExtension +public class ReverseEngineeringEditorContributor extends MultiPageEditorContributor { + private static final String EDITOR_ID = "org.hibernate.eclipse.mapper.editors.ReverseEngineeringEditor"; //$NON-NLS-1$ - private IExtendedContributor extendedContributor; - + public ReverseEngineeringEditorContributor() { - super(); - - sourceViewerActionContributor = new SourcePageActionContributor(); - - // Read action extensions. - ExtendedEditorActionBuilder builder = new ExtendedEditorActionBuilder(); - extendedContributor = builder.readActionExtensions(EDITOR_ID); - } - - public void init(IActionBars actionBars) { - super.init(actionBars); - - if (actionBars != null) { - initDesignViewerActionBarContributor(actionBars); - initSourceViewerActionContributor(actionBars); - } - } - - protected void initDesignViewerActionBarContributor(IActionBars actionBars) { - if (designViewerActionBarContributor != null) - designViewerActionBarContributor.init(actionBars, getPage() ); - } - - protected void initSourceViewerActionContributor(IActionBars actionBars) { - if (sourceViewerActionContributor != null) - sourceViewerActionContributor.init(actionBars, getPage() ); - } - - public void dispose() { - super.dispose(); - - if (designViewerActionBarContributor != null) - designViewerActionBarContributor.dispose(); - - if (sourceViewerActionContributor != null) - sourceViewerActionContributor.dispose(); - - if (extendedContributor != null) - extendedContributor.dispose(); - } - - /** - * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToMenu(IMenuManager) - */ - public final void contributeToMenu(IMenuManager menu) { - super.contributeToMenu(menu); - - addToMenu(menu); - - if (extendedContributor != null) - extendedContributor.contributeToMenu(menu); - } - - protected void addToMenu(IMenuManager menu) { - } - - /** - * @see IExtendedContributor#contributeToPopupMenu(IMenuManager) - */ - public final void contributeToPopupMenu(IMenuManager menu) { - - addToPopupMenu(menu); - - if (extendedContributor != null) - extendedContributor.contributeToPopupMenu(menu); - } - - protected void addToPopupMenu(IMenuManager menu) { - } - - /** - * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToToolBar(IToolBarManager) - */ - public final void contributeToToolBar(IToolBarManager toolBarManager) { - super.contributeToToolBar(toolBarManager); - - addToToolBar(toolBarManager); - - if (extendedContributor != null) - extendedContributor.contributeToToolBar(toolBarManager); - } - - protected void addToToolBar(IToolBarManager toolBarManager) { - } - - /** - * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToStatusLine(IStatusLineManager) - */ - public final void contributeToStatusLine(IStatusLineManager manager) { - super.contributeToStatusLine(manager); - - addToStatusLine(manager); - - if (extendedContributor != null) - extendedContributor.contributeToStatusLine(manager); - } - - protected void addToStatusLine(IStatusLineManager manager) { - } - - /** - * @see IExtendedContributor#updateToolbarActions() - */ - public void updateToolbarActions() { - if (extendedContributor != null) - extendedContributor.updateToolbarActions(); - } - - public void setActiveEditor(IEditorPart targetEditor) { - // save multiPageEditor before calling - // super.setActiveEditor(targetEditor) - // super.setActiveEditor will call setActivePage(IEditorPart - // activeEditor) - // multiPageEditor is needed in setActivePage(IEditorPart - // activeEditor) - if (targetEditor instanceof XMLMultiPageEditorPart) - multiPageEditor = (XMLMultiPageEditorPart) targetEditor; - - super.setActiveEditor(targetEditor); - - updateToolbarActions(); - - if (extendedContributor != null) - extendedContributor.setActiveEditor(targetEditor); - } - - public void setActivePage(IEditorPart activeEditor) { - // This contributor is designed for StructuredTextMultiPageEditorPart. - // To safe-guard this from problems caused by unexpected usage by - // other editors, the following - // check is added. - if (multiPageEditor != null) { - if (activeEditor != null && activeEditor instanceof StructuredTextEditor) - activateSourcePage(activeEditor); - else - activateDesignPage(activeEditor); - } - - updateToolbarActions(); - - IActionBars actionBars = getActionBars(); - if (actionBars != null) { - // update menu bar and tool bar - actionBars.updateActionBars(); - } - } - - protected void activateDesignPage(IEditorPart activeEditor) { - if (designViewerActionBarContributor != null && designViewerActionBarContributor instanceof IDesignViewerActionBarContributor) { - designViewerActionBarContributor.setActiveEditor(multiPageEditor); - } - - if (sourceViewerActionContributor != null && sourceViewerActionContributor instanceof ISourceViewerActionBarContributor) { - // if design page is not really an IEditorPart, activeEditor == - // null, so pass in multiPageEditor instead (d282414) - if (activeEditor == null) { - sourceViewerActionContributor.setActiveEditor(multiPageEditor); - } else { - sourceViewerActionContributor.setActiveEditor(activeEditor); - } - ( (ISourceViewerActionBarContributor) sourceViewerActionContributor).setViewerSpecificContributionsEnabled(false); - } - } - - protected void activateSourcePage(IEditorPart activeEditor) { - if (designViewerActionBarContributor != null && designViewerActionBarContributor instanceof IDesignViewerActionBarContributor) { - designViewerActionBarContributor.setActiveEditor(multiPageEditor); - } - - if (sourceViewerActionContributor != null && sourceViewerActionContributor instanceof ISourceViewerActionBarContributor) { - sourceViewerActionContributor.setActiveEditor(activeEditor); - ( (ISourceViewerActionBarContributor) sourceViewerActionContributor).setViewerSpecificContributionsEnabled(true); - } + super(EDITOR_ID); } } Index: HBMXMLHyperlinkDetector.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/HBMXMLHyperlinkDetector.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- HBMXMLHyperlinkDetector.java 7 Feb 2006 16:17:59 -0000 1.8 +++ HBMXMLHyperlinkDetector.java 13 Feb 2006 15:55:59 -0000 1.9 @@ -5,40 +5,26 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.Region; import org.eclipse.jface.text.hyperlink.IHyperlink; import org.eclipse.jface.text.hyperlink.IHyperlinkDetector; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; -import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.util.StringUtils; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; +import org.hibernate.eclipse.mapper.editors.xpl.BaseXMLHyperlinkSupport; import org.hibernate.eclipse.mapper.extractor.HBMInfoExtractor; import org.hibernate.eclipse.mapper.extractor.HBMInfoHandler; import org.w3c.dom.Attr; -import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** * hyper link detector for hbm.xml */ -public class HBMXMLHyperlinkDetector implements IHyperlinkDetector { +public class HBMXMLHyperlinkDetector extends BaseXMLHyperlinkSupport implements IHyperlinkDetector { HBMInfoExtractor infoExtractor = new HBMInfoExtractor(); - /** - * Creates a new hbm.xml element hyperlink detector. - * - */ public HBMXMLHyperlinkDetector() { } - /* - * @see org.eclipse.jface.text.hyperlink.IHyperlinkDetector#detectHyperlinks(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion, boolean) - */ public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { if (region == null || textViewer == null) { return null; @@ -77,78 +63,4 @@ return null; } - - private IRegion getHyperlinkRegion(Node node) { - IRegion hyperRegion = null; - - if (node != null) { - short nodeType = node.getNodeType(); - if (nodeType == Node.DOCUMENT_TYPE_NODE) { - // handle doc type node - IDOMNode docNode = (IDOMNode) node; - hyperRegion = new Region(docNode.getStartOffset(), docNode.getEndOffset() - docNode.getStartOffset() ); - } - else if (nodeType == Node.ATTRIBUTE_NODE) { - // handle attribute nodes - IDOMAttr att = (IDOMAttr) node; - // do not include quotes in attribute value region - int regOffset = att.getValueRegionStartOffset(); - int regLength = att.getValueRegion().getTextLength(); - String attValue = att.getValueRegionText(); - if (StringUtils.isQuoted(attValue) ) { - regOffset = ++regOffset; - regLength = regLength - 2; - } - hyperRegion = new Region(regOffset, regLength); - } - } - return hyperRegion; - } - - private Attr getCurrentAttrNode(Node node, int offset) { - if ( (node instanceof IndexedRegion) && ( (IndexedRegion) node).contains(offset) && (node.hasAttributes() ) ) { - NamedNodeMap attrs = node.getAttributes(); - // go through each attribute in node and if attribute contains - // offset, return that attribute - for (int i = 0; i < attrs.getLength(); ++i) { - // assumption that if parent node is of type IndexedRegion, - // then its attributes will also be of type IndexedRegion - IndexedRegion attRegion = (IndexedRegion) attrs.item(i); - if (attRegion.contains(offset) ) { - return (Attr) attrs.item(i); - } - } - } - return null; - } - - - /** - * Returns the node the cursor is currently on in the document. null if no - * node is selected - * - * @param offset - * @return Node either element, doctype, text, or null - */ - private Node getCurrentNode(IDocument document, int offset) { - // get the current node at the offset (returns either: element, - // doctype, text) - IndexedRegion inode = null; - IStructuredModel sModel = null; - try { - sModel = StructuredModelManager.getModelManager().getExistingModelForRead(document); - inode = sModel.getIndexedRegion(offset); - if (inode == null) - inode = sModel.getIndexedRegion(offset - 1); - } - finally { - if (sModel != null) - sModel.releaseFromRead(); - } - - if (inode instanceof Node) { - return (Node) inode; - } - return null; - } } --- XMLFormEditorPart.java DELETED --- |
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/modelhandler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9600/src/org/hibernate/eclipse/mapper/modelhandler Modified Files: ModelHandlerForREVENGXML.java ModelHandlerForCFGXML.java ModelHandlerForHBMXML.java Log Message: fix license issues Index: ModelHandlerForREVENGXML.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/modelhandler/ModelHandlerForREVENGXML.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ModelHandlerForREVENGXML.java 12 May 2005 09:13:22 -0000 1.1 +++ ModelHandlerForREVENGXML.java 13 Feb 2006 15:55:59 -0000 1.2 @@ -14,21 +14,13 @@ * Provides hbm.xml model handling. */ public class ModelHandlerForREVENGXML extends AbstractModelHandler implements IModelHandler { - /** - * Needs to match what's in plugin registry. In fact, can be overwritten - * at run time with what's in registry! (so should never be 'final') - */ - static String AssociatedContentTypeID = "org.hibernate.eclipse.mapper.content-type.reveng.xml"; //$NON-NLS-1$ - /** - * Needs to match what's in plugin registry. In fact, can be overwritten - * at run time with what's in registry! (so should never be 'final') - */ - private static String ModelHandlerID = "org.hibernate.eclipse.mapper.handler.reveng.xml"; //$NON-NLS-1$ + final static String CONTENTTYPE_ID = "org.hibernate.eclipse.mapper.content-type.reveng.xml"; //$NON-NLS-1$ + final static String MODELHANDLER_ID = "org.hibernate.eclipse.mapper.handler.reveng.xml"; //$NON-NLS-1$ public ModelHandlerForREVENGXML() { super(); - setId(ModelHandlerID); - setAssociatedContentTypeId(AssociatedContentTypeID); + setId(MODELHANDLER_ID); + setAssociatedContentTypeId(CONTENTTYPE_ID); } public IDocumentCharsetDetector getEncodingDetector() { @@ -42,5 +34,4 @@ public IModelLoader getModelLoader() { return new XMLModelLoader(); } - } Index: ModelHandlerForCFGXML.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/modelhandler/ModelHandlerForCFGXML.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ModelHandlerForCFGXML.java 3 May 2005 11:56:52 -0000 1.3 +++ ModelHandlerForCFGXML.java 13 Feb 2006 15:55:59 -0000 1.4 @@ -16,21 +16,14 @@ * Provides hbm.xml model handling. */ public class ModelHandlerForCFGXML extends AbstractModelHandler implements IModelHandler { - /** - * Needs to match what's in plugin registry. In fact, can be overwritten - * at run time with what's in registry! (so should never be 'final') - */ - static String AssociatedContentTypeID = "org.hibernate.eclipse.mapper.content-type.cfg.xml"; //$NON-NLS-1$ - /** - * Needs to match what's in plugin registry. In fact, can be overwritten - * at run time with what's in registry! (so should never be 'final') - */ - private static String ModelHandlerID = "org.hibernate.eclipse.mapper.handler.cfg.xml"; //$NON-NLS-1$ + + final static String CONTENTTYPE_ID = "org.hibernate.eclipse.mapper.content-type.cfg.xml"; //$NON-NLS-1$ + final private static String MODELHANDLER_ID = "org.hibernate.eclipse.mapper.handler.cfg.xml"; //$NON-NLS-1$ public ModelHandlerForCFGXML() { super(); - setId(ModelHandlerID); - setAssociatedContentTypeId(AssociatedContentTypeID); + setId(MODELHANDLER_ID); + setAssociatedContentTypeId(CONTENTTYPE_ID); } public IDocumentCharsetDetector getEncodingDetector() { @@ -44,5 +37,4 @@ public IModelLoader getModelLoader() { return new XMLModelLoader(); } - } Index: ModelHandlerForHBMXML.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/modelhandler/ModelHandlerForHBMXML.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ModelHandlerForHBMXML.java 9 Jul 2005 22:31:45 -0000 1.4 +++ ModelHandlerForHBMXML.java 13 Feb 2006 15:55:59 -0000 1.5 @@ -9,27 +9,17 @@ import org.eclipse.wst.xml.core.internal.encoding.XMLDocumentLoader; import org.eclipse.wst.xml.core.internal.modelhandler.XMLModelLoader; - - /** * Provides hbm.xml model handling. */ public class ModelHandlerForHBMXML extends AbstractModelHandler implements IModelHandler { - /** - * Needs to match what's in plugin registry. In fact, can be overwritten - * at run time with what's in registry! (so should never be 'final') - */ - public static String AssociatedContentTypeID = "org.hibernate.eclipse.mapper.content-type.hbm.xml"; //$NON-NLS-1$ - /** - * Needs to match what's in plugin registry. In fact, can be overwritten - * at run time with what's in registry! (so should never be 'final') - */ - public static String ModelHandlerID = "org.hibernate.eclipse.mapper.handler.hbm.xml"; //$NON-NLS-1$ + public final static String CONTENTTYPE_ID = "org.hibernate.eclipse.mapper.content-type.hbm.xml"; //$NON-NLS-1$ + public final static String MODELHANDLER_ID = "org.hibernate.eclipse.mapper.handler.hbm.xml"; //$NON-NLS-1$ public ModelHandlerForHBMXML() { super(); - setId(ModelHandlerID); - setAssociatedContentTypeId(AssociatedContentTypeID); + setId(MODELHANDLER_ID); + setAssociatedContentTypeId(CONTENTTYPE_ID); } public IDocumentCharsetDetector getEncodingDetector() { |
From: <max...@us...> - 2006-02-13 15:56:18
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9600/META-INF Modified Files: MANIFEST.MF Log Message: fix license issues Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/META-INF/MANIFEST.MF,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- MANIFEST.MF 29 Jan 2006 18:40:39 -0000 1.17 +++ MANIFEST.MF 13 Feb 2006 15:56:00 -0000 1.18 @@ -7,12 +7,17 @@ Bundle-Activator: org.hibernate.eclipse.mapper.MapperPlugin Bundle-Vendor: Hibernate Team Bundle-Localization: plugin -Export-Package: - org.hibernate.eclipse.mapper, +Export-Package: org.hibernate.eclipse.mapper, org.hibernate.eclipse.mapper.editors, + org.hibernate.eclipse.mapper.editors.reveng, + org.hibernate.eclipse.mapper.editors.reveng.xpl, + org.hibernate.eclipse.mapper.editors.xpl, org.hibernate.eclipse.mapper.extractor, + org.hibernate.eclipse.mapper.factory, + org.hibernate.eclipse.mapper.model, org.hibernate.eclipse.mapper.modelhandler, - org.hibernate.eclipse.mapper.registry + org.hibernate.eclipse.mapper.registry, + org.hibernate.eclipse.mapper.views.contentoutline Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.ui.editors, |
From: <max...@us...> - 2006-02-13 15:56:17
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9600/src/org/hibernate/eclipse/mapper Modified Files: MapperPlugin.java Log Message: fix license issues Index: MapperPlugin.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/MapperPlugin.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- MapperPlugin.java 2 Sep 2005 08:03:36 -0000 1.5 +++ MapperPlugin.java 13 Feb 2006 15:55:59 -0000 1.6 @@ -4,7 +4,7 @@ import java.util.ResourceBundle; import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.hibernate.eclipse.EclipseLogger; +import org.hibernate.eclipse.logging.xpl.EclipseLogger; import org.osgi.framework.BundleContext; /** |
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/xpl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9600/src/org/hibernate/eclipse/mapper/editors/reveng/xpl Added Files: MultiPageEditorContributor.java FormTextEntry.java Log Message: fix license issues --- NEW FILE: MultiPageEditorContributor.java --- /***************************************************************************** * Copyright (c) 2004, 2006 IBM Corporation, JBoss Inc. 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: * IBM Corporation - initial API and implementation * Max Rydahl Anderse, JBoss Inc - adopted for usage in multi page editor ****************************************************************************/ package org.hibernate.eclipse.mapper.editors.reveng.xpl; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IStatusLineManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IEditorActionBarContributor; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.part.MultiPageEditorActionBarContributor; import org.eclipse.wst.sse.ui.StructuredTextEditor; import org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder; import org.eclipse.wst.sse.ui.internal.IExtendedContributor; import org.eclipse.wst.sse.ui.internal.ISourceViewerActionBarContributor; import org.eclipse.wst.xml.ui.internal.tabletree.IDesignViewerActionBarContributor; import org.eclipse.wst.xml.ui.internal.tabletree.SourcePageActionContributor; import org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart; /** * Manages the installation/deinstallation of global actions for multi-page editors. * Responsible for the redirection of global actions to the active editor. * Multi-page contributor replaces the contributors for the individual editors in the multi-page editor. */ public class MultiPageEditorContributor extends MultiPageEditorActionBarContributor { protected IEditorActionBarContributor designViewerActionBarContributor = null; protected IEditorActionBarContributor sourceViewerActionContributor = null; protected XMLMultiPageEditorPart multiPageEditor = null; // EditorExtension private IExtendedContributor extendedContributor; public MultiPageEditorContributor(String editorId) { super(); sourceViewerActionContributor = new SourcePageActionContributor(); // Read action extensions. ExtendedEditorActionBuilder builder = new ExtendedEditorActionBuilder(); extendedContributor = builder.readActionExtensions(editorId); } public void init(IActionBars actionBars) { super.init(actionBars); if (actionBars != null) { initDesignViewerActionBarContributor(actionBars); initSourceViewerActionContributor(actionBars); } } protected void initDesignViewerActionBarContributor(IActionBars actionBars) { if (designViewerActionBarContributor != null) designViewerActionBarContributor.init(actionBars, getPage() ); } protected void initSourceViewerActionContributor(IActionBars actionBars) { if (sourceViewerActionContributor != null) sourceViewerActionContributor.init(actionBars, getPage() ); } public void dispose() { super.dispose(); if (designViewerActionBarContributor != null) designViewerActionBarContributor.dispose(); if (sourceViewerActionContributor != null) sourceViewerActionContributor.dispose(); if (extendedContributor != null) extendedContributor.dispose(); } public final void contributeToMenu(IMenuManager menu) { super.contributeToMenu(menu); addToMenu(menu); if (extendedContributor != null) extendedContributor.contributeToMenu(menu); } protected void addToMenu(IMenuManager menu) { } public final void contributeToPopupMenu(IMenuManager menu) { addToPopupMenu(menu); if (extendedContributor != null) extendedContributor.contributeToPopupMenu(menu); } protected void addToPopupMenu(IMenuManager menu) { } /** * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToToolBar(IToolBarManager) */ public final void contributeToToolBar(IToolBarManager toolBarManager) { super.contributeToToolBar(toolBarManager); addToToolBar(toolBarManager); if (extendedContributor != null) extendedContributor.contributeToToolBar(toolBarManager); } protected void addToToolBar(IToolBarManager toolBarManager) { } public final void contributeToStatusLine(IStatusLineManager manager) { super.contributeToStatusLine(manager); addToStatusLine(manager); if (extendedContributor != null) extendedContributor.contributeToStatusLine(manager); } protected void addToStatusLine(IStatusLineManager manager) { } public void updateToolbarActions() { if (extendedContributor != null) extendedContributor.updateToolbarActions(); } public void setActiveEditor(IEditorPart targetEditor) { // save multiPageEditor before calling // super.setActiveEditor(targetEditor) // super.setActiveEditor will call setActivePage(IEditorPart // activeEditor) // multiPageEditor is needed in setActivePage(IEditorPart // activeEditor) if (targetEditor instanceof XMLMultiPageEditorPart) multiPageEditor = (XMLMultiPageEditorPart) targetEditor; super.setActiveEditor(targetEditor); updateToolbarActions(); if (extendedContributor != null) extendedContributor.setActiveEditor(targetEditor); } public void setActivePage(IEditorPart activeEditor) { // This contributor is designed for StructuredTextMultiPageEditorPart. // To safe-guard this from problems caused by unexpected usage by // other editors, the following // check is added. if (multiPageEditor != null) { if (activeEditor != null && activeEditor instanceof StructuredTextEditor) activateSourcePage(activeEditor); else activateDesignPage(activeEditor); } updateToolbarActions(); IActionBars actionBars = getActionBars(); if (actionBars != null) { // update menu bar and tool bar actionBars.updateActionBars(); } } protected void activateDesignPage(IEditorPart activeEditor) { if (designViewerActionBarContributor != null && designViewerActionBarContributor instanceof IDesignViewerActionBarContributor) { designViewerActionBarContributor.setActiveEditor(multiPageEditor); } if (sourceViewerActionContributor != null && sourceViewerActionContributor instanceof ISourceViewerActionBarContributor) { // if design page is not really an IEditorPart, activeEditor == // null, so pass in multiPageEditor instead (d282414) if (activeEditor == null) { sourceViewerActionContributor.setActiveEditor(multiPageEditor); } else { sourceViewerActionContributor.setActiveEditor(activeEditor); } ( (ISourceViewerActionBarContributor) sourceViewerActionContributor).setViewerSpecificContributionsEnabled(false); } } protected void activateSourcePage(IEditorPart activeEditor) { if (designViewerActionBarContributor != null && designViewerActionBarContributor instanceof IDesignViewerActionBarContributor) { designViewerActionBarContributor.setActiveEditor(multiPageEditor); } if (sourceViewerActionContributor != null && sourceViewerActionContributor instanceof ISourceViewerActionBarContributor) { sourceViewerActionContributor.setActiveEditor(activeEditor); ( (ISourceViewerActionBarContributor) sourceViewerActionContributor).setViewerSpecificContributionsEnabled(true); } } } --- NEW FILE: FormTextEntry.java --- /******************************************************************************* * Copyright (c) 2000, 2005, 2006 IBM Corporation, JBoss Inc. 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: * IBM Corporation - initial API and implementation * Max Rydahl Andersen, JBoss Inc. - added tooltip description support *******************************************************************************/ package org.hibernate.eclipse.mapper.editors.reveng.xpl; import java.text.BreakIterator; import org.eclipse.swt.SWT; import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Layout; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.forms.FormColors; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Hyperlink; import org.eclipse.ui.forms.widgets.TableWrapData; import org.eclipse.ui.forms.widgets.TableWrapLayout; import org.hibernate.eclipse.mapper.editors.reveng.IFormTextEntryListener; /** * Helper to have a label/text entry field in a Form. * * Supports hyperlinking of the label and optionally a button after the text. * * From the eclipse forms internal package. The attached listener reacts to all * the events. Entring new text makes the entry 'dirty', but only when 'commit' * is called is 'valueChanged' method called (and only if 'dirty' flag is set). * This allows delayed commit. */ public class FormTextEntry { private static final int TOOLTIP_WIDTH_LIMIT = 300; private Control label; private Text text; private Button browse; private String value=""; //$NON-NLS-1$ private String description; private boolean dirty; boolean ignoreModify = false; private IFormTextEntryListener listener; /** * The default constructor. Call 'createControl' to make it. * */ public FormTextEntry(Composite parent, FormToolkit toolkit, String labelText, int style) { createControl(parent, toolkit, labelText, style, null, false, 0); } /** * This constructor create all the controls right away. * * @param parent * @param toolkit * @param labelText * @param browseText * @param linkLabel */ public FormTextEntry(Composite parent, FormToolkit toolkit, String labelText, String browseText, boolean linkLabel) { this(parent, toolkit, labelText, browseText, linkLabel, 0); } public FormTextEntry(Composite parent, FormToolkit toolkit, String labelText, String browseText, boolean linkLabel, int indent) { createControl(parent, toolkit, labelText, SWT.SINGLE, browseText, linkLabel, indent); } /** all constructor */ public FormTextEntry(Composite parent, FormToolkit toolkit, String labelText, int style, String browseText, boolean linkLabel, int indent) { createControl(parent, toolkit, labelText, style, browseText, linkLabel, indent); } /** * Create all the controls in the provided parent. * * @param parent * @param toolkit * @param labelText * @param span * @param browseText * @param linkLabel */ private void createControl(Composite parent, FormToolkit toolkit, String labelText, int style, String browseText, boolean linkLabel, int indent) { if (linkLabel) { Hyperlink link = toolkit.createHyperlink(parent, labelText, SWT.NULL); label = link; } else { label = toolkit.createLabel(parent, labelText); label.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); label.setToolTipText(getToolTipText(label)); } text = toolkit.createText(parent, "", style); //$NON-NLS-1$ addListeners(); if (browseText != null) { browse = toolkit.createButton(parent, browseText, SWT.PUSH); browse.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (listener != null) listener.browseButtonSelected(FormTextEntry.this); } }); } fillIntoGrid(parent, indent); } public void setEditable(boolean editable) { text.setEditable(editable); if (browse!=null) browse.setEnabled(editable); } public void setEnabled(boolean enabled) { } private void fillIntoGrid(Composite parent, int indent) { Layout layout = parent.getLayout(); if (layout instanceof GridLayout) { GridData gd; int span = ((GridLayout) layout).numColumns; gd = new GridData(GridData.VERTICAL_ALIGN_CENTER); gd.horizontalIndent = indent; label.setLayoutData(gd); int tspan = browse != null ? span - 2 : span - 1; gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = tspan; gd.grabExcessHorizontalSpace = (tspan == 1); gd.widthHint = 10; text.setLayoutData(gd); if (browse != null) { gd = new GridData(GridData.VERTICAL_ALIGN_CENTER); browse.setLayoutData(gd); } } else if (layout instanceof TableWrapLayout) { TableWrapData td; int span = ((TableWrapLayout) layout).numColumns; td = new TableWrapData(); td.valign = TableWrapData.MIDDLE; td.indent = indent; label.setLayoutData(td); int tspan = browse != null ? span - 2 : span - 1; td = new TableWrapData(TableWrapData.FILL); td.colspan = tspan; td.grabHorizontal = (tspan == 1); td.valign = TableWrapData.MIDDLE; text.setLayoutData(td); if (browse != null) { td = new TableWrapData(); td.valign = TableWrapData.MIDDLE; browse.setLayoutData(td); } } } /** * Attaches the listener for the entry. * * @param listener */ public void setFormEntryListener(IFormTextEntryListener listener) { if (label instanceof Hyperlink) { if (this.listener!=null) ((Hyperlink)label).removeHyperlinkListener(this.listener); if (listener!=null) ((Hyperlink)label).addHyperlinkListener(listener); } this.listener = listener; } private void addListeners() { text.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { keyReleaseOccured(e); } }); text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { editOccured(e); } }); text.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { if (listener != null) listener.focusGained(FormTextEntry.this); } public void focusLost(FocusEvent e) { if (dirty) commit(); } }); } /** * If dirty, commits the text in the widget to the value and notifies the * listener. This call clears the 'dirty' flag. * */ public void commit() { if (dirty) { value = text.getText(); //if (value.length()==0) //value = null; //notify if (listener != null) listener.textValueChanged(this); } dirty = false; } public void cancelEdit() { dirty = false; } private void editOccured(ModifyEvent e) { if (ignoreModify) return; dirty = true; if (listener != null) listener.textDirty(this); } /** * Returns the text control. * * @return */ public Text getText() { return text; } /** * Returns the browse button control. * @return */ public Button getButton() { return browse; } /** * Returns the current entry value. If the entry is dirty and was not * commited, the value may be different from the text in the widget. * * @return */ public String getValue() { return value.trim(); } /** * Returns true if the text has been modified. * * @return */ public boolean isDirty() { return dirty; } private void keyReleaseOccured(KeyEvent e) { if (e.character == '\r') { // commit value if (dirty) commit(); } else if (e.character == '\u001b') { // Escape character text.setText(value != null ? value : ""); // restore old //$NON-NLS-1$ dirty = false; } listener.selectionChanged(FormTextEntry.this); } /** * Sets the value of this entry. * * @param value */ public void setValue(String value) { if (text != null) text.setText(value != null ? value : ""); //$NON-NLS-1$ this.value = (value != null) ? value : ""; //$NON-NLS-1$ } /** * Sets the value of this entry with the possibility to turn the * notification off. * * @param value * @param blockNotification */ public void setValue(String value, boolean blockNotification) { ignoreModify = blockNotification; setValue(value); ignoreModify = false; } protected String getToolTipText(Control control) { String text = getDescription(); if (text==null) return null; int dot = text.indexOf('.'); if (dot != -1) { StringBuffer buf = new StringBuffer(); boolean inTag=false; for (int i=0; i<text.length(); i++) { char c = text.charAt(i); if (inTag) { if (c=='>') { inTag = false; continue; } } else { if (c=='<') { inTag = true; continue; } else if (c=='.') { if (i<text.length()-1) { char c2 = text.charAt(i+1); if (c2==' ' || c2=='\t' || c2=='\n') break; } } buf.append(c); } } return wrapText(control, buf.toString(), TOOLTIP_WIDTH_LIMIT); } return text; } private String getDescription() { return description; } public void setDescription(String description) { this.description = description; if(label!=null) { label.setToolTipText(getToolTipText(label)); } } private String wrapText(Control c, String src, int width) { BreakIterator wb = BreakIterator.getWordInstance(); wb.setText(src); int saved = 0; int last = 0; StringBuffer buff = new StringBuffer(); GC gc = new GC(c); for (int loc = wb.first(); loc != BreakIterator.DONE; loc = wb.next()) { String word = src.substring(saved, loc); Point extent = gc.textExtent(word); if (extent.x > width) { // overflow String prevLine = src.substring(saved, last); buff.append(prevLine); buff.append(SWT.LF); saved = last; } last = loc; } String lastLine = src.substring(saved, last); buff.append(lastLine); return buff.toString(); } } |
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/xpl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9600/src/org/hibernate/eclipse/mapper/editors/xpl Added Files: BaseXMLHyperlinkSupport.java BaseXMLContentAssistProcessor.java XMLFormEditorPart.java Log Message: fix license issues --- NEW FILE: BaseXMLHyperlinkSupport.java --- /******************************************************************************* * Copyright (c) 2000, 2005, 2006 IBM Corporation, JBoss Inc. 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: * IBM Corporation - initial API and implementation * Max Rydahl Andersen, JBoss Inc - Extracted from various duplicated XMLHyperLinkDetctor methods in WTP *******************************************************************************/ package org.hibernate.eclipse.mapper.editors.xpl; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.Region; import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager; import org.eclipse.wst.sse.core.internal.util.StringUtils; import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr; import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** * xml hyper link detector support class. Provides helper methods to locate the "hyperlinked" part. * */ public abstract class BaseXMLHyperlinkSupport { protected IRegion getHyperlinkRegion(Node node) { IRegion hyperRegion = null; if (node != null) { short nodeType = node.getNodeType(); if (nodeType == Node.DOCUMENT_TYPE_NODE) { // handle doc type node IDOMNode docNode = (IDOMNode) node; hyperRegion = new Region(docNode.getStartOffset(), docNode.getEndOffset() - docNode.getStartOffset() ); } else if (nodeType == Node.ATTRIBUTE_NODE) { // handle attribute nodes IDOMAttr att = (IDOMAttr) node; // do not include quotes in attribute value region int regOffset = att.getValueRegionStartOffset(); int regLength = att.getValueRegion().getTextLength(); String attValue = att.getValueRegionText(); if (StringUtils.isQuoted(attValue) ) { regOffset = ++regOffset; regLength = regLength - 2; } hyperRegion = new Region(regOffset, regLength); } } return hyperRegion; } protected Attr getCurrentAttrNode(Node node, int offset) { if ( (node instanceof IndexedRegion) && ( (IndexedRegion) node).contains(offset) && (node.hasAttributes() ) ) { NamedNodeMap attrs = node.getAttributes(); // go through each attribute in node and if attribute contains // offset, return that attribute for (int i = 0; i < attrs.getLength(); ++i) { // assumption that if parent node is of type IndexedRegion, // then its attributes will also be of type IndexedRegion IndexedRegion attRegion = (IndexedRegion) attrs.item(i); if (attRegion.contains(offset) ) { return (Attr) attrs.item(i); } } } return null; } /** * Returns the node the cursor is currently on in the document. null if no * node is selected * * @param offset * @return Node either element, doctype, text, or null */ protected Node getCurrentNode(IDocument document, int offset) { // get the current node at the offset (returns either: element, // doctype, text) IndexedRegion inode = null; IStructuredModel sModel = null; try { sModel = StructuredModelManager.getModelManager().getExistingModelForRead(document); inode = sModel.getIndexedRegion(offset); if (inode == null) inode = sModel.getIndexedRegion(offset - 1); } finally { if (sModel != null) sModel.releaseFromRead(); } if (inode instanceof Node) { return (Node) inode; } return null; } } --- NEW FILE: BaseXMLContentAssistProcessor.java --- /******************************************************************************* * Copyright (c) 2001, 2004, 2006 IBM Corporation, JBoss Inc. 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: * IBM Corporation - initial API and implementation * Jens Lukowski/Innoopract - initial renaming/restructuring * Max Rydahl Andersen, JBoss Inc. - extracted attribueValue proposal mechanism. *******************************************************************************/ package org.hibernate.eclipse.mapper.editors.xpl; import java.util.Iterator; import java.util.List; import org.eclipse.jface.text.contentassist.ICompletionProposal; import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList; import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentAssistProcessor; public abstract class BaseXMLContentAssistProcessor extends XMLContentAssistProcessor { protected void addAttributeValueProposals(ContentAssistRequest contentAssistRequest) { super.addAttributeValueProposals(contentAssistRequest); IDOMNode node = (IDOMNode) contentAssistRequest.getNode(); // Find the attribute region and name for which this position should have a value proposed IStructuredDocumentRegion open = node.getFirstStructuredDocumentRegion(); ITextRegionList openRegions = open.getRegions(); int i = openRegions.indexOf(contentAssistRequest.getRegion() ); if (i < 0) return; ITextRegion nameRegion = null; while (i >= 0) { nameRegion = openRegions.get(i--); if (nameRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) break; } String matchString = contentAssistRequest.getMatchString(); int offset = contentAssistRequest.getReplacementBeginPosition(); if (matchString == null) { matchString = ""; //$NON-NLS-1$ } if (matchString.length() > 0 && (matchString.startsWith("\"") || matchString.startsWith("'") ) ) {//$NON-NLS-2$//$NON-NLS-1$ matchString = matchString.substring(1); offset = offset+1; } if (nameRegion != null) { String attributeName = open.getText(nameRegion); List attributeValueProposals = getAttributeValueProposals(attributeName, matchString, offset, contentAssistRequest); if(attributeValueProposals!=null) { for (Iterator iter = attributeValueProposals.iterator(); iter.hasNext();) { ICompletionProposal element = (ICompletionProposal) iter.next(); contentAssistRequest.addProposal(element); } } } } abstract protected List getAttributeValueProposals(String attributeName, String matchString, int offset, ContentAssistRequest contentAssistRequest); } --- NEW FILE: XMLFormEditorPart.java --- /***************************************************************************** * Copyright (c) 2004, 2006 IBM Corporation, JBoss Inc. 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: * IBM Corporation - initial API and implementation * Max Rydahl Andersen, JBoss Inc. - Adopted for usage in multipage editor. ****************************************************************************/ package org.hibernate.eclipse.mapper.editors.xpl; import org.eclipse.core.resources.IMarker; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextInputListener; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IPropertyListener; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.forms.editor.FormEditor; import org.eclipse.ui.ide.IDE; import org.eclipse.ui.ide.IGotoMarker; import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; import org.eclipse.wst.sse.ui.StructuredTextEditor; import org.eclipse.wst.xml.ui.internal.XMLUIPlugin; import org.eclipse.wst.xml.ui.internal.tabletree.IDesignViewer; import org.eclipse.wst.xml.ui.internal.tabletree.XMLEditorMessages; import org.eclipse.wst.xml.ui.internal.tabletree.XMLTableTreeHelpContextIds; import org.eclipse.wst.xml.ui.internal.tabletree.XMLTableTreeViewer; public class XMLFormEditorPart extends FormEditor { /** The text editor. */ private StructuredTextEditor textEditor; private IDesignViewer designViewer; private PropertyListener propertyListener; private int designPageIndex; private int sourcePageIndex; protected void addPages() { try { createSourcePage(); createAndAddDesignPage(); addSourcePage(); connectDesignPage(); } catch (PartInitException e) { throw new RuntimeException(e); } } /** * Connects the design viewer with the viewer selection manager. Should be * done after createSourcePage() is done because we need to get the * ViewerSelectionManager from the TextEditor. setModel is also done here * because getModel() needs to reference the TextEditor. */ private void connectDesignPage() { if (designViewer != null) { designViewer.setDocument(getDocument()); //designViewer.setModel(getModel()); // TODO Is this needed anymore? since 3.1beta1 / WTP M9 //designViewer.setViewerSelectionManager(textEditor.getViewerSelectionManager()); } } /** * Create and Add the Design Page using a registered factory * */ private void createAndAddDesignPage() { IDesignViewer tableTreeViewer = createDesignPage(); designViewer = tableTreeViewer; // note: By adding the design page as a Control instead of an // IEditorPart, page switches will indicate // a "null" active editor when the design page is made active designPageIndex = addPage(tableTreeViewer.getControl()); setPageText(designPageIndex, tableTreeViewer.getTitle()); } protected IDesignViewer createDesignPage() { XMLTableTreeViewer tableTreeViewer = new XMLTableTreeViewer(getContainer()); // Set the default infopop for XML design viewer. XMLUIPlugin.getInstance().getWorkbench().getHelpSystem().setHelp(tableTreeViewer.getControl(), XMLTableTreeHelpContextIds.XML_DESIGN_VIEW_HELPID); return tableTreeViewer; } protected void createSourcePage() throws PartInitException { textEditor = createTextEditor(); textEditor.setEditorPart(this); if (propertyListener == null) { propertyListener = new PropertyListener(); } textEditor.addPropertyListener(propertyListener); } private StructuredTextEditor createTextEditor() { return new StructuredTextEditor(); } StructuredTextEditor getTextEditor() { return textEditor; } /** * Internal IPropertyListener */ class PropertyListener implements IPropertyListener { public void propertyChanged(Object source, int propId) { switch (propId) { // had to implement input changed "listener" so that // StructuredTextEditor could tell it containing editor that // the input has change, when a 'resource moved' event is // found. case IEditorPart.PROP_INPUT : case IEditorPart.PROP_DIRTY : { if (source == getTextEditor()) { if (getTextEditor().getEditorInput() != getEditorInput()) { setInput(getTextEditor().getEditorInput()); /* * title should always change when input changes. * create runnable for following post call */ Runnable runnable = new Runnable() { public void run() { _firePropertyChange(IWorkbenchPart.PROP_TITLE); } }; /* * Update is just to post things on the display * queue (thread). We have to do this to get the * dirty property to get updated after other * things on the queue are executed. */ postOnDisplayQue(runnable); } } break; } case IWorkbenchPart.PROP_TITLE : { // update the input if the title is changed if (source == getTextEditor()) { if (getTextEditor().getEditorInput() != getEditorInput()) { setInput(getTextEditor().getEditorInput()); } } break; } default : { // propagate changes. Is this needed? Answer: Yes. if (source == getTextEditor()) { _firePropertyChange(propId); } break; } } } } class TextInputListener implements ITextInputListener { public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) { } public void inputDocumentChanged(IDocument oldInput, IDocument newInput) { if (designViewer != null && newInput != null) designViewer.setDocument(newInput); } } private void addSourcePage() throws PartInitException { try { sourcePageIndex = addPage(textEditor, getEditorInput()); setPageText(sourcePageIndex, XMLEditorMessages.XMLMultiPageEditorPart_0); // the update's critical, to get viewer selection manager and // highlighting to work textEditor.update(); firePropertyChange(PROP_TITLE); // Changes to the Text Viewer's document instance should also // force an // input refresh textEditor.getTextViewer().addTextInputListener(new TextInputListener()); } catch (PartInitException exception) { // dispose editor dispose(); throw exception; } } private IStructuredModel getModel() { IStructuredModel model = null; if (textEditor != null) model = textEditor.getModel(); // should get it by other means! return model; } public void doSave(IProgressMonitor monitor) { textEditor.doSave(monitor); } public void doSaveAs() { textEditor.doSaveAs(); } public boolean isSaveAsAllowed() { return textEditor.isSaveAsAllowed(); } void _firePropertyChange(int property) { super.firePropertyChange(property); } /** * Posts the update code "behind" the running operation. */ void postOnDisplayQue(Runnable runnable) { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow[] windows = workbench.getWorkbenchWindows(); if (windows != null && windows.length > 0) { Display display = windows[0].getShell().getDisplay(); display.asyncExec(runnable); } else runnable.run(); } void gotoMarker(IMarker marker) { setActivePage(sourcePageIndex); IDE.gotoMarker(textEditor, marker); } public Object getAdapter(Class key) { Object result = null; if (key == IDesignViewer.class) { result = designViewer; } else if (key.equals(IGotoMarker.class)) { result = new IGotoMarker() { public void gotoMarker(IMarker marker) { XMLFormEditorPart.this.gotoMarker(marker); } }; } else { // DMW: I'm bullet-proofing this because // its been reported (on IBM WSAD 4.03 version) a null pointer // sometimes // happens here on startup, when an editor has been left // open when workbench shutdown. if (textEditor != null) { result = textEditor.getAdapter(key); } } if(result==null) { return super.getAdapter(key); } else { return result; } } private IDocument getDocument() { IDocument document = null; if (textEditor != null) document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); return document; } } |
From: <max...@us...> - 2006-02-13 15:56:12
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9420/src/org/hibernate/eclipse/console/views Modified Files: KnownConfigurationsView.java Log Message: fix license issues Index: KnownConfigurationsView.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsView.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- KnownConfigurationsView.java 7 Feb 2006 16:17:48 -0000 1.14 +++ KnownConfigurationsView.java 13 Feb 2006 15:55:25 -0000 1.15 @@ -29,7 +29,7 @@ import org.hibernate.console.KnownConfigurations; import org.hibernate.console.node.BaseNode; import org.hibernate.eclipse.console.actions.EditConsoleConfiguration; -import org.hibernate.eclipse.console.workbench.AnyAdaptableLabelProvider; +import org.hibernate.eclipse.console.workbench.xpl.AnyAdaptableLabelProvider; /** |
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9420/src/org/hibernate/eclipse/hqleditor Modified Files: HQLWordDetector.java HQLSourceViewerConfiguration.java HQLEditor.java HQLCodeScanner.java HQLCompletionProcessor.java Added Files: MinimalDiffContextInformationValidator.java HQLColors.java DisplayStringProposalComparator.java Removed Files: HQLColorProvider.java Log Message: fix license issues --- NEW FILE: MinimalDiffContextInformationValidator.java --- package org.hibernate.eclipse.hqleditor; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.TextPresentation; import org.eclipse.jface.text.contentassist.IContextInformation; import org.eclipse.jface.text.contentassist.IContextInformationPresenter; import org.eclipse.jface.text.contentassist.IContextInformationValidator; /** Will validate context information that were generated within a certain offset. */ class MinimalDiffContextInformationValidator implements IContextInformationValidator, IContextInformationPresenter { protected int basedOffset; private final int minimal; public MinimalDiffContextInformationValidator(int minimal) { this.minimal = minimal; } public boolean isContextInformationValid( int offset ) { return Math.abs( basedOffset - offset ) < minimal; } public boolean updatePresentation( int position, TextPresentation presentation ) { return true; } public void install( IContextInformation info, ITextViewer viewer, int offset ) { basedOffset = offset; } } --- NEW FILE: HQLColors.java --- package org.hibernate.eclipse.hqleditor; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; public class HQLColors { public static final RGB HQL_COMMENT_COLOR = new RGB( 0, 0, 128 ); public static final RGB HQL_MULTILINE_COMMENT_COLOR = new RGB( 128, 0, 0 ); public static final RGB HQL_QUOTED_LITERAL_COLOR = new RGB( 0, 0, 255 ); public static final RGB HQL_KEYWORD_COLOR = new RGB( 128, 0, 0 ); public static final RGB HQL_IDENTIFIER_COLOR = new RGB( 0, 0, 128 ); public static final RGB HQL_DEFAULT_COLOR = new RGB( 0, 0, 0 ); protected Map colorTable = new HashMap(10); public void dispose() { Iterator e = colorTable.values().iterator(); while (e.hasNext()) ((Color) e.next()).dispose(); } public Color getColor( RGB rgb ) { Color color = (Color) colorTable.get( rgb ); if (color == null) { color = new Color( Display.getCurrent(), rgb ); colorTable.put( rgb, color ); } return color; } } --- NEW FILE: DisplayStringProposalComparator.java --- package org.hibernate.eclipse.hqleditor; import java.util.Comparator; import org.eclipse.jface.text.contentassist.ICompletionProposal; /** * Sort a comparator according to its display string. * Use the INSTANCE variable to save memory/time. */ public class DisplayStringProposalComparator implements Comparator { static public Comparator INSTANCE = new DisplayStringProposalComparator(); public int compare( Object o1, Object o2 ) { ICompletionProposal c1 = (ICompletionProposal) o1; ICompletionProposal c2 = (ICompletionProposal) o2; return c1.getDisplayString().compareTo( c2.getDisplayString() ); } } Index: HQLWordDetector.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLWordDetector.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- HQLWordDetector.java 16 Aug 2005 15:14:13 -0000 1.1 +++ HQLWordDetector.java 13 Feb 2006 15:55:24 -0000 1.2 @@ -2,10 +2,6 @@ import org.eclipse.jface.text.rules.IWordDetector; -/** - * This class determines whether a given character is valid as part of an HQL keyword - * in the current context. - */ public class HQLWordDetector implements IWordDetector { public boolean isWordStart( char c ) { Index: HQLSourceViewerConfiguration.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLSourceViewerConfiguration.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- HQLSourceViewerConfiguration.java 16 Aug 2005 15:14:13 -0000 1.1 +++ HQLSourceViewerConfiguration.java 13 Feb 2006 15:55:24 -0000 1.2 @@ -13,172 +13,86 @@ import org.eclipse.jface.text.rules.BufferedRuleBasedScanner; import org.eclipse.jface.text.rules.DefaultDamagerRepairer; import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.source.IAnnotationHover; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.SourceViewerConfiguration; -/** - * This class defines the editor add-ons; content assist, content formatter, - * highlighting, auto-indent strategy, double click strategy. - */ public class HQLSourceViewerConfiguration extends SourceViewerConfiguration { - /** The completion processor for completing the user's typing. */ - private HQLCompletionProcessor fCompletionProcessor; + public final static String HQL_PARTITIONING= "__hql_partitioning"; //$NON-NLS-1$ + private HQLCompletionProcessor completionProcessor; private HQLEditor hqlEditor; - /** - * This class implements a single token scanner. - */ static class SingleTokenScanner extends BufferedRuleBasedScanner { public SingleTokenScanner( TextAttribute attribute ) { setDefaultReturnToken( new Token( attribute )); } } - /** - * Constructs an instance of this class with the given HQLEditor to - * configure. - * @param editor - * - * @param editor the HQLEditor to configure - */ public HQLSourceViewerConfiguration(HQLEditor editor) { hqlEditor = editor; - fCompletionProcessor = new HQLCompletionProcessor(editor); + completionProcessor = new HQLCompletionProcessor(editor); } public HQLEditor getHQLEditor() { return hqlEditor; } - - /** - * Returns the annotation hover which will provide the information to be - * shown in a hover popup window when requested for the given - * source viewer. - * - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAnnotationHover(org.eclipse.jface.text.source.ISourceViewer) - */ - public IAnnotationHover getAnnotationHover( ISourceViewer sourceViewer ) { - return null; //new HQLAnnotationHover(); - } - - /** - * Returns the auto indentation strategy ready to be used with the given source viewer - * when manipulating text of the given content type. - * - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAutoIndentStrategy(org.eclipse.jface.text.source.ISourceViewer, java.lang.String) - */ - /* - public IAutoIndentStrategy getAutoIndentStrategy( ISourceViewer sourceViewer, String contentType ) { - return (IDocument.DEFAULT_CONTENT_TYPE.equals( contentType ) ? new HQLAutoIndentStrategy() : new DefaultAutoIndentStrategy()); - }*/ - - public final static String HQL_PARTITIONING= "__hql_partitioning"; //$NON-NLS-1$ - - /** - * Returns the configured partitioning for the given source viewer. The partitioning is - * used when the querying content types from the source viewer's input document. - * - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer) - */ + public String getConfiguredDocumentPartitioning( ISourceViewer sourceViewer ) { return HQL_PARTITIONING; } - /** - * Creates, initializes, and returns the ContentAssistant to use with this editor. - * - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(ISourceViewer) - */ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { ContentAssistant assistant = new ContentAssistant(); assistant.setDocumentPartitioning( getConfiguredDocumentPartitioning( sourceViewer )); - // Set content assist processors for various content types. - fCompletionProcessor = new HQLCompletionProcessor(hqlEditor); - assistant.setContentAssistProcessor( fCompletionProcessor, IDocument.DEFAULT_CONTENT_TYPE); + completionProcessor = new HQLCompletionProcessor(hqlEditor); + assistant.setContentAssistProcessor( completionProcessor, IDocument.DEFAULT_CONTENT_TYPE); - // Configure how content assist information will appear. assistant.enableAutoActivation( true ); assistant.setAutoActivationDelay( 500 ); - assistant.setProposalPopupOrientation( IContentAssistant.PROPOSAL_STACKED ); - assistant.setContextInformationPopupOrientation( IContentAssistant.CONTEXT_INFO_ABOVE ); - //assistant.setContextInformationPopupBackground( HQLEditorPlugin.getDefault().getHQLColorProvider().getColor( new RGB( 150, 150, 0 ))); - //Set to Carolina blue -// assistant.setContextInformationPopupBackground( HQLEditorPlugin.getDefault().getHQLColorProvider().getColor( new RGB( 0, 191, 255 ))); + assistant.setProposalPopupOrientation( IContentAssistant.PROPOSAL_STACKED ); return assistant; } - /** - * Creates, configures, and returns the ContentFormatter to use. - * - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentFormatter(ISourceViewer) - */ public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) { ContentFormatter formatter = new ContentFormatter(); formatter.setDocumentPartitioning( HQL_PARTITIONING ); IFormattingStrategy formattingStrategy = new HQLFormattingStrategy(); formatter.setFormattingStrategy( formattingStrategy, IDocument.DEFAULT_CONTENT_TYPE ); - - + return formatter; } - /** - * Creates, configures, and returns a presentation reconciler to help with - * document changes. - * - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(ISourceViewer) - */ public IPresentationReconciler getPresentationReconciler( ISourceViewer sourceViewer ) { - // Get the color provider. - HQLColorProvider colorProvider = new HQLColorProvider(); + HQLColors colorProvider = new HQLColors(); - // Create a presentation reconciler to handle handle document changes. PresentationReconciler reconciler = new PresentationReconciler(); String docPartitioning = getConfiguredDocumentPartitioning( sourceViewer ); reconciler.setDocumentPartitioning( docPartitioning ); - // Add a "damager-repairer" for changes in default text (HQL code). DefaultDamagerRepairer dr = new DefaultDamagerRepairer( new HQLCodeScanner( colorProvider ) ); reconciler.setDamager( dr, IDocument.DEFAULT_CONTENT_TYPE ); reconciler.setRepairer( dr, IDocument.DEFAULT_CONTENT_TYPE ); - // Add a "damager-repairer" for changes witin one-line HQL comments. - dr = new DefaultDamagerRepairer( new SingleTokenScanner( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_COMMENT_COLOR )))); + dr = new DefaultDamagerRepairer( new SingleTokenScanner( new TextAttribute( colorProvider.getColor( HQLColors.HQL_COMMENT_COLOR )))); reconciler.setDamager( dr, HQLPartitionScanner.HQL_COMMENT ); reconciler.setRepairer( dr, HQLPartitionScanner.HQL_COMMENT ); - // Add a "damager-repairer" for changes witin quoted literals. - dr = new DefaultDamagerRepairer( new SingleTokenScanner( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_QUOTED_LITERAL_COLOR )))); + dr = new DefaultDamagerRepairer( new SingleTokenScanner( new TextAttribute( colorProvider.getColor( HQLColors.HQL_QUOTED_LITERAL_COLOR )))); reconciler.setDamager( dr, HQLPartitionScanner.HQL_QUOTED_LITERAL ); reconciler.setRepairer( dr, HQLPartitionScanner.HQL_QUOTED_LITERAL ); - // Add a "damager-repairer" for changes witin delimited identifiers. - dr = new DefaultDamagerRepairer( new SingleTokenScanner( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_DELIMITED_IDENTIFIER_COLOR )))); - reconciler.setDamager( dr, HQLPartitionScanner.HQL_DELIMITED_IDENTIFIER ); - reconciler.setRepairer( dr, HQLPartitionScanner.HQL_DELIMITED_IDENTIFIER ); - return reconciler; } - /** - * Returns the text hover which will provide the information to be shown - * in a text hover popup window when requested for the given source viewer and - * the given content type. - * - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer, java.lang.String) - */ public ITextHover getTextHover( ISourceViewer sourceViewer, String contentType ) { return new HQLTextHover(); } - - -} // end class + +} Index: HQLEditor.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLEditor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- HQLEditor.java 7 Feb 2006 16:17:48 -0000 1.6 +++ HQLEditor.java 13 Feb 2006 15:55:24 -0000 1.7 @@ -355,8 +355,8 @@ * * @return the HQL color provider */ - public HQLColorProvider getHQLColorProvider() { - return new HQLColorProvider(); + public HQLColors getHQLColorProvider() { + return new HQLColors(); } /** Index: HQLCodeScanner.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCodeScanner.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- HQLCodeScanner.java 25 Aug 2005 12:18:57 -0000 1.2 +++ HQLCodeScanner.java 13 Feb 2006 15:55:24 -0000 1.3 @@ -15,15 +15,11 @@ import org.eclipse.jface.text.rules.WhitespaceRule; import org.eclipse.jface.text.rules.WordRule; import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Display; -/** - * This class implements a RuleBaseScanner for HQL source code text. - */ public class HQLCodeScanner extends RuleBasedScanner { - /** Defines the HQL keywords. */ - private static String[] fgKeywords = { + /** Defines the HQL keywords. Based on hql.g antlr grammer in 2005 ;) */ + private static String[] hqlKeywords = { "between", //$NON-NLS-1$ "class", //$NON-NLS-1$ "delete", //$NON-NLS-1$ @@ -87,199 +83,159 @@ }; - /** Defines the SQL built-in function names. */ - private static String[] fgFunctions = { - "log", //$NON-NLS-1$ - "roundmagic", //$NON-NLS-1$ - "rand", //$NON-NLS-1$ - "sign", //$NON-NLS-1$ - "char", //$NON-NLS-1$ - "curdate", //$NON-NLS-1$ - "radians", //$NON-NLS-1$ - "mod", //$NON-NLS-1$ - "pi", //$NON-NLS-1$ - "coalesce", //$NON-NLS-1$ - "ltrim", //$NON-NLS-1$ - "month", //$NON-NLS-1$ - "acos", //$NON-NLS-1$ - "day", //$NON-NLS-1$ - "current_time", //$NON-NLS-1$ - "curtime", //$NON-NLS-1$ - "hextoraw", //$NON-NLS-1$ - "cast", //$NON-NLS-1$ - "space", //$NON-NLS-1$ - "second", //$NON-NLS-1$ - "hour", //$NON-NLS-1$ - "lcase", //$NON-NLS-1$ - "avg", //$NON-NLS-1$ - "monthname", //$NON-NLS-1$ - "soundex", //$NON-NLS-1$ - "extract", //$NON-NLS-1$ - "rawtohex", //$NON-NLS-1$ - "quater", //$NON-NLS-1$ - "current_date", //$NON-NLS-1$ - "abs", //$NON-NLS-1$ - "trim", //$NON-NLS-1$ - "bit_length", //$NON-NLS-1$ - "nullif", //$NON-NLS-1$ - "ucase", //$NON-NLS-1$ - "cot", //$NON-NLS-1$ - "sqrt", //$NON-NLS-1$ - "max", //$NON-NLS-1$ - "week", //$NON-NLS-1$ - "now", //$NON-NLS-1$ - "atan", //$NON-NLS-1$ - "upper", //$NON-NLS-1$ - "lower", //$NON-NLS-1$ - "min", //$NON-NLS-1$ - "concat", //$NON-NLS-1$ - "ceiling", //$NON-NLS-1$ - "asin", //$NON-NLS-1$ - "degrees", //$NON-NLS-1$ - "sum", //$NON-NLS-1$ - "locate", //$NON-NLS-1$ - "user", //$NON-NLS-1$ - "sin", //$NON-NLS-1$ - "tan", //$NON-NLS-1$ - "substring", //$NON-NLS-1$ - "length", //$NON-NLS-1$ - "dayname", //$NON-NLS-1$ - "floor", //$NON-NLS-1$ - "dayofweek", //$NON-NLS-1$ - "dayofyear", //$NON-NLS-1$ - "str", //$NON-NLS-1$ - "dayofmonth", //$NON-NLS-1$ - "ascii", //$NON-NLS-1$ - "reverse", //$NON-NLS-1$ - "exp", //$NON-NLS-1$ - "cos", //$NON-NLS-1$ - "year", //$NON-NLS-1$ - "current_timestamp", //$NON-NLS-1$ - "log10", //$NON-NLS-1$ - "minute", //$NON-NLS-1$ - "rtrim", //$NON-NLS-1$ - "count", //$NON-NLS-1$ - "database", //$NON-NLS-1$ - }; - - /** Defines an array of arrays that combines all the HQL language elements defined previously. */ - private static Object[] fgAllWords = { fgKeywords, fgFunctions }; + /** built-in function names. Various normal builtin functions in SQL/HQL. Maybe sShould try and do this dynamically based on dialect */ + private static String[] builtInFunctions = { + // standard sql92 functions + "substring", + "locate", + "trim", + "length", + "bit_length", + "coalesce", + "nullif", + "abs", + "mod", + "sqrt", + "upper", + "lower", + "cast", + "extract", + + // time functions mapped to ansi extract + "second", + "minute", + "hour", + "day", + "month", + "year", + + "str", + + // misc functions - based on oracle dialect + "sign", + "acos", + "asin", + "atan", + "cos", + "cosh", + "exp", + "ln", + "sin", + "sinh", + "stddev", + "sqrt", + "tan", + "tanh", + "variance", + + "round", + "trunc", + "ceil", + "floor", + + "chr", + "initcap", + "lower", + "ltrim", + "rtrim", + "soundex", + "upper", + "ascii", + "length", + "to_char", + "to_date", + + "current_date", + "current_time", + "current_timestamp", + "lastday", + "sysday", + "systimestamp", + "uid", + "user", + + "rowid", + "rownum", + + "concat", + "instr", + "instrb", + "lpad", + "replace", + "rpad", + "substr", + "substrb", + "translate", + + "substring", + "locate", + "bit_length", + "coalesce", + + "atan2", + "log", + "mod", + "nvl", + "nvl2", + "power", + + "add_months", + "months_between", + "next_day", + + }; static { - Arrays.sort(fgFunctions); - Arrays.sort(fgKeywords); + // for performance in search. + Arrays.sort(builtInFunctions); + Arrays.sort(hqlKeywords); } - /** - * This class determines if a character is a whitespace character. - */ - public class HQLWhiteSpaceDetector implements IWhitespaceDetector { + static public class HQLWhiteSpaceDetector implements IWhitespaceDetector { public boolean isWhitespace( char c ) { return Character.isWhitespace( c ); } - } // end inner class + } - /** - * Constructs an instance of this class using the given color provider. - */ - public HQLCodeScanner( HQLColorProvider colorProvider ) { - // Define tokens for the SQL language elements. - IToken commentToken = null; - IToken stringToken = null; - IToken keywordToken = null; - IToken functionToken = null; -// IToken identifierToken = null; - IToken delimitedIdentifierToken = null; - IToken otherToken = null; + public HQLCodeScanner( HQLColors colorProvider ) { + final IToken commentToken = new Token( new TextAttribute( colorProvider.getColor( HQLColors.HQL_COMMENT_COLOR ))); + final IToken stringToken = new Token( new TextAttribute( colorProvider.getColor( HQLColors.HQL_QUOTED_LITERAL_COLOR ))); + final IToken keywordToken = new Token( new TextAttribute( colorProvider.getColor( HQLColors.HQL_KEYWORD_COLOR ), null, SWT.BOLD)); + final IToken functionToken = new Token( new TextAttribute( colorProvider.getColor( HQLColors.HQL_KEYWORD_COLOR ))); + final IToken otherToken = new Token( new TextAttribute( colorProvider.getColor( HQLColors.HQL_DEFAULT_COLOR ))); - /* On "high contrast" displays the default text color (black) is a problem, - * since the normal high contrast background is black. ("High contrast" is - * a Windows feature that helps vision-impaired people.) When high contrast mode is enabled, - * use different colors that show up better against a black background. - */ - if (Display.getDefault().getHighContrast() == true) { - commentToken = new Token( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_HC_COMMENT_COLOR ))); - stringToken = new Token( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_HC_QUOTED_LITERAL_COLOR ))); - keywordToken = new Token( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_HC_KEYWORD_COLOR ))); - functionToken = new Token( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_HC_KEYWORD_COLOR ))); - delimitedIdentifierToken = new Token( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_HC_DELIMITED_IDENTIFIER_COLOR ))); - otherToken = new Token( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_HC_DEFAULT_COLOR ))); - } - else { - commentToken = new Token( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_COMMENT_COLOR ))); - stringToken = new Token( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_QUOTED_LITERAL_COLOR ))); - keywordToken = new Token( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_KEYWORD_COLOR ), null, SWT.BOLD)); - functionToken = new Token( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_KEYWORD_COLOR ))); - delimitedIdentifierToken = new Token( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_DELIMITED_IDENTIFIER_COLOR ))); - otherToken = new Token( new TextAttribute( colorProvider.getColor( HQLColorProvider.HQL_DEFAULT_COLOR ))); - } - setDefaultReturnToken( otherToken ); List rules = new ArrayList(); - // Add rule for single-line comments. rules.add( new EndOfLineRule( "--", commentToken )); //$NON-NLS-1$ - - // Add rules for delimited identifiers and string literals. rules.add( new SingleLineRule( "'", "'", stringToken, '\\' )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - rules.add( new SingleLineRule( "\"", "\"", delimitedIdentifierToken, '\\' )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - // Add generic whitespace rule. rules.add( new WhitespaceRule( new HQLWhiteSpaceDetector() )); - // Define a word rule and add SQL keywords to it. WordRule wordRule = new WordRule( new HQLWordDetector(), otherToken ); - String[] reservedWords = getHQLKeywords(); - for (int i = 0; i < reservedWords.length; i++) { - wordRule.addWord( reservedWords[i], keywordToken ); - wordRule.addWord( reservedWords[i].toLowerCase(), keywordToken ); - } - - // Add the SQL function names to the word rule. - String[] functions = getHQLFunctionNames(); - for (int i = 0; i< functions.length; i++) { - wordRule.addWord( functions[i], functionToken ); - wordRule.addWord( functions[i].toLowerCase(), functionToken ); - } + addWordRules( keywordToken, wordRule, getHQLKeywords() ); + addWordRules( functionToken, wordRule, getHQLFunctionNames() ); - // Add the word rule to the list of rules. rules.add( wordRule ); - // Convert the list of rules to an array and return it. - IRule[] result = new IRule[ rules.size() ]; - rules.toArray( result ); - setRules( result ); + setRules( (IRule[]) rules.toArray( new IRule[ rules.size() ] ) ); } - /** - * Gets an array of HQL keywords - * - * @return the HQL keywords - */ + private void addWordRules(final IToken token, WordRule wordRule, String[] reservedWords) { + for (int i = 0; i < reservedWords.length; i++) { + wordRule.addWord( reservedWords[i], token ); + wordRule.addWord( reservedWords[i].toLowerCase(), token ); + } + } + public static String[] getHQLKeywords() { - return fgKeywords; + return hqlKeywords; } - /** - * Gets an array of HQL function names - * - * @return the HQL function names - */ public static String[] getHQLFunctionNames() { - return fgFunctions; + return builtInFunctions; } - /** - * Gets an array of arrays containing all HQL words, including keywords - * and function names - * - * @return the array of SQL words - */ - public static Object[] getSQLAllWords() { - return fgAllWords; - } - } // end class Index: HQLCompletionProcessor.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- HQLCompletionProcessor.java 7 Feb 2006 16:17:48 -0000 1.2 +++ HQLCompletionProcessor.java 13 Feb 2006 15:55:24 -0000 1.3 @@ -10,11 +10,9 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.ITypedRegion; -import org.eclipse.jface.text.TextPresentation; import org.eclipse.jface.text.contentassist.ICompletionProposal; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.text.contentassist.IContextInformation; -import org.eclipse.jface.text.contentassist.IContextInformationPresenter; import org.eclipse.jface.text.contentassist.IContextInformationValidator; import org.hibernate.cfg.Configuration; import org.hibernate.console.ConsoleConfiguration; @@ -24,71 +22,18 @@ */ public class HQLCompletionProcessor implements IContentAssistProcessor { - private char[] fProposalAutoActivationSet; - - /** - * Simple content assist tip closer. The tip is valid in a range of 5 - * characters around its popup location. - */ - protected static class Validator implements IContextInformationValidator, IContextInformationPresenter { - protected int fInstallOffset; - - public boolean isContextInformationValid( int offset ) { - return Math.abs( fInstallOffset - offset ) < 5; - } - - public void install( IContextInformation info, ITextViewer viewer, int offset ) { - fInstallOffset = offset; - } - - public boolean updatePresentation( int position, TextPresentation presentation ) { - return true; - } - }; - - private static class CompletionProposalComparator implements Comparator { - public int compare( Object o1, Object o2 ) { - ICompletionProposal c1 = (ICompletionProposal) o1; - ICompletionProposal c2 = (ICompletionProposal) o2; - return c1.getDisplayString().compareTo( c2.getDisplayString() ); - } - }; - - protected IContextInformationValidator fValidator = new Validator(); - - private Comparator fComparator; - + private char[] autoActivationChars = { '.' }; + protected IContextInformationValidator validator = new MinimalDiffContextInformationValidator(5); + private final Comparator completionComparator; private final HQLEditor editor; - + private String errorMessage; + public HQLCompletionProcessor(HQLEditor editor) { super(); this.editor = editor; - - // activation/trigger to invoke content assist - char[] completionChars = { '.' }; - setCompletionProposalAutoActivationCharacters( completionChars ); - - fComparator = new CompletionProposalComparator(); - } - - /** - * Tells this processor to order the proposals alphabetically. - * - * @param order <code>true</code> if proposals should be ordered. - */ - public void orderProposalsAlphabetically( boolean order ) { - fComparator = order ? new CompletionProposalComparator() : null; + completionComparator = DisplayStringProposalComparator.INSTANCE; } - /** - * Returns a list of proposed content completions based on the specified - * location within the document that corresponds to the current cursor - * position within the text-editor control. - * - * @param viewer the viewer whose document is used to compute the proposals - * @param documentPosition a location within the document - * @return an array of content-assist proposals - */ public ICompletionProposal[] computeCompletionProposals( ITextViewer viewer, int documentOffset ) { ICompletionProposal[] result = null; @@ -97,62 +42,60 @@ ITypedRegion partition = null; if (documentOffset > 0) { - if (doc.getChar( documentOffset - 1 ) == ';') - partition = viewer.getDocument().getPartition( documentOffset ); - else - // for incomplete statement. - partition = viewer.getDocument().getPartition( documentOffset - 1 ); + partition = viewer.getDocument().getPartition( documentOffset - 1 ); + } + else { + partition = viewer.getDocument().getPartition( documentOffset ); } - else - partition = viewer.getDocument().getPartition( documentOffset ); result = computeProposals( doc, partition, documentOffset ); } catch (BadLocationException x) { - } - ; + } if (result != null) - result = order( result ); + result = sort( result ); return result; } - private ICompletionProposal[] computeProposals(IDocument doc, ITypedRegion partition, int documentOffset) { + private ICompletionProposal[] computeProposals(IDocument doc, ITypedRegion partition, final int currentOffset) { ICompletionProposal[] result = null; - try { - if (doc != null && partition != null && documentOffset >= 0) { - - List proposalList = new ArrayList(); - String replacementStr = null; - String displayStr = null; - String startWord = null; - char docOffsetChar; - - // Get document offset to the start of "word" where content assist - // is requested. - int offset = getPartitionOffset( doc, partition, documentOffset, partition.getOffset() ); - - try { - startWord = doc.get( offset, documentOffset - offset ); - - findMatchingEntities( documentOffset, proposalList, startWord, editor.getConsoleConfiguration() ); - findMatchingWords( documentOffset, proposalList, startWord, HQLCodeScanner.getHQLKeywords(), "keyword" ); - findMatchingWords( documentOffset, proposalList, startWord, HQLCodeScanner.getHQLFunctionNames(), "function"); - - - result = (ICompletionProposal[]) proposalList.toArray(new ICompletionProposal[proposalList.size()]); - - } - catch (BadLocationException exc) { - } - } - } catch (Throwable te) { - te.printStackTrace(); + if (doc != null && partition != null && currentOffset >= 0) { + + List proposalList = new ArrayList(); + String startWord = null; + + int startOffset = findNearestWhiteSpace( doc, currentOffset, partition.getOffset() ); + + int wordLength = currentOffset - startOffset; + startWord = getWord( doc, startOffset, wordLength ); + + if(startWord!=null) { + findMatchingEntities( currentOffset, proposalList, startWord, editor.getConsoleConfiguration() ); + findMatchingWords( currentOffset, proposalList, startWord, HQLCodeScanner.getHQLKeywords(), "keyword" ); + findMatchingWords( currentOffset, proposalList, startWord, HQLCodeScanner.getHQLFunctionNames(), "function"); + + result = (ICompletionProposal[]) proposalList.toArray(new ICompletionProposal[proposalList.size()]); + if(result.length==0) { + errorMessage = "No HQL completions avaialable."; + } + } else { + errorMessage = "No start word found."; + } } - - return result; + + return result; + } + + private String getWord(IDocument doc, int startOffset, int wordLength) { + try { + return doc.get( startOffset, wordLength ); + } + catch (BadLocationException e) { + return null; // no word found. + } } private void findMatchingEntities(int documentOffset, List proposalList, String startWord, ConsoleConfiguration lastUsedConfiguration) { @@ -186,179 +129,42 @@ } } - /** - * Returns a list of content-assist tips based on the specified location - * within the document that corresponds to the current cursor position - * within the text-editor control. - * - * @param viewer the viewer whose document is used to compute the tips - * @param documentPosition a location within the document - * @return an array of content-assist tips - */ - - public IContextInformation[] computeContextInformation( ITextViewer viewer, int documentOffset ) { - IContextInformation[] result = null; - return result; - } - - /** - * Returns a string of characters which when pressed should automatically - * display content-assist proposals. - * - * @see IContentAssistProcessor.getCompletionProposalAutoActivationCharacters() - * - * @return string of characters - */ - public char[] getCompletionProposalAutoActivationCharacters() { - return fProposalAutoActivationSet; - } - - /** - * Returns a string of characters which when pressed should automatically - * display a content-assist tip. - * - * @return string of characters - */ - public char[] getContextInformationAutoActivationCharacters() { - return new char[] { '#' }; - } - - /** - * Returns a delegate used to determine when a displayed tip should be - * dismissed. - * - * @return a tip closer - */ - public IContextInformationValidator getContextInformationValidator() { - return fValidator; - } + public IContextInformation[] computeContextInformation( ITextViewer viewer, int documentOffset ) { return null; } + public char[] getCompletionProposalAutoActivationCharacters() { return autoActivationChars; } - /** - * Returns the reason why the content-assist processor was unable to produce - * any proposals or tips. - * - * @return an error message or null if no error occurred - */ - public String getErrorMessage() { - return null; - } + public char[] getContextInformationAutoActivationCharacters() { return new char[0]; } - /** - * Orders the given proposals. - * - * @params ICompletionProposal[] List of proposals to be ordered - */ - private ICompletionProposal[] order( ICompletionProposal[] proposals ) { - if (fComparator != null) - Arrays.sort( proposals, fComparator ); - return proposals; - } + public IContextInformationValidator getContextInformationValidator() { return validator; } - /** - * Sets this processor's set of characters triggering the activation of the - * completion proposal computation. - * - * @param activationSet the activation set - */ - public void setCompletionProposalAutoActivationCharacters( char[] activationSet ) { - fProposalAutoActivationSet = activationSet; + public String getErrorMessage() { + return errorMessage; } - /** - * Returns the document offset to the start of the "word" where content - * assist is requested. - * - * @param doc the current document - * @param partition document partition region. A region consists of offset, - * length, and type. - * @param documentOffset offset into the document - * @param offset offset in the document to start of the name preceeding the - * activation character - */ - public int getPartitionOffset( IDocument doc, ITypedRegion partition, int documentOffset, int offset ) { - boolean loop = true; - - int offset1 = documentOffset - 1; - try { - while (loop && offset <= offset1) { - switch (doc.getChar( offset1 )) { - case 10: // linefeed - case 32: // space - case 13: // return - case 9: { // tab - loop = false; - } - break; - default: { - offset1--; - } - break; - } - } - } - catch (BadLocationException x) { - } - - offset = offset1 + 1; - - return offset; + private ICompletionProposal[] sort( ICompletionProposal[] proposals ) { + Arrays.sort( proposals, completionComparator ); + return proposals; } - /** - * Returns the document offset to the start of the "word" where content - * assist is requested. - * - * @param doc the current document - * @param partition document partition region. A region consists of offset, - * length, and type. - * @param documentOffset offset into the document - * @param leadingString - * @param position <code>1</code> from current position <code>0</code> - * after leadingString - * @return the partition offset - */ - public int getPartitionOffset( IDocument doc, ITypedRegion partition, int documentOffset, String leadingString, - int position ) { - int offset = partition.getOffset() + leadingString.length(); - - if (documentOffset <= offset) - return offset; - - switch (position) { - case 0: { - } - break; - default: { - boolean loop = true; - int offset1 = documentOffset - 1; - try { - while (loop && offset <= offset1) { - switch (doc.getChar( offset1 )) { - case 10: // linefeed - case 32: // space - case 13: // return - case 9: { // tab - loop = false; - } - break; - default: { - offset1--; - } - break; - } - } - } - catch (BadLocationException x) { - } - ; - - offset = offset1 + 1; - } - break; - } - - return getPartitionOffset( doc, partition, documentOffset, offset ); + public int findNearestWhiteSpace( IDocument doc, int documentOffset, int offset ) { + boolean loop = true; + + int tmpOffset = documentOffset - 1; + try { + while (loop && offset <= tmpOffset) { + if(Character.isWhitespace(doc.getChar(tmpOffset))) { + loop = false; + } else { + tmpOffset--; + } + } + } + catch (BadLocationException x) { + } + + offset = tmpOffset + 1; + + return offset; } -} \ No newline at end of file + } \ No newline at end of file --- HQLColorProvider.java DELETED --- |
From: <max...@us...> - 2006-02-13 15:56:06
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9420/META-INF Modified Files: MANIFEST.MF Log Message: fix license issues Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/META-INF/MANIFEST.MF,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- MANIFEST.MF 29 Jan 2006 17:51:34 -0000 1.19 +++ MANIFEST.MF 13 Feb 2006 15:55:25 -0000 1.20 @@ -16,10 +16,12 @@ org.hibernate.eclipse.console.properties, org.hibernate.eclipse.console.sql, org.hibernate.eclipse.console.utils, + org.hibernate.eclipse.console.utils.xpl, org.hibernate.eclipse.console.views, org.hibernate.eclipse.console.views.properties, org.hibernate.eclipse.console.wizards, org.hibernate.eclipse.console.workbench, + org.hibernate.eclipse.console.workbench.xpl, org.hibernate.eclipse.graph, org.hibernate.eclipse.graph.actions, org.hibernate.eclipse.graph.anchor, |
From: <max...@us...> - 2006-02-13 15:56:02
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/xpl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9571/src/org/hibernate/eclipse/mapper/editors/reveng/xpl Log Message: Directory /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/xpl added to the repository |
From: <max...@us...> - 2006-02-13 15:55:59
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/xpl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9571/src/org/hibernate/eclipse/mapper/editors/xpl Log Message: Directory /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/xpl added to the repository |
From: <max...@us...> - 2006-02-13 15:55:46
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9525/src/org/hibernate/eclipse/console/test Modified Files: ConsolePluginAllTests.java HibernateProjectTests.java SimpleTestProject.java Added Files: ContentAssistTest.java Removed Files: PluginTest.java Log Message: fix license issues --- NEW FILE: ContentAssistTest.java --- package org.hibernate.eclipse.console.test; import org.eclipse.core.resources.ProjectScope; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.preferences.IScopeContext; import org.eclipse.jdt.core.IJavaProject; import org.hibernate.eclipse.console.utils.ProjectUtils; import org.osgi.service.prefs.BackingStoreException; import org.osgi.service.prefs.Preferences; public class ContentAssistTest extends HibernateConsoleTest { public ContentAssistTest(String name) { super( name ); } public void testEnableHibernateNature() throws BackingStoreException, CoreException { IJavaProject prj = getProject().getIJavaProject(); IScopeContext scope = new ProjectScope(prj.getProject() ); Preferences node = scope.getNode("org.hibernate.eclipse.console"); node.putBoolean("hibernate3.enabled", true ); node.put("default.configuration", "testcfg" ); node.flush(); ProjectUtils.addProjectNature(prj.getProject(), "org.hibernate.eclipse.console.hibernateNature", new NullProgressMonitor() ); ProjectUtils.removeProjectNature(prj.getProject(), "org.hibernate.eclipse.console.hibernateNature", new NullProgressMonitor() ); } } Index: ConsolePluginAllTests.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ConsolePluginAllTests.java 8 Feb 2006 08:02:02 -0000 1.3 +++ ConsolePluginAllTests.java 13 Feb 2006 15:55:37 -0000 1.4 @@ -16,7 +16,6 @@ //$JUnit-BEGIN$ suite.addTestSuite( KnownConfigurationsTest.class ); suite.addTestSuite( QueryParametersTest.class ); - suite.addTestSuite( PluginTest.class ); suite.addTestSuite( PerspectiveTest.class ); suite.addTestSuite( ConsoleConfigurationTest.class ); suite.addTestSuite( JavaFormattingTest.class ); Index: HibernateProjectTests.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/HibernateProjectTests.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- HibernateProjectTests.java 25 Jan 2006 10:09:54 -0000 1.1 +++ HibernateProjectTests.java 13 Feb 2006 15:55:37 -0000 1.2 @@ -5,7 +5,12 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.preferences.IScopeContext; import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jface.text.ITextViewer; +import org.eclipse.jface.text.contentassist.ICompletionProposal; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.ide.IDE; import org.hibernate.eclipse.console.utils.ProjectUtils; +import org.hibernate.eclipse.mapper.editors.HBMXMLContentAssistProcessor; import org.osgi.service.prefs.BackingStoreException; import org.osgi.service.prefs.Preferences; @@ -15,20 +20,13 @@ super( name ); } - public void testEnableHibernateNature() throws BackingStoreException, CoreException { - - IJavaProject prj = getProject().getIJavaProject(); - IScopeContext scope = new ProjectScope(prj.getProject() ); - - - Preferences node = scope.getNode("org.hibernate.eclipse.console"); + public void testContentAssist() throws BackingStoreException, CoreException { - node.putBoolean("hibernate3.enabled", true ); - node.put("default.configuration", "testcfg" ); - node.flush(); + HBMXMLContentAssistProcessor processor = new HBMXMLContentAssistProcessor(); + //IEditorPart iep = IDE.openEditor(getPage(), getProject().openFile("gpd.xml")); + ITextViewer viewer = null; - ProjectUtils.addProjectNature(prj.getProject(), "org.hibernate.eclipse.console.hibernateNature", new NullProgressMonitor() ); - ProjectUtils.removeProjectNature(prj.getProject(), "org.hibernate.eclipse.console.hibernateNature", new NullProgressMonitor() ); + ICompletionProposal[] proposals = processor.computeCompletionProposals(viewer, 0); } } \ No newline at end of file Index: SimpleTestProject.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/SimpleTestProject.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SimpleTestProject.java 25 Jan 2006 10:09:54 -0000 1.2 +++ SimpleTestProject.java 13 Feb 2006 15:55:37 -0000 1.3 @@ -80,12 +80,8 @@ project = buildNewProject(PROJECT_NAME); javaProject = buildJavaProject(project); - IType primaryType = buildType( - buildPackage(PACKAGE_NAME, project, javaProject), FILE_NAME); - - // v2 IFile file = buildTestClass(project); - // v2 ICompilationUnit cu = (ICompilationUnit) JavaCore.create(file); - + buildType(buildPackage(PACKAGE_NAME, project, javaProject), FILE_NAME); + } private IProject buildNewProject(String projectName) { --- PluginTest.java DELETED --- |
From: <max...@us...> - 2006-02-13 15:55:45
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9525/META-INF Modified Files: MANIFEST.MF Log Message: fix license issues Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- MANIFEST.MF 8 Feb 2006 08:02:03 -0000 1.7 +++ MANIFEST.MF 13 Feb 2006 15:55:37 -0000 1.8 @@ -22,7 +22,9 @@ org.hibernate.eclipse.help, org.hibernate.eclipse.mapper, org.eclipse.jface.text, - org.hibernate.eclipse.console + org.hibernate.eclipse.console, + org.eclipse.wst.xml.core, + org.eclipse.wst.xml.ui Eclipse-AutoStart: true Bundle-Activator: org.hibernate.eclipse.console.test.HibernateConsoleTestPlugin Eclipse-RegisterBuddy: org.hibernate.eclipse |
From: <max...@us...> - 2006-02-13 15:55:36
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9420/src/org/hibernate/eclipse/console/workbench Removed Files: AnyAdaptableLabelProvider.java Log Message: fix license issues --- AnyAdaptableLabelProvider.java DELETED --- |
From: <max...@us...> - 2006-02-13 15:55:36
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9420/src/org/hibernate/eclipse/console/utils Modified Files: DialogSelectionHelper.java Log Message: fix license issues Index: DialogSelectionHelper.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/DialogSelectionHelper.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- DialogSelectionHelper.java 22 Dec 2005 15:15:08 -0000 1.6 +++ DialogSelectionHelper.java 13 Feb 2006 15:55:26 -0000 1.7 @@ -44,75 +44,9 @@ * @author max * */ -public class DialogSelectionHelper { - - /** - * - * Shows the UI to select new JAR or ZIP archive entries located in the workspace. - * The dialog returns the selected entries or <code>null</code> if the dialog has - * been cancelled. The dialog does not apply any changes. - * @param shell The parent shell for the dialog. - * @param initialSelection The path of the element (container or archive) to initially select or <code>null</code> to not select an entry. - * @param usedEntries An array of paths that are already on the classpath and therefore should not be - * selected again. - * @param fileExtensions An array of file extensions. - * @param allowMultiple allow multiple selections. - * @param allowFiles TODO - * @param acceptedTypes TODO - * - * @return Returns the new classpath container entry paths or <code>null</code> if the dialog has - * been cancelled by the user. - * - * Inspired by BuildPathDialogAccess.chooseJAREntries from jdt.ui.wizards - */ - public static IPath[] chooseFileEntries(Shell shell, IPath initialSelection, IPath[] usedEntries, String title, String description, String[] fileExtensions, boolean allowMultiple, boolean allowDirectories, boolean allowFiles ) { - if (usedEntries == null) { - throw new IllegalArgumentException("used entries must be not-null"); - } - - List clazzes = new ArrayList(); - if(allowDirectories) { - clazzes.add(IFolder.class); - clazzes.add(IProject.class); - } - if(allowFiles) { - clazzes.add(IFile.class); - } - Class[] acceptedClasses = (Class[]) clazzes.toArray(new Class[clazzes.size()]); - - TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, true); - ArrayList usedFiles= new ArrayList(usedEntries.length); - IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); - for (int i= 0; i < usedEntries.length; i++) { - IResource resource= root.findMember(usedEntries[i]); - if (resource instanceof IFile) { - usedFiles.add(resource); - } - } - IResource focus= initialSelection != null ? root.findMember(initialSelection) : null; - - ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider() ); - dialog.setValidator(validator); - dialog.setAllowMultiple(allowMultiple); - dialog.setTitle(title); - dialog.setMessage(description); - dialog.addFilter(new FileFilter(fileExtensions, usedFiles, true, allowDirectories) ); - dialog.setInput(root); - dialog.setSorter(new ResourceSorter(ResourceSorter.NAME) ); - dialog.setInitialSelection(focus); - - if (dialog.open() == Window.OK) { - Object[] elements= dialog.getResult(); - IPath[] res= new IPath[elements.length]; - for (int i= 0; i < res.length; i++) { - IResource elem= (IResource)elements[i]; - res[i]= elem.getFullPath(); - } - return res; - } - return null; - } +public class DialogSelectionHelper extends org.hibernate.eclipse.console.utils.xpl.DialogSelectionHelper { + /** * Realize a Java Project selection dialog and return the first selected project, * or null if there was none. |
From: <max...@us...> - 2006-02-13 15:55:36
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/xpl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9420/src/org/hibernate/eclipse/console/workbench/xpl Added Files: AnyAdaptableLabelProvider.java Log Message: fix license issues --- NEW FILE: AnyAdaptableLabelProvider.java --- /******************************************************************************* * Copyright (c) 2000, 2005, 2006 IBM Corporation, JBoss Inc. 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: * IBM Corporation - initial API and implementation * Max Rydahl Andersen, JBoss Inc. - Adapted to not be tied to WorkBenchAdaptable *******************************************************************************/ package org.hibernate.eclipse.console.workbench.xpl; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Platform; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.DecoratingLabelProvider; import org.eclipse.jface.viewers.IColorProvider; import org.eclipse.jface.viewers.IFontProvider; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.LabelProviderChangedEvent; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorRegistry; import org.eclipse.ui.IPropertyListener; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.internal.util.SWTResourceUtil; import org.eclipse.ui.model.IWorkbenchAdapter; import org.eclipse.ui.model.IWorkbenchAdapter2; /** * LabelProvider based on WorkBenchLabelProvider that is not limited to WorkBench elements. * * @author Max Rydahl Andersen * */ public class AnyAdaptableLabelProvider extends LabelProvider implements IColorProvider, IFontProvider { /** * Returns a workbench label provider that is hooked up to the decorator * mechanism. * * @return a new <code>DecoratingLabelProvider</code> which wraps a <code> * new <code>WorkbenchLabelProvider</code> */ public static ILabelProvider getDecoratingWorkbenchLabelProvider() { return new DecoratingLabelProvider(new AnyAdaptableLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager() .getLabelDecorator()); } /** * Listener that tracks changes to the editor registry and does a full update * when it changes, since many workbench adapters derive their icon from the file * associations in the registry. */ private IPropertyListener editorRegistryListener = new IPropertyListener() { public void propertyChanged(Object source, int propId) { if (propId == IEditorRegistry.PROP_CONTENTS) { fireLabelProviderChanged(new LabelProviderChangedEvent(AnyAdaptableLabelProvider.this)); } } }; /** * Creates a new workbench label provider. */ public AnyAdaptableLabelProvider() { PlatformUI.getWorkbench().getEditorRegistry().addPropertyListener(editorRegistryListener); } /** * Returns an image descriptor that is based on the given descriptor, * but decorated with additional information relating to the state * of the provided object. * * Subclasses may reimplement this method to decorate an object's * image. * * @param input The base image to decorate. * @param element The element used to look up decorations. * @return the resuling ImageDescriptor. * @see org.eclipse.jface.resource.CompositeImageDescriptor */ protected ImageDescriptor decorateImage(ImageDescriptor input, Object element) { return input; } /** * Returns a label that is based on the given label, * but decorated with additional information relating to the state * of the provided object. * * Subclasses may implement this method to decorate an object's * label. * @param input The base text to decorate. * @param element The element used to look up decorations. * @return the resulting text */ protected String decorateText(String input, Object element) { return input; } /* (non-Javadoc) * Method declared on ILabelProvider */ public void dispose() { PlatformUI.getWorkbench().getEditorRegistry().removePropertyListener(editorRegistryListener); super.dispose(); } /** * Returns the implementation of IWorkbenchAdapter for the given * object. * @param o the object to look up. * @return IWorkbenchAdapter or<code>null</code> if the adapter is not defined or the * object is not adaptable. */ protected final IWorkbenchAdapter getAdapter(Object o) { if (o instanceof IAdaptable) { return (IWorkbenchAdapter) ((IAdaptable) o).getAdapter(IWorkbenchAdapter.class); } else { return (IWorkbenchAdapter) Platform.getAdapterManager().getAdapter(o, IWorkbenchAdapter.class); } } /** * Returns the implementation of IWorkbenchAdapter2 for the given * object. * @param o the object to look up. * @return IWorkbenchAdapter2 or<code>null</code> if the adapter is not defined or the * object is not adaptable. */ protected final IWorkbenchAdapter2 getAdapter2(Object o) { if (o instanceof IAdaptable) { return (IWorkbenchAdapter2) ((IAdaptable) o).getAdapter(IWorkbenchAdapter2.class); } else { return (IWorkbenchAdapter2) Platform.getAdapterManager().getAdapter(o, IWorkbenchAdapter2.class); } } /* (non-Javadoc) * Method declared on ILabelProvider */ public final Image getImage(Object element) { //obtain the base image by querying the element IWorkbenchAdapter adapter = getAdapter(element); if (adapter == null) { return null; } ImageDescriptor descriptor = adapter.getImageDescriptor(element); if (descriptor == null) { return null; } //add any annotations to the image descriptor descriptor = decorateImage(descriptor, element); Image image = (Image) SWTResourceUtil.getImageTable().get(descriptor); if (image == null) { image = descriptor.createImage(); SWTResourceUtil.getImageTable().put(descriptor, image); } return image; } /* (non-Javadoc) * Method declared on ILabelProvider */ public final String getText(Object element) { //query the element for its label IWorkbenchAdapter adapter = getAdapter(element); if (element instanceof String) { return (String) element; } if (adapter == null) { return "Unknown: " + element.getClass().getName(); //$NON-NLS-1$ } String label = adapter.getLabel(element); //return the decorated label return decorateText(label, element); } /* (non-Javadoc) * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object) */ public Color getForeground(Object element) { return getColor(element, true); } /* (non-Javadoc) * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object) */ public Color getBackground(Object element) { return getColor(element, false); } /* (non-Javadoc) * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object) */ public Font getFont(Object element) { IWorkbenchAdapter2 adapter = getAdapter2(element); if (adapter == null) { return null; } FontData descriptor = adapter.getFont(element); if (descriptor == null) { return null; } Font font = (Font) SWTResourceUtil.getFontTable().get(descriptor); if (font == null) { font = new Font(Display.getCurrent(), descriptor); SWTResourceUtil.getFontTable().put(descriptor, font); } return font; } private Color getColor(Object element, boolean forground) { IWorkbenchAdapter2 adapter = getAdapter2(element); if (adapter == null) { return null; } RGB descriptor = forground ? adapter.getForeground(element) : adapter .getBackground(element); if (descriptor == null) { return null; } Color color = (Color) SWTResourceUtil.getColorTable().get(descriptor); if (color == null) { color = new Color(Display.getCurrent(), descriptor); SWTResourceUtil.getColorTable().put(descriptor, color); } return color; } } |
From: <max...@us...> - 2006-02-13 15:55:36
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9420/src/org/hibernate/eclipse/console/wizards Modified Files: TableFilterView.java Log Message: fix license issues Index: TableFilterView.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/TableFilterView.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- TableFilterView.java 9 Dec 2005 16:55:19 -0000 1.8 +++ TableFilterView.java 13 Feb 2006 15:55:27 -0000 1.9 @@ -20,10 +20,10 @@ import org.hibernate.console.KnownConfigurations; import org.hibernate.eclipse.console.model.IReverseEngineeringDefinition; import org.hibernate.eclipse.console.model.ITableFilter; -import org.hibernate.eclipse.console.workbench.AnyAdaptableLabelProvider; import org.hibernate.eclipse.console.workbench.DeferredContentProvider; import org.hibernate.eclipse.console.workbench.LazyDatabaseSchema; import org.hibernate.eclipse.console.workbench.TableContainer; +import org.hibernate.eclipse.console.workbench.xpl.AnyAdaptableLabelProvider; import org.hibernate.mapping.Column; import org.hibernate.mapping.Table; import org.hibernate.util.StringHelper; |
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9420/src/org/hibernate/eclipse/launch Removed Files: ExporterProvidersTab.java AddPropertyDialog.java PropertiesPart.java Log Message: fix license issues --- ExporterProvidersTab.java DELETED --- --- AddPropertyDialog.java DELETED --- --- PropertiesPart.java DELETED --- |
From: <max...@us...> - 2006-02-13 15:55:36
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9420/src/org/hibernate/eclipse/console Modified Files: HibernateConsolePlugin.java Log Message: fix license issues Index: HibernateConsolePlugin.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- HibernateConsolePlugin.java 17 Nov 2005 23:45:55 -0000 1.20 +++ HibernateConsolePlugin.java 13 Feb 2006 15:55:25 -0000 1.21 @@ -26,10 +26,10 @@ import org.hibernate.console.HibernateConsoleRuntimeException; import org.hibernate.console.KnownConfigurations; import org.hibernate.console.preferences.ConsoleConfigurationPreferences; -import org.hibernate.eclipse.EclipseLogger; import org.hibernate.eclipse.console.workbench.ConfigurationAdapterFactory; import org.hibernate.eclipse.hqleditor.HQLEditorInput; import org.hibernate.eclipse.hqleditor.HQLEditorStorage; +import org.hibernate.eclipse.logging.xpl.EclipseLogger; import org.osgi.framework.BundleContext; /** |