/** * Copyright (c) 2005, 2010 IBM Corporation 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 * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation */ package org.eclipse.wst.xquery.debug.core; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.dltk.core.DLTKPriorityContributionSelector; import org.eclipse.dltk.core.IDLTKContributedExtension; /** * Debug engine selector based on which debugging engine the user has selected in the preference * page * * @author Lionel Villard */ public class XQDTDebugEngineSelector extends DLTKPriorityContributionSelector { // Constructors public XQDTDebugEngineSelector() { } // Overrides @Override public IDLTKContributedExtension select(IDLTKContributedExtension[] contributions, IProject project) { if (contributions != null) { IEclipsePreferences preferences = (new InstanceScope()).getNode(XQDTDebugCorePlugin.PLUGIN_ID); if (preferences != null) { String debugEngineID = preferences.get(XQDTDebugConstants.DEBUGGING_ENGINE_ID_KEY, null); if (debugEngineID != null) { for (int i = 0; i < contributions.length; i++) { if (contributions[i].getId().equals(debugEngineID)) { return contributions[i]; } } } } } // Fallback return super.select(contributions, project); } }