mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Revert "Bug 510789 - Added final field to class wizard"
This reverts commit ccabaa2118
.
Change-Id: I9dba85dadfb44e8e8d97e9368bba6da4da541910
This commit is contained in:
parent
61d10d11ef
commit
757eab4307
4 changed files with 6 additions and 94 deletions
|
@ -91,7 +91,6 @@ public class NewClassCodeGenerator {
|
||||||
private ICElement fCreatedClass;
|
private ICElement fCreatedClass;
|
||||||
private String fFullyQualifiedClassName;
|
private String fFullyQualifiedClassName;
|
||||||
private boolean fForceSourceFileCreation;
|
private boolean fForceSourceFileCreation;
|
||||||
private final boolean fIsFinal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When set to <code>true</code>, the source file is created, even if no stubs have
|
* When set to <code>true</code>, the source file is created, even if no stubs have
|
||||||
|
@ -126,7 +125,7 @@ public class NewClassCodeGenerator {
|
||||||
* @param methodStubs the method stubs
|
* @param methodStubs the method stubs
|
||||||
*/
|
*/
|
||||||
public NewClassCodeGenerator(IPath headerPath, IPath sourcePath, IPath testPath, String className, String namespace,
|
public NewClassCodeGenerator(IPath headerPath, IPath sourcePath, IPath testPath, String className, String namespace,
|
||||||
IBaseClassInfo[] baseClasses, IMethodStub[] methodStubs, boolean isFinal) {
|
IBaseClassInfo[] baseClasses, IMethodStub[] methodStubs) {
|
||||||
fHeaderPath = headerPath;
|
fHeaderPath = headerPath;
|
||||||
fSourcePath = sourcePath;
|
fSourcePath = sourcePath;
|
||||||
fTestPath = testPath;
|
fTestPath = testPath;
|
||||||
|
@ -143,7 +142,6 @@ public class NewClassCodeGenerator {
|
||||||
}
|
}
|
||||||
fBaseClasses = baseClasses;
|
fBaseClasses = baseClasses;
|
||||||
fMethodStubs = methodStubs;
|
fMethodStubs = methodStubs;
|
||||||
fIsFinal = isFinal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICElement getCreatedClass() {
|
public ICElement getCreatedClass() {
|
||||||
|
@ -468,9 +466,6 @@ public class NewClassCodeGenerator {
|
||||||
}
|
}
|
||||||
code.append("class "); //$NON-NLS-1$
|
code.append("class "); //$NON-NLS-1$
|
||||||
code.append(fClassName);
|
code.append(fClassName);
|
||||||
if (fIsFinal) {
|
|
||||||
code.append(" final "); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
code.append(constructBaseClassInheritance());
|
code.append(constructBaseClassInheritance());
|
||||||
code.append(" {"); //$NON-NLS-1$
|
code.append(" {"); //$NON-NLS-1$
|
||||||
code.append(lineDelimiter);
|
code.append(lineDelimiter);
|
||||||
|
|
|
@ -30,7 +30,6 @@ public final class NewClassWizardMessages extends NLS {
|
||||||
public static String NewClassCreationWizardPage_warning_NotACProject;
|
public static String NewClassCreationWizardPage_warning_NotACProject;
|
||||||
public static String NewClassCreationWizardPage_warning_NotInACProject;
|
public static String NewClassCreationWizardPage_warning_NotInACProject;
|
||||||
public static String NewClassCreationWizardPage_namespace_label;
|
public static String NewClassCreationWizardPage_namespace_label;
|
||||||
public static String NewClassCreationWizardPage_final_label;
|
|
||||||
public static String NewClassCreationWizardPage_namespace_button;
|
public static String NewClassCreationWizardPage_namespace_button;
|
||||||
public static String NewClassCreationWizardPage_error_EnterNamespace;
|
public static String NewClassCreationWizardPage_error_EnterNamespace;
|
||||||
public static String NewClassCreationWizardPage_error_NamespaceExistsDifferentCase;
|
public static String NewClassCreationWizardPage_error_NamespaceExistsDifferentCase;
|
||||||
|
|
|
@ -36,8 +36,6 @@ 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_final_label=Final class
|
|
||||||
|
|
||||||
NewClassCreationWizardPage_error_EnterNamespace=Namespace is empty.
|
NewClassCreationWizardPage_error_EnterNamespace=Namespace is empty.
|
||||||
NewClassCreationWizardPage_error_NamespaceExistsDifferentCase=Namespace with the same name exists in a different scope.
|
NewClassCreationWizardPage_error_NamespaceExistsDifferentCase=Namespace with the same name exists in a different scope.
|
||||||
NewClassCreationWizardPage_error_TypeMatchingNamespaceExists=Another type with the same name as specified namespace exists.
|
NewClassCreationWizardPage_error_TypeMatchingNamespaceExists=Another type with the same name as specified namespace exists.
|
||||||
|
|
|
@ -122,7 +122,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
private static final String KEY_STUB_SELECTED = "stubSelected"; //$NON-NLS-1$
|
private static final String KEY_STUB_SELECTED = "stubSelected"; //$NON-NLS-1$
|
||||||
private static final String KEY_STUB_VIRTUAL = "stubVirtual"; //$NON-NLS-1$
|
private static final String KEY_STUB_VIRTUAL = "stubVirtual"; //$NON-NLS-1$
|
||||||
private static final String KEY_STUB_IMPL = "stubImpl"; //$NON-NLS-1$
|
private static final String KEY_STUB_IMPL = "stubImpl"; //$NON-NLS-1$
|
||||||
private static final String KEY_FINAL_SELECTED = "finalSelected"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
// Field IDs
|
// Field IDs
|
||||||
protected static final int SOURCE_FOLDER_ID = 1;
|
protected static final int SOURCE_FOLDER_ID = 1;
|
||||||
|
@ -134,10 +133,8 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
protected static final int SOURCE_FILE_ID = 64;
|
protected static final int SOURCE_FILE_ID = 64;
|
||||||
/** @since 5.3 */
|
/** @since 5.3 */
|
||||||
protected static final int TEST_FILE_ID = 128;
|
protected static final int TEST_FILE_ID = 128;
|
||||||
/** @since 6.7*/
|
|
||||||
protected static final int FINAL_ID = 256;
|
|
||||||
protected static final int ALL_FIELDS = SOURCE_FOLDER_ID | NAMESPACE_ID | CLASS_NAME_ID | BASE_CLASSES_ID
|
protected static final int ALL_FIELDS = SOURCE_FOLDER_ID | NAMESPACE_ID | CLASS_NAME_ID | BASE_CLASSES_ID
|
||||||
| METHOD_STUBS_ID | HEADER_FILE_ID | SOURCE_FILE_ID | TEST_FILE_ID | FINAL_ID;
|
| METHOD_STUBS_ID | HEADER_FILE_ID | SOURCE_FILE_ID | TEST_FILE_ID;
|
||||||
protected int fLastFocusedField = 0;
|
protected int fLastFocusedField = 0;
|
||||||
|
|
||||||
protected StringButtonDialogField fSourceFolderDialogField;
|
protected StringButtonDialogField fSourceFolderDialogField;
|
||||||
|
@ -148,10 +145,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
protected MethodStubsListDialogField fMethodStubsDialogField;
|
protected MethodStubsListDialogField fMethodStubsDialogField;
|
||||||
protected StringButtonDialogField fHeaderFileDialogField;
|
protected StringButtonDialogField fHeaderFileDialogField;
|
||||||
protected StringButtonDialogField fSourceFileDialogField;
|
protected StringButtonDialogField fSourceFileDialogField;
|
||||||
/**
|
|
||||||
* @since 6.7
|
|
||||||
*/
|
|
||||||
protected SelectionButtonDialogField fIsFinalClassField;
|
|
||||||
/** @since 5.3 */
|
/** @since 5.3 */
|
||||||
protected StringButtonDialogField fTestFileDialogField;
|
protected StringButtonDialogField fTestFileDialogField;
|
||||||
/** @since 5.3 */
|
/** @since 5.3 */
|
||||||
|
@ -172,10 +165,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
protected IStatus fSourceFileStatus;
|
protected IStatus fSourceFileStatus;
|
||||||
/** @since 5.3 */
|
/** @since 5.3 */
|
||||||
protected IStatus fTestFileStatus;
|
protected IStatus fTestFileStatus;
|
||||||
/**
|
|
||||||
* @since 6.7
|
|
||||||
*/
|
|
||||||
protected IStatus fIsFinalStatus;
|
|
||||||
protected final IStatus STATUS_OK = new StatusInfo();
|
protected final IStatus STATUS_OK = new StatusInfo();
|
||||||
|
|
||||||
protected IFile fCreatedHeaderFile;
|
protected IFile fCreatedHeaderFile;
|
||||||
|
@ -227,11 +216,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
fMethodStubsDialogField = new MethodStubsListDialogField(
|
fMethodStubsDialogField = new MethodStubsListDialogField(
|
||||||
NewClassWizardMessages.NewClassCreationWizardPage_methodStubs_label, methodStubsAdapter);
|
NewClassWizardMessages.NewClassCreationWizardPage_methodStubs_label, methodStubsAdapter);
|
||||||
|
|
||||||
FinalFieldAdapter finalAdapter = new FinalFieldAdapter();
|
|
||||||
fIsFinalClassField = new SelectionButtonDialogField(SWT.CHECK);
|
|
||||||
fIsFinalClassField.setDialogFieldListener(finalAdapter);
|
|
||||||
fIsFinalClassField.setLabelText(NewClassWizardMessages.NewClassCreationWizardPage_final_label);
|
|
||||||
|
|
||||||
FileGroupFieldAdapter fileGroupAdapter = new FileGroupFieldAdapter();
|
FileGroupFieldAdapter fileGroupAdapter = new FileGroupFieldAdapter();
|
||||||
fHeaderFileDialogField = new StringButtonDialogField(fileGroupAdapter);
|
fHeaderFileDialogField = new StringButtonDialogField(fileGroupAdapter);
|
||||||
fHeaderFileDialogField.setDialogFieldListener(fileGroupAdapter);
|
fHeaderFileDialogField.setDialogFieldListener(fileGroupAdapter);
|
||||||
|
@ -260,7 +244,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
fHeaderFileStatus = STATUS_OK;
|
fHeaderFileStatus = STATUS_OK;
|
||||||
fSourceFileStatus = STATUS_OK;
|
fSourceFileStatus = STATUS_OK;
|
||||||
fTestFileStatus = STATUS_OK;
|
fTestFileStatus = STATUS_OK;
|
||||||
fIsFinalStatus = STATUS_OK;
|
|
||||||
fLastFocusedField = 0;
|
fLastFocusedField = 0;
|
||||||
|
|
||||||
isFirstTime = true;
|
isFirstTime = true;
|
||||||
|
@ -292,7 +275,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
createClassNameControls(composite, nColumns);
|
createClassNameControls(composite, nColumns);
|
||||||
createBaseClassesControls(composite, nColumns);
|
createBaseClassesControls(composite, nColumns);
|
||||||
createMethodStubsControls(composite, nColumns);
|
createMethodStubsControls(composite, nColumns);
|
||||||
createFinalClassControls(composite, nColumns);
|
|
||||||
|
|
||||||
createSeparator(composite, nColumns);
|
createSeparator(composite, nColumns);
|
||||||
|
|
||||||
|
@ -377,16 +359,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
textControl.addFocusListener(new StatusFocusListener(CLASS_NAME_ID));
|
textControl.addFocusListener(new StatusFocusListener(CLASS_NAME_ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the controls for the final class field.
|
|
||||||
*
|
|
||||||
* @param composite the parent composite
|
|
||||||
* @since 6.7
|
|
||||||
*/
|
|
||||||
protected void createFinalClassControls(Composite composite, int nColumns) {
|
|
||||||
fIsFinalClassField.doFillIntoGrid(composite, nColumns - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the controls for the base classes field. Expects a <code>GridLayout</code> with
|
* Creates the controls for the base classes field. Expects a <code>GridLayout</code> with
|
||||||
* at least 3 columns.
|
* at least 3 columns.
|
||||||
|
@ -527,7 +499,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
addMethodStub(stub, getBooleanSettingWithDefault(KEY_STUB_SELECTED + i, stub.isEnabledByDefault()));
|
addMethodStub(stub, getBooleanSettingWithDefault(KEY_STUB_SELECTED + i, stub.isEnabledByDefault()));
|
||||||
}
|
}
|
||||||
|
|
||||||
fIsFinalClassField.setSelection(fDialogSettings.getBoolean(KEY_FINAL_SELECTED));
|
|
||||||
setTestFileSelection(fDialogSettings.getBoolean(KEY_TEST_FILE_SELECTED), true);
|
setTestFileSelection(fDialogSettings.getBoolean(KEY_TEST_FILE_SELECTED), true);
|
||||||
handleFieldChanged(ALL_FIELDS);
|
handleFieldChanged(ALL_FIELDS);
|
||||||
}
|
}
|
||||||
|
@ -745,16 +716,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
return fClassNameDialogField.getText().trim();
|
return fClassNameDialogField.getText().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the class is final
|
|
||||||
*
|
|
||||||
* @return true if final, false otherwise
|
|
||||||
* @since 6.7
|
|
||||||
*/
|
|
||||||
public boolean isFinalClass() {
|
|
||||||
return fIsFinalClassField.isSelected();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the text of the class name input field.
|
* Sets the text of the class name input field.
|
||||||
*
|
*
|
||||||
|
@ -1124,21 +1085,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* handles changes to the final field
|
|
||||||
*/
|
|
||||||
private final class FinalFieldAdapter implements IStringButtonAdapter, IDialogFieldListener {
|
|
||||||
@Override
|
|
||||||
public void changeControlPressed(DialogField field) {
|
|
||||||
handleFieldChanged(FINAL_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dialogFieldChanged(DialogField field) {
|
|
||||||
handleFieldChanged(FINAL_ID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* handles changes to the namespace field
|
* handles changes to the namespace field
|
||||||
*/
|
*/
|
||||||
|
@ -1525,9 +1471,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
if (fieldChanged(fields, TEST_FILE_ID)) {
|
if (fieldChanged(fields, TEST_FILE_ID)) {
|
||||||
fTestFileStatus = testFileChanged();
|
fTestFileStatus = testFileChanged();
|
||||||
}
|
}
|
||||||
if (fieldChanged(fields, FINAL_ID)) {
|
|
||||||
fIsFinalStatus = finalChanged();
|
|
||||||
}
|
|
||||||
doStatusUpdate();
|
doStatusUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1560,8 +1503,7 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
(fMethodStubsStatus != lastStatus) ? fMethodStubsStatus : STATUS_OK,
|
(fMethodStubsStatus != lastStatus) ? fMethodStubsStatus : STATUS_OK,
|
||||||
(fHeaderFileStatus != lastStatus) ? fHeaderFileStatus : STATUS_OK,
|
(fHeaderFileStatus != lastStatus) ? fHeaderFileStatus : STATUS_OK,
|
||||||
(fSourceFileStatus != lastStatus) ? fSourceFileStatus : STATUS_OK,
|
(fSourceFileStatus != lastStatus) ? fSourceFileStatus : STATUS_OK,
|
||||||
(fTestFileStatus != lastStatus) ? fTestFileStatus : STATUS_OK,
|
(fTestFileStatus != lastStatus) ? fTestFileStatus : STATUS_OK, };
|
||||||
(fIsFinalStatus != lastStatus) ? fIsFinalStatus : STATUS_OK, };
|
|
||||||
|
|
||||||
// the mode severe status will be displayed and the ok button enabled/disabled.
|
// the mode severe status will be displayed and the ok button enabled/disabled.
|
||||||
updateStatus(status);
|
updateStatus(status);
|
||||||
|
@ -1590,8 +1532,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
return fSourceFileStatus;
|
return fSourceFileStatus;
|
||||||
case TEST_FILE_ID:
|
case TEST_FILE_ID:
|
||||||
return fTestFileStatus;
|
return fTestFileStatus;
|
||||||
case FINAL_ID:
|
|
||||||
return fIsFinalStatus;
|
|
||||||
default:
|
default:
|
||||||
return STATUS_OK;
|
return STATUS_OK;
|
||||||
}
|
}
|
||||||
|
@ -1786,15 +1726,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Final class field changed
|
|
||||||
* @return the status of the validation
|
|
||||||
* @since 6.7
|
|
||||||
*/
|
|
||||||
protected IStatus finalChanged() {
|
|
||||||
return Status.OK_STATUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook method that gets called when the list of base classes has changed. The method
|
* Hook method that gets called when the list of base classes has changed. The method
|
||||||
* validates the base classes and returns the status of the validation.
|
* validates the base classes and returns the status of the validation.
|
||||||
|
@ -2149,7 +2080,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
// Update dialog settings.
|
// Update dialog settings.
|
||||||
fDialogSettings.put(KEY_NAMESPACE_SELECTED, fNamespaceSelection.isSelected());
|
fDialogSettings.put(KEY_NAMESPACE_SELECTED, fNamespaceSelection.isSelected());
|
||||||
fDialogSettings.put(KEY_TEST_FILE_SELECTED, fTestFileSelection.isSelected());
|
fDialogSettings.put(KEY_TEST_FILE_SELECTED, fTestFileSelection.isSelected());
|
||||||
fDialogSettings.put(KEY_FINAL_SELECTED, fIsFinalClassField.isSelected());
|
|
||||||
String namespace = fNamespaceSelection.isSelected() ? getNamespaceText() : null;
|
String namespace = fNamespaceSelection.isSelected() ? getNamespaceText() : null;
|
||||||
fDialogSettings.put(KEY_NAMESPACE, namespace);
|
fDialogSettings.put(KEY_NAMESPACE, namespace);
|
||||||
IMethodStub[] stubs = fMethodStubsDialogField.getMethodStubs();
|
IMethodStub[] stubs = fMethodStubsDialogField.getMethodStubs();
|
||||||
|
@ -2173,7 +2103,7 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
IPath sourcePath = getSourceFileFullPath();
|
IPath sourcePath = getSourceFileFullPath();
|
||||||
IPath testPath = getTestFileFullPath();
|
IPath testPath = getTestFileFullPath();
|
||||||
createClass(headerPath, sourcePath, testPath, getClassName(), namespace, getBaseClasses(),
|
createClass(headerPath, sourcePath, testPath, getClassName(), namespace, getBaseClasses(),
|
||||||
getSelectedMethodStubs(), isFinalClass(), monitor);
|
getSelectedMethodStubs(), monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2205,10 +2135,9 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
* @nooverride This method is not intended to be re-implemented or extended by clients.
|
* @nooverride This method is not intended to be re-implemented or extended by clients.
|
||||||
*/
|
*/
|
||||||
protected void createClass(IPath headerPath, IPath sourcePath, IPath testPath, String className, String namespace,
|
protected void createClass(IPath headerPath, IPath sourcePath, IPath testPath, String className, String namespace,
|
||||||
IBaseClassInfo[] baseClasses, IMethodStub[] methodStubs, boolean isFinal, IProgressMonitor monitor)
|
IBaseClassInfo[] baseClasses, IMethodStub[] methodStubs, IProgressMonitor monitor) throws CoreException {
|
||||||
throws CoreException {
|
|
||||||
NewClassCodeGenerator generator = new NewClassCodeGenerator(headerPath, sourcePath, testPath, className,
|
NewClassCodeGenerator generator = new NewClassCodeGenerator(headerPath, sourcePath, testPath, className,
|
||||||
namespace, baseClasses, methodStubs, isFinal);
|
namespace, baseClasses, methodStubs);
|
||||||
generator.setForceSourceFileCreation(true);
|
generator.setForceSourceFileCreation(true);
|
||||||
generator.createClass(monitor);
|
generator.createClass(monitor);
|
||||||
|
|
||||||
|
@ -2227,15 +2156,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
createClass(headerPath, sourcePath, null, className, namespace, baseClasses, methodStubs, monitor);
|
createClass(headerPath, sourcePath, null, className, namespace, baseClasses, methodStubs, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @noreference This method is not intended to be referenced by clients.
|
|
||||||
* @nooverride This method is not intended to be re-implemented or extended by clients.
|
|
||||||
*/
|
|
||||||
protected void createClass(IPath headerPath, IPath sourcePath, IPath testPath, String className, String namespace,
|
|
||||||
IBaseClassInfo[] baseClasses, IMethodStub[] methodStubs, IProgressMonitor monitor) throws CoreException {
|
|
||||||
createClass(headerPath, sourcePath, null, className, namespace, baseClasses, methodStubs, false, monitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the created class. The method only returns a valid class
|
* Returns the created class. The method only returns a valid class
|
||||||
* after {@link #createClass} has been called.
|
* after {@link #createClass} has been called.
|
||||||
|
|
Loading…
Add table
Reference in a new issue