1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

Use instanceof to match the builtin wizard pages to allow for easier extensions

This commit is contained in:
Leo Treggiari 2005-01-28 03:32:24 +00:00
parent a37e05f7ec
commit 60b9d81d50
2 changed files with 26 additions and 17 deletions

View file

@ -1,5 +1,5 @@
/********************************************************************** /**********************************************************************
* Copyright (c) 2002,2004 IBM Corporation and others. * Copyright (c) 2002,2005 IBM Corporation 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 Common Public License v0.5 * are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -72,10 +72,12 @@ public class NewManagedProjectOptionPage extends NewCProjectWizardOptionPage {
ICOptionPage page = (ICOptionPage) iter.next(); ICOptionPage page = (ICOptionPage) iter.next();
String id = null; String id = null;
switch( i ){ if (page instanceof ReferenceBlock) {
case 0 : id = ManagedBuilderHelpContextIds.MAN_PROJ_WIZ_PROJECTS_TAB; break; id = ManagedBuilderHelpContextIds.MAN_PROJ_WIZ_PROJECTS_TAB;
case 1 : id = ManagedBuilderHelpContextIds.MAN_PROJ_WIZ_ERRORPARSERS_TAB; break; } else if (page instanceof ErrorParserBlock) {
case 2 : id = ManagedBuilderHelpContextIds.MAN_PROJ_WIZ_INDEXER_TAB; break; id = ManagedBuilderHelpContextIds.MAN_PROJ_WIZ_ERRORPARSERS_TAB;
} else if (page instanceof IndexerBlock) {
id = ManagedBuilderHelpContextIds.MAN_PROJ_WIZ_INDEXER_TAB;
} }
WorkbenchHelp.setHelp(page.getControl(), id); WorkbenchHelp.setHelp(page.getControl(), id);

View file

@ -1,5 +1,5 @@
/********************************************************************** /**********************************************************************
* Copyright (c) 2002,2004 IBM Corporation and others. * Copyright (c) 2002,2005 IBM Corporation 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 Common Public License v0.5 * are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,19 +13,20 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor; import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.managedbuilder.core.BuildException; import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IToolChain; import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform; import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature; import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderHelpContextIds; import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderHelpContextIds;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages; import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin; import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.ui.wizards.NewCProjectWizard; import org.eclipse.cdt.ui.wizards.NewCProjectWizard;
import org.eclipse.cdt.ui.wizards.NewCProjectWizardPage;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
@ -89,15 +90,21 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
IWizardPage [] pages = getPages(); IWizardPage [] pages = getPages();
if( pages != null && pages.length == 3 ){ if (pages != null) {
WorkbenchHelp.setHelp(pages[0].getControl(), ManagedBuilderHelpContextIds.MAN_PROJ_WIZ_NAME_PAGE); for (int i = 0; i < pages.length; i++) {
IWizardPage page = pages[i];
//pages[1] is the CProjectPlatformPage which already has a help id. if (page instanceof NewCProjectWizardPage) {
WorkbenchHelp.setHelp(page.getControl(), ManagedBuilderHelpContextIds.MAN_PROJ_WIZ_NAME_PAGE);
NewManagedProjectOptionPage optionPage = (NewManagedProjectOptionPage) pages[2]; }
else if (page instanceof NewManagedProjectOptionPage) {
NewManagedProjectOptionPage optionPage = (NewManagedProjectOptionPage) page;
optionPage.setupHelpContextIds(); optionPage.setupHelpContextIds();
} }
// The other built-in page is the CProjectPlatformPage which already has a help id.
} }
}
}
public void updateProjectTypeProperties() { public void updateProjectTypeProperties() {
// Update the error parser list // Update the error parser list
optionPage.updateProjectTypeProperties(); optionPage.updateProjectTypeProperties();