summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-04-11 14:46:33 (EDT)
committer pelder2006-04-11 14:46:33 (EDT)
commit59ec5a1daffa93bf74d51b75c5c52a9d89f6c65c (patch)
tree63990b086699e3996cfe9f89239049c6a3e3b662
parent9e963abfa4466522e62b5aa248e4969c6ca36cf4 (diff)
downloadorg.eclipse.jet-59ec5a1daffa93bf74d51b75c5c52a9d89f6c65c.zip
org.eclipse.jet-59ec5a1daffa93bf74d51b75c5c52a9d89f6c65c.tar.gz
org.eclipse.jet-59ec5a1daffa93bf74d51b75c5c52a9d89f6c65c.tar.bz2
[136168] Use source folder option correctly, plus clean up some NPEs.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/JET2Compiler.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/JET2Compiler.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/JET2Compiler.java
index 305d599..35145ef 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/JET2Compiler.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/JET2Compiler.java
@@ -161,11 +161,11 @@ public class JET2Compiler
final IJETBundleManager bundleManager = JET2Platform.getJETBundleManager();
final IJETBundleDescriptor descriptor = bundleManager.getDescriptorForProject(project.getName());
- predefinedLibraryMap = getPredefinedPrefixMap(descriptor);
+ predefinedLibraryMap = descriptor != null ? getPredefinedPrefixMap(descriptor) : Collections.EMPTY_MAP;
- final String templateLoaderClass = descriptor.getTemplateLoaderClass();
- if (templateLoaderClass != null)
+ if (descriptor != null && descriptor.getTemplateLoaderClass() != null)
{
+ final String templateLoaderClass = descriptor.getTemplateLoaderClass();
int index = templateLoaderClass.lastIndexOf('.');
templateLoaderPackage = index >= 0 ? templateLoaderClass.substring(0, index) : ""; //$NON-NLS-1$
templateLoaderClassName = index >= 0 ? templateLoaderClass.substring(index + 1) : templateLoaderClass;
@@ -208,7 +208,7 @@ public class JET2Compiler
final LoaderGenerationParameters args = new LoaderGenerationParameters(templateLoaderPackage, templateLoaderClassName, compilerState.getTemplateMap());
String src = new JET2TransformGenerator().generate(args);
- IPath targetPath = new Path(getOption(JET2Compiler.OPTION_COMPILED_TEMPLATE_SRC_DIR, JET2Compiler.DEFAULT_COMPILED_TEMPLATE_SRC_DIR)).append(
+ IPath targetPath = new Path(getSourceDirOption()).append(
templateLoaderPackage.replace('.', '/')).append(templateLoaderClassName).addFileExtension("java"); //$NON-NLS-1$
try
@@ -226,6 +226,14 @@ public class JET2Compiler
}
}
+ /**
+ * @return
+ */
+ private String getSourceDirOption()
+ {
+ return getOption(JET2Compiler.OPTION_COMPILED_TEMPLATE_SRC_DIR, JET2Compiler.DEFAULT_COMPILED_TEMPLATE_SRC_DIR);
+ }
+
private String getOption(String key, String defaultValue)
{
Object value = options.get(key);
@@ -478,7 +486,7 @@ public class JET2Compiler
*/
private IPath javaClassProjectPath(String javaClassName)
{
- IPath targetPath = new Path(JET2Compiler.DEFAULT_COMPILED_TEMPLATE_SRC_DIR).append(javaClassName.replace('.', '/')).addFileExtension("java"); //$NON-NLS-1$
+ IPath targetPath = new Path(getSourceDirOption()).append(javaClassName.replace('.', '/')).addFileExtension("java"); //$NON-NLS-1$
return targetPath;
}