Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java12
2 files changed, 12 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java
index d53a69d6ff0..e11f01fabd3 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java
@@ -117,7 +117,7 @@ public class StubUtility {
};
String text = evaluateTemplate(context, template, fullLine);
- if (!text.endsWith(lineDelimiter))
+ if (text != null && !text.endsWith(lineDelimiter))
text += lineDelimiter;
return text;
}
@@ -164,7 +164,7 @@ public class StubUtility {
CodeTemplateContextType.TYPE_COMMENT
};
String text = evaluateTemplate(context, template, fullLine);
- if (!text.endsWith(lineDelimiter))
+ if (text != null && !text.endsWith(lineDelimiter))
text += lineDelimiter;
return text;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java
index e9438eaa4f6..9de3a40e54e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java
@@ -211,7 +211,11 @@ public class NewClassCodeGenerator {
String headerContent = constructHeaderFileContent(headerTU, publicMethods,
protectedMethods, privateMethods, headerWorkingCopy.getBuffer().getContents(),
new SubProgressMonitor(monitor, 100));
- headerContent= formatSource(headerContent, headerTU);
+ if (headerContent != null) {
+ headerContent= formatSource(headerContent, headerTU);
+ } else {
+ headerContent = ""; //$NON-NLS-1$
+ }
headerWorkingCopy.getBuffer().setContents(headerContent);
if (monitor.isCanceled()) {
@@ -250,7 +254,11 @@ public class NewClassCodeGenerator {
String sourceContent = constructSourceFileContent(sourceTU, headerTU,
publicMethods, protectedMethods, privateMethods,
sourceWorkingCopy.getBuffer().getContents(), new SubProgressMonitor(monitor, 100));
- sourceContent= formatSource(sourceContent, sourceTU);
+ if (sourceContent != null) {
+ sourceContent = formatSource(sourceContent, sourceTU);
+ } else {
+ sourceContent = ""; //$NON-NLS-1$
+ }
sourceWorkingCopy.getBuffer().setContents(sourceContent);
if (monitor.isCanceled()) {

Back to the top