1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

2004-08-13 Chris Wiebe

add namespace to new class wizard.
	* src/org/eclipse/cdt/internal/ui/wizards/classwizard/*
This commit is contained in:
Chris Wiebe 2004-08-14 00:14:37 +00:00
parent d45d99f463
commit ad9112a59b
7 changed files with 263 additions and 91 deletions

View file

@ -1,10 +1,15 @@
2004-08-012 Chris Wiebe 2004-08-13 Chris Wiebe
add namespace to class wizard.
* src/org/eclipse/cdt/internal/ui/wizards/classwizard/*
2004-08-12 Chris Wiebe
Initial draft of new class wizard. Initial draft of new class wizard.
* src/org/eclipse/cdt/ui/wizards/NewClassCreationWizard.java * src/org/eclipse/cdt/ui/wizards/NewClassCreationWizard.java
* src/org/eclipse/cdt/internal/ui/wizards/classwizard/* * src/org/eclipse/cdt/internal/ui/wizards/classwizard/*
2004-08-012 Chris Wiebe 2004-08-12 Chris Wiebe
* src/org/eclipse/cdt/internal/ui/wizards/dialogsfields/ListDialogField.java * src/org/eclipse/cdt/internal/ui/wizards/dialogsfields/ListDialogField.java
* src/org/eclipse/cdt/internal/ui/wizards/dialogsfields/CheckedListDialogField.java * src/org/eclipse/cdt/internal/ui/wizards/dialogsfields/CheckedListDialogField.java

View file

@ -324,7 +324,6 @@
%NewWizards.class.description %NewWizards.class.description
</description> </description>
</wizard> </wizard>
<!--
<wizard <wizard
name="New C++ Class" name="New C++ Class"
icon="icons/full/ctool16/newclass_wiz.gif" icon="icons/full/ctool16/newclass_wiz.gif"
@ -338,7 +337,6 @@
%NewWizards.class.description %NewWizards.class.description
</description> </description>
</wizard> </wizard>
-->
</extension> </extension>
<!-- Define the document provider and partitionner for the CEditor --> <!-- Define the document provider and partitionner for the CEditor -->
<extension <extension

View file

@ -48,11 +48,12 @@ public final class ConstructorMethodStub extends AbstractMethodStub {
buf.append("::"); //$NON-NLS-1$ buf.append("::"); //$NON-NLS-1$
buf.append(className); buf.append(className);
buf.append("()"); //$NON-NLS-1$ buf.append("()"); //$NON-NLS-1$
buf.append(" {"); //$NON-NLS-1$ buf.append(lineDelimiter);
buf.append('{');
buf.append(lineDelimiter); buf.append(lineDelimiter);
//buf.append("// TODO Auto-generated constructor stub"); //buf.append("// TODO Auto-generated constructor stub");
//buf.append(lineDelimiter); //buf.append(lineDelimiter);
buf.append("}"); //$NON-NLS-1$ buf.append('}');
return buf.toString(); return buf.toString();
} }
} }

View file

@ -52,11 +52,12 @@ public final class DestructorMethodStub extends AbstractMethodStub {
buf.append("::~"); //$NON-NLS-1$ buf.append("::~"); //$NON-NLS-1$
buf.append(className); buf.append(className);
buf.append("()"); //$NON-NLS-1$ buf.append("()"); //$NON-NLS-1$
buf.append(" {"); //$NON-NLS-1$ buf.append(lineDelimiter);
buf.append('{');
buf.append(lineDelimiter); buf.append(lineDelimiter);
//buf.append("// TODO Auto-generated destructor stub"); //buf.append("// TODO Auto-generated destructor stub");
//buf.append(lineDelimiter); //buf.append(lineDelimiter);
buf.append("}"); //$NON-NLS-1$ buf.append('}');
return buf.toString(); return buf.toString();
} }
} }

View file

@ -36,6 +36,7 @@ public class NewClassCodeGenerator {
private IPath fHeaderPath = null; private IPath fHeaderPath = null;
private IPath fSourcePath = null; private IPath fSourcePath = null;
private String fClassName = null; private String fClassName = null;
private String fNamespace = null;
private String fLineDelimiter; private String fLineDelimiter;
private IBaseClassInfo[] fBaseClasses = null; private IBaseClassInfo[] fBaseClasses = null;
private IMethodStub[] fMethodStubs = null; private IMethodStub[] fMethodStubs = null;
@ -43,10 +44,11 @@ public class NewClassCodeGenerator {
private ITranslationUnit fCreatedSourceTU = null; private ITranslationUnit fCreatedSourceTU = null;
private ICElement fCreatedClass = null; private ICElement fCreatedClass = null;
public NewClassCodeGenerator(IPath headerPath, IPath sourcePath, String className, IBaseClassInfo[] baseClasses, IMethodStub[] methodStubs) { public NewClassCodeGenerator(IPath headerPath, IPath sourcePath, String className, String namespace, IBaseClassInfo[] baseClasses, IMethodStub[] methodStubs) {
fHeaderPath = headerPath; fHeaderPath = headerPath;
fSourcePath = sourcePath; fSourcePath = sourcePath;
fClassName = className; fClassName = className;
fNamespace = namespace;
fBaseClasses = baseClasses; fBaseClasses = baseClasses;
fMethodStubs = methodStubs; fMethodStubs = methodStubs;
fLineDelimiter = NewSourceFileGenerator.getLineDelimiter(); fLineDelimiter = NewSourceFileGenerator.getLineDelimiter();
@ -161,16 +163,24 @@ public class NewClassCodeGenerator {
text.append(oldContents); text.append(oldContents);
else else
text.append(oldContents.substring(0, insertionPos)); text.append(oldContents.substring(0, insertionPos));
text.append(fLineDelimiter);
} }
if (fBaseClasses != null && fBaseClasses.length > 0) {
addBaseClassIncludes(headerTU, text); addBaseClassIncludes(headerTU, text);
text.append(fLineDelimiter);
}
if (fNamespace != null && fNamespace.length() > 0) {
beginNamespace(text);
}
text.append("class "); //$NON-NLS-1$ text.append("class "); //$NON-NLS-1$
text.append(fClassName); text.append(fClassName);
addBaseClassInheritance(text); addBaseClassInheritance(text);
text.append(fLineDelimiter); text.append(fLineDelimiter);
text.append('{'); text.append('{');
text.append(fLineDelimiter);
//TODO sort methods (eg constructor always first?) //TODO sort methods (eg constructor always first?)
List publicMethods = getStubs(ASTAccessVisibility.PUBLIC, false); List publicMethods = getStubs(ASTAccessVisibility.PUBLIC, false);
@ -188,6 +198,10 @@ public class NewClassCodeGenerator {
text.append("};"); //$NON-NLS-1$ text.append("};"); //$NON-NLS-1$
text.append(fLineDelimiter); text.append(fLineDelimiter);
if (fNamespace != null && fNamespace.length() > 0) {
endNamespace(text);
}
if (oldContents != null && insertionPos != -1) { if (oldContents != null && insertionPos != -1) {
text.append(fLineDelimiter); text.append(fLineDelimiter);
text.append(oldContents.substring(insertionPos)); text.append(oldContents.substring(insertionPos));
@ -209,9 +223,23 @@ public class NewClassCodeGenerator {
return insertPos; return insertPos;
} }
private void beginNamespace(StringBuffer text) {
text.append("namespace "); //$NON-NLS-1$
text.append(fNamespace);
text.append(fLineDelimiter);
text.append('{');
text.append(fLineDelimiter);
text.append(fLineDelimiter);
}
private void endNamespace(StringBuffer text) {
text.append(fLineDelimiter);
text.append("};"); //$NON-NLS-1$
text.append(fLineDelimiter);
}
private void addMethodDeclarations(List publicMethods, List protectedMethods, List privateMethods, StringBuffer text) { private void addMethodDeclarations(List publicMethods, List protectedMethods, List privateMethods, StringBuffer text) {
if (!publicMethods.isEmpty()) { if (!publicMethods.isEmpty()) {
text.append(fLineDelimiter);
text.append("public:"); //$NON-NLS-1$ text.append("public:"); //$NON-NLS-1$
text.append(fLineDelimiter); text.append(fLineDelimiter);
for (Iterator i = publicMethods.iterator(); i.hasNext();) { for (Iterator i = publicMethods.iterator(); i.hasNext();) {
@ -224,7 +252,6 @@ public class NewClassCodeGenerator {
} }
if (!protectedMethods.isEmpty()) { if (!protectedMethods.isEmpty()) {
text.append(fLineDelimiter);
text.append("protected:"); //$NON-NLS-1$ text.append("protected:"); //$NON-NLS-1$
text.append(fLineDelimiter); text.append(fLineDelimiter);
for (Iterator i = protectedMethods.iterator(); i.hasNext();) { for (Iterator i = protectedMethods.iterator(); i.hasNext();) {
@ -237,7 +264,6 @@ public class NewClassCodeGenerator {
} }
if (!privateMethods.isEmpty()) { if (!privateMethods.isEmpty()) {
text.append(fLineDelimiter);
text.append("private:"); //$NON-NLS-1$ text.append("private:"); //$NON-NLS-1$
text.append(fLineDelimiter); text.append(fLineDelimiter);
for (Iterator i = privateMethods.iterator(); i.hasNext();) { for (Iterator i = privateMethods.iterator(); i.hasNext();) {
@ -288,7 +314,6 @@ public class NewClassCodeGenerator {
} }
private void addBaseClassIncludes(ITranslationUnit headerTU, StringBuffer text) { private void addBaseClassIncludes(ITranslationUnit headerTU, StringBuffer text) {
if (fBaseClasses != null && fBaseClasses.length > 0) {
IProject project = headerTU.getCProject().getProject(); IProject project = headerTU.getCProject().getProject();
IPath projectLocation = project.getLocation(); IPath projectLocation = project.getLocation();
IPath headerLocation = headerTU.getResource().getLocation(); IPath headerLocation = headerTU.getResource().getLocation();
@ -323,8 +348,6 @@ public class NewClassCodeGenerator {
text.append(fLineDelimiter); text.append(fLineDelimiter);
} }
} }
text.append(fLineDelimiter);
}
} }
public String constructSourceFileContent(ITranslationUnit sourceTU, ITranslationUnit headerTU) { public String constructSourceFileContent(ITranslationUnit sourceTU, ITranslationUnit headerTU) {
@ -333,6 +356,7 @@ public class NewClassCodeGenerator {
if (headerTU != null) { if (headerTU != null) {
addHeaderInclude(sourceTU, headerTU, text); addHeaderInclude(sourceTU, headerTU, text);
text.append(fLineDelimiter);
} }
//TODO sort methods (eg constructor always first?) //TODO sort methods (eg constructor always first?)
@ -343,9 +367,17 @@ public class NewClassCodeGenerator {
if (publicMethods.isEmpty() if (publicMethods.isEmpty()
&& protectedMethods.isEmpty() && protectedMethods.isEmpty()
&& privateMethods.isEmpty()) { && privateMethods.isEmpty()) {
text.append(' '); // no methods
} else { } else {
if (fNamespace != null && fNamespace.length() > 0) {
beginNamespace(text);
}
addMethodBodies(publicMethods, protectedMethods, privateMethods, text); addMethodBodies(publicMethods, protectedMethods, privateMethods, text);
if (fNamespace != null && fNamespace.length() > 0) {
endNamespace(text);
}
} }
return text.toString(); return text.toString();
@ -378,9 +410,10 @@ public class NewClassCodeGenerator {
for (Iterator i = publicMethods.iterator(); i.hasNext();) { for (Iterator i = publicMethods.iterator(); i.hasNext();) {
IMethodStub stub = (IMethodStub) i.next(); IMethodStub stub = (IMethodStub) i.next();
String code = stub.createMethodImplementation(fClassName, fBaseClasses, fLineDelimiter); String code = stub.createMethodImplementation(fClassName, fBaseClasses, fLineDelimiter);
text.append(fLineDelimiter);
text.append(code); text.append(code);
text.append(fLineDelimiter); text.append(fLineDelimiter);
if (i.hasNext())
text.append(fLineDelimiter);
} }
} }
@ -388,9 +421,10 @@ public class NewClassCodeGenerator {
for (Iterator i = protectedMethods.iterator(); i.hasNext();) { for (Iterator i = protectedMethods.iterator(); i.hasNext();) {
IMethodStub stub = (IMethodStub) i.next(); IMethodStub stub = (IMethodStub) i.next();
String code = stub.createMethodImplementation(fClassName, fBaseClasses, fLineDelimiter); String code = stub.createMethodImplementation(fClassName, fBaseClasses, fLineDelimiter);
text.append(fLineDelimiter);
text.append(code); text.append(code);
text.append(fLineDelimiter); text.append(fLineDelimiter);
if (i.hasNext())
text.append(fLineDelimiter);
} }
} }
@ -398,9 +432,10 @@ public class NewClassCodeGenerator {
for (Iterator i = privateMethods.iterator(); i.hasNext();) { for (Iterator i = privateMethods.iterator(); i.hasNext();) {
IMethodStub stub = (IMethodStub) i.next(); IMethodStub stub = (IMethodStub) i.next();
String code = stub.createMethodImplementation(fClassName, fBaseClasses, fLineDelimiter); String code = stub.createMethodImplementation(fClassName, fBaseClasses, fLineDelimiter);
text.append(fLineDelimiter);
text.append(code); text.append(code);
text.append(fLineDelimiter); text.append(fLineDelimiter);
if (i.hasNext())
text.append(fLineDelimiter);
} }
} }
} }

View file

@ -101,6 +101,7 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
StringButtonDialogField fNamespaceDialogField; StringButtonDialogField fNamespaceDialogField;
private boolean fCanModifyNamespace; private boolean fCanModifyNamespace;
protected IStatus fNamespaceStatus; protected IStatus fNamespaceStatus;
ITypeInfo fCurrentNamespace;
/** ID of the enclosing class input field. */ /** ID of the enclosing class input field. */
protected final static String ENCLOSING_CLASS = PAGE_NAME + ".enclosingclass"; //$NON-NLS-1$ protected final static String ENCLOSING_CLASS = PAGE_NAME + ".enclosingclass"; //$NON-NLS-1$
@ -590,6 +591,7 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
public void changeControlPressed(DialogField field) { public void changeControlPressed(DialogField field) {
ITypeInfo namespace = chooseNamespace(); ITypeInfo namespace = chooseNamespace();
if (namespace != null) { if (namespace != null) {
fCurrentNamespace = namespace;
String name = namespace.getQualifiedTypeName().getFullyQualifiedName(); String name = namespace.getQualifiedTypeName().getFullyQualifiedName();
// this will trigger dialogFieldChanged // this will trigger dialogFieldChanged
@ -641,9 +643,9 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
boolean enclosing = isEnclosingClassSelected(); boolean enclosing = isEnclosingClassSelected();
String name = ""; //$NON-NLS-1$ String name = ""; //$NON-NLS-1$
if (enclosing && fCurrentEnclosingClass != null) { if (enclosing && fCurrentEnclosingClass != null) {
ITypeInfo namespace = fCurrentEnclosingClass.getEnclosingNamespace(); fCurrentNamespace = fCurrentEnclosingClass.getEnclosingNamespace();
if (namespace != null) { if (fCurrentNamespace != null) {
IQualifiedTypeName qualNSName = namespace.getQualifiedTypeName(); IQualifiedTypeName qualNSName = fCurrentNamespace.getQualifiedTypeName();
name = qualNSName.getFullyQualifiedName(); name = qualNSName.getFullyQualifiedName();
} }
} }
@ -786,6 +788,53 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
*/ */
protected IStatus namespaceChanged() { protected IStatus namespaceChanged() {
StatusInfo status = new StatusInfo(); StatusInfo status = new StatusInfo();
fCurrentNamespace = null;
String namespace = getNamespace();
// check if empty
if (namespace.length() == 0) {
return status;
}
IStatus val = CConventions.validateClassName(namespace);
if (val.getSeverity() == IStatus.ERROR) {
status.setError(NewClassWizardMessages.getFormattedString("NewClassCreationWizardPage.error.InvalidNamespace", val.getMessage())); //$NON-NLS-1$
return status;
} else if (val.getSeverity() == IStatus.WARNING) {
status.setWarning(NewClassWizardMessages.getFormattedString("NewClassCreationWizardPage.warning.NamespaceDiscouraged", val.getMessage())); //$NON-NLS-1$
// continue checking
}
IProject project = getCurrentProject();
if (project != null) {
ITypeSearchScope scope = prepareTypeCache();
if (scope == null) {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.noTypeCache")); //$NON-NLS-1$
return status;
}
IQualifiedTypeName qualName = new QualifiedTypeName(namespace);
ITypeInfo[] types = AllTypesCache.getTypes(project, qualName, false);
for (int i = 0; i < types.length; ++i) {
if (types[i].getCElementType() == ICElement.C_NAMESPACE) {
fCurrentNamespace = types[i];
break;
}
}
if (fCurrentNamespace == null) {
types = AllTypesCache.getTypes(project, qualName, true);
for (int i = 0; i < types.length; ++i) {
if (types[i].getCElementType() == ICElement.C_NAMESPACE) {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.NamespaceExistsDifferentCase")); //$NON-NLS-1$
return status;
}
}
status.setWarning(NewClassWizardMessages.getString("NewClassCreationWizardPage.warning.NamespaceNotExists")); //$NON-NLS-1$
return status;
}
}
return status; return status;
} }
@ -802,7 +851,53 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
if (!isEnclosingClassSelected()) { if (!isEnclosingClassSelected()) {
return status; return status;
} }
//TODO check if enclosing class exists fCurrentEnclosingClass = null;
String enclosing = getEnclosingClass();
// must not be empty
if (enclosing.length() == 0) {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.EnterClassName")); //$NON-NLS-1$
return status;
}
IStatus val = CConventions.validateClassName(enclosing);
if (val.getSeverity() == IStatus.ERROR) {
status.setError(NewClassWizardMessages.getFormattedString("NewClassCreationWizardPage.error.InvalidClassName", val.getMessage())); //$NON-NLS-1$
return status;
} else if (val.getSeverity() == IStatus.WARNING) {
status.setWarning(NewClassWizardMessages.getFormattedString("NewClassCreationWizardPage.warning.ClassNameDiscouraged", val.getMessage())); //$NON-NLS-1$
// continue checking
}
IProject project = getCurrentProject();
if (project != null) {
ITypeSearchScope scope = prepareTypeCache();
if (scope == null) {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.noTypeCache")); //$NON-NLS-1$
return status;
}
IQualifiedTypeName qualName = new QualifiedTypeName(enclosing);
ITypeInfo[] types = AllTypesCache.getTypes(project, qualName, false);
for (int i = 0; i < types.length; ++i) {
if (types[i].getCElementType() == ICElement.C_CLASS) {
fCurrentEnclosingClass = types[i];
break;
}
}
if (fCurrentEnclosingClass == null) {
types = AllTypesCache.getTypes(project, qualName, true);
for (int i = 0; i < types.length; ++i) {
if (types[i].getCElementType() == ICElement.C_CLASS) {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.ClassNameExistsDifferentCase")); //$NON-NLS-1$
return status;
}
}
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.ClassNameNotExists")); //$NON-NLS-1$
return status;
}
}
return status; return status;
} }
@ -834,16 +929,31 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
// continue checking // continue checking
} }
IProject project = getCurrentProject();
if (project != null) {
ITypeSearchScope scope = prepareTypeCache();
if (scope == null) {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.noTypeCache")); //$NON-NLS-1$
return status;
}
IQualifiedTypeName qualName = new QualifiedTypeName(className); IQualifiedTypeName qualName = new QualifiedTypeName(className);
// must not exist // must not exist
if (!isEnclosingClassSelected()) { if (!isEnclosingClassSelected()) {
IProject project = getCurrentProject(); if (fCurrentNamespace != null) {
if (project == null) ITypeInfo[] types = fCurrentNamespace.getEnclosedTypes();
return null; for (int i = 0; i < types.length; ++i) {
ITypeSearchScope scope = prepareTypeCache(); IQualifiedTypeName typeName = types[i].getQualifiedTypeName().removeFirstSegments(1);
if (scope == null) if (typeName.equalsIgnoreCase(qualName)) {
return null; if (typeName.equals(qualName))
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.ClassNameExists")); //$NON-NLS-1$
else
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.ClassNameExistsDifferentCase")); //$NON-NLS-1$
return status;
}
}
} else {
ITypeInfo[] types = AllTypesCache.getTypes(project, qualName, false); ITypeInfo[] types = AllTypesCache.getTypes(project, qualName, false);
if (types.length != 0) { if (types.length != 0) {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.ClassNameExists")); //$NON-NLS-1$ status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.ClassNameExists")); //$NON-NLS-1$
@ -854,17 +964,13 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.ClassNameExistsDifferentCase")); //$NON-NLS-1$ status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.ClassNameExistsDifferentCase")); //$NON-NLS-1$
return status; return status;
} }
} else { }
ITypeSearchScope scope = prepareTypeCache(); } else if (fCurrentEnclosingClass != null) {
if (scope == null)
return null;
if (fCurrentEnclosingClass != null) {
ITypeInfo[] types = fCurrentEnclosingClass.getEnclosedTypes(); ITypeInfo[] types = fCurrentEnclosingClass.getEnclosedTypes();
for (int i = 0; i < types.length; ++i) { for (int i = 0; i < types.length; ++i) {
ITypeInfo type = types[i]; IQualifiedTypeName typeName = types[i].getQualifiedTypeName().removeFirstSegments(1);
if (type.getQualifiedTypeName().equalsIgnoreCase(qualName)) { if (typeName.equalsIgnoreCase(qualName)) {
if (type.getQualifiedTypeName().equals(qualName)) if (typeName.equals(qualName))
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.ClassNameExists")); //$NON-NLS-1$ status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.ClassNameExists")); //$NON-NLS-1$
else else
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.ClassNameExistsDifferentCase")); //$NON-NLS-1$ status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.ClassNameExistsDifferentCase")); //$NON-NLS-1$
@ -949,6 +1055,24 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
return fSourceFolderDialogField.getText(); return fSourceFolderDialogField.getText();
} }
/**
* Returns the namespace entered into the namespace input field.
*
* @return the namespace
*/
public String getNamespace() {
return fNamespaceDialogField.getText();
}
/**
* Returns the enclosing class name entered into the enclosing class input field.
*
* @return the enclosing class name
*/
public String getEnclosingClass() {
return fEnclosingClassDialogField.getText();
}
/** /**
* Returns the selection state of the enclosing class checkbox. * Returns the selection state of the enclosing class checkbox.
* *
@ -959,9 +1083,9 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
} }
/** /**
* Returns the type name entered into the type input field. * Returns the class name entered into the class input field.
* *
* @return the type name * @return the class name
*/ */
public String getClassName() { public String getClassName() {
return fClassNameDialogField.getText(); return fClassNameDialogField.getText();
@ -1152,7 +1276,7 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
* editable; otherwise it is read-only. * editable; otherwise it is read-only.
*/ */
public void setNamespace(ITypeInfo namespace, boolean canBeModified) { public void setNamespace(ITypeInfo namespace, boolean canBeModified) {
// fCurrNamespace = namespace; fCurrentNamespace = namespace;
fCanModifyNamespace = canBeModified; fCanModifyNamespace = canBeModified;
if (namespace != null) { if (namespace != null) {
String name = namespace.getQualifiedTypeName().getFullyQualifiedName(); String name = namespace.getQualifiedTypeName().getFullyQualifiedName();
@ -1404,6 +1528,7 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
headerPath, headerPath,
sourcePath, sourcePath,
getClassName(), getClassName(),
getNamespace(),
getBaseClasses(), getBaseClasses(),
getCheckedMethodStubs()); getCheckedMethodStubs());
fCodeGenerator.createClass(monitor); fCodeGenerator.createClass(monitor);

View file

@ -37,13 +37,20 @@ NewClassCreationWizardPage.warning.NotInACProject=Folder is not in a C/C++ proje
NewClassCreationWizardPage.namespace.label=Namespace: NewClassCreationWizardPage.namespace.label=Namespace:
NewClassCreationWizardPage.namespace.button=Bro&wse... NewClassCreationWizardPage.namespace.button=Bro&wse...
NewClassCreationWizardPage.warning.NamespaceNotExists=Namespace does not exist. A new namespace will be created.
NewClassCreationWizardPage.error.NamespaceExistsDifferentCase=Namespace with same name but different case exists.
NewClassCreationWizardPage.error.InvalidNamespace=Namespace is not valid. {0}
NewClassCreationWizardPage.warning.NamespaceDiscouraged=Namespace is discouraged. {0}
NewClassCreationWizardPage.enclosingClass.label=&Enclosing Class: NewClassCreationWizardPage.enclosingClass.label=&Enclosing Class:
NewClassCreationWizardPage.enclosingClass.button=Br&owse... NewClassCreationWizardPage.enclosingClass.button=Br&owse...
NewClassCreationWizardPage.error.noTypeCache=Unable to access type cache.
NewClassCreationWizardPage.className.label=Class &Name: NewClassCreationWizardPage.className.label=Class &Name:
NewClassCreationWizardPage.error.EnterClassName=Class name is empty. NewClassCreationWizardPage.error.EnterClassName=Class name is empty.
NewClassCreationWizardPage.error.ClassNameExists=Class already exists. NewClassCreationWizardPage.error.ClassNameExists=Class already exists.
NewClassCreationWizardPage.error.ClassNameNotExists=Class does not exist.
NewClassCreationWizardPage.error.ClassNameExistsDifferentCase=Class with same name but different case exists. NewClassCreationWizardPage.error.ClassNameExistsDifferentCase=Class with same name but different case exists.
NewClassCreationWizardPage.error.InvalidClassName=Class name is not valid. {0} NewClassCreationWizardPage.error.InvalidClassName=Class name is not valid. {0}
NewClassCreationWizardPage.error.QualifiedName=Class name must not be qualified. NewClassCreationWizardPage.error.QualifiedName=Class name must not be qualified.