Author: dgeraskov
Date: 2012-08-24 08:54:41 -0400 (Fri, 24 Aug 2012)
New Revision: 43218
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/HibernateResourceTree.java
Log:
https://issues.jboss.org/browse/JBIDE-4007
Do not allow to select Folder when browse resource, but only hbm.xml files
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/HibernateResourceTree.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/HibernateResourceTree.java 2012-08-24
12:42:49 UTC (rev 43217)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/HibernateResourceTree.java 2012-08-24
12:54:41 UTC (rev 43218)
@@ -23,7 +23,7 @@
String pathpart = o.getPathPart();
String pp = pathpart;
pp = pp.toLowerCase();
- return pp.endsWith(".hbm.xml");
+ return pp.endsWith(".hbm.xml"); //$NON-NLS-1$
}
public void setModel(XModel model) {
@@ -80,7 +80,7 @@
}
public boolean isSelectable(XModelObject object) {
- return (object != null && (object.getFileType() == XFileObject.FILE ||
object.getFileType() == XFileObject.FOLDER));
+ return (object != null && (object.getFileType() == XFileObject.FILE));
}
public String getPath(XModelObject o) {
@@ -90,18 +90,18 @@
if(p == null) return ""; //$NON-NLS-1$
int b = "FileSystems/".length(), e = p.length() - s.length();
//$NON-NLS-1$
if(e < b) return ""; //$NON-NLS-1$
- if(o.getFileType() == XFileObject.FOLDER) s += "/"; //$NON-NLS-1$
- if(s.startsWith("/")) s = s.substring(1);
+ if(o.getFileType() == XFileObject.FOLDER) s += XModelObjectConstants.SEPARATOR;
+ if(s.startsWith(XModelObjectConstants.SEPARATOR)) s = s.substring(1);
return s;
}
public XModelObject find(String value) {
- if(value != null && value.endsWith("/")) {
+ if(value != null && value.endsWith(XModelObjectConstants.SEPARATOR)) {
value = value.substring(0, value.length() - 1);
}
XModelObject result = model.getByPath(value);
- if(result == null && value != null &&
!value.startsWith("/")) { //$NON-NLS-1$
- result = model.getByPath("/" + value); //$NON-NLS-1$
+ if(result == null && value != null &&
!value.startsWith(XModelObjectConstants.SEPARATOR)) {
+ result = model.getByPath(XModelObjectConstants.SEPARATOR + value);
}
return result;
}