# HG changeset patch # User john.dean.3@nokia.com # Date 1257532753 21600 # Node ID ee4c4ca487169068aafaed990bc1d29161a01c3e # Parent 019adf6accac6136acbb60695483eec4bcff9965 Removed/added refactored class name which was missing in last commit diff -r 019adf6accac -r ee4c4ca48716 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchCreationWizardFactory.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchCreationWizardFactory.java Fri Nov 06 12:28:33 2009 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -package com.nokia.cdt.internal.debug.launch.wizard; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; - -/** - * Created for purposes of dependency injection on the LaunchCreationWizard. - * This factory allows for other factories to be substituted at runtime, for - * purposes of injecting at runtime LaunchCreationWizard sub-classes created by - * the ATF - * - */ -public class LaunchCreationWizardFactory { - - // This is an abstract factory which maintains here the actual factory - ILaunchCreationWizardFactory factory; - - private LaunchCreationWizardFactory() { - setDefault(); - } - - /** - * Returns the LaunchCreationWizard generated by the factory. - */ - public LaunchCreationWizard get(IProject project, String configurationName, - List mmps, List exes, IPath defaultExecutable, - boolean isEmulation, boolean emulatorOnly, String mode) throws Exception { - return factory.get(project, configurationName, mmps, exes, defaultExecutable, isEmulation, emulatorOnly, mode); - } - - /** - * Sets the factory to the default product implementation. Used by the default initializer and to clear a dependency previously set - */ - public void setDefault() { - set(new ILaunchCreationWizardFactory() { - - public LaunchCreationWizard get(IProject project, String configurationName, - List mmps, List exes, IPath defaultExecutable, - boolean isEmulation, boolean emulatorOnly, String mode) - throws Exception { - return new LaunchCreationWizard(project, configurationName, mmps, exes, defaultExecutable, isEmulation, emulatorOnly, mode); - - } - }); - } - - /** - * Intended to be used by tests to inject a custom factory - */ - public void set(ILaunchCreationWizardFactory factory) { - this.factory = factory; - } - - static private LaunchCreationWizardFactory abstractFactory = null; - - /** - * Returns the singleton - * @return - */ - public static LaunchCreationWizardFactory getInstance() { - if (abstractFactory == null) { - abstractFactory = new LaunchCreationWizardFactory(); - } - return abstractFactory; - } -} diff -r 019adf6accac -r ee4c4ca48716 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchCreationWizardInstance.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchCreationWizardInstance.java Fri Nov 06 12:39:13 2009 -0600 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +package com.nokia.cdt.internal.debug.launch.wizard; + +import java.util.List; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IPath; + +/** + * Created for purposes of dependency injection on the LaunchCreationWizard. + * This instance allows for other factories to be substituted at runtime, for + * purposes of injecting at runtime LaunchCreationWizard sub-classes created by + * the automated tests + * + */ +public class LaunchCreationWizardInstance { + + // The delegate factory + ILaunchCreationWizardFactory factory; + + static private LaunchCreationWizardInstance instance = null; + + /** + * Returns the singleton + * @return + */ + public static LaunchCreationWizardInstance getInstance() { + if (instance == null) { + instance = new LaunchCreationWizardInstance(); + } + return instance; + } + + private LaunchCreationWizardInstance() { + setDefault(); + } + + /** + * Returns the LaunchCreationWizard generated by the factory. + */ + public LaunchCreationWizard create(IProject project, String configurationName, + List mmps, List exes, IPath defaultExecutable, + boolean isEmulation, boolean emulatorOnly, String mode) throws Exception { + return factory.create(project, configurationName, mmps, exes, defaultExecutable, isEmulation, emulatorOnly, mode); + } + + /** + * Sets the factory to the default product implementation. Used by the default initializer and to clear a dependency previously set + */ + public void setDefault() { + set(new ILaunchCreationWizardFactory() { + + public LaunchCreationWizard create(IProject project, String configurationName, + List mmps, List exes, IPath defaultExecutable, + boolean isEmulation, boolean emulatorOnly, String mode) + throws Exception { + return new LaunchCreationWizard(project, configurationName, mmps, exes, defaultExecutable, isEmulation, emulatorOnly, mode); + + } + }); + } + + /** + * Intended to be used by tests to inject a custom factory + */ + public void set(ILaunchCreationWizardFactory factory) { + this.factory = factory; + } +}