[jbosstools-commits] JBoss Tools SVN: r22810 - branches/jbosstools-3.1.x/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/editor.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Tue Jun 15 08:57:42 EDT 2010
Author: scabanovich
Date: 2010-06-15 08:57:42 -0400 (Tue, 15 Jun 2010)
New Revision: 22810
Modified:
branches/jbosstools-3.1.x/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/editor/HibConfig3CompoundEditor.java
Log:
https://jira.jboss.org/browse/JBIDE-6374
Modified: branches/jbosstools-3.1.x/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/editor/HibConfig3CompoundEditor.java
===================================================================
--- branches/jbosstools-3.1.x/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/editor/HibConfig3CompoundEditor.java 2010-06-15 12:56:42 UTC (rev 22809)
+++ branches/jbosstools-3.1.x/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/editor/HibConfig3CompoundEditor.java 2010-06-15 12:57:42 UTC (rev 22810)
@@ -11,9 +11,11 @@
package org.jboss.tools.hibernate.ui.xml.editor;
import org.jboss.tools.common.editor.TreeFormPage;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.ui.editor.EditorDescriptor;
import org.jboss.tools.common.model.ui.editors.multipage.DefaultMultipageEditor;
import org.jboss.tools.common.model.ui.texteditors.XMLTextEditorComponent;
+import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
import org.jboss.tools.hibernate.ui.xml.HibernateUIXMLPlugin;
import org.jboss.tools.hibernate.ui.xml.Messages;
import org.jboss.tools.hibernate.xml.model.FileHibernateFilteredTreeConstraint;
@@ -31,14 +33,14 @@
sessionFactory.setLabel(Messages.HibConfig3CompoundEditor_SessionFactoryLabel);
sessionFactory.setTitle(Messages.HibConfig3CompoundEditor_SessionFactoryTitle);
((TreeFormPage)sessionFactory).addFilter(new FileHibernateFilteredTreeConstraint());
- sessionFactory.initialize(object.getChildByPath("Session Factory")); //$NON-NLS-1$
+ sessionFactory.initialize(getSessionFactoryObject());
addFormPage(sessionFactory, "sessionFactoryEditor"); //$NON-NLS-1$
security = createTreeFormPage();
security.setLabel(Messages.HibConfig3CompoundEditor_SecurityLabel);
security.setTitle(Messages.HibConfig3CompoundEditor_SecurityTitle);
((TreeFormPage)security).addFilter(new FileHibernateFilteredTreeConstraint());
- security.initialize(object.getChildByPath("Security")); //$NON-NLS-1$
+ security.initialize(getSecurityObject());
addFormPage(security, "securityEditor"); //$NON-NLS-1$
}
@@ -64,9 +66,9 @@
protected void setNormalMode() {
if (treeFormPage!=null) { // AU added
- sessionFactory.initialize(getModelObject().getChildByPath("Session Factory")); // AU added //$NON-NLS-1$
+ sessionFactory.initialize(getSessionFactoryObject());
sessionFactory.setErrorMode(isErrorMode());
- security.initialize(getModelObject().getChildByPath("Security")); // AU added //$NON-NLS-1$
+ security.initialize(getSecurityObject());
security.setErrorMode(isErrorMode());
} // AU added
if (selectionProvider!=null) {
@@ -77,11 +79,27 @@
}
}
+ XModelObject getSessionFactoryObject() {
+ XModelObject o = getModelObject().getChildByPath("Session Factory"); //$NON-NLS-1$
+ if(o == null) {
+ o = XModelObjectLoaderUtil.createValidObject(object.getModel(), "HibConfig3SessionFactory"); //$NON-NLS-1$
+ }
+ return o;
+ }
+
+ XModelObject getSecurityObject() {
+ XModelObject o = getModelObject().getChildByPath("Security"); //$NON-NLS-1$
+ if(o == null) {
+ o = XModelObjectLoaderUtil.createValidObject(object.getModel(), "HibConfig3Security"); //$NON-NLS-1$
+ }
+ return o;
+ }
+
protected void setErrorMode() {
if (treeFormPage!=null) { // AU added
- sessionFactory.initialize(getModelObject().getChildByPath("Session Factory")); // AU added //$NON-NLS-1$
+ sessionFactory.initialize(getSessionFactoryObject());
sessionFactory.setErrorMode(isErrorMode());
- security.initialize(getModelObject().getChildByPath("Security")); // AU added //$NON-NLS-1$
+ security.initialize(getSecurityObject());
security.setErrorMode(isErrorMode());
} // AU added
if (treeEditor!=null) {
@@ -100,4 +118,4 @@
return new XMLTextEditorComponent(false);
}
-}
+}
\ No newline at end of file
More information about the jbosstools-commits
mailing list