From dc8208f6603c54a58b38406f6a84bed9d0c2d7e0 Mon Sep 17 00:00:00 2001 From: Vivian Kong Date: Tue, 27 Mar 2007 16:49:44 +0000 Subject: [PATCH] Patch for bug 178305 by Ravi Sankar --- .../AbstractFileCreationWizardPage.java | 19 +++++++++++++++++-- .../wizards/NewClassCreationWizardPage.java | 18 +++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/filewizard/AbstractFileCreationWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/filewizard/AbstractFileCreationWizardPage.java index b1a3d10caa6..256eeee4b7f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/filewizard/AbstractFileCreationWizardPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/filewizard/AbstractFileCreationWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2007 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 @@ -7,6 +7,7 @@ * * Contributors: * QNX Software Systems - initial API and implementation + * IBM Corporation *******************************************************************************/ package org.eclipse.cdt.internal.ui.wizards.filewizard; @@ -78,6 +79,13 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag private IStatus fNewFileStatus; private final IStatus STATUS_OK = new StatusInfo(); + /** + * This flag isFirstTime is used to keep a note + * that the file creation wizard has just been + * created. + */ + private boolean isFirstTime = false; + public AbstractFileCreationWizardPage(String name) { super(name); @@ -94,6 +102,9 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag fSourceFolderStatus = STATUS_OK; fNewFileStatus = STATUS_OK; fLastFocusedField = 0; + + isFirstTime = true; + } // -------- UI Creation --------- @@ -415,7 +426,11 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag fSourceFolderStatus = sourceFolderChanged(); } if (fieldChanged(fields, NEW_FILE_ID)) { - fNewFileStatus = fileNameChanged(); + if( isFirstTime ){ + isFirstTime = false; + return; + } + fNewFileStatus = fileNameChanged(); } doStatusUpdate(); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewClassCreationWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewClassCreationWizardPage.java index d841c11751b..888dff1467f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewClassCreationWizardPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewClassCreationWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2007 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 @@ -138,7 +138,13 @@ public class NewClassCreationWizardPage extends NewElementWizardPage { protected IFile fCreatedSourceFile = null; protected IFile fCreatedHeaderFile = null; protected ICElement fCreatedClass = null; - + + /** + * This flag isFirstTime is used to keep a note + * that the class creation wizard has just been + * created. + */ + private boolean isFirstTime = false; /** * the default method stubs */ @@ -203,7 +209,9 @@ public class NewClassCreationWizardPage extends NewElementWizardPage { fHeaderFileStatus = STATUS_OK; fSourceFileStatus = STATUS_OK; fLastFocusedField = 0; - + + isFirstTime = true; + updateNamespaceEnableState(); updateFileGroupEnableState(); } @@ -1335,6 +1343,10 @@ public class NewClassCreationWizardPage extends NewElementWizardPage { fNamespaceStatus = namespaceChanged(); } if (fieldChanged(fields, CLASS_NAME_ID)) { + if( isFirstTime ) { + isFirstTime = false; + return; + } fClassNameStatus = classNameChanged(); } if (fieldChanged(fields, BASE_CLASSES_ID)) {