Skip to main content
summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorDoug Schaefer2016-08-30 15:05:18 +0000
committerDoug Schaefer2016-08-31 19:03:29 +0000
commit9c8bcb28c874581067b2e26f9e4321f19d7c2a86 (patch)
tree73d637b7beae9308aaf654e1fe0033267b2c6e72 /build
parent5d9eaa604e238af18b8c8df4e8742830accae5d2 (diff)
downloadorg.eclipse.cdt-9c8bcb28c874581067b2e26f9e4321f19d7c2a86.tar.gz
org.eclipse.cdt-9c8bcb28c874581067b2e26f9e4321f19d7c2a86.tar.xz
org.eclipse.cdt-9c8bcb28c874581067b2e26f9e4321f19d7c2a86.zip
Allow participants in CMake toolchain file management.
For ESP8266, I want to auto discover the toolchains and friends installed into Eclipse. I also want to handle toolchain files manually added by the user. Adding providers and listeners. Adds prefix to gcc commands. Makes CMake config provider for Local only. ESP8266 has it's own launch config. Add build output to the build config model. And fix up output folders. Change-Id: I682c3d08898e5ca275d07f8bb63c6ec1c7605a81
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java8
-rw-r--r--build/org.eclipse.cdt.cmake.core/plugin.xml1
-rw-r--r--build/org.eclipse.cdt.cmake.core/schema/toolChainProvider.exsd102
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java5
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeToolChainEvent.java41
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainListener.java17
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainManager.java4
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainProvider.java14
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java11
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationDelegate.java2
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationProvider.java26
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java54
-rw-r--r--build/org.eclipse.cdt.cmake.ui/plugin.xml1
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java3
14 files changed, 256 insertions, 33 deletions
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
index 99c169e941a..8be04d5d92d 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
@@ -73,7 +73,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
this.version = version;
this.name = id + " - " + version; //$NON-NLS-1$
this.path = path;
- this.prefix = prefix;
+ this.prefix = prefix != null ? prefix : "";
if (path != null) {
StringBuilder pathString = new StringBuilder();
@@ -393,15 +393,15 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
@Override
public String[] getCompileCommands() {
- return new String[] { "gcc", "g++", "clang", "clang++", "cc", "c++" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ return new String[] { prefix + "gcc", prefix + "g++", prefix + "clang", prefix + "clang++", prefix + "cc", prefix + "c++" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
}
@Override
public String[] getCompileCommands(ILanguage language) {
if (GPPLanguage.ID.equals(language.getId())) {
- return new String[] { "g++", "clang++", "c++" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return new String[] { prefix + "g++", prefix + "clang++", prefix + "c++" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else if (GCCLanguage.ID.equals(language.getId())) {
- return new String[] { "gcc", "clang", "cc" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return new String[] { prefix + "gcc", prefix + "clang", prefix + "cc" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else {
return new String[0];
}
diff --git a/build/org.eclipse.cdt.cmake.core/plugin.xml b/build/org.eclipse.cdt.cmake.core/plugin.xml
index 14b2864eb46..2673e5b6d95 100644
--- a/build/org.eclipse.cdt.cmake.core/plugin.xml
+++ b/build/org.eclipse.cdt.cmake.core/plugin.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
+ <extension-point id="toolChainProvider" name="CMake ToolChain File Provider" schema="schema/toolChainProvider.exsd"/>
<extension
id="cmakeNature"
point="org.eclipse.core.resources.natures">
diff --git a/build/org.eclipse.cdt.cmake.core/schema/toolChainProvider.exsd b/build/org.eclipse.cdt.cmake.core/schema/toolChainProvider.exsd
new file mode 100644
index 00000000000..19d844273e3
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/schema/toolChainProvider.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.cmake.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.cdt.cmake.core" id="toolChainProvider" name="CMake ToolChain File Provider"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="provider"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="provider">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.cdt.cmake.core.ICMakeToolChainProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java
index b12a8a694da..82cc0aea8de 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java
@@ -22,7 +22,9 @@ import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.tools.templates.freemarker.FMProjectGenerator;
import org.eclipse.tools.templates.freemarker.SourceRoot;
import org.osgi.framework.Bundle;
@@ -68,6 +70,9 @@ public class CMakeProjectGenerator extends FMProjectGenerator {
} else {
entries.add(CoreModel.newSourceEntry(getProject().getFullPath()));
}
+
+ entries.add(CoreModel.newOutputEntry(getProject().getFolder("build").getFullPath(),
+ new IPath[] { new Path("**/CMakeFiles/**") }));
CoreModel.getDefault().create(project).setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]),
monitor);
}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeToolChainEvent.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeToolChainEvent.java
new file mode 100644
index 00000000000..962f1f2accc
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeToolChainEvent.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems 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
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core;
+
+/**
+ * Event occured with CMake ToolChain Files, either added or removed.
+ */
+public class CMakeToolChainEvent {
+
+ /**
+ * ToolChain file has been added.
+ */
+ public static final int ADDED = 1;
+
+ /**
+ * ToolChain File has been removed.
+ */
+ public static final int REMOVED = 2;
+
+ private final int type;
+ private final ICMakeToolChainFile toolChainFile;
+
+ public CMakeToolChainEvent(int type, ICMakeToolChainFile toolChainFile) {
+ this.type = type;
+ this.toolChainFile = toolChainFile;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public ICMakeToolChainFile getToolChainFile() {
+ return toolChainFile;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainListener.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainListener.java
new file mode 100644
index 00000000000..447fe68fee5
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainListener.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems 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
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core;
+
+/**
+ * Listener for toolchain events.
+ */
+public interface ICMakeToolChainListener {
+
+ void handleCMakeToolChainEvent(CMakeToolChainEvent event);
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainManager.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainManager.java
index a6d11e94582..b522fb1d0ef 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainManager.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainManager.java
@@ -30,4 +30,8 @@ public interface ICMakeToolChainManager {
Collection<ICMakeToolChainFile> getToolChainFiles();
+ void addListener(ICMakeToolChainListener listener);
+
+ void removeListener(ICMakeToolChainListener listener);
+
}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainProvider.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainProvider.java
new file mode 100644
index 00000000000..1620c5995f3
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainProvider.java
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems 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
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core;
+
+public interface ICMakeToolChainProvider {
+
+ void init(ICMakeToolChainManager manager);
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
index 6efa8bf43ae..9db982f7ce4 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-// * Copyright (c) 2015, 2016 QNX Software Systems and others.
+ * Copyright (c) 2015, 2016 QNX Software Systems 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
@@ -28,10 +28,13 @@ import org.eclipse.cdt.core.build.IToolChain;
import org.eclipse.cdt.core.model.ICModelMarker;
import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.core.resources.IBuildConfiguration;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
@@ -96,7 +99,8 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
if (!Files.exists(buildDir.resolve("Makefile"))) { //$NON-NLS-1$
List<String> command = new ArrayList<>();
- // TODO assuming cmake is in the path here, probably need a preference in case it isn't.
+ // TODO assuming cmake is in the path here, probably need a
+ // preference in case it isn't.
Path cmakePath = CBuildConfiguration.getCommandFromPath(Paths.get("cmake")); //$NON-NLS-1$
if (cmakePath == null) {
if (!Platform.getOS().equals(Platform.OS_WIN32)) {
@@ -127,7 +131,8 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
try (ErrorParserManager epm = new ErrorParserManager(project, getBuildDirectoryURI(), this,
getToolChain().getErrorParserIds())) {
- // TODO need to figure out which builder to call. Hardcoding to make for now.
+ // TODO need to figure out which builder to call. Hardcoding to
+ // make for now.
List<String> command = Arrays.asList("make"); //$NON-NLS-1$
ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile());
setBuildEnvironment(processBuilder.environment());
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationDelegate.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationDelegate.java
index 1d862296f6f..a2a5435d23f 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationDelegate.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationDelegate.java
@@ -55,7 +55,7 @@ public class CMakeLaunchConfigurationDelegate extends LaunchConfigurationTargete
IToolChain toolChain = tcs.iterator().next();
IProject project = getProject(configuration);
- ICBuildConfiguration config = configManager.createBuildConfiguration(project, toolChain, "run", monitor); //$NON-NLS-1$
+ ICBuildConfiguration config = configManager.getBuildConfiguration(project, toolChain, "run", monitor); //$NON-NLS-1$
if (config != null) {
IProjectDescription desc = project.getDescription();
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationProvider.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationProvider.java
index bf0e83536ad..adf1bb8d358 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationProvider.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationProvider.java
@@ -28,35 +28,11 @@ import org.eclipse.launchbar.core.target.ILaunchTargetManager;
public class CMakeLaunchConfigurationProvider extends AbstractLaunchConfigProvider {
- private final ICMakeToolChainManager manager = Activator.getService(ICMakeToolChainManager.class);
- private final IToolChainManager tcManager = Activator.getService(IToolChainManager.class);
-
private Map<IProject, ILaunchConfiguration> configs = new HashMap<>();
@Override
public boolean supports(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException {
- if (ILaunchTargetManager.localLaunchTargetTypeId.equals(target.getTypeId())) {
- return true;
- }
-
- String os = target.getAttribute(ILaunchTarget.ATTR_OS, ""); //$NON-NLS-1$
- if (os.isEmpty()) {
- return false;
- }
-
- String arch = target.getAttribute(ILaunchTarget.ATTR_ARCH, ""); //$NON-NLS-1$
- if (arch.isEmpty()) {
- return false;
- }
-
- Map<String, String> properties = new HashMap<>();
- properties.put(IToolChain.ATTR_OS, os);
- properties.put(IToolChain.ATTR_ARCH, arch);
- if (manager.getToolChainFilesMatching(properties).isEmpty()) {
- return false;
- }
-
- return !tcManager.getToolChainsMatching(properties).isEmpty();
+ return ILaunchTargetManager.localLaunchTargetTypeId.equals(target.getTypeId());
}
@Override
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java
index 8d1b2c740cb..15c42839b5d 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java
@@ -13,12 +13,22 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import org.eclipse.cdt.cmake.core.CMakeToolChainEvent;
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
+import org.eclipse.cdt.cmake.core.ICMakeToolChainListener;
import org.eclipse.cdt.cmake.core.ICMakeToolChainManager;
+import org.eclipse.cdt.cmake.core.ICMakeToolChainProvider;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
@@ -30,6 +40,8 @@ public class CMakeToolChainManager implements ICMakeToolChainManager {
private static final String N = "n"; //$NON-NLS-1$
private static final String PATH = "__path"; //$NON-NLS-1$
+ private final List<ICMakeToolChainListener> listeners = new LinkedList<>();
+
private Preferences getPreferences() {
return InstanceScope.INSTANCE.getNode(Activator.getId()).node("cmakeToolchains"); //$NON-NLS-1$
}
@@ -57,6 +69,19 @@ public class CMakeToolChainManager implements ICMakeToolChainManager {
}
// TODO discovery
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.getId(),
+ "toolChainProvider"); //$NON-NLS-1$
+ for (IConfigurationElement element : point.getConfigurationElements()) {
+ if (element.getName().equals("provider")) { //$NON-NLS-1$
+ try {
+ ICMakeToolChainProvider provider = (ICMakeToolChainProvider) element
+ .createExecutableExtension("class"); //$NON-NLS-1$
+ provider.init(this);
+ } catch (ClassCastException | CoreException e) {
+ Activator.log(e);
+ }
+ }
+ }
}
}
@@ -92,11 +117,14 @@ public class CMakeToolChainManager implements ICMakeToolChainManager {
} catch (BackingStoreException e) {
Activator.log(e);
}
+
+ fireEvent(new CMakeToolChainEvent(CMakeToolChainEvent.ADDED, file));
}
@Override
public void removeToolChainFile(ICMakeToolChainFile file) {
init();
+ fireEvent(new CMakeToolChainEvent(CMakeToolChainEvent.REMOVED, file));
files.remove(file.getPath());
String n = ((CMakeToolChainFile) file).n;
@@ -143,4 +171,30 @@ public class CMakeToolChainManager implements ICMakeToolChainManager {
return matches;
}
+ @Override
+ public void addListener(ICMakeToolChainListener listener) {
+ listeners.add(listener);
+ }
+
+ @Override
+ public void removeListener(ICMakeToolChainListener listener) {
+ listeners.remove(listener);
+ }
+
+ private void fireEvent(CMakeToolChainEvent event) {
+ for (ICMakeToolChainListener listener : listeners) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void run() throws Exception {
+ listener.handleCMakeToolChainEvent(event);
+ }
+
+ @Override
+ public void handleException(Throwable exception) {
+ Activator.log(exception);
+ }
+ });
+ }
+ }
+
}
diff --git a/build/org.eclipse.cdt.cmake.ui/plugin.xml b/build/org.eclipse.cdt.cmake.ui/plugin.xml
index c76595197c8..09a01d710fb 100644
--- a/build/org.eclipse.cdt.cmake.ui/plugin.xml
+++ b/build/org.eclipse.cdt.cmake.ui/plugin.xml
@@ -23,6 +23,7 @@
<extension
point="org.eclipse.ui.preferencePages">
<page
+ category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
class="org.eclipse.cdt.cmake.ui.internal.CMakePreferencePage"
id="org.eclipse.cdt.cmake.ui.page1"
name="%cmake.preferences.name">
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java
index e6cae98fb80..94406b75ac5 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java
@@ -184,6 +184,9 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
manager.removeToolChainFile(file);
}
+ filesToAdd.clear();
+ filesToRemove.clear();
+
return true;
}

Back to the top