Index: src/org/jboss/tools/hibernate4_0/console/EclipseHQLCompletionRequestor.java =================================================================== --- src/org/jboss/tools/hibernate4_0/console/EclipseHQLCompletionRequestor.java (revision 37150) +++ src/org/jboss/tools/hibernate4_0/console/EclipseHQLCompletionRequestor.java (working copy) @@ -28,8 +28,9 @@ import org.eclipse.swt.graphics.Image; import org.hibernate.console.ImageConstants; import org.hibernate.eclipse.console.utils.EclipseImages; -import org.hibernate.eclipse.console.workbench.HibernateWorkbenchHelper; import org.hibernate.internal.util.StringHelper; +import org.hibernate.mapping.Property; +import org.hibernate.mapping.Value; import org.hibernate.tool.ide.completion.HQLCompletionProposal; import org.hibernate.tool.ide.completion.IHQLCompletionRequestor; @@ -116,8 +117,14 @@ key = ImageConstants.MAPPEDCLASS; break; case HQLCompletionProposal.PROPERTY: - if(proposal.getProperty()!=null) { - return HibernateWorkbenchHelper.getImage( proposal.getProperty() ); + Property property = proposal.getProperty(); + if(property!=null) { + if(property.getPersistentClass()!=null + && property.getPersistentClass().getIdentifierProperty()==property) { + key = ImageConstants.IDPROPERTY; + } else { + key = getIconNameForValue(property.getValue()); + } } else { key = ImageConstants.PROPERTY; } @@ -147,5 +154,16 @@ result.clear(); lastErrorMessage = null; } + + static private String getIconNameForValue(Value value) { + String result; + + result = (String) value.accept(new IconNameValueVisitor()); + + if(result==null) { + result = ImageConstants.UNKNOWNPROPERTY; + } + return result; + } } Index: src/org/jboss/tools/hibernate4_0/console/IconNameValueVisitor.java =================================================================== --- src/org/jboss/tools/hibernate4_0/console/IconNameValueVisitor.java (revision 0) +++ src/org/jboss/tools/hibernate4_0/console/IconNameValueVisitor.java (revision 0) @@ -0,0 +1,99 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.tools.hibernate4_0.console; + +import org.hibernate.console.ImageConstants; +import org.hibernate.mapping.Any; +import org.hibernate.mapping.Array; +import org.hibernate.mapping.Bag; +import org.hibernate.mapping.Component; +import org.hibernate.mapping.DependantValue; +import org.hibernate.mapping.IdentifierBag; +import org.hibernate.mapping.List; +import org.hibernate.mapping.ManyToOne; +import org.hibernate.mapping.Map; +import org.hibernate.mapping.OneToMany; +import org.hibernate.mapping.OneToOne; +import org.hibernate.mapping.PrimitiveArray; +import org.hibernate.mapping.Set; +import org.hibernate.mapping.SimpleValue; +import org.hibernate.mapping.ValueVisitor; + +final class IconNameValueVisitor implements ValueVisitor { + + public Object accept(OneToOne oto) { + return ImageConstants.ONETOONE; + } + + public Object accept(ManyToOne mto) { + return ImageConstants.MANYTOONE; + } + + public Object accept(Component component) { + return ImageConstants.COMPONENT; + } + + public Object accept(DependantValue value) { + return ImageConstants.UNKNOWNPROPERTY; + } + + public Object accept(SimpleValue value) { + return ImageConstants.PROPERTY; + } + + public Object accept(Any any) { + return ImageConstants.PROPERTY; + } + + public Object accept(Set set) { + return ImageConstants.MANYTOONE; + } + + public Object accept(OneToMany many) { + return ImageConstants.ONETOMANY; + } + + public Object accept(Map map) { + return ImageConstants.MANYTOONE; + } + + public Object accept(Array list) { + return ImageConstants.MANYTOONE; + } + + public Object accept(PrimitiveArray primitiveArray) { + return ImageConstants.MANYTOONE; + } + + public Object accept(List list) { + return ImageConstants.MANYTOONE; + } + + public Object accept(IdentifierBag bag) { + return ImageConstants.MANYTOONE; + } + + public Object accept(Bag bag) { + return ImageConstants.MANYTOONE; + } + +} \ No newline at end of file