mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-16 04:35:45 +02:00
Bug 250665 - New Source/Header wizard page: "Finish" button is enabled for empty file names
This commit is contained in:
parent
db8d239e76
commit
2dd772835a
2 changed files with 21 additions and 22 deletions
|
@ -100,7 +100,7 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
||||||
* that the file creation wizard has just been
|
* that the file creation wizard has just been
|
||||||
* created.
|
* created.
|
||||||
*/
|
*/
|
||||||
private boolean isFirstTime = false;
|
private boolean isFirstTime = true;
|
||||||
|
|
||||||
private Template[] fTemplates;
|
private Template[] fTemplates;
|
||||||
|
|
||||||
|
@ -128,9 +128,6 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
||||||
fSourceFolderStatus = STATUS_OK;
|
fSourceFolderStatus = STATUS_OK;
|
||||||
fNewFileStatus = STATUS_OK;
|
fNewFileStatus = STATUS_OK;
|
||||||
fLastFocusedField = 0;
|
fLastFocusedField = 0;
|
||||||
|
|
||||||
isFirstTime = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------- UI Creation ---------
|
// -------- UI Creation ---------
|
||||||
|
@ -458,7 +455,11 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
||||||
|
|
||||||
public void focusGained(FocusEvent e) {
|
public void focusGained(FocusEvent e) {
|
||||||
fLastFocusedField = this.fieldID;
|
fLastFocusedField = this.fieldID;
|
||||||
doStatusUpdate();
|
if (isFirstTime) {
|
||||||
|
isFirstTime = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
doStatusUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void focusLost(FocusEvent e) {
|
public void focusLost(FocusEvent e) {
|
||||||
|
@ -547,10 +548,6 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
||||||
fSourceFolderStatus = sourceFolderChanged();
|
fSourceFolderStatus = sourceFolderChanged();
|
||||||
}
|
}
|
||||||
if (fieldChanged(fields, NEW_FILE_ID)) {
|
if (fieldChanged(fields, NEW_FILE_ID)) {
|
||||||
if( isFirstTime ){
|
|
||||||
isFirstTime = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fNewFileStatus = fileNameChanged();
|
fNewFileStatus = fileNameChanged();
|
||||||
}
|
}
|
||||||
doStatusUpdate();
|
doStatusUpdate();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2007 QNX Software Systems and others.
|
* Copyright (c) 2004, 2008 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -911,6 +911,10 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
public void focusGained(FocusEvent e) {
|
public void focusGained(FocusEvent e) {
|
||||||
if (fLastFocusedField != this.fieldID) {
|
if (fLastFocusedField != this.fieldID) {
|
||||||
fLastFocusedField = this.fieldID;
|
fLastFocusedField = this.fieldID;
|
||||||
|
if( isFirstTime ) {
|
||||||
|
isFirstTime = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
doStatusUpdate();
|
doStatusUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1340,10 +1344,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
fNamespaceStatus = namespaceChanged();
|
fNamespaceStatus = namespaceChanged();
|
||||||
}
|
}
|
||||||
if (fieldChanged(fields, CLASS_NAME_ID)) {
|
if (fieldChanged(fields, CLASS_NAME_ID)) {
|
||||||
if( isFirstTime ) {
|
|
||||||
isFirstTime = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fClassNameStatus = classNameChanged();
|
fClassNameStatus = classNameChanged();
|
||||||
}
|
}
|
||||||
if (fieldChanged(fields, BASE_CLASSES_ID)) {
|
if (fieldChanged(fields, BASE_CLASSES_ID)) {
|
||||||
|
@ -1374,21 +1374,23 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
||||||
// do the last focused field first
|
// do the last focused field first
|
||||||
IStatus lastStatus = getLastFocusedStatus();
|
IStatus lastStatus = getLastFocusedStatus();
|
||||||
|
|
||||||
|
final boolean isClassNameWarning = fClassNameStatus.getSeverity() == IStatus.WARNING;
|
||||||
// status of all used components
|
// status of all used components
|
||||||
IStatus[] status = new IStatus[] {
|
IStatus[] status = new IStatus[] {
|
||||||
// give priority to file-level warnings over
|
|
||||||
// class name warnings
|
|
||||||
(fHeaderFileStatus != lastStatus && fClassNameStatus == lastStatus) ? fHeaderFileStatus : STATUS_OK,
|
|
||||||
(fSourceFileStatus != lastStatus && fClassNameStatus == lastStatus) ? fSourceFileStatus : STATUS_OK,
|
|
||||||
|
|
||||||
lastStatus,
|
lastStatus,
|
||||||
(fSourceFolderStatus != lastStatus) ? fSourceFolderStatus : STATUS_OK,
|
(fSourceFolderStatus != lastStatus) ? fSourceFolderStatus : STATUS_OK,
|
||||||
(fHeaderFileStatus != lastStatus) ? fHeaderFileStatus : STATUS_OK,
|
|
||||||
(fSourceFileStatus != lastStatus) ? fSourceFileStatus : STATUS_OK,
|
|
||||||
(fNamespaceStatus != lastStatus) ? fNamespaceStatus : STATUS_OK,
|
(fNamespaceStatus != lastStatus) ? fNamespaceStatus : STATUS_OK,
|
||||||
|
|
||||||
|
// give priority to file-level warnings over
|
||||||
|
// class name warnings
|
||||||
|
(fHeaderFileStatus != lastStatus && isClassNameWarning) ? fHeaderFileStatus : STATUS_OK,
|
||||||
|
(fSourceFileStatus != lastStatus && isClassNameWarning) ? fSourceFileStatus : STATUS_OK,
|
||||||
|
|
||||||
(fClassNameStatus != lastStatus) ? fClassNameStatus : STATUS_OK,
|
(fClassNameStatus != lastStatus) ? fClassNameStatus : STATUS_OK,
|
||||||
(fBaseClassesStatus != lastStatus) ? fBaseClassesStatus : STATUS_OK,
|
(fBaseClassesStatus != lastStatus) ? fBaseClassesStatus : STATUS_OK,
|
||||||
(fMethodStubsStatus != lastStatus) ? fMethodStubsStatus : STATUS_OK,
|
(fMethodStubsStatus != lastStatus) ? fMethodStubsStatus : STATUS_OK,
|
||||||
|
(fSourceFileStatus != lastStatus) ? fSourceFileStatus : STATUS_OK,
|
||||||
|
(fHeaderFileStatus != lastStatus) ? fHeaderFileStatus : 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.
|
||||||
|
|
Loading…
Add table
Reference in a new issue