Author: vyemialyanchyk
Date: 2009-07-01 10:17:22 -0400 (Wed, 01 Jul 2009)
New Revision: 16319
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmImageMap.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelMap.java
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/BaseUIPlugin.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/LogHelper.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/StatusFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ActionOrmTree.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ContentProviderVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/Messages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenActionDelegate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmContentProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelImageVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ViewsAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/views.properties
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/VisualEditorPlugin.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/VisualEditor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenMappingAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenSourceAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/Shape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramTreeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeTreeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/GEFRootEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeTreeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/TreePartFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HibernateUtils.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4285 - code review, update code
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/VisualEditorPlugin.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/VisualEditorPlugin.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/VisualEditorPlugin.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -17,12 +17,11 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.*;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.jboss.tools.hibernate.ui.view.BaseUIPlugin;
import org.osgi.framework.BundleContext;
-public class VisualEditorPlugin extends BaseUIPlugin {
+public class VisualEditorPlugin extends AbstractUIPlugin {
- public final static String PLUGIN_ID= "org.jboss.tools.hibernate.ui.veditor";
//$NON-NLS-1$
+ public final static String ID = "org.jboss.tools.hibernate.ui.veditor";
//$NON-NLS-1$
//The shared instance.
private static VisualEditorPlugin plugin;
@@ -49,7 +48,7 @@
}
public static ImageDescriptor getImageDescriptor(String path) {
- return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
}
public static IWorkbenchPage getPage(){
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/VisualEditor.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/VisualEditor.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/VisualEditor.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -189,6 +189,21 @@
return ret;
}
+ public Set<Object> getSelectedElements2() {
+ Set<Object> ret = new HashSet<Object>();
+ List<?> selectedEditParts = getGraphicalViewer().getSelectedEditParts();
+ Iterator<?> iterator = selectedEditParts.iterator();
+ while (iterator.hasNext()) {
+ Object elem = iterator.next();
+ if (elem instanceof OrmEditPart) {
+ Shape shape = (Shape)((OrmEditPart)elem).getModel();
+ Object ormElement = shape.getOrmElement();
+ ret.add(ormElement);
+ }
+ }
+ return ret;
+ }
+
public OrmDiagram getViewerContents() {
return ormDiagram;
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenMappingAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenMappingAction.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenMappingAction.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -46,9 +46,10 @@
ConsoleConfiguration consoleConfig = objectEditorInput.getConfiguration();
VisualEditor part = (VisualEditor)getWorkbenchPart();
- Set selectedElements = part.getSelectedElements();
+ //Set selectedElements = part.getSelectedElements();
+ Set<Object> selectedElements = part.getSelectedElements2();
- Iterator iterator = selectedElements.iterator();
+ Iterator<Object> iterator = selectedElements.iterator();
while (iterator.hasNext()) {
Object selection = iterator.next();
if (selection instanceof Property
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenSourceAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenSourceAction.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenSourceAction.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -70,10 +70,10 @@
}
protected boolean calculateEnabled() {
- //VisualEditor part = (VisualEditor)getWorkbenchPart();
- //return part.getSelectedElements().size() > 0;
- /**/
VisualEditor part = (VisualEditor)getWorkbenchPart();
+ return part.getSelectedElements().size() > 0;
+ /** /
+ VisualEditor part = (VisualEditor)getWorkbenchPart();
Set selectedElements = part.getSelectedElements();
Iterator iterator = selectedElements.iterator();
while (iterator.hasNext()) {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -32,6 +32,7 @@
import org.eclipse.jdt.core.IJavaProject;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
@@ -60,7 +61,7 @@
public static final String DIRTY = "dirty"; //$NON-NLS-1$
private boolean dirty = false;
private String childrenLocations[];
- private HashMap<String,OrmShape> elements = new HashMap<String,OrmShape>();
+ private HashMap<String, OrmShape> elements = new HashMap<String,
OrmShape>();
private RootClass[] ormElements;
private ConsoleConfiguration consoleConfig;
private String[] entityNames;
@@ -308,100 +309,108 @@
@SuppressWarnings("unchecked")
private OrmShape getOrCreatePersistentClass(PersistentClass persistentClass, Table
componentClassDatabaseTable){
OrmShape classShape = null;
+ if (persistentClass == null) {
+ return classShape;
+ }
OrmShape shape = null;
- if(persistentClass != null) {
- classShape =
elements.get(HibernateUtils.getPersistentClassName(persistentClass.getEntityName()));
- if (classShape == null) classShape = createShape(persistentClass);
- if(componentClassDatabaseTable == null && persistentClass.getTable() != null)
- componentClassDatabaseTable = persistentClass.getTable();
- if(componentClassDatabaseTable != null) {
- shape = elements.get(HibernateUtils.getTableName(componentClassDatabaseTable));
- if (shape == null) shape = getOrCreateDatabaseTable(componentClassDatabaseTable);
- createConnections(classShape, shape);
- if(!isConnectionExist(classShape, shape)){
- new Connection(classShape, shape);
- classShape.firePropertyChange(REFRESH, null, null);
- shape.firePropertyChange(REFRESH, null, null);
+ classShape =
elements.get(HibernateUtils.getPersistentClassName(persistentClass.getEntityName()));
+ if (classShape == null) {
+ classShape = createShape(persistentClass);
+ }
+ if (componentClassDatabaseTable == null && persistentClass.getTable() != null)
{
+ componentClassDatabaseTable = persistentClass.getTable();
+ }
+ if (componentClassDatabaseTable != null) {
+ shape = elements.get(HibernateUtils.getTableName(componentClassDatabaseTable));
+ if (shape == null) {
+ shape = getOrCreateDatabaseTable(componentClassDatabaseTable);
+ }
+ createConnections(classShape, shape);
+ if (!isConnectionExist(classShape, shape)) {
+ new Connection(classShape, shape);
+ classShape.firePropertyChange(REFRESH, null, null);
+ shape.firePropertyChange(REFRESH, null, null);
+ }
+ }
+ RootClass rc = (RootClass)persistentClass;
+ Iterator iter = rc.getSubclassIterator();
+ while (iter.hasNext()) {
+ Object element = iter.next();
+ if (element instanceof Subclass) {
+ Subclass subclass = (Subclass)element;
+ OrmShape subclassShape =
elements.get(HibernateUtils.getPersistentClassName(subclass.getEntityName()));
+ if (subclassShape == null) {
+ subclassShape = createShape(subclass);
}
- }
- RootClass rc = (RootClass)persistentClass;
- Iterator iter = rc.getSubclassIterator();
- while (iter.hasNext()) {
- Object element = iter.next();
- if (element instanceof Subclass) {
- Subclass subclass = (Subclass)element;
- OrmShape subclassShape =
elements.get(HibernateUtils.getPersistentClassName(subclass.getEntityName()));
- if (subclassShape == null) subclassShape = createShape(subclass);
- if (((Subclass)element).isJoinedSubclass()) {
- Table jcTable = ((Subclass)element).getTable();
- OrmShape jcTableShape = getOrCreateDatabaseTable(jcTable);
- createConnections(subclassShape, jcTableShape);
- if(!isConnectionExist(subclassShape, jcTableShape)){
- new Connection(subclassShape, jcTableShape);
- subclassShape.firePropertyChange(REFRESH, null, null);
- jcTableShape.firePropertyChange(REFRESH, null, null);
- }
- } else {
- createConnections(subclassShape, shape);
- if(!isConnectionExist(subclassShape, shape)){
- new Connection(subclassShape, shape);
- subclassShape.firePropertyChange(REFRESH, null, null);
- shape.firePropertyChange(REFRESH, null, null);
- }
+ if (((Subclass)element).isJoinedSubclass()) {
+ Table jcTable = ((Subclass)element).getTable();
+ OrmShape jcTableShape = getOrCreateDatabaseTable(jcTable);
+ createConnections(subclassShape, jcTableShape);
+ if (!isConnectionExist(subclassShape, jcTableShape)) {
+ new Connection(subclassShape, jcTableShape);
+ subclassShape.firePropertyChange(REFRESH, null, null);
+ jcTableShape.firePropertyChange(REFRESH, null, null);
}
- OrmShape ownerTableShape =
getOrCreateDatabaseTable(((Subclass)element).getRootTable());
- createConnections(subclassShape, ownerTableShape);
+ } else {
+ createConnections(subclassShape, shape);
+ if (!isConnectionExist(subclassShape, shape)) {
+ new Connection(subclassShape, shape);
+ subclassShape.firePropertyChange(REFRESH, null, null);
+ shape.firePropertyChange(REFRESH, null, null);
+ }
+ }
+ OrmShape ownerTableShape =
getOrCreateDatabaseTable(((Subclass)element).getRootTable());
+ createConnections(subclassShape, ownerTableShape);
- Iterator<Join> joinIterator = subclass.getJoinIterator();
- while (joinIterator.hasNext()) {
- Join join = joinIterator.next();
- Iterator<Property> iterator = join.getPropertyIterator();
- while (iterator.hasNext()) {
- Property property = iterator.next();
- OrmShape tableShape = getOrCreateDatabaseTable(property.getValue().getTable());
- createConnections(subclassShape, tableShape);
- subclassShape.firePropertyChange(REFRESH, null, null);
- tableShape.firePropertyChange(REFRESH, null, null);
- }
+ Iterator<Join> joinIterator = subclass.getJoinIterator();
+ while (joinIterator.hasNext()) {
+ Join join = joinIterator.next();
+ Iterator<Property> iterator = join.getPropertyIterator();
+ while (iterator.hasNext()) {
+ Property property = iterator.next();
+ OrmShape tableShape = getOrCreateDatabaseTable(property.getValue().getTable());
+ createConnections(subclassShape, tableShape);
+ subclassShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
}
}
}
+ }
- if (persistentClass.getIdentifier() instanceof Component) {
- Component identifier = (Component)persistentClass.getIdentifier();
- if (identifier.getComponentClassName() != null &&
!identifier.getComponentClassName().equals(identifier.getOwner().getEntityName())) {
- OrmShape componentClassShape = elements.get(identifier.getComponentClassName());
- if (componentClassShape == null && persistentClass instanceof RootClass) {
- componentClassShape =
getOrCreateComponentClass(((RootClass)persistentClass).getIdentifierProperty());
+ if (persistentClass.getIdentifier() instanceof Component) {
+ Component identifier = (Component)persistentClass.getIdentifier();
+ if (identifier.getComponentClassName() != null &&
!identifier.getComponentClassName().equals(identifier.getOwner().getEntityName())) {
+ OrmShape componentClassShape = elements.get(identifier.getComponentClassName());
+ if (componentClassShape == null && persistentClass instanceof RootClass) {
+ componentClassShape =
getOrCreateComponentClass(((RootClass)persistentClass).getIdentifierProperty());
- Shape idPropertyShape =
classShape.getChild(persistentClass.getIdentifierProperty());
- if (idPropertyShape != null && !isConnectionExist(idPropertyShape,
componentClassShape)) {
- new Connection(idPropertyShape, componentClassShape);
- idPropertyShape.firePropertyChange(REFRESH, null, null);
- componentClassShape.firePropertyChange(REFRESH, null, null);
- }
+ Shape idPropertyShape =
classShape.getChild(persistentClass.getIdentifierProperty());
+ if (idPropertyShape != null && !isConnectionExist(idPropertyShape,
componentClassShape)) {
+ new Connection(idPropertyShape, componentClassShape);
+ idPropertyShape.firePropertyChange(REFRESH, null, null);
+ componentClassShape.firePropertyChange(REFRESH, null, null);
+ }
- OrmShape tableShape = getOrCreateDatabaseTable(identifier.getTable());
- if (componentClassShape != null) {
- createConnections(componentClassShape, tableShape);
- componentClassShape.firePropertyChange(REFRESH, null, null);
- tableShape.firePropertyChange(REFRESH, null, null);
- }
+ OrmShape tableShape = getOrCreateDatabaseTable(identifier.getTable());
+ if (componentClassShape != null) {
+ createConnections(componentClassShape, tableShape);
+ componentClassShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
}
}
}
+ }
- Iterator joinIterator = persistentClass.getJoinIterator();
- while (joinIterator.hasNext()) {
- Join join = (Join)joinIterator.next();
- Iterator<Property> iterator = join.getPropertyIterator();
- while (iterator.hasNext()) {
- Property property = iterator.next();
- OrmShape tableShape = getOrCreateDatabaseTable(property.getValue().getTable());
- createConnections(classShape, tableShape);
- classShape.firePropertyChange(REFRESH, null, null);
- tableShape.firePropertyChange(REFRESH, null, null);
- }
+ Iterator joinIterator = persistentClass.getJoinIterator();
+ while (joinIterator.hasNext()) {
+ Join join = (Join)joinIterator.next();
+ Iterator<Property> iterator = join.getPropertyIterator();
+ while (iterator.hasNext()) {
+ Property property = iterator.next();
+ OrmShape tableShape = getOrCreateDatabaseTable(property.getValue().getTable());
+ createConnections(classShape, tableShape);
+ classShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
}
}
return classShape;
@@ -410,10 +419,10 @@
@SuppressWarnings("unchecked")
private OrmShape getOrCreateDatabaseTable(Table databaseTable){
OrmShape tableShape = null;
- if(databaseTable != null) {
+ if (databaseTable != null) {
String tableName = HibernateUtils.getTableName(databaseTable);
tableShape = elements.get(tableName);
- if(tableShape == null) {
+ if (tableShape == null) {
tableShape = createShape(databaseTable);
final Configuration config = consoleConfig.getConfiguration();
Iterator iterator = config.getClassMappings();
@@ -423,8 +432,9 @@
RootClass cls = (RootClass)clazz;
Table table = cls.getTable();
if (tableName.equals(table.getName() + "." + table.getName())) {
//$NON-NLS-1$
- if (elements.get(HibernateUtils.getPersistentClassName(cls.getEntityName())) ==
null)
+ if (elements.get(HibernateUtils.getPersistentClassName(cls.getEntityName())) ==
null) {
getOrCreatePersistentClass(cls, null);
+ }
}
}
}
@@ -477,9 +487,11 @@
private boolean isConnectionExist(Shape source, Shape target){
Connection conn;
if (source != null && source.getSourceConnections() != null) {
- for(int i=0;i<source.getSourceConnections().size();i++){
+ for (int i = 0; i < source.getSourceConnections().size(); i++) {
conn = source.getSourceConnections().get(i);
- if(conn.getTarget().equals(target)) return true;
+ if (conn.getTarget().equals(target)) {
+ return true;
+ }
}
}
return false;
@@ -501,40 +513,41 @@
}
public void processExpand(ExpandeableShape shape) {
+ Object element = shape.getOrmElement();
+ if (!(element instanceof Property)) {
+ return;
+ }
OrmShape s = null;
- Object element = shape.getOrmElement();
- if (element instanceof Property) {
- Property property = (Property)element;
- if (!property.isComposite()) {
- Type type = ((Property)element).getType();
- if (type.isEntityType()) {
- EntityType et = (EntityType) type;
- final Configuration config = consoleConfig.getConfiguration();
- Object clazz = config.getClassMapping(et.getAssociatedEntityName());
- if (clazz instanceof RootClass) {
- RootClass rootClass = (RootClass)clazz;
- s = getOrCreatePersistentClass(rootClass, null);
- if (!isConnectionExist(shape, s)) {
- new Connection(shape, s);
- shape.firePropertyChange(REFRESH, null, null);
- s.firePropertyChange(REFRESH, null, null);
- }
- } else if (clazz instanceof Subclass) {
- s = getOrCreatePersistentClass(((Subclass)clazz).getRootClass(), null);
+ Property property = (Property)element;
+ if (!property.isComposite()) {
+ Type type = ((Property)element).getType();
+ if (type.isEntityType()) {
+ EntityType et = (EntityType) type;
+ final Configuration config = consoleConfig.getConfiguration();
+ Object clazz = config.getClassMapping(et.getAssociatedEntityName());
+ if (clazz instanceof RootClass) {
+ RootClass rootClass = (RootClass)clazz;
+ s = getOrCreatePersistentClass(rootClass, null);
+ if (!isConnectionExist(shape, s)) {
+ new Connection(shape, s);
+ shape.firePropertyChange(REFRESH, null, null);
+ s.firePropertyChange(REFRESH, null, null);
}
+ } else if (clazz instanceof Subclass) {
+ s = getOrCreatePersistentClass(((Subclass)clazz).getRootClass(), null);
}
- } else {
- s = getOrCreatePersistentClass(new SpecialRootClass(property), null);
- new Connection(shape, s);
- createConnections(s, getOrCreateDatabaseTable(property.getValue().getTable()));
- shape.firePropertyChange(REFRESH, null, null);
- s.firePropertyChange(REFRESH, null, null);
}
- if(!shape.getParent().equals(s)) {
- shape.setReference(s);
- }
- firePropertyChange(REFRESH, null, null);
+ } else {
+ s = getOrCreatePersistentClass(new SpecialRootClass(property), null);
+ new Connection(shape, s);
+ createConnections(s, getOrCreateDatabaseTable(property.getValue().getTable()));
+ shape.firePropertyChange(REFRESH, null, null);
+ s.firePropertyChange(REFRESH, null, null);
}
+ if(!shape.getParent().equals(s)) {
+ shape.setReference(s);
+ }
+ firePropertyChange(REFRESH, null, null);
}
public void update(){
@@ -565,16 +578,16 @@
}
SimpleValue value = (SimpleValue)csChild0.getOrmElement();
OrmShape tableShape = getOrCreateDatabaseTable(value.getTable());
- Iterator iterator = value.getColumnIterator();
- while (iterator.hasNext()) {
- Object o = iterator.next();
- if (o instanceof Column) {
- Column column = (Column)o;
- Shape colShape = tableShape.getChild(column);
- if (!isConnectionExist(csChild0, colShape)) {
- new Connection(csChild0, colShape);
+ Iterator it = value.getColumnIterator();
+ while (it.hasNext()) {
+ Object el = it.next();
+ if (el instanceof Column) {
+ Column col = (Column)el;
+ Shape shape = tableShape.getChild(col);
+ if (shape != null && !isConnectionExist(csChild0, shape)) {
+ new Connection(csChild0, shape);
csChild0.firePropertyChange(REFRESH, null, null);
- childShape.firePropertyChange(REFRESH, null, null);
+ shape.firePropertyChange(REFRESH, null, null);
}
}
}
@@ -595,45 +608,45 @@
childShape.firePropertyChange(REFRESH, null, null);
}
OrmShape keyTableShape = getOrCreateDatabaseTable(collection.getKey().getTable());
- Iterator iter = collection.getKey().getColumnIterator();
- while (iter.hasNext()) {
- Object o = iter.next();
- if (o instanceof Column) {
- Column col = (Column)o;
- Shape keyColumnShape = keyTableShape.getChild(col);
- if (keyColumnShape != null && !isConnectionExist(csChild0, keyColumnShape))
{
- new Connection(csChild0, keyColumnShape);
+ Iterator it = collection.getKey().getColumnIterator();
+ while (it.hasNext()) {
+ Object el = it.next();
+ if (el instanceof Column) {
+ Column col = (Column)el;
+ Shape shape = keyTableShape.getChild(col);
+ if (shape != null && !isConnectionExist(csChild0, shape)) {
+ new Connection(csChild0, shape);
csChild0.firePropertyChange(REFRESH, null, null);
- keyColumnShape.firePropertyChange(REFRESH, null, null);
+ shape.firePropertyChange(REFRESH, null, null);
}
}
}
} else /* if (collection.isMap() || collection.isSet()) */ {
childShape = getOrCreateDatabaseTable(collection.getCollectionTable());
- Iterator columnIterator =
((DependantValue)csChild0.getOrmElement()).getColumnIterator();
- while (columnIterator.hasNext()) {
- Object o = columnIterator.next();
- if (o instanceof Column) {
- Shape keyShape = childShape.getChild((Column)o);
- if (!isConnectionExist(csChild0, keyShape)) {
- new Connection(csChild0, keyShape);
+ Iterator it = ((DependantValue)csChild0.getOrmElement()).getColumnIterator();
+ while (it.hasNext()) {
+ Object el = it.next();
+ if (el instanceof Column) {
+ Column col = (Column)el;
+ Shape shape = childShape.getChild(col);
+ if (shape != null && !isConnectionExist(csChild0, shape)) {
+ new Connection(csChild0, shape);
csChild0.firePropertyChange(REFRESH, null, null);
- keyShape.firePropertyChange(REFRESH, null, null);
+ shape.firePropertyChange(REFRESH, null, null);
}
}
}
-
- Iterator iter = ((SimpleValue)csChild1.getOrmElement()).getColumnIterator();
- while (iter.hasNext()) {
- Object element = iter.next();
- if (element instanceof Column) {
- Column col = (Column)element;
- Shape elementShape = childShape.getChild(col);
- if (!isConnectionExist(csChild1, elementShape)){
- new Connection(csChild1, elementShape);
+ it = ((SimpleValue)csChild1.getOrmElement()).getColumnIterator();
+ while (it.hasNext()) {
+ Object el = it.next();
+ if (el instanceof Column) {
+ Column col = (Column)el;
+ Shape shape = childShape.getChild(col);
+ if (shape != null && !isConnectionExist(csChild1, shape)){
+ new Connection(csChild1, shape);
csChild1.firePropertyChange(REFRESH, null, null);
- elementShape.firePropertyChange(REFRESH, null, null);
+ shape.firePropertyChange(REFRESH, null, null);
}
}
}
@@ -647,33 +660,38 @@
public OrmShape getOrCreateComponentClass(Property property) {
OrmShape classShape = null;
- if (property != null) {
- if (property.getValue() instanceof Collection) {
- Component component = (Component)((Collection)property.getValue()).getElement();
- if (component != null) {
- classShape = createShape(property);
- OrmShape tableShape =
elements.get(HibernateUtils.getTableName(component.getTable()));
- if (tableShape == null) tableShape =
getOrCreateDatabaseTable(component.getTable());
- createConnections(classShape, tableShape);
- if (!isConnectionExist(classShape, tableShape)) {
- new Connection(classShape, tableShape);
- classShape.firePropertyChange(REFRESH, null, null);
- tableShape.firePropertyChange(REFRESH, null, null);
- }
- Shape parentShape = ((SpecialOrmShape)classShape).getParentShape();
- if (parentShape != null) {
- OrmShape parentClassShape =
elements.get(HibernateUtils.getPersistentClassName(((Property)parentShape.getOrmElement()).getPersistentClass().getEntityName()));
- if (!isConnectionExist(parentShape, parentClassShape)) {
- new Connection(parentShape, parentClassShape);
- parentShape.firePropertyChange(REFRESH, null, null);
- parentClassShape.firePropertyChange(REFRESH, null, null);
- }
- }
+ if (property == null) {
+ return classShape;
+ }
+ if (property.getValue() instanceof Collection) {
+ Component component = (Component)((Collection)property.getValue()).getElement();
+ if (component != null) {
+ classShape = createShape(property);
+ OrmShape tableShape =
elements.get(HibernateUtils.getTableName(component.getTable()));
+ if (tableShape == null) {
+ tableShape = getOrCreateDatabaseTable(component.getTable());
}
- } else if (property.getValue() instanceof Component) {
- classShape = elements.get(((Component)property.getValue()).getComponentClassName());
- if (classShape == null) classShape = createShape(property);
+ createConnections(classShape, tableShape);
+ if (!isConnectionExist(classShape, tableShape)) {
+ new Connection(classShape, tableShape);
+ classShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
+ }
+ Shape parentShape = ((SpecialOrmShape)classShape).getParentShape();
+ if (parentShape != null) {
+ OrmShape parentClassShape =
elements.get(HibernateUtils.getPersistentClassName(((Property)parentShape.getOrmElement()).getPersistentClass().getEntityName()));
+ if (!isConnectionExist(parentShape, parentClassShape)) {
+ new Connection(parentShape, parentClassShape);
+ parentShape.firePropertyChange(REFRESH, null, null);
+ parentClassShape.firePropertyChange(REFRESH, null, null);
+ }
+ }
}
+ } else if (property.getValue() instanceof Component) {
+ classShape = elements.get(((Component)property.getValue()).getComponentClassName());
+ if (classShape == null) {
+ classShape = createShape(property);
+ }
}
return classShape;
}
@@ -681,28 +699,31 @@
private OrmShape getOrCreateAssociationClass(Property property) {
OrmShape classShape = null;
OneToMany component = (OneToMany)((Collection)property.getValue()).getElement();
- if (component != null) {
- if (component.getAssociatedClass() instanceof RootClass) {
- classShape = getOrCreatePersistentClass(component.getAssociatedClass(), null);
- if (classShape == null) classShape = createShape(component.getAssociatedClass());
- OrmShape tableShape =
elements.get(HibernateUtils.getTableName(component.getAssociatedClass().getTable()));
- if (tableShape == null) tableShape =
getOrCreateDatabaseTable(component.getAssociatedClass().getTable());
- createConnections(classShape, tableShape);
- if(!isConnectionExist(classShape, tableShape)){
- new Connection(classShape, tableShape);
- classShape.firePropertyChange(REFRESH, null, null);
- tableShape.firePropertyChange(REFRESH, null, null);
- }
+ if (component == null) {
+ return classShape;
+ }
+ if (component.getAssociatedClass() instanceof RootClass) {
+ classShape = getOrCreatePersistentClass(component.getAssociatedClass(), null);
+ if (classShape == null) {
+ classShape = createShape(component.getAssociatedClass());
}
+ OrmShape tableShape =
elements.get(HibernateUtils.getTableName(component.getAssociatedClass().getTable()));
+ if (tableShape == null) {
+ tableShape = getOrCreateDatabaseTable(component.getAssociatedClass().getTable());
+ }
+ createConnections(classShape, tableShape);
+ if (!isConnectionExist(classShape, tableShape)) {
+ new Connection(classShape, tableShape);
+ classShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
+ }
}
return classShape;
}
-
-
-
+
public String getKey(Shape shape) {
Object element = shape.getOrmElement();
- String key=null;
+ String key = null;
if (element instanceof RootClass) {
key = HibernateUtils.getPersistentClassName(((RootClass)element).getEntityName());
} else if (element instanceof Table) {
@@ -713,7 +734,6 @@
} else if (element instanceof Subclass) {
key = HibernateUtils.getPersistentClassName(((Subclass)element).getEntityName());
}
-
return key;
}
@@ -773,7 +793,7 @@
fos = new FileOutputStream(file);
properties.store(fos, ""); //$NON-NLS-1$
} catch (IOException e) {
- VisualEditorPlugin.getDefault().logError("Can't save layout of
mapping.", e); //$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't save layout of
mapping.", e); //$NON-NLS-1$
} finally {
if (fos != null) {
try {
@@ -798,7 +818,7 @@
file.create(source, true, null);
}
} catch (CoreException e) {
- VisualEditorPlugin.getDefault().logError(e);
+ HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e);
//$NON-NLS-1$
}
}
return file;
@@ -818,7 +838,7 @@
loadSuccessfull = true;
}
} catch (IOException ex) {
- VisualEditorPlugin.getDefault().logError("Can't load layout of
mapping.", ex); //$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't load layout of
mapping.", ex); //$NON-NLS-1$
} finally {
if (fis != null) {
try {
@@ -845,7 +865,7 @@
}
public void setState(Properties properties,Shape shape, boolean value) {
- setState(properties, getKey(shape)+".state", value); //$NON-NLS-1$
+ setState(properties, getKey(shape) + ".state", value); //$NON-NLS-1$
}
private boolean getState(Properties properties, String key) {
@@ -855,15 +875,15 @@
private Point getPoint(Properties properties, String key) {
Point point = new Point(0, 0);
- String str = properties.getProperty(key+".x", "0"); //$NON-NLS-1$
//$NON-NLS-2$
+ String str = properties.getProperty(key + ".x", "0"); //$NON-NLS-1$
//$NON-NLS-2$
point.x = Integer.parseInt(str);
- String str2 = properties.getProperty(key+".y", "0"); //$NON-NLS-1$
//$NON-NLS-2$
+ String str2 = properties.getProperty(key + ".y", "0");
//$NON-NLS-1$ //$NON-NLS-2$
point.y = Integer.parseInt(str2);
return point;
}
private void setPoint(Properties properties, String key, Point point) {
- String key1 = key+".x"; //$NON-NLS-1$
+ String key1 = key + ".x"; //$NON-NLS-1$
if (!properties.containsKey(key1)) {
properties.remove(key1);
properties.put(key1, "" + point.x); //$NON-NLS-1$
@@ -889,7 +909,7 @@
}
public boolean getState(Properties properties, Shape shape){
- return getState(properties, getKey(shape)+".state"); //$NON-NLS-1$
+ return getState(properties, getKey(shape) + ".state"); //$NON-NLS-1$
}
public ConsoleConfiguration getConsoleConfig() {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -40,7 +40,7 @@
Shape bodyOrmShape;
Object ormElement = getOrmElement();
if (ormElement instanceof RootClass) {
- RootClass rootClass = (RootClass)getOrmElement();
+ RootClass rootClass = (RootClass)ormElement;
Property identifierProperty = rootClass.getIdentifierProperty();
if (identifierProperty != null) {
addChild(new Shape(identifierProperty));
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/Shape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/Shape.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/Shape.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -20,7 +20,7 @@
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Value;
import org.jboss.tools.hibernate.ui.view.views.HibernateUtils;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelNameVisitor;
+import org.jboss.tools.hibernate.ui.view.views.OrmLabelProvider;
public class Shape extends ModelElement {
@@ -33,9 +33,9 @@
public static final String SHOW_SELECTION = "show selection"; //$NON-NLS-1$
public static final String SET_FOCUS = "set focus"; //$NON-NLS-1$
- private Object ormElement;
+ private Object ormElement;
- static OrmModelNameVisitor ormModelNameVisitor;
+ private static OrmLabelProvider labelProvider = new OrmLabelProvider();
private static IPropertyDescriptor[] descriptors_property;
private static IPropertyDescriptor[] descriptors_column;
@@ -61,8 +61,6 @@
static {
- ormModelNameVisitor = new OrmModelNameVisitor();
-
descriptors_property = new IPropertyDescriptor[] {
new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME),
new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
@@ -233,103 +231,87 @@
if (PROPERTY_NAME.equals(propertyId)) {
if (prop != null) {
res = prop.getName();
- }
- else if (col != null) {
+ } else if (col != null) {
res = col.getName();
}
- }
- else if (PROPERTY_TYPE.equals(propertyId)) {
+ } else if (PROPERTY_TYPE.equals(propertyId)) {
if (prop != null) {
Value value = prop.getValue();
if (value instanceof Component) {
res = prop.getValue().toString();
- }
- else {
+ } else {
res = prop.getType().getReturnedClass().getName();
}
- }
- else if (col != null) {
- String type = ormModelNameVisitor.getColumnSqlType(col,
getOrmDiagram().getConsoleConfig());
-
+ } else if (col != null) {
+ String sqlType = col.getSqlType();
+ if (sqlType == null) {
+ labelProvider.setConfig(getOrmDiagram().getConsoleConfig().getConfiguration());
+ labelProvider.updateColumnSqlType(col);
+ sqlType = col.getSqlType();
+ }
StringBuffer name = new StringBuffer();
-
- if (type != null) {
- name.append(type.toUpperCase());
+ if (sqlType != null) {
+ name.append(sqlType.toUpperCase());
name.append(HibernateUtils.getTable(col) != null
&& HibernateUtils.isPrimaryKey(col) ? " PK" : "");
//$NON-NLS-1$ //$NON-NLS-2$
name.append(HibernateUtils.getTable(col) != null
&& HibernateUtils.isForeignKey(col) ? " FK" : "");
//$NON-NLS-1$ //$NON-NLS-2$
}
-
res = name.toString();
}
- }
- else if (PROPERTY_VALUE.equals(propertyId)) {
+ } else if (PROPERTY_VALUE.equals(propertyId)) {
if (prop != null) {
res = prop.getValue().toString();
- }
- else if (getOrmElement() instanceof Column) {
+ } else if (getOrmElement() instanceof Column) {
res = col.getValue().toString();
}
- }
- else if (PROPERTY_CLASS.equals(propertyId)) {
+ } else if (PROPERTY_CLASS.equals(propertyId)) {
if (prop != null) {
if (prop.getPersistentClass() != null) {
res = prop.getPersistentClass().getClassName();
}
}
- }
- else if (PROPERTY_SELECT.equals(propertyId)) {
+ } else if (PROPERTY_SELECT.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isSelectable()).toString();
}
- }
- else if (PROPERTY_INSERT.equals(propertyId)) {
+ } else if (PROPERTY_INSERT.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isInsertable()).toString();
}
- }
- else if (PROPERTY_UPDATE.equals(propertyId)) {
+ } else if (PROPERTY_UPDATE.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isUpdateable()).toString();
}
- }
- else if (PROPERTY_CASCADE.equals(propertyId)) {
+ } else if (PROPERTY_CASCADE.equals(propertyId)) {
if (prop != null) {
res = prop.getCascade();
}
- }
- else if (PROPERTY_LAZY.equals(propertyId)) {
+ } else if (PROPERTY_LAZY.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isLazy()).toString();
}
- }
- else if (PROPERTY_OPTIONAL.equals(propertyId)) {
+ } else if (PROPERTY_OPTIONAL.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isOptional()).toString();
}
- }
- else if (PROPERTY_NATURAL_IDENTIFIER.equals(propertyId)) {
+ } else if (PROPERTY_NATURAL_IDENTIFIER.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isNaturalIdentifier()).toString();
}
- }
- else if (PROPERTY_NODE_NAME.equals(propertyId)) {
+ } else if (PROPERTY_NODE_NAME.equals(propertyId)) {
if (prop != null) {
res = prop.getNodeName();
}
- }
- else if (PROPERTY_OPTIMISTIC_LOCKED.equals(propertyId)) {
+ } else if (PROPERTY_OPTIMISTIC_LOCKED.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isOptimisticLocked()).toString();
}
- }
- else if (PROPERTY_NULLABLE.equals(propertyId)) {
+ } else if (PROPERTY_NULLABLE.equals(propertyId)) {
if (col != null) {
res = Boolean.valueOf(col.isNullable()).toString();
}
- }
- else if (PROPERTY_UNIQUE.equals(propertyId)) {
+ } else if (PROPERTY_UNIQUE.equals(propertyId)) {
if (col != null) {
res = Boolean.valueOf(col.isUnique()).toString();
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -12,12 +12,13 @@
import java.util.Iterator;
+import org.hibernate.MappingException;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.execution.ExecutionContext.Command;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
import org.hibernate.type.Type;
-import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
public class SpecialOrmShape extends OrmShape {
private Shape parentShape;
@@ -27,6 +28,7 @@
// generate();
}
+ @SuppressWarnings("unchecked")
protected void generate() {
Shape bodyOrmShape;
RootClass rootClass = (RootClass)getOrmElement();
@@ -42,37 +44,33 @@
parentShape = bodyOrmShape;
}
- Iterator iterator = rootClass.getPropertyIterator();
+ Iterator<Property> iterator = rootClass.getPropertyIterator();
while (iterator.hasNext()) {
- Property field = (Property)iterator.next();
- try {
- Type type = null;
- if (getOrmDiagram() != null){
- ConsoleConfiguration cfg = getOrmDiagram().getConsoleConfig();
- final Property fField = field;
- type = (Type) cfg.execute(new Command(){
- public Object execute() {
- return fField.getValue().getType();
- }});
- } else {
- try{
- type = field.getValue().getType();
- } catch (Exception e){
- //type is not accessible
- VisualEditorPlugin.getDefault().logError(e);
- }
+ Property field = iterator.next();
+ Type type = null;
+ if (getOrmDiagram() != null){
+ ConsoleConfiguration cfg = getOrmDiagram().getConsoleConfig();
+ final Property fField = field;
+ type = (Type) cfg.execute(new Command(){
+ public Object execute() {
+ return fField.getValue().getType();
+ }});
+ } else {
+ try{
+ type = field.getValue().getType();
+ } catch (MappingException e){
+ //type is not accessible
+ HibernateConsolePlugin.getDefault().logErrorMessage("MappingException: ",
e); //$NON-NLS-1$
}
- if (type != null && type.isEntityType()) {
- bodyOrmShape = new ExpandeableShape(field);
- } else if (type != null && type.isCollectionType()) {
- bodyOrmShape = new ComponentShape(field);
- } else {
- bodyOrmShape = new Shape(field);
- }
- addChild(bodyOrmShape);
- } catch (Exception e) {
- VisualEditorPlugin.getDefault().logError(e);
}
+ if (type != null && type.isEntityType()) {
+ bodyOrmShape = new ExpandeableShape(field);
+ } else if (type != null && type.isCollectionType()) {
+ bodyOrmShape = new ComponentShape(field);
+ } else {
+ bodyOrmShape = new Shape(field);
+ }
+ addChild(bodyOrmShape);
}
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -19,40 +19,53 @@
import org.hibernate.mapping.RootClass;
// TODO: What is this ? And why is it extending mapping classes ?!
+// vitali: it seems this is class to "wrap" properties set to RootClass
+//
+// TODO: vitali: try to change "extends RootClass" into property
public class SpecialRootClass extends RootClass {
+//public class SpecialRootClass {
private Property property;
private Property parentProperty;
+ //protected String entityName;
+ //protected String className;
+ //protected ArrayList properties = new ArrayList();
+ //protected RootClass rootClass;
+
public SpecialRootClass(Property property) {
- super();
this.property = property;
+ //this.rootClass = null;
generate();
}
+ @SuppressWarnings("unchecked")
private void generate() {
- if (property != null) {
- Component component = null;
- if (property.getValue() instanceof Collection) {
- Collection collection = (Collection)property.getValue();
- component = (Component)collection.getElement();
- } else if (property.getValue() instanceof Component) {
- component = (Component)property.getValue();
+ if (property == null) {
+ return;
+ }
+ Component component = null;
+ if (property.getValue() instanceof Collection) {
+ Collection collection = (Collection)property.getValue();
+ component = (Component)collection.getElement();
+ } else if (property.getValue() instanceof Component) {
+ component = (Component)property.getValue();
+ }
+ if (component != null) {
+ setClassName(component.getComponentClassName());
+ setEntityName(component.getComponentClassName());
+ PersistentClass ownerClass = component.getOwner();
+ if (component.getParentProperty() != null) {
+ parentProperty = new Property();
+ parentProperty.setName(component.getParentProperty());
+ parentProperty.setPersistentClass(ownerClass);
}
- if (component != null) {
- setClassName(component.getComponentClassName());
- setEntityName(component.getComponentClassName());
- PersistentClass ownerClass = component.getOwner();
- if (component.getParentProperty() != null) {
- parentProperty = new Property();
- parentProperty.setName(component.getParentProperty());
- parentProperty.setPersistentClass(ownerClass);
+ Iterator<Property> iterator = component.getPropertyIterator();
+ while (iterator.hasNext()) {
+ Property property = iterator.next();
+ if (property != null) {
+ addProperty(property);
}
- Iterator iterator = component.getPropertyIterator();
- while (iterator.hasNext()) {
- Property property = (Property)iterator.next();
- if (property != null) addProperty(property);
- }
}
}
}
@@ -64,4 +77,53 @@
public Property getProperty() {
return this.property;
}
+ /** /
+ public String getEntityName() {
+ if (rootClass != null) {
+ return rootClass.getEntityName();
+ }
+ return entityName;
+ }
+
+ public void setEntityName(String entityName) {
+ if (rootClass != null) {
+ rootClass.setEntityName(className);
+ }
+ this.entityName = entityName;
+ }
+
+ public String getClassName() {
+ if (rootClass != null) {
+ return rootClass.getClassName();
+ }
+ return className;
+ }
+
+ public void setClassName(String className) {
+ if (rootClass != null) {
+ rootClass.setClassName(className);
+ }
+ this.className = className;
+ }
+
+ public void addProperty(Property p) {
+ properties.add(p);
+ p.setPersistentClass(rootClass);
+ }
+
+ public RootClass getRootClass() {
+ return rootClass;
+ }
+
+ public void setRootClass(RootClass rootClass) {
+ this.rootClass = rootClass;
+ if (rootClass != null) {
+ this.entityName = rootClass.getEntityName();
+ this.className = rootClass.getClassName();
+ } else {
+ this.entityName = null;
+ this.className = null;
+ }
+ }
+ /**/
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -37,11 +37,11 @@
import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.CreateRequest;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Table;
-import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
import org.jboss.tools.hibernate.ui.veditor.editors.VisualEditor;
import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.AutoLayout;
import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.IItemInfo;
@@ -110,7 +110,7 @@
ormShape.setLocation(new Point(Integer
.parseInt(xy[0]), Integer.parseInt(xy[1])));
} catch (NumberFormatException e) {
- VisualEditorPlugin.getDefault().logError(e);
+ HibernateConsolePlugin.getDefault().logErrorMessage("NumberFormatException:
", e); //$NON-NLS-1$
}
}
if (xy.length > 2) {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramTreeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramTreeEditPart.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramTreeEditPart.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -19,8 +19,8 @@
*
* @param model Model for this.
*/
- public DiagramTreeEditPart(Object model) {
- super (model);
+ public DiagramTreeEditPart(OrmDiagram model) {
+ super(model);
}
/**
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeTreeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeTreeEditPart.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeTreeEditPart.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -11,15 +11,12 @@
import org.jboss.tools.hibernate.ui.veditor.editors.model.ExpandeableShape;
import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
import org.jboss.tools.hibernate.ui.view.views.OrmLabelProvider;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelImageVisitor;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelNameVisitor;
public class ExpandeableShapeTreeEditPart extends
org.eclipse.gef.editparts.AbstractTreeEditPart implements
PropertyChangeListener {
- static final protected OrmLabelProvider ormLabelProvider = new OrmLabelProvider(
- new OrmModelImageVisitor(), new OrmModelNameVisitor());
+ protected OrmLabelProvider ormLabelProvider;
/**
* Constructor initializes this with the given model.
@@ -27,8 +24,10 @@
* @param model
* Model for this.
*/
- public ExpandeableShapeTreeEditPart(Object model) {
+ public ExpandeableShapeTreeEditPart(ExpandeableShape model) {
super(model);
+ ConsoleConfiguration cfg = model.getOrmDiagram().getConsoleConfig();
+ ormLabelProvider = new OrmLabelProvider(cfg.getConfiguration());
}
/**
@@ -65,14 +64,10 @@
if (getWidget() instanceof Tree) {
return;
}
-
Shape model = (Shape) getModel();
-
Object element = model.getOrmElement();
- ConsoleConfiguration cfg = model.getOrmDiagram().getConsoleConfig();
-
setWidgetImage(ormLabelProvider.getImage(element));
- setWidgetText(ormLabelProvider.getText(element, cfg));
+ setWidgetText(ormLabelProvider.getText(element));
}
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/GEFRootEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/GEFRootEditPart.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/GEFRootEditPart.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.veditor.editors.parts;
-import java.util.List;
-
import org.eclipse.draw2d.ConnectionLayer;
import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.LayerConstants;
@@ -25,14 +23,12 @@
super();
}
+ @SuppressWarnings("unchecked")
public void setToFront(AbstractConnectionEditPart editpart) {
ConnectionLayer layer = (ConnectionLayer)getLayer(LayerConstants.CONNECTION_LAYER);
IFigure fig = editpart.getFigure();
-
- List children = layer.getChildren();
-
- children.remove(fig);
- children.add(fig);
+ layer.getChildren().remove(fig);
+ layer.getChildren().add(fig);
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -47,16 +47,24 @@
import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
import org.jboss.tools.hibernate.ui.view.views.OrmLabelProvider;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelImageVisitor;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelNameVisitor;
-public class ShapeEditPart extends
-OrmEditPart implements PropertyChangeListener, NodeEditPart {
+public class ShapeEditPart extends OrmEditPart implements PropertyChangeListener,
NodeEditPart {
- static final protected OrmLabelProvider ormLabelProvider =
- new OrmLabelProvider(new OrmModelImageVisitor(), new OrmModelNameVisitor());
+ protected OrmLabelProvider ormLabelProvider = new OrmLabelProvider();
+ public void setModel(Object model) {
+ super.setModel(model);
+ ModelElement modelTmp = (ModelElement)model;
+ while (modelTmp.getParent() != null) {
+ modelTmp = modelTmp.getParent();
+ }
+ if (modelTmp instanceof OrmDiagram) {
+ ConsoleConfiguration consoleConfig = ((OrmDiagram)modelTmp).getConsoleConfig();
+ ormLabelProvider.setConfig(consoleConfig.getConfiguration());
+ }
+ }
+
protected void createEditPolicies() {
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
ShapesSelectionEditPolicy());
}
@@ -65,15 +73,7 @@
protected IFigure createFigure() {
if (getModel() instanceof Shape) {
Label label = new Label();
- ModelElement model = (ModelElement) getModel();
- while (model.getParent() != null) {
- model = model.getParent();
- }
- ConsoleConfiguration cfg = null;
- if (model instanceof OrmDiagram) {
- cfg = ((OrmDiagram) model).getConsoleConfig();
- }
- label.setText(ormLabelProvider.getText(getElement(), cfg));
+ label.setText(ormLabelProvider.getText(getElement()));
label.setBackgroundColor(getColor());
label.setIcon(ormLabelProvider.getImage(getElement()));
label.setLabelAlignment(PositionConstants.LEFT);
@@ -119,14 +119,14 @@
public void activate() {
if (!isActive()) {
super.activate();
- ((ModelElement) getModel()).addPropertyChangeListener(this);
+ getCastedModel().addPropertyChangeListener(this);
}
}
public void deactivate() {
if (isActive()) {
super.deactivate();
- ((ModelElement) getModel()).removePropertyChangeListener(this);
+ getCastedModel().removePropertyChangeListener(this);
}
}
@@ -243,28 +243,28 @@
protected void hideSelection() {
getCastedModel().hideSelection();
- Iterator iter = getCastedModel().getSourceConnections().iterator();
+ Iterator<Connection> iter = getCastedModel().getSourceConnections().iterator();
while (iter.hasNext()) {
- Connection element = (Connection) iter.next();
+ Connection element = iter.next();
element.hideSelection();
}
iter = getCastedModel().getTargetConnections().iterator();
while (iter.hasNext()) {
- Connection element = (Connection) iter.next();
+ Connection element = iter.next();
element.hideSelection();
}
}
protected void showSelection() {
getCastedModel().showSelection();
- Iterator iter = getCastedModel().getSourceConnections().iterator();
+ Iterator<Connection> iter =
getCastedModel().getSourceConnections().iterator();
while (iter.hasNext()) {
- Connection element = (Connection) iter.next();
+ Connection element = iter.next();
element.showSelection();
}
iter = getCastedModel().getTargetConnections().iterator();
while (iter.hasNext()) {
- Connection element = (Connection) iter.next();
+ Connection element = iter.next();
element.showSelection();
}
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeTreeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeTreeEditPart.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeTreeEditPart.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -10,15 +10,12 @@
import org.jboss.tools.hibernate.ui.veditor.editors.model.ExpandeableShape;
import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
import org.jboss.tools.hibernate.ui.view.views.OrmLabelProvider;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelImageVisitor;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelNameVisitor;
public class ShapeTreeEditPart extends
org.eclipse.gef.editparts.AbstractTreeEditPart implements
PropertyChangeListener {
- static final protected OrmLabelProvider ormLabelProvider = new OrmLabelProvider(
- new OrmModelImageVisitor(), new OrmModelNameVisitor());
+ protected OrmLabelProvider ormLabelProvider;
/**
* Constructor initializes this with the given model.
@@ -26,8 +23,10 @@
* @param model
* Model for this.
*/
- public ShapeTreeEditPart(Object model) {
+ public ShapeTreeEditPart(Shape model) {
super(model);
+ ConsoleConfiguration cfg = model.getOrmDiagram().getConsoleConfig();
+ ormLabelProvider = new OrmLabelProvider(cfg.getConfiguration());
}
/**
@@ -45,7 +44,7 @@
*
* @return <code>null</code>
*/
- protected List getModelChildren() {
+ protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -60,12 +59,9 @@
return;
}
Shape model = (Shape) getModel();
-
Object element = model.getOrmElement();
- ConsoleConfiguration cfg = model.getOrmDiagram().getConsoleConfig();
-
setWidgetImage(ormLabelProvider.getImage(element));
- setWidgetText(ormLabelProvider.getText(element, cfg));
+ setWidgetText(ormLabelProvider.getText(element));
}
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/TreePartFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/TreePartFactory.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/TreePartFactory.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -11,13 +11,13 @@
public EditPart createEditPart(EditPart context, Object modelElement) {
if (modelElement instanceof OrmDiagram) {
- return new DiagramTreeEditPart(modelElement);
+ return new DiagramTreeEditPart((OrmDiagram)modelElement);
}
if (modelElement instanceof ExpandeableShape) {
- return new ExpandeableShapeTreeEditPart(modelElement);
+ return new ExpandeableShapeTreeEditPart((ExpandeableShape)modelElement);
}
if (modelElement instanceof Shape) {
- return new ShapeTreeEditPart(modelElement);
+ return new ShapeTreeEditPart((Shape)modelElement);
}
throw new
RuntimeException(UIVEditorMessages.PartFactory_canot_create_part_for_model_element
+ ((modelElement != null) ? modelElement.getClass().getName()
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/BaseUIPlugin.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/BaseUIPlugin.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/BaseUIPlugin.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * Provides an easy way to log status of events.
- *
- * NOTE: It is useful to make the static method getPluginLog()
- * which provides the interface IPluginLog for using it in your code
- * in future
- *
- * @author Sergey Vasilyev
- *
- */
-
-public class BaseUIPlugin extends AbstractUIPlugin {
-
- public void logError(String message, Throwable t) {
- LogHelper.logError(this, message, t);
- }
-
- public void logError(String message) {
- LogHelper.logError(this, message);
- }
-
- public void logError(Throwable t) {
- LogHelper.logError(this, t);
- }
-
- public void logInfo(String message, Throwable t) {
- LogHelper.logInfo(this, message, t);
- }
-
- public void logInfo(String message) {
- LogHelper.logInfo(this, message);
- }
-
- public void logWarning(String message, Throwable t) {
- LogHelper.logWarning(this, message, t);
- }
-
- public void logWarning(String message) {
- LogHelper.logWarning(this, message);
- }
-
- public void logWarning(Throwable t) {
- LogHelper.logWarning(this, t);
- }
-
- public void showError(String message, Throwable t) {
- logError(message, t);
- Shell shell = Display.getDefault().getActiveShell();
- IStatus s = StatusFactory.getInstance(IStatus.ERROR,
this.getBundle().getSymbolicName(), message, t);
- ErrorDialog.openError(shell, UIViewMessages.BaseUIPlugin_hibernate_console, message,
s);
- }
-}
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -19,11 +19,4 @@
return '!' + key + '!';
}
}
-
- /**
- * @deprecated use bundle via ImageBundle.getString()
- */
- public static ResourceBundle getBundle() {
- return RESOURCE_BUNDLE;
- }
}
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/LogHelper.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/LogHelper.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/LogHelper.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view;
-
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.Bundle;
-
-public class LogHelper {
- public static void logError(Plugin plugin, Throwable t) {
- logError(plugin, null, t);
- }
-
- public static void logError(Plugin plugin, String message) {
- logError(plugin, message, null);
- }
-
- public static void logError(Plugin plugin, String message, Throwable t) {
- IStatus status = StatusFactory.getInstance(IStatus.ERROR,
- plugin.getBundle().getSymbolicName(), message, t);
- logStatus(plugin, status);
- }
-
- public static void logError(String pluginId, Throwable t) {
- logError(pluginId, null, t);
- }
-
- public static void logError(String pluginId, String message) {
- logError(pluginId, message, null);
- }
-
- public static void logError(String pluginId, String message, Throwable t) {
- IStatus status = StatusFactory.getInstance(IStatus.ERROR, pluginId,
- message, t);
- logStatus(pluginId, status);
- }
-
- public static void logWarning(Plugin plugin, Throwable t) {
- logWarning(plugin, null, t);
- }
-
- public static void logWarning(Plugin plugin, String message) {
- logWarning(plugin, message, null);
- }
-
-
- public static void logWarning(Plugin plugin, String message, Throwable t) {
- IStatus status = StatusFactory.getInstance(IStatus.WARNING,
- plugin.getBundle().getSymbolicName(), message, t);
- logStatus(plugin, status);
- }
-
- public static void logWarning(String pluginId, Throwable t) {
- logWarning(pluginId, null, t);
- }
-
- public static void logWarning(String pluginId, String message) {
- logWarning(pluginId, message, null);
- }
-
-
- public static void logWarning(String pluginId, String message,
- Throwable t) {
- IStatus status = StatusFactory.getInstance(IStatus.WARNING, pluginId,
- message, t);
- logStatus(pluginId, status);
- }
-
- public static void logInfo(Plugin plugin, String message,
- Throwable t) {
- IStatus status = StatusFactory.getInstance(IStatus.INFO,
- plugin.getBundle().getSymbolicName(), message, t);
- logStatus(plugin, status);
- }
-
-
- public static void logInfo(Plugin plugin, String message) {
- IStatus status = StatusFactory.getInstance(IStatus.INFO,
- plugin.getBundle().getSymbolicName(), message);
- logStatus(plugin, status);
- }
-
- public static void logInfo(String pluginId, String message,
- Throwable t) {
- IStatus status = StatusFactory.getInstance(IStatus.INFO, pluginId,
- message, t);
- logStatus(pluginId, status);
- }
-
- public static void logInfo(String pluginId, String message) {
- IStatus status = StatusFactory.getInstance(IStatus.INFO, pluginId,
- message);
- logStatus(pluginId, status);
- }
-
- public static void log(int severity, String pluginId, int code,
- String message, Throwable t) {
- IStatus status = StatusFactory.getInstance(severity, pluginId, code,
- message, t);
- logStatus(pluginId, status);
- }
-
- public static void logStatus(Plugin plugin, IStatus status) {
- plugin.getLog().log(status);
- }
-
- public static void logStatus(String pluginId, IStatus status) {
- Bundle bundle = Platform.getBundle(pluginId);
- logStatus(bundle, status);
- }
-
- public static void logStatus(Bundle bundle, IStatus status) {
- ILog log = Platform.getLog(bundle);
- log.log(status);
- }
-}
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/StatusFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/StatusFactory.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/StatusFactory.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-public class StatusFactory {
- public final static int UNDEFINED_ERROR = 0;
- public final static String UNSPECIFIED_MESSAGE = null;
- public final static String EMPTY_MESSAGE = ""; //$NON-NLS-1$
- public final static String EMPTY_PLUGIN = ""; //$NON-NLS-1$
-
- public static IStatus getInstance(int severity, String pluginId,
- int code, String message, Throwable t) {
- return new Status(severity, pluginId == null ? EMPTY_PLUGIN : pluginId,
- code, checkMessage(message, t) , t);
- }
-
- public static IStatus getInstance(int severity, int code, String message,
- Throwable t) {
- return getInstance(severity, EMPTY_PLUGIN, code, message, t);
- }
-
- public static IStatus getInstance(int severity, String pluginId,
- String message, Throwable t) {
- return getInstance(severity, pluginId, UNDEFINED_ERROR, message, t);
- }
-
- public static IStatus getInstance(int severity, String pluginId,
- String message) {
- return getInstance(severity, pluginId, UNDEFINED_ERROR, message, null);
- }
-
- public static IStatus getInstance(int severity, String pluginId,
- Throwable t) {
- return getInstance(severity, pluginId, UNDEFINED_ERROR, EMPTY_MESSAGE, t);
- }
-
- public static IStatus getInstance(int severity, String pluginId,
- int code, Throwable t) {
- return getInstance(severity, pluginId, code, EMPTY_MESSAGE, t);
- }
-
- public static IStatus getInstance(int severity, String pluginId,
- int code, String message) {
- return getInstance(severity, pluginId, code, message, null);
- }
-
- private static String checkMessage(String message, Throwable t) {
- if (message == UNSPECIFIED_MESSAGE) {
- if (t != null && t.getMessage() != null) {
- return t.getMessage();
- }
-
- return EMPTY_MESSAGE;
- }
-
- return message;
- }
-}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -9,6 +9,8 @@
public static String OrmLabelProvider_element;
public static String OrmLabelProvider_orm_element;
public static String OrmLabelProvider_unknown_type_of_element_in_tree_of_type;
+ public static String ViewPlugin_no_message_1;
+ public static String ViewPlugin_no_message_2;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, UIViewMessages.class);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties 2009-07-01
14:17:22 UTC (rev 16319)
@@ -4,3 +4,6 @@
OrmLabelProvider_element=element
OrmLabelProvider_orm_element=OrmElement
OrmLabelProvider_unknown_type_of_element_in_tree_of_type=Unknown type of element in tree
of type:
+
+ViewPlugin_no_message_1=: <no message>
+ViewPlugin_no_message_2=<No message>
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -10,63 +10,40 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.view;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.MissingResourceException;
-import java.util.Properties;
-import java.util.ResourceBundle;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The main plugin class to be used in the desktop.
*/
-public class ViewPlugin extends BaseUIPlugin {
- private static ViewPlugin plugin;
- private ResourceBundle resourceBundle;
+public class ViewPlugin extends AbstractUIPlugin {
- /**
- * @deprecated use bundle via ImageBundle.getString()
- */
- public static final ResourceBundle BUNDLE_IMAGE = ImageBundle.getBundle();
+ public static final String ID = "org.jboss.tools.hibernate.view";
//$NON-NLS-1$
- public static boolean TRACE = false;
- public static boolean TRACE_VIEW = false;
- public static boolean TRACE_WIZARD = false;
+ private static ViewPlugin plugin;
- public static final String PLUGIN_ID = "org.jboss.tools.hibernate.view";
//$NON-NLS-1$
- public static final String autoMappingSettingPrefPage =
"autoMappingSettingPrefPage"; //$NON-NLS-1$
-
public ViewPlugin() {
super();
setPlugin(this);
-
- try {
- resourceBundle = ResourceBundle.getBundle(PLUGIN_ID +
".EditPluginResources"); //$NON-NLS-1$
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
}
public static ImageDescriptor getImageDescriptor(String name) {
- String iconPath = "images/"; //$NON-NLS-1$
+ final String iconPath = "images/"; //$NON-NLS-1$
+ final URL installURL = getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
+ URL url = null;
try {
- URL installURL = getDefault().getBundle().getEntry("/");; //$NON-NLS-1$
- URL url = new URL(installURL, iconPath + name);
- return ImageDescriptor.createFromURL(url);
+ url = new URL(installURL, iconPath + name);
} catch (MalformedURLException e) {
- return ImageDescriptor.getMissingImageDescriptor();
}
+ return ImageDescriptor.createFromURL(url);
}
public void start(BundleContext context) throws Exception {
@@ -85,60 +62,10 @@
ViewPlugin.plugin = plugin;
}
- public static String getResourceString(String key) {
- ResourceBundle bundle = ViewPlugin.getDefault().getResourceBundle();
- try {
- return (bundle != null) ? bundle.getString(key) : key;
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-
- public static Shell getActiveWorkbenchShell() {
- IWorkbenchWindow window = getActiveWorkbenchWindow();
- if (window != null) {
- return window.getShell();
- }
- return null;
- }
-
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
- return getDefault().getWorkbench().getActiveWorkbenchWindow();
- }
-
public static IWorkbenchPage getPage(){
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
return window.getActivePage();
}
- static {
-
- String value = Platform.getDebugOption(PLUGIN_ID + "/debug"); //$NON-NLS-1$
- if (value != null && value.equalsIgnoreCase("true")) TRACE = true;
//$NON-NLS-1$
-
- value = Platform.getDebugOption(PLUGIN_ID + "/debug/view"); //$NON-NLS-1$
- if (value != null && value.equalsIgnoreCase("true")) TRACE_VIEW =
true; //$NON-NLS-1$
-
- value = Platform.getDebugOption(PLUGIN_ID + "/debug/view/wizard");
//$NON-NLS-1$
- if (value != null && value.equalsIgnoreCase("true")) TRACE_WIZARD =
true; //$NON-NLS-1$
-
- }
-
- public static void loadPreferenceStoreProperties(Properties properties, String key){
- IPreferenceStore preferenceStore = ViewPlugin.getDefault().getPreferenceStore();
- String value = preferenceStore.getString(key);
- if (value.length() != 0){
- ByteArrayInputStream bain = new ByteArrayInputStream(value.getBytes());
- try {
- properties.load(bain);
- } catch (IOException e) {
- getDefault().logError(UIViewMessages.ViewPlugin_canot_load_preference_store_properties,
e);
- }
- }
- }
}
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,65 +1,65 @@
# START NON-TRANSLATABLE
-#OrmModelImageVisitor
-OrmModelImageVisitor.OrmModel=exdOrmModel.gif
-OrmModelImageVisitor.DatabaseSchema=exdDatabaseSchema.gif
-OrmModelImageVisitor.DatabaseTable=exdDatabaseTable.gif
-OrmModelImageVisitor.DatabaseView=exdDatabaseView.gif
-OrmModelImageVisitor.DatabaseConstraint=exdDatabaseConstraint1.gif
-OrmModelImageVisitor.Package=exdPackage.gif
-OrmModelImageVisitor.Mapping=exdMapping.gif
-OrmModelImageVisitor.MappingStorage=exdMappingStorage.gif
-OrmModelImageVisitor.PersistentClass=exdPersistentClass.gif
-OrmModelImageVisitor.PersistentField=exdPersistentField.gif
+#Image
+Image_OrmModel=exdOrmModel.gif
+Image_DatabaseSchema=exdDatabaseSchema.gif
+Image_DatabaseTable=exdDatabaseTable.gif
+Image_DatabaseView=exdDatabaseView.gif
+Image_DatabaseConstraint=exdDatabaseConstraint1.gif
+Image_Package=exdPackage.gif
+Image_Mapping=exdMapping.gif
+Image_MappingStorage=exdMappingStorage.gif
+Image_PersistentClass=exdPersistentClass.gif
+Image_PersistentField=exdPersistentField.gif
-OrmModelImageVisitor.PersistentClassMapping=exdPersistentClassMapping.gif
-#OrmModelImageVisitor.PersistentRootClassMapping=exdPersistentRootClassMapping.gif
-OrmModelImageVisitor.PersistentRootClassMapping=exdPersistentRootClassMappingC.gif
-OrmModelImageVisitor.PersistentSubclassMapping=exdPersistentSubclassMapping.gif
-OrmModelImageVisitor.PersistentUnionSubclassMapping=exdPersistentUnionSubclassMapping.gif
-OrmModelImageVisitor.PersistentJoinedSubclassMapping=exdPersistentJoinedSubclassMapping.gif
+Image_PersistentClassMapping=exdPersistentClassMapping.gif
+#Image_PersistentRootClassMapping=exdPersistentRootClassMapping.gif
+Image_PersistentRootClassMapping=exdPersistentRootClassMappingC.gif
+Image_PersistentSubclassMapping=exdPersistentSubclassMapping.gif
+Image_PersistentUnionSubclassMapping=exdPersistentUnionSubclassMapping.gif
+Image_PersistentJoinedSubclassMapping=exdPersistentJoinedSubclassMapping.gif
-OrmModelImageVisitor.PersistentFieldMapping=exdPersistentFieldMapping1.gif
-OrmModelImageVisitor.PersistentValueMapping=exdPersistentValueMapping1.gif
+Image_PersistentFieldMapping=exdPersistentFieldMapping1.gif
+Image_PersistentValueMapping=exdPersistentValueMapping1.gif
-##OrmModelImageVisitor for PersistentField
-OrmModelImageVisitor.PersistentFieldAny=any.gif
-OrmModelImageVisitor.PersistentFieldComponent=component.gif
-OrmModelImageVisitor.PersistentFieldComponent_id=component_id.gif
-OrmModelImageVisitor.PersistentFieldMany-to-any=many-to-any.gif
-OrmModelImageVisitor.PersistentFieldMany-to-many=many-to-many.gif
-OrmModelImageVisitor.PersistentFieldMany-to-one=many-to-one.gif
-OrmModelImageVisitor.PersistentFieldMany-to-one_id=many-to-one_id.gif
-OrmModelImageVisitor.PersistentFieldOne-to-many=one-to-many.gif
-OrmModelImageVisitor.PersistentFieldOne-to-one=one-to-one.gif
-OrmModelImageVisitor.PersistentFieldOne-to-one_id=one-to-one_id.gif
-OrmModelImageVisitor.PersistentFieldSimple=simple.gif
-OrmModelImageVisitor.PersistentFieldSimple_id=simple_id.gif
-OrmModelImageVisitor.PersistentFieldSimple_version=simple_version.gif
-OrmModelImageVisitor.PersistentFieldNot_mapped=not_mapped.gif
-OrmModelImageVisitor.PersistentFieldParent=parent.gif
+##Image for PersistentField
+Image_PersistentFieldAny=any.gif
+Image_PersistentFieldComponent=component.gif
+Image_PersistentFieldComponent_id=component_id.gif
+Image_PersistentFieldMany-to-any=many-to-any.gif
+Image_PersistentFieldMany-to-many=many-to-many.gif
+Image_PersistentFieldMany-to-one=many-to-one.gif
+Image_PersistentFieldMany-to-one_id=many-to-one_id.gif
+Image_PersistentFieldOne-to-many=one-to-many.gif
+Image_PersistentFieldOne-to-one=one-to-one.gif
+Image_PersistentFieldOne-to-one_id=one-to-one_id.gif
+Image_PersistentFieldSimple=simple.gif
+Image_PersistentFieldSimple_id=simple_id.gif
+Image_PersistentFieldSimple_version=simple_version.gif
+Image_PersistentFieldNot_mapped=not_mapped.gif
+Image_PersistentFieldParent=parent.gif
-##OrmModelImageVisitor for Collection
-OrmModelImageVisitor.Collection=collection.gif
-OrmModelImageVisitor.Collection_array=collection_array.gif
-OrmModelImageVisitor.Collection_primitive_array=collection_primitive_array.gif
-OrmModelImageVisitor.Collection_set=collection_set.gif
-OrmModelImageVisitor.Collection_bag=collection_bag.gif
-OrmModelImageVisitor.Collection_idbag=collection_idbag.gif
-OrmModelImageVisitor.Collection_list=collection_list.gif
-OrmModelImageVisitor.Collection_map=collection_map.gif
-OrmModelImageVisitor.NamedQueryMapping=hql.gif
+##Image for Collection
+Image_Collection=collection.gif
+Image_Collection_array=collection_array.gif
+Image_Collection_primitive_array=collection_primitive_array.gif
+Image_Collection_set=collection_set.gif
+Image_Collection_bag=collection_bag.gif
+Image_Collection_idbag=collection_idbag.gif
+Image_Collection_list=collection_list.gif
+Image_Collection_map=collection_map.gif
+Image_NamedQueryMapping=hql.gif
-##OrmModelImageVisitor for IDatabaseColumn
-OrmModelImageVisitor.DatabaseColumn=exdDatabaseColumn.gif
-OrmModelImageVisitor.DatabasePrimaryKeyColumn=exdDatabasePrimaryKeyColumn.gif
-OrmModelImageVisitor.DatabaseForeignKeyColumn=exdDatabaseForeignKeyColumn.gif
-OrmModelImageVisitor.DatabaseDiscriminatorColumn=exdDatabaseDiscriminatorColumn.gif
-OrmModelImageVisitor.DatabaseVersionColumn=exdDatabaseVersionColumn.gif
-OrmModelImageVisitor.DatabasePrimaryForeignKeysColumn=exdDatabasePrimaryForeignKeysColumn.gif
-OrmModelImageVisitor.DatabaseUniqueKeyColumn=unique_key.gif
+##Image for IDatabaseColumn
+Image_DatabaseColumn=exdDatabaseColumn.gif
+Image_DatabasePrimaryKeyColumn=exdDatabasePrimaryKeyColumn.gif
+Image_DatabaseForeignKeyColumn=exdDatabaseForeignKeyColumn.gif
+Image_DatabaseDiscriminatorColumn=exdDatabaseDiscriminatorColumn.gif
+Image_DatabaseVersionColumn=exdDatabaseVersionColumn.gif
+Image_DatabasePrimaryForeignKeysColumn=exdDatabasePrimaryForeignKeysColumn.gif
+Image_DatabaseUniqueKeyColumn=unique_key.gif
#Explorer
Explorer.RootPackageClassField=exdPackage.gif
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ActionOrmTree.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ActionOrmTree.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ActionOrmTree.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view.views;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.TreeViewer;
-
-// tau 22.11.2005
-// edit tau 27.01.2006
-
-public abstract class ActionOrmTree extends Action {
-
- private TreeViewer viewer;
-
- public ActionOrmTree() {
- super();
- }
-
- public void run(TreeViewer viewer) {
- this.viewer = viewer;
- run();
- }
-
- public void run() {
- try {
- this.rush();
- } finally {
-// OrmCore.lock.release();
-// ((OrmContentProvider)viewer.getContentProvider()).lockMenu = false; // add tau
06.12.2005
-//
-// // add tau 27.01.2006
-// OrmCore.getDefault().setLockResourceChangeListener(false);
-
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW )
ExceptionHandler.logInfo("!Finally ActionOrmTree.run() lock(=" + OrmCore.lock +
").acquire(), Depth=" + OrmCore.lock.getDepth());
- }
-
- }
-
- protected abstract void rush();
-
- public TreeViewer getViewer() {
- return viewer;
- }
-
- public ActionOrmTree setViewer(TreeViewer viewer) {
- this.viewer = viewer;
- return this;
- }
-
-}
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ContentProviderVisitor.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ContentProviderVisitor.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ContentProviderVisitor.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view.views;
-
-import org.hibernate.mapping.Column;
-
-
-public class ContentProviderVisitor {
-
- private static final Object[] nullChildren = new Object[0];
-
- public Object visitDatabaseColumn(Column column, Object argument) {
- return null;
- }
-
-}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HibernateUtils.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HibernateUtils.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HibernateUtils.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -20,9 +20,8 @@
public static String getPersistentClassName(PersistentClass rootClass) {
if (rootClass == null) {
return ""; //$NON-NLS-1$
- } else {
- return rootClass.getEntityName() != null ? rootClass.getEntityName() :
rootClass.getClassName();
- }
+ }
+ return rootClass.getEntityName() != null ? rootClass.getEntityName() :
rootClass.getClassName();
}
public static String getPersistentClassName(String className) {
@@ -34,23 +33,28 @@
return className;
}
- public static boolean isPrimaryKey(Column column){
+ public static boolean isPrimaryKey(Column column) {
Table table = getTable(column);
- if(table != null){
- if(table.getPrimaryKey() != null){
- if(table.getPrimaryKey().containsColumn(column)) return true;
+ if (table != null) {
+ if (table.getPrimaryKey() != null) {
+ if (table.getPrimaryKey().containsColumn(column)) {
+ return true;
+ }
}
}
return false;
}
+ @SuppressWarnings("unchecked")
public static boolean isForeignKey(Column column){
Table table = getTable(column);
- if(table != null){
- Iterator iter = table.getForeignKeyIterator();
- while(iter.hasNext()){
- ForeignKey fk = (ForeignKey)iter.next();
- if(fk.containsColumn(column)) return true;
+ if (table != null) {
+ Iterator<ForeignKey> iter = table.getForeignKeyIterator();
+ while (iter.hasNext()) {
+ ForeignKey fk = iter.next();
+ if (fk.containsColumn(column)) {
+ return true;
+ }
}
}
return false;
@@ -58,8 +62,9 @@
}
public static Table getTable(Column column){
- if(column.getValue() != null)
+ if (column.getValue() != null) {
return column.getValue().getTable();
+ }
return null;
}
}
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/Messages.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/Messages.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/Messages.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,22 +0,0 @@
-package org.jboss.tools.hibernate.ui.view.views;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class Messages {
- private static final String BUNDLE_NAME =
"org.jboss.tools.hibernate.ui.view.views.views"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
-
- private Messages() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -21,10 +21,6 @@
protected Object fObject;
protected ConsoleConfiguration configuration;
- public ObjectEditorInput(Object object) {
- fObject = object;
- }
-
public ObjectEditorInput(ConsoleConfiguration configuration, Object object) {
fObject = object;
this.configuration = configuration;
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenActionDelegate.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenActionDelegate.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenActionDelegate.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view.views;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-public abstract class OpenActionDelegate implements IObjectActionDelegate {
- private IWorkbenchPart part;
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- this.part = targetPart;
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- public IWorkbenchPart getPart() {
- return part;
- }
-}
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -16,25 +16,35 @@
import java.util.Map;
import java.util.Set;
-import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.internal.ObjectPluginAction;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.eclipse.console.utils.ProjectUtils;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass;
import org.jboss.tools.hibernate.ui.view.ViewPlugin;
@SuppressWarnings("restriction")
-public class OpenDiagramActionDelegate extends OpenActionDelegate {
+public class OpenDiagramActionDelegate implements IObjectActionDelegate {
private HashMap<Object, ObjectEditorInput> hashMap = new HashMap<Object,
ObjectEditorInput>();
+ //private IWorkbenchPart fPart;
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ //this.fPart = targetPart;
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
public void run(IAction action) {
ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
Map<ConsoleConfiguration, Set<PersistentClass>> mapCC_PCs = new
HashMap<ConsoleConfiguration, Set<PersistentClass>>();
@@ -58,7 +68,7 @@
try {
openEditor(setPC, consoleConfiguration);
} catch (PartInitException e) {
- ViewPlugin.getDefault().logError("Can't open mapping view.",
e); //$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't open mapping
view.", e); //$NON-NLS-1$
}
}
}
@@ -66,12 +76,12 @@
public IEditorPart openEditor(PersistentClass persClass,
ConsoleConfiguration consoleConfiguration) throws PartInitException {
ObjectEditorInput input = hashMap.get(persClass.getRootClass());
- if(input == null) {
+ if (input == null) {
input = new ObjectEditorInput(consoleConfiguration, persClass.getRootClass());
hashMap.put(persClass.getRootClass(), input);
}
- return IDE.openEditor(ViewPlugin.getPage(),input
,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor"); //$NON-NLS-1$
+ return IDE.openEditor(ViewPlugin.getPage(),input,
"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor"); //$NON-NLS-1$
}
public IEditorPart openEditor(Set<PersistentClass> setPC, ConsoleConfiguration
consoleConfiguration) throws PartInitException {
@@ -95,6 +105,6 @@
hashMap.put(id, input);
}
- return IDE.openEditor(ViewPlugin.getPage(),input
,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor"); //$NON-NLS-1$
+ return IDE.openEditor(ViewPlugin.getPage(),input,
"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor"); //$NON-NLS-1$
}
}
\ No newline at end of file
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmContentProvider.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmContentProvider.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmContentProvider.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view.views;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.TreeItem;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-
-
-public class OrmContentProvider implements ITreeContentProvider/*, IOrmModelListener,
IOrmProjectChangedListener*/ {
-
- protected static final int PACKAGE_CLASS_FIELD_CONTENT_PROVIDER = 1;
- protected static final int CLASS_FIELD_CONTENT_PROVIDER = 2;
- protected static final int STORAGE_CLASS_FIELD_CONTENT_PROVIDER = 3;
-
- protected static final int SCHEMA_TABLE_COLUMN_CONTENT_PROVIDER = 4;
- protected static final int TABLE_COLUMN_CONTENT_PROVIDER = 5;
-
- protected TreeViewer viewer;
-
- private static final ContentProviderVisitor contentProviderVisitor = new
ContentProviderVisitor();
- private static final Object[] nullChildren = new Object[0];
- private static Object[] children = new Object[0];
- private int tip;
- private boolean sorting;
-
- private Object[] expandedElements = null;
- private ISelection selectionElements = null;
-
- private String[] beforeChangeElements = null;
- private String beforeChangeSelectionElementQualifiedName = null;
-
- public boolean lockMenu = false;
-
-
- public OrmContentProvider(int tip){
- this.tip = tip;
- sorting = true;
- }
-
- public Object[] getChildren(Object parentElement) {
- if (children == null)
- children = nullChildren;
-
- if (!sorting){
- sorting = true;
- }
- return children;
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return true;
- }
-
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- public void dispose() {
-
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public int getTip() {
- return tip;
- }
-
- public void setSorting(boolean sorting) {
- this.sorting = sorting;
- }
-
- public Object[] getExpandedElements() {
- return expandedElements;
- }
-
- public void setExpandedElements(Object[] expandedElements) {
- this.expandedElements = expandedElements;
- }
-
- public ISelection getSelectionElements() {
- return selectionElements;
- }
-
- public void setSelectionElements(ISelection selectionElements) {
- this.selectionElements = selectionElements;
- }
-
- public void viewerRefreshUpdate(final Object element, final boolean flagUpdate) {
- Control control = viewer.getControl();
-
- if (control == null || control.isDisposed()) {
- return;
- }
-
- Display display = control.getDisplay();
- display.asyncExec(new Runnable() {
-
- public void run() {
- try {
- if (!viewer.getControl().isDisposed()) {
- viewer.getTree().setRedraw(false);
- if (beforeChangeElements == null){
- beforeChangeElements = saveElements();
- beforeChangeSelectionElementQualifiedName = saveSelection();
- }
-
- if (flagUpdate) {
- viewer.update(element, null);
- } else {
- viewer.refresh(element, true);
- }
-
- if (beforeChangeElements != null){
- restoreElements(beforeChangeElements,
beforeChangeSelectionElementQualifiedName);
- beforeChangeElements = null;
- }
-
- viewer.getTree().setRedraw(true);
- }
- } catch (Exception e) {
- ViewPlugin.getDefault().logError(e);
- }
- }
- });
- }
-
-
- private String[] saveElements() {
- String [] expandedElements = null;
- int length = viewer.getExpandedElements().length;
- if (length != 0) {
- expandedElements = new String [length];
- }
-
- int j = 0;
- TreeItem[] items = viewer.getTree().getItems();
- for (int i = 0; i < items.length; i++) {
- TreeItem item = items[i];
- j = saveItem(item, expandedElements, j);
- }
- return expandedElements;
- }
-
- private int saveItem(TreeItem treeItem, String [] expandedElements, int j) {
- return j;
- }
-
- private String saveSelection() {
- String selectionElementQualifiedName = ""; //$NON-NLS-1$
- ISelection selection = viewer.getSelection();
- if (!selection.isEmpty()) {
- TreeItem[] selectionTreeItems = viewer.getTree().getSelection();
- if (selectionTreeItems.length != 0) {
- TreeItem selectionItem = selectionTreeItems[0];
- if (selection instanceof StructuredSelection) {
- Object selectionElement = ((StructuredSelection) selection).getFirstElement();
- }
- }
- }
- return selectionElementQualifiedName;
- }
-
- private void restoreElements(String[] expandedElements, String
selectionElementQualifiedName) {
- checkItem(viewer.getTree().getItems(), expandedElements,
selectionElementQualifiedName);
- }
-
- private void checkItem(TreeItem[] items, String[] expandedElements, String
selectionElementQualifiedName) {
- for (int j = 0; j < items.length; j++) {
- TreeItem item = items[j];
- }
- }
-
- private boolean isBuilder(IProject project){
- boolean flag = false;
- if (project.getWorkspace().isAutoBuilding()) {
- IProjectDescription description;
- }
- return flag;
- }
-
-}
Copied:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmImageMap.java
(from rev 16222,
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelImageVisitor.java)
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmImageMap.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmImageMap.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.view.views;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.hibernate.mapping.Any;
+import org.hibernate.mapping.Array;
+import org.hibernate.mapping.Bag;
+import org.hibernate.mapping.Column;
+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.PersistentClass;
+import org.hibernate.mapping.PrimitiveArray;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.Set;
+import org.hibernate.mapping.SimpleValue;
+import org.hibernate.mapping.Table;
+import org.hibernate.mapping.Value;
+import org.jboss.tools.hibernate.ui.view.ImageBundle;
+import org.jboss.tools.hibernate.ui.view.ViewPlugin;
+
+/**
+ * Map: ORM object -> Image descriptor
+ */
+public class OrmImageMap {
+
+ private OrmImageMap() {}
+
+ public static ImageDescriptor getImageDescriptor(final Object obj) {
+ String imageName = null;
+ if (obj instanceof Table) {
+ imageName = getImageName((Table)obj);
+ } else if (obj instanceof Column) {
+ imageName = getImageName((Column)obj);
+ } else if (obj instanceof Property) {
+ imageName = getImageName((Property)obj);
+ } else if (obj instanceof OneToMany) {
+ imageName = getImageName((OneToMany)obj);
+ } else if (obj instanceof SimpleValue) {
+ imageName = getImageName((SimpleValue)obj);
+ } else if (obj instanceof PersistentClass) {
+ imageName = getImageName((PersistentClass)obj);
+ }
+ return ViewPlugin.getImageDescriptor(ImageBundle.getString(imageName));
+ }
+
+ /**
+ * the image name for hierarchy:
+ * Table
+ * @param table
+ * @return
+ */
+ public static String getImageName(Table table) {
+ return "Image_DatabaseTable"; //$NON-NLS-1$
+ }
+
+ /**
+ * the image name for hierarchy:
+ * Column
+ * @param column
+ * @return
+ */
+ public static String getImageName(Column column) {
+ String str = "Image_DatabaseColumn"; //$NON-NLS-1$
+ final boolean primaryKey = HibernateUtils.isPrimaryKey(column);
+ final boolean foreignKey = HibernateUtils.isForeignKey(column);
+ final Table table = HibernateUtils.getTable(column);
+ if (column.isUnique()) {
+ str = "Image_DatabaseUniqueKeyColumn"; //$NON-NLS-1$
+ } else if (primaryKey && table != null && foreignKey) {
+ str = "Image_DatabasePrimaryForeignKeysColumn"; //$NON-NLS-1$
+ } else if (primaryKey) {
+ str = "Image_DatabasePrimaryKeyColumn"; //$NON-NLS-1$
+ } else if (table != null && foreignKey) {
+ str = "Image_DatabaseForeignKeyColumn"; //$NON-NLS-1$
+ }
+ return str;
+
+ }
+
+ /**
+ * the image name for hierarchy:
+ * Property
+ * @param field
+ * @return
+ */
+ public static String getImageName(Property field) {
+ String str = "Image_PersistentFieldSimple"; //$NON-NLS-1$
+ if (field == null) {
+ return str;
+ }
+ final PersistentClass persistentClass = field.getPersistentClass();
+ if (persistentClass != null && persistentClass.getVersion() == field) {
+ str = "Image_PersistentFieldSimple_version"; //$NON-NLS-1$
+ } else if (persistentClass != null && persistentClass.getIdentifierProperty()
== field) {
+ str = "Image_PersistentFieldSimple_id"; //$NON-NLS-1$
+ } else if (field.getValue() != null) {
+ final Value value = field.getValue();
+ if (value instanceof OneToMany) {
+ str = "Image_PersistentFieldOne-to-many"; //$NON-NLS-1$
+ } else if (value instanceof OneToOne) {
+ str = "Image_PersistentFieldOne-to-one"; //$NON-NLS-1$
+ } else if (value instanceof ManyToOne) {
+ str = "Image_PersistentFieldMany-to-one"; //$NON-NLS-1$
+ } else if (value instanceof Any) {
+ str = "Image_PersistentFieldAny"; //$NON-NLS-1$
+ } else if (field.getType() != null && field.getType().isCollectionType()) {
+ if (value instanceof PrimitiveArray) {
+ str = "Image_Collection_primitive_array"; //$NON-NLS-1$
+ } else if (value instanceof Array) {
+ str = "Image_Collection_array"; //$NON-NLS-1$
+ } else if (value instanceof List) {
+ str = "Image_Collection_list"; //$NON-NLS-1$
+ } else if (value instanceof Set) {
+ str = "Image_Collection_set"; //$NON-NLS-1$
+ } else if (value instanceof Map) {
+ str = "Image_Collection_map"; //$NON-NLS-1$
+ } else if (value instanceof Bag) {
+ str = "Image_Collection_bag"; //$NON-NLS-1$
+ } else if (value instanceof IdentifierBag) {
+ str = "Image_Collection_idbag"; //$NON-NLS-1$
+ } else {
+ str = "Image_Collection"; //$NON-NLS-1$
+ }
+ }
+ } else if ("parent".equals(field.getName())) { //$NON-NLS-1$
+ str = "Image_PersistentFieldParent"; //$NON-NLS-1$
+ }
+ return str;
+ }
+
+ /**
+ * the image name for hierarchy:
+ * OneToMany
+ * @param field
+ * @return
+ */
+ public static String getImageName(OneToMany field) {
+ return "Image_PersistentFieldOne-to-many"; //$NON-NLS-1$
+ }
+
+ /**
+ * the image name for hierarchy:
+ * SimpleValue
+ * |-- Any
+ * |-- Component
+ * |-- DependantValue
+ * |-- ToOne
+ * |-- ManyToOne
+ * |-- OneToOne
+ * @param field
+ * @return
+ */
+ public static String getImageName(SimpleValue field) {
+ String res = "Image_PersistentFieldSimple"; //$NON-NLS-1$
+ if (field instanceof Any) {
+ res = "Image_PersistentFieldMany-to-any"; //$NON-NLS-1$
+ } else if (field instanceof Component) {
+ res = "Image_PersistentFieldComponent"; //$NON-NLS-1$
+ } else if (field instanceof DependantValue) {
+ DependantValue mapping = (DependantValue)field;
+ if (mapping.getTable().getIdentifierValue() == mapping) {
+ res = "Image_PersistentFieldComponent_id"; //$NON-NLS-1$
+ }
+ } else if (field instanceof ManyToOne) {
+ res = "Image_PersistentFieldMany-to-many"; //$NON-NLS-1$
+ }
+ return res;
+ }
+
+ /**
+ * the image name for hierarchy:
+ * PersistentClass
+ * |-- RootClass
+ * | |-- SpecialRootClass
+ * |
+ * |-- Subclass
+ * |-- JoinedSubclass
+ * |-- SingleTableSubclass
+ * |-- UnionSubclass
+ * @param persistentClass
+ * @return
+ */
+ public static String getImageName(PersistentClass persistentClass) {
+ return "Image_PersistentClass"; //$NON-NLS-1$
+ }
+
+}
Copied:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelMap.java
(from rev 16222,
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java)
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelMap.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelMap.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.view.views;
+
+import org.hibernate.eclipse.console.workbench.TypeNameValueVisitor;
+import org.hibernate.mapping.Column;
+import org.hibernate.mapping.Component;
+import org.hibernate.mapping.DependantValue;
+import org.hibernate.mapping.OneToMany;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.SimpleValue;
+import org.hibernate.mapping.Table;
+import org.hibernate.mapping.Value;
+import org.hibernate.type.Type;
+import org.jboss.tools.hibernate.ui.view.UIViewMessages;
+
+/**
+ * Map: ORM object -> label
+ */
+public class OrmLabelMap {
+
+ static private String SPACE = " "; //$NON-NLS-1$
+ static private String POINTER = " -> "; //$NON-NLS-1$
+
+ private OrmLabelMap() {}
+
+ public static String getLabel(final Object obj) {
+ String label = null;
+ if (obj instanceof Table) {
+ label = getParticularLabel((Table)obj);
+ } else if (obj instanceof Column) {
+ label = getParticularLabel((Column)obj);
+ } else if (obj instanceof Property) {
+ label = getParticularLabel((Property)obj);
+ } else if (obj instanceof OneToMany) {
+ label = getParticularLabel((OneToMany)obj);
+ } else if (obj instanceof SimpleValue) {
+ label = getParticularLabel((SimpleValue)obj);
+ } else if (obj instanceof PersistentClass) {
+ label = getParticularLabel((PersistentClass)obj);
+ } else if (obj instanceof String) {
+ label = (String)obj;
+ } else {
+ throw unknownElement(obj);
+ }
+ if (label == null) {
+ label = UIViewMessages.OrmLabelProvider_orm_element;
+ }
+ return label;
+ }
+
+ public static String getParticularLabel(Table table) {
+ return HibernateUtils.getTableName(table);
+ }
+
+ public static String getParticularLabel(Column column) {
+ final String sqlType = column.getSqlType();
+ StringBuffer name = new StringBuffer();
+ name.append(column.getName());
+ if (sqlType != null) {
+ name.append(" ["); //$NON-NLS-1$
+ name.append(sqlType.toUpperCase());
+ name.append(column.isNullable() ? " Nullable" : ""); //$NON-NLS-1$
//$NON-NLS-2$
+ name.append(HibernateUtils.getTable(column) != null
+ && HibernateUtils.isPrimaryKey(column) ? " PK" : "");
//$NON-NLS-1$ //$NON-NLS-2$
+ name.append(HibernateUtils.getTable(column) != null
+ && HibernateUtils.isForeignKey(column) ? " FK" : "");
//$NON-NLS-1$ //$NON-NLS-2$
+ name.append("]"); //$NON-NLS-1$
+ }
+ return name.toString();
+ }
+
+ public static String getParticularLabel(Property field) {
+ StringBuffer name = new StringBuffer();
+ name.append(field.getName());
+ name.append(" :"); //$NON-NLS-1$
+ String typeString = null;
+ Type type = null;
+ try {
+ type = field.getType();
+ } catch (Exception e) {
+ // ignore - this is only way to catch java.lang.reflect.InvocationTargetException
+ }
+ if (type != null && type.getReturnedClass() != null) {
+ typeString = type.getReturnedClass().getName();
+ } else {
+ if (field.getValue() instanceof Component) {
+ typeString = ((Component)field.getValue()).getComponentClassName();
+ } else if (field.getValue()!= null && field.getValue().isSimpleValue()) {
+ typeString = ((SimpleValue)field.getValue()).getTypeName();
+ }
+ }
+ if (typeString != null) {
+ typeString = correctTypeString(typeString);
+ name.append(SPACE);
+ name.append(typeString);
+ return name.toString();
+ }
+ Value value = field.getValue();
+ String typeName = null;
+ if (value != null) {
+ typeName = (String) value.accept(new TypeNameValueVisitor(false));
+ if (typeName != null) {
+ return field.getName() + " : " + typeName; //$NON-NLS-1$
+ }
+ }
+ return field.getName();
+ }
+
+ public static String getParticularLabel(OneToMany field) {
+ return UIViewMessages.OrmLabelProvider_element;
+ }
+
+ /**
+ * the label for hierarchy:
+ * SimpleValue
+ * |-- Any
+ * |-- Component
+ * |-- DependantValue
+ * |-- ToOne
+ * |-- ManyToOne
+ * |-- OneToOne
+ * @param field
+ * @return
+ */
+ public static String getParticularLabel(SimpleValue field) {
+ String label = UIViewMessages.OrmLabelProvider_element;
+ if (field instanceof DependantValue) {
+ label = "key"; //$NON-NLS-1$
+ } else if (field instanceof Component) {
+ label = "element"; //$NON-NLS-1$
+ }
+ return label;
+ }
+
+ /**
+ * the label for hierarchy:
+ * PersistentClass
+ * |-- RootClass
+ * | |-- SpecialRootClass
+ * |
+ * |-- Subclass
+ * |-- JoinedSubclass
+ * |-- SingleTableSubclass
+ * |-- UnionSubclass
+ * @param persistentClass
+ * @return
+ */
+ public static String getParticularLabel(PersistentClass persistentClass) {
+ StringBuffer name = new StringBuffer();
+ name.append(persistentClass.getEntityName() != null ?
+ persistentClass.getEntityName() : persistentClass.getClassName());
+ Table table = persistentClass.getTable();
+ if (table != null) {
+ final String tableName = HibernateUtils.getTableName(table);
+ if (tableName != null) {
+ name.append(POINTER);
+ name.append(tableName);
+ }
+ }
+ return name.toString();
+ }
+
+ private static String correctTypeString(String str) {
+ String ret = str;
+ while (ret.startsWith("[")) { //$NON-NLS-1$
+ ret = ret.substring(1).concat("[]"); //$NON-NLS-1$
+ }
+ switch (ret.toCharArray()[0]) {
+ case 'Z': ret = "boolean".concat(ret.substring(1));break;
//$NON-NLS-1$
+ case 'B': ret = "byte".concat(ret.substring(1));break; //$NON-NLS-1$
+ case 'C': ret = "char".concat(ret.substring(1));break; //$NON-NLS-1$
+ case 'L': ret = ret.substring(1);break;
+ case 'D': ret = "double".concat(ret.substring(1));break;
//$NON-NLS-1$
+ case 'F': ret = "float".concat(ret.substring(1));break;
//$NON-NLS-1$
+ case 'I': ret = "int".concat(ret.substring(1));break; //$NON-NLS-1$
+ case 'J': ret = "long".concat(ret.substring(1));break; //$NON-NLS-1$
+ case 'S': ret = "short".concat(ret.substring(1));break;
//$NON-NLS-1$
+ }
+ return ret;
+ }
+
+ private static RuntimeException unknownElement(Object element) {
+ String msg = UIViewMessages.OrmLabelProvider_unknown_type_of_element_in_tree_of_type;
+ if (element != null && element.getClass() != null ) {
+ msg = msg + element.getClass().getName();
+ } else {
+ msg = msg + element;
+ }
+ return new RuntimeException(msg);
+
+ }
+}
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
+ * Copyright (c) 2007-2009 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -23,70 +23,46 @@
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.mapping.Any;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.engine.Mapping;
import org.hibernate.mapping.Column;
-import org.hibernate.mapping.Component;
-import org.hibernate.mapping.DependantValue;
-import org.hibernate.mapping.JoinedSubclass;
-import org.hibernate.mapping.ManyToOne;
-import org.hibernate.mapping.OneToMany;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
-import org.hibernate.mapping.SimpleValue;
-import org.hibernate.mapping.SingleTableSubclass;
-import org.hibernate.mapping.Subclass;
-import org.hibernate.mapping.Table;
-import org.hibernate.mapping.UnionSubclass;
-import org.jboss.tools.hibernate.ui.view.UIViewMessages;
public class OrmLabelProvider extends LabelProvider implements IColorProvider,
IFontProvider {
private Map<ImageDescriptor, Image> imageCache = new HashMap<ImageDescriptor,
Image>(25);
- private OrmModelImageVisitor ormModelImageVisitor;
- private OrmModelNameVisitor ormModelNameVisitor;
+
+ protected Configuration config = null;
+ protected Mapping mapping = null;
+ protected Dialect dialect = null;
- public OrmLabelProvider(OrmModelImageVisitor imageVisitor, OrmModelNameVisitor
nameVisitor) {
+ public OrmLabelProvider() {
+ }
+
+ public OrmLabelProvider(Configuration config) {
super();
- ormModelImageVisitor = imageVisitor;
- ormModelNameVisitor = nameVisitor;
+ setConfig(config);
}
- public Image getImage(Object element) {
- ImageDescriptor descriptor = null;
+ public void setConfig(Configuration config) {
+ if (this.config == config) {
+ return;
+ }
+ this.config = config;
+ mapping = null;
+ dialect = null;
+ }
- if (element instanceof RootClass) {
- descriptor = (ImageDescriptor) ((RootClass) element).accept(ormModelImageVisitor);
- } else if (element instanceof UnionSubclass) {
- descriptor = (ImageDescriptor) ((UnionSubclass)
element).accept(ormModelImageVisitor);
- } else if (element instanceof SingleTableSubclass) {
- descriptor = (ImageDescriptor) ((SingleTableSubclass)
element).accept(ormModelImageVisitor);
- } else if (element instanceof JoinedSubclass) {
- descriptor = (ImageDescriptor) ((JoinedSubclass)
element).accept(ormModelImageVisitor);
- } else if (element instanceof Subclass) {
- descriptor = (ImageDescriptor) ((Subclass) element).accept(ormModelImageVisitor);
- } else if (element instanceof Property) {
- descriptor = (ImageDescriptor)ormModelImageVisitor.visitPersistentField((Property)
element);
- } else if (element instanceof Table) {
- descriptor = (ImageDescriptor)ormModelImageVisitor.visitDatabaseTable((Table)
element);
- } else if (element instanceof Column) {
- descriptor = (ImageDescriptor)ormModelImageVisitor.visitDatabaseColumn((Column)
element);
- } else if (element instanceof DependantValue) {
- descriptor =
(ImageDescriptor)ormModelImageVisitor.visitComponentKeyMapping((DependantValue) element);
- } else if (element instanceof Component) {
- descriptor = (ImageDescriptor)ormModelImageVisitor.visitComponentMapping((Component)
element);
- } else if (element instanceof ManyToOne) {
- descriptor = (ImageDescriptor)ormModelImageVisitor.visitManyToOneMapping((ManyToOne)
element);
- } else if (element instanceof OneToMany) {
- descriptor = (ImageDescriptor)ormModelImageVisitor.visitOneToManyMapping((OneToMany)
element);
- } else if (element instanceof Any) {
- descriptor = (ImageDescriptor)ormModelImageVisitor.visitAnyMapping((Any) element);
- } else if (element instanceof SimpleValue) {
- descriptor =
(ImageDescriptor)ormModelImageVisitor.visitSimpleValueMapping((SimpleValue) element);
- } else {
+ @Override
+ public Image getImage(Object element) {
+ ImageDescriptor descriptor = OrmImageMap.getImageDescriptor(element);
+ if (descriptor == null) {
return null;
}
-
Image image = imageCache.get(descriptor);
if (image == null) {
image = descriptor.createImage();
@@ -95,83 +71,14 @@
return image;
}
- public String getText(Object element, ConsoleConfiguration cfg) {
- if (element instanceof RootClass) {
- String name = (String)ormModelNameVisitor.visitPersistentClass((RootClass)element,
null);
- if (name == null) {
- return UIViewMessages.OrmLabelProvider_orm_element;
- } else {
- return name;
- }
- } else if (element instanceof Table) {
- String name = (String)ormModelNameVisitor.visitTable((Table)element, null);
- if (name == null) {
- return UIViewMessages.OrmLabelProvider_orm_element;
- } else {
- return name;
- }
- } else if (element instanceof Subclass) {
- String name = (String)ormModelNameVisitor.visitPersistentClass((Subclass)element,
null);
- if (name == null) {
- return UIViewMessages.OrmLabelProvider_orm_element;
- } else {
- return name;
- }
- } else if (element instanceof Property) {
- String name = (String)ormModelNameVisitor.visitPersistentField((Property)element,
null);
- if (name == null) {
- return UIViewMessages.OrmLabelProvider_orm_element;
- } else {
- return name;
- }
- } else if (element instanceof Column) {
- String name = (String)ormModelNameVisitor.visitDatabaseColumn((Column)element, cfg);
- if (name == null) {
- return UIViewMessages.OrmLabelProvider_orm_element;
- } else {
- return name;
- }
- } else if (element instanceof OneToMany || element instanceof ManyToOne) {
- String name = UIViewMessages.OrmLabelProvider_element;
- if (name == null) {
- return UIViewMessages.OrmLabelProvider_orm_element;
- } else {
- return name;
- }
- } else if (element instanceof SimpleValue) {
- if (element instanceof DependantValue) {
- String name =
(String)ormModelNameVisitor.visitCollectionKeyMapping((DependantValue)element, null);
- if (name == null) {
- return UIViewMessages.OrmLabelProvider_orm_element;
- } else {
- return name;
- }
- } else if (element instanceof Component) {
- String name = (String)ormModelNameVisitor.visitComponentMapping((Component)element,
null);
- if (name == null) {
- return UIViewMessages.OrmLabelProvider_orm_element;
- } else {
- return name;
- }
- } else {
- return UIViewMessages.OrmLabelProvider_element;
-// throw unknownElement(element);
- }
- } else if (element instanceof String){
- return (String) element;
- } else {
- throw unknownElement(element);
+ @Override
+ public String getText(Object obj) {
+ if (obj instanceof Column) {
+ updateColumnSqlType((Column)obj);
}
-
+ return OrmLabelMap.getLabel(obj);
}
- protected RuntimeException unknownElement(Object element) {
- if (element != null && element.getClass() != null )
- return new
RuntimeException(UIViewMessages.OrmLabelProvider_unknown_type_of_element_in_tree_of_type +
element.getClass().getName());
- else return new
RuntimeException(UIViewMessages.OrmLabelProvider_unknown_type_of_element_in_tree_of_type +
element);
-
- }
-
public void dispose() {
for (Iterator<Image> i = imageCache.values().iterator(); i.hasNext();) {
i.next().dispose();
@@ -185,7 +92,6 @@
} else if (element instanceof Property) {
return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE);
}
-
return null;
}
@@ -194,10 +100,40 @@
}
public Font getFont(Object element) {
-/* if (element instanceof IOrmProject) {
- return
JFaceResources.getFontRegistry().getBold(JFaceResources.getTextFont().getFontData()[0].getName());
- }*/
+ //return
JFaceResources.getFontRegistry().getBold(JFaceResources.getTextFont().getFontData()[0].getName());
return null;
}
+
+ /**
+ * For correct label creation should update column sql type.
+ * @param column
+ * @return
+ */
+ public boolean updateColumnSqlType(final Column column) {
+ String sqlType = column.getSqlType();
+ if (sqlType != null) {
+ return false;
+ }
+ if (mapping == null) {
+ mapping = config.buildMapping();
+ }
+ if (dialect == null) {
+ final String dialectName = config.getProperty(Environment.DIALECT);
+ if (dialectName != null) {
+ try {
+ dialect = (Dialect) Class.forName(dialectName).newInstance();
+ } catch (InstantiationException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e);
//$NON-NLS-1$
+ } catch (IllegalAccessException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e);
//$NON-NLS-1$
+ } catch (ClassNotFoundException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e);
//$NON-NLS-1$
+ }
+ }
+ }
+ sqlType = column.getSqlType(dialect, mapping);
+ column.setSqlType(sqlType);
+ return true;
+ }
}
\ No newline at end of file
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelImageVisitor.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelImageVisitor.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelImageVisitor.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view.views;
-
-import java.util.ResourceBundle;
-
-import org.hibernate.mapping.Any;
-import org.hibernate.mapping.Array;
-import org.hibernate.mapping.Bag;
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.Component;
-import org.hibernate.mapping.DependantValue;
-import org.hibernate.mapping.IdentifierBag;
-import org.hibernate.mapping.JoinedSubclass;
-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.PersistentClassVisitor;
-import org.hibernate.mapping.PrimitiveArray;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.RootClass;
-import org.hibernate.mapping.Set;
-import org.hibernate.mapping.SimpleValue;
-import org.hibernate.mapping.SingleTableSubclass;
-import org.hibernate.mapping.Subclass;
-import org.hibernate.mapping.Table;
-import org.hibernate.mapping.UnionSubclass;
-import org.jboss.tools.hibernate.ui.view.ImageBundle;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-
-/**
- * @author Tau
- *
- */
-public class OrmModelImageVisitor implements PersistentClassVisitor {
-
- public Object visitDatabaseTable(Table table) {
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.DatabaseTable")); //$NON-NLS-1$
- }
-
- public Object visitDatabaseColumn(Column column) {
- if (column.isUnique()) {
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.DatabaseUniqueKeyColumn"));
//$NON-NLS-1$
- } else if (HibernateUtils.isPrimaryKey(column)
- && HibernateUtils.getTable(column) != null
- && HibernateUtils.isForeignKey(column)) {
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.DatabasePrimaryForeignKeysColumn"));
//$NON-NLS-1$
- } else if (HibernateUtils.isPrimaryKey(column)) {
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.DatabasePrimaryKeyColumn"));
//$NON-NLS-1$
- } else if (HibernateUtils.getTable(column) != null
- && HibernateUtils.isForeignKey(column)) {
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.DatabaseForeignKeyColumn"));
//$NON-NLS-1$
- } else
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.DatabaseColumn")); //$NON-NLS-1$
-
- }
-
- public Object visitPersistentField(Property field) {
- if (field != null) {
- if (field.getPersistentClass() != null &&
field.getPersistentClass().getVersion() == field) {
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldSimple_version"));
//$NON-NLS-1$
- }
- if (field.getPersistentClass() != null &&
field.getPersistentClass().getIdentifierProperty() == field) {
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldSimple_id"));
//$NON-NLS-1$
- }
- if (field.getValue() != null) {
- if (field.getValue() instanceof OneToMany)
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldOne-to-many"));
//$NON-NLS-1$
- else if (field.getValue() instanceof OneToOne)
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldOne-to-one"));
//$NON-NLS-1$
- else if (field.getValue() instanceof ManyToOne)
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldMany-to-one"));
//$NON-NLS-1$
- else if (field.getValue() instanceof Any)
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldAny")); //$NON-NLS-1$
-
- try {
- if (field.getType() != null
- && field.getType().isCollectionType()) {
- if (field.getValue() instanceof PrimitiveArray)
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.Collection_primitive_array"));
//$NON-NLS-1$
- else if (field.getValue() instanceof Array)
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.Collection_array")); //$NON-NLS-1$
- else if (field.getValue() instanceof List)
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.Collection_list")); //$NON-NLS-1$
- else if (field.getValue() instanceof Set)
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.Collection_set")); //$NON-NLS-1$
- else if (field.getValue() instanceof Map)
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.Collection_map")); //$NON-NLS-1$
- else if (field.getValue() instanceof Bag)
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.Collection_bag")); //$NON-NLS-1$
- else if (field.getValue() instanceof IdentifierBag)
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.Collection_idbag")); //$NON-NLS-1$
- else
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.Collection")); //$NON-NLS-1$
- }
- } catch (Exception e) {
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldNot_mapped"));
//$NON-NLS-1$
- }
- }
- if("parent".equals(field.getName())) //$NON-NLS-1$
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldParent")); //$NON-NLS-1$
-
- }
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldSimple")); //$NON-NLS-1$
- }
-
- public Object visitManyToOneMapping(ManyToOne field) {
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldMany-to-many"));
//$NON-NLS-1$
- }
-
- public Object visitOneToManyMapping(OneToMany field) {
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldOne-to-many"));
//$NON-NLS-1$
- }
-
- public Object visitSimpleValueMapping(SimpleValue field) {
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldSimple")); //$NON-NLS-1$
- }
-
- public Object visitAnyMapping(Any field) {
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldMany-to-any"));
//$NON-NLS-1$
- }
-
- public Object visitComponentMapping(Component mapping) {
- if (mapping != null) {
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldComponent"));
//$NON-NLS-1$
- }
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldNot_mapped"));
//$NON-NLS-1$
- }
-
- public Object visitComponentKeyMapping(DependantValue mapping) {
- if (mapping.getTable().getIdentifierValue() == mapping) {
- return ViewPlugin
- .getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldComponent_id"));
//$NON-NLS-1$
- }
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentFieldSimple")); //$NON-NLS-1$
- }
-
- public Object accept(RootClass arg0) {
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentClass")); //$NON-NLS-1$
- }
-
- public Object accept(UnionSubclass arg0) {
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentClass")); //$NON-NLS-1$
- }
-
- public Object accept(SingleTableSubclass arg0) {
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentClass")); //$NON-NLS-1$
- }
-
- public Object accept(JoinedSubclass arg0) {
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentClass")); //$NON-NLS-1$
- }
-
- public Object accept(Subclass arg0) {
- return ViewPlugin.getImageDescriptor(ImageBundle
- .getString("OrmModelImageVisitor.PersistentClass")); //$NON-NLS-1$
- }
-
-}
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view.views;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.hibernate.HibernateException;
-import org.hibernate.cfg.Environment;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.execution.ExecutionContext.Command;
-import org.hibernate.dialect.Dialect;
-import org.hibernate.eclipse.console.workbench.TypeNameValueVisitor;
-import org.hibernate.engine.Mapping;
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.Component;
-import org.hibernate.mapping.DependantValue;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.RootClass;
-import org.hibernate.mapping.SimpleValue;
-import org.hibernate.mapping.Subclass;
-import org.hibernate.mapping.Table;
-import org.hibernate.mapping.Value;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-
-public class OrmModelNameVisitor /*implements IOrmModelVisitor*/ {
-
- static private String SPACE = " "; //$NON-NLS-1$
- static private String POINTER = " -> "; //$NON-NLS-1$
-
- public OrmModelNameVisitor() {
- super();
- }
-
- private Map<ConsoleConfiguration, Mapping> mappings = new
HashMap<ConsoleConfiguration, Mapping>();
- private Map<String, Dialect> dialects = new HashMap<String, Dialect>();
-
- public Object visitDatabaseColumn(Column column, Object argument) {
-
- String type = getColumnSqlType(column, argument);
-
- StringBuffer name = new StringBuffer();
- name.append(column.getName());
-
- if (type != null) {
- name.append(" ["); //$NON-NLS-1$
- name.append(type.toUpperCase());
- name.append(column.isNullable() ? " Nullable" : ""); //$NON-NLS-1$
//$NON-NLS-2$
- name.append(HibernateUtils.getTable(column) != null
- && HibernateUtils.isPrimaryKey(column) ? " PK" : "");
//$NON-NLS-1$ //$NON-NLS-2$
- name.append(HibernateUtils.getTable(column) != null
- && HibernateUtils.isForeignKey(column) ? " FK" : "");
//$NON-NLS-1$ //$NON-NLS-2$
- name.append("]"); //$NON-NLS-1$
- }
-
- return name.toString();
-
- }
-
- public String getColumnSqlType(final Column column, Object argument) {
-
- ConsoleConfiguration cfg = null;
- Mapping mapping = null;
- Dialect dialect = null;
-
- String type = null;
-
- if (argument instanceof ConsoleConfiguration) {
-
- cfg = (ConsoleConfiguration) argument;
-
- if (mappings.containsKey(cfg.getConfiguration())) {
- mapping = mappings.get(cfg);
- } else {
- mapping = cfg.getConfiguration().buildMapping();
- mappings.put(cfg, mapping);
- }
-
- try {
- String dialectName = cfg.getConfiguration().getProperty(Environment.DIALECT);
- if (dialectName != null) {
- if (dialects.containsKey(dialectName)) {
- dialect = dialects.get(dialectName);
- } else {
- dialect = (Dialect) Class.forName(dialectName).newInstance();
- dialects.put(dialectName, dialect);
- }
- }
- } catch (HibernateException e) {
- ViewPlugin.getDefault().logError(e);
- } catch (InstantiationException e) {
- ViewPlugin.getDefault().logError(e);
- } catch (IllegalAccessException e) {
- ViewPlugin.getDefault().logError(e);
- } catch (ClassNotFoundException e) {
- ViewPlugin.getDefault().logError(e);
- }
-
- final Mapping fMapping = mapping;
- final Dialect fDialect = dialect;
-
- try {
- type = (String)cfg.execute( new Command() {
- public Object execute() {
- return column.getSqlType(fDialect, fMapping);
- }});
- } catch(Exception e){
- }
- }
-
- //if (type != null) {
- return type;
- /*} else {
- if (column.getValue() instanceof SimpleValue) {
- SimpleValue sValue = (SimpleValue) column.getValue();
- Properties p = sValue.getTypeParameters();
- if (p == null)
- return null;
- String propType = p.getProperty( "type" );
- if ( propType != null ) {
- int sqlType = Integer.decode( propType ).intValue();
- return dialect.getTypeName( sqlType, column.getLength(), column.getPrecision(),
column.getScale() );
- }
- }
- return null;
- } */
- }
-
- public Object visitPersistentClass(RootClass clazz, Object argument) {
-
- StringBuffer name = new StringBuffer();
- name.append(clazz.getEntityName() != null ? clazz.getEntityName() :
clazz.getClassName());
-
- Table table = clazz.getTable(); // upd tau 06.06.2005
- if (table != null) {
- String tableName = HibernateUtils.getTableName(table);
- if (tableName != null) {
- name.append(POINTER);
- name.append(tableName);
- }
- }
-
- return name.toString();
- }
-
- public Object visitTable(Table table, Object argument) {
- StringBuffer name = new StringBuffer();
- name.append(HibernateUtils.getTableName(table));
- return name.toString();
- }
-
- public Object visitPersistentClass(Subclass clazz, Object argument) {
-
- StringBuffer name = new StringBuffer();
- name.append(clazz.getEntityName());
-
- Table table = clazz.getTable();
- if (table != null) {
- String tableName = HibernateUtils.getTableName(table);
- if (tableName != null) {
- name.append(POINTER);
- name.append(tableName);
- }
- }
-
- return name.toString();
- }
-
- public Object visitPersistentField(Property field, Object argument) {
- StringBuffer name = new StringBuffer();
- name.append(field.getName());
- name.append(" "); //$NON-NLS-1$
- name.append(Messages.getString("OrmModelNameVisitor.Colon")); //$NON-NLS-1$
- String typeString = null;
-
- try {
- typeString = field.getType().getReturnedClass().getName();
- } catch (Exception e) {
- if (field.getValue() instanceof Component) {
- typeString = ((Component)field.getValue()).getComponentClassName();
- } else if (field.getValue()!= null && field.getValue().isSimpleValue()) {
- typeString = ((SimpleValue)field.getValue()).getTypeName();
- }
- }
-
- if (typeString != null) {
- typeString = correctTypeString(typeString);
- name.append(SPACE);
- name.append(typeString);
- return name.toString();
- }
-
- Value value = field.getValue();
- String typeName = null;
- if (value != null){
- typeName = (String) value.accept(new TypeNameValueVisitor(false));
- if (typeName!=null) {
- return field.getName() + " : " + typeName; //$NON-NLS-1$
- }
- }
- return field.getName();
- }
-
- private String correctTypeString(String str) {
- String ret = str;
- while (ret.startsWith("[")) { //$NON-NLS-1$
- ret = ret.substring(1).concat("[]"); //$NON-NLS-1$
- }
- switch (ret.toCharArray()[0]) {
- case 'Z': ret = "boolean".concat(ret.substring(1));break;
//$NON-NLS-1$
- case 'B': ret = "byte".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'C': ret = "char".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'L': ret = ret.substring(1);break;
- case 'D': ret = "double".concat(ret.substring(1));break;
//$NON-NLS-1$
- case 'F': ret = "float".concat(ret.substring(1));break;
//$NON-NLS-1$
- case 'I': ret = "int".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'J': ret = "long".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'S': ret = "short".concat(ret.substring(1));break;
//$NON-NLS-1$
- }
- return ret;
- }
-
- public Object visitCollectionKeyMapping(DependantValue mapping, Object argument) {
- return "key"; //$NON-NLS-1$
- }
-
- public Object visitComponentMapping(Component mapping, Object argument) {
- return "element"; //$NON-NLS-1$
- }
-}
\ No newline at end of file
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ViewsAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ViewsAction.java 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ViewsAction.java 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view.views;
-
-import java.util.HashMap;
-
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.ide.IDE;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-
-
-public class ViewsAction {
- static ActionOrmTree openEditorAction;
-
- static {
- openEditorAction = new ActionOrmTree() {
- HashMap<Object,ObjectEditorInput> hashMap = new
HashMap<Object,ObjectEditorInput>();
- public void rush() {
- ObjectEditorInput input =
hashMap.get(this.getViewer().getTree().getSelection()[0].getData());
- if(input == null) {
- input = new
ObjectEditorInput(this.getViewer().getTree().getSelection()[0].getData());
- hashMap.put(this.getViewer().getTree().getSelection()[0].getData(), input);
- }
- try {
- IDE.openEditor(ViewPlugin.getPage(),input
,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor"); //$NON-NLS-1$
- } catch (PartInitException e) {
- ViewPlugin.getDefault().logError(e);
- }
- }
- };
- openEditorAction.setText(Messages.getString("Explorer.OpenEditorActionName"));
//$NON-NLS-1$
- openEditorAction.setToolTipText(Messages.getString("Explorer.OpenEditorActionToolTipText"));
//$NON-NLS-1$
- }
-}
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/views.properties
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/views.properties 2009-07-01
13:55:12 UTC (rev 16318)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/views.properties 2009-07-01
14:17:22 UTC (rev 16319)
@@ -1,257 +0,0 @@
-# START NON-TRANSLATABLE
-# suspected OBSOLETE
-//Explorer
-Explorer.ActionRootPackageClassFieldName=project -> mapping -> package ->
class(table) -> field -> column(s)
-Explorer.ActionRootPackageClassFieldContentDescription=project -> mapping ->
package -> class(table) -> field
-Explorer.ActionRootPackageClassFieldToolTipText=Group by package
-
-Explorer.ActionRootClassFieldName=project -> mapping -> class(table) -> field
-> column(s)
-Explorer.ActionRootClassFieldContentDescription=project -> mapping -> class(table)
-> field -> column(s)
-Explorer.ActionRootClassFieldToolTipText=Group by mapping
-
-Explorer.ActionRootStorageClassFieldName=project -> mapping -> mapping storage
-> class(table) -> field -> column(s)
-Explorer.ActionRootStorageClassFieldContentDescription=project -> mapping ->
mapping storage -> class(table) -> field -> column(s)
-Explorer.ActionRootStorageClassFieldToolTipText=Group by storage
-
-Explorer.HibernateConnectionWizardName=Edit Hibernate Configuration...
-Explorer.HibernateConnectionWizardToolTipText=Hibernate configuration wizard
-
-Explorer.PersistentClassesWizardName=Add Persistent Classes...
-Explorer.PersistentClassesWizardToolTipText=Add persistent classes wizard
-
-Explorer.GenerateDAOWizardName=Generate DAO Classes...
-Explorer.GenerateDAOWizardToolTipText=Generate DAO wizard
-
-Explorer.FieldMappingWizardName=Edit Mapping...
-Explorer.FieldMappingWizardToolTipText=Field mapping wizard
-//Kuzmin 06.10.2005
-Explorer.FieldMappingWizardNameNew=New Mapping...
-
-Explorer.TablesClassesWizardName=Reverse Engineer Database Schema...
-Explorer.TablesClassesWizardToolTipText=Add tables classes wizard
-Explorer.TablesClassesWizardInfoCreate=Created classes
-Explorer.TablesClassesWizardInfonoPK=Tables have no PK
-Explorer.TablesClassesWizardInfoLink=Many-to-many link tables
-Explorer.TablesClassesWizardInfoTitle=JBoss Tools Reversing Operation Report
-
-Explorer.AddNamedQueryName=Add Named Query...
-Explorer.AddNamedQueryToolTipText=Create new named query
-Explorer.AddNamedQuery.DefaultNewName=New query
-
-Explorer.TestQueryName=Query Test...
-Explorer.TestQueryToolTipText=Query test
-Explorer.TestQuery.DefaultQuery=from {0}
-
-Explorer.EditNamedQueryName=Edit Named Query...
-Explorer.EditNamedQueryToolTipText=Edit selected named query
-
-Explorer.RemoveNamedQueryName=Remove Named Query
-Explorer.RemoveNamedQueryToolTipText=Remove selected named query
-Explorer.RemoveNamedQueryTitle=Confirm Remove Named Query
-Explorer.RemoveNamedQueryMessage=Do you want to remove the Named Query "{0}"?
-
-Explorer.DuplicateQueryNameErrorTitle=Duplicate Query Name Error
-
-Explorer.MappingWizardName=Edit Mapping...
-Explorer.MappingWizardToolTipText=Edit mapping
-
-Explorer.GenerateDDLWizardName=Generate DDL Wizard...
-Explorer.GenerateDDLWizardToolTipText=Generate DDL file
-Explorer.GenerateDDLErrorTitle=Generate DDL Error
-
-Explorer.AutoBuildingFalseTitle=Warning
-Explorer.AutoBuildingFalseMessage="Build Automatically" is switched
off.\nContinue?
-
-Explorer.HibernateCacheWizardName=Hibernate Cache Wizard...
-Explorer.HibernateCacheWizardToolTipText=Hibernate cache wizard
-
-Explorer.AutoMappingSettingName=Auto Mapping Settings...
-Explorer.AutoMappingSettingToolTipText=Auto mapping settings
-
-Explorer.RunTimeSettingName=Edit hibernate.properties...
-Explorer.RunTimeSettingToolTipText=Hibernate properties
-
-#new 11.05.2005
-Explorer.ClearPackageMappingName=Clear Mapping...
-Explorer.ClearPackageMappingToolTipText=Clear mapping
-Explorer.ClearPackageMappingTitle=Confirm Clear Mapping
-Explorer.ClearPackageMappingQuestion=Are you sure you want to remove the mapping\nfor the
"{0}"?
-
-
-Explorer.ClearClassMappingName=Clear Mapping...
-Explorer.ClearClassMappingToolTipText=Clear mapping
-Explorer.ClearClassMappingTitle=Confirm Clear Mapping
-Explorer.ClearClassMappingQuestion=Are you sure you want to remove the mapping\nfor the
"{0}"?
-
-
-Explorer.RemoveClassActionName=Remove Persistent Class...
-Explorer.RemoveClassActionToolTipText=Remove a persistent class
-Explorer.RemoveClassAction.QuestionDialog.Title=Remove Persistent Class
-Explorer.RemoveClassAction.QuestionDialog.Message=Do you want to remove "{0}"
?
-Explorer.RemoveClassAction.QuestionDialog.Radio1=Delete mapping file (if empty)
-Explorer.RemoveClassAction.QuestionDialog.Radio2=Delete source code
-
-Explorer.RemoveClassesActionName=Remove Persistent Classes...
-Explorer.RemoveClassesActionToolTipText=Remove persistent classes
-Explorer.RemoveClassesAction.QuestionDialog.Title=Remove Persistent Classes
-Explorer.RemoveClassesAction.QuestionDialog.Message=Do you want to remove all classes in
"{0}"?
-Explorer.RemoveClassesAction.QuestionDialog.Radio1=Delete mapping files (if empty)
-Explorer.RemoveClassesAction.QuestionDialog.Radio2=Delete source code
-
-Explorer.ClearFieldMappingActionName=Clear Mapping...
-Explorer.ClearFieldMappingActionToolTipText=Clear mapping
-Explorer.ClearFieldMappingTitle=Confirm Clear Mapping
-Explorer.ClearFieldMappingQuestion=Are you sure you want to remove the mapping\nfor the
"{0}"?
-
-Explorer.ClassAutoMappingActionName=Auto Mapping
-Explorer.ClassAutoMappingActionToolTipText=Auto mapping
-
-Explorer.RefreshClassSchemaMappingActionName=Synchronize Mapping...
-Explorer.RefreshClassSchemaMappingActionToolTipText=Synchronize Mapping
-Explorer.RefreshClassSchemaMappingTitle=Warning
-Explorer.RefreshClassSchemaMappingQuestion=JBoss Tools will automatically synchronize
mapping with the source code.\n\nPress OK to continue.
-
-
-Explorer.PackageAutoMappingActionName=Auto Mapping
-Explorer.PackageAutoMappingActionToolTipText=Auto mapping
-Explorer.PackageAutoMappingAction.ProgressMonitor=Auto mapping "{0}"
-
-Explorer.RefreshPackageSchemaMappingActionName=Synchronize Mapping...
-Explorer.RefreshPackageSchemaMappingActionToolTipText=Synchronize Mapping
-Explorer.RefreshPackageSchemaMappingTitle=Warning
-Explorer.RefreshPackageSchemaMappingQuestion=JBoss Tools will automatically synchronize
mapping with the source code.\n\nPress OK to continue.
-
-Explorer.RefreshMappingSchemaMappingActionName=Synchronize Mapping...
-Explorer.RefreshMappingSchemaMappingActionToolTipText=Synchronize Mapping
-Explorer.RefreshMappingSchemaMapping.ProgressMonitor=Synchronize Mapping "{0}"
-Explorer.RefreshMappingSchemaMappingTitle=Warning
-Explorer.RefreshMappingSchemaMappingQuestion=JBoss Tools will automatically synchronize
mapping with the source code.\n\nPress OK to continue.
-
-Explorer.RefactoringDialogClassActionName=Rename Class...
-Explorer.RefactoringDialogClassActionToolTipText=Rename a class
-
-Explorer.RefactoringDialogFieldActionName=Rename Field...
-Explorer.refactoringDialogFieldActionToolTipText=Rename a field
-
-Explorer.FetchStrategyWizarddName=Fetch Strategy Wizard...
-Explorer.FetchStrategyWizardToolTipText=Fetch strategy
-
-Explorer.CollapseAllActionName=Collapse All
-Explorer.CollapseAllActionToolTipText=Collapse all
-
-Explorer.ExpandAllActionName=Expand All
-Explorer.ExpandAllActionToolTipText=Expand all
-
-Explorer.refreshMappingActionName=Refresh
-Explorer.refreshMappingActionToolTipText=Refresh
-Explorer.refreshMappingAction.ProgressMonitor=Refresh
-
-Explorer.refreshOrmProjectActionName=Refresh
-Explorer.refreshOrmProjectActionToolTipText=Refresh
-Explorer.refreshOrmProjectAction.ProgressMonitor=Refresh "{0}"
-
-Explorer.removeConfigAction.ProgressMonitor=Remove "{0}"
-Explorer.removeConfigActionName=Remove Hibernate Configuration...
-Explorer.removeConfigActionToolTipText=Remove Hibernate configuration
-Explorer.removeConfigAction.QuestionDialog.Title=Confirm Remove Hibernate Configuration
-Explorer.removeConfigAction.QuestionDialog.Message=Do you want to remove the Hibernate
Configuration "{0}"?
-Explorer.removeConfigAction.QuestionDialog.Radio1=Also delete the mapping files
-Explorer.removeConfigAction.QuestionDialog.Radio2=Do not delete the mapping files
-
-Explorer.RenameTableObjectActionName=Rename Table...
-Explorer.RenameTableObjectActionToolTipText=Rename table
-
-Explorer.AddColumnDialogActionName=Add Column...
-Explorer.AddColumnDialogActionToolTipText=Add column
-
-Explorer.RemoveTableActionName=Remove Table...
-Explorer.RemoveTableActionTipText=Remove table
-Explorer.RemoveTableQuestion=Are you sure you want to remove table '
-Explorer.RemoveTableConfirmDeleteTitle=Confirm Delete
-
-Explorer.renameTableObjectDialogForColumnActionName=Rename Column...
-Explorer.renameTableObjectDialogForColumnActionToolTipText=Rename column
-
-Explorer.AddMappingStorageActionName=Add Mapping Files...
-Explorer.AddMappingStorageActionMessage=Choose mapping files to be added to the current
Hibernate configuration:
-Explorer.AddMappingStorageActionTipText=Add a Hibernate mapping file
-Explorer.FileNoErrorProjectDialogTitle=Action Explorer Visitor
-Explorer.FileNoErrorProjectDialogMessage=File "{0}" is outside of project
"{1}"
-Explorer.ConfirmProjectToPathDialogTitle=Confirm Add Project to the Build Path
-Explorer.ConfirmProjectToPathDialogMessage=Do you want to add project "{0}" to
the build path and mapping files to the current Hibernate configuration?
-Explorer.ConfirmProjectToPathDialogButtonLabelOK=OK
-Explorer.ConfirmProjectToPathDialogButtonLabelCancel=Cancel
-Explorer.XMLFileStorageDublicateTitle=Add Mapping Files
-Explorer.XMLFileStorageDublicateMessage=File "{0}" contains mapping for
existing persistent class "{1}".\nThe file will be ignored.
-
-
-Explorer.ColumnPropertyDialogActionName=Properties...
-Explorer.ColumnPropertyDialogActionToolTipText=Properties
-
-Explorer.ViewTableActionName=View Table
-Explorer.ViewTableActionToolTipText=View table
-
-Explorer.ormProjectsNotFound=There are no projects available with Hibernate
capabilities!
-Explorer.ormProjectsWasFound=
-
-Explorer.openSourceActionName=Open Source Code
-Explorer.openSourceActionToolTipText=Open a source file
-
-Explorer.openMappingStorageActionName=Open Mapping
-Explorer.openMappingStorageActionToolTipText=Open a mapping storage file
-
-Explorer.openMappingActionName=Open Mapping
-Explorer.openMappingActionToolTipText=Open a Hibernate configuration file
-
-Explorer.hibernateAddMappingWizardName=New Hibernate Configuration...
-Explorer.hibernateAddMappingWizardToolTipText=New Hibernate Configuration...
-
-Explorer.RefreshSchemaMappingActionName=Synchronize Schema Mapping...
-Explorer.RefreshSchemaMappingActionToolTipText=Synchronize Schema Mapping
-Explorer.RefreshSchemaMappingTitle=Warning
-Explorer.RefreshSchemaMappingQuestion=Warning.\nJBoss Tools will automatically
synchronize mapping with the Data Schema.
-
-
-Explorer.RefreshDatabaseTableSchemaMappingActionName=Synchronize Table Mapping...
-Explorer.RefreshDatabaseTableSchemaMappingActionToolTipText=Synchronize Table Mapping
-Explorer.RefreshDatabaseTableSchemaTitle=Warning
-Explorer.RefreshDatabaseTableSchemaQuestion=Warning.\nJBoss Tools will automatically
synchronize mapping with the Data Schema.
-
-Explorer.HQLConsole=HQL Console
-Explorer.HQLConsoleToolTipText=HQL Console
-Explorer.HibernateConsole=Hibernate Console
-Explorer.HibernateConsoleToolTipText=Hibernate Console
-# END NON-TRANSLATABLE
-
-Explorer.OpenEditorActionName=Open Mapping Diagram
-Explorer.OpenEditorActionToolTipText=Open Mapping Diagram
-
-# START NON-TRANSLATABLE
-# suspected OBSOLETE
-#ExplorerBase
-ExplorerBase.ActionRootSchemaTableColumnName=project -> mapping -> schema ->
table -> column
-ExplorerBase.ActionRootSchemaTableColumnContentDescription=project -> mapping ->
schema -> table -> column
-ExplorerBase.ActionRootSchemaTableColumnToolTipText=Show Relational Schema
-
-ExplorerBase.ActionRootTableColumnName=project -> mapping -> table -> column
-ExplorerBase.ActionRootTableColumnContentDescription=project -> mapping -> table
-> column
-ExplorerBase.ActionRootTableColumnToolTipText=Show columns
-OrmExplorer.licenceTitle=Evaluation Period
-OrmExplorer.licencemessage=Evaluation period expired.
-#OrmModelNameVisitor
-OrmModelNameVisitor.DefaultPackageName=Default Package
-OrmModelNameVisitor.DefaultDatabaseSchema=Default Schema
-# END NON-TRANSLATABLE
-
-
-
-# START NON-TRANSLATABLE
-OrmModelNameVisitor.Colon=:
-# suspected OBSOLETE
-OrmModelNameVisitor.OpenBrackets=(
-OrmModelNameVisitor.Comma=,
-OrmModelNameVisitor.CloseBrackets=)
-
-#Job
-Job.LoadMapping=Loading mappings...
-# END NON-TRANSLATABLE