Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/.settings/.api_filters28
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java9
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java3
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuilder.java9
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java94
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainProvider.java20
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IUserToolChainProvider.java41
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java3
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java12
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.properties1
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java44
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties12
-rw-r--r--core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF3
-rw-r--r--core/org.eclipse.cdt.ui/plugin.xml1
-rw-r--r--core/org.eclipse.cdt.ui/schema/newToolChainWizards.exsd129
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.java22
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties21
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/build/NewToolChainWizard.java33
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/build/NewToolChainWizardSelectionPage.java144
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorHoverConfigurationBlock.java3
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/project/NewCDTProjectWizard.java6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java10
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/build/ToolChainPreferencePage.java310
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/build/ToolChainWizard.java31
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/ReferenceBlock.java14
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/EnvDialog.java3
26 files changed, 978 insertions, 28 deletions
diff --git a/core/org.eclipse.cdt.core/.settings/.api_filters b/core/org.eclipse.cdt.core/.settings/.api_filters
new file mode 100644
index 00000000000..f95a509891f
--- /dev/null
+++ b/core/org.eclipse.cdt.core/.settings/.api_filters
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.cdt.core" version="2">
+ <resource path="src/org/eclipse/cdt/core/build/IToolChainProvider.java" type="org.eclipse.cdt.core.build.IToolChainProvider">
+ <filter comment="This interface is still pretty new. Assuming low risk." id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.IToolChainProvider"/>
+ <message_argument value="addToolChain(IToolChain)"/>
+ </message_arguments>
+ </filter>
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.IToolChainProvider"/>
+ <message_argument value="getToolChain(String)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Newish interface. Assuming low risk." id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.IToolChainProvider"/>
+ <message_argument value="removeToolChain(IToolChain)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="This is a newish interface. Assuming low risk." id="1211105284">
+ <message_arguments>
+ <message_argument value="removeToolChain(IToolChain)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java
index a4895bdda0a..9dd1c4b31a0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java
@@ -87,13 +87,14 @@ public class SemanticQueries {
* Returns all pure virtual methods of a class. Inherited pure virtual methods
* that have not been implemented are also returned.
*
- * NOTE: The method produces complete results for template instantiations
- * but doesn't take into account base classes and methods dependent on unspecified
+ * NOTE: The method produces complete results for template instantiations but
+ * doesn't take into account base classes and methods dependent on unspecified
* template parameters.
*
- * @param classType the class whose pure virtual methods should be returned
+ * @param classType
+ * the class whose pure virtual methods should be returned
* @return an array containing all pure virtual methods of the class
- * @since 6.3
+ * @since 6.4
*/
public static ICPPMethod[] getPureVirtualMethods(ICPPClassType classType) {
FinalOverriderMap finalOverriderMap = CPPInheritance.getFinalOverriderMap(classType);
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
index 196eb50a4dd..e2adadf98c2 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
@@ -92,7 +92,6 @@ import com.google.gson.JsonParseException;
* settings for subclasses.
*
* @since 6.0
- * @noextend This class is provisional and should be subclassed with caution.
*/
public abstract class CBuildConfiguration extends PlatformObject
implements ICBuildConfiguration, IMarkerGenerator, IConsoleParser {
@@ -138,7 +137,7 @@ public abstract class CBuildConfiguration extends PlatformObject
}
toolChain = tc;
- launchMode = settings.get(LAUNCH_MODE, null); // $NON-NLS-1$
+ launchMode = settings.get(LAUNCH_MODE, "run"); //$NON-NLS-1$
}
protected CBuildConfiguration(IBuildConfiguration config, String name, IToolChain toolChain) {
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuilder.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuilder.java
index 47f2eef8f5a..a50744deb02 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuilder.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuilder.java
@@ -5,6 +5,7 @@ import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.resources.IConsole;
+import org.eclipse.cdt.internal.core.build.Messages;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
@@ -38,14 +39,14 @@ public class CBuilder extends IncrementalProjectBuilder {
// Get the build configuration
ICBuildConfiguration config = getBuildConfig().getAdapter(ICBuildConfiguration.class);
if (config == null) {
- console.getErrorStream().write("Build not configured correctly\n");
+ console.getErrorStream().write(Messages.CBuilder_NotConfiguredCorrectly);
return null;
}
return config.build(kind, args, console, monitor);
} catch (IOException e) {
throw new CoreException(
- new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "Exception while building", e));
+ new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, Messages.CBuilder_ExceptionWhileBuilding, e));
}
}
@@ -61,14 +62,14 @@ public class CBuilder extends IncrementalProjectBuilder {
// Get the build configuration
ICBuildConfiguration config = getBuildConfig().getAdapter(ICBuildConfiguration.class);
if (config == null) {
- console.getErrorStream().write("Build not configured correctly\n");
+ console.getErrorStream().write(Messages.CBuilder_NotConfiguredCorrectly2);
return;
}
config.clean(console, monitor);
} catch (IOException e) {
throw new CoreException(
- new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "Exception while building", e));
+ new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, Messages.CBuilder_ExceptionWhileBuilding2, e));
}
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java
index c6e19379537..b1b0ec270bd 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java
@@ -8,23 +8,65 @@
package org.eclipse.cdt.core.build;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.ISafeRunnable;
/**
* The global toolchain manager. Accessed as an OSGi service.
*
+ * @noimplement This interface is not intended to be implemented by clients.
* @since 6.0
*/
public interface IToolChainManager {
+ /**
+ * Return the provider with the given id
+ *
+ * @param providerId
+ * id
+ * @return provider
+ * @throws CoreException
+ */
IToolChainProvider getProvider(String providerId) throws CoreException;
-
+
+ /**
+ * Return the toolchain from the given provider with the given id and version.
+ *
+ * @param providerId
+ * id of provider
+ * @param id
+ * id of toolchain
+ * @param version
+ * version of toolchain
+ * @return the toolchain
+ * @throws CoreException
+ */
IToolChain getToolChain(String providerId, String id, String version) throws CoreException;
+ /**
+ * Return the toolchains provided by the given provider
+ *
+ * @param providerId
+ * id of provider
+ * @return toolchains the provider provides
+ * @throws CoreException
+ */
Collection<IToolChain> getToolChains(String providerId) throws CoreException;
+ /**
+ * Return all versions of toolchains with the given id provided by the given
+ * provider.
+ *
+ * @param providerId
+ * id of provider
+ * @param id
+ * id of toolchains
+ * @return toolchains with the given id provided by the provider
+ * @throws CoreException
+ */
Collection<IToolChain> getToolChains(String providerId, String id) throws CoreException;
/**
@@ -36,8 +78,58 @@ public interface IToolChainManager {
*/
Collection<IToolChain> getToolChainsMatching(Map<String, String> properties) throws CoreException;
+ /**
+ * Return all of the toolchains.
+ *
+ * @since 6.4
+ */
+ Collection<IToolChain> getAllToolChains() throws CoreException;
+
+ /**
+ * Set the preference order of the toolchains. This controls the order
+ * toolchains are returned in the other methods in this interface. Often, the
+ * first toolchain in a list is the default toolchain to use in a build
+ * configuration.
+ *
+ * @param orderedToolchains
+ * @throws CoreException
+ * @since 6.4
+ */
+ void setToolChainOrder(List<IToolChain> orderedToolchains) throws CoreException;
+
+ /**
+ * Add a toolchain.
+ *
+ * @param toolChain
+ * the toolchain
+ */
void addToolChain(IToolChain toolChain);
+ /**
+ * Remove a toolchain
+ *
+ * @param toolChain
+ * the toolchain
+ */
void removeToolChain(IToolChain toolChain);
+ /**
+ * Add a listener for toolchains added or removed. The listener is a simple
+ * runnable that is called when an event occurs.
+ *
+ * @param listener
+ * runnable that is called when a toolchain is added or removed
+ * @since 6.4
+ */
+ void addToolChainListener(ISafeRunnable listener);
+
+ /**
+ * Remove a listener.
+ *
+ * @param listener
+ * the listener to remove
+ * @since 6.4
+ */
+ void removeToolChainListener(ISafeRunnable listener);
+
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainProvider.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainProvider.java
index 0b9c78ef7cc..d1c11e2fbbe 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainProvider.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainProvider.java
@@ -36,15 +36,27 @@ public interface IToolChainProvider {
/**
* Called by the manager to dynamically create the toolchain.
*
- * @param name
- * the name of the toolchain
+ * @deprecated We have dropped the concept of version. All ids must be unique.
+ * @param id
+ * the id of the toolchain
* @param version
* the version of the toolchain
- * @param properties
- * the persisted settings for the toolchain
* @return the toolchain initialized with the settings.
*/
+ @Deprecated
default IToolChain getToolChain(String id, String version) throws CoreException {
+ return getToolChain(id);
+ }
+
+ /**
+ * Called by the manager to dynamically create the toolchain.
+ *
+ * @param id
+ * the id of the toolchain
+ * @return the toolchain initialized with the settings.
+ * @since 6.4
+ */
+ default IToolChain getToolChain(String id) throws CoreException {
// By default, assumes all toolchains were added at init time.
return null;
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IUserToolChainProvider.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IUserToolChainProvider.java
new file mode 100644
index 00000000000..14f2f21c996
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IUserToolChainProvider.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.core.build;
+
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * A toolchain provider that is managed by the user. The user can manually add
+ * and remove toolchains.
+ *
+ * It is the responsibility of the provider to manage persistence and to
+ * populate the toolchains with the toolchain manager.
+ *
+ * @since 6.4
+ */
+public interface IUserToolChainProvider extends IToolChainProvider {
+
+ /**
+ * Manually add a toolchain to be managed by this provider.
+ *
+ * @param toolChain
+ * toolchain to be added
+ * @since 6.4
+ */
+ void addToolChain(IToolChain toolChain) throws CoreException;
+
+ /**
+ * Manually remove a toolchain managed by this provider.
+ *
+ * @param toolChain
+ * toolchain to be removed
+ * @throws CoreException
+ */
+ void removeToolChain(IToolChain toolChain) throws CoreException;
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
index ceeb95c4995..50f28769f26 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
@@ -17,6 +17,7 @@ import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.IConsoleParser;
import org.eclipse.cdt.core.model.ICModelMarker;
import org.eclipse.cdt.core.resources.IConsole;
+import org.eclipse.cdt.internal.core.build.Messages;
import org.eclipse.core.resources.IBuildConfiguration;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
@@ -77,7 +78,7 @@ public class StandardBuildConfiguration extends CBuildConfiguration {
Path buildDir = getBuildDirectory();
- outStream.write(String.format("Building in: %s\n", buildDir.toString()));
+ outStream.write(String.format(Messages.StandardBuildConfiguration_0, buildDir.toString()));
String[] command = new String[buildCommand.length];
Path make = findCommand(buildCommand[0]);
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java
index 34174d410fc..e94820da9da 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java
@@ -1,3 +1,10 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.internal.core.build;
import org.eclipse.osgi.util.NLS;
@@ -5,6 +12,11 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.build.Messages"; //$NON-NLS-1$
public static String CBuildConfigurationtoolchainMissing;
+ public static String CBuilder_ExceptionWhileBuilding;
+ public static String CBuilder_ExceptionWhileBuilding2;
+ public static String CBuilder_NotConfiguredCorrectly;
+ public static String CBuilder_NotConfiguredCorrectly2;
+ public static String StandardBuildConfiguration_0;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.properties b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.properties
deleted file mode 100644
index d1a49530f37..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.properties
+++ /dev/null
@@ -1 +0,0 @@
-CBuildConfigurationtoolchainMissing=Toolchain missing for config: %s
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java
index 7be272a5109..2333ee5e066 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java
@@ -21,13 +21,17 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SafeRunner;
public class ToolChainManager implements IToolChainManager {
private Map<String, IConfigurationElement> providerElements;
private Map<String, IToolChainProvider> providers;
private Map<List<String>, IToolChain> toolChains;
+ private List<IToolChain> orderedToolChains;
+ private List<ISafeRunnable> listeners = new ArrayList<>();
private void init() {
if (providerElements == null) {
@@ -45,6 +49,7 @@ public class ToolChainManager implements IToolChainManager {
// Load the discovered toolchains
toolChains = new HashMap<>();
+ orderedToolChains = new ArrayList<>();
for (IConfigurationElement element : providerElements.values()) {
// TODO check for enablement
try {
@@ -69,12 +74,16 @@ public class ToolChainManager implements IToolChainManager {
@Override
public void addToolChain(IToolChain toolChain) {
+ orderedToolChains.add(toolChain);
toolChains.put(getId(toolChain), toolChain);
+ fireChange();
}
@Override
public void removeToolChain(IToolChain toolChain) {
+ orderedToolChains.remove(toolChain);
toolChains.remove(getId(toolChain));
+ fireChange();
}
@Override
@@ -172,4 +181,39 @@ public class ToolChainManager implements IToolChainManager {
return tcs;
}
+ @Override
+ public Collection<IToolChain> getAllToolChains() throws CoreException {
+ init();
+ return orderedToolChains;
+ }
+
+ @Override
+ public void setToolChainOrder(List<IToolChain> orderedToolchains) throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void addToolChainListener(ISafeRunnable listener) {
+ synchronized (listeners) {
+ listeners.add(listener);
+ }
+ }
+
+ @Override
+ public void removeToolChainListener(ISafeRunnable listener) {
+ synchronized (listeners) {
+ listeners.remove(listener);
+ }
+ }
+
+ private void fireChange() {
+ List<ISafeRunnable> runners;
+ synchronized (listeners) {
+ runners = new ArrayList<>(listeners);
+ }
+ for (ISafeRunnable runner : runners) {
+ SafeRunner.run(runner);
+ }
+ }
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties
new file mode 100644
index 00000000000..318235d700b
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties
@@ -0,0 +1,12 @@
+################################################################################
+# Copyright (c) 2017 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
+################################################################################
+CBuilder_ExceptionWhileBuilding=Exception while building
+CBuilder_ExceptionWhileBuilding2=Exception while building
+CBuilder_NotConfiguredCorrectly=Build not configured correctly\n
+CBuilder_NotConfiguredCorrectly2=Build not configured correctly\n
+StandardBuildConfiguration_0=Building in: %s\n
diff --git a/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF
index 3fe3c4d2342..5d48903ebcd 100644
--- a/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.ui; singleton:=true
-Bundle-Version: 6.2.0.qualifier
+Bundle-Version: 6.3.0.qualifier
Bundle-Activator: org.eclipse.cdt.ui.CUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -76,6 +76,7 @@ Export-Package: org.eclipse.cdt.internal.corext;x-internal:=true,
org.eclipse.cdt.ui,
org.eclipse.cdt.ui.actions,
org.eclipse.cdt.ui.browser.typeinfo,
+ org.eclipse.cdt.ui.build,
org.eclipse.cdt.ui.dialogs,
org.eclipse.cdt.ui.extensions,
org.eclipse.cdt.ui.internal.templateengine.wizard;x-internal:=true,
diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml
index 20644ae7931..b30990a3dd7 100644
--- a/core/org.eclipse.cdt.ui/plugin.xml
+++ b/core/org.eclipse.cdt.ui/plugin.xml
@@ -31,6 +31,7 @@
<extension-point id="LanguageSettingsProviderAssociation" name="%LanguageSettingsProviderAssociationExtensionPoint" schema="schema/LanguageSettingsProviderAssociation.exsd"/>
<extension-point id="RefreshExclusionContributor" name="%RefreshExclusionContributorExtensionPoint" schema="schema/RefreshExclusionContributor.exsd"/>
<extension-point id="semanticHighlighting" name="%semanticHighlightingExtensionPoint" schema="schema/semanticHighlighting.exsd"/>
+ <extension-point id="newToolChainWizards" name="New ToolChain Wizards" schema="schema/newToolChainWizards.exsd"/>
<extension
point="org.eclipse.core.runtime.adapters">
diff --git a/core/org.eclipse.cdt.ui/schema/newToolChainWizards.exsd b/core/org.eclipse.cdt.ui/schema/newToolChainWizards.exsd
new file mode 100644
index 00000000000..67dc553f06e
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/schema/newToolChainWizards.exsd
@@ -0,0 +1,129 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.cdt.ui" id="newToolChainWizards" name="New ToolChain Wizards"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="wizard"/>
+ </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="wizard">
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="icon" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.cdt.ui.build.ToolChainWizard:"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="providerId" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.cdt.core.toolChainProvider/provider/@id"/>
+ </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/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.java
index f3de9a8f1c6..706eec2282f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.java
@@ -65,6 +65,22 @@ public final class CUIMessages extends NLS {
public static String TextEditorDropAdapter_error_message;
public static String TextEditorDropAdapter_unreadableFile;
public static String TextEditorDropAdapter_noFile;
+ public static String ToolChainPreferencePage_Add;
+ public static String ToolChainPreferencePage_Arch;
+ public static String ToolChainPreferencePage_AreYouSure;
+ public static String ToolChainPreferencePage_AvailableToolchains;
+ public static String ToolChainPreferencePage_Down;
+ public static String ToolChainPreferencePage_Edit;
+ public static String ToolChainPreferencePage_EditDot;
+ public static String ToolChainPreferencePage_Name;
+ public static String ToolChainPreferencePage_NoEditor;
+ public static String ToolChainPreferencePage_OS;
+ public static String ToolChainPreferencePage_Remove;
+ public static String ToolChainPreferencePage_Remove1;
+ public static String ToolChainPreferencePage_RemoveToolchain;
+ public static String ToolChainPreferencePage_Toolchains;
+ public static String ToolChainPreferencePage_Up;
+ public static String ToolChainPreferencePage_UserDefinedToolchains;
public static String OptionalMessageDialog_dontShowAgain;
public static String OptionalMessageDialog_rememberDecision;
public static String CStructureCreatorVisitor_translationUnitName;
@@ -72,6 +88,12 @@ public final class CUIMessages extends NLS {
public static String FileTransferDragAdapter_problem;
public static String FileTransferDragAdapter_problemTitle;
public static String CUIPlugin_initPrefs;
+ public static String NewCDTProjectWizard_PageTitle;
+ public static String NewCDTProjectWizard_Title;
+ public static String NewToolChainWizard_Title;
+
+ public static String NewToolChainWizardSelectionPage_Description;
+ public static String NewToolChainWizardSelectionPage_Title;
static {
NLS.initializeMessages(BUNDLE_NAME, CUIMessages.class);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties
index 35f54d2a079..523f0e5c221 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties
@@ -65,6 +65,22 @@ TextEditorDropAdapter_error_title=Drag and Drop
TextEditorDropAdapter_error_message=A problem occurred during drag and drop.
TextEditorDropAdapter_unreadableFile=Unreadable file: ''{0}''
TextEditorDropAdapter_noFile=Not a file: ''{0}''
+ToolChainPreferencePage_Add=Add...
+ToolChainPreferencePage_Arch=Arch
+ToolChainPreferencePage_AreYouSure=Are you sure you'd like to remove the selected toolchain?
+ToolChainPreferencePage_AvailableToolchains=Available Toolchains
+ToolChainPreferencePage_Down=Down
+ToolChainPreferencePage_Edit=Edit
+ToolChainPreferencePage_EditDot=Edit...
+ToolChainPreferencePage_Name=Name
+ToolChainPreferencePage_NoEditor=No editor found for this toolchain
+ToolChainPreferencePage_OS=OS
+ToolChainPreferencePage_Remove=Remove
+ToolChainPreferencePage_Remove1=Remove
+ToolChainPreferencePage_RemoveToolchain=Remove Toolchain
+ToolChainPreferencePage_Toolchains=Toolchains
+ToolChainPreferencePage_Up=Up
+ToolChainPreferencePage_UserDefinedToolchains=User Defined Toolchains
OptionalMessageDialog_dontShowAgain= Do not show this &message again
OptionalMessageDialog_rememberDecision=Re&member my decision
@@ -75,3 +91,8 @@ FileTransferDragAdapter_problem=Problem while moving or copying files.
FileTransferDragAdapter_problemTitle=Drag & Drop
CUIPlugin_initPrefs=Initialize C/C++ UI Preferences
+NewCDTProjectWizard_PageTitle=Templates for New C/C++ Project
+NewCDTProjectWizard_Title=New C/C++ Project
+NewToolChainWizard_Title=New Toolchain
+NewToolChainWizardSelectionPage_Description=Select the type of toolchain to add.
+NewToolChainWizardSelectionPage_Title=Toolchain Type
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/build/NewToolChainWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/build/NewToolChainWizard.java
new file mode 100644
index 00000000000..01a279bd506
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/build/NewToolChainWizard.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.internal.ui.build;
+
+import org.eclipse.jface.wizard.Wizard;
+
+import org.eclipse.cdt.internal.ui.CUIMessages;
+
+public class NewToolChainWizard extends Wizard {
+
+ public NewToolChainWizard() {
+ setForcePreviousAndNextButtons(true);
+ }
+
+ @Override
+ public void addPages() {
+ super.addPages();
+ addPage(new NewToolChainWizardSelectionPage());
+ setWindowTitle(CUIMessages.NewToolChainWizard_Title);
+ }
+
+ @Override
+ public boolean performFinish() {
+ // Downstream wizards do finish
+ return false;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/build/NewToolChainWizardSelectionPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/build/NewToolChainWizardSelectionPage.java
new file mode 100644
index 00000000000..a9a3ee7bd3b
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/build/NewToolChainWizardSelectionPage.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.internal.ui.build;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.build.ToolChainWizard;
+
+import org.eclipse.cdt.internal.ui.CUIMessages;
+
+public class NewToolChainWizardSelectionPage extends WizardPage {
+
+ private Table table;
+
+ public NewToolChainWizardSelectionPage() {
+ super(NewToolChainWizardSelectionPage.class.getName());
+
+ setTitle(CUIMessages.NewToolChainWizardSelectionPage_Title);
+ setDescription(CUIMessages.NewToolChainWizardSelectionPage_Description);
+ setPageComplete(false);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout());
+
+ table = new Table(comp, SWT.BORDER | SWT.SINGLE);
+ table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ IExtensionPoint point = Platform.getExtensionRegistry()
+ .getExtensionPoint(CUIPlugin.PLUGIN_ID + ".newToolChainWizards"); //$NON-NLS-1$
+ for (IExtension extension : point.getExtensions()) {
+ for (IConfigurationElement element : extension.getConfigurationElements()) {
+ String name = element.getAttribute("name"); //$NON-NLS-1$
+ TableItem item = new TableItem(table, SWT.NONE);
+ item.setText(name);
+
+ String iconFile = element.getAttribute("icon"); //$NON-NLS-1$
+ if (iconFile != null) {
+ ImageDescriptor desc = CUIPlugin
+ .imageDescriptorFromPlugin(element.getNamespaceIdentifier(), iconFile);
+ if (desc != null) {
+ item.setImage(desc.createImage());
+ }
+ }
+
+ item.setData(element);
+ }
+ }
+
+ table.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ getContainer().updateButtons();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ if (canFlipToNextPage()) {
+ getContainer().showPage(getNextPage());
+ }
+ }
+ });
+
+ setControl(comp);
+ }
+
+ @Override
+ public void dispose() {
+ for (TableItem item : table.getItems()) {
+ Object obj = item.getData();
+ if (obj instanceof Wizard) {
+ ((Wizard) obj).dispose();
+ }
+ }
+ super.dispose();
+ }
+
+ public ImageDescriptor getDescriptionImage(IConfigurationElement element) {
+ String descImage = element.getAttribute("icon"); //$NON-NLS-1$
+ if (descImage == null) {
+ return null;
+ }
+ return AbstractUIPlugin.imageDescriptorFromPlugin(element.getNamespaceIdentifier(),
+ descImage);
+ }
+
+ @Override
+ public boolean canFlipToNextPage() {
+ return table.getSelectionIndex() >= 0;
+ }
+
+ @Override
+ public IWizardPage getNextPage() {
+ int i = table.getSelectionIndex();
+ if (i >= 0) {
+ TableItem item = table.getItem(i);
+ Object obj = item.getData();
+ ToolChainWizard nextWizard;
+ if (obj instanceof IConfigurationElement) {
+ IConfigurationElement element = (IConfigurationElement) obj;
+ try {
+ nextWizard = (ToolChainWizard) element.createExecutableExtension("class"); //$NON-NLS-1$
+ nextWizard.addPages();
+ item.setData(nextWizard);
+ } catch (CoreException e) {
+ CUIPlugin.log(e);
+ return null;
+ }
+ } else {
+ nextWizard = (ToolChainWizard) obj;
+ }
+
+ return nextWizard.getStartingPage();
+ }
+ return super.getNextPage();
+ }
+
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorHoverConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorHoverConfigurationBlock.java
index a844a0a3952..a21044cb8f1 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorHoverConfigurationBlock.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorHoverConfigurationBlock.java
@@ -54,6 +54,7 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
+
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.PreferenceConstants;
@@ -221,7 +222,7 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB
hoverComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
String rollOverLabel= PreferencesMessages.CEditorHoverConfigurationBlock_annotationRollover;
- addCheckBox(hoverComposite, rollOverLabel, PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER, 0); //$NON-NLS-1$
+ addCheckBox(hoverComposite, rollOverLabel, PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER, 0);
//addFiller(hoverComposite);
Label label= new Label(hoverComposite, SWT.NONE);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/project/NewCDTProjectWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/project/NewCDTProjectWizard.java
index 17c23314c69..ac12720d1a6 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/project/NewCDTProjectWizard.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/project/NewCDTProjectWizard.java
@@ -9,14 +9,16 @@ package org.eclipse.cdt.internal.ui.wizards.project;
import org.eclipse.tools.templates.ui.NewWizard;
+import org.eclipse.cdt.internal.ui.CUIMessages;
+
public class NewCDTProjectWizard extends NewWizard {
private static final String cdtTag = "org.eclipse.cdt.ui.cdtTag"; //$NON-NLS-1$
public NewCDTProjectWizard() {
super(cdtTag);
- setWindowTitle("New C/C++ Project");
- setTemplateSelectionPageTitle("Templates for New C/C++ Project");
+ setWindowTitle(CUIMessages.NewCDTProjectWizard_Title);
+ setTemplateSelectionPageTitle(CUIMessages.NewCDTProjectWizard_PageTitle);
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java
index 4073e4a4ce2..a02051c7bc2 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java
@@ -73,6 +73,7 @@ import org.eclipse.ui.themes.IThemeManager;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
import com.ibm.icu.text.MessageFormat;
@@ -1090,4 +1091,13 @@ public class CUIPlugin extends AbstractUIPlugin {
IWorkbenchWindow[] windows = getDefault().getWorkbench().getWorkbenchWindows();
return windows[0].getShell();
}
+
+ /**
+ * @since 6.3
+ */
+ public static <T> T getService(Class<T> service) {
+ BundleContext context = fgCPlugin.getBundle().getBundleContext();
+ ServiceReference<T> ref = context.getServiceReference(service);
+ return ref != null ? context.getService(ref) : null;
+ }
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/build/ToolChainPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/build/ToolChainPreferencePage.java
new file mode 100644
index 00000000000..b0ed4f1a1ab
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/build/ToolChainPreferencePage.java
@@ -0,0 +1,310 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.ui.build;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.core.build.IToolChainManager;
+import org.eclipse.cdt.core.build.IUserToolChainProvider;
+import org.eclipse.cdt.ui.CUIPlugin;
+
+import org.eclipse.cdt.internal.ui.CUIMessages;
+import org.eclipse.cdt.internal.ui.build.NewToolChainWizard;
+
+/**
+ * Preference page to manage Toolchains for Core Build.
+ *
+ * @since 6.3
+ */
+public class ToolChainPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ private TableViewer availTable;
+ private Button availUp;
+ private Button availDown;
+
+ private TableViewer userTable;
+ private Button userEdit;
+ private Button userRemove;
+
+ private IToolChainManager manager = CUIPlugin.getService(IToolChainManager.class);
+
+ private ISafeRunnable tcListener = () -> Display.getDefault().asyncExec(() -> {
+ availTable.refresh();
+ userTable.refresh();
+ });
+
+ public ToolChainPreferencePage() {
+ super(CUIMessages.ToolChainPreferencePage_Toolchains);
+ }
+
+ @Override
+ public void init(IWorkbench workbench) {
+ }
+
+ private static class TableLabelProvider extends LabelProvider implements ITableLabelProvider {
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ IToolChain toolChain = (IToolChain) element;
+ switch (columnIndex) {
+ case 0:
+ return toolChain.getName();
+ case 1:
+ return toolChain.getProperty(IToolChain.ATTR_OS);
+ case 2:
+ return toolChain.getProperty(IToolChain.ATTR_ARCH);
+ }
+ return null;
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite control = new Composite(parent, SWT.NONE);
+ control.setLayout(new GridLayout());
+
+ Group availGroup = new Group(control, SWT.NONE);
+ availGroup.setText(CUIMessages.ToolChainPreferencePage_AvailableToolchains);
+ availGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ availGroup.setLayout(new GridLayout(2, false));
+
+ availTable = createToolChainTable(availGroup);
+ availTable.getTable().addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateButtons();
+ }
+ });
+ availTable.setLabelProvider(new TableLabelProvider());
+ availTable.setContentProvider(new IStructuredContentProvider() {
+ @Override
+ public Object[] getElements(Object inputElement) {
+ try {
+ return manager.getAllToolChains().toArray();
+ } catch (CoreException e) {
+ CUIPlugin.log(e.getStatus());
+ return new Object[0];
+ }
+ }
+ });
+
+
+ Composite availButtonComp = new Composite(availGroup, SWT.NONE);
+ availButtonComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
+ availButtonComp.setLayout(new GridLayout());
+
+ availUp = new Button(availButtonComp, SWT.PUSH);
+ availUp.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false));
+ availUp.setText(CUIMessages.ToolChainPreferencePage_Up);
+
+ availDown = new Button(availButtonComp, SWT.PUSH);
+ availDown.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false));
+ availDown.setText(CUIMessages.ToolChainPreferencePage_Down);
+
+ Group userGroup = new Group(control, SWT.NONE);
+ userGroup.setText(CUIMessages.ToolChainPreferencePage_UserDefinedToolchains);
+ userGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ userGroup.setLayout(new GridLayout(2, false));
+
+ userTable = createToolChainTable(userGroup);
+ userTable.getTable().addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateButtons();
+ }
+ });
+ userTable.setLabelProvider(new TableLabelProvider());
+ userTable.setContentProvider(new IStructuredContentProvider() {
+ @Override
+ public Object[] getElements(Object inputElement) {
+ List<IToolChain> tcs = new ArrayList<>();
+ try {
+ for (IToolChain tc : manager.getAllToolChains()) {
+ if (tc.getProvider() instanceof IUserToolChainProvider) {
+ tcs.add(tc);
+ }
+ }
+ } catch (CoreException e) {
+ CUIPlugin.log(e);
+ }
+ return tcs.toArray();
+ }
+ });
+
+ Composite userButtonComp = new Composite(userGroup, SWT.NONE);
+ userButtonComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
+ userButtonComp.setLayout(new GridLayout());
+
+ Button userAdd = new Button(userButtonComp, SWT.PUSH);
+ userAdd.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false));
+ userAdd.setText(CUIMessages.ToolChainPreferencePage_Add);
+ userAdd.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Wizard wizard = new NewToolChainWizard();
+ WizardDialog dialog = new WizardDialog(getShell(), wizard);
+ dialog.open();
+ }
+ });
+
+ userEdit = new Button(userButtonComp, SWT.PUSH);
+ userEdit.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+ userEdit.setText(CUIMessages.ToolChainPreferencePage_EditDot);
+ userEdit.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IToolChain tc = (IToolChain) userTable.getStructuredSelection().getFirstElement();
+ String providerId = tc.getProvider().getId();
+
+ ToolChainWizard wizard = null;
+ IExtensionPoint point = Platform.getExtensionRegistry()
+ .getExtensionPoint(CUIPlugin.PLUGIN_ID + ".newToolChainWizards"); //$NON-NLS-1$
+ loop: for (IExtension extension : point.getExtensions()) {
+ for (IConfigurationElement element : extension.getConfigurationElements()) {
+ if (providerId.equals(element.getAttribute("providerId"))) { //$NON-NLS-1$
+ try {
+ wizard = (ToolChainWizard) element.createExecutableExtension("class"); //$NON-NLS-1$
+ break loop;
+ } catch (CoreException e1) {
+ CUIPlugin.log(e1.getStatus());
+ }
+ }
+ }
+ }
+
+ if (wizard != null) {
+ wizard.setToolChain(tc);
+ WizardDialog dialog = new WizardDialog(getShell(), wizard);
+ dialog.open();
+ } else {
+ MessageDialog.openInformation(getShell(), CUIMessages.ToolChainPreferencePage_Edit, CUIMessages.ToolChainPreferencePage_NoEditor);
+ }
+ }
+ });
+
+ userRemove = new Button(userButtonComp, SWT.PUSH);
+ userRemove.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false));
+ userRemove.setText(CUIMessages.ToolChainPreferencePage_Remove);
+ userRemove.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (MessageDialog.openConfirm(getShell(), CUIMessages.ToolChainPreferencePage_Remove1,
+ CUIMessages.ToolChainPreferencePage_AreYouSure)) {
+ IToolChain tc = (IToolChain) userTable.getStructuredSelection().getFirstElement();
+ IUserToolChainProvider provider = (IUserToolChainProvider) tc.getProvider();
+ new Job(CUIMessages.ToolChainPreferencePage_RemoveToolchain) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ provider.removeToolChain(tc);
+ return Status.OK_STATUS;
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ }
+ }.schedule();
+ }
+ }
+ });
+
+ availTable.setInput(manager);
+ userTable.setInput(manager);
+ updateButtons();
+ manager.addToolChainListener(tcListener);
+ return control;
+ }
+
+ @Override
+ public void dispose() {
+ manager.removeToolChainListener(tcListener);
+ super.dispose();
+ }
+
+ private TableViewer createToolChainTable(Composite parent) {
+ Composite tableComp = new Composite(parent, SWT.NONE);
+ tableComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ Table table = new Table(tableComp, SWT.BORDER | SWT.V_SCROLL | SWT.FULL_SELECTION);
+ table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ TableColumnLayout tableLayout = new TableColumnLayout();
+
+ TableColumn tableNameColumn = new TableColumn(table, SWT.LEAD);
+ tableNameColumn.setText(CUIMessages.ToolChainPreferencePage_Name);
+ tableLayout.setColumnData(tableNameColumn, new ColumnWeightData(6));
+
+ TableColumn tableOSColumn = new TableColumn(table, SWT.LEAD);
+ tableOSColumn.setText(CUIMessages.ToolChainPreferencePage_OS);
+ tableLayout.setColumnData(tableOSColumn, new ColumnWeightData(2));
+
+ TableColumn tableArchColumn = new TableColumn(table, SWT.LEAD);
+ tableArchColumn.setText(CUIMessages.ToolChainPreferencePage_Arch);
+ tableLayout.setColumnData(tableArchColumn, new ColumnWeightData(2));
+
+ tableComp.setLayout(tableLayout);
+
+ return new TableViewer(table);
+ }
+
+ private void updateButtons() {
+ boolean availSelected = availTable.getTable().getSelectionCount() > 0;
+ availUp.setEnabled(availSelected);
+ availDown.setEnabled(availSelected);
+
+ boolean userSelected = userTable.getTable().getSelectionCount() > 0;
+ userEdit.setEnabled(userSelected);
+ userRemove.setEnabled(userSelected);
+ }
+
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/build/ToolChainWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/build/ToolChainWizard.java
new file mode 100644
index 00000000000..845628892c8
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/build/ToolChainWizard.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.ui.build;
+
+import org.eclipse.jface.wizard.Wizard;
+
+import org.eclipse.cdt.core.build.IToolChain;
+
+/**
+ * Parent class for toolChain wizards that create or edit toolchains.
+ *
+ * @since 6.3
+ */
+public abstract class ToolChainWizard extends Wizard {
+
+ protected IToolChain toolChain;
+
+ public void setToolChain(IToolChain toolChain) {
+ this.toolChain = toolChain;
+ }
+
+ public IToolChain getToolChain() {
+ return toolChain;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/ReferenceBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/ReferenceBlock.java
index 55cad28d860..c098dc3b2f0 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/ReferenceBlock.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/ReferenceBlock.java
@@ -12,9 +12,6 @@ package org.eclipse.cdt.ui.dialogs;
import java.util.ArrayList;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.internal.ui.CUIMessages;
-import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IWorkspace;
@@ -38,6 +35,11 @@ import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.ui.CUIPlugin;
+
+import org.eclipse.cdt.internal.ui.CUIMessages;
+
/**
* @deprecated as of CDT 4.0. This Block was used for New Project Wizard
* for 3.X style projects.
@@ -47,9 +49,9 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
@Deprecated
public class ReferenceBlock extends AbstractCOptionPage {
- private static final String PREFIX = "ReferenceBlock"; //$NON-NLS-1$ //$NON-NLS-1$
- private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$ //$NON-NLS-1$
- private static final String DESC = PREFIX + ".desc"; //$NON-NLS-1$ //$NON-NLS-1$
+ private static final String PREFIX = "ReferenceBlock"; //$NON-NLS-1$
+ private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
+ private static final String DESC = PREFIX + ".desc"; //$NON-NLS-1$
private CheckboxTableViewer referenceProjectsViewer;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/EnvDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/EnvDialog.java
index deb69fc56f9..321abf1d9f4 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/EnvDialog.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/EnvDialog.java
@@ -78,7 +78,8 @@ public class EnvDialog extends Dialog {
}
@Override
- protected Control createDialogArea(Composite c) {
+ protected Control createDialogArea(Composite parent) {
+ Composite c = new Composite(parent, SWT.NONE);
c.setLayout(new GridLayout(3, false));
GridData gd;

Back to the top