1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 16:56:04 +02:00

Bug 561770 - Rework API new class creation wizard page

Change-Id: Id8d83e05b8bc2665bf20fc804f0511ca8acd3126
This commit is contained in:
Marco Stornelli 2020-04-09 14:37:02 +02:00
parent 2a0bc541f0
commit ab1c2b0889

View file

@ -136,8 +136,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
protected static final int TEST_FILE_ID = 128;
/** @since 7.0*/
protected static final int FINAL_ID = 256;
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;
protected int fLastFocusedField = 0;
protected StringButtonDialogField fSourceFolderDialogField;
@ -268,9 +266,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
// -------- UI Creation ---------
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
@ -529,7 +524,7 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
fIsFinalClassField.setSelection(fDialogSettings.getBoolean(KEY_FINAL_SELECTED));
setTestFileSelection(fDialogSettings.getBoolean(KEY_TEST_FILE_SELECTED), true);
handleFieldChanged(ALL_FIELDS);
handleFieldsChanged();
}
private boolean getBooleanSettingWithDefault(String key, boolean defaultValue) {
@ -1085,13 +1080,13 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
IPath newFolderPath = chooseSourceFolder(oldFolderPath);
if (newFolderPath != null) {
setSourceFolderFullPath(newFolderPath, false);
handleFieldChanged(SOURCE_FOLDER_ID | ALL_FIELDS);
handleFieldsChanged();
}
}
@Override
public void dialogFieldChanged(DialogField field) {
handleFieldChanged(SOURCE_FOLDER_ID | ALL_FIELDS);
handleFieldsChanged();
}
}
@ -1531,6 +1526,23 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
doStatusUpdate();
}
/**
* Hook method that gets called when all fields on this page have changed.
* @since 7.0
*/
protected void handleFieldsChanged() {
fSourceFolderStatus = sourceFolderChanged();
fNamespaceStatus = namespaceChanged();
fClassNameStatus = classNameChanged();
fBaseClassesStatus = baseClassesChanged();
fMethodStubsStatus = methodStubsChanged();
fHeaderFileStatus = headerFileChanged();
fSourceFileStatus = sourceFileChanged();
fTestFileStatus = testFileChanged();
fIsFinalStatus = finalChanged();
doStatusUpdate();
}
private boolean fieldChanged(int fields, int fieldID) {
return ((fields & fieldID) != 0);
}