1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug Fixing

This commit is contained in:
Hoda Amer 2004-07-09 18:33:22 +00:00
parent 1030a3afa9
commit 745dce1341
3 changed files with 23 additions and 3 deletions

View file

@ -1,3 +1,6 @@
2004-07-09 Hoda Amer
Fix for PR 69510 : [C++ Class Wizard] error message in C++ Class Wizard if invoke Class Wizard from existing C++ class in C/C++ Project View
2004-07-09 Alain Magloire 2004-07-09 Alain Magloire
Pr reported by Alex C. Pr reported by Alex C.
Follow the other views lead and for multiple selection Follow the other views lead and for multiple selection

View file

@ -179,6 +179,8 @@ NewClassWizardPage.warning.BaseClassNotExists=Warning: Base class does not exist
NewClassWizardPage.operations.getProjectClasses=Looking for classes in project NewClassWizardPage.operations.getProjectClasses=Looking for classes in project
NewClassWizardPage.error.NotAvailableForNonCppProjects= The wizard is not available for non C++ projects. NewClassWizardPage.error.NotAvailableForNonCppProjects= The wizard is not available for non C++ projects.
NewClassWizardPage.error.SelectedProjectError=Error in determining the selected project.
NewClassWizardPage.error.DefaultSourceFolderError=Error in determining the default source folder.
NewClassWizardPage.getProjectClasses.exception.title=Exception NewClassWizardPage.getProjectClasses.exception.title=Exception
NewClassWizardPage.getProjectClasses.exception.message=Unexpected exception. See log for details. NewClassWizardPage.getProjectClasses.exception.message=Unexpected exception. See log for details.

View file

@ -213,7 +213,13 @@ public class NewClassWizardPage extends WizardPage implements Listener {
eSelection = null; eSelection = null;
defaultSourceFolder = null; defaultSourceFolder = null;
StatusInfo status = new StatusInfo(); StatusInfo status = new StatusInfo();
status.setError(NewWizardMessages.getString("NewClassWizardPage.error.NotAvailableForNonCppProjects")); //$NON-NLS-1$ if(!hasCppNature){
status.setError(NewWizardMessages.getString("NewClassWizardPage.error.NotAvailableForNonCppProjects")); //$NON-NLS-1$
}else if (fSelectedProject == null){
status.setError(NewWizardMessages.getString("NewClassWizardPage.error.SelectedProjectError")); //$NON-NLS-1$
} else {
status.setError(NewWizardMessages.getString("NewClassWizardPage.error.DefaultSourceFolderError")); //$NON-NLS-1$
}
updateStatus(status); updateStatus(status);
} }
} }
@ -497,7 +503,11 @@ public class NewClassWizardPage extends WizardPage implements Listener {
Object selectedElement= selection.getFirstElement(); Object selectedElement= selection.getFirstElement();
if (selectedElement instanceof IAdaptable) { if (selectedElement instanceof IAdaptable) {
IAdaptable adaptable= (IAdaptable) selectedElement; IAdaptable adaptable= (IAdaptable) selectedElement;
resource= (IResource) adaptable.getAdapter(IResource.class); if(adaptable instanceof ICElement){
resource = ((ICElement)adaptable).getUnderlyingResource();
}else {
resource= (IResource) adaptable.getAdapter(IResource.class);
}
if (resource != null && resource instanceof IFile) if (resource != null && resource instanceof IFile)
resource= resource.getParent(); resource= resource.getParent();
} }
@ -510,7 +520,12 @@ public class NewClassWizardPage extends WizardPage implements Listener {
Object selectedElement= selection.getFirstElement(); Object selectedElement= selection.getFirstElement();
if (selectedElement instanceof IAdaptable) { if (selectedElement instanceof IAdaptable) {
IAdaptable adaptable= (IAdaptable) selectedElement; IAdaptable adaptable= (IAdaptable) selectedElement;
IResource resource= (IResource) adaptable.getAdapter(IResource.class); IResource resource = null;
if(adaptable instanceof ICElement){
resource = ((ICElement)adaptable).getUnderlyingResource();
}else {
resource= (IResource) adaptable.getAdapter(IResource.class);
}
if (resource != null) { if (resource != null) {
return resource.getProject(); return resource.getProject();
} }