mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00
Let new class wizard created empty source file, bug 269498.
This commit is contained in:
parent
8fc63d723e
commit
7bf6393aac
2 changed files with 13 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 QNX Software Systems and others.
|
||||
* Copyright (c) 2004, 2009 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -72,7 +72,16 @@ public class NewClassCodeGenerator {
|
|||
private ITranslationUnit fCreatedSourceTU = null;
|
||||
private ICElement fCreatedClass = null;
|
||||
private String fFullyQualifiedClassName;
|
||||
private boolean fForceSourceFileCreation;
|
||||
|
||||
/**
|
||||
* When set to <code>true</code>, the source file is created, even if no stubs have
|
||||
* been selected.
|
||||
*/
|
||||
public void setForceSourceFileCreation(boolean force) {
|
||||
fForceSourceFileCreation = force;
|
||||
}
|
||||
|
||||
public static class CodeGeneratorException extends CoreException {
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
|
@ -195,9 +204,7 @@ public class NewClassCodeGenerator {
|
|||
List<IMethodStub> protectedMethods = getStubs(ASTAccessVisibility.PROTECTED, true);
|
||||
List<IMethodStub> privateMethods = getStubs(ASTAccessVisibility.PRIVATE, true);
|
||||
|
||||
if (publicMethods.isEmpty() && protectedMethods.isEmpty() && privateMethods.isEmpty()) {
|
||||
//TODO need prefs option
|
||||
// don't create source file if no method bodies
|
||||
if (!fForceSourceFileCreation && publicMethods.isEmpty() && protectedMethods.isEmpty() && privateMethods.isEmpty()) {
|
||||
monitor.worked(100);
|
||||
} else {
|
||||
IFile sourceFile = NewSourceFileGenerator.createSourceFile(fSourcePath, true, new SubProgressMonitor(monitor, 50));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 QNX Software Systems and others.
|
||||
* Copyright (c) 2004, 2009 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -1917,6 +1917,7 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
|||
namespace,
|
||||
baseClasses,
|
||||
methodStubs);
|
||||
generator.setForceSourceFileCreation(true);
|
||||
generator.createClass(monitor);
|
||||
|
||||
fCreatedClass = generator.getCreatedClass();
|
||||
|
|
Loading…
Add table
Reference in a new issue