Author: vyemialyanchyk
Date: 2009-06-22 11:03:42 -0400 (Mon, 22 Jun 2009)
New Revision: 16115
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4506 - use sort order for ormElements
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-06-22
14:31:07 UTC (rev 16114)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2009-06-22
15:03:42 UTC (rev 16115)
@@ -51,6 +51,9 @@
import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
import org.jboss.tools.hibernate.ui.view.views.HibernateUtils;
+import sun.misc.Compare;
+import sun.misc.Sort;
+
public class OrmDiagram extends ModelElement {
public static final String REFRESH = "refresh"; //$NON-NLS-1$
@@ -82,6 +85,9 @@
this.consoleConfig = consoleConfig;
ormElements = new RootClass[ioe.length];
System.arraycopy(ioe, 0, ormElements, 0, ioe.length);
+ // should sort elements - cause different sort order gives different file name
+ // for the same thing
+ Sort.quicksort(ormElements, new OrmElCompare());
entityNames = new String[ioe.length];
for (int i = 0; i < ormElements.length; i++) {
entityNames[i] = ormElements[i].getEntityName();
@@ -94,7 +100,17 @@
load();
setDirty(false);
}
+
+ protected class OrmElCompare implements Compare {
+ public int doCompare(Object arg0, Object arg1) {
+ RootClass rc0 = (RootClass)arg0;
+ RootClass rc1 = (RootClass)arg1;
+ return rc0.getNodeName().compareTo(rc1.getNodeName());
+ }
+
+ }
+
/**
* It has no parent
*/