diff options
5 files changed, 43 insertions, 16 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java index c8e9bd83922..6b87ed66501 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java @@ -35,8 +35,6 @@ import org.eclipse.core.runtime.Platform; */ public class CommandLauncherManager { - public final static String CONTAINER_BUILD_ENABLED = "container.build.enabled"; //$NON-NLS-1$ - private static CommandLauncherManager instance; private List<ICommandLauncherFactory> factories = new ArrayList<>(); @@ -195,6 +193,7 @@ public class CommandLauncherManager { * * @param config - ICBuildConfiguration to determine launcher for. * @return an ICommandLauncher for running commands + * @since 6.5 */ public ICommandLauncher getCommandLauncher(ICBuildConfiguration config) { // loop through list of factories and return launcher returned with @@ -202,10 +201,12 @@ public class CommandLauncherManager { int highestPriority = -1; ICommandLauncher bestLauncher = null; for (ICommandLauncherFactory factory : factories) { - ICommandLauncher launcher = factory.getCommandLauncher(config); - if (launcher != null) { - if (priorityMapping.get(factory) > highestPriority) { - bestLauncher = launcher; + if (factory instanceof ICommandLauncherFactory2) { + ICommandLauncher launcher = ((ICommandLauncherFactory2)factory).getCommandLauncher(config); + if (launcher != null) { + if (priorityMapping.get(factory) > highestPriority) { + bestLauncher = launcher; + } } } } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory.java index 7ab4429e920..8ac7cdbb96c 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory.java @@ -37,15 +37,6 @@ public interface ICommandLauncherFactory { public ICommandLauncher getCommandLauncher(ICConfigurationDescription cfgd); /** - * Get a Command Launcher for a build configuration descriptor - * @param cfg - ICBuildConfiguration to get command launcher for - * @return ICommandLauncher or null - */ - public default ICommandLauncher getCommandLauncher(ICBuildConfiguration cfg) { - return null; - } - - /** * Register language setting entries for a project * @param project - IProject used in obtaining language setting entries * @param entries - List of language setting entries diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory2.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory2.java new file mode 100644 index 00000000000..5b838e4e1c8 --- /dev/null +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory2.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2018 Red Hat Inc. 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.core; + +import org.eclipse.cdt.core.build.ICBuildConfiguration; + +/** + * @since 6.5 + */ +public interface ICommandLauncherFactory2 { + + public static final String CONTAINER_BUILD_ENABLED = "container.build.enabled"; //$NON-NLS-1$ + + /** + * Get a Command Launcher for a build configuration descriptor + * @param cfg - ICBuildConfiguration to get command launcher for + * @return ICommandLauncher or null + */ + public default ICommandLauncher getCommandLauncher(ICBuildConfiguration cfg) { + return null; + } + +} diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildCommandLauncher.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildCommandLauncher.java index 8171fb9c0b8..2abaa206631 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildCommandLauncher.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildCommandLauncher.java @@ -10,6 +10,9 @@ *******************************************************************************/ package org.eclipse.cdt.core.build; +/** + * @since 6.5 + */ public interface ICBuildCommandLauncher { /** diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java index 4c0d8079b45..3589d6c6467 100644 --- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java +++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java @@ -21,6 +21,7 @@ import java.util.Set; import org.eclipse.cdt.core.ICommandLauncher; import org.eclipse.cdt.core.ICommandLauncherFactory; +import org.eclipse.cdt.core.ICommandLauncherFactory2; import org.eclipse.cdt.core.build.ICBuildConfiguration; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.settings.model.CIncludePathEntry; @@ -37,7 +38,7 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.linuxtools.docker.ui.launch.ContainerLauncher; public class ContainerCommandLauncherFactory - implements ICommandLauncherFactory { + implements ICommandLauncherFactory, ICommandLauncherFactory2 { @Override public ICommandLauncher getCommandLauncher(IProject project) { |