Author: scabanovich
Date: 2007-10-09 10:32:01 -0400 (Tue, 09 Oct 2007)
New Revision: 4076
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java
Log:
JBIDE-1053
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java 2007-10-09
13:36:57 UTC (rev 4075)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java 2007-10-09
14:32:01 UTC (rev 4076)
@@ -71,17 +71,19 @@
protected String getDefaultPageTemplate() {
String defaultPageTemplate = null;
String nature =
getTarget().getModel().getProperties().getProperty("nature");
- try {
- if(nature.indexOf("jsf") >= 0) {
- XModelObject obj =
PreferenceModelUtilities.getPreferenceModel().getByPath(NewJSFProjectPath);
- defaultPageTemplate = obj.getAttributeValue("Page Template");
- } else if(nature.indexOf("struts") >= 0) {
- XModelObject obj =
PreferenceModelUtilities.getPreferenceModel().getByPath(NewStrutsProjectPath);
- defaultPageTemplate = obj.getAttributeValue("Page Template");
- }
- } catch (Exception x) {
- WebModelPlugin.getPluginLog().logError(x);
+ if(nature == null) {
+ return null;
}
+ String prefPath = (nature.indexOf("jsf") >= 0) ? NewJSFProjectPath :
+ (nature.indexOf("struts") >= 0) ? NewStrutsProjectPath :
+ null;
+ if(prefPath == null) return null;
+ XModelObject pref = PreferenceModelUtilities.getPreferenceModel().getByPath(prefPath);
+ if(pref == null) {
+ WebModelPlugin.getPluginLog().logError("Cannot find preference object " +
prefPath, new Exception());
+ return null;
+ }
+ defaultPageTemplate = pref.getAttributeValue("Page Template");
return defaultPageTemplate;
}
Show replies by date