Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJeff Johnston2018-01-29 21:13:38 +0000
committerJeff Johnston2018-01-29 21:14:18 +0000
commit55fb64151bd85b1766dd92875a28f25117c4e631 (patch)
tree68d0885b14ebc5dba8cc0ee1b4ab17b0df3d3d86 /core
parent1d9e549ae71109f97df38ded70dd548312b96023 (diff)
downloadorg.eclipse.cdt-55fb64151bd85b1766dd92875a28f25117c4e631.tar.gz
org.eclipse.cdt-55fb64151bd85b1766dd92875a28f25117c4e631.tar.xz
org.eclipse.cdt-55fb64151bd85b1766dd92875a28f25117c4e631.zip
Bug 530468 - Support passing CBuildConfiguration to Cmd Launcher Factory
- add new ICBuildCommandLauncher interface - add new defaulted method to ICommandLauncherFactory interface - add code to look at Build Configuration properties in ContainerCommandLauncherFactory - add new methods to CommandLauncherManager and ContainerCommandLauncher - add an update dialog call in ContainerTab - add calls to set and get CBuildConfiguration to ContainerCommandLauncher Change-Id: If95fafe592c7ea4580bae1a15d168d1163e132fd
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java29
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory.java10
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildCommandLauncher.java29
3 files changed, 68 insertions, 0 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 a090891c4aa..c8e9bd83922 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
@@ -17,6 +17,7 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.core.resources.IProject;
@@ -34,6 +35,8 @@ 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<>();
@@ -190,6 +193,32 @@ public class CommandLauncherManager {
/**
* Get a command launcher.
*
+ * @param config - ICBuildConfiguration to determine launcher for.
+ * @return an ICommandLauncher for running commands
+ */
+ public ICommandLauncher getCommandLauncher(ICBuildConfiguration config) {
+ // loop through list of factories and return launcher returned with
+ // highest priority
+ 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 (bestLauncher != null) {
+ return bestLauncher;
+ }
+ // default to local CommandLauncher
+ return new CommandLauncher();
+ }
+
+ /**
+ * Get a command launcher.
+ *
* @param cfgd - ICConfigurationDescription to get command launcher for.
* @return an ICommandLauncher for running commands
*/
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 e1399886f78..7ab4429e920 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
@@ -12,6 +12,7 @@ package org.eclipse.cdt.core;
import java.util.List;
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.core.resources.IProject;
@@ -36,6 +37,15 @@ 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/build/ICBuildCommandLauncher.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildCommandLauncher.java
new file mode 100644
index 00000000000..8171fb9c0b8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildCommandLauncher.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.build;
+
+public interface ICBuildCommandLauncher {
+
+ /**
+ * Get registered CBuildConfiguration
+ *
+ * @return ICBuildConfiguration or null
+ */
+ public ICBuildConfiguration getBuildConfiguration();
+
+ /**
+ * Register a CBuildConfiguration for this command launcher
+ *
+ * @param config - CBuildConfiguration to register
+ */
+ public void setBuildConfiguration(ICBuildConfiguration config);
+
+}

Back to the top