From 1943967ffe7e8087d0d26557289c17cb9b5318f6 Mon Sep 17 00:00:00 2001
From: cvs2svn
Date: Wed, 14 Jan 2004 22:03:24 +0000
Subject: This commit was manufactured by cvs2svn to create tag
'Second_releng'.
Sprout from master 2004-01-14 22:03:23 UTC Doug Schaefer 10th July, 2002 Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html.
-For purposes of the CPL, "Program" will mean the Content. If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL. If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.
- * Note that the
- * Use the About This Content
-
-License
-Contributions
-
-add
method checks for and eliminates
- * duplicates based on identity (not equality). Likewise, the
- * remove
method compares based on identity.
- * getListeners
method when notifying listeners.
- * Note that no garbage is created if no listeners are registered.
- * The recommended code sequence for notifying all registered listeners
- * of say, FooListener.eventHappened
, is:
- *
- * Object[] listeners = myListenerList.getListeners();
- * for (int i = 0; i < listeners.length; ++i) {
- * ((FooListener) listeners[i]).eventHappened(event);
- * }
- *
- *
null
but initialized
- * to an array of size capacity the first time a listener is added.
- * Maintains invariant: listeners != null IFF size != 0
- */
- private Object[] listeners = null;
-
- /**
- * The empty array singleton instance, returned by getListeners()
- * when size == 0.
- */
- private static final Object[] EmptyArray = new Object[0];
-
- /**
- * Creates a listener list with an initial capacity of 1.
- */
- public ListenerList() {
- this(1);
- }
-
- /**
- * Creates a listener list with the given initial capacity.
- *
- * @param capacity the number of listeners which this list can initially accept
- * without growing its internal representation; must be at least 1
- */
- public ListenerList(int capacity) {
- this.capacity = capacity;
- }
-
- /**
- * Adds the given listener to this list. Has no effect if an identical listener
- * is already registered.
- *
- * @param listener the listener
- */
- public void add(Object listener) {
- if (size == 0) {
- listeners = new Object[capacity];
- } else {
- // check for duplicates using identity
- for (int i = 0; i < size; ++i) {
- if (listeners[i] == listener) {
- return;
- }
- }
- // grow array if necessary
- if (size == listeners.length) {
- System.arraycopy(listeners, 0, listeners = new Object[size * 2 + 1], 0, size);
- }
- }
- listeners[size++] = listener;
- }
-
- /**
- * Removes all listeners from this list.
- */
- public void clear() {
- size = 0;
- listeners = null;
- }
-
- /**
- * Returns an array containing all the registered listeners,
- * in the order in which they were added.
- * - * The resulting array is unaffected by subsequent adds or removes. - * If there are no listeners registered, the result is an empty array - * singleton instance (no garbage is created). - * Use this method when notifying listeners, so that any modifications - * to the listener list during the notification will have no effect on the - * notification itself. - *
- * - * @return the list of registered listeners - */ - public Object[] getListeners() { - if (size == 0) - return EmptyArray; - Object[] result = new Object[size]; - System.arraycopy(listeners, 0, result, 0, size); - return result; - } - - /** - * Returns whether this listener list is empty. - * - * @returntrue
if there are no registered listeners, and
- * false
otherwise
- */
- public boolean isEmpty() {
- return size == 0;
- }
-
- /**
- * Removes the given listener from this list. Has no effect if an identical
- * listener was not already registered.
- *
- * @param listener the listener
- */
- public void remove(Object listener) {
- for (int i = 0; i < size; ++i) {
- if (listeners[i] == listener) {
- if (size == 1) {
- listeners = null;
- size = 0;
- } else {
- System.arraycopy(listeners, i + 1, listeners, i, --size - i);
- listeners[size] = null;
- }
- return;
- }
- }
- }
-
- /**
- * Returns the number of registered listeners.
- *
- * @return the number of registered listeners
- */
- public int size() {
- return size;
- }
-}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeProject.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeProject.java
deleted file mode 100644
index 015012968e7..00000000000
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeProject.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.core;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICOwner;
-import org.eclipse.cdt.make.core.MakeScannerProvider;
-import org.eclipse.core.runtime.CoreException;
-
-public class MakeProject implements ICOwner {
-
- public void configure(ICDescriptor cproject) throws CoreException {
- cproject.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
- cproject.remove(CCorePlugin.BUILDER_MODEL_ID);
- cproject.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, MakeScannerProvider.INTERFACE_IDENTITY);
- }
-
- public void update(ICDescriptor cproject, String extensionID) throws CoreException {
- if ( extensionID.equals(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID)) {
- cproject.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, MakeScannerProvider.INTERFACE_IDENTITY);
- }
- if ( extensionID.equals(CCorePlugin.BINARY_PARSER_UNIQ_ID)) {
- cproject.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, CCorePlugin.PLUGIN_ID + ".Elf"); //$NON-NLS-1$
- }
-
- }
-}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeRecon.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeRecon.java
deleted file mode 100644
index 6962d4834cc..00000000000
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeRecon.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.core;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.util.ArrayList;
-
-import org.eclipse.cdt.utils.spawner.ProcessFactory;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class MakeRecon extends OutputStream {
-
- IPath make;
- String[] args;
- String[] environ;
- IPath directory;
- IProgressMonitor monitor;
- OutputStream console;
- MyList log;
- StringBuffer currentLine;
-
- class MyList extends ArrayList {
- public void removeInterval (int start, int len) {
- removeRange(start, len);
- }
- }
-
- public MakeRecon(IPath buildCommand, String[] buildArguments,
- String[] env, IPath workingDirectory, IProgressMonitor mon, OutputStream cos) {
- this(buildCommand, new String[]{"-n"}, buildArguments, env, workingDirectory, mon, cos);
- }
-
- public MakeRecon(IPath buildCommand, String[] options, String[] buildArguments,
- String[] env, IPath workingDirectory, IProgressMonitor mon, OutputStream cos) {
-
- make = buildCommand;
-
- args = new String[0];
- if (options != null) {
- String[]array = new String[args.length + options.length];
- System.arraycopy(args, 0, array, 0, args.length);
- System.arraycopy(options, 0, array, args.length, options.length);
- args = array;
- }
- if (buildArguments != null) {
- String[] array = new String[args.length + buildArguments.length];
- System.arraycopy(args, 0, array, 0, args.length);
- System.arraycopy(buildArguments, 0, array, args.length, buildArguments.length);
- args = array;
- }
-
- environ = env;
- directory = workingDirectory;
- monitor = mon;
- console = cos;
- currentLine = new StringBuffer();
- log = new MyList();
-
- // Get the buffer log.
- invokeMakeRecon();
-
- }
-
- private void invokeMakeRecon() {
- int i = 0;
- String[] array = new String[args.length + 1];
- array[0] = make.toOSString();
- System.arraycopy(args, 0, array, 1, args.length);
- Process p;
- try {
- p = ProcessFactory.getFactory().exec(array, environ, directory.toFile());
- InputStream in = p.getInputStream();
- BufferedReader reader = new BufferedReader(new InputStreamReader(in));
- // Swallow the output
- String line;
- try {
- while ((line = reader.readLine()) != null) {
- log.add(line);
- i++;
- }
- } catch (IOException e) {
- }
- try {
- in.close();
- } catch (IOException e) {
- }
- p.destroy();
- log.trimToSize();
- } catch (IOException e1) {
- i = IProgressMonitor.UNKNOWN;
- }
- monitor.beginTask("", i);
- }
-
- /**
- * @see java.io.OutputStream#close()
- */
- public void close() throws IOException {
- if (console != null) {
- console.close();
- }
- monitor.done();
- }
-
- /**
- * @see java.io.OutputStream#flush()
- */
- public void flush() throws IOException {
- if (console != null) {
- console.flush();
- }
- }
-
- /**
- * @see java.io.OutputStream#write(int)
- */
- public synchronized void write(int b) throws IOException {
- currentLine.append((char) b);
- checkProgress(false);
- if (console != null) {
- console.write(b);
- }
- }
-
- /**
- * @see java.io.OutputStream#write(...)
- */
- public synchronized void write(byte[] b, int off, int len) throws IOException {
- if (b == null) {
- throw new NullPointerException();
- } else if (off != 0 || (len < 0) || (len > b.length)) {
- throw new IndexOutOfBoundsException();
- } else if (len == 0) {
- return;
- }
- currentLine.append(new String(b, 0, len));
- checkProgress(false);
- if (console != null) {
- console.write(b, off, len);
- }
- }
-
- private void checkProgress(boolean flush) {
- String buffer = currentLine.toString();
- int i = 0;
- while ((i = buffer.indexOf("\n")) != -1) {
- String line = buffer.substring(0, i).trim(); // get rid of any trailing \r
- processLine(line);
- buffer = buffer.substring(i + 1); // skip the \n and advance
- }
- currentLine.setLength(0);
- if (flush) {
- if (buffer.length() > 0) {
- processLine(buffer);
- }
- } else {
- currentLine.append(buffer);
- }
- }
-
- private void processLine(String line) {
- int found = -1;
- for (int i = 0; i < log.size(); i++) {
- String s = (String)log.get(i);
- if (s.startsWith(line)) {
- found = i;
- break;
- }
- }
-
- if (found != -1) {
- String show = (String)log.get(found);
- if (show.length() > 50) {
- show = show.substring(0, 50);
- }
- monitor.subTask(show);
- monitor.worked(found + 1);
- log.removeInterval(0, found + 1);
- }
- }
-}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java
deleted file mode 100644
index 4139da1b405..00000000000
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Created on 19-Aug-2003
- *
- * Copyright (c) 2002,2003 QNX Software Systems Ltd.
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.core;
-
-import java.util.HashMap;
-
-import org.eclipse.cdt.make.core.IMakeBuilderInfo;
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-
-public class MakeTarget implements IMakeTarget {
-
- private String target;
- private String buildArguments;
- private IPath buildCommand;
- private boolean isDefaultBuildCmd;
- private boolean isStopOnError;
- private String name;
- private String targetBuilderID;
- private IContainer container;
- private MakeTargetManager manager;
-
- MakeTarget(MakeTargetManager manager, IProject project, String targetBuilderID, String name) throws CoreException {
- this.manager = manager;
- this.targetBuilderID = targetBuilderID;
- this.name = name;
- IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(project, manager.getBuilderID(targetBuilderID));
- buildCommand = info.getBuildCommand();
- buildArguments = info.getBuildArguments();
- isDefaultBuildCmd = info.isDefaultBuildCmd();
- isStopOnError = info.isStopOnError();
- }
-
- public void setContainer(IContainer container) {
- this.container = container;
- }
-
- void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public String getTargetBuilderID() {
- return targetBuilderID;
- }
-
- public boolean isStopOnError() {
- return isStopOnError;
- }
-
- public void setStopOnError(boolean stopOnError) {
- isStopOnError = stopOnError;
- }
-
- public boolean isDefaultBuildCmd() {
- return isDefaultBuildCmd;
- }
-
- public void setUseDefaultBuildCmd(boolean useDefault) {
- isDefaultBuildCmd = useDefault;
- }
-
- public IPath getBuildCommand() {
- return buildCommand != null ? buildCommand: new Path("");
- }
-
- public void setBuildCommand(IPath command) {
- buildCommand = command;
- }
-
- public String getBuildArguments() {
- return buildArguments != null ? buildArguments : "";
- }
-
- public void setBuildArguments(String arguments) {
- buildArguments = arguments;
- }
-
- public IContainer getContainer() {
- return container;
- }
-
- public boolean equals(Object obj) {
- if (obj == this)
- return true;
- if (obj instanceof MakeTarget) {
- MakeTarget other = (MakeTarget) obj;
- return container.equals(other.getContainer()) && name.equals(other.getName());
- }
- return false;
- }
-
- public int hashCode() {
- return container.hashCode() * 17 + name.hashCode();
- }
-
- public void build(IProgressMonitor monitor) throws CoreException {
- IProject project = container.getProject();
- String builderID = manager.getBuilderID(targetBuilderID);
- HashMap infoMap = new HashMap();
- IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(infoMap, builderID);
- if ( buildArguments != null) {
- info.setBuildArguments(buildArguments);
- }
- if ( buildCommand != null ) {
- info.setBuildCommand(buildCommand);
- }
- info.setUseDefaultBuildCmd(isDefaultBuildCmd);
- info.setStopOnError(isStopOnError);
- info.setFullBuildEnable(true);
- info.setFullBuildTarget(target);
- if ( container != null) {
- info.setBuildLocation(container.getFullPath());
- }
- IMakeBuilderInfo projectInfo = MakeCorePlugin.createBuildInfo(project, builderID);
- info.setErrorParsers(projectInfo.getErrorParsers());
- project.build(IncrementalProjectBuilder.FULL_BUILD, builderID, infoMap, monitor);
- }
-
- public void setBuildTarget(String target) {
- this.target = target;
-
- }
-
- public String getBuildTarget() {
- return target;
- }
-}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTargetManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTargetManager.java
deleted file mode 100644
index edaa4c7d2a2..00000000000
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTargetManager.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.core;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Vector;
-import java.util.Map.Entry;
-
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.core.IMakeTargetListener;
-import org.eclipse.cdt.make.core.IMakeTargetManager;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.core.MakeTargetEvent;
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-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.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-public class MakeTargetManager implements IMakeTargetManager, IResourceChangeListener {
- private static String TARGET_BUILD_EXT = "MakeTargetBuilder"; //$NON-NLS-1$
-
- private static String TARGETS_EXT = "targets"; //$NON-NLS-1$
-
- private ListenerList listeners = new ListenerList();
- private HashMap projectMap = new HashMap();
- private HashMap builderMap;
- protected Vector fProjects = new Vector();
-
- public MakeTargetManager() {
- }
-
- public IMakeTarget createTarget(IProject project, String name, String targetBuilderID) throws CoreException {
- return new MakeTarget(this, project, targetBuilderID, name);
- }
-
- public void addTarget(IContainer container, IMakeTarget target) throws CoreException {
- if (container instanceof IWorkspaceRoot) {
- throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeCorePlugin.getResourceString("MakeTargetManager.add_to_workspace_root"), null)); //$NON-NLS-1$
- }
- if (target.getContainer() != null) {
- throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeCorePlugin.getResourceString("MakeTargetManager.add_temporary_target"), null)); //$NON-NLS-1$
- }
- IProject project = container.getProject();
- ProjectTargets projectTargets = (ProjectTargets)projectMap.get(project);
- if (projectTargets == null) {
- projectTargets = readTargets(project);
- }
- ((MakeTarget)target).setContainer(container);
- projectTargets.add((MakeTarget)target);
- writeTargets(projectTargets);
- notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_ADD, target));
- }
-
- public void removeTarget(IMakeTarget target) throws CoreException {
- IProject project = target.getContainer().getProject();
- ProjectTargets projectTargets = (ProjectTargets)projectMap.get(project);
- if (projectTargets == null) {
- projectTargets = readTargets(project);
- }
- projectTargets.remove(target);
- writeTargets(projectTargets);
- notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_REMOVED, target));
- }
-
- public void renameTarget(IMakeTarget target, String name) throws CoreException {
- IProject project = target.getContainer().getProject();
- ProjectTargets projectTargets = (ProjectTargets)projectMap.get(project);
- if (projectTargets == null) {
- projectTargets = readTargets(project);
- }
- if (!projectTargets.contains((MakeTarget)target)) {
- throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeCorePlugin.getResourceString("MakeTargetManager.target_exists"), null)); //$NON-NLS-1$
- }
- ((MakeTarget)target).setName(name);
- writeTargets(projectTargets);
- notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_CHANGED, target));
- }
-
- public IMakeTarget[] getTargets(IContainer container) throws CoreException {
- ProjectTargets projectTargets = (ProjectTargets)projectMap.get(container.getProject());
- if (projectTargets == null) {
- projectTargets = readTargets(container.getProject());
- }
- return projectTargets.get(container);
- }
-
- public IMakeTarget findTarget(IContainer container, String name) {
- ProjectTargets projectTargets = (ProjectTargets)projectMap.get(container.getProject());
- if (projectTargets == null) {
- projectTargets = readTargets(container.getProject());
- }
- return projectTargets.findTarget(container, name);
- }
-
- public IProject[] getTargetBuilderProjects() throws CoreException {
- return (IProject[])fProjects.toArray(new IProject[fProjects.size()]);
- }
-
- public String[] getTargetBuilders(IProject project) {
- if (fProjects.contains(project) || hasTargetBuilder(project)) {
- try {
- Vector ids = new Vector();
- IProjectDescription description = project.getDescription();
- ICommand builder[] = description.getBuildSpec();
- for (int i = 0; i < builder.length; i++) {
- Iterator entries = builderMap.entrySet().iterator();
- while (entries.hasNext()) {
- Map.Entry entry = (Entry)entries.next();
- if (entry.getValue().equals(builder[i].getBuilderName())) {
- ids.add(entry.getKey());
- }
- }
- }
- return (String[])ids.toArray(new String[ids.size()]);
- } catch (CoreException e) {
- }
- }
- return new String[0];
- }
-
- public boolean hasTargetBuilder(IProject project) {
- try {
- if (project.isAccessible()) {
- IProjectDescription description = project.getDescription();
- ICommand builder[] = description.getBuildSpec();
- for (int j = 0; j < builder.length; j++) {
- if (builderMap.containsValue(builder[j].getBuilderName())) {
- return true;
- }
- }
- }
- } catch (CoreException e) {
- }
- return false;
- }
-
- public void startup() {
- initializeBuilders();
- IProject project[] = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for (int i = 0; i < project.length; i++) {
- if (hasTargetBuilder(project[i])) {
- fProjects.add(project[i]);
- }
- }
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
- }
-
- public void shutdown() {
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
- }
-
- public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta delta = event.getDelta();
- if (delta != null) {
- try {
- delta.accept(new MakeTargetVisitor());
- } catch (CoreException e) {
- MakeCorePlugin.log(e);
- }
- }
- }
-
- class MakeTargetVisitor implements IResourceDeltaVisitor {
- /**
- * @see IResourceDeltaVisitor#visit(IResourceDelta)
- */
- public boolean visit(IResourceDelta delta) {
- if (delta == null) {
- return false;
- }
- IResource resource = delta.getResource();
- if (resource.getType() == IResource.PROJECT) {
- IProject project = (IProject)resource;
- int flags = delta.getFlags();
- int deltaKind = delta.getKind();
- if (deltaKind == IResourceDelta.ADDED) {
- if (hasTargetBuilder(project)) {
- fProjects.add(project);
- notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
- }
- } else if (deltaKind == IResourceDelta.REMOVED) {
- if (fProjects.contains(project)) {
- deleteTargets(project);
- fProjects.remove(project);
- notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
- }
- } else if (deltaKind == IResourceDelta.CHANGED) {
- if (0 != (flags & IResourceDelta.DESCRIPTION)) {
- if (fProjects.contains(project) && !hasTargetBuilder(project)) {
- fProjects.remove(project);
- projectMap.remove(project);
- notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
- } else if (!fProjects.contains(project) && hasTargetBuilder(project)) {
- fProjects.add(project);
- notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
- }
- }
- if (0 != (flags & IResourceDelta.OPEN)) {
- if (!project.isOpen() && fProjects.contains(project)) {
- fProjects.remove(project);
- projectMap.remove(project);
- notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
- } else if (project.isOpen() && hasTargetBuilder(project) && !fProjects.contains(project)) {
- fProjects.add(project);
- notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
- }
- }
- }
- return false;
- }
- return resource instanceof IWorkspaceRoot;
- }
- }
-
- protected void writeTargets(ProjectTargets projectTargets) throws CoreException {
- IPath targetFilePath =
- MakeCorePlugin.getDefault().getStateLocation().append(projectTargets.getProject().getName()).addFileExtension(
- TARGETS_EXT);
- File targetFile = targetFilePath.toFile();
- try {
- FileOutputStream file = new FileOutputStream(targetFile);
- projectTargets.saveTargets(file);
- } catch (IOException e) {
- throw new CoreException(
- new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, "Error writing target file", e));
- }
- }
-
- protected ProjectTargets readTargets(IProject project) {
- IPath targetFilePath =
- MakeCorePlugin.getDefault().getStateLocation().append(project.getName()).addFileExtension(TARGETS_EXT);
- File targetFile = targetFilePath.toFile();
- ProjectTargets projectTargets = null;
- if (targetFile.exists()) {
- try {
- projectTargets = new ProjectTargets(this, project, new FileInputStream(targetFile));
- } catch (FileNotFoundException e) {
- }
- }
- if (projectTargets == null) {
- projectTargets = new ProjectTargets(this, project);
- }
- projectMap.put(project, projectTargets);
- return projectTargets;
- }
-
- protected void deleteTargets(IProject project) {
- IPath targetFilePath =
- MakeCorePlugin.getDefault().getStateLocation().append(project.getName()).addFileExtension(TARGETS_EXT);
- File targetFile = targetFilePath.toFile();
- if (targetFile.exists()) {
- targetFile.delete();
- }
- projectMap.remove(project);
- }
-
- protected void initializeBuilders() {
- builderMap = new HashMap();
- IExtensionPoint point = MakeCorePlugin.getDefault().getDescriptor().getExtensionPoint(MakeTargetManager.TARGET_BUILD_EXT);
- IExtension[] ext = point.getExtensions();
- for (int i = 0; i < ext.length; i++) {
- IConfigurationElement[] element = ext[i].getConfigurationElements();
- for (int j = 0; j < element.length; j++) {
- if (element[j].getName().equals("builder")) { //$NON-NLS-1$
- String builderID = element[j].getAttribute("builderID"); //$NON-NLS-1$
- String targetID = element[j].getAttribute("id"); //$NON-NLS-1$
- builderMap.put(targetID, builderID);
- }
- }
- }
- }
-
- protected void notifyListeners(MakeTargetEvent event) {
- Object[] list = listeners.getListeners();
- for (int i = 0; i < list.length; i++) {
- ((IMakeTargetListener)list[i]).targetChanged(event);
- }
- }
-
- public void addListener(IMakeTargetListener listener) {
- listeners.add(listener);
- }
-
- public void removeListener(IMakeTargetListener listener) {
- listeners.remove(listeners);
- }
-
- public String getBuilderID(String targetBuilderID) {
- return (String)builderMap.get(targetBuilderID);
- }
-}
\ No newline at end of file
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/ProjectTargets.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/ProjectTargets.java
deleted file mode 100644
index a8a8c32fd0a..00000000000
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/ProjectTargets.java
+++ /dev/null
@@ -1,242 +0,0 @@
-package org.eclipse.cdt.make.internal.core;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.xerces.dom.DocumentImpl;
-import org.apache.xml.serialize.Method;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.Serializer;
-import org.apache.xml.serialize.SerializerFactory;
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class ProjectTargets {
-
- private static final String BUILD_TARGET_ELEMENT = "buildTargets"; //$NON-NLS-1$
- private static final String TARGET_ELEMENT = "target"; //$NON-NLS-1$
- private static final String TARGET_ATTR_ID = "targetID"; //$NON-NLS-1$
- private static final String TARGET_ATTR_PATH = "path";
- private static final String TARGET_ATTR_NAME = "name";
- private static final String TARGET_STOP_ON_ERROR = "stopOnError";
- private static final String TARGET_USE_DEFAULT_CMD = "useDefaultCommand";
- private static final String TARGET_ARGUMENTS = "buildArguments";
- private static final String TARGET_COMMAND = "buildCommand";
- private static final String TARGET = "buidlTarget";
-
- private HashMap targetMap = new HashMap();
-
- private IProject project;
- private MakeTargetManager manager;
-
- public ProjectTargets(MakeTargetManager manager, IProject project) {
- this.project = project;
- this.manager = manager;
- }
-
- public ProjectTargets(MakeTargetManager manager, IProject project, InputStream input) {
- this(manager, project);
-
- Document document = null;
- try {
- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- document = parser.parse(input);
- } catch (Exception e) {
- MakeCorePlugin.log(e);
- }
- Node node = document.getFirstChild();
- if (node.getNodeName().equals(BUILD_TARGET_ELEMENT)) {
- NodeList list = node.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- node = list.item(i);
- if (node.getNodeName().equals(TARGET_ELEMENT)) {
- IContainer container = null;
- NamedNodeMap attr = node.getAttributes();
- String path = attr.getNamedItem(TARGET_ATTR_PATH).getNodeValue();
- if (path != null && !path.equals("")) {
- container = project.getFolder(path);
- } else {
- container = project;
- }
- try {
- MakeTarget target =
- new MakeTarget(
- manager,
- project,
- attr.getNamedItem(TARGET_ATTR_ID).getNodeValue(),
- attr.getNamedItem(TARGET_ATTR_NAME).getNodeValue());
- target.setContainer(container);
- String option = getString(node, TARGET_STOP_ON_ERROR);
- if (option != null) {
- target.setStopOnError(Boolean.valueOf(option).booleanValue());
- }
- option = getString(node, TARGET_USE_DEFAULT_CMD);
- if (option != null) {
- target.setUseDefaultBuildCmd(Boolean.valueOf(option).booleanValue());
- }
- option = getString(node, TARGET_COMMAND);
- if (option != null) {
- target.setBuildCommand(new Path(option));
- }
- option = getString(node, TARGET_ARGUMENTS);
- if (option != null) {
- target.setBuildArguments(option);
- }
- option = getString(node, TARGET);
- if (option != null) {
- target.setBuildTarget(option);
- }
- add(target);
- } catch (CoreException e) {
- MakeCorePlugin.log(e);
- }
- }
- }
- }
- }
-
- protected String getString(Node target, String tagName) {
- Node node = searchNode(target, tagName);
- return node != null ? (node.getFirstChild() == null ? null : node.getFirstChild().getNodeValue()) : null;
- }
-
- protected Node searchNode(Node target, String tagName) {
- NodeList list = target.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- if (list.item(i).getNodeName().equals(tagName))
- return list.item(i);
- }
- return null;
- }
-
- public IMakeTarget[] get(IContainer container) {
- ArrayList list = (ArrayList)targetMap.get(container);
- if (list != null) {
- return (IMakeTarget[])list.toArray(new IMakeTarget[list.size()]);
- }
- return new IMakeTarget[0];
- }
-
- public IMakeTarget findTarget(IContainer container, String name) {
- ArrayList list = (ArrayList)targetMap.get(container);
- if (list != null) {
- Iterator targets = list.iterator();
- while (targets.hasNext()) {
- IMakeTarget target = (IMakeTarget)targets.next();
- if (target.getName().equals(name)) {
- return target;
- }
- }
- }
- return null;
- }
-
- public void add(MakeTarget target) throws CoreException {
- ArrayList list = (ArrayList)targetMap.get(target.getContainer());
- if (list != null && list.contains(target)) {
- throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeCorePlugin.getResourceString("MakeTargetManager.target_exists"), null)); //$NON-NLS-1$
- }
- if (list == null) {
- list = new ArrayList();
- targetMap.put(target.getContainer(), list);
- }
- list.add(target);
- }
-
- public boolean contains(MakeTarget target) {
- ArrayList list = (ArrayList)targetMap.get(target.getContainer());
- if (list != null && list.contains(target)) {
- return true;
- }
- return false;
- }
-
- public void remove(IMakeTarget target) {
- ArrayList list = (ArrayList)targetMap.get(target.getContainer());
- if (list == null || !list.contains(target)) {
- return;
- }
- list.remove(target);
- if (list.size() == 0) {
- targetMap.remove(list);
- }
- }
-
- public IProject getProject() {
- return project;
- }
-
- protected Document getAsXML() throws IOException {
- Document doc = new DocumentImpl();
- Element targetsRootElement = doc.createElement(BUILD_TARGET_ELEMENT);
- doc.appendChild(targetsRootElement);
- Iterator container = targetMap.entrySet().iterator();
- while (container.hasNext()) {
- List targets = (List) ((Map.Entry)container.next()).getValue();
- for (int i = 0; i < targets.size(); i++) {
- MakeTarget target = (MakeTarget)targets.get(i);
- targetsRootElement.appendChild(createTargetElement(doc, target));
- }
- }
- return doc;
- }
-
- private Node createTargetElement(Document doc, MakeTarget target) {
- Element targetElem = doc.createElement(TARGET_ELEMENT);
- targetElem.setAttribute(TARGET_ATTR_NAME, target.getName());
- targetElem.setAttribute(TARGET_ATTR_ID, target.getTargetBuilderID());
- targetElem.setAttribute(TARGET_ATTR_PATH, target.getContainer().getProjectRelativePath().toString());
- Element elem = doc.createElement(TARGET_COMMAND);
- targetElem.appendChild(elem);
- elem.appendChild(doc.createTextNode(target.getBuildCommand().toString()));
-
- elem = doc.createElement(TARGET_ARGUMENTS);
- elem.appendChild(doc.createTextNode(target.getBuildArguments()));
- targetElem.appendChild(elem);
-
- elem = doc.createElement(TARGET);
- elem.appendChild(doc.createTextNode(target.getBuildTarget()));
- targetElem.appendChild(elem);
-
- elem = doc.createElement(TARGET_STOP_ON_ERROR);
- elem.appendChild(doc.createTextNode(new Boolean(target.isStopOnError()).toString()));
- targetElem.appendChild(elem);
-
- elem = doc.createElement(TARGET_USE_DEFAULT_CMD);
- elem.appendChild(doc.createTextNode(new Boolean(target.isDefaultBuildCmd()).toString()));
- targetElem.appendChild(elem);
- return targetElem;
- }
-
- public void saveTargets(OutputStream output) throws IOException {
- Document doc = getAsXML();
- OutputFormat format = new OutputFormat();
- format.setIndenting(true);
- format.setPreserveSpace(true);
- format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$
- Serializer serializer =
- SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(new OutputStreamWriter(output, "UTF8"), format);
- serializer.asDOMSerializer().serialize(doc);
- }
-}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/StreamMonitor.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/StreamMonitor.java
deleted file mode 100644
index 32e1dcd0ca5..00000000000
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/StreamMonitor.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.core;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class StreamMonitor extends OutputStream {
-
- IProgressMonitor monitor;
- OutputStream console;
- public final int fTotalWork;
- private int halfWay;
- private int currentIncrement = 2;
- private int nextProgress = currentIncrement;
- private int worked = 0;
-
- public StreamMonitor(IProgressMonitor mon, OutputStream cos, int totalWork) {
- monitor = mon;
- console = cos;
- fTotalWork = totalWork;
- halfWay = fTotalWork / 2;
- monitor.beginTask("", fTotalWork);
- }
-
- private void progressUpdate() {
- if (--nextProgress <= 0) {
- //we have exhausted the current increment, so report progress
- if (fTotalWork > worked) {
- monitor.worked(1);
- }
- worked++;
- if (worked >= halfWay) {
- //we have passed the current halfway point, so double the
- //increment and reset the halfway point.
- currentIncrement *= 2;
- halfWay += (fTotalWork - halfWay) / 2;
- }
- //reset the progress counter to another full increment
- nextProgress = currentIncrement;
- }
- }
- /**
- * @see java.io.OutputStream#close()
- */
- public void close() throws IOException {
- if (console != null) {
- console.close();
- }
- monitor.done();
- }
-
- /**
- * @see java.io.OutputStream#flush()
- */
- public void flush() throws IOException {
- if (console != null) {
- console.flush();
- }
- }
-
- /**
- * @see java.io.OutputStream#write(int)
- */
- public synchronized void write(int b) throws IOException {
- if (console != null) {
- console.write(b);
- }
- progressUpdate();
- }
-
- /**
- * @see java.io.OutputStream#write(...)
- */
- public synchronized void write(byte[] b, int off, int len) throws IOException {
- if (b == null) {
- throw new NullPointerException();
- } else if (off != 0 || (len < 0) || (len > b.length)) {
- throw new IndexOutOfBoundsException();
- } else if (len == 0) {
- return;
- }
- if (console != null) {
- console.write(b, off, len);
- }
- progressUpdate();
- }
-
- public int getWorkDone() {
- return worked;
- }
-}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java
deleted file mode 100644
index 7c4467080ee..00000000000
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.core.makefile;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.make.core.makefile.IInferenceRule;
-import org.eclipse.cdt.make.core.makefile.IMacroDefinition;
-import org.eclipse.cdt.make.core.makefile.IMakefile;
-import org.eclipse.cdt.make.core.makefile.IRule;
-import org.eclipse.cdt.make.core.makefile.IDirective;
-import org.eclipse.cdt.make.core.makefile.ITargetRule;
-
-/**
- * Makefile : ( statement ) *
- * statement : rule | macro_definition | comments | empty
- * rule : inference_rule | target_rule
- * inference_rule : target ':' 10th July, 2002
-Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. -For purposes of the CPL, "Program" will mean the Content.
- -If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.
- -If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.
- - - \ No newline at end of file diff --git a/build/org.eclipse.cdt.make.ui/build.properties b/build/org.eclipse.cdt.make.ui/build.properties deleted file mode 100644 index e1ced3c43d8..00000000000 --- a/build/org.eclipse.cdt.make.ui/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -bin.includes = plugin.xml,\ - *.jar,\ - cdtmakeui.jar,\ - icons/,\ - *.html,\ - plugin.properties -source.cdtmakeui.jar = src/ diff --git a/build/org.eclipse.cdt.make.ui/icons/actions/build_menu.gif b/build/org.eclipse.cdt.make.ui/icons/actions/build_menu.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/actions/build_menu.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/alphab_sort_co.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/alphab_sort_co.gif deleted file mode 100644 index 6d772441d0d..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/ctool16/alphab_sort_co.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/convert-normal.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/convert-normal.gif deleted file mode 100644 index 80c3f8cbc5c..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/ctool16/convert-normal.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/make.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/make.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/ctool16/make.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/makefile.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/makefile.gif deleted file mode 100644 index 20e7baed143..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/ctool16/makefile.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/newc_app.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/newc_app.gif deleted file mode 100644 index 6c2d75db2e6..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/ctool16/newc_app.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/newcc_app.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/newcc_app.gif deleted file mode 100644 index 86d78df150f..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/ctool16/newcc_app.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/segment_edit.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/segment_edit.gif deleted file mode 100644 index be9eb921513..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/ctool16/segment_edit.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/target_add.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/target_add.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/ctool16/target_add.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/target_build.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/target_build.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/ctool16/target_build.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/target_delete.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/target_delete.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/ctool16/target_delete.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/target_edit.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/target_edit.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/ctool16/target_edit.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/update_old.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/update_old.gif deleted file mode 100644 index 9d5a508bc49..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/ctool16/update_old.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/cview16/make_target.gif b/build/org.eclipse.cdt.make.ui/icons/cview16/make_target.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/cview16/make_target.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/dtool16/alphab_sort_co.gif b/build/org.eclipse.cdt.make.ui/icons/dtool16/alphab_sort_co.gif deleted file mode 100644 index 62a8fdb555b..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/dtool16/alphab_sort_co.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/dtool16/segment_edit.gif b/build/org.eclipse.cdt.make.ui/icons/dtool16/segment_edit.gif deleted file mode 100644 index 6844777924f..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/dtool16/segment_edit.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/dtool16/target_add.gif b/build/org.eclipse.cdt.make.ui/icons/dtool16/target_add.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/dtool16/target_add.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/dtool16/target_build.gif b/build/org.eclipse.cdt.make.ui/icons/dtool16/target_build.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/dtool16/target_build.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/dtool16/target_delete.gif b/build/org.eclipse.cdt.make.ui/icons/dtool16/target_delete.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/dtool16/target_delete.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/dtool16/target_edit.gif b/build/org.eclipse.cdt.make.ui/icons/dtool16/target_edit.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/dtool16/target_edit.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/etool16/alphab_sort_co.gif b/build/org.eclipse.cdt.make.ui/icons/etool16/alphab_sort_co.gif deleted file mode 100644 index 9d38f6dff8a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/etool16/alphab_sort_co.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/etool16/segment_edit.gif b/build/org.eclipse.cdt.make.ui/icons/etool16/segment_edit.gif deleted file mode 100644 index e292fe5ef18..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/etool16/segment_edit.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/etool16/target_add.gif b/build/org.eclipse.cdt.make.ui/icons/etool16/target_add.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/etool16/target_add.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/etool16/target_build.gif b/build/org.eclipse.cdt.make.ui/icons/etool16/target_build.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/etool16/target_build.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/etool16/target_delete.gif b/build/org.eclipse.cdt.make.ui/icons/etool16/target_delete.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/etool16/target_delete.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/etool16/target_edit.gif b/build/org.eclipse.cdt.make.ui/icons/etool16/target_edit.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/etool16/target_edit.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/obj16/command_obj.gif b/build/org.eclipse.cdt.make.ui/icons/obj16/command_obj.gif deleted file mode 100644 index f13e465665b..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/obj16/command_obj.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/obj16/error_obj.gif b/build/org.eclipse.cdt.make.ui/icons/obj16/error_obj.gif deleted file mode 100644 index b04020bc723..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/obj16/error_obj.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/obj16/include_obj.gif b/build/org.eclipse.cdt.make.ui/icons/obj16/include_obj.gif deleted file mode 100644 index 0c5f2085409..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/obj16/include_obj.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/obj16/irule_obj.gif b/build/org.eclipse.cdt.make.ui/icons/obj16/irule_obj.gif deleted file mode 100644 index a9a08d038fd..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/obj16/irule_obj.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/obj16/macro_obj.gif b/build/org.eclipse.cdt.make.ui/icons/obj16/macro_obj.gif deleted file mode 100644 index c12970d2b48..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/obj16/macro_obj.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/obj16/relation_obj.gif b/build/org.eclipse.cdt.make.ui/icons/obj16/relation_obj.gif deleted file mode 100644 index 11b6f337fb8..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/obj16/relation_obj.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/obj16/target_obj.gif b/build/org.eclipse.cdt.make.ui/icons/obj16/target_obj.gif deleted file mode 100644 index 3fc40d6a13a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/obj16/target_obj.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/obj16/trule_obj.gif b/build/org.eclipse.cdt.make.ui/icons/obj16/trule_obj.gif deleted file mode 100644 index 64c522da372..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/obj16/trule_obj.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/icons/wizban/newcprj_wiz.gif b/build/org.eclipse.cdt.make.ui/icons/wizban/newcprj_wiz.gif deleted file mode 100644 index 60ccf9c7c6a..00000000000 Binary files a/build/org.eclipse.cdt.make.ui/icons/wizban/newcprj_wiz.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.make.ui/plugin.properties b/build/org.eclipse.cdt.make.ui/plugin.properties deleted file mode 100644 index edfa9a4e7e0..00000000000 --- a/build/org.eclipse.cdt.make.ui/plugin.properties +++ /dev/null @@ -1,48 +0,0 @@ -pluginName=C/C++ Standard make Build UI -providerName=Eclipse.org - -WizardNewCMakeProject.name=Standard Make C Project -WizardNewCMakeProject.description=Create a new C Project which uses a simple makefile. - -WizardNewCCMakeProject.name=Standard Make C++ Project -WizardNewCCMakeProject.description=Create a new C++ Project which uses a simple makefile. - -WizardConvertMakeProject.name=Convert to a C/C++ Make Project -WizardConvertMakeProject.description=Convert to a C/C++ Project which uses a simple makefile - -ActionMakeCreateTarget.label=Create Make Target... -ActionMakeBuildTarget.label=Build Make Target... - -ActionMakeUpdate.label=Update Old Make Project... -ActionMakeUpdate.tooltip=Update Old Make Project - -CommandTargetBuild.name=Make Target Build -CommandTargetBuild.description=Invoke a make target build for the selected container. -CommandTargetCreate.name=Create Make Target -CommandTargetCreate.description=Create a new make build target for the selected container. - -PreferenceMakeProject.name=New Make Projects - -PropertyMakeProject.name= C/C++ Make Project - -ViewCatagoryMake.name=Make -ViewMake.name=Make Targets - -ActionSetMake.label=Make Actions -ActionSetUpdateMake.label=Update Make Projects - -# Scope and Key Commands -scope.makefileEditor.name=Makefile Editor -makefileEditor.description=Editor for Makefile Files - -category.source.name=Makefile Source -category.source.description= Makefile Source Actions - -ActionDefinition.comment.name= Comment -ActionDefinition.comment.description= Turn the selected lines into # style comments - -ActionDefinition.uncomment.name= Uncomment -ActionDefinition.uncomment.description= Uncomment the selected # style comment lines - -MakefileEditor.name=Makefile Editor - diff --git a/build/org.eclipse.cdt.make.ui/plugin.xml b/build/org.eclipse.cdt.make.ui/plugin.xml deleted file mode 100644 index 7bed92a07d9..00000000000 --- a/build/org.eclipse.cdt.make.ui/plugin.xml +++ /dev/null @@ -1,402 +0,0 @@ - - -null
if none
- */
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
- return getDefault().getWorkbench().getActiveWorkbenchWindow();
- }
-
- /**
- * Returns the active workbench page or null
if none.
- */
- public static IWorkbenchPage getActivePage() {
- IWorkbenchWindow window= getActiveWorkbenchWindow();
- if (window != null) {
- return window.getActivePage();
- }
- return null;
- }
-
- /**
- * Returns the string from the plugin's resource bundle,
- * or 'key' if not found.
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle = MakeUIPlugin.getDefault().getResourceBundle();
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-
- /**
- * Convenience method which returns the unique identifier of this plugin.
- */
- public static String getUniqueIdentifier() {
- if (getDefault() == null) {
- // If the default instance is not yet initialized,
- // return a static identifier. This identifier must
- // match the plugin id defined in plugin.xml
- return "org.eclipse.cdt.make.ui"; //$NON-NLS-1$
- }
- return getDefault().getDescriptor().getUniqueIdentifier();
- }
-
- public static void log(IStatus status) {
- ResourcesPlugin.getPlugin().getLog().log(status);
- }
-
- public static void logErrorMessage(String message) {
- log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, message, null));
- }
-
- public static void logException(Throwable e, final String title, String message) {
- if (e instanceof InvocationTargetException) {
- e = ((InvocationTargetException) e).getTargetException();
- }
- IStatus status = null;
- if (e instanceof CoreException)
- status = ((CoreException) e).getStatus();
- else {
- if (message == null)
- message = e.getMessage();
- if (message == null)
- message = e.toString();
- status = new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.OK, message, e);
- }
- ResourcesPlugin.getPlugin().getLog().log(status);
- Display display;
- display = Display.getCurrent();
- if (display == null)
- display = Display.getDefault();
- final IStatus fstatus = status;
- display.asyncExec(new Runnable() {
- public void run() {
- ErrorDialog.openError(null, title, null, fstatus);
- }
- });
- }
-
- public static void logException(Throwable e) {
- logException(e, null, null);
- }
-
- public static void log(Throwable e) {
- if (e instanceof InvocationTargetException)
- e = ((InvocationTargetException) e).getTargetException();
- IStatus status = null;
- if (e instanceof CoreException)
- status = ((CoreException) e).getStatus();
- else
- status = new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.OK, e.getMessage(), e);
- log(status);
- }
-
- /**
- * Utility method with conventions
- */
- public static void errorDialog(Shell shell, String title, String message, IStatus s) {
- log(s);
- // if the 'message' resource string and the IStatus' message are the same,
- // don't show both in the dialog
- if (s != null && message.equals(s.getMessage())) {
- message = null;
- }
- ErrorDialog.openError(shell, title, message, s);
- }
-
- /**
- * Utility method with conventions
- */
- public static void errorDialog(Shell shell, String title, String message, Throwable t) {
- log(t);
- IStatus status;
- if (t instanceof CoreException) {
- status = ((CoreException) t).getStatus();
- // if the 'message' resource string and the IStatus' message are the same,
- // don't show both in the dialog
- if (status != null && message.equals(status.getMessage())) {
- message = null;
- }
- } else {
- status = new Status(IStatus.ERROR, MakeUIPlugin.getUniqueIdentifier(), -1, "Internal Error: ", t); //$NON-NLS-1$
- }
- ErrorDialog.openError(shell, title, message, status);
- }
-
- public void earlyStartup() {
- final IProject[] oldProject = UpdateMakeProjectAction.getOldProjects();
- if (oldProject.length > 0) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (MessageDialog
- .openQuestion(
- getShell(),
- "Update make projects",
- "Older 'make' projects have been detected in your workspace. \n"
- + "These projects are no longer supported, "
- + "would you like to convert these now?")
- == true) {
- ProgressMonitorDialog pd = new ProgressMonitorDialog(getShell());
- UpdateMakeProjectAction.run(false, pd, oldProject);
- }
- }
- });
- }
- return;
-
- }
-
- protected Shell getShell() {
- if (getActiveWorkbenchShell() != null) {
- return getActiveWorkbenchShell();
- } else {
- IWorkbenchWindow[] windows = getDefault().getWorkbench().getWorkbenchWindows();
- return windows[0].getShell();
- }
- }
-
- public synchronized IMakefileDocumentProvider getMakefileDocumentProvider() {
- if (fMakefileDocumentProvider == null) {
- fMakefileDocumentProvider= new MakefileDocumentProvider();
- }
- return fMakefileDocumentProvider;
- }
-
- public synchronized IWorkingCopyManager getWorkingCopyManager() {
- if (fWorkingCopyManager == null) {
- IMakefileDocumentProvider provider= getMakefileDocumentProvider();
- fWorkingCopyManager= new WorkingCopyManager(provider);
- }
- return fWorkingCopyManager;
- }
-
- public void shutdown() throws CoreException {
- super.shutdown();
- if (fWorkingCopyManager != null) {
- fWorkingCopyManager.shutdown();
- fWorkingCopyManager= null;
- }
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MessageLine.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MessageLine.java
deleted file mode 100644
index f839a812cc1..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MessageLine.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.cdt.make.internal.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * A message line. It distinguishs between "normal" messages and errors.
- * Setting an error message hides a currently displayed message until
- * clearErrorMessage
is called.
- */
-public class MessageLine extends CLabel {
-
- private String fMessage;
-
- private Color fNormalMsgAreaBackground;
-
- /**
- * Creates a new message line as a child of the given parent.
- */
- public MessageLine(Composite parent) {
- this(parent, SWT.LEFT);
- }
-
- /**
- * Creates a new message line as a child of the parent and with the given SWT stylebits.
- */
- public MessageLine(Composite parent, int style) {
- super(parent, style);
- fNormalMsgAreaBackground= getBackground();
- }
-
-
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(String message) {
- if (message != null && message.length() > 0) {
- setText(message);
- setImage(MakeUIImages.getImage(MakeUIImages.IMG_OBJS_ERROR));
- setBackground(JFaceColors.getErrorBackground(getDisplay()));
- return;
- }
- setText(fMessage);
- setImage(null);
- setBackground(fNormalMsgAreaBackground);
- }
-
- public void setMessage(String message) {
- fMessage = message;
- setText(message);
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/AddBuildTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/AddBuildTargetAction.java
deleted file mode 100644
index 5e748ab7859..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/AddBuildTargetAction.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.core.IMakeTargetManager;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.core.makefile.ITargetRule;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.ui.dialogs.MakeTargetDialog;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IFileEditorInput;
-
-/**
- */
-public class AddBuildTargetAction extends Action {
-
- MakefileContentOutlinePage fOutliner;
- static final ITargetRule[] EMPTY_TARGET_RULES = {};
-
- public AddBuildTargetAction(MakefileContentOutlinePage outliner) {
- super("Add To Build Target");
- setDescription("Add To Build Target");
- setToolTipText("Add To Build Target");
- fOutliner = outliner;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- IMakeTargetManager manager = MakeCorePlugin.getDefault().getTargetManager();
- IFile file = getFile();
- Shell shell = fOutliner.getControl().getShell();
- ITargetRule[] rules = getTargetRules(fOutliner.getSelection());
- if (file != null && rules.length > 0 && shell != null) {
- StringBuffer sbBuildName = new StringBuffer();
- StringBuffer sbMakefileTarget = new StringBuffer();
- for (int i = 0; i < rules.length; i++) {
- String name = rules[i].getTarget().toString().trim();
- if (sbBuildName.length() == 0) {
- sbBuildName.append(name);
- } else {
- sbBuildName.append('_').append(name);
- }
- if (sbMakefileTarget.length() == 0) {
- sbMakefileTarget.append(name);
- } else {
- sbMakefileTarget.append(' ').append(name);
- }
- }
- String buildName = sbBuildName.toString();
- String makefileTarget = sbMakefileTarget.toString();
- IMakeTarget target = manager.findTarget(file.getParent(), buildName);
- if (target == null) {
- try {
- String[] ids = manager.getTargetBuilders(file.getProject());
- if (ids.length > 0) {
- target = manager.createTarget(file.getProject(), buildName, ids[0]);
- target.setBuildTarget(makefileTarget);
- manager.addTarget(file.getParent(), target);
- }
- } catch (CoreException e) {
- MakeUIPlugin.errorDialog(shell, "Internal Error", "", e);
- target = null;
- }
- }
-
- // Always popup the dialog.
- if (target != null) {
- MakeTargetDialog dialog;
- try {
- dialog = new MakeTargetDialog(shell, target);
- dialog.open();
- } catch (CoreException e) {
- MakeUIPlugin.errorDialog(shell, "Internal Error", "", e);
- }
- }
- }
- }
-
- public boolean canActionBeAdded(ISelection selection) {
- ITargetRule[] rules = getTargetRules(selection);
- for (int i = 0; i < rules.length; i++) {
- IFile file = getFile();
- if (file == null)
- return false;
- if (! MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(file.getProject()))
- return false;
- }
- return true;
- }
-
-
- private IFile getFile() {
- Object input = fOutliner.getInput();
- if (input instanceof IFileEditorInput) {
- return ((IFileEditorInput)input).getFile();
- }
- return null;
- }
-
- private ITargetRule[] getTargetRules(ISelection sel) {
- if (!sel.isEmpty() && sel instanceof IStructuredSelection) {
- List list= ((IStructuredSelection)sel).toList();
- if (list.size() > 0) {
- List targets = new ArrayList(list.size());
- Object[] elements = list.toArray();
- for (int i = 0; i < elements.length; i++) {
- if (elements[i] instanceof ITargetRule) {
- targets.add(elements[i]);
- }
- }
- return (ITargetRule[])targets.toArray(EMPTY_TARGET_RULES);
- }
- }
- return EMPTY_TARGET_RULES;
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/IMakefileDocumentProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/IMakefileDocumentProvider.java
deleted file mode 100644
index baeea749cab..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/IMakefileDocumentProvider.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- */
-package org.eclipse.cdt.make.internal.ui.editor;
-
-import org.eclipse.cdt.make.core.makefile.IMakefile;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-
-/**
- */
-public interface IMakefileDocumentProvider extends IDocumentProvider {
-
- /**
- * Shuts down this provider.
- */
- void shutdown();
-
- /**
- * Returns the working copy for the given element.
- *
- * @param element the element
- * @return the working copy for the given element
- */
- IMakefile getWorkingCopy(Object element);
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/IMakefileEditorActionDefinitionIds.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/IMakefileEditorActionDefinitionIds.java
deleted file mode 100644
index 86d9c12ecf4..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/IMakefileEditorActionDefinitionIds.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-
-package org.eclipse.cdt.make.internal.ui.editor;
-
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-
-/**
- */
-public interface IMakefileEditorActionDefinitionIds extends ITextEditorActionDefinitionIds {
-
- String UNCOMMENT = "org.eclipse.cdt.make.ui.edit.text.makefile.comment";
-
- String COMMENT = "org.eclipse.cdt.make.ui.edit.text.makefile.uncomment";
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/LexicalSortingAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/LexicalSortingAction.java
deleted file mode 100644
index 8a726e49010..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/LexicalSortingAction.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * QNX Software Systems - initial implementation
-***********************************************************************/
-
-package org.eclipse.cdt.make.internal.ui.editor;
-
-import org.eclipse.cdt.make.core.makefile.IDirective;
-import org.eclipse.cdt.make.core.makefile.IInferenceRule;
-import org.eclipse.cdt.make.core.makefile.IMacroDefinition;
-import org.eclipse.cdt.make.core.makefile.ISpecialRule;
-import org.eclipse.cdt.make.internal.ui.MakeUIImages;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-public class LexicalSortingAction extends Action {
-
- private static final String ACTION_NAME = "LexicalSortingAction";
- private static final String DIALOG_STORE_KEY = ACTION_NAME + ".sort";
-
- private LexicalMakefileSorter fSorter;
- private TreeViewer fTreeViewer;
-
- public LexicalSortingAction(TreeViewer treeViewer) {
- super(MakeUIPlugin.getResourceString(ACTION_NAME + ".label"));
-
- setDescription(MakeUIPlugin.getResourceString(ACTION_NAME + ".description"));
- setToolTipText(MakeUIPlugin.getResourceString(ACTION_NAME + ".tooltip"));
- MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_ALPHA_SORTING);
-
- fTreeViewer = treeViewer;
- fSorter = new LexicalMakefileSorter();
- boolean checked = MakeUIPlugin.getDefault().getDialogSettings().getBoolean(DIALOG_STORE_KEY);
- valueChanged(checked, false);
- }
-
- public void run() {
- valueChanged(isChecked(), true);
- }
-
- private void valueChanged(boolean on, boolean store) {
- setChecked(on);
- fTreeViewer.setSorter(on ? fSorter : null);
-
- String key = ACTION_NAME + ".tooltip" + (on ? ".on" : ".off");
- setToolTipText(MakeUIPlugin.getResourceString(key));
- if (store) {
- MakeUIPlugin.getDefault().getDialogSettings().put(DIALOG_STORE_KEY, on);
- }
- }
-
- private class LexicalMakefileSorter extends ViewerSorter {
-
- public boolean isSorterProperty(Object element, Object property) {
- return true;
- }
-
- public int category(Object obj) {
- if (obj instanceof IDirective) {
- IDirective directive = (IDirective) obj;
- if (directive instanceof IMacroDefinition) {
- return 0;
- } else if (directive instanceof ISpecialRule) {
- return 1;
- } else if (directive instanceof IInferenceRule) {
- return 2;
- }
- }
- return 3;
- }
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileContentOutlinePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileContentOutlinePage.java
deleted file mode 100644
index c534d670eea..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileContentOutlinePage.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.make.core.makefile.IBadDirective;
-import org.eclipse.cdt.make.core.makefile.ICommand;
-import org.eclipse.cdt.make.core.makefile.IComment;
-import org.eclipse.cdt.make.core.makefile.IDirective;
-import org.eclipse.cdt.make.core.makefile.IEmptyLine;
-import org.eclipse.cdt.make.core.makefile.IInferenceRule;
-import org.eclipse.cdt.make.core.makefile.IMacroDefinition;
-import org.eclipse.cdt.make.core.makefile.IMakefile;
-import org.eclipse.cdt.make.core.makefile.IParent;
-import org.eclipse.cdt.make.core.makefile.IRule;
-import org.eclipse.cdt.make.core.makefile.ITargetRule;
-import org.eclipse.cdt.make.core.makefile.gnu.IInclude;
-import org.eclipse.cdt.make.core.makefile.gnu.ITerminal;
-import org.eclipse.cdt.make.internal.core.makefile.NullMakefile;
-import org.eclipse.cdt.make.internal.ui.MakeUIImages;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.ui.IWorkingCopyManager;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-/**
- * MakefileContentOutlinePage
- */
-public class MakefileContentOutlinePage extends ContentOutlinePage implements IContentOutlinePage {
-
- private class MakefileContentProvider implements ITreeContentProvider {
-
- protected boolean showMacroDefinition = true;
- protected boolean showTargetRule = true;
- protected boolean showInferenceRule = true;
- protected boolean showIncludeChildren = false;
-
- protected IMakefile makefile;
- protected IMakefile nullMakefile = new NullMakefile();
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object element) {
- if (element == fInput) {
- return getElements(makefile);
- } else if (element instanceof IDirective) {
- return getElements(element);
- }
- return new Object[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- */
- public Object getParent(Object element) {
- if (element instanceof IMakefile) {
- return fInput;
- } else if (element instanceof IDirective) {
- return ((IDirective)element).getParent();
- }
- return fInput;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
- public boolean hasChildren(Object element) {
- if (element == fInput) {
- return true;
- } else if (element instanceof IParent) {
- // Do not drill down in includes.
- if (element instanceof IInclude && !showIncludeChildren) {
- return false;
- }
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- IDirective[] directives;
- if (inputElement == fInput) {
- directives = makefile.getDirectives();
- } else if (inputElement instanceof IRule) {
- directives = ((IRule)inputElement).getCommands();
- } else if (inputElement instanceof IParent) {
- if (inputElement instanceof IInclude && !showIncludeChildren) {
- directives = new IDirective[0];
- } else {
- directives = ((IParent)inputElement).getDirectives();
- }
- } else {
- directives = new IDirective[0];
- }
- List list = new ArrayList(directives.length);
- for (int i = 0; i < directives.length; i++) {
- if (showMacroDefinition && directives[i] instanceof IMacroDefinition) {
- list.add(directives[i]);
- } else if (showInferenceRule && directives[i] instanceof IInferenceRule) {
- list.add(directives[i]);
- } else if (showTargetRule && directives[i] instanceof ITargetRule) {
- list.add(directives[i]);
- } else {
- boolean irrelevant = (directives[i] instanceof IComment ||
- directives[i] instanceof IEmptyLine ||
- directives[i] instanceof ITerminal);
- if (!irrelevant) {
- list.add(directives[i]);
- }
- }
- }
- return list.toArray();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (oldInput != null) {
- makefile = nullMakefile;
- }
-
- if (newInput != null) {
- IWorkingCopyManager manager= MakeUIPlugin.getDefault().getWorkingCopyManager();
- makefile = manager.getWorkingCopy((IEditorInput)newInput);
- if (makefile == null) {
- makefile = nullMakefile;
- }
- }
- }
-
- }
-
- private class MakefileLabelProvider extends LabelProvider implements ILabelProvider {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- if (element instanceof ITargetRule) {
- return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_TARGET_RULE);
- } else if (element instanceof IInferenceRule) {
- return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_INFERENCE_RULE);
- } else if (element instanceof IMacroDefinition) {
- return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_MACRO);
- } else if (element instanceof ICommand) {
- return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_COMMAND);
- } else if (element instanceof IInclude) {
- return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_INCLUDE);
- } else if (element instanceof IBadDirective) {
- return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_ERROR);
- } else if (element instanceof IParent) {
- return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_RELATION);
- }
- return super.getImage(element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- String name;
- if (element instanceof IRule) {
- name = ((IRule) element).getTarget().toString().trim();
- } else if (element instanceof IMacroDefinition) {
- name = ((IMacroDefinition) element).getName().trim();
- } else {
- name = super.getText(element);
- }
- if (name != null) {
- name = name.trim();
- if (name.length() > 25) {
- name = name.substring(0, 25) + " ..."; //$NON-NLS-1$
- }
- }
- return name;
- }
-
- }
-
- protected MakefileEditor fEditor;
- protected Object fInput;
- protected AddBuildTargetAction fAddBuildTargetAction;
-
- public MakefileContentOutlinePage(MakefileEditor editor) {
- super();
- fEditor = editor;
- fAddBuildTargetAction = new AddBuildTargetAction(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- super.createControl(parent);
- TreeViewer viewer = getTreeViewer();
- viewer.setContentProvider(new MakefileContentProvider());
- viewer.setLabelProvider(new MakefileLabelProvider());
- if (fInput != null) {
- viewer.setInput(fInput);
- }
-
- MenuManager manager= new MenuManager("#MakefileOutlinerContext");
- manager.setRemoveAllWhenShown(true);
- manager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager m) {
- contextMenuAboutToShow(m);
- }
- });
- Control tree = viewer.getControl();
- Menu menu = manager.createContextMenu(tree);
- tree.setMenu(menu);
-
- IPageSite site= getSite();
- site.registerContextMenu(MakeUIPlugin.getPluginId() + ".outline", manager, viewer); //$NON-NLS-1$
- site.setSelectionProvider(viewer);
-
- }
-
- /**
- * called to create the context menu of the outline
- */
- protected void contextMenuAboutToShow(IMenuManager menu) {
- if (fAddBuildTargetAction.canActionBeAdded(getSelection()))
- menu.add(fAddBuildTargetAction);
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS+"-end"));//$NON-NLS-1$
- }
-
- /**
- * Sets the input of the outline page
- */
- public void setInput(Object input) {
- fInput = input;
- update();
- }
-
- public Object getInput() {
- return fInput;
- }
-
- /**
- * Updates the outline page.
- */
- public void update() {
- final TreeViewer viewer = getTreeViewer();
-
- if (viewer != null) {
- final Control control = viewer.getControl();
- if (control != null && !control.isDisposed()) {
- control.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (!control.isDisposed()) {
- control.setRedraw(false);
- viewer.setInput(fInput);
- viewer.expandAll();
- control.setRedraw(true);
- }
- }
- });
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
- */
- public void setActionBars(IActionBars actionBars) {
- super.setActionBars(actionBars);
- IToolBarManager toolBarManager= actionBars.getToolBarManager();
-
- LexicalSortingAction action= new LexicalSortingAction(getTreeViewer());
- toolBarManager.add(action);
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentProvider.java
deleted file mode 100644
index e347f025e27..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentProvider.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.editor;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.Iterator;
-
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.core.makefile.IMakefile;
-import org.eclipse.cdt.make.internal.ui.text.makefile.MakefilePartitionScanner;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentPartitioner;
-import org.eclipse.jface.text.rules.DefaultPartitioner;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.editors.text.FileDocumentProvider;
-
-/**
- */
-public class MakefileDocumentProvider extends FileDocumentProvider implements IMakefileDocumentProvider {
-
- private static MakefilePartitionScanner scanner = null;
-
- /**
- * Bundle of all required informations to allow working copy management.
- */
- protected class MakefileInfo extends FileInfo {
-
- IMakefile fCopy;
-
- public MakefileInfo(IDocument document, IAnnotationModel model, FileSynchronizer fileSynchronizer, IMakefile copy) {
- super(document, model, fileSynchronizer);
- fCopy = copy;
- }
-
- public void setModificationStamp(long timeStamp) {
- fModificationStamp = timeStamp;
- }
- }
-
- /**
- * Constructor for MakefileDocumentProvider.
- */
- public MakefileDocumentProvider() {
- super();
- }
-
- /**
- * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#createDocument(Object)
- */
- protected IDocument createDocument(Object element) throws CoreException {
- IDocument document = super.createDocument(element);
- if (document != null) {
- IDocumentPartitioner partitioner = createPartitioner();
- partitioner.connect(document);
- document.setDocumentPartitioner(partitioner);
- }
- return document;
- }
-
- private IDocumentPartitioner createPartitioner() {
- return new DefaultPartitioner(getPartitionScanner(), MakefilePartitionScanner.TYPES);
- }
-
- private MakefilePartitionScanner getPartitionScanner() {
- if (scanner == null)
- scanner = new MakefilePartitionScanner();
- return scanner;
- }
-
- /*
- * @see AbstractDocumentProvider#createElementInfo(Object)
- */
- protected ElementInfo createElementInfo(Object element) throws CoreException {
- if (element instanceof IFileEditorInput) {
-
- IFileEditorInput input = (IFileEditorInput) element;
- IMakefile makefile = createMakefile(input.getFile());
- if (makefile == null) {
- return super.createElementInfo(element);
- }
- try {
- refreshFile(input.getFile());
- } catch (CoreException x) {
- handleCoreException(x, "FileDocumentProvider.createElementInfo");
- }
-
- IDocument d = null;
- IStatus s = null;
-
- try {
- d = createDocument(element);
- } catch (CoreException x) {
- s = x.getStatus();
- d = createEmptyDocument();
- }
-
- IAnnotationModel m = createAnnotationModel(element);
- FileSynchronizer f = new FileSynchronizer(input);
- f.install();
-
- FileInfo info = new MakefileInfo(d, m, f, makefile);
- info.fModificationStamp = computeModificationStamp(input.getFile());
- info.fStatus = s;
- info.fEncoding = getPersistedEncoding(input);
-
- return info;
- }
-
- return super.createElementInfo(element);
- }
-
- /**
- * @param file
- * @return
- */
- private IMakefile createMakefile(IFile file) {
- return MakeCorePlugin.getDefault().createMakefile(file);
- }
-
- /*
- * @see AbstractDocumentProvider#doSaveDocument(IProgressMonitor, Object, IDocument, boolean)
- */
- protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
-
- // Update the makefile directives tree;
- ElementInfo elementInfo= getElementInfo(element);
- if (elementInfo instanceof MakefileInfo) {
- MakefileInfo info= (MakefileInfo) elementInfo;
- String content = document.get();
- StringReader reader = new StringReader(content);
- try {
- info.fCopy.parse(reader);
- } catch (IOException e) {
- }
- }
- super.doSaveDocument(monitor, element, document, overwrite);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.ui.editor.IMakefileDocumentProvider#shutdown()
- */
- public void shutdown() {
- Iterator e = getConnectedElements();
- while (e.hasNext()) {
- disconnect(e.next());
- }
- }
-
- /*
- * @see org.eclipse.cdt.make.internal.ui.editor.ICompilationUnitDocumentProvider#getWorkingCopy(java.lang.Object)
- */
- public IMakefile getWorkingCopy(Object element) {
-
- ElementInfo elementInfo = getElementInfo(element);
- if (elementInfo instanceof MakefileInfo) {
- MakefileInfo info = (MakefileInfo) elementInfo;
- return info.fCopy;
- }
- return null;
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java
deleted file mode 100644
index c5915916210..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.editor;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.cdt.make.core.makefile.IDirective;
-import org.eclipse.cdt.make.core.makefile.IMakefile;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.internal.ui.text.MakefileColorManager;
-import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileWordDetector;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.rules.IWordDetector;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.ui.IPartService;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.texteditor.DefaultRangeIndicator;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-import org.eclipse.ui.texteditor.TextOperationAction;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-public class MakefileEditor extends TextEditor implements ISelectionChangedListener{
-
- /**
- * The page that shows the outline.
- */
- protected MakefileContentOutlinePage page;
- private IMakefile makefile;
-
- public MakefileContentOutlinePage getOutlinePage() {
- if (page == null) {
- page = new MakefileContentOutlinePage(this);
- page.addSelectionChangedListener(this);
- page.setInput(getEditorInput());
- }
- return page;
- }
-
- public MakefileEditor() {
- super();
- }
-
- /**
- * @see AbstractTextEditor#init(IEditorSite, IEditorInput)
- */
- protected void initializeEditor() {
-
- setSourceViewerConfiguration(new MakefileSourceConfiguration(new MakefileColorManager(), this));
- setRangeIndicator(new DefaultRangeIndicator());
- setEditorContextMenuId("#MakefileEditorContext"); //$NON-NLS-1$
- setRulerContextMenuId("#MakefileRulerContext"); //$NON-NLS-1$
- setDocumentProvider(MakeUIPlugin.getDefault().getMakefileDocumentProvider());
- setPreferenceStore(MakeUIPlugin.getDefault().getPreferenceStore());
- }
-
- /* (non-Javadoc)
- * Method declared on IAdaptable
- */
- public Object getAdapter(Class key) {
- if (key.equals(IContentOutlinePage.class)) {
- return getOutlinePage();
- }
- return super.getAdapter(key);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void doSave(IProgressMonitor monitor) {
- super.doSave(monitor);
- makefile = null;
- if (page != null) {
- page.update();
- }
- }
-
- /**
- * Method to install the editor actions.
- *
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
- */
- protected void createActions() {
- super.createActions();
-
- ResourceBundle bundle = MakeUIPlugin.getDefault().getResourceBundle();
-
- IAction a = new TextOperationAction(bundle, "ContentAssistProposal.", this, ISourceViewer.CONTENTASSIST_PROPOSALS); //$NON-NLS-1$
- a.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- setAction("ContentAssistProposal", a); //$NON-NLS-1$
-
- a = new TextOperationAction(bundle, "ContentAssistTip.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION); //$NON-NLS-1$
- a.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
- setAction("ContentAssistTip", a); //$NON-NLS-1$
-
- a = new TextOperationAction(bundle, "Comment.", this, ITextOperationTarget.PREFIX); //$NON-NLS-1$
- a.setActionDefinitionId(IMakefileEditorActionDefinitionIds.COMMENT);
- setAction("Comment", a); //$NON-NLS-1$
- markAsStateDependentAction("Comment", true); //$NON-NLS-1$
-
- a = new TextOperationAction(bundle, "Uncomment.", this, ITextOperationTarget.STRIP_PREFIX); //$NON-NLS-1$
- a.setActionDefinitionId(IMakefileEditorActionDefinitionIds.UNCOMMENT);
- setAction("Uncomment", a); //$NON-NLS-1$
- markAsStateDependentAction("Uncomment", true); //$NON-NLS-1$
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection.isEmpty()) {
- resetHighlightRange();
- } else if (selection instanceof IStructuredSelection){
- if (!isActivePart() && MakeUIPlugin.getActivePage() != null) {
- MakeUIPlugin.getActivePage().bringToTop(this);
- }
- Object element = ((IStructuredSelection) selection).getFirstElement();
- if (element instanceof IDirective) {
- IDirective statement = (IDirective)element;
- setSelection(statement, !isActivePart());
- }
- }
- }
-
- /**
- * Returns whether the editor is active.
- */
- private boolean isActivePart() {
- IWorkbenchWindow window= getSite().getWorkbenchWindow();
- IPartService service= window.getPartService();
- IWorkbenchPart part= service.getActivePart();
- return part != null && part.equals(this);
- }
-
- private void setSelection(IDirective directive, boolean moveCursor) {
- int startLine = directive.getStartLine() - 1;
- int endLine = directive.getEndLine() - 1;
- try {
- IDocument doc = getDocumentProvider().getDocument(getEditorInput());
- int start = doc.getLineOffset(startLine);
- int len = doc.getLineLength(endLine) - 1;
- int length = (doc.getLineOffset(endLine) + len) - start;
- setHighlightRange(start, length, true);
- if (moveCursor) {
- // Let see if we can move the cursor at the position also
- String var = directive.toString().trim();
- IWordDetector detector = new MakefileWordDetector();
- for (len = 0; len < var.length(); len++) {
- char c = var.charAt(len);
- //if (! (Character.isLetterOrDigit(c) || c == '.' || c == '_')) {
- if (!(detector.isWordPart(c) || detector.isWordStart(c) || c == '-' || c == '_')) {
- break;
- }
- }
- if (len > 0) {
- var = var.substring(0, len);
- }
- len = doc.search(start, var, true, true, true);
- length = var.length();
- if (len > -1 && length > 0) {
- getSourceViewer().revealRange(len, length);
- // Selected region begins one index after offset
- getSourceViewer().setSelectedRange(len, length);
- }
-
- }
- } catch (IllegalArgumentException x) {
- resetHighlightRange();
- } catch (BadLocationException e) {
- resetHighlightRange();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
- */
- protected void editorContextMenuAboutToShow(IMenuManager menu) {
- super.editorContextMenuAboutToShow(menu);
- addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "Comment"); //$NON-NLS-1$
- addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "Uncomment"); //$NON-NLS-1$
-
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditorActionContributor.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditorActionContributor.java
deleted file mode 100644
index b3344ab36bd..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditorActionContributor.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.editor;
-
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.texteditor.BasicTextEditorActionContributor;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-import org.eclipse.ui.texteditor.RetargetTextEditorAction;
-
-/**
- */
-public class MakefileEditorActionContributor extends BasicTextEditorActionContributor {
-
- private MakefileEditorTogglePresentationAction fTogglePresentation;
- protected RetargetTextEditorAction fContentAssistProposal;
- protected RetargetTextEditorAction fContentAssistTip;
-
- /**
- * Constructor for MakefileEditorActionContributor.
- */
- public MakefileEditorActionContributor() {
- super();
- fContentAssistProposal = new RetargetTextEditorAction(MakeUIPlugin.getDefault().getResourceBundle(), "ContentAssistProposal."); //$NON-NLS-1$
- fContentAssistProposal.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- fContentAssistTip = new RetargetTextEditorAction(MakeUIPlugin.getDefault().getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$
- fContentAssistTip.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
- fTogglePresentation = new MakefileEditorTogglePresentationAction();
- }
-
- /**
- * @see org.eclipse.ui.IEditorActionBarContributor#setActiveEditor(IEditorPart)
- */
- public void setActiveEditor(IEditorPart targetEditor) {
- super.setActiveEditor(targetEditor);
- doSetActiveEditor(targetEditor);
- }
-
- private void doSetActiveEditor(IEditorPart part) {
- super.setActiveEditor(part);
-
- ITextEditor editor = null;
- if (part instanceof ITextEditor) {
- editor = (ITextEditor) part;
- }
-
- fContentAssistProposal.setAction(getAction(editor, "ContentAssistProposal")); //$NON-NLS-1$
- fContentAssistTip.setAction(getAction(editor, "ContentAssistTip")); //$NON-NLS-1$
-
- fTogglePresentation.setEditor(editor);
- fTogglePresentation.update();
- }
-
- /*
- * @see IEditorActionBarContributor#dispose()
- */
- public void dispose() {
- doSetActiveEditor(null);
- super.dispose();
- }
-
- /**
- * @see org.eclipse.ui.part.EditorActionBarContributor#init(IActionBars)
- */
- public void init(IActionBars bars) {
- super.init(bars);
- IMenuManager menuManager = bars.getMenuManager();
- IMenuManager editMenu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
- if (editMenu != null) {
- editMenu.add(new Separator());
- editMenu.add(fContentAssistProposal);
- editMenu.add(fContentAssistTip);
- }
-
- IToolBarManager toolBarManager = bars.getToolBarManager();
- if (toolBarManager != null) {
- toolBarManager.add(new Separator());
- toolBarManager.add(fTogglePresentation);
- }
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditorTogglePresentationAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditorTogglePresentationAction.java
deleted file mode 100644
index 1d1137e1481..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditorTogglePresentationAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.editor;
-
-import org.eclipse.cdt.make.internal.ui.MakeUIImages;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.TextEditorAction;
-
-/**
- */
-public class MakefileEditorTogglePresentationAction extends TextEditorAction {
-
- /**
- * Constructor for MakefileEditorTogglePresentationAction.
- */
- public MakefileEditorTogglePresentationAction() {
- super(MakeUIPlugin.getDefault().getResourceBundle(), "MakefileEditorTogglePresentation.", null); //$NON-NLS-1$
- MakeUIImages.setImageDescriptors(this, MakeUIImages.T_TOOL, MakeUIImages.IMG_TOOLS_MAKEFILE_SEGMENT_EDIT);
- update();
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- ITextEditor editor= getTextEditor();
- editor.resetHighlightRange();
- boolean show = editor.showsHighlightRangeOnly();
- setChecked(!show);
- editor.showHighlightRangeOnly(!show);
- }
-
- /**
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- setChecked(getTextEditor() != null && getTextEditor().showsHighlightRangeOnly());
- setEnabled(true);
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileSourceConfiguration.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileSourceConfiguration.java
deleted file mode 100644
index 12b71800480..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileSourceConfiguration.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.editor;
-
-import org.eclipse.cdt.make.internal.ui.text.IMakefileColorManager;
-import org.eclipse.cdt.make.internal.ui.text.MakefileColorManager;
-import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileCodeScanner;
-import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileCompletionProcessor;
-import org.eclipse.cdt.make.internal.ui.text.makefile.MakefilePartitionScanner;
-import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileReconcilingStrategy;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.contentassist.ContentAssistant;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.presentation.IPresentationReconciler;
-import org.eclipse.jface.text.presentation.PresentationReconciler;
-import org.eclipse.jface.text.reconciler.IReconciler;
-import org.eclipse.jface.text.reconciler.MonoReconciler;
-import org.eclipse.jface.text.rules.BufferedRuleBasedScanner;
-import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.swt.graphics.RGB;
-
-public class MakefileSourceConfiguration extends SourceViewerConfiguration {
-
- private IMakefileColorManager colorManager;
- private MakefileCodeScanner codeScanner;
- private MakefileEditor fEditor;
-
- /**
- * Single token scanner.
- */
- static class SingleTokenScanner extends BufferedRuleBasedScanner {
- public SingleTokenScanner(TextAttribute attribute) {
- setDefaultReturnToken(new Token(attribute));
- }
- }
-
- /**
- * Constructor for MakeConfiguration
- */
- public MakefileSourceConfiguration(IMakefileColorManager colorManager, MakefileEditor editor) {
- super();
- fEditor = editor;
- this.colorManager = colorManager;
- }
-
- /**
- * @see SourceViewerConfiguration#getConfiguredContentTypes(ISourceViewer)
- */
- public String[] getConfiguredContentTypes(ISourceViewer v) {
- return new String[] {
- IDocument.DEFAULT_CONTENT_TYPE,
- MakefilePartitionScanner.MAKEFILE_COMMENT,
- MakefilePartitionScanner.MAKEFILE_IF_BLOCK,
- MakefilePartitionScanner.MAKEFILE_DEF_BLOCK,
- MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK,
- MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT,
- };
-
- }
-
- /**
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(ISourceViewer)
- */
- public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
- ContentAssistant assistant = new ContentAssistant();
- assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), IDocument.DEFAULT_CONTENT_TYPE);
- assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_COMMENT);
- assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_DEF_BLOCK);
- assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_IF_BLOCK);
- assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK);
- assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT);
-
- assistant.enableAutoActivation(true);
- assistant.setAutoActivationDelay(500);
-
- assistant.setProposalPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW);
- assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW);
- //Set to Carolina blue
- assistant.setContextInformationPopupBackground(getColorManager().getColor(new RGB(0, 191, 255)));
-
- return assistant;
- }
-
- protected IMakefileColorManager getColorManager() {
- if (null == colorManager)
- colorManager = new MakefileColorManager();
- return colorManager;
- }
-
- protected MakefileCodeScanner getCodeScanner() {
- if (null == codeScanner)
- codeScanner = new MakefileCodeScanner(getColorManager());
- return codeScanner;
-
- }
-
- public IPresentationReconciler getPresentationReconciler(ISourceViewer v) {
-
- PresentationReconciler reconciler = new PresentationReconciler();
-
- DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getCodeScanner());
- reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
- reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
-
- dr = new DefaultDamagerRepairer(getCodeScanner());
- dr = new DefaultDamagerRepairer(getCodeScanner());
- reconciler.setDamager(dr, MakefilePartitionScanner.MAKEFILE_COMMENT);
- reconciler.setRepairer(dr, MakefilePartitionScanner.MAKEFILE_COMMENT);
-
- dr = new DefaultDamagerRepairer(getCodeScanner());
- reconciler.setDamager(dr, MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT);
- reconciler.setRepairer(dr, MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT);
-
- dr = new DefaultDamagerRepairer(getCodeScanner());
- reconciler.setDamager(dr, MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK);
- reconciler.setRepairer(dr, MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK);
-
- dr = new DefaultDamagerRepairer(getCodeScanner());
- reconciler.setDamager(dr, MakefilePartitionScanner.MAKEFILE_IF_BLOCK);
- reconciler.setRepairer(dr, MakefilePartitionScanner.MAKEFILE_IF_BLOCK);
-
- dr = new DefaultDamagerRepairer(getCodeScanner());
- reconciler.setDamager(dr, MakefilePartitionScanner.MAKEFILE_DEF_BLOCK);
- reconciler.setRepairer(dr, MakefilePartitionScanner.MAKEFILE_DEF_BLOCK);
-
- dr = new DefaultDamagerRepairer(getCodeScanner());
- reconciler.setDamager(dr, MakefilePartitionScanner.MAKEFILE_OTHER);
- reconciler.setRepairer(dr, MakefilePartitionScanner.MAKEFILE_OTHER);
- return reconciler;
- }
-
- /**
- * @see SourceViewerConfiguration#getReconciler(ISourceViewer)
- */
- public IReconciler getReconciler(ISourceViewer sourceViewer) {
- if (fEditor != null && fEditor.isEditable()) {
- MonoReconciler reconciler= new MonoReconciler(new MakefileReconcilingStrategy(fEditor), false);
- reconciler.setDelay(1000);
- reconciler.setProgressMonitor(new NullProgressMonitor());
- return reconciler;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getDefaultPrefixes(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
- */
- public String[] getDefaultPrefixes(ISourceViewer sourceViewer, String contentType) {
- return new String[]{"#"};
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/WorkingCopyManager.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/WorkingCopyManager.java
deleted file mode 100644
index 201bc65ade3..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/WorkingCopyManager.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.make.internal.ui.editor;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.make.core.makefile.IMakefile;
-import org.eclipse.cdt.make.ui.IWorkingCopyManager;
-import org.eclipse.cdt.make.ui.IWorkingCopyManagerExtension;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.Assert;
-import org.eclipse.ui.IEditorInput;
-
-
-/**
- * This working copy manager works together with a given compilation unit document provider and
- * additionally offers to "overwrite" the working copy provided by this document provider.
- */
-public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyManagerExtension {
-
- private IMakefileDocumentProvider fDocumentProvider;
- private Map fMap;
- private boolean fIsShuttingDown;
-
- /**
- * Creates a new working copy manager that co-operates with the given
- * compilation unit document provider.
- *
- * @param provider the provider
- */
- public WorkingCopyManager(IMakefileDocumentProvider provider) {
- Assert.isNotNull(provider);
- fDocumentProvider= provider;
- }
-
- /*
- * @see org.eclipse.cdt.make.ui.IWorkingCopyManager#connect(org.eclipse.ui.IEditorInput)
- */
- public void connect(IEditorInput input) throws CoreException {
- fDocumentProvider.connect(input);
- }
-
- /*
- * @see org.eclipse.cdt.make.ui.IWorkingCopyManager#disconnect(org.eclipse.ui.IEditorInput)
- */
- public void disconnect(IEditorInput input) {
- fDocumentProvider.disconnect(input);
- }
-
- /*
- * @see org.eclipse.cdt.make.ui.IWorkingCopyManager#shutdown()
- */
- public void shutdown() {
- if (!fIsShuttingDown) {
- fIsShuttingDown= true;
- try {
- if (fMap != null) {
- fMap.clear();
- fMap= null;
- }
- fDocumentProvider.shutdown();
- } finally {
- fIsShuttingDown= false;
- }
- }
- }
-
- /*
- * @see org.eclipse.cdt.make.ui.IWorkingCopyManager#getWorkingCopy(org.eclipse.ui.IEditorInput)
- */
- public IMakefile getWorkingCopy(IEditorInput input) {
- IMakefile unit= fMap == null ? null : (IMakefile) fMap.get(input);
- return unit != null ? unit : fDocumentProvider.getWorkingCopy(input);
- }
-
- /*
- * @see org.eclipse.cdt.make.ui.IWorkingCopyManagerExtension#setWorkingCopy(org.eclipse.ui.IEditorInput, org.eclipse.cdt.make.core.makefile.IMakefile)
- */
- public void setWorkingCopy(IEditorInput input, IMakefile workingCopy) {
- if (fDocumentProvider.getDocument(input) != null) {
- if (fMap == null)
- fMap= new HashMap();
- fMap.put(input, workingCopy);
- }
- }
-
- /*
- * @see org.eclipse.cdt.make.internal.ui.javaeditor.IWorkingCopyManagerExtension#removeWorkingCopy(org.eclipse.ui.IEditorInput)
- */
- public void removeWorkingCopy(IEditorInput input) {
- fMap.remove(input);
- if (fMap.isEmpty())
- fMap= null;
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/CheckboxTablePart.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/CheckboxTablePart.java
deleted file mode 100644
index 76313520b3f..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/CheckboxTablePart.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.internal.ui.part;
-
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @version 1.0
- * @author
- */
-public class CheckboxTablePart extends StructuredViewerPart {
- public CheckboxTablePart(String[] buttonLabels) {
- super(buttonLabels);
- }
-
- /*
- * @see StructuredViewerPart#createStructuredViewer(Composite, FormWidgetFactory)
- */
- protected StructuredViewer createStructuredViewer(Composite parent, int style) {
- style |= SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
- CheckboxTableViewer tableViewer = CheckboxTableViewer.newCheckList(parent, style);
- tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- CheckboxTablePart.this.selectionChanged((IStructuredSelection) e.getSelection());
- }
- });
- tableViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- elementChecked(event.getElement(), event.getChecked());
- }
- });
- return tableViewer;
- }
-
- public CheckboxTableViewer getTableViewer() {
- return (CheckboxTableViewer) getViewer();
- }
-
- /*
- * @see SharedPartWithButtons#buttonSelected(int)
- */
- protected void buttonSelected(Button button, int index) {
- }
-
- protected void elementChecked(Object element, boolean checked) {
- }
- protected void selectionChanged(IStructuredSelection selection) {
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/SharedPart.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/SharedPart.java
deleted file mode 100644
index b903e987e17..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/SharedPart.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.internal.ui.part;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * @version 1.0
- * @author
- */
-public abstract class SharedPart {
- private boolean enabled = true;
-
- public void setEnabled(boolean enabled) {
- if (enabled != this.enabled) {
- this.enabled = enabled;
- updateEnabledState();
- }
- }
-
- public abstract void createControl(Composite parent, int style, int span);
-
- public boolean isEnabled() {
- return enabled;
- }
-
- protected void updateEnabledState() {
- }
-
- protected Composite createComposite(Composite parent) {
- return new Composite(parent, SWT.NULL);
- }
-
- protected Label createEmptySpace(Composite parent, int span) {
- Label label = new Label(parent, SWT.NULL);
- GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- gd.horizontalSpan = span;
- gd.widthHint = 0;
- gd.heightHint = 0;
- label.setLayoutData(gd);
- return label;
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/SharedPartWithButtons.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/SharedPartWithButtons.java
deleted file mode 100644
index 74bf5032f2c..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/SharedPartWithButtons.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.internal.ui.part;
-
-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.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @version 1.0
- * @author
- */
-public abstract class SharedPartWithButtons extends SharedPart {
- private String[] buttonLabels;
- private Control[] controls;
- private Composite buttonContainer;
-
- private class SelectionHandler implements SelectionListener {
- public void widgetSelected(SelectionEvent e) {
- buttonSelected(e);
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- buttonSelected(e);
- }
- private void buttonSelected(SelectionEvent e) {
- Integer index = (Integer) e.widget.getData();
- SharedPartWithButtons.this.buttonSelected((Button) e.widget, index.intValue());
- }
- }
-
- public SharedPartWithButtons(String[] buttonLabels) {
- this.buttonLabels = buttonLabels;
- }
-
- public void setButtonEnabled(int index, boolean enabled) {
- if (controls != null && index >= 0 && controls.length > index) {
- Control c = controls[index];
- if (c instanceof Button)
- c.setEnabled(enabled);
- }
- }
-
- protected abstract void createMainControl(Composite parent, int style, int span);
- protected abstract void buttonSelected(Button button, int index);
-
- /*
- * @see SharedPart#createControl(Composite, FormWidgetFactory)
- */
- public void createControl(Composite parent, int style, int span) {
- createMainLabel(parent, span);
- createMainControl(parent, style, span - 1);
- if (buttonLabels != null && buttonLabels.length > 0) {
- buttonContainer = createComposite(parent);
- GridData gd = new GridData(GridData.FILL_VERTICAL);
- buttonContainer.setLayoutData(gd);
- buttonContainer.setLayout(createButtonsLayout());
-
- controls = new Control[buttonLabels.length];
- SelectionHandler listener = new SelectionHandler();
- for (int i = 0; i < buttonLabels.length; i++) {
- String label = buttonLabels[i];
- if (label != null) {
- Button button = createButton(buttonContainer, label, i);
- button.addSelectionListener(listener);
- controls[i] = button;
- } else {
- createEmptySpace(buttonContainer, 1);
- }
- }
- }
- }
-
- protected GridLayout createButtonsLayout() {
- GridLayout layout = new GridLayout();
- layout.marginWidth = layout.marginHeight = 0;
- return layout;
- }
-
- protected Button createButton(Composite parent, String label, int index) {
- Button button = new Button(parent, SWT.PUSH);
- button.setText(label);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
- button.setLayoutData(gd);
- button.setData(new Integer(index));
- return button;
- }
-
- protected void updateEnabledState() {
- for (int i = 0; i < controls.length; i++) {
- Control c = controls[i];
- if (c instanceof Button)
- c.setEnabled(isEnabled());
- }
- }
-
- protected void createMainLabel(Composite parent, int span) {
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/StructuredViewerPart.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/StructuredViewerPart.java
deleted file mode 100644
index 0bac65c69b3..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/StructuredViewerPart.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.internal.ui.part;
-
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-/**
- * @version 1.0
- * @author
- */
-public abstract class StructuredViewerPart extends SharedPartWithButtons {
- private StructuredViewer viewer;
- private Point minSize = null;
-
- public StructuredViewerPart(String[] buttonLabels) {
- super(buttonLabels);
- }
-
- public StructuredViewer getViewer() {
- return viewer;
- }
-
- public Control getControl() {
- return viewer.getControl();
- }
-
- /*
- * @see SharedPartWithButtons#createMainControl(Composite, int, FormWidgetFactory)
- */
- protected void createMainControl(Composite parent, int style, int span) {
- viewer = createStructuredViewer(parent, style);
- Control control = viewer.getControl();
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.horizontalSpan = span;
- control.setLayoutData(gd);
- applyMinimumSize();
- }
-
- public void setMinimumSize(int width, int height) {
- minSize = new Point(width, height);
- if (viewer != null)
- applyMinimumSize();
- }
- private void applyMinimumSize() {
- if (minSize != null) {
- GridData gd = (GridData) viewer.getControl().getLayoutData();
- gd.widthHint = minSize.x;
- gd.heightHint = minSize.y;
- }
- }
-
- protected void updateEnabledState() {
- getControl().setEnabled(isEnabled());
- super.updateEnabledState();
- }
-
- protected abstract StructuredViewer createStructuredViewer(Composite parent, int style);
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/WizardCheckboxTablePart.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/WizardCheckboxTablePart.java
deleted file mode 100644
index 0bbf5467e98..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/WizardCheckboxTablePart.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.internal.ui.part;
-import java.text.MessageFormat;
-
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-/**
- * @version 1.0
- * @author
- */
-public class WizardCheckboxTablePart extends CheckboxTablePart {
- public static final String KEY_SELECT_ALL = MakeUIPlugin.getResourceString("WizardCheckboxTablePart.WizardCheckboxTablePart.selectAll"); //$NON-NLS-1$
- public static final String KEY_DESELECT_ALL = MakeUIPlugin.getResourceString("WizardCheckboxTablePart.WizardCheckboxTablePart.deselectAll"); //$NON-NLS-1$
- public static final String KEY_COUNTER = MakeUIPlugin.getResourceString("WizardCheckboxTablePart.WizardCheckboxTablePart.counter"); //$NON-NLS-1$
-
- private final String EMPTY_STRING = ""; //$NON-NLS-1$
- private int selectAllIndex = -1;
- private int deselectAllIndex = -1;
- private String tableName;
- private int counter;
- private Label counterLabel;
-
- /**
- * Constructor for WizardCheckboxTablePart.
- * @param buttonLabels
- */
- public WizardCheckboxTablePart(String tableName, String[] buttonLabels) {
- super(buttonLabels);
- this.tableName = tableName;
- }
-
- public WizardCheckboxTablePart(String mainLabel) {
- this(
- mainLabel,
- new String[] { MakeUIPlugin.getResourceString(KEY_SELECT_ALL), MakeUIPlugin.getResourceString(KEY_DESELECT_ALL)});
- setSelectAllIndex(0);
- setDeselectAllIndex(1);
- }
-
- public void setSelectAllIndex(int index) {
- this.selectAllIndex = index;
- }
- public void setDeselectAllIndex(int index) {
- this.deselectAllIndex = index;
- }
-
- protected void buttonSelected(Button button, int index) {
- if (index == selectAllIndex) {
- handleSelectAll(true);
- }
- if (index == deselectAllIndex) {
- handleSelectAll(false);
- }
- }
-
- public Object[] getSelection() {
- CheckboxTableViewer viewer = getTableViewer();
- return viewer.getCheckedElements();
- }
-
- public void setSelection(Object[] selected) {
- CheckboxTableViewer viewer = getTableViewer();
- viewer.setCheckedElements(selected);
- updateCounter(selected.length);
- }
-
- public void createControl(Composite parent) {
- createControl(parent, SWT.NULL, 2);
- counterLabel = new Label(parent, SWT.NULL);
- GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan = 2;
- counterLabel.setLayoutData(gd);
- updateCounter(0);
- }
-
- protected Button createButton(Composite parent, String label, int index) {
- Button button = super.createButton(parent, label, index);
- return button;
- }
-
- protected StructuredViewer createStructuredViewer(Composite parent, int style) {
- StructuredViewer viewer = super.createStructuredViewer(parent, style);
- return viewer;
- }
-
- protected void createMainLabel(Composite parent, int span) {
- if (tableName == null)
- return;
- Label label = new Label(parent, SWT.NULL);
- label.setText(tableName);
- GridData gd = new GridData();
- gd.horizontalSpan = span;
- label.setLayoutData(gd);
- }
-
- protected void updateCounter(int amount) {
- counter = amount;
- updateCounterLabel();
- }
-
- protected void updateCounterLabel() {
- String number = EMPTY_STRING + getSelectionCount();
- String totalNumber = EMPTY_STRING + getTotalCount();
- String message = MessageFormat.format(MakeUIPlugin.getResourceString(KEY_COUNTER), new String[] { number, totalNumber });
- counterLabel.setText(message);
- }
-
- public int getSelectionCount() {
- return counter;
- }
-
- public void selectAll(boolean select) {
- handleSelectAll(select);
- }
-
- private int getTotalCount() {
- CheckboxTableViewer viewer = getTableViewer();
- return viewer.getTable().getItemCount();
- }
-
- protected void handleSelectAll(boolean select) {
- CheckboxTableViewer viewer = getTableViewer();
- viewer.setAllChecked(select);
- int selected;
- if (!select) {
- selected = 0;
- } else {
- selected = getTotalCount();
- }
- updateCounter(selected);
- }
- protected void elementChecked(Object element, boolean checked) {
- int count = getSelectionCount();
- updateCounter(checked ? count + 1 : count - 1);
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java
deleted file mode 100644
index f165a1e4e60..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.internal.ui.preferences;
-
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.internal.ui.MakeProjectOptionBlock;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-/**
- * This class represents a preference page that
- * is contributed to the Preferences dialog. By
- * subclassing FieldEditorPreferencePage, we
- * can use the field support built into JFace that allows
- * us to create a page that is small and knows how to
- * save, restore and apply itself.
- *
- * This page is used to modify preferences only. They
- * are stored in the preference store that belongs to
- * the main plug-in class. That way, preferences can
- * be accessed directly via the preference store.
- */
-
-public class MakePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, ICOptionContainer {
-
- private MakeProjectOptionBlock fOptionBlock;
-
- public MakePreferencePage() {
- setPreferenceStore(MakeUIPlugin.getDefault().getPreferenceStore());
- setDescription("Make Project Preferences");
- fOptionBlock = new MakeProjectOptionBlock(this);
- }
-
- /*
- * @see PreferencePage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- super.createControl(parent);
- // WorkbenchHelp.setHelp(parent, ICMakeHelpContextIds.PROJECT_PROPERTY_PAGE);
- }
-
- protected Control createContents(Composite parent) {
- return fOptionBlock.createContents(parent);
- }
-
-
- public void init(IWorkbench workbench) {
- }
-
- public boolean performOk() {
- boolean ok = fOptionBlock.performApply(null);
- MakeCorePlugin.getDefault().savePluginPreferences();
- return ok;
- }
-
- /**
- * @see DialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- fOptionBlock.setVisible(visible);
- }
-
- public void updateContainer() {
- fOptionBlock.update();
- boolean ok = fOptionBlock.isValid();
- if (!ok) {
- setErrorMessage(fOptionBlock.getErrorMessage());
- }
- if (ok) {
- setErrorMessage(null);
- }
- setValid(ok);
- }
-
- public IProject getProject() {
- return null;
- }
-
- public boolean isValid() {
- updateContainer();
- return super.isValid();
- }
-
- protected void performDefaults() {
- fOptionBlock.performDefaults();
- super.performDefaults();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.ui.dialogs.ICOptionContainer#getPreferences()
- */
- public Preferences getPreferences() {
- return MakeUIPlugin.getDefault().getPluginPreferences();
- }
-
-}
\ No newline at end of file
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java
deleted file mode 100644
index 4459fb51ad0..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.internal.ui.properties;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.cdt.make.internal.ui.MakeProjectOptionBlock;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-public class MakePropertyPage extends PropertyPage implements ICOptionContainer {
-
- MakeProjectOptionBlock fOptionBlock;
-
- private static final String MSG_CLOSEDPROJECT = "MakeProjectPropertyPage.closedproject"; //$NON-NLS-1$
-
- public MakePropertyPage() {
- super();
- fOptionBlock = new MakeProjectOptionBlock(this);
- }
-
-
- protected Control createContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new FillLayout());
-
- IProject project = getProject();
- if (!project.isOpen()) {
- contentForClosedProject(composite);
- } else {
- contentForCProject(composite);
- }
-
- return composite;
- }
-
- private void contentForCProject(Composite parent) {
- fOptionBlock.createContents(parent);
- // WorkbenchHelp.setHelp(parent, ICMakeHelpContextIds.PROJECT_PROPERTY_PAGE);
- }
-
- private void contentForClosedProject(Composite parent) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(MakeUIPlugin.getResourceString(MSG_CLOSEDPROJECT));
- label.setFont(parent.getFont());
-
- noDefaultAndApplyButton();
- }
-
- /**
- * @see PreferencePage#performOk
- */
- public boolean performOk() {
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- fOptionBlock.performApply(monitor);
- }
- };
- IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(runnable);
- try {
- new ProgressMonitorDialog(getShell()).run(false, true, op);
- } catch (InvocationTargetException e) {
- return false;
- } catch (InterruptedException e) {
- // cancelled
- return false;
- }
- return true;
- }
-
- public IProject getProject() {
- Object element = getElement();
- if (element instanceof IProject) {
- return (IProject) element;
- }
- return null;
- }
-
- /**
- * @see DialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- fOptionBlock.setVisible(visible);
- }
-
- public void updateContainer() {
- fOptionBlock.update();
- setValid(fOptionBlock.isValid());
- setErrorMessage(fOptionBlock.getErrorMessage());
- }
-
- protected void performDefaults() {
- fOptionBlock.performDefaults();
- super.performDefaults();
- }
-
- public boolean isValid() {
- updateContainer();
- return super.isValid();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.ui.dialogs.ICOptionContainer#getPreferences()
- */
- public Preferences getPreferences() {
- return null;
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/CompletionProposalComparator.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/CompletionProposalComparator.java
deleted file mode 100644
index 971bc37d571..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/CompletionProposalComparator.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.cdt.make.internal.ui.text;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-
-import java.util.Comparator;
-
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-
-public class CompletionProposalComparator implements Comparator {
-
- /**
- * Constructor for CompletionProposalComparator.
- */
- public CompletionProposalComparator() {
- }
-
- /* (non-Javadoc)
- * @see Comparator#compare(Object, Object)
- */
- public int compare(Object o1, Object o2) {
- ICompletionProposal c1= (ICompletionProposal) o1;
- ICompletionProposal c2= (ICompletionProposal) o2;
- return c1.getDisplayString().compareToIgnoreCase(c2.getDisplayString());
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/IMakefileColorManager.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/IMakefileColorManager.java
deleted file mode 100644
index 588f4b11d08..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/IMakefileColorManager.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.text;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-
-public interface IMakefileColorManager {
- public static final RGB MAKE_COMMENT = new RGB(128, 0, 0);
- public static final RGB MAKE_KEYWORD = new RGB(128, 128, 0);
- public static final RGB MAKE_FUNCTION = new RGB(128, 0, 128);
- public static final RGB MAKE_MACRO_VAR = new RGB(0, 0, 128);
- public static final RGB MAKE_META_DATA = new RGB(0, 128, 0);
- public static final RGB MAKE_DEFAULT = new RGB(0, 0, 0);
-
- public static final RGB MAKE_FORM_FOREGROUND = Display.getCurrent().getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB();
- public static final RGB MAKE_FORM_BACKGROUND = new RGB(0xff, 0xff, 0xff); //RGB(0xff, 0xfe, 0xf9);
- public static final RGB MAKE_DEFAULT_PAGE_HEADER = new RGB(0x48, 0x70, 0x98);
- public static final RGB MAKE_HYPERLINK_TEXT = new RGB(0, 0, 128);
- public static final RGB MAKE_CONTROL_BORDER = new RGB(195, 191, 179);
-
- void dispose();
- Color getColor(RGB rgb);
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/MakefileColorManager.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/MakefileColorManager.java
deleted file mode 100644
index 40f133748c5..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/MakefileColorManager.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.text;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-
-public class MakefileColorManager implements IMakefileColorManager {
-
- protected Map fColorTable = new HashMap(10);
-
- /**
- * @see IMakefileColorManager#dispose()
- */
- public void dispose() {
- Iterator e = fColorTable.values().iterator();
- while (e.hasNext())
- ((Color) e.next()).dispose();
- }
-
- /**
- * @see IMakefileColorManager#getColor(RGB)
- */
- public Color getColor(RGB rgb) {
- Color color = (Color) fColorTable.get(rgb);
- if (color == null) {
- color = new Color(Display.getCurrent(), rgb);
- fColorTable.put(rgb, color);
- }
- return color;
-
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/WordPartDetector.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/WordPartDetector.java
deleted file mode 100644
index 58994c399e8..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/WordPartDetector.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * "The Java Developer's Guide to Eclipse"
- * by Shavor, D'Anjou, Fairbrother, Kehn, Kellerman, McCarthy
- *
- * (C) Copyright International Business Machines Corporation, 2003.
- * All Rights Reserved.
- *
- * Code or samples provided herein are provided without warranty of any kind.
- */
-package org.eclipse.cdt.make.internal.ui.text;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-
-/**
- * Used to scan and detect for SQL keywords
- */
-public class WordPartDetector {
- String wordPart = "";
- int offset;
-
- /**
- * Method WordPartDetector.
- * @param viewer is a text viewer
- * @param documentOffset into the SQL document
- */
- public WordPartDetector(ITextViewer viewer, int documentOffset) {
- offset = documentOffset - 1;
- int endOffset = documentOffset;
- try {
- IDocument doc = viewer.getDocument();
- int bottom = viewer.getBottomIndexEndOffset();
- int top = viewer.getTopIndexStartOffset();
- while (offset >= top && isMakefileLetter(doc.getChar(offset))) {
- offset--;
- }
- while (endOffset < bottom && isMakefileLetter(doc.getChar(endOffset))) {
- endOffset++;
- }
- //we've been one step too far : increase the offset
- offset++;
- wordPart = viewer.getDocument().get(offset, endOffset - offset);
- } catch (BadLocationException e) {
- // do nothing
- }
- }
-
- /**
- * Method getString.
- * @return String
- */
- public String getString() {
- return wordPart;
- }
-
- public int getOffset() {
- return offset;
- }
-
- boolean isMakefileLetter(char c) {
- return Character.isLetterOrDigit(c) || c == '_' || c == '.';
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCodeScanner.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCodeScanner.java
deleted file mode 100644
index e68bcca03e0..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCodeScanner.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.text.makefile;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.make.internal.ui.text.IMakefileColorManager;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.rules.EndOfLineRule;
-import org.eclipse.jface.text.rules.ICharacterScanner;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.IWhitespaceDetector;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.rules.WhitespaceRule;
-import org.eclipse.jface.text.rules.WordRule;
-
-public class MakefileCodeScanner extends RuleBasedScanner {
-
- private final static String[] keywords = { "define", "endef", "ifdef", "ifndef", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "ifeq", "ifneq", "else", "endif", "include", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "-include", "sinclude", "override", "endef", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "export", "unexport", "vpath" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- };
-
- private final static String[] functions = { "subst", "patsubst", "strip", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "findstring", "filter", "sort", "dir", "notdir", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "suffix", "basename", "addsuffix", "addprefix", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "join", "word", "words", "wordlist", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "firstword", "wildcard", "error", "warning", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "shell", "origin", "foreach", "call" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- };
-
-
- /**
- * Constructor for MakefileCodeScanner
- */
- public MakefileCodeScanner(IMakefileColorManager provider) {
- super();
-
- IToken keyword = new Token(new TextAttribute(provider.getColor(IMakefileColorManager.MAKE_KEYWORD)));
- IToken function = new Token(new TextAttribute(provider.getColor(IMakefileColorManager.MAKE_FUNCTION)));
- IToken comment = new Token(new TextAttribute(provider.getColor(IMakefileColorManager.MAKE_COMMENT)));
- IToken macro = new Token(new TextAttribute(provider.getColor(IMakefileColorManager.MAKE_MACRO_VAR)));
- IToken other = new Token(new TextAttribute(provider.getColor(IMakefileColorManager.MAKE_DEFAULT)));
-
- List rules = new ArrayList();
-
- // Add rule for single line comments.
- rules.add(new EndOfLineRule("#", comment, '\\')); //$NON-NLS-1$
-
- // Add generic whitespace rule.
- rules.add(new WhitespaceRule(new IWhitespaceDetector() {
- public boolean isWhitespace(char character) {
- return Character.isWhitespace(character);
- }
- }));
-
- // Add word rule for keywords, types, and constants.
- WordRule wordRule = new WordRule(new MakefileWordDetector(), other);
- for (int i = 0; i < keywords.length; i++)
- wordRule.addWord(keywords[i], keyword);
- for (int i = 0; i < functions.length; i++)
- wordRule.addWord(functions[i], function);
-
- rules.add(wordRule);
-
- //rules.add(new PatternRule("$(", ")", macro, '\\', true)); //$NON-NLS-1$ //$NON-NLS-2$
- rules.add(new MakefileSimpleMacroRule(macro)); //$NON-NLS-1$ //$NON-NLS-2$
-
- rules.add(new MacroRule(macro, other));
-
- setDefaultReturnToken(other);
-
- IRule[] result = new IRule[rules.size()];
-
- rules.toArray(result);
-
- setRules(result);
-
- }
-
- private class MacroRule implements IRule {
- private static final int INIT_STATE = 0;
- private static final int VAR_STATE = 1;
- private static final int END_VAR_STATE = 2;
- private static final int EQUAL_STATE = 3;
- private static final int FINISH_STATE = 4;
- private static final int ERROR_STATE = 5;
-
- private IToken token;
- private StringBuffer buffer = new StringBuffer();
- protected IToken defaultToken;
- public MacroRule(IToken token, IToken defaultToken) {
- this.token = token;
- this.defaultToken = defaultToken;
- }
- public IToken evaluate(ICharacterScanner scanner) {
- int state = INIT_STATE;
- buffer.setLength(0);
- boolean bTwoCharsAssign = false;
-
- for (int c = scanner.read(); c != ICharacterScanner.EOF; c = scanner.read()) {
- switch (state) {
- case INIT_STATE :
- if (c != '\n' && Character.isWhitespace((char) c))
- break;
- if (isValidCharacter(c))
- state = VAR_STATE;
- else
- state = ERROR_STATE;
- break;
- case VAR_STATE :
- if (isValidCharacter(c))
- break;
- case END_VAR_STATE :
- if (c != '\n' && Character.isWhitespace((char) c))
- state = END_VAR_STATE;
- else if (c == ':' || c == '+') {
- bTwoCharsAssign = true;
- state = EQUAL_STATE;
- } else if (c == '=')
- state = FINISH_STATE;
- else {
- if (state == END_VAR_STATE)
- scanner.unread(); // Return back to the space
- state = ERROR_STATE;
- }
- break;
- case EQUAL_STATE :
- if (c == '=')
- state = FINISH_STATE;
- else
- state = ERROR_STATE;
- break;
- case FINISH_STATE :
- break;
- default :
- break;
- }
- if (state >= FINISH_STATE)
- break;
- buffer.append((char) c);
- }
-
- scanner.unread();
-
- if (state == FINISH_STATE) {
- if (bTwoCharsAssign)
- scanner.unread();
- return token;
- }
-
- if (defaultToken.isUndefined())
- unreadBuffer(scanner);
-
- return Token.UNDEFINED;
- }
-
- /**
- * Returns the characters in the buffer to the scanner.
- *
- * @param scanner the scanner to be used
- */
- protected void unreadBuffer(ICharacterScanner scanner) {
- for (int i = buffer.length() - 1; i >= 0; i--)
- scanner.unread();
- }
-
- protected boolean isValidCharacter(int c) {
- char c0 = (char) c;
- return Character.isLetterOrDigit(c0) || (c0 == '_');
- }
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCompletionProcessor.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCompletionProcessor.java
deleted file mode 100644
index 85bd95eb10d..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCompletionProcessor.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.text.makefile;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-
-import org.eclipse.cdt.make.core.makefile.IMacroDefinition;
-import org.eclipse.cdt.make.core.makefile.IMakefile;
-import org.eclipse.cdt.make.core.makefile.IRule;
-import org.eclipse.cdt.make.core.makefile.IDirective;
-import org.eclipse.cdt.make.internal.ui.MakeUIImages;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.internal.ui.text.CompletionProposalComparator;
-import org.eclipse.cdt.make.internal.ui.text.WordPartDetector;
-import org.eclipse.cdt.make.ui.IWorkingCopyManager;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.TextPresentation;
-import org.eclipse.jface.text.contentassist.CompletionProposal;
-import org.eclipse.jface.text.contentassist.ContextInformation;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.contentassist.IContextInformationPresenter;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * MakefileCompletionProcessor
- */
-public class MakefileCompletionProcessor implements IContentAssistProcessor {
-
- /**
- * Simple content assist tip closer. The tip is valid in a range
- * of 5 characters around its popup location.
- */
- protected static class Validator implements IContextInformationValidator, IContextInformationPresenter {
-
- protected int fInstallOffset;
-
- /*
- * @see IContextInformationValidator#isContextInformationValid(int)
- */
- public boolean isContextInformationValid(int offset) {
- return Math.abs(fInstallOffset - offset) < 5;
- }
-
- /*
- * @see IContextInformationValidator#install(IContextInformation, ITextViewer, int)
- */
- public void install(IContextInformation info, ITextViewer viewer, int offset) {
- fInstallOffset = offset;
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContextInformationPresenter#updatePresentation(int, TextPresentation)
- */
- public boolean updatePresentation(int documentPosition, TextPresentation presentation) {
- return false;
- }
- }
-
- public class DirectiveComparator implements Comparator {
-
- /* (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object o1, Object o2) {
- String name1;
- String name2;
-
- if (o1 instanceof IMacroDefinition) {
- name1 = ((IMacroDefinition)o1).getName();
- } else if (o1 instanceof IRule) {
- name1 = ((IRule)o1).getTarget().toString();
- } else {
- name1 ="";
- }
-
- if (o2 instanceof IMacroDefinition) {
- name2 = ((IMacroDefinition)o1).getName();
- } else if (o2 instanceof IRule) {
- name2 = ((IRule)o1).getTarget().toString();
- } else {
- name2 ="";
- }
-
- //return String.CASE_INSENSITIVE_ORDER.compare(name1, name2);
- return name1.compareToIgnoreCase(name2);
- }
-
- }
- protected IContextInformationValidator fValidator = new Validator();
- protected Image imageMacro = MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_MACRO);
- protected Image imageTarget = MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_TARGET_RULE);
-
- protected CompletionProposalComparator comparator = new CompletionProposalComparator();
- protected IEditorPart fEditor;
- protected IWorkingCopyManager fManager;
-
- public MakefileCompletionProcessor(IEditorPart editor) {
- fEditor = editor;
- fManager = MakeUIPlugin.getDefault().getWorkingCopyManager();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int)
- */
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
- boolean macro = inMacro(viewer, documentOffset);
- IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
- IDirective[] statements = null;
- if (macro) {
- IDirective[] m1 = makefile.getMacroDefinitions();
- IDirective[] m2 = makefile.getBuiltinMacroDefinitions();
- statements = new IDirective[m1.length + m2.length];
- System.arraycopy(m1, 0, statements, 0, m1.length);
- System.arraycopy(m2, 0, statements, m1.length, m2.length);
- } else {
- statements = makefile.getTargetRules();
- }
-
- ArrayList proposalList = new ArrayList(statements.length);
- WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset);
-
- // iterate over all the different categories
- for (int i = 0; i < statements.length; i++) {
- String name = null;
- Image image = null;
- String infoString = "";//getContentInfoString(name);
- if (statements[i] instanceof IMacroDefinition) {
- name = ((IMacroDefinition) statements[i]).getName();
- image = imageMacro;
- infoString = ((IMacroDefinition)statements[i]).getValue().toString();
- } else if (statements[i] instanceof IRule) {
- name = ((IRule) statements[i]).getTarget().toString();
- image = imageTarget;
- infoString = name;
- }
- if (name != null && name.startsWith(wordPart.getString())) {
- IContextInformation info = new ContextInformation(name, infoString);
- String displayString = (name.equals(infoString) ? name : name + " - " + infoString);
- ICompletionProposal result =
- new CompletionProposal(
- name,
- wordPart.getOffset(),
- wordPart.getString().length(),
- name.length(),
- image,
- displayString,
- info,
- infoString);
- proposalList.add(result);
- }
- }
- ICompletionProposal[] proposals = (ICompletionProposal[]) proposalList.toArray(new ICompletionProposal[0]);
- Arrays.sort(proposals, comparator);
- return proposals;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
- */
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
- WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset);
- boolean macro = inMacro(viewer, documentOffset);
- IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
- ArrayList contextList = new ArrayList();
- if (macro) {
- IDirective[] statements = makefile.getMacroDefinitions();
- for (int i = 0; i < statements.length; i++) {
- if (statements[i] instanceof IMacroDefinition) {
- String name = ((IMacroDefinition) statements[i]).getName();
- if (name != null && name.equals(wordPart.getString())) {
- String value = ((IMacroDefinition) statements[i]).getValue().toString();
- if (value != null && value.length() > 0) {
- contextList.add(value);
- }
- }
- }
- }
- statements = makefile.getBuiltinMacroDefinitions();
- for (int i = 0; i < statements.length; i++) {
- if (statements[i] instanceof IMacroDefinition) {
- String name = ((IMacroDefinition) statements[i]).getName();
- if (name != null && name.equals(wordPart.getString())) {
- String value = ((IMacroDefinition) statements[i]).getValue().toString();
- if (value != null && value.length() > 0) {
- contextList.add(value);
- }
- }
- }
- }
- }
-
- IContextInformation[] result = new IContextInformation[contextList.size()];
- for (int i = 0; i < result.length; i++) {
- String context = (String)contextList.get(i);
- result[i] = new ContextInformation(imageMacro, wordPart.getString(), context);
- }
- return result;
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
- */
- public char[] getCompletionProposalAutoActivationCharacters() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
- */
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
- */
- public String getErrorMessage() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
- */
- public IContextInformationValidator getContextInformationValidator() {
- return fValidator;
- }
-
- private boolean inMacro(ITextViewer viewer, int offset) {
- boolean isMacro = false;
- IDocument document = viewer.getDocument();
- // Try to figure out if we are in a Macro.
- try {
- for (int index = offset - 1; index >= 0; index--) {
- char c;
- c = document.getChar(index);
- if (c == '$') {
- isMacro = true;
- break;
- } else if (Character.isWhitespace(c)) {
- break;
- }
- }
- } catch (BadLocationException e) {
- }
- return isMacro;
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileMacroScanner.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileMacroScanner.java
deleted file mode 100644
index 4d70025b4d9..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileMacroScanner.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.text.makefile;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.IWhitespaceDetector;
-import org.eclipse.jface.text.rules.IWordDetector;
-import org.eclipse.jface.text.rules.PatternRule;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.rules.WhitespaceRule;
-import org.eclipse.jface.text.rules.WordRule;
-
-public class MakefileMacroScanner extends RuleBasedScanner {
- private String buffer;
- private final static String[] DELIMITERS = { "\r", "\n", "\r\n" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- public final static String tokenText = "text"; //$NON-NLS-1$
- public final static String tokenMacro = "macro"; //$NON-NLS-1$
- public final static String tokenOther = "other"; //$NON-NLS-1$
-
- /**
- * Constructor for MakefileMacroScanner
- */
- public MakefileMacroScanner(String buffer) {
- super();
- this.buffer = buffer;
- fOffset = 0;
-
- IToken tText = new Token(tokenText);
- IToken tMacro = new Token(tokenMacro);
- IToken tOther = new Token(tokenOther);
-
- List rules = new ArrayList();
-
- rules.add(new PatternRule("\"", "\"", tText, '\\', true)); //$NON-NLS-1$ //$NON-NLS-2$
- rules.add(new PatternRule("\'", "\'", tText, '\\', true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- rules.add(new MakefileSimpleMacroRule(tMacro));
-
- // Add generic whitespace rule.
- rules.add(new WhitespaceRule(new IWhitespaceDetector() {
- public boolean isWhitespace(char character) {
- return Character.isWhitespace(character);
- }
- }));
-
- WordRule wRule = new WordRule(new IWordDetector() {
- public boolean isWordPart(char c) {
- return isWordStart(c);
- }
- public boolean isWordStart(char c) {
- return !(((short) c == EOF) || Character.isSpaceChar(c));
- }
- }, tOther);
-
- rules.add(wRule);
-
- IRule[] result = new IRule[rules.size()];
-
- rules.toArray(result);
-
- setRules(result);
-
- setRange(null, 0, buffer.length());
- }
-
- /**
- * @see RuleBasedScanner#getColumn()
- */
- public int getColumn() {
- return fOffset;
- }
-
- /**
- * @see RuleBasedScanner#read()
- */
- public int read() {
- int c;
- if (fOffset == buffer.length())
- c = EOF;
- else
- c = buffer.charAt(fOffset);
- ++fOffset;
- return c;
- }
-
- /**
- * @see RuleBasedScanner#setRange(IDocument, int, int)
- */
- public void setRange(IDocument document, int offset, int length) {
- fDocument = document;
- fOffset = offset;
- fRangeEnd = offset + length;
-
- fDelimiters = new char[DELIMITERS.length][];
- for (int i = 0; i < DELIMITERS.length; i++)
- fDelimiters[i] = DELIMITERS[i].toCharArray();
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefilePartitionScanner.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefilePartitionScanner.java
deleted file mode 100644
index 0d7e3276432..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefilePartitionScanner.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.text.makefile;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.rules.EndOfLineRule;
-import org.eclipse.jface.text.rules.ICharacterScanner;
-import org.eclipse.jface.text.rules.IPredicateRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.MultiLineRule;
-import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
-import org.eclipse.jface.text.rules.Token;
-
-public class MakefilePartitionScanner extends RuleBasedPartitionScanner {
- // Partition types
- public final static String MAKEFILE_COMMENT = "makefile_comment"; //$NON-NLS-1$
- public final static String MAKEFILE_MACRO_ASSIGNEMENT = "makefile_macro_assignement"; //$NON-NLS-1$
- public final static String MAKEFILE_INCLUDE_BLOCK = "makefile_include_block"; //$NON-NLS-1$
- public final static String MAKEFILE_IF_BLOCK = "makefile_if_block"; //$NON-NLS-1$
- public final static String MAKEFILE_DEF_BLOCK = "makefile_def_block"; //$NON-NLS-1$
- public final static String MAKEFILE_OTHER = "makefile_other"; //$NON-NLS-1$
-
- public final static String[] TYPES =
- new String[] {
- MAKEFILE_COMMENT,
- MAKEFILE_MACRO_ASSIGNEMENT,
- MAKEFILE_INCLUDE_BLOCK,
- MAKEFILE_IF_BLOCK,
- MAKEFILE_DEF_BLOCK,
- MAKEFILE_OTHER,
- // All other
- };
-
- /** The predefined delimiters of this tracker */
- private char[][] fModDelimiters = { { '\r', '\n' }, {
- '\r' }, {
- '\n' }
- };
-
- /**
- * Constructor for MakefilePartitionScanner
- */
- public MakefilePartitionScanner() {
- super();
-
- IToken tComment = new Token(MAKEFILE_COMMENT);
- IToken tMacro = new Token(MAKEFILE_MACRO_ASSIGNEMENT);
- IToken tInclude = new Token(MAKEFILE_INCLUDE_BLOCK);
- IToken tIf = new Token(MAKEFILE_IF_BLOCK);
- IToken tDef = new Token(MAKEFILE_DEF_BLOCK);
- IToken tOther = new Token(MAKEFILE_OTHER);
-
- List rules = new ArrayList();
-
- // Add rule for single line comments.
-
- rules.add(new EndOfLineRule("#", tComment, '\\')); //$NON-NLS-1$
-
- rules.add(new EndOfLineRule("include", tInclude)); //$NON-NLS-1$
-
- rules.add(new EndOfLineRule("export", tDef)); //$NON-NLS-1$
- rules.add(new EndOfLineRule("unexport", tDef)); //$NON-NLS-1$
- rules.add(new EndOfLineRule("vpath", tDef)); //$NON-NLS-1$
- rules.add(new EndOfLineRule("override", tDef)); //$NON-NLS-1$
- rules.add(new MultiLineRule("define", "endef", tDef)); //$NON-NLS-1$
- rules.add(new MultiLineRule("override define", "endef", tDef)); //$NON-NLS-1$
-
- // Add rules for multi-line comments and javadoc.
- rules.add(new MultiLineRule("ifdef", "endif", tIf)); //$NON-NLS-1$
- rules.add(new MultiLineRule("ifndef", "endif", tIf)); //$NON-NLS-1$
- rules.add(new MultiLineRule("ifeq", "endif", tIf)); //$NON-NLS-1$
- rules.add(new MultiLineRule("ifnneq", "endif", tIf)); //$NON-NLS-1$
-
- // Last rule must be supplied with default token!
- rules.add(new MacroRule(tMacro, tOther)); //$NON-NLS-1$
-
- IPredicateRule[] result = new IPredicateRule[rules.size()];
- rules.toArray(result);
- setPredicateRules(result);
-
- }
-
- /*
- * @see ICharacterScanner#getLegalLineDelimiters
- */
- public char[][] getLegalLineDelimiters() {
- return fModDelimiters;
- }
-
- private class MacroRule implements IPredicateRule {
- private static final int INIT_STATE = 0;
- private static final int VAR_STATE = 1;
- private static final int END_VAR_STATE = 2;
- private static final int EQUAL_STATE = 3;
- private static final int FINISH_STATE = 4;
- private static final int ERROR_STATE = 5;
-
- private IToken token;
- private StringBuffer buffer = new StringBuffer();
- protected IToken defaultToken;
- public MacroRule(IToken token, IToken defaultToken) {
- this.token = token;
- this.defaultToken = defaultToken;
- }
-
- public IToken getSuccessToken() {
- return token;
- }
-
- public IToken evaluate(ICharacterScanner scanner, boolean resume) {
- buffer.setLength(0);
- int state = INIT_STATE;
-
- if (resume)
- scanToBeginOfLine(scanner);
-
- for (int c = scanner.read(); c != ICharacterScanner.EOF; c = scanner.read()) {
- switch (state) {
- case INIT_STATE :
- if (c != '\n' && Character.isWhitespace((char) c))
- break;
- if (isValidCharacter(c))
- state = VAR_STATE;
- else
- state = ERROR_STATE;
- break;
- case VAR_STATE :
- if (isValidCharacter(c))
- break;
- case END_VAR_STATE :
- if (c != '\n' && Character.isWhitespace((char) c))
- state = END_VAR_STATE;
- else if (c == ':' || c == '+')
- state = EQUAL_STATE;
- else if (c == '=')
- state = FINISH_STATE;
- else {
- if (state == END_VAR_STATE)
- scanner.unread(); // Return back to the space
- state = ERROR_STATE;
- }
- break;
- case EQUAL_STATE :
- if (c == '=')
- state = FINISH_STATE;
- else
- state = ERROR_STATE;
- break;
- case FINISH_STATE :
- break;
- default :
- break;
- }
- if (state >= FINISH_STATE)
- break;
- buffer.append((char) c);
- }
-
- scanner.unread();
-
- if (state == FINISH_STATE) {
- scanToEndOfLine(scanner);
- return token;
- }
-
- if (defaultToken.isUndefined())
- unreadBuffer(scanner);
-
- return Token.UNDEFINED;
-
- }
-
- public IToken evaluate(ICharacterScanner scanner) {
- return evaluate(scanner, false);
- }
-
- /**
- * Returns the characters in the buffer to the scanner.
- *
- * @param scanner the scanner to be used
- */
- protected void unreadBuffer(ICharacterScanner scanner) {
- for (int i = buffer.length() - 1; i >= 0; i--)
- scanner.unread();
- }
-
- private void scanToEndOfLine(ICharacterScanner scanner) {
- int c;
- char[][] delimiters = scanner.getLegalLineDelimiters();
- while ((c = scanner.read()) != ICharacterScanner.EOF) {
- // Check for end of line since it can be used to terminate the pattern.
- for (int i = 0; i < delimiters.length; i++) {
- if (c == delimiters[i][0] && sequenceDetected(scanner, delimiters[i]))
- return;
- }
- }
- }
-
- private void scanToBeginOfLine(ICharacterScanner scanner) {
- for (; scanner.getColumn() != 0; scanner.unread());
- }
-
- private boolean sequenceDetected(ICharacterScanner scanner, char[] sequence) {
- for (int i = 1; i < sequence.length; i++) {
- int c = scanner.read();
- if (c == ICharacterScanner.EOF) {
- return true;
- } else if (c != sequence[i]) {
- // Non-matching character detected, rewind the scanner back to the start.
- for (; i > 0; i--)
- scanner.unread();
- return false;
- }
- }
-
- return true;
- }
- protected boolean isValidCharacter(int c) {
- char c0 = (char) c;
- return Character.isLetterOrDigit(c0) || (c0 == '_');
- }
-
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileReconcilingStrategy.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileReconcilingStrategy.java
deleted file mode 100644
index 623699bebea..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileReconcilingStrategy.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-
-package org.eclipse.cdt.make.internal.ui.text.makefile;
-
-import java.io.IOException;
-import java.io.StringReader;
-
-import org.eclipse.cdt.make.core.makefile.IMakefile;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.internal.ui.editor.MakefileContentOutlinePage;
-import org.eclipse.cdt.make.internal.ui.editor.MakefileEditor;
-import org.eclipse.cdt.make.ui.IWorkingCopyManager;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-
-public class MakefileReconcilingStrategy implements IReconcilingStrategy {
-
-
- private int fLastRegionOffset;
- private ITextEditor fEditor;
- private IWorkingCopyManager fManager;
- private IDocumentProvider fDocumentProvider;
- private IProgressMonitor fProgressMonitor;
-
- private MakefileContentOutlinePage fOutliner;
-
- public MakefileReconcilingStrategy(MakefileEditor editor) {
- fOutliner= editor.getOutlinePage();
- fLastRegionOffset = Integer.MAX_VALUE;
- fEditor= editor;
- fManager= MakeUIPlugin.getDefault().getWorkingCopyManager();
- fDocumentProvider= MakeUIPlugin.getDefault().getMakefileDocumentProvider();
- }
-
- /**
- * @see IReconcilingStrategy#reconcile(document)
- */
- public void setDocument(IDocument document) {
- }
-
-
- /*
- * @see IReconcilingStrategyExtension#setProgressMonitor(IProgressMonitor)
- */
- public void setProgressMonitor(IProgressMonitor monitor) {
- fProgressMonitor= monitor;
- }
-
- /**
- * @see IReconcilingStrategy#reconcile(region)
- */
- public void reconcile(IRegion region) {
- // We use a trick to avoid running the reconciler multiple times
- // on a file when it gets changed. This is because this gets called
- // multiple times with different regions of the file, we do a
- // complete parse on the first region.
- if(region.getOffset() <= fLastRegionOffset) {
- reconcile();
- }
- fLastRegionOffset = region.getOffset();
- }
-
-
- /**
- * @see IReconcilingStrategy#reconcile(dirtyRegion, region)
- */
- public void reconcile(DirtyRegion dirtyRegion, IRegion region) {
- // FIXME: This seems to generate to much flashing in
- // the contentouline viewer.
- //reconcile();
- }
-
- private void reconcile() {
- IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
- String content = fDocumentProvider.getDocument(fEditor.getEditorInput()).get();
- StringReader reader = new StringReader(content);
- try {
- makefile.parse(reader);
- } catch (IOException e) {
- }
-
- fOutliner.update();
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileSimpleMacroRule.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileSimpleMacroRule.java
deleted file mode 100644
index 721c3f42450..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileSimpleMacroRule.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.text.makefile;
-
-import org.eclipse.jface.text.rules.ICharacterScanner;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.PatternRule;
-
-public class MakefileSimpleMacroRule extends PatternRule {
-
- private int nOfBrackets;
-
- public MakefileSimpleMacroRule(IToken token) {
- super("$(", ")", token, (char) 0, true); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- protected IToken doEvaluate(ICharacterScanner scanner, boolean resume) {
- nOfBrackets = 1;
- return super.doEvaluate(scanner, resume);
- }
-
- protected boolean endSequenceDetected(ICharacterScanner scanner) {
- int c;
- char[][] delimiters = scanner.getLegalLineDelimiters();
- while ((c = scanner.read()) != ICharacterScanner.EOF) {
- if ('(' == (char) c)
- ++nOfBrackets;
-
- if (fEndSequence.length > 0 && c == fEndSequence[0]) {
- // Check if the specified end sequence has been found.
- if (sequenceDetected(scanner, fEndSequence, true)) {
- if (0 == --nOfBrackets)
- return true;
- }
- } else if (fBreaksOnEOL) {
- // Check for end of line since it can be used to terminate the pattern.
- for (int i = 0; i < delimiters.length; i++) {
- if (c == delimiters[i][0] && sequenceDetected(scanner, delimiters[i], false))
- return true;
- }
- }
- }
- scanner.unread();
- return true;
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileWordDetector.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileWordDetector.java
deleted file mode 100644
index 05f7b300006..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileWordDetector.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.text.makefile;
-
-import org.eclipse.jface.text.rules.IWordDetector;
-
-public class MakefileWordDetector implements IWordDetector {
-
- private static final String correctStartSpecChars = "%*().><"; //$NON-NLS-1$
- private static final String correctSpecChars = "@$/\\"; //$NON-NLS-1$
-
- /**
- * @see IWordDetector#isWordPart(character)
- */
- public boolean isWordPart(char character) {
- return Character.isLetterOrDigit(character) || (correctSpecChars.indexOf(character) >= 0);
- }
-
- /**
- * @see IWordDetector#isWordStart(char)
- */
- public boolean isWordStart(char character) {
- return Character.isLetterOrDigit(character) || (correctStartSpecChars.indexOf(character) >= 0);
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/wizards/StatusWizardPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/wizards/StatusWizardPage.java
deleted file mode 100644
index e1e1fc2b634..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/wizards/StatusWizardPage.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.internal.ui.wizards;
-
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.wizard.WizardPage;
-
-public abstract class StatusWizardPage extends WizardPage {
-
- private IStatus fCurrStatus;
-
- private boolean fPageVisible;
- private boolean fNoErrorOnStartup;
-
- public StatusWizardPage(String name, boolean noErrorOnStartup) {
- super(name);
- fPageVisible= false;
- fCurrStatus= createStatus(IStatus.OK, ""); //$NON-NLS-1$
- fNoErrorOnStartup= noErrorOnStartup;
- }
-
- // ---- WizardPage ----------------
-
- /*
- * @see WizardPage#becomesVisible
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- fPageVisible= visible;
- // policy: wizards are not allowed to come up with an error message
- if (visible && fNoErrorOnStartup && fCurrStatus.matches(IStatus.ERROR)) {
- // keep the error state, but remove the message
- fCurrStatus= createStatus(IStatus.ERROR, ""); //$NON-NLS-1$
- }
- updateStatus(fCurrStatus);
- }
-
- /**
- * Updates the status line and the ok button depending on the status
- */
- protected void updateStatus(IStatus status) {
- fCurrStatus= status;
- setPageComplete(!status.matches(IStatus.ERROR));
- if (fPageVisible) {
- applyToStatusLine(this, status);
- }
- }
-
- /**
- * Applies the status to a dialog page
- */
- public static void applyToStatusLine(DialogPage page, IStatus status) {
- String errorMessage= null;
- String warningMessage= null;
- String statusMessage= status.getMessage();
- if (statusMessage.length() > 0) {
- if (status.matches(IStatus.ERROR)) {
- errorMessage= statusMessage;
- } else if (!status.isOK()) {
- warningMessage= statusMessage;
- }
- }
- page.setErrorMessage(errorMessage);
- page.setMessage(warningMessage,status.getSeverity());
- }
-
- public static IStatus getMoreSevere(IStatus s1, IStatus s2) {
- if (s1.getSeverity() >= s2.getSeverity()) {
- return s1;
- } else {
- return s2;
- }
- }
-
-
- public static IStatus createStatus(int severity, String message) {
- return new Status(severity, MakeUIPlugin.getUniqueIdentifier(), severity, message, null);
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IMakeHelpContextIds.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IMakeHelpContextIds.java
deleted file mode 100644
index c8f17f4ca20..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IMakeHelpContextIds.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.ui;
-
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-
-public interface IMakeHelpContextIds {
- public static final String PREFIX = MakeUIPlugin.getUniqueIdentifier() + ".";
-
- public static final String MAKE_PATH_SYMBOL_SETTINGS = PREFIX + "cdt_paths_symbols_page";
- public static final String MAKE_BUILDER_SETTINGS = PREFIX + "cdt_make_builder_page";
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManager.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManager.java
deleted file mode 100644
index 54e4b739ace..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManager.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.ui;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.ui.IEditorInput;
-
-import org.eclipse.cdt.make.core.makefile.IMakefile;
-
-/**
- * Interface for accessing working copies of IMakefile
- * objects. The original unit is only given indirectly by means
- * of an IEditorInput
. The life cycle is as follows:
- *
connect
creates and remembers a working copy of the
- * unit which is encoded in the given editor inputgetWorkingCopy
returns the working copy remembered on
- * connect
disconnect
destroys the working copy remembered on
- * connect
- * This interface is not intended to be implemented by clients. - *
- * - * - */ -public interface IWorkingCopyManager { - - /** - * Connects the given editor input to this manager. After calling - * this method, a working copy will be available for the compilation unit encoded - * in the given editor input (does nothing if there is no encoded compilation unit). - * - * @param input the editor input - * @exception CoreException if the working copy cannot be created for the - * unit - */ - void connect(IEditorInput input) throws CoreException; - - /** - * Disconnects the given editor input from this manager. After calling - * this method, a working copy for the compilation unit encoded - * in the given editor input will no longer be available. Does nothing if there - * is no encoded compilation unit, or if there is no remembered working copy for - * the compilation unit. - * - * @param input the editor input - */ - void disconnect(IEditorInput input); - - /** - * Returns the working copy remembered for the compilation unit encoded in the - * given editor input. - * - * @param input the editor input - * @return the working copy of the compilation unit, ornull
if the
- * input does not encode an editor input, or if there is no remembered working
- * copy for this compilation unit
- */
- IMakefile getWorkingCopy(IEditorInput input);
-
- /**
- * Shuts down this working copy manager. All working copies still remembered
- * by this manager are destroyed.
- */
- void shutdown();
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManagerExtension.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManagerExtension.java
deleted file mode 100644
index e33fa7c3f78..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManagerExtension.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.make.ui;
-
-import org.eclipse.ui.IEditorInput;
-
-import org.eclipse.cdt.make.core.makefile.IMakefile;
-
-/**
- * Extension interface for IWorkingCopyManager
.
- * @since 2.1
- */
-public interface IWorkingCopyManagerExtension {
-
- /**
- * Sets the given working copy for the given editor input. If the given editor input
- * is not connected to this working copy manager, this call has no effect.
- * This working copy manager does not assume the ownership of this working copy, i.e.,
- * the given working copy is not automatically be freed when this manager is shut down.
- *
- * @param input the editor input
- * @param workingCopy the working copy
- */
- void setWorkingCopy(IEditorInput input, IMakefile workingCopy);
-
- /**
- * Removes the working copy set for the given editor input. If there is no
- * working copy set for this input or this input is not connected to this
- * working copy manager, this call has no effect.
- *
- * @param input the editor input
- */
- void removeWorkingCopy(IEditorInput input);
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java
deleted file mode 100644
index 4b08da0f616..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java
+++ /dev/null
@@ -1,234 +0,0 @@
-package org.eclipse.cdt.make.ui;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002. All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.core.IMakeTargetListener;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.core.MakeTargetEvent;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Control;
-
-public class MakeContentProvider implements ITreeContentProvider, IMakeTargetListener, IResourceChangeListener {
- protected boolean bFlatten;
-
- protected StructuredViewer viewer;
-
- /**
- * Constructor for MakeContentProvider
- */
- public MakeContentProvider() {
- this(false);
- }
-
- public MakeContentProvider(boolean flat) {
- bFlatten = flat;
- }
-
- public Object[] getChildren(Object obj) {
- if (obj instanceof IWorkspaceRoot) {
- try {
- return MakeCorePlugin.getDefault().getTargetManager().getTargetBuilderProjects();
- } catch (CoreException e) {
- }
- } else if (obj instanceof IContainer) {
- ArrayList children = new ArrayList();
- try {
- IResource[] resource = ((IContainer) obj).members();
- for (int i = 0; i < resource.length; i++) {
- if (resource[i] instanceof IContainer) {
- children.add(resource[i]);
- }
- }
- children.addAll(Arrays.asList(MakeCorePlugin.getDefault().getTargetManager().getTargets((IContainer) obj)));
- } catch (CoreException e) {
- }
- return children.toArray();
- }
- return new Object[0];
- }
-
- public Object getParent(Object obj) {
- if (obj instanceof IMakeTarget) {
- return ((IMakeTarget) obj).getContainer();
- } else if (obj instanceof IContainer) {
- return ((IContainer) obj).getParent();
- }
- return null;
- }
-
- public boolean hasChildren(Object obj) {
- return getChildren(obj).length > 0;
- }
-
- public Object[] getElements(Object obj) {
- if (bFlatten) {
- List list = new ArrayList();
- Object[] children = getChildren(obj);
- for (int i = 0; i < children.length; i++) {
- list.add(children[i]);
- list.addAll(Arrays.asList(getElements(children[i])));
- }
- return list.toArray();
- }
- return getChildren(obj);
- }
-
- public void dispose() {
- if (viewer != null) {
- MakeCorePlugin.getDefault().getTargetManager().removeListener(this);
- }
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (this.viewer == null) {
- MakeCorePlugin.getDefault().getTargetManager().addListener(this);
- }
- this.viewer = (StructuredViewer) viewer;
- IWorkspace oldWorkspace = null;
- IWorkspace newWorkspace = null;
- if (oldInput instanceof IWorkspace) {
- oldWorkspace = (IWorkspace) oldInput;
- } else if (oldInput instanceof IContainer) {
- oldWorkspace = ((IContainer) oldInput).getWorkspace();
- }
- if (newInput instanceof IWorkspace) {
- newWorkspace = (IWorkspace) newInput;
- } else if (newInput instanceof IContainer) {
- newWorkspace = ((IContainer) newInput).getWorkspace();
- }
- if (oldWorkspace != newWorkspace) {
- if (oldWorkspace != null) {
- oldWorkspace.removeResourceChangeListener(this);
- }
- if (newWorkspace != null) {
- newWorkspace.addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE);
- }
- }
- }
-
- public void targetChanged(final MakeTargetEvent event) {
- final Control ctrl = viewer.getControl();
- if (ctrl != null && !ctrl.isDisposed()) {
- switch (event.getType()) {
- case MakeTargetEvent.PROJECT_ADDED :
- case MakeTargetEvent.PROJECT_REMOVED :
- ctrl.getDisplay().syncExec(new Runnable() {
- public void run() {
- if (ctrl != null && !ctrl.isDisposed()) {
- viewer.refresh();
- }
- }
- });
- break;
- case MakeTargetEvent.TARGET_ADD :
- case MakeTargetEvent.TARGET_CHANGED :
- case MakeTargetEvent.TARGET_REMOVED :
- ctrl.getDisplay().syncExec(new Runnable() {
- public void run() {
- if (ctrl != null && !ctrl.isDisposed()) {
- if (bFlatten) {
- viewer.refresh();
- } else {
- viewer.refresh(event.getTarget().getContainer());
- }
- }
- }
- });
- break;
- }
- }
- }
-
- void processDelta(IResourceDelta delta) {
- // Bail out if the widget was disposed.
- Control ctrl = viewer.getControl();
- if (ctrl == null || ctrl.isDisposed() || delta == null) {
- return;
- }
-
- // Get the affected resource
- IResource resource = delta.getResource();
- IResourceDelta[] affectedChildren = delta.getAffectedChildren(IResourceDelta.CHANGED);
-
- // Not interested in Content changes.
- for (int i = 0; i < affectedChildren.length; i++) {
- if ((affectedChildren[i].getFlags() & IResourceDelta.TYPE) != 0) {
- return;
- }
- }
-
- // Handle changed children recursively.
- for (int i = 0; i < affectedChildren.length; i++) {
- processDelta(affectedChildren[i]);
- }
-
- // Handle removed children. Issue one update for all removals.
- affectedChildren = delta.getAffectedChildren(IResourceDelta.REMOVED);
- if (affectedChildren.length > 0) {
- ArrayList affected = new ArrayList(affectedChildren.length);
- for (int i = 0; i < affectedChildren.length; i++) {
- if (affectedChildren[i].getResource() instanceof IContainer) {
- affected.add(affectedChildren[i].getResource());
- }
- }
- if (affected.size() != 0) {
- if (viewer instanceof AbstractTreeViewer) {
- ((AbstractTreeViewer) viewer).remove(affected.toArray());
- } else {
- viewer.refresh(resource);
- }
- }
- }
-
- // Handle added children. Issue one update for all insertions.
- affectedChildren = delta.getAffectedChildren(IResourceDelta.ADDED);
- if (affectedChildren.length > 0) {
- ArrayList affected = new ArrayList(affectedChildren.length);
- for (int i = 0; i < affectedChildren.length; i++) {
- if (affectedChildren[i].getResource() instanceof IContainer) {
- affected.add(affectedChildren[i].getResource());
- }
- }
- if (affected.size() != 0) {
- if (viewer instanceof AbstractTreeViewer) {
- ((AbstractTreeViewer) viewer).add(resource, affected.toArray());
- } else {
- viewer.refresh(resource);
- }
- }
- }
- }
-
- public void resourceChanged(IResourceChangeEvent event) {
- final IResourceDelta delta = event.getDelta();
- Control ctrl = viewer.getControl();
- if (ctrl != null && !ctrl.isDisposed()) {
- // Do a sync exec, not an async exec, since the resource delta
- // must be traversed in this method. It is destroyed
- // when this method returns.
- ctrl.getDisplay().syncExec(new Runnable() {
- public void run() {
- processDelta(delta);
- }
- });
- }
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeLabelProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeLabelProvider.java
deleted file mode 100644
index 9829395843e..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeLabelProvider.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.eclipse.cdt.make.ui;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.internal.ui.MakeUIImages;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class MakeLabelProvider extends LabelProvider implements ITableLabelProvider {
- private IPath pathPrefix;
-
- WorkbenchLabelProvider fLableProvider = new WorkbenchLabelProvider();
-
- public MakeLabelProvider() {
- this(null);
- }
-
- public MakeLabelProvider(IPath removePrefix) {
- pathPrefix = removePrefix;
- }
- /**
- * @see ILabelProvider#getImage(Object)
- */
- public Image getImage(Object obj) {
- Image image = null;
- if (obj instanceof IMakeTarget) {
- return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_BUILD_TARGET);
- } else if (obj instanceof IContainer) {
- return fLableProvider.getImage(obj);
- }
- return image;
- }
-
- /**
- * @see ILabelProvider#getText(Object)
- */
- public String getText(Object obj) {
- if (obj instanceof IMakeTarget) {
- return ((IMakeTarget) obj).getName();
- } else if (obj instanceof IContainer) {
- return fLableProvider.getText(obj);
- }
- return "";
- }
-
- public void dispose() {
- super.dispose();
- fLableProvider.dispose();
- }
-
- public Image getColumnImage(Object obj, int columnIndex) {
- return columnIndex == 0 ? getImage(obj) : null;
- }
-
- public String getColumnText(Object obj, int columnIndex) {
- switch (columnIndex) {
- case 0 :
- return getText(obj);
- case 1 :
- if (obj instanceof IMakeTarget) {
- if (pathPrefix != null) {
- IPath targetPath = ((IMakeTarget) obj).getContainer().getProjectRelativePath();
- if (pathPrefix.isPrefixOf(targetPath)) {
- targetPath = targetPath.removeFirstSegments(pathPrefix.segmentCount());
- }
- if (targetPath.segmentCount() > 0) {
- return targetPath.toString();
- }
- }
- }
- }
- return "";
- }
-}
\ No newline at end of file
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java
deleted file mode 100644
index 80b24515ce7..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.eclipse.cdt.make.ui;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.BuildAction;
-
-public class TargetBuild {
-
- /**
- * Causes all editors to save any modified resources depending on the user's
- * preference.
- */
- static void saveAllResources(IMakeTarget[] targets) {
-
- if (!BuildAction.isSaveAllSet())
- return;
-
- List projects = new ArrayList();
- for (int i = 0; i < targets.length; ++i) {
- IMakeTarget target = targets[i];
- projects.add(target.getContainer().getProject());
- }
-
- IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (int i = 0; i < windows.length; i++) {
- IWorkbenchPage[] pages = windows[i].getPages();
- for (int j = 0; j < pages.length; j++) {
- IWorkbenchPage page = pages[j];
- IEditorReference[] editorReferences = page.getEditorReferences();
- for (int k = 0; k < editorReferences.length; k++) {
- IEditorPart editor = editorReferences[k].getEditor(false);
- if (editor != null && editor.isDirty()) {
- IEditorInput input = editor.getEditorInput();
- if (input instanceof IFileEditorInput) {
- IFile inputFile = ((IFileEditorInput) input).getFile();
- if (projects.contains(inputFile.getProject())) {
- page.saveEditor(editor, false);
- }
- }
- }
- }
- }
- }
- }
-
- static public void runWithProgressDialog(Shell shell, IMakeTarget[] targets) {
- ProgressMonitorDialog pd = new ProgressMonitorDialog(shell);
- try {
- TargetBuild.run(true, pd, targets);
- } catch (InvocationTargetException e) {
- MakeUIPlugin.errorDialog(shell, "Target Build Error", "Error Building Target", e);
- }
- }
-
- static public void run(boolean fork, IRunnableContext context, final IMakeTarget[] targets) throws InvocationTargetException {
- try {
- saveAllResources(targets);
-
- context.run(fork, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("Building Targets...", targets.length);
- for( int i = 0; i < targets.length; i++) {
- targets[i].build(new SubProgressMonitor(monitor, 1));
- }
- }
- };
- MakeUIPlugin.getWorkspace().run(runnable, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } catch (OperationCanceledException e) {
- throw new InterruptedException(e.getMessage());
- }
- }
- });
- } catch (InterruptedException e) {
- return;
- }
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetListViewerPart.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetListViewerPart.java
deleted file mode 100644
index ae02f6e1397..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetListViewerPart.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package org.eclipse.cdt.make.ui;
-
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.core.IMakeTargetManager;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.internal.ui.part.StructuredViewerPart;
-import org.eclipse.cdt.make.ui.dialogs.MakeTargetDialog;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-
-public class TargetListViewerPart extends StructuredViewerPart {
-
- private TableViewer tableViewer;
- private IMakeTarget fSelectedTarget;
- private final int ADD_TARGET = 0;
- private final int REMOVE_TARGET = 1;
- private final int EDIT_TARGET = 2;
- private IContainer fContainer;
-
- public TargetListViewerPart(IContainer container) {
- super(new String[] { "Add Target...", "Remove Target", "Edit Target..." });
- fContainer = container;
- }
-
- protected StructuredViewer createStructuredViewer(Composite parent, int style) {
- tableViewer = new TableViewer(parent, SWT.SINGLE | SWT.BORDER);
- Table table = (Table) tableViewer.getControl();
- TableLayout layout = new TableLayout();
-
- layout.addColumnData(new ColumnWeightData(50));
- TableColumn tc = new TableColumn(table, SWT.NONE, 0);
- tc.setText("Targets");
-
- layout.addColumnData(new ColumnWeightData(50));
- tc = new TableColumn(table, SWT.NONE, 1);
- tc.setText("Location");
-
- table.setLayout(layout);
- table.setHeaderVisible(true);
-
- tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- TargetListViewerPart.this.selectionChanged((IStructuredSelection) e.getSelection());
- }
- });
- tableViewer.setContentProvider(new MakeContentProvider(true));
- tableViewer.addFilter(new ViewerFilter() {
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- return (element instanceof IMakeTarget);
- }
- });
- tableViewer.setLabelProvider(new MakeLabelProvider(fContainer.getProjectRelativePath()));
- tableViewer.setInput(fContainer);
-
- return tableViewer;
- }
-
- protected void buttonSelected(Button button, int index) {
- try {
- switch (index) {
- case ADD_TARGET :
- {
- MakeTargetDialog dialog = new MakeTargetDialog(getControl().getShell(), fContainer);
- dialog.open();
- }
- break;
- case REMOVE_TARGET :
- IMakeTargetManager manager = MakeCorePlugin.getDefault().getTargetManager();
- manager.removeTarget((IMakeTarget) ((IStructuredSelection) getViewer().getSelection()).getFirstElement());
- break;
- case EDIT_TARGET :
- {
- MakeTargetDialog dialog =
- new MakeTargetDialog(
- getControl().getShell(),
- (IMakeTarget) ((IStructuredSelection) getViewer().getSelection()).getFirstElement());
- dialog.open();
- }
-
- break;
- }
- } catch (CoreException e) {
- MakeUIPlugin.errorDialog(getControl().getShell(), "Error", "Error", e);
- }
- }
-
- protected void selectionChanged(IStructuredSelection selection) {
- fSelectedTarget = (IMakeTarget) selection.getFirstElement();
- if (getViewer() != null) {
- updateEnabledState();
- }
- }
-
- public void setSelectedTarget(IMakeTarget target) {
- fSelectedTarget = target;
- if (tableViewer != null) {
- tableViewer.setSelection(new StructuredSelection(fSelectedTarget), false);
- }
- }
-
- public IMakeTarget getSelectedTarget() {
- return fSelectedTarget;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.ui.part.SharedPart#updateEnabledState()
- */
- protected void updateEnabledState() {
- super.updateEnabledState();
- setButtonEnabled(REMOVE_TARGET, fSelectedTarget != null && isEnabled());
- setButtonEnabled(EDIT_TARGET, fSelectedTarget != null && isEnabled());
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.ui.part.SharedPart#createControl(org.eclipse.swt.widgets.Composite, int, int)
- */
- public void createControl(Composite parent, int style, int span) {
- super.createControl(parent, style, span);
- updateEnabledState();
- if (getViewer() != null && fSelectedTarget != null) {
- getViewer().setSelection(new StructuredSelection(fSelectedTarget));
- }
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractTargetAction.java
deleted file mode 100644
index e154c6716ba..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractTargetAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Created on 25-Sep-2003
- *
- * Copyright (c) 2002,2003 QNX Software Systems Ltd.
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.ui.actions;
-
-import org.eclipse.cdt.core.model.ICContainer;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.actions.ActionDelegate;
-
-public abstract class AbstractTargetAction
- extends ActionDelegate
- implements IObjectActionDelegate, IWorkbenchWindowActionDelegate {
- private IWorkbenchPart fPart;
- private IWorkbenchWindow fWindow;
- private IContainer fContainer;
-
- protected Shell getShell() {
- if (fPart != null) {
- return fPart.getSite().getShell();
- } else if (fWindow != null) {
- return fWindow.getShell();
- }
- return MakeUIPlugin.getActiveWorkbenchShell();
- }
-
- protected IContainer getSelectedContainer() {
- return fContainer;
- }
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- fPart = targetPart;
- }
-
- public void init(IWorkbenchWindow window) {
- fWindow = window;
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- boolean enabled = false;
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection sel = (IStructuredSelection) selection;
- Object obj = sel.getFirstElement();
- if (obj instanceof ICElement) {
- if ( obj instanceof ICContainer) {
- fContainer = (IContainer) ((ICContainer) obj).getUnderlyingResource();
- } else {
- obj = ((ICElement)obj).getResource();
- if ( obj != null) {
- fContainer = ((IResource)obj).getParent();
- }
- }
- } else if (obj instanceof IResource) {
- if (obj instanceof IContainer) {
- fContainer = (IContainer) obj;
- } else {
- fContainer = ((IResource)obj).getParent();
- }
- } else {
- fContainer = null;
- }
- if (fContainer != null && MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(fContainer.getProject())) {
- enabled = true;
- }
- }
- action.setEnabled(enabled);
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetAction.java
deleted file mode 100644
index 4d0691504ca..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Created on 25-Jul-2003
- *
- * Copyright (c) 2002,2003 QNX Software Systems Ltd.
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.ui.actions;
-
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.ui.dialogs.BuildTargetDialog;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.window.Window;
-
-public class BuildTargetAction extends AbstractTargetAction {
-
- public void run(IAction action) {
- IContainer container = getSelectedContainer();
- if (container != null) {
- BuildTargetDialog dialog = new BuildTargetDialog(getShell(), container);
- String name = null;
- try {
- name = (String) container.getSessionProperty(new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"));
- } catch (CoreException e) {
- }
- if ( name != null) {
- IPath path = new Path(name);
- name = path.segment(path.segmentCount() - 1);
- IContainer targetContainer;
- if ( path.segmentCount() > 1) {
- path = path.removeLastSegments(1);
- targetContainer = (IContainer) container.findMember(path);
- } else {
- targetContainer = container;
- }
- IMakeTarget target = MakeCorePlugin.getDefault().getTargetManager().findTarget(targetContainer, name);
- if (target != null)
- dialog.setTarget(target);
- }
- if (dialog.open() == Window.OK) {
- IMakeTarget target = dialog.getTarget();
- if (target != null) {
- try {
- IPath path = target.getContainer().getProjectRelativePath().removeFirstSegments(container.getProjectRelativePath().segmentCount());
- path = path.append(target.getName());
- container.setSessionProperty(
- new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"),
- path.toString());
- } catch (CoreException e1) {
- }
- }
- }
- }
- }
-
-
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/CreateTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/CreateTargetAction.java
deleted file mode 100644
index 9505072608e..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/CreateTargetAction.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Created on 25-Jul-2003
- *
- * Copyright (c) 2002,2003 QNX Software Systems Ltd.
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.ui.actions;
-
-import org.eclipse.cdt.make.ui.dialogs.MakeTargetDialog;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.IAction;
-
-public class CreateTargetAction extends AbstractTargetAction {
-
- public void run(IAction action) {
- if ( getSelectedContainer() != null ) {
- MakeTargetDialog dialog;
- try {
- dialog = new MakeTargetDialog(getShell(), getSelectedContainer());
- dialog.open();
- } catch (CoreException e) {
- }
- }
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java
deleted file mode 100644
index 628861584e3..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Created on 25-Jul-2003
- *
- * Copyright (c) 2002,2003 QNX Software Systems Ltd.
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Vector;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.make.core.IMakeBuilderInfo;
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.core.IMakeTargetManager;
-import org.eclipse.cdt.make.core.MakeBuilder;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.core.MakeProjectNature;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.ui.wizards.UpdateMakeProjectWizard;
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.IResourceProxyVisitor;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
-
- private ISelection fSelection;
-
- public void dispose() {
- }
-
- public void init(IWorkbenchWindow window) {
- }
-
- public void run(IAction action) {
- if (fSelection instanceof IStructuredSelection) {
- Object[] elems = ((IStructuredSelection) fSelection).toArray();
- ArrayList projects = new ArrayList(elems.length);
-
- for (int i = 0; i < elems.length; i++) {
- Object elem = elems[i];
- IProject project = null;
-
- if (elem instanceof IFile) {
- IFile file = (IFile) elem;
- project = file.getProject();
- } else if (elem instanceof IProject) {
- project = (IProject) elem;
- } else if (elem instanceof ICProject) {
- project = ((ICProject) elem).getProject();
- }
- if (project != null) {
- projects.add(project);
- }
- }
-
- final IProject[] projectArray = (IProject[]) projects.toArray(new IProject[projects.size()]);
-
- UpdateMakeProjectWizard wizard = new UpdateMakeProjectWizard(projectArray);
- WizardDialog dialog = new WizardDialog(MakeUIPlugin.getActiveWorkbenchShell(), wizard);
- dialog.open();
- }
-
- }
-
- public static IProject[] getOldProjects() {
- IProject[] project = MakeUIPlugin.getWorkspace().getRoot().getProjects();
- Vector result = new Vector();
- try {
- for (int i = 0; i < project.length; i++) {
- if (isOldProject(project[i])) {
- result.add(project[i]);
- }
- }
- } catch (CoreException e) {
- MakeUIPlugin.logException(e);
- }
-
- return (IProject[]) result.toArray(new IProject[result.size()]);
- }
-
- protected static boolean isOldProject(IProject project) throws CoreException {
- if (project.isAccessible()) {
- IProjectDescription desc = project.getDescription();
- ICommand builder[] = desc.getBuildSpec();
- for (int j = 0; j < builder.length; j++) {
- if (builder[j].getBuilderName().equals(MakeCorePlugin.OLD_BUILDER_ID)) {
- return true;
- }
- }
- }
- return false;
- }
-
- static public void run(boolean fork, IRunnableContext context, final IProject[] projects) {
- try {
- context.run(fork, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- doProjectUpdate(monitor, projects);
- }
- };
- MakeUIPlugin.getWorkspace().run(runnable, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } catch (OperationCanceledException e) {
- throw new InterruptedException(e.getMessage());
- }
- }
- });
- } catch (InterruptedException e) {
- return;
- } catch (InvocationTargetException e) {
- MakeUIPlugin.logException(e, "Error", "Error updating Make Projects");
- }
- }
-
- public static class TargetConvertVisitor implements IResourceProxyVisitor {
- private final int TOTAL_WORK = 100;
- private int halfWay = TOTAL_WORK / 2;
- private int currentIncrement = 4;
- private int nextProgress = currentIncrement;
- private int worked = 0;
- IProgressMonitor monitor;
-
- public TargetConvertVisitor(IProgressMonitor monitor) {
- this.monitor = monitor;
- monitor.beginTask("Converting Make Targets...", TOTAL_WORK);
- }
-
- public boolean visit(IResourceProxy proxy) throws CoreException {
- try {
- if (proxy.getType() != IResource.FOLDER && proxy.getType() != IResource.PROJECT) {
- return false;
- }
- IContainer container = (IContainer) proxy.requestResource();
- monitor.subTask(container.getProjectRelativePath().toString());
- QualifiedName qName = new QualifiedName("org.eclipse.cdt.make", "goals");
- String goal = container.getPersistentProperty(qName);
- if (goal != null) {
- goal = goal.trim();
- IMakeTargetManager manager = MakeCorePlugin.getDefault().getTargetManager();
- String[] builder = manager.getTargetBuilders(container.getProject());
- IMakeTarget target = manager.createTarget(container.getProject(), goal, builder[0]);
- target.setBuildTarget(goal);
- manager.addTarget(container, target);
- container.setPersistentProperty(qName, null);
- }
- return true;
- } finally {
- if (--nextProgress <= 0) {
- //we have exhausted the current increment, so report progress
- monitor.worked(1);
- worked++;
- if (worked >= halfWay) {
- //we have passed the current halfway point, so double the
- //increment and reset the halfway point.
- currentIncrement *= 2;
- halfWay += (TOTAL_WORK - halfWay) / 2;
- }
- //reset the progress counter to another full increment
- nextProgress = currentIncrement;
- }
-
- }
- }
- }
-
- protected static void doProjectUpdate(IProgressMonitor monitor, IProject[] project) throws CoreException {
- monitor.beginTask("Updating make Projects...", project.length * 4);
- try {
- for (int i = 0; i < project.length; i++) {
- // remove old builder
- project[i].refreshLocal(IResource.DEPTH_ONE, new SubProgressMonitor(monitor, 1));
- MakeProjectNature.removeFromBuildSpec(
- project[i],
- MakeCorePlugin.OLD_BUILDER_ID,
- new SubProgressMonitor(monitor, 1));
-
- // convert .cdtproject
- CCorePlugin.getDefault().mapCProjectOwner(project[i], MakeCorePlugin.MAKE_PROJECT_ID, true);
- // add new nature
- MakeProjectNature.addNature(project[i], new SubProgressMonitor(monitor, 1));
-
- // move existing build properties to new
- IMakeBuilderInfo newInfo = MakeCorePlugin.createBuildInfo(project[i], MakeBuilder.BUILDER_ID);
- final int LOCATION = 0, FULL_ARGS = 1, INC_ARGS = 2, STOP_ERORR = 3, USE_DEFAULT = 4;
- QualifiedName[] qName = new QualifiedName[USE_DEFAULT + 1];
- qName[LOCATION] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildLocation");
- qName[FULL_ARGS] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildFullArguments");
- qName[INC_ARGS] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildIncrementalArguments");
- qName[STOP_ERORR] = new QualifiedName(CCorePlugin.PLUGIN_ID, "stopOnError");
- qName[USE_DEFAULT] = new QualifiedName(CCorePlugin.PLUGIN_ID, "useDefaultBuildCmd");
-
- String property = project[i].getPersistentProperty(qName[LOCATION]);
- if (property != null) {
- newInfo.setBuildCommand(new Path(property));
- }
- property = project[i].getPersistentProperty(qName[FULL_ARGS]);
- if (property != null) {
- newInfo.setBuildArguments(property);
- }
- property = project[i].getPersistentProperty(qName[STOP_ERORR]);
- if (property != null) {
- newInfo.setStopOnError(Boolean.valueOf(property).booleanValue());
- }
- property = project[i].getPersistentProperty(qName[USE_DEFAULT]);
- if (property != null) {
- newInfo.setUseDefaultBuildCmd(Boolean.valueOf(property).booleanValue());
- }
- for (int j = 0; j < qName.length; j++) {
- project[i].setPersistentProperty(qName[j], null);
- }
-
- IProgressMonitor subMon = new SubProgressMonitor(monitor, 1, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
- project[i].accept(new TargetConvertVisitor(subMon), 0);
- monitor.worked(1);
- }
- } finally {
- monitor.done();
- }
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- boolean enabled = false;
- fSelection = selection;
- if (fSelection instanceof IStructuredSelection) {
- Object sel = ((IStructuredSelection) fSelection).getFirstElement();
- if (sel instanceof IAdaptable) {
- IResource res = (IResource) ((IAdaptable) sel).getAdapter(IResource.class);
- try {
- if (res instanceof IProject && isOldProject((IProject) res)) {
- enabled = true;
- }
- } catch (CoreException e) {
- }
- }
- }
- action.setEnabled(enabled);
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildPathInfoBlock.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildPathInfoBlock.java
deleted file mode 100644
index 45d95edbe6c..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildPathInfoBlock.java
+++ /dev/null
@@ -1,643 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * QNX Software Systems - Move to Make plugin
-***********************************************************************/
-package org.eclipse.cdt.make.ui.dialogs;
-
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-import org.eclipse.cdt.internal.ui.util.SWTUtil;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.core.MakeScannerInfo;
-import org.eclipse.cdt.make.core.MakeScannerProvider;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.ui.IMakeHelpContextIds;
-import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
-import org.eclipse.cdt.utils.ui.controls.ControlFactory;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class BuildPathInfoBlock extends AbstractCOptionPage {
- private static final int PROJECT_LIST_MULTIPLIER = 10;
-
- private static final String PREF_SYMBOLS = "ScannerSymbols";
- private static final String PREF_INCLUDES = "ScannerIncludes";
- private static final String PREFIX = "BuildPathInfoBlock"; //$NON-NLS-1$
- private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
- private static final String PATHS = PREFIX + ".paths"; //$NON-NLS-1$
- private static final String SYMBOLS = PREFIX + ".symbols"; //$NON-NLS-1$
- private static final String BROWSE = PREFIX + ".browse"; //$NON-NLS-1$
- private static final String PATH_TITLE = BROWSE + ".path"; //$NON-NLS-1$
- private static final String EDIT_PATH_TITLE = BROWSE + ".path.edit"; //$NON-NLS-1$
- private static final String PATH_LABEL = BROWSE + ".path.label"; //$NON-NLS-1$
- private static final String SYMBOL_TITLE = BROWSE + ".symbol"; //$NON-NLS-1$
- private static final String EDIT_SYMBOL_TITLE = BROWSE + ".symbol.edit"; //$NON-NLS-1$
- private static final String SYMBOL_LABEL = BROWSE + ".symbol.label"; //$NON-NLS-1$
- private static final String NEW = "BuildPropertyCommon.label.new"; //$NON-NLS-1$
- private static final String EDIT = "BuildPropertyCommon.label.edit"; //$NON-NLS-1$
- private static final String REMOVE = "BuildPropertyCommon.label.remove"; //$NON-NLS-1$
- private static final String UP = "BuildPropertyCommon.label.up"; //$NON-NLS-1$
- private static final String DOWN = "BuildPropertyCommon.label.down"; //$NON-NLS-1$
-
- private List pathList;
- private List symbolList;
- private Composite pathButtonComp;
- private Button addPath;
- private Button editPath;
- private Button removePath;
- private Button pathUp;
- private Button pathDown;
- private Composite symbolButtonComp;
- private Button addSymbol;
- private Button editSymbol;
- private Button removeSymbol;
- private Button symbolUp;
- private Button symbolDown;
- private Shell shell;
-
- public BuildPathInfoBlock() {
- super(MakeUIPlugin.getResourceString(LABEL));
- setDescription("Set the include paths and preprocessor symbols for this project");
- }
-
- private void createPathListButtons(Composite parent) {
- // Create a composite for the buttons
- pathButtonComp = ControlFactory.createComposite(parent, 1);
- pathButtonComp.setFont(parent.getFont());
-
- // Add the buttons
- addPath = ControlFactory.createPushButton(pathButtonComp, MakeUIPlugin.getResourceString(NEW));
- addPath.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleAddPath();
- }
- });
- addPath.setEnabled(true);
- addPath.setFont(parent.getFont());
- addPath.setLayoutData(new GridData());
- SWTUtil.setButtonDimensionHint(addPath);
-
- editPath = ControlFactory.createPushButton(pathButtonComp, MakeUIPlugin.getResourceString(EDIT));
- editPath.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- editPathListItem();
- }
- });
- editPath.setEnabled(true);
- editPath.setFont(parent.getFont());
- editPath.setLayoutData(new GridData());
- SWTUtil.setButtonDimensionHint(editPath);
-
- removePath = ControlFactory.createPushButton(pathButtonComp, MakeUIPlugin.getResourceString(REMOVE));
- removePath.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleRemovePath();
- }
- });
- removePath.setFont(parent.getFont());
- removePath.setLayoutData(new GridData());
- SWTUtil.setButtonDimensionHint(removePath);
-
- pathUp = ControlFactory.createPushButton(pathButtonComp, MakeUIPlugin.getResourceString(UP));
- pathUp.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handlePathUp();
- }
- });
- pathUp.setFont(parent.getFont());
- pathUp.setLayoutData(new GridData());
- SWTUtil.setButtonDimensionHint(pathUp);
-
- pathDown = ControlFactory.createPushButton(pathButtonComp, MakeUIPlugin.getResourceString(DOWN));
- pathDown.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handlePathDown();
- }
- });
- pathDown.setFont(parent.getFont());
- pathDown.setLayoutData(new GridData());
- SWTUtil.setButtonDimensionHint(pathDown);
-
- }
-
- private void createPathListControl(Composite parent, int numColumns) {
- // Create the list
- pathList = new List(parent, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
- pathList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- enablePathButtons();
- }
- });
- pathList.addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- editPathListItem();
- }
- });
-
- // Make it occupy the first 2 columns
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalSpan = numColumns - 1;
- gd.heightHint = getDefaultFontHeight(pathList, PROJECT_LIST_MULTIPLIER);
- pathList.setLayoutData(gd);
- pathList.setFont(parent.getFont());
-
- }
-
- /**
- * Get the defualt widget height for the supplied control.
- * @return int
- * @param control - the control being queried about fonts
- * @param lines - the number of lines to be shown on the table.
- */
- private static int getDefaultFontHeight(Control control, int lines) {
- FontData[] viewerFontData = control.getFont().getFontData();
- int fontHeight = 10;
-
- //If we have no font data use our guess
- if (viewerFontData.length > 0)
- fontHeight = viewerFontData[0].getHeight();
- return lines * fontHeight;
- }
-
- private void createSymbolListButtons(Composite parent) {
- // Create a composite for the buttons
- symbolButtonComp = ControlFactory.createComposite(parent, 1);
- symbolButtonComp.setFont(parent.getFont());
-
- // Add the buttons
- addSymbol = ControlFactory.createPushButton(symbolButtonComp, MakeUIPlugin.getResourceString(NEW));
- addSymbol.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleAddSymbol();
- }
- });
- addSymbol.setEnabled(true);
- addSymbol.setFont(parent.getFont());
- addSymbol.setLayoutData(new GridData());
- SWTUtil.setButtonDimensionHint(addSymbol);
-
- editSymbol = ControlFactory.createPushButton(symbolButtonComp, MakeUIPlugin.getResourceString(EDIT));
- editSymbol.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- editSymbolListItem();
- }
- });
- editSymbol.setEnabled(true);
- editSymbol.setFont(parent.getFont());
- editSymbol.setLayoutData(new GridData());
- SWTUtil.setButtonDimensionHint(editSymbol);
-
- removeSymbol = ControlFactory.createPushButton(symbolButtonComp, MakeUIPlugin.getResourceString(REMOVE));
- removeSymbol.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleRemoveSymbol();
- }
- });
- removeSymbol.setFont(parent.getFont());
- removeSymbol.setLayoutData(new GridData());
- SWTUtil.setButtonDimensionHint(removeSymbol);
-
- symbolUp = ControlFactory.createPushButton(symbolButtonComp, MakeUIPlugin.getResourceString(UP));
- symbolUp.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleSymbolUp();
- }
- });
- symbolUp.setFont(parent.getFont());
- symbolUp.setLayoutData(new GridData());
- SWTUtil.setButtonDimensionHint(symbolUp);
-
- symbolDown = ControlFactory.createPushButton(symbolButtonComp, MakeUIPlugin.getResourceString(DOWN));
- symbolDown.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleSymbolDown();
- }
- });
- symbolDown.setFont(parent.getFont());
- symbolDown.setLayoutData(new GridData());
- SWTUtil.setButtonDimensionHint(symbolDown);
- }
-
- private void createSymbolListControl(Composite parent, int numColumns) {
- // Create the list
- symbolList = new List(parent, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
- symbolList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- enableSymbolButtons();
- }
- });
- symbolList.addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- editSymbolListItem();
- }
- });
-
- // Make it occupy the first n-1 columns
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.horizontalSpan = numColumns - 1;
- gd.grabExcessHorizontalSpace = true;
- gd.heightHint = getDefaultFontHeight(pathList, PROJECT_LIST_MULTIPLIER);
- symbolList.setLayoutData(gd);
- symbolList.setFont(parent.getFont());
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.ui.wizards.IWizardTab#doRun(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void performApply(IProgressMonitor monitor) throws CoreException {
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
- if (getContainer().getProject() != null) {
- // Store the paths and symbols
- monitor.beginTask("Setting Scanner Info", 3);
- MakeScannerInfo info = MakeScannerProvider.getDefault().getMakeScannerInfo(getContainer().getProject(), false);
- info.setIncludePaths(getPathListContents());
- monitor.worked(1);
- info.setPreprocessorSymbols(getSymbolListContents());
- monitor.worked(1);
- info.update();
- monitor.done();
- } else {
- setIncludes(MakeCorePlugin.getDefault().getPluginPreferences());
- setSymbols(MakeCorePlugin.getDefault().getPluginPreferences());
- }
- }
-
- public void performDefaults() {
- pathList.removeAll();
- symbolList.removeAll();
- if (getContainer().getProject() != null) {
- pathList.setItems(getIncludes(MakeCorePlugin.getDefault().getPluginPreferences()));
- symbolList.setItems(getSymbols(MakeCorePlugin.getDefault().getPluginPreferences()));
- }
- getContainer().updateContainer();
- }
-
- private void setSymbols(Preferences prefs) {
- prefs.setValue(PREF_SYMBOLS, stringArrayToString(getSymbolListContents()));
- }
-
- private void setIncludes(Preferences prefs) {
- prefs.setValue(PREF_INCLUDES, stringArrayToString(getPathListContents()));
- }
-
- private String stringArrayToString(String[] strings) {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < strings.length; i++) {
- buf.append(strings[i]).append(';');
- }
- return buf.toString();
- }
-
- private String[] getSymbols(Preferences prefs) {
- String syms = prefs.getString(PREF_SYMBOLS);
- return parseStringToList(syms);
- }
-
- private String[] getIncludes(Preferences prefs) {
- String syms = prefs.getString(PREF_INCLUDES);
- return parseStringToList(syms);
- }
-
- private String[] parseStringToList(String syms) {
- if (syms != null && syms.length() > 0) {
- StringTokenizer tok = new StringTokenizer(syms, ";");
- ArrayList list = new ArrayList(tok.countTokens());
- while (tok.hasMoreElements()) {
- list.add(tok.nextToken());
- }
- return (String[]) list.toArray(new String[list.size()]);
- }
- return new String[0];
- }
-
- /*
- * Double-click handler to allow edit of path information
- */
- protected void editPathListItem() {
- // Edit the selection index
- int index = pathList.getSelectionIndex();
- if (index != -1) {
- String selItem = pathList.getItem(index);
- if (selItem != null) {
- InputDialog dialog =
- new InputDialog(
- shell,
- MakeUIPlugin.getResourceString(EDIT_PATH_TITLE),
- MakeUIPlugin.getResourceString(PATH_LABEL),
- selItem,
- null);
- String newItem = null;
- if (dialog.open() == InputDialog.OK) {
- newItem = dialog.getValue();
- if (newItem != null && !newItem.equals(selItem)) {
- pathList.setItem(index, newItem);
- }
- }
- }
- }
- }
-
- /*
- * Double-click handler to allow edit of symbol information
- */
- protected void editSymbolListItem() {
- // Edit the selection index
- int index = symbolList.getSelectionIndex();
- if (index != -1) {
- String selItem = symbolList.getItem(index);
- if (selItem != null) {
- InputDialog dialog =
- new InputDialog(
- shell,
- MakeUIPlugin.getResourceString(EDIT_SYMBOL_TITLE),
- MakeUIPlugin.getResourceString(SYMBOL_LABEL),
- selItem,
- null);
- String newItem = null;
- if (dialog.open() == InputDialog.OK) {
- newItem = dialog.getValue();
- if (newItem != null && !newItem.equals(selItem)) {
- symbolList.setItem(index, newItem);
- }
- }
- }
- }
- }
-
- /*
- * Enables the buttons on the path control if the right conditions are met
- */
- void enablePathButtons() {
- // Enable the remove button if there is at least 1 item in the list
- int items = pathList.getItemCount();
- if (items > 0) {
- editPath.setEnabled(true);
- removePath.setEnabled(true);
- // Enable the up/down buttons depending on what item is selected
- int index = pathList.getSelectionIndex();
- pathUp.setEnabled(items > 1 && index > 0);
- pathDown.setEnabled(items > 1 && index < (items - 1));
- } else {
- editPath.setEnabled(false);
- removePath.setEnabled(false);
- pathUp.setEnabled(false);
- pathDown.setEnabled(false);
- }
- }
-
- void enableSymbolButtons() {
- // Enable the remove button if there is at least 1 item in the list
- int items = symbolList.getItemCount();
- if (items > 0) {
- editSymbol.setEnabled(true);
- removeSymbol.setEnabled(true);
- // Enable the up/down buttons depending on what item is selected
- int index = symbolList.getSelectionIndex();
- symbolUp.setEnabled(items > 1 && index > 0);
- symbolDown.setEnabled(items > 1 && index < (items - 1));
- } else {
- editSymbol.setEnabled(false);
- removeSymbol.setEnabled(false);
- symbolUp.setEnabled(false);
- symbolDown.setEnabled(false);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.ui.wizards.IWizardTab#getControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- // Create the composite control for the tab
- int tabColumns = 3;
- Font font = parent.getFont();
- Composite composite = ControlFactory.createComposite(parent, tabColumns);
- composite.setFont(font);
- GridData gd;
- setControl(composite);
-
- WorkbenchHelp.setHelp(getControl(), IMakeHelpContextIds.MAKE_PATH_SYMBOL_SETTINGS);
-
- // Create a label for the include paths control
- Label paths = ControlFactory.createLabel(composite, MakeUIPlugin.getResourceString(PATHS));
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = tabColumns;
- paths.setLayoutData(gd);
- paths.setFont(font);
-
- //Create the list and button controls
- createPathListControl(composite, tabColumns);
- createPathListButtons(composite);
- enablePathButtons();
-
- // Create a label for the symbols control
- Label symbols = ControlFactory.createLabel(composite, MakeUIPlugin.getResourceString(SYMBOLS));
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = tabColumns;
- symbols.setLayoutData(gd);
- symbols.setFont(font);
-
- // Create list and button controls for symbols
- createSymbolListControl(composite, tabColumns);
- createSymbolListButtons(composite);
- enableSymbolButtons();
-
- setListContents();
- pathList.select(0);
- enablePathButtons();
- symbolList.select(0);
- enableSymbolButtons();
- }
-
- private String[] getPathListContents() {
- return pathList.getItems();
- }
-
- private String[] getSymbolListContents() {
- return symbolList.getItems();
- }
-
- protected void handleAddPath() {
- // Popup an entry dialog
- InputDialog dialog = new InputDialog(shell, MakeUIPlugin.getResourceString(PATH_TITLE), MakeUIPlugin.getResourceString(PATH_LABEL), "", null); //$NON-NLS-1$
- String path = null;
- if (dialog.open() == InputDialog.OK) {
- path = dialog.getValue();
- }
- if (path != null && path.length() > 0) {
- pathList.add(path);
- pathList.select(pathList.getItemCount() - 1);
- enablePathButtons();
- }
- }
-
- protected void handleAddSymbol() {
- // Popup an entry dialog
- InputDialog dialog = new InputDialog(shell, MakeUIPlugin.getResourceString(SYMBOL_TITLE), MakeUIPlugin.getResourceString(SYMBOL_LABEL), "", null); //$NON-NLS-1$
- String symbol = null;
- if (dialog.open() == InputDialog.OK) {
- symbol = dialog.getValue();
- }
- if (symbol != null && symbol.length() > 0) {
- symbolList.add(symbol);
- symbolList.select(symbolList.getItemCount() - 1);
- enableSymbolButtons();
- }
- }
-
- protected void handlePathDown() {
- // Get the selection index
- int index = pathList.getSelectionIndex();
- int items = pathList.getItemCount();
- if (index == -1 || index == items - 1) {
- return;
- }
- // Swap the items in the list
- String selItem = pathList.getItem(index);
- pathList.remove(index);
- if (index + 1 == items) {
- pathList.add(selItem);
- } else {
- pathList.add(selItem, ++index);
- }
-
- // Keep the swapped item selected
- pathList.select(index);
- enablePathButtons();
- }
-
- protected void handlePathUp() {
- // Get the selection index
- int index = pathList.getSelectionIndex();
- if (index == -1 || index == 0) {
- return;
- }
- // Swap the items in the list
- String selItem = pathList.getItem(index);
- pathList.remove(index);
- pathList.add(selItem, --index);
-
- // Keep the index selected
- pathList.select(index);
- enablePathButtons();
- }
-
- protected void handleRemovePath() {
- // Get the selection index
- int index = pathList.getSelectionIndex();
- if (index == -1) {
- return;
- }
-
- // Remove the element at that index
- pathList.remove(index);
- index = index - 1 < 0 ? 0 : index - 1;
- pathList.select(index);
-
- // Check if the buttons should still be enabled
- enablePathButtons();
- }
-
- protected void handleRemoveSymbol() {
- // Get the selection index
- int index = symbolList.getSelectionIndex();
- if (index == -1) {
- return;
- }
- // Remove the item at that index
- symbolList.remove(index);
- index = index - 1 < 0 ? 0 : index - 1;
- symbolList.select(index);
- // Check if the button state should be toggled
- enableSymbolButtons();
- }
-
- protected void handleSymbolDown() {
- // Get the selection index
- int index = symbolList.getSelectionIndex();
- int items = symbolList.getItemCount();
- if (index == -1 || index == items - 1) {
- return;
- }
- // Swap the items in the list
- String selItem = symbolList.getItem(index);
- symbolList.remove(index);
- if (index + 1 == items) {
- symbolList.add(selItem);
- } else {
- symbolList.add(selItem, ++index);
- }
-
- // Keep the swapped item selected
- symbolList.select(index);
- enableSymbolButtons();
- }
-
- protected void handleSymbolUp() {
- // Get the selection index
- int index = symbolList.getSelectionIndex();
- if (index == -1 || index == 0) {
- return;
- }
- // Swap the items in the list
- String selItem = symbolList.getItem(index);
- symbolList.remove(index);
- symbolList.add(selItem, --index);
-
- // Keep the index selected
- symbolList.select(index);
- enableSymbolButtons();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.ui.wizards.IWizardTab#isValid()
- */
- public boolean isValid() {
- // Info on this page is not critical
- return true;
- }
-
- private void setListContents() {
- if (getContainer().getProject() != null) {
- MakeScannerInfo info;
- try {
- info = MakeScannerProvider.getDefault().getMakeScannerInfo(getContainer().getProject(), false);
- pathList.setItems(info.getIncludePaths());
- symbolList.setItems(info.getPreprocessorSymbols());
- } catch (CoreException e) {
- }
- } else {
- pathList.setItems(getIncludes(MakeCorePlugin.getDefault().getPluginPreferences()));
- symbolList.setItems(getSymbols(MakeCorePlugin.getDefault().getPluginPreferences()));
- }
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildTargetDialog.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildTargetDialog.java
deleted file mode 100644
index f9fd94f3e54..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildTargetDialog.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.eclipse.cdt.make.ui.dialogs;
-
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.ui.TargetBuild;
-import org.eclipse.cdt.make.ui.TargetListViewerPart;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-public class BuildTargetDialog extends Dialog {
- private TargetListViewerPart targetPart;
- private IContainer fContainer;
-
- public BuildTargetDialog(Shell shell, IContainer container) {
- super(shell);
- fContainer = container;
- targetPart = new TargetListViewerPart(fContainer);
- }
-
- public void setTarget(IMakeTarget target) {
- targetPart.setSelectedTarget(target);
- }
-
- public IMakeTarget getTarget() {
- return targetPart.getSelectedTarget();
- }
-
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText("Build Targets");
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- // create Build and Cancel buttons by default
- createButton(parent, IDialogConstants.OK_ID, "Build", true);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- getButton(IDialogConstants.OK_ID).setEnabled(targetPart.getSelectedTarget() != null);
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- ((GridLayout) composite.getLayout()).numColumns = 2;
- Label title = new Label(composite, SWT.NONE);
- GridData gd = new GridData();
- gd.horizontalSpan = 2;
- title.setLayoutData(gd);
- title.setText("Make Targets for: " + fContainer.getFullPath().toString().substring(1));
- targetPart.createControl(composite, SWT.NULL, 2);
-
- gd = (GridData) targetPart.getControl().getLayoutData();
- gd.heightHint = convertHeightInCharsToPixels(15);
- gd.widthHint = convertWidthInCharsToPixels(50);
- targetPart.getControl().setLayoutData(gd);
- targetPart.getViewer().addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- okPressed();
- }
- });
- targetPart.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- getButton(IDialogConstants.OK_ID).setEnabled(targetPart.getSelectedTarget() != null);
- }
- });
- return composite;
- }
-
- protected void okPressed() {
- IMakeTarget selected = targetPart.getSelectedTarget();
- super.okPressed();
- if (selected != null) {
- TargetBuild.runWithProgressDialog(getParentShell(), new IMakeTarget[] { selected });
- }
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MakeTargetDialog.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MakeTargetDialog.java
deleted file mode 100644
index ad9a0f0a360..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MakeTargetDialog.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/*******************************************************************************
- * Created on 22-Aug-2003
- *
- * Copyright (c) 2002,2003 QNX Software Systems Ltd.
- *
- * Contributors: QNX Software Systems - Initial API and implementation
- ******************************************************************************/
-package org.eclipse.cdt.make.ui.dialogs;
-
-import org.eclipse.cdt.make.core.IMakeBuilderInfo;
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.core.IMakeTargetManager;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.internal.ui.MessageLine;
-import org.eclipse.cdt.utils.ui.controls.ControlFactory;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-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.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-public class MakeTargetDialog extends Dialog {
-
- protected MessageLine fStatusLine;
- private static final String TARGET_PREFIX = "TargetBlock"; //$NON-NLS-1$
- private static final String TARGET_NAME_LABEL = TARGET_PREFIX + ".target.label";
-
- private static final String BUILD_ARGUMENT_PREFIX = "BuildTarget"; //$NON-NLS-1$
- private static final String BUILD_ARGUMENT_GROUP = BUILD_ARGUMENT_PREFIX + ".target.group_label";
- private static final String BUILD_ARGUMENT_LABEL = BUILD_ARGUMENT_PREFIX + ".target.label";
-
- private static final String SETTING_PREFIX = "SettingsBlock"; //$NON-NLS-1$
-
- private static final String MAKE_SETTING_GROUP = SETTING_PREFIX + ".makeSetting.group_label"; //$NON-NLS-1$
- private static final String MAKE_SETTING_STOP_ERROR = SETTING_PREFIX + ".makeSetting.stopOnError"; //$NON-NLS-1$
-
- private static final String MAKE_CMD_GROUP = SETTING_PREFIX + ".makeCmd.group_label"; //$NON-NLS-1$
- private static final String MAKE_CMD_USE_DEFAULT = SETTING_PREFIX + ".makeCmd.use_default"; //$NON-NLS-1$
- private static final String MAKE_CMD_LABEL = SETTING_PREFIX + ".makeCmd.label"; //$NON-NLS-1$
-
- Text targetNameText;
- Button stopOnErrorButton;
- Text commandText;
- Button defButton;
- Text targetText;
-
- IMakeTargetManager fTargetManager;
- IContainer fContainer;
-
- private IPath buildCommand;
- private boolean isDefaultCommand;
- private boolean isStopOnError;
- private String buildArguments;
- private String targetString;
- private String targetName;
- private String targetBuildID;
- protected IMakeTarget fTarget;
-
- /**
- * @param parentShell
- */
- public MakeTargetDialog(Shell parentShell, IMakeTarget target) throws CoreException {
- this(parentShell, target.getContainer());
- fTarget = target;
- isStopOnError = target.isStopOnError();
- isDefaultCommand = target.isDefaultBuildCmd();
- buildCommand = target.getBuildCommand();
- buildArguments = target.getBuildArguments();
- targetName = target.getName();
- targetString = target.getBuildTarget();
- targetBuildID = target.getTargetBuilderID();
- }
-
- /**
- * @param parentShell
- */
- public MakeTargetDialog(Shell parentShell, IContainer container) throws CoreException {
- super(parentShell);
- fContainer = container;
- fTargetManager = MakeCorePlugin.getDefault().getTargetManager();
- String[] id = fTargetManager.getTargetBuilders(container.getProject());
- if (id.length == 0) {
- throw new CoreException(
- new Status(IStatus.ERROR, MakeUIPlugin.getUniqueIdentifier(), -1, "Not target builders on the project", null));
- }
- targetBuildID = id[0];
- IMakeBuilderInfo buildInfo =
- MakeCorePlugin.createBuildInfo(container.getProject(), fTargetManager.getBuilderID(targetBuildID));
- isStopOnError = buildInfo.isStopOnError();
- isDefaultCommand = buildInfo.isDefaultBuildCmd();
- buildCommand = buildInfo.getBuildCommand();
- buildArguments = buildInfo.getBuildArguments();
- targetString = buildInfo.getIncrementalBuildTarget();
- }
-
- protected void configureShell(Shell newShell) {
- String title;
- if (fTarget == null) {
- title = "Create Make target.";
- } else {
- title = "Modify Make target,";
- }
- newShell.setText(title);
- super.configureShell(newShell);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- initializeDialogUnits(composite);
-
- String title;
- if (fTarget == null) {
- title = "Create a new Make target.";
- } else {
- title = "Modify a Make target,";
- }
-
- fStatusLine = new MessageLine(composite);
- fStatusLine.setAlignment(SWT.LEFT);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint = convertWidthInCharsToPixels(50);
- fStatusLine.setLayoutData(gd);
- fStatusLine.setMessage(title);
-
- createNameControl(composite);
- createTargetControl(composite);
- createBuildCmdControls(composite);
- createSettingControls(composite);
- return composite;
- }
-
- protected void createNameControl(Composite parent) {
- Composite composite = ControlFactory.createComposite(parent, 2);
- ((GridLayout) composite.getLayout()).makeColumnsEqualWidth = false;
- ((GridLayout) composite.getLayout()).horizontalSpacing = 0;
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Label label = ControlFactory.createLabel(composite, MakeUIPlugin.getResourceString(TARGET_NAME_LABEL));
- ((GridData) (label.getLayoutData())).horizontalAlignment = GridData.BEGINNING;
- ((GridData) (label.getLayoutData())).grabExcessHorizontalSpace = false;
- targetNameText = ControlFactory.createTextField(composite, SWT.SINGLE | SWT.BORDER);
- ((GridData) (targetNameText.getLayoutData())).horizontalAlignment = GridData.FILL;
- ((GridData) (targetNameText.getLayoutData())).grabExcessHorizontalSpace = true;
- targetNameText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event e) {
- String newName = targetNameText.getText().trim();
- if (newName.equals("")) {
- fStatusLine.setErrorMessage("Must specify a target name.");
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- } else if (
- fTarget != null
- && fTarget.getName().equals(newName)
- || fTargetManager.findTarget(fContainer, newName) == null) {
- fStatusLine.setErrorMessage(null);
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- } else {
- fStatusLine.setErrorMessage("Target with that name already exits");
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- }
- }
- });
- }
-
- protected void createSettingControls(Composite parent) {
- Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_SETTING_GROUP), 1);
- stopOnErrorButton = new Button(group, SWT.CHECK);
- stopOnErrorButton.setText(MakeUIPlugin.getResourceString(MAKE_SETTING_STOP_ERROR));
- if (isStopOnError) {
- stopOnErrorButton.setSelection(true);
- }
- if (isDefaultCommand) {
- stopOnErrorButton.setEnabled(true);
- } else {
- stopOnErrorButton.setEnabled(false);
- }
- }
-
- protected void createBuildCmdControls(Composite parent) {
- Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_CMD_GROUP), 1);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.horizontalSpacing = 0;
- layout.makeColumnsEqualWidth = false;
- group.setLayout(layout);
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- defButton = ControlFactory.createCheckBox(group, MakeUIPlugin.getResourceString(MAKE_CMD_USE_DEFAULT));
- defButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (defButton.getSelection() == true) {
- commandText.setEnabled(false);
- stopOnErrorButton.setEnabled(true);
- } else {
- commandText.setEnabled(true);
- stopOnErrorButton.setEnabled(false);
- }
- }
- });
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- defButton.setLayoutData(gd);
- Label label = ControlFactory.createLabel(group, MakeUIPlugin.getResourceString(MAKE_CMD_LABEL));
- ((GridData) (label.getLayoutData())).horizontalAlignment = GridData.BEGINNING;
- ((GridData) (label.getLayoutData())).grabExcessHorizontalSpace = false;
- commandText = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER);
- ((GridData) (commandText.getLayoutData())).horizontalAlignment = GridData.FILL;
- ((GridData) (commandText.getLayoutData())).grabExcessHorizontalSpace = true;
- commandText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event e) {
- if (commandText.getText().equals("")) {
- fStatusLine.setErrorMessage("Must specify a build command");
- }
- }
- });
- if (buildCommand != null) {
- StringBuffer cmd = new StringBuffer(buildCommand.toOSString());
- if (!isDefaultCommand) {
- String args = buildArguments;
- if (args != null && !args.equals("")) { //$NON-NLS-1$
- cmd.append(" "); //$NON-NLS-1$
- cmd.append(args);
- }
- }
- commandText.setText(cmd.toString());
- }
- if (isDefaultCommand) {
- commandText.setEnabled(false);
- } else {
- commandText.setEnabled(true);
- }
- defButton.setSelection(isDefaultCommand);
- }
-
- private void createTargetControl(Composite parent) {
- Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(BUILD_ARGUMENT_GROUP), 1);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = false;
- group.setLayout(layout);
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Label label = ControlFactory.createLabel(group, MakeUIPlugin.getResourceString(BUILD_ARGUMENT_LABEL));
- ((GridData) (label.getLayoutData())).horizontalAlignment = GridData.BEGINNING;
- ((GridData) (label.getLayoutData())).grabExcessHorizontalSpace = false;
- targetText = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER);
- ((GridData) (targetText.getLayoutData())).horizontalAlignment = GridData.FILL;
- ((GridData) (targetText.getLayoutData())).grabExcessHorizontalSpace = true;
- targetText.setText(targetString);
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- if (fTarget != null) {
- createButton(parent, IDialogConstants.OK_ID, "Update", true);
- } else {
- createButton(parent, IDialogConstants.OK_ID, "Create", true);
- }
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- //do this here because setting the text will set enablement on the ok button
- targetNameText.setFocus();
- if (targetName != null) {
- targetNameText.setText(targetName);
- } else {
- targetNameText.setText(generateUniqueName(targetString));
- }
- targetNameText.selectAll();
- }
-
- private String generateUniqueName(String targetString) {
- String newName = targetString;
- int i = 0;
- while(fTargetManager.findTarget(fContainer, newName) != null) {
- i++;
- newName = targetString + " (" + Integer.toString(i) + ")";
- }
- return newName;
- }
-
- private boolean isStopOnError() {
- return stopOnErrorButton.getSelection();
- }
-
- private boolean useDefaultBuildCmd() {
- return defButton.getSelection();
- }
-
- private String getBuildLine() {
- if (commandText != null) {
- String cmd = commandText.getText();
- if (cmd != null)
- return cmd.trim();
- }
- return null;
- }
-
- protected void okPressed() {
- IMakeTarget target = fTarget;
- try {
- if (fTarget == null) {
- target = fTargetManager.createTarget(fContainer.getProject(), targetNameText.getText().trim(), targetBuildID);
- }
-
- target.setStopOnError(isStopOnError());
- target.setUseDefaultBuildCmd(useDefaultBuildCmd());
- if (!useDefaultBuildCmd()) {
- String bldLine = getBuildLine();
- int start = 0;
- int end = -1;
- if (!bldLine.startsWith("\"")) { //$NON-NLS-1$
- end = bldLine.indexOf(' ');
- } else {
- start = 1;
- end = bldLine.indexOf('"', 1);
- }
- IPath path;
- if (end == -1) {
- path = new Path(bldLine);
- } else {
- path = new Path(bldLine.substring(start, end));
- }
- target.setBuildCommand(path);
- String args = ""; //$NON-NLS-1$
- if (end != -1) {
- args = bldLine.substring(end + 1);
- }
- target.setBuildArguments(args);
- }
- target.setBuildTarget(targetText.getText().trim());
-
- if (fTarget == null) {
- fTargetManager.addTarget(fContainer, target);
- } else {
- if (!target.getName().equals(targetNameText.getText().trim())) {
- fTargetManager.renameTarget(target, targetNameText.getText().trim());
- }
- }
- } catch (CoreException e) {
- MakeUIPlugin.errorDialog(getShell(), "Make Target Error", "Error adding target", e);
- }
- super.okPressed();
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java
deleted file mode 100644
index 002dfbaa748..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java
+++ /dev/null
@@ -1,395 +0,0 @@
-package org.eclipse.cdt.make.ui.dialogs;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.cdt.make.core.IMakeBuilderInfo;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.ui.IMakeHelpContextIds;
-import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
-import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
-import org.eclipse.cdt.utils.ui.controls.ControlFactory;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-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.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.ContainerSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class SettingsBlock extends AbstractCOptionPage {
-
- private static final String PREFIX = "SettingsBlock"; //$NON-NLS-1$
- private static final String MAKE_LABEL = PREFIX + ".label"; //$NON-NLS-1$
- private static final String MAKE_MESSAGE = PREFIX + ".message"; //$NON-NLS-1$
-
- private static final String MAKE_SETTING_GROUP = PREFIX + ".makeSetting.group_label"; //$NON-NLS-1$
- private static final String MAKE_SETTING_STOP_ERROR = PREFIX + ".makeSetting.stopOnError"; //$NON-NLS-1$
-
- private static final String MAKE_CMD_GROUP = PREFIX + ".makeCmd.group_label"; //$NON-NLS-1$
- private static final String MAKE_CMD_USE_DEFAULT = PREFIX + ".makeCmd.use_default"; //$NON-NLS-1$
- private static final String MAKE_CMD_LABEL = PREFIX + ".makeCmd.label"; //$NON-NLS-1$
-
- private static final String MAKE_WORKBENCH_BUILD_GROUP = PREFIX + ".makeWorkbench.group_label"; //$NON-NLS-1$
- private static final String MAKE_WORKBENCH_BUILD_TYPE = PREFIX + ".makeWorkbench.type"; //$NON-NLS-1$
- private static final String MAKE_WORKBENCH_BUILD_TARGET = PREFIX + ".makeWorkbench.target"; //$NON-NLS-1$
- private static final String MAKE_WORKBENCH_BUILD_AUTO = PREFIX + ".makeWorkbench.auto"; //$NON-NLS-1$
- private static final String MAKE_WORKBENCH_BUILD_INCR = PREFIX + ".makeWorkbench.incremental"; //$NON-NLS-1$
- private static final String MAKE_WORKBENCH_BUILD_FULL = PREFIX + ".makeWorkbench.full"; //$NON-NLS-1$
-
- private static final String MAKE_BUILD_DIR_GROUP = PREFIX + ".makeDir.group_label"; //$NON-NLS-1$
- private static final String MAKE_BUILD_DIR_LABEL = PREFIX + ".makeDir.label"; //$NON-NLS-1$
- private static final String MAKE_BUILD_DIR_BROWSE = PREFIX + ".makeDir.browse"; //$NON-NLS-1$
-
- Button stopOnErrorButton;
-
- Button defButton;
- Text buildCommand;
-
- Text buildLocation;
-
- Text targetFull;
- Text targetIncr;
- Text targetAuto;
- Button fullButton;
- Button incrButton;
- Button autoButton;
-
- private IMakeBuilderInfo fBuildInfo;
- private Preferences fPrefs;
- private String fBuilderID;
-
- public SettingsBlock(Preferences prefs, String builderID) {
- super(MakeUIPlugin.getResourceString(MAKE_LABEL));
- setDescription(MakeUIPlugin.getResourceString(MAKE_MESSAGE));
- fPrefs = prefs;
- fBuilderID = builderID;
- }
-
- protected void createSettingControls(Composite parent) {
- Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_SETTING_GROUP), 1);
- stopOnErrorButton = new Button(group, SWT.CHECK);
- stopOnErrorButton.setText(MakeUIPlugin.getResourceString(MAKE_SETTING_STOP_ERROR));
- if (fBuildInfo.isStopOnError()) {
- stopOnErrorButton.setSelection(true);
- }
- }
-
- protected void createBuildCmdControls(Composite parent) {
- Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_CMD_GROUP), 1);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = false;
- layout.horizontalSpacing = 0;
- group.setLayout(layout);
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- defButton = ControlFactory.createCheckBox(group, MakeUIPlugin.getResourceString(MAKE_CMD_USE_DEFAULT));
- defButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (defButton.getSelection() == true) {
- buildCommand.setEnabled(false);
- stopOnErrorButton.setEnabled(true);
- getContainer().updateContainer();
- } else {
- buildCommand.setEnabled(true);
- stopOnErrorButton.setEnabled(false);
- getContainer().updateContainer();
- }
- }
- });
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- defButton.setLayoutData(gd);
- Label label = ControlFactory.createLabel(group, MakeUIPlugin.getResourceString(MAKE_CMD_LABEL));
- ((GridData) (label.getLayoutData())).horizontalAlignment = GridData.BEGINNING;
- ((GridData) (label.getLayoutData())).grabExcessHorizontalSpace = false;
- buildCommand = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER);
- ((GridData) (buildCommand.getLayoutData())).horizontalAlignment = GridData.FILL;
- ((GridData) (buildCommand.getLayoutData())).grabExcessHorizontalSpace = true;
- buildCommand.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event e) {
- getContainer().updateContainer();
- }
- });
- if (fBuildInfo.getBuildCommand() != null) {
- StringBuffer cmd = new StringBuffer(fBuildInfo.getBuildCommand().toOSString());
- if (!fBuildInfo.isDefaultBuildCmd()) {
- String args = fBuildInfo.getBuildArguments();
- if (args != null && !args.equals("")) { //$NON-NLS-1$
- cmd.append(" "); //$NON-NLS-1$
- cmd.append(args);
- }
- }
- buildCommand.setText(cmd.toString());
- }
- if (fBuildInfo.isDefaultBuildCmd()) {
- buildCommand.setEnabled(false);
- } else {
- stopOnErrorButton.setEnabled(false);
- }
- defButton.setSelection(fBuildInfo.isDefaultBuildCmd());
- }
-
- protected void createWorkBenchBuildControls(Composite parent) {
- SelectionAdapter selectionAdapter = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- targetAuto.setEnabled(autoButton.getSelection());
- targetFull.setEnabled(fullButton.getSelection());
- targetIncr.setEnabled(incrButton.getSelection());
- getContainer().updateContainer();
- }
-
- };
- Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_GROUP), 1);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = false;
- group.setLayout(layout);
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Label label = new Label(group, SWT.NONE);
- label.setText(MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_TYPE));
- label = new Label(group, SWT.NONE);
- label.setText(MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_TARGET));
- autoButton = ControlFactory.createCheckBox(group, MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_AUTO));
- autoButton.addSelectionListener(selectionAdapter);
- autoButton.setSelection(fBuildInfo.isAutoBuildEnable());
- targetAuto = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER);
- targetAuto.setText(fBuildInfo.getAutoBuildTarget());
- ((GridData) (targetAuto.getLayoutData())).horizontalAlignment = GridData.FILL;
- ((GridData) (targetAuto.getLayoutData())).grabExcessHorizontalSpace = true;
- incrButton = ControlFactory.createCheckBox(group, MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_INCR));
- incrButton.addSelectionListener(selectionAdapter);
- incrButton.setSelection(fBuildInfo.isIncrementalBuildEnabled());
- targetIncr = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER);
- targetIncr.setText(fBuildInfo.getIncrementalBuildTarget());
- ((GridData) (targetIncr.getLayoutData())).horizontalAlignment = GridData.FILL;
- ((GridData) (targetIncr.getLayoutData())).grabExcessHorizontalSpace = true;
- fullButton = ControlFactory.createCheckBox(group, MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_FULL));
- fullButton.addSelectionListener(selectionAdapter);
- fullButton.setSelection(fBuildInfo.isFullBuildEnabled());
- targetFull = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER);
- targetFull.setText(fBuildInfo.getFullBuildTarget());
- ((GridData) (targetFull.getLayoutData())).horizontalAlignment = GridData.FILL;
- ((GridData) (targetFull.getLayoutData())).grabExcessHorizontalSpace = true;
- selectionAdapter.widgetSelected(null);
- }
-
- protected void createBuilderWorkingDirControls(Composite parent) {
- Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_GROUP), 1);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.makeColumnsEqualWidth = false;
- group.setLayout(layout);
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Label label = ControlFactory.createLabel(group, MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_LABEL));
- ((GridData) (label.getLayoutData())).horizontalAlignment = GridData.BEGINNING;
- ((GridData) (label.getLayoutData())).grabExcessHorizontalSpace = false;
- buildLocation = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER);
- ((GridData) (buildLocation.getLayoutData())).horizontalAlignment = GridData.FILL;
- ((GridData) (buildLocation.getLayoutData())).grabExcessHorizontalSpace = true;
- buildLocation.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event e) {
- getContainer().updateContainer();
- }
- });
- Button browse = new Button(group, SWT.NONE);
- browse.setText(MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_BROWSE));
- browse.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ContainerSelectionDialog dialog =
- new ContainerSelectionDialog(
- getShell(),
- getContainer().getProject(),
- true,
- "Selection Locations to build from.");
- if (dialog.open() == ContainerSelectionDialog.OK) {
- Object[] selection = dialog.getResult();
- if (selection.length > 0) {
- buildLocation.setText(((IPath) selection[0]).toOSString());
- }
- }
- }
- });
- buildLocation.setText(fBuildInfo.getBuildLocation().toOSString());
- }
-
- public void createControl(Composite parent) {
- Composite composite = ControlFactory.createComposite(parent, 1);
- setControl(composite);
-
- WorkbenchHelp.setHelp(getControl(), IMakeHelpContextIds.MAKE_BUILDER_SETTINGS);
-
- if (fBuildInfo == null) {
- ControlFactory.createEmptySpace(composite);
- ControlFactory.createLabel(composite, "Missing builder information on project.");
- return;
- }
-
- createBuildCmdControls(composite);
- createSettingControls(composite);
- createWorkBenchBuildControls(composite);
-
- if (getContainer().getProject() != null) {
- createBuilderWorkingDirControls(composite);
- }
- }
-
- public boolean isValid() {
- if (defButton != null && defButton.getSelection() != true) {
- String cmd = getBuildLine();
- if (cmd == null || cmd.length() == 0) {
- return false;
- }
- }
- return true;
- }
-
- public void performApply(IProgressMonitor monitor) throws CoreException {
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
- IWorkspace workspace = MakeUIPlugin.getWorkspace();
- // To avoid multi-build
- IWorkspaceRunnable operation = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("Applying Settings...", 1);
- IMakeBuilderInfo info;
- if (getContainer().getProject() != null) {
- info = MakeCorePlugin.createBuildInfo(getContainer().getProject(), fBuilderID);
- } else {
- info = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, false);
- }
- info.setStopOnError(isStopOnError());
- info.setUseDefaultBuildCmd(useDefaultBuildCmd());
- if (!useDefaultBuildCmd()) {
- String bldLine = getBuildLine();
- int start = 0;
- int end = -1;
- if (!bldLine.startsWith("\"")) { //$NON-NLS-1$
- end = bldLine.indexOf(' ');
- } else {
- start = 1;
- end = bldLine.indexOf('"', 1);
- }
- IPath path;
- if (end == -1) {
- path = new Path(bldLine);
- } else {
- path = new Path(bldLine.substring(start, end));
- }
- info.setBuildCommand(path);
- String args = ""; //$NON-NLS-1$
- if (end != -1) {
- args = bldLine.substring(end + 1);
- }
- info.setBuildArguments(args);
- }
- info.setAutoBuildEnable(autoButton.getSelection());
- info.setAutoBuildTarget(targetAuto.getText().trim());
- info.setIncrementalBuildEnable(incrButton.getSelection());
- info.setIncrementalBuildTarget(targetIncr.getText().trim());
- info.setFullBuildEnable(fullButton.getSelection());
- info.setFullBuildTarget(targetFull.getText().trim());
- if (buildLocation != null) {
- info.setBuildLocation(new Path(buildLocation.getText().trim()));
- }
- }
- };
- workspace.run(operation, monitor);
- }
-
- public void performDefaults() {
- IMakeBuilderInfo info;
- if (getContainer().getProject() != null) {
- info = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, false);
- } else {
- info = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, true);
- }
- if (info.isStopOnError())
- stopOnErrorButton.setSelection(true);
- else
- stopOnErrorButton.setSelection(false);
- if (info.getBuildCommand() != null) {
- StringBuffer cmd = new StringBuffer(info.getBuildCommand().toOSString());
- if (!info.isDefaultBuildCmd()) {
- String args = info.getBuildArguments();
- if (args != null && !args.equals("")) { //$NON-NLS-1$
- cmd.append(" "); //$NON-NLS-1$
- cmd.append(args);
- }
- }
- buildCommand.setText(cmd.toString());
- }
- if (info.isDefaultBuildCmd()) {
- buildCommand.setEnabled(false);
- stopOnErrorButton.setEnabled(true);
- } else {
- buildCommand.setEnabled(true);
- stopOnErrorButton.setEnabled(false);
- }
- defButton.setSelection(info.isDefaultBuildCmd());
- autoButton.setSelection(info.isAutoBuildEnable());
- targetAuto.setText(info.getAutoBuildTarget());
- incrButton.setSelection(info.isIncrementalBuildEnabled());
- targetIncr.setText(info.getIncrementalBuildTarget());
- fullButton.setSelection(info.isFullBuildEnabled());
- targetFull.setText(info.getFullBuildTarget());
- }
-
- private boolean isStopOnError() {
- return stopOnErrorButton.getSelection();
- }
-
- private boolean useDefaultBuildCmd() {
- return defButton.getSelection();
- }
-
- private String getBuildLine() {
- if (buildCommand != null) {
- String cmd = buildCommand.getText();
- if (cmd != null)
- return cmd.trim();
- }
- return null;
- }
-
- public void setContainer(ICOptionContainer container) {
- super.setContainer(container);
- if (getContainer().getProject() != null) {
- try {
- fBuildInfo = MakeCorePlugin.createBuildInfo(getContainer().getProject(), fBuilderID);
- } catch (CoreException e) {
- }
- } else {
- fBuildInfo = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, false);
- }
- }
-
- public String getErrorMessage() {
- if (!useDefaultBuildCmd()) {
- String cmd = getBuildLine();
- if (cmd == null || cmd.length() == 0) {
- return "Must enter a build command";
- }
- }
- return null;
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/AddTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/AddTargetAction.java
deleted file mode 100644
index a80a1fa95c1..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/AddTargetAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.cdt.make.ui.views;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-
-import java.util.List;
-
-import org.eclipse.cdt.make.internal.ui.MakeUIImages;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.ui.dialogs.MakeTargetDialog;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.actions.SelectionListenerAction;
-
-public class AddTargetAction extends SelectionListenerAction {
-
- Shell shell;
- IResource resource;
-
- public AddTargetAction(Shell shell) {
- super("Add Build Target");
- this.shell = shell;
-
- setToolTipText("Add Build Target");
- MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_ADD);
- }
-
- public void run() {
- if (canAdd()) {
- try {
- MakeTargetDialog dialog = new MakeTargetDialog(shell, (IContainer) getStructuredSelection().getFirstElement());
- dialog.open();
- } catch (CoreException e) {
- MakeUIPlugin.errorDialog(shell, "Internal Error", "", e);
- }
- }
-
- }
-
- protected boolean updateSelection(IStructuredSelection selection) {
- return super.updateSelection(selection) && canAdd();
- }
-
- private boolean canAdd() {
- List elements = getStructuredSelection().toList();
- if (elements.size() > 1 || elements.size() < 1) {
- return false;
- }
- if (elements.get(0) instanceof IContainer) {
- return true;
- }
- return false;
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java
deleted file mode 100644
index 54b2538acfa..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.cdt.make.ui.views;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.internal.ui.MakeUIImages;
-import org.eclipse.cdt.make.ui.TargetBuild;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.actions.SelectionListenerAction;
-
-public class BuildTargetAction extends SelectionListenerAction {
-
- Shell shell;
- IResource resource;
-
- public BuildTargetAction(Shell shell) {
- super("Build Target");
- this.shell = shell;
-
- setToolTipText("Build Target");
- MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_BUILD);
- }
-
- public void run() {
- if (canBuild()) {
- IMakeTarget[] targets = (IMakeTarget[]) getSelectedElements().toArray(new IMakeTarget[0]);
- TargetBuild.runWithProgressDialog(shell, targets);
- }
- }
-
- protected boolean updateSelection(IStructuredSelection selection) {
- return super.updateSelection(selection) && canBuild();
- }
-
- private boolean canBuild() {
- List elements = getSelectedElements();
- if (elements.size() > 0) {
- Iterator iterator = elements.iterator();
- while (iterator.hasNext()) {
- if (!(iterator.next() instanceof IMakeTarget)) {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-
- private List getSelectedElements() {
- return getStructuredSelection().toList();
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/DeleteTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/DeleteTargetAction.java
deleted file mode 100644
index 99d1aeb6dd7..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/DeleteTargetAction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.eclipse.cdt.make.ui.views;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.core.IMakeTargetManager;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.internal.ui.MakeUIImages;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.actions.SelectionListenerAction;
-
-public class DeleteTargetAction extends SelectionListenerAction {
-
- Shell shell;
- IResource resource;
-
- public DeleteTargetAction(Shell shell) {
- super("Delete Build Target");
- this.shell = shell;
-
- setToolTipText("Delete Build Target");
- MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_DELETE);
- }
-
- /**
- * Asks the user to confirm a delete operation.
- *
- * @return true
if the user says to go ahead, and false
- * if the deletion should be abandoned
- */
- boolean confirmDelete() {
- List targets = getTargetsToDelete();
- String title;
- String msg;
- if (targets.size() == 1) {
- title = "Confirm Target Deletion";
- IMakeTarget target = (IMakeTarget) targets.get(0);
- msg = MessageFormat.format("Are you sure you want to delete ''{0}''?", new Object[] { target.getName()});
- } else {
- title = "Confirm Multiple Target Deletion";
- msg =
- MessageFormat.format(
- "Are you sure you want to delete these {0} targets?",
- new Object[] { new Integer(targets.size())});
- }
- return MessageDialog.openQuestion(shell, title, msg);
- }
-
- public void run() {
- if (canDelete() && confirmDelete() == false)
- return;
- List targets = getTargetsToDelete();
- IMakeTargetManager manager = MakeCorePlugin.getDefault().getTargetManager();
- Iterator iter = targets.iterator();
- try {
- while (iter.hasNext()) {
- manager.removeTarget((IMakeTarget) iter.next());
- }
- } catch (CoreException e) {
- MakeUIPlugin.errorDialog(shell, "Target Remove Error", "Error deleting build target", e);
- }
- }
-
- protected boolean updateSelection(IStructuredSelection selection) {
- return super.updateSelection(selection) && canDelete();
- }
-
- /**
- * @return
- */
- private List getTargetsToDelete() {
- return getStructuredSelection().toList();
- }
-
- /**
- * @return
- */
- private boolean canDelete() {
- List elements = getStructuredSelection().toList();
- if (elements.size() > 0) {
- Iterator iterator = elements.iterator();
- while (iterator.hasNext()) {
- if (!(iterator.next() instanceof IMakeTarget)) {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/EditTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/EditTargetAction.java
deleted file mode 100644
index 60ab60fca52..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/EditTargetAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.cdt.make.ui.views;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-
-import java.util.List;
-
-import org.eclipse.cdt.make.core.IMakeTarget;
-import org.eclipse.cdt.make.internal.ui.MakeUIImages;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.ui.dialogs.MakeTargetDialog;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.actions.SelectionListenerAction;
-
-public class EditTargetAction extends SelectionListenerAction {
-
- Shell shell;
- IResource resource;
-
- public EditTargetAction(Shell shell) {
- super("Edit Build Target");
- this.shell = shell;
-
- setToolTipText("Edit Build Target");
- MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_EDIT);
- }
-
- public void run() {
- if (canRename()) {
- MakeTargetDialog dialog;
- try {
- dialog = new MakeTargetDialog(shell, (IMakeTarget) getStructuredSelection().getFirstElement());
- dialog.open();
- } catch (CoreException e) {
- MakeUIPlugin.errorDialog(shell, "Internal Error", "", e);
- }
- }
- }
-
- protected boolean updateSelection(IStructuredSelection selection) {
- return super.updateSelection(selection) && canRename();
- }
-
- private boolean canRename() {
- List elements = getStructuredSelection().toList();
- if (elements.size() > 1 || elements.size() < 1) {
- return false;
- }
- if (elements.get(0) instanceof IMakeTarget) {
- return true;
- }
- return false;
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java
deleted file mode 100644
index 59723ac833c..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package org.eclipse.cdt.make.ui.views;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.cdt.make.ui.*;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.part.DrillDownAdapter;
-import org.eclipse.ui.part.ViewPart;
-
-public class MakeView extends ViewPart {
-
- private BuildTargetAction buildTargetAction;
- private EditTargetAction editTargetAction;
- private DeleteTargetAction deleteTargetAction;
- AddTargetAction addTargetAction;
- TreeViewer viewer;
- DrillDownAdapter drillDownAdapter;
-
- public MakeView() {
- super();
- }
-
- /**
- * @see IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- viewer.getTree().setFocus();
- }
-
- /**
- * @see ContentOutlinePage#createControl
- */
- public void createPartControl(Composite parent) {
- viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setUseHashlookup(true);
- viewer.setContentProvider(new MakeContentProvider());
- viewer.setLabelProvider(new MakeLabelProvider());
-
- drillDownAdapter = new DrillDownAdapter(viewer);
-
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClick(event);
- }
- });
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChanged(event);
- }
- });
- viewer.getControl().addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- if (event.character == SWT.DEL && event.stateMask == 0) {
- handleDeleteKeyPressed();
- }
- }
- });
-
- viewer.setContentProvider(new MakeContentProvider());
- viewer.setLabelProvider(new MakeLabelProvider());
- viewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
- getSite().setSelectionProvider(viewer);
-
- makeActions();
- hookContextMenu();
- contributeToActionBars();
- }
-
- private void makeActions() {
- buildTargetAction = new BuildTargetAction(viewer.getControl().getShell());
- addTargetAction = new AddTargetAction(viewer.getControl().getShell());
- deleteTargetAction = new DeleteTargetAction(viewer.getControl().getShell());
- editTargetAction = new EditTargetAction(viewer.getControl().getShell());
- }
- private void contributeToActionBars() {
- IActionBars bars = getViewSite().getActionBars();
- fillLocalPullDown(bars.getMenuManager());
- fillLocalToolBar(bars.getToolBarManager());
- }
-
- private void fillLocalToolBar(IToolBarManager toolBar) {
- drillDownAdapter.addNavigationActions(toolBar);
- toolBar.add(buildTargetAction);
- }
-
- private void fillLocalPullDown(IMenuManager manager) {
- }
-
-
- private void hookContextMenu() {
- MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- MakeView.this.fillContextMenu(manager);
- updateActions((IStructuredSelection) viewer.getSelection());
- }
- });
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
-// getSite().registerContextMenu(menuMgr, viewer);
- }
-
-
- protected void fillContextMenu(IMenuManager manager) {
- manager.add(buildTargetAction);
- manager.add(addTargetAction);
- manager.add(deleteTargetAction);
- manager.add(editTargetAction);
- manager.add(new Separator());
- drillDownAdapter.addNavigationActions(manager);
-
- // Other plug-ins can contribute there actions here
-// manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- protected void handleDeleteKeyPressed() {
- deleteTargetAction.run();
- }
-
- protected void handleDoubleClick(DoubleClickEvent event) {
- buildTargetAction.run();
- }
-
- void handleSelectionChanged(SelectionChangedEvent event) {
- IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- updateActions(sel);
- }
-
- void updateActions(IStructuredSelection sel) {
- addTargetAction.selectionChanged(sel);
- buildTargetAction.selectionChanged(sel);
- deleteTargetAction.selectionChanged(sel);
- editTargetAction.selectionChanged(sel);
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/ConvertToMakeProjectWizard.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/ConvertToMakeProjectWizard.java
deleted file mode 100644
index e42817f83d1..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/ConvertToMakeProjectWizard.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.cdt.make.ui.wizards;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.ui.wizards.conversion.ConversionWizard;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-/**
- * This wizard provides a method by which the user can
- * add a C nature to a project that previously had no nature associated with it.
- */
-public class ConvertToMakeProjectWizard extends ConversionWizard {
-
- private static final String WZ_TITLE = "WizardMakeProjectConversion.title"; //$NON-NLS-1$
- private static final String WZ_DESC = "WizardMakeProjectConversion.description"; //$NON-NLS-1$
- private static final String PREFIX = "WizardMakeConversion"; //$NON-NLS-1$
- private static final String WINDOW_TITLE = "WizardMakeConversion.windowTitle"; //$NON-NLS-1$
-
- /**
- * ConvertToStdMakeConversionWizard Wizard constructor
- */
- public ConvertToMakeProjectWizard() {
- this(getWindowTitleResource(), getWzDescriptionResource());
- }
- /**
- * ConvertToStdMakeConversionWizard Wizard constructor
- *
- * @param title
- * @param desc
- */
- public ConvertToMakeProjectWizard(String title, String desc) {
- super(title, desc);
- }
-
- /**
- * Method getWzDescriptionResource, allows Wizard description label value
- * to be changed by subclasses
- *
- * @return String
- */
- protected static String getWzDescriptionResource() {
- return MakeUIPlugin.getResourceString(WZ_DESC);
- }
-
- /**
- * Method getWzTitleResource, allows Wizard description label value
- * to be changed by subclasses
- *
- * @return String
- */
- protected static String getWzTitleResource() {
- return MakeUIPlugin.getResourceString(WZ_TITLE);
- }
-
- /**
- * Method getWindowTitleResource, allows Wizard Title label value to be
- * changed by subclasses
- *
- * @return String
- */
- protected static String getWindowTitleResource() {
- return MakeUIPlugin.getResourceString(WINDOW_TITLE);
- }
-
- /**
- * Method getPrefix, allows prefix value to be changed by subclasses
- *
- * @return String
- */
- protected static String getPrefix() {
- return PREFIX;
- }
-
- /**
- * Method addPages adds our Simple to C conversion Wizard page.
- *
- * @see Wizard#createPages
- */
- public void addPages() {
- addPage(mainPage = new ConvertToMakeProjectWizardPage(getPrefix()));
- }
-
- public String getProjectID() {
- return MakeCorePlugin.MAKE_PROJECT_ID;
- }
-
- protected void doRun(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("Converting to Make Project...", 2);
- try {
- super.doRun(new SubProgressMonitor(monitor, 1));
- } finally {
- monitor.done();
- }
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/ConvertToMakeProjectWizardPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/ConvertToMakeProjectWizardPage.java
deleted file mode 100644
index 377139beafd..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/ConvertToMakeProjectWizardPage.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.cdt.make.ui.wizards;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.make.core.MakeProjectNature;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.ui.wizards.conversion.ConvertProjectWizardPage;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
-
-/**
- *
- * ConvertToStdMakeProjectWizardPage
- * Standard main page for a wizard that adds a C project Nature to a project with no nature associated with it.
- * This conversion is one way in that the project cannot be converted back (i.e have the nature removed).
- *
- * @author Judy N. Green
- * @since Aug 6, 2002
- *
- * Example useage: - *
- * mainPage = new ConvertToStdMakeProjectWizardPage("ConvertProjectPage"); - * mainPage.setTitle("Project Conversion"); - * mainPage.setDescription("Add C or C++ a Nature to a project."); - *- * - */ -public class ConvertToMakeProjectWizardPage extends ConvertProjectWizardPage { - - private static final String WZ_TITLE = "WizardMakeProjectConversion.title"; //$NON-NLS-1$ - private static final String WZ_DESC = "WizardMakeProjectConversion.description"; //$NON-NLS-1$ - - /** - * Constructor for ConvertToStdMakeProjectWizardPage. - * @param pageName - */ - public ConvertToMakeProjectWizardPage(String pageName) { - super(pageName); - } - - /** - * Method getWzTitleResource returns the correct Title Label for this class - * overriding the default in the superclass. - */ - protected String getWzTitleResource(){ - return MakeUIPlugin.getResourceString(WZ_TITLE); - } - - /** - * Method getWzDescriptionResource returns the correct description - * Label for this class overriding the default in the superclass. - */ - protected String getWzDescriptionResource(){ - return MakeUIPlugin.getResourceString(WZ_DESC); - } - - /** - * Method isCandidate returns true for all projects. - * - * @param project - * @return boolean - */ - public boolean isCandidate(IProject project) { - return true; // all - } - - public void convertProject(IProject project, IProgressMonitor monitor, String projectID) throws CoreException { - monitor.beginTask("Converting Make project...", 3); - try { - super.convertProject(project, new SubProgressMonitor(monitor, 1), projectID); - MakeProjectNature.addNature(project, new SubProgressMonitor(monitor, 1)); - CCorePlugin.getDefault().mapCProjectOwner(project, projectID, true); - } finally { - monitor.done(); - } - } - - public void createControl(Composite parent) { - super.createControl(parent); - IStructuredSelection sel = ((BasicNewResourceWizard)getWizard()).getSelection(); - if ( sel != null) { - tableViewer.setCheckedElements(sel.toArray()); - setPageComplete(validatePage()); - } - } - -} diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/MakeProjectWizardOptionPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/MakeProjectWizardOptionPage.java deleted file mode 100644 index 3d14e8d9fd0..00000000000 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/MakeProjectWizardOptionPage.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.eclipse.cdt.make.ui.wizards; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import org.eclipse.cdt.make.internal.ui.MakeProjectOptionBlock; -import org.eclipse.cdt.make.internal.ui.MakeUIPlugin; -import org.eclipse.cdt.ui.dialogs.ICOptionContainer; -import org.eclipse.cdt.ui.dialogs.ReferenceBlock; -import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock; -import org.eclipse.cdt.ui.wizards.NewCProjectWizard; -import org.eclipse.cdt.ui.wizards.NewCProjectWizardOptionPage; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.Preferences; - -/** - * Standard main page for a wizard that is creates a project resource. - *
- * This page may be used by clients as-is; it may be also be subclassed to suit. - *
- *- * Example useage: - *
- * mainPage = new CProjectWizardPage("basicCProjectPage"); - * mainPage.setTitle("Project"); - * mainPage.setDescription("Create a new project resource."); - *- * - */ -public class MakeProjectWizardOptionPage extends NewCProjectWizardOptionPage { - - public class MakeWizardOptionBlock extends MakeProjectOptionBlock { - - public MakeWizardOptionBlock(ICOptionContainer parent) { - super(parent); - } - - protected void addTabs() { - addTab(new ReferenceBlock()); - super.addTabs(); - } - } - - public MakeProjectWizardOptionPage(String title, String description) { - super("MakeProjectSettingsPage"); //$NON-NLS-1$ - setTitle(title); - setDescription(description); - } - - protected TabFolderOptionBlock createOptionBlock() { - return new MakeWizardOptionBlock(this); - } - - public IProject getProject() { - return ((NewCProjectWizard)getWizard()).getNewProject(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.ui.dialogs.ICOptionContainer#getPreference() - */ - public Preferences getPreferences() { - return MakeUIPlugin.getDefault().getPluginPreferences(); - } - -} diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/NewMakeCCProjectWizard.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/NewMakeCCProjectWizard.java deleted file mode 100644 index 90147413725..00000000000 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/NewMakeCCProjectWizard.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.eclipse.cdt.make.ui.wizards; - -/* - * (c) Copyright QNX Software Systems Ltd. 2002. - * All Rights Reserved. - */ - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.make.internal.ui.MakeUIPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; - -/** - */ -public class NewMakeCCProjectWizard extends NewMakeProjectWizard { - - private static final String WZ_TITLE = "MakeCCWizard.title"; //$NON-NLS-1$ - private static final String WZ_DESC = "MakeCCWizard.description"; //$NON-NLS-1$ - - private static final String WZ_SETTINGS_TITLE = "MakeCCWizard.title"; //$NON-NLS-1$ - private static final String WZ_SETTINGS_DESC = "MakeCCWizard.description"; //$NON-NLS-1$ - - public NewMakeCCProjectWizard() { - super(MakeUIPlugin.getResourceString(WZ_TITLE), MakeUIPlugin.getResourceString(WZ_DESC)); - } - - public void addPages() { - super.addPages(); - addPage( - fOptionPage = - new MakeProjectWizardOptionPage( - MakeUIPlugin.getResourceString(WZ_SETTINGS_TITLE), - MakeUIPlugin.getResourceString(WZ_SETTINGS_DESC))); - } - - protected void doRun(IProgressMonitor monitor) throws CoreException { - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - monitor.beginTask(MakeUIPlugin.getResourceString("MakeCCWizard.task_name"), 10); //$NON-NLS-1$ - super.doRun(new SubProgressMonitor(monitor, 9)); - // Add C++ Nature. - if (newProject != null) { - // Add C++ Nature to the newly created project. - CCorePlugin.getDefault().convertProjectFromCtoCC(newProject, new SubProgressMonitor(monitor, 1)); - } - monitor.done(); - } -} diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/NewMakeCProjectWizard.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/NewMakeCProjectWizard.java deleted file mode 100644 index dc55fddf9e0..00000000000 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/NewMakeCProjectWizard.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.eclipse.cdt.make.ui.wizards; - -/* - * (c) Copyright QNX Software Systems Ltd. 2002. - * All Rights Reserved. - */ - -import org.eclipse.cdt.make.internal.ui.MakeUIPlugin; - -/** - */ -public class NewMakeCProjectWizard extends NewMakeProjectWizard { - - private static final String WZ_TITLE = "MakeCWizard.title"; //$NON-NLS-1$ - private static final String WZ_DESC = "MakeCWizard.description"; //$NON-NLS-1$' - - private static final String WZ_SETTINGS_TITLE = "MakeCWizardSettings.title"; //$NON-NLS-1$ - private static final String WZ_SETTINGS_DESC = "MakeCWizardSettings.description"; //$NON-NLS-1$' - - public NewMakeCProjectWizard() { - super(MakeUIPlugin.getResourceString(WZ_TITLE), MakeUIPlugin.getResourceString(WZ_DESC)); - } - - public void addPages() { - super.addPages(); - addPage( - fOptionPage = - new MakeProjectWizardOptionPage( - MakeUIPlugin.getResourceString(WZ_SETTINGS_TITLE), - MakeUIPlugin.getResourceString(WZ_SETTINGS_DESC))); - } - -} diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/NewMakeProjectWizard.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/NewMakeProjectWizard.java deleted file mode 100644 index 66b2758952c..00000000000 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/NewMakeProjectWizard.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.cdt.make.ui.wizards; - -/* - * (c) Copyright QNX Software Systems Ltd. 2002. - * All Rights Reserved. - */ - -import org.eclipse.cdt.make.core.MakeCorePlugin; -import org.eclipse.cdt.make.core.MakeProjectNature; -import org.eclipse.cdt.make.internal.ui.MakeUIPlugin; -import org.eclipse.cdt.ui.wizards.NewCProjectWizard; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; - -/** - */ -public abstract class NewMakeProjectWizard extends NewCProjectWizard { - - protected MakeProjectWizardOptionPage fOptionPage; - - public NewMakeProjectWizard(String title, String desc) { - super(title, desc); - } - - protected void doRunPrologue(IProgressMonitor monitor) { - } - - protected void doRunEpilogue(IProgressMonitor monitor) { - } - - protected void doRun(IProgressMonitor monitor) throws CoreException { - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - monitor.beginTask(MakeUIPlugin.getResourceString("MakeCWizard.task_name"), 10); //$NON-NLS-1$ - - // super.doRun() just creates the project and does not assign a builder to it. - super.doRun(new SubProgressMonitor(monitor, 5)); - - MakeProjectNature.addNature(getProjectHandle(), new SubProgressMonitor(monitor, 1)); - - // Modify the project based on what the user has selected - if (newProject != null) { - fOptionPage.performApply(new SubProgressMonitor(monitor, 4)); - monitor.done(); - } - } - - public String getProjectID() { - return MakeCorePlugin.MAKE_PROJECT_ID; - } -} diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/UpdateMakeProjectWizard.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/UpdateMakeProjectWizard.java deleted file mode 100644 index e7cbae594f3..00000000000 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/UpdateMakeProjectWizard.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Created on 28-Jul-2003 - * - * Copyright (c) 2002,2003 QNX Software Systems Ltd. - * - * Contributors: - * QNX Software Systems - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.make.ui.wizards; - -import org.eclipse.cdt.make.internal.ui.MakeUIPlugin; -import org.eclipse.cdt.make.ui.actions.*; -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.wizard.Wizard; - -public class UpdateMakeProjectWizard extends Wizard { - private static final String MAKE_UPDATE_WINDOW_TITLE = "MakeWizardUpdate.window_title"; //$NON-NLS-1$ - - private UpdateMakeProjectWizardPage page1; - private IProject[] selected; - - public UpdateMakeProjectWizard(IProject[] selected) { - setDefaultPageImageDescriptor(null); - setWindowTitle(MakeUIPlugin.getResourceString(MAKE_UPDATE_WINDOW_TITLE)); - setNeedsProgressMonitor(true); - this.selected = selected; - } - - public boolean performFinish() { - Object[] finalSelected = page1.getSelected(); - - IProject[] projectArray = new IProject[finalSelected.length]; - System.arraycopy(finalSelected, 0, projectArray, 0, finalSelected.length); - UpdateMakeProjectAction.run(true, getContainer(), projectArray); - return true; - } - - public void addPages() { - page1 = new UpdateMakeProjectWizardPage(selected); - addPage(page1); - } -} diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/UpdateMakeProjectWizardPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/UpdateMakeProjectWizardPage.java deleted file mode 100644 index 497fb0b8e0d..00000000000 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/UpdateMakeProjectWizardPage.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Created on 28-Jul-2003 - * - * Copyright (c) 2002,2003 QNX Software Systems Ltd. - * - * Contributors: - * QNX Software Systems - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.make.ui.wizards; - -import org.eclipse.cdt.make.internal.ui.MakeUIPlugin; -import org.eclipse.cdt.make.internal.ui.part.WizardCheckboxTablePart; -import org.eclipse.cdt.make.internal.ui.wizards.StatusWizardPage; -import org.eclipse.cdt.make.ui.actions.UpdateMakeProjectAction; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -public class UpdateMakeProjectWizardPage extends StatusWizardPage { - - private static final String MAKE_UPDATE_TITLE = "MakeWizardUpdatePage.title"; //$NON-NLS-1$ - private static final String MAKE_UPDATE_DESCRIPTION = "MakeWizardUpdatePage.description"; //$NON-NLS-1$ - - private IProject[] selected; - private CheckboxTableViewer makeProjectListViewer; - private TablePart tablePart; - - public class MakeProjectContentProvider implements IStructuredContentProvider { - public Object[] getElements(Object parent) { - return UpdateMakeProjectAction.getOldProjects(); - } - - public void dispose() { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - } - - class TablePart extends WizardCheckboxTablePart { - public TablePart(String mainLabel) { - super(mainLabel); - } - public void updateCounter(int count) { - super.updateCounter(count); - dialogChanged(); - } - protected StructuredViewer createStructuredViewer(Composite parent, int style) { - StructuredViewer viewer = super.createStructuredViewer(parent, style); - return viewer; - } - } - - public UpdateMakeProjectWizardPage(IProject[] selected) { - super("UpdateMakeProjectWizardPage", true); //$NON-NLS-1$ - setTitle(MakeUIPlugin.getResourceString(MAKE_UPDATE_TITLE)); - setDescription(MakeUIPlugin.getResourceString(MAKE_UPDATE_DESCRIPTION)); - this.selected = selected; - tablePart = new TablePart("Project list"); - } - - public void dispose() { - super.dispose(); - } - - public void createControl(Composite parent) { - Composite container = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.marginHeight = 0; - layout.marginWidth = 5; - container.setLayout(layout); - - tablePart.createControl(container); - makeProjectListViewer = tablePart.getTableViewer(); - makeProjectListViewer.setContentProvider(new MakeProjectContentProvider()); - makeProjectListViewer.setLabelProvider(new WorkbenchLabelProvider()); - - GridData gd = (GridData) tablePart.getControl().getLayoutData(); - gd.heightHint = 300; - gd.widthHint = 300; - - makeProjectListViewer.setInput(MakeUIPlugin.getWorkspace().getRoot()); - tablePart.setSelection(selected); - setControl(container); - Dialog.applyDialogFont(container); - } - - public void storeSettings() { - } - - public Object[] getSelected() { - return tablePart.getSelection(); - } - - void dialogChanged() { - IStatus genStatus = validatePlugins(); - updateStatus(genStatus); - } - - - private IStatus validatePlugins() { - Object[] allModels = UpdateMakeProjectAction.getOldProjects(); - if (allModels == null || allModels.length == 0) { - return createStatus(IStatus.ERROR, "No projects to update"); - } - if (tablePart.getSelectionCount() == 0) { - return createStatus(IStatus.ERROR, "No projects selected"); - } - return createStatus(IStatus.OK, ""); //$NON-NLS-1$ - } -} diff --git a/build/org.eclipse.cdt.managedbuilder.core/.classpath b/build/org.eclipse.cdt.managedbuilder.core/.classpath deleted file mode 100644 index 065ac06e197..00000000000 --- a/build/org.eclipse.cdt.managedbuilder.core/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - -
10th July, 2002
-Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. -For purposes of the CPL, "Program" will mean the Content.
- -If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.
- -If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.
- - - \ No newline at end of file diff --git a/build/org.eclipse.cdt.managedbuilder.core/build.properties b/build/org.eclipse.cdt.managedbuilder.core/build.properties deleted file mode 100644 index 9f95adad610..00000000000 --- a/build/org.eclipse.cdt.managedbuilder.core/build.properties +++ /dev/null @@ -1,6 +0,0 @@ -bin.includes = plugin.xml,\ - plugin.properties,\ - about.html,\ - schema/,\ - mngbuildcore.jar -source.mngbuildcore.jar = src/ diff --git a/build/org.eclipse.cdt.managedbuilder.core/plugin.properties b/build/org.eclipse.cdt.managedbuilder.core/plugin.properties deleted file mode 100644 index 20c7c57bb40..00000000000 --- a/build/org.eclipse.cdt.managedbuilder.core/plugin.properties +++ /dev/null @@ -1,5 +0,0 @@ -pluginName=C/C++ Managed Builder Core -providerName=Eclipse.org - -GeneratedMakefileCBuilder.name=Generated Makefile Builder -ManagedBuildNature.name=Managed Builder Project \ No newline at end of file diff --git a/build/org.eclipse.cdt.managedbuilder.core/plugin.xml b/build/org.eclipse.cdt.managedbuilder.core/plugin.xml deleted file mode 100644 index adbfc6c5bc8..00000000000 --- a/build/org.eclipse.cdt.managedbuilder.core/plugin.xml +++ /dev/null @@ -1,71 +0,0 @@ - - -true
if the build system knows how to
- * build a file with the extension passed in the argument.
- *
- * @param srcExt
- * @return
- */
- public boolean buildsFileType(String srcExt);
-
- /**
- * Returns the name of the artifact to build for the receiver.
- *
- * @return
- */
- public String getBuildArtifactName();
-
- /**
- * Answers the command needed to remove files on the build machine
- *
- * @return
- */
- public String getCleanCommand();
-
- /**
- * Answers the name of the default configuration, for example Debug
- * or Release
.
- *
- * @return
- */
- public String getConfigurationName();
-
- /**
- * Answers a String
array containing the names of all the configurations
- * defined for the project's current target.
- *
- * @return
- */
- public String[] getConfigurationNames();
-
- /**
- * Get the default configuration associated with the receiver
- *
- * @return
- */
- public IConfiguration getDefaultConfiguration(ITarget target);
-
-
- /**
- * Returns the default target in the receiver.
- *
- * @return
- */
- public ITarget getDefaultTarget();
-
- /**
- * Answers the extension that will be built by the current configuration
- * for the extension passed in the argument or null
.
- *
- * @param resourceName
- * @return
- */
- public String getOutputExtension(String resourceExtension);
-
- /**
- * Answers the flag to be passed to the build tool to produce a specific output
- * or an empty String
if there is no special flag. For example, the
- * GCC tools use the '-o' flag to produce a named output, for example
- * gcc -c foo.c -o foo.o
- *
- * @param outputExt
- * @return
- */
- public String getOutputFlag(String outputExt);
-
- /**
- * Get the target specified in the argument.
- *
- * @param id
- * @return
- */
- public ITarget getTarget(String id);
-
- /**
- * Answers the prefix that should be prepended to the name of the build
- * artifact. For example, a library foo, should have the prefix 'lib' and
- * the extension '.a', so the final goal would be 'libfoo.a'
- *
- * @param extension
- * @return
- */
- public String getOutputPrefix(String outputExtension);
-
- /**
- * Get all of the targets associated with the receiver.
- *
- * @return
- */
- public List getTargets();
-
- /**
- * Returns a String
containing the flags, including
- * those overridden by the user, for the tool that handles the
- * type of source file defined by the argument.
- *
- * @param extension
- * @return
- */
- public String getFlagsForSource(String extension);
-
- /**
- * Returns a String
containing the flags, including
- * those overridden by the user, for the tool that handles the
- * type of target defined by the argument.
- *
- * @param extension
- * @return
- */
- public String getFlagsForTarget(String extension);
-
- /**
- * Answers the libraries the project links in.
- *
- * @param extension
- * @return
- */
- public String[] getLibsForTarget(String extension);
-
- /**
- * Answers a String
containing the arguments to be passed to make.
- * For example, if the user has selected a build that keeps going on error, the
- * answer would contain {"-k"}.
- *
- * @return String
- */
- public String getMakeArguments();
-
- /**
- * Answers a String
containing the make command invocation
- * for the default target/configuration.
- */
- public String getMakeCommand();
-
- /**
- * Returns a String
containing the command-line invocation
- * for the tool associated with the source extension.
- *
- * @param extension the file extension of the file to be built
- * @return String
- */
- public String getToolForSource(String extension);
-
- /**
- * Returns a String
containing the command-line invocation
- * for the tool associated with the target extension.
- *
- * @param extension
- * @return
- */
- public String getToolForTarget(String extension);
-
- /**
- * Answers a String
array containing the contents of the
- * user objects option, if one is defined for the target.
- *
- * @param extension the file ecxtension of the build target
- * @return
- */
- public String[] getUserObjectsForTarget(String extension);
-
- /**
- * Answers true if the build model has been changed by the user.
- *
- * @return boolean
- */
- public boolean isDirty();
-
- /**
- * Answers true
if the extension matches one of the special
- * file extensions the tools for the target consider to be a header file.
- *
- * @param ext the file extension of the resource
- * @return boolean
- */
- public boolean isHeaderFile(String ext);
-
- /**
- * Set the dirty flag for the build model to the value of the argument.
- *
- * @param isDirty
- */
- public void setDirty(boolean isDirty);
-
- /**
- * Set the primary configuration for the receiver.
- *
- * @param configuration The IConfiguration
that will be used as the default
- * for all building.
- */
- public void setDefaultConfiguration(IConfiguration configuration);
-
- /**
- * Set the primary target for the receiver.
- *
- * @param target
- */
- public void setDefaultTarget(ITarget target);
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java
deleted file mode 100644
index 4c483d8fe97..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.cdt.managedbuilder.core;
-
-/**
- *
- */
-public interface IOption extends IBuildObject {
- // Type for the value of the option
- public static final int BOOLEAN = 0;
- public static final int ENUMERATED = 1;
- public static final int STRING = 2;
- public static final int STRING_LIST = 3;
- public static final int INCLUDE_PATH = 4;
- public static final int PREPROCESSOR_SYMBOLS = 5;
- public static final int LIBRARIES = 6;
- public static final int OBJECTS = 7;
-
- // Schema attribute names for option elements
- public static final String CATEGORY = "category";
- public static final String COMMAND = "command";
- public static final String DEFAULT_VALUE = "defaultValue";
- public static final String ENUM_VALUE = "enumeratedOptionValue";
- public static final String IS_DEFAULT = "isDefault";
- public static final String LIST_VALUE = "listOptionValue";
- public static final String TYPE_BOOL = "boolean";
- public static final String TYPE_ENUM = "enumerated";
- public static final String TYPE_INC_PATH = "includePath";
- public static final String TYPE_LIB = "libs";
- public static final String TYPE_STRING = "string";
- public static final String TYPE_STR_LIST = "stringList";
- public static final String TYPE_USER_OBJS = "userObjs";
- public static final String VALUE_TYPE = "valueType";
-
- // Schema attribute names for listOptionValue elements
- public static final String LIST_ITEM_VALUE = "value";
- public static final String LIST_ITEM_BUILTIN = "builtIn";
-
-
- /**
- * If this option is defined as an enumeration, this function returns
- * the list of possible values for that enum.
- *
- * If this option is not defined as an enumeration, it returns null
.
- *
- * @return String []
- */
- public String [] getApplicableValues();
-
- /**
- * Answers the value for a boolean option.
- *
- * @return boolean
- * @throws BuildException
- */
- public boolean getBooleanValue() throws BuildException;
-
- /**
- * Answers an array of strings containing the built-in values
- * defined for a stringList, includePaths, definedSymbols, or libs
- * option. If none have been defined, the array will be empty but
- * never null
.
- *
- * @return String[]
- */
- public String[] getBuiltIns();
-
- /**
- * Returns the category for this option.
- *
- * @return IOptionCategory
- */
- public IOptionCategory getCategory();
-
- /**
- * Answers a String
containing the actual command line
- * option associated with the option
- *
- * @return String
- */
- public String getCommand();
-
- /**
- * Answers the user-defined preprocessor symbols.
- *
- * @return String[]
- * @throws BuildException
- */
- public String[] getDefinedSymbols() throws BuildException;
-
- /**
- * Answers the command associated with the enumeration name. For
- * example, if the enumeration name was 'Default' for the debug
- * level option of the Gnu compiler, and the plugin manifest defined
- * that as -g, then the return value would be a String containing "-g"
- *
- * @return
- */
- public String getEnumCommand (String name);
-
- /**
- * Answers an array of String
containing the includes paths
- * defined in the build model.
- *
- * @return String[]
- * @throws BuildException
- */
- public String[] getIncludePaths() throws BuildException;
-
-
- /**
- * Answers an array or String
s containing the libraries
- * that must be linked into the project.
- *
- * @return String[]
- * @throws BuildException
- */
- public String[] getLibraries() throws BuildException ;
-
- /**
- * Answers a String
containing the selected enumeration in an
- * enumerated option. For an option that has not been changed by the user,
- * the receiver will answer with the default defined in the plugin manifest.
- * If the user has modified the selection, the receiver will answer with the
- * overridden selection.
- *
- * @return String
- * @throws BuildException
- */
- public String getSelectedEnum () throws BuildException;
-
- /**
- * Returns the current value for this option if it is a List of Strings.
- *
- * @return String []
- * @throws BuildException
- */
- public String [] getStringListValue() throws BuildException;
-
- /**
- * Returns the current value for this option if it is a String
- *
- * @return String
- * @throws BuildException
- */
- public String getStringValue() throws BuildException;
-
- /**
- * Returns the tool defining this option.
- *
- * @return ITool
- */
- public ITool getTool();
-
-
- /**
- * Answers all of the user-defined object files that must be linked with
- * the final build target.
- *
- * @return
- * @throws BuildException
- */
- public String [] getUserObjects() throws BuildException;
-
- /**
- * Get the type for the value of the option.
- *
- * @return int
- */
- public int getValueType();
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOptionCategory.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOptionCategory.java
deleted file mode 100644
index 5067a92de36..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOptionCategory.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.cdt.managedbuilder.core;
-
-/**
- *
- */
-public interface IOptionCategory extends IBuildObject {
-
- // Schema element names
- public static final String PARENT = "parent";
-
- /**
- * Returns the list of children of this node in the option category tree
- *
- * @return
- */
- public IOptionCategory[] getChildCategories();
-
- /**
- * Returns the options in this category for a given configuration.
- *
- * @param tool
- * @return
- */
- public IOption[] getOptions(IConfiguration configuration);
-
- /**
- * Returns the category that owns this category, or null if this is the
- * top category for a tool.
- *
- * @return
- */
- public IOptionCategory getOwner();
-
- /**
- * Returns the tool that ultimately owns this category.
- *
- * @return
- */
- public ITool getTool();
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java
deleted file mode 100644
index ef7395aba71..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.cdt.managedbuilder.core;
-
-import org.eclipse.core.resources.IResource;
-
-/**
- * This class represents targets for the managed build process. A target
- * is some type of resource built using a given collection of tools.
- */
-public interface ITarget extends IBuildObject {
- public static final String TARGET_ELEMENT_NAME = "target"; //$NON-NLS-1$
- public static final String ARTIFACT_NAME = "artifactName"; //$NON-NLS-1$
- public static final String BINARY_PARSER = "binaryParser"; //$NON-NLS-1$
- public static final String CLEAN_COMMAND = "cleanCommand"; //$NON-NLS-1$
- public static final String DEFAULT_EXTENSION = "defaultExtension"; //$NON-NLS-1$
- public static final String IS_ABSTRACT = "isAbstract"; //$NON-NLS-1$
- public static final String IS_TEST = "isTest"; //$NON-NLS-1$
- public static final String MAKE_COMMAND = "makeCommand"; //$NON-NLS-1$
- public static final String OS_LIST = "osList"; //$NON-NLS-1$
- public static final String PARENT = "parent"; //$NON-NLS-1$
-
- /**
- * Creates a configuration for the target populated with the tools and
- * options settings from the parent configuration. As options and tools
- * change in the parent, unoverridden values are updated in the child
- * config as well.
- *
- * @param parent The IConfiguration
to use as a settings template
- * @param id The unique id the new configuration will have
- * @return IConfiguration
- */
- public IConfiguration createConfiguration(IConfiguration parent, String id);
-
- /**
- * Creates a new configuration for the target. It is populated with
- * the tools defined for that target and options set at their defaults.
- *
- * @param id id for this configuration.
- * @return IConfiguration
- */
- public IConfiguration createConfiguration(String id);
-
- /**
- * Get the name of the final build artifact.
- *
- * @return String
- */
- public String getArtifactName();
-
- /**
- * Answers the unique ID of the binary parser associated with the target.
- *
- * @return String
- */
- public String getBinaryParserId();
-
- /**
- * Answers the OS-specific command to remove files created by the build
- *
- * @return String
- */
- public String getCleanCommand();
-
- /**
- * Returns all of the configurations defined by this target.
- *
- * @return IConfiguration[]
- */
- public IConfiguration[] getConfigurations();
-
- /**
- * Get the default extension that should be applied to build artifacts
- * created by this target.
- *
- * @return String
- */
- public String getDefaultExtension();
-
- /**
- * Answers the name of the make utility for the target.
- *
- * @return String
- */
- public String getMakeCommand();
-
- /**
- * Returns the configuration with the given id, or null
if not found.
- *
- * @param id
- * @return IConfiguration
- */
- public IConfiguration getConfiguration(String id);
-
- /**
- * Gets the resource that this target is applied to.
- *
- * @return IResource
- */
- public IResource getOwner();
-
- /**
- * Answers the ITarget
that is the parent of the receiver.
- *
- * @return ITarget
- */
- public ITarget getParent();
-
- /**
- * Answers an array of operating systems the target can be created on.
- *
- * @return String[]
- */
- public String[] getTargetOSList();
-
- /**
- * Returns the list of platform specific tools associated with this
- * platform.
- *
- * @return ITool[]
- */
- public ITool[] getTools();
-
-
- /**
- * Answers true if the receiver has a make command that differs from its
- * parent specification.
- *
- * @return boolean
- */
- public boolean hasOverridenMakeCommand();
-
- /**
- * Returns whether this target is abstract.
- * @return boolean
- */
- public boolean isAbstract();
-
- /**
- * Answers true
if the receiver is a target that is defined
- * for testing purposes only, else false
. A test target will
- * not be shown in the UI but can still be manipulated programmatically.
- *
- * @return boolean
- */
- public boolean isTestTarget();
-
- /**
- * Removes the configuration with the ID specified in the argument.
- *
- * @param id
- */
- public void removeConfiguration(String id);
-
- /**
- * Resets the make command in the receiver to the value specified in
- * its parent.
- *
- */
- public void resetMakeCommand();
-
- /**
- * Set the name of the artifact that will be produced when the receiver
- * is built.
- *
- * @param name
- */
- public void setBuildArtifact(String name);
-
- /**
- * Sets the make command for the receiver to the value in the argument.
- *
- * @param command
- */
- public void setMakeCommand(String command);
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java
deleted file mode 100644
index dcc2fea7b29..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.cdt.managedbuilder.core;
-
-/**
- *
- */
-public interface ITool extends IBuildObject {
- // Schema element names
- public static final String COMMAND = "command"; //$NON-NLS-1$
- public static final String INTERFACE_EXTS = "headerExtensions"; //$NON-NLS-1$
- public static final String NATURE = "natureFilter"; //$NON-NLS-1$
- public static final String OPTION = "option"; //$NON-NLS-1$
- public static final String OPTION_CAT = "optionCategory"; //$NON-NLS-1$
- public static final String OPTION_REF = "optionReference"; //$NON-NLS-1$
- public static final String OUTPUT_FLAG = "outputFlag"; //$NON-NLS-1$
- public static final String OUTPUT_PREFIX = "outputPrefix"; //$NON-NLS-1$
- public static final String OUTPUTS = "outputs"; //$NON-NLS-1$
- public static final String SOURCES = "sources"; //$NON-NLS-1$
- public static final String TOOL_ELEMENT_NAME = "tool"; //$NON-NLS-1$
- public static final String WHITE_SPACE = " "; //$NON-NLS-1$
-
- public static final int FILTER_C = 0;
- public static final int FILTER_CC = 1;
- public static final int FILTER_BOTH = 2;
-
- /**
- * Return true
if the receiver builds files with the
- * specified extension, else false
.
- *
- * @param extension file extension of the source
- * @return boolean
- */
- public boolean buildsFileType(String extension);
-
- /**
- * Answers a constant corresponding to the project nature the tool should be used
- * for. Possible answers are:
- *
- * null
if the tool does not understand that extension.
- *
- * @param inputExtension The extension of the source file.
- * @return String
- */
- public String getOutputExtension(String inputExtension);
-
- /**
- * Answers the argument that must be passed to a specific tool in order to
- * control the name of the output artifact. For example, the GCC compile and
- * linker use '-o', while the archiver does not.
- *
- * @return String
- */
- public String getOutputFlag();
-
- /**
- * Answers the prefix that the tool should prepend to the name of the build artifact.
- * For example, a librarian usually prepends 'lib' to the target.a
- * @return String
- */
- public String getOutputPrefix();
-
- /**
- * Return the target that defines this tool, if applicable
- * @return ITarget
- */
- public ITarget getTarget();
-
- /**
- * Answers the command-line invocation defined for the receiver.
- *
- * @return String
- */
- public String getToolCommand();
-
- /**
- * Answers the additional command line arguments the user has specified for
- * the tool.
- *
- * @return String
- */
- public String getToolFlags() throws BuildException ;
-
- /**
- * Options are organized into categories for UI purposes.
- * These categories are organized into a tree. This is the root
- * of that tree.
- *
- * @return IOptionCategory
- */
- public IOptionCategory getTopOptionCategory();
-
- /**
- * Answers true
if the tool considers the file extension to be
- * one associated with a header file.
- *
- * @param ext file extension of the source
- * @return boolean
- */
- public boolean isHeaderFile(String ext);
-
- /**
- * Answers true
if the receiver builds a file with the extension specified
- * in the argument, else false
.
- *
- * @param outputExtension extension of the file being produced by a tool
- * @return boolean
- */
- public boolean producesFileType(String outputExtension);
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
deleted file mode 100644
index 6d39ed13638..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
+++ /dev/null
@@ -1,555 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.cdt.managedbuilder.core;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.xerces.dom.DocumentImpl;
-import org.apache.xml.serialize.Method;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.Serializer;
-import org.apache.xml.serialize.SerializerFactory;
-import org.eclipse.cdt.core.AbstractCExtension;
-import org.eclipse.cdt.core.parser.*;
-import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
-import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.internal.core.Target;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-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.QualifiedName;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * This is the main entry point for getting at the build information
- * for the managed build system.
- */
-public class ManagedBuildManager extends AbstractCExtension implements IScannerInfoProvider {
-
- private static final QualifiedName buildInfoProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "managedBuildInfo");
- private static final String ROOT_ELEM_NAME = "ManagedProjectBuildInfo"; //$NON-NLS-1$
- private static final String FILE_NAME = ".cdtbuild"; //$NON-NLS-1$
- private static final ITarget[] emptyTargets = new ITarget[0];
- public static final String INTERFACE_IDENTITY = ManagedBuilderCorePlugin.getUniqueIdentifier() + "." + "ManagedBuildManager"; //$NON-NLS-1$
- public static final String EXTENSION_POINT_ID = "ManagedBuildInfo"; //$NON-NLS-1$
-
- // Targets defined by extensions (i.e., not associated with a resource)
- private static boolean extensionTargetsLoaded = false;
- private static List extensionTargets;
- private static Map extensionTargetMap;
-
- // Listeners interested in build model changes
- private static Map buildModelListeners;
-
- /**
- * Returns the list of targets that are defined by this project,
- * projects referenced by this project, and by the extensions.
- *
- * @param project
- * @return
- */
- public static ITarget[] getDefinedTargets(IProject project) {
- // Make sure the extensions are loaded
- loadExtensions();
-
- // Get the targets for this project and all referenced projects
- List definedTargets = null;
- // To Do
-
- // Create the array and copy the elements over
- int size = extensionTargets != null ?
- extensionTargets.size() + (definedTargets != null ? definedTargets.size() : 0) :
- 0;
-
- ITarget[] targets = new ITarget[size];
-
- int n = 0;
- for (int i = 0; i < extensionTargets.size(); ++i)
- targets[n++] = (ITarget)extensionTargets.get(i);
-
- if (definedTargets != null)
- for (int i = 0; i < definedTargets.size(); ++i)
- targets[n++] = (ITarget)definedTargets.get(i);
-
- return targets;
- }
-
- /**
- * @return
- */
- public static Map getExtensionTargetMap() {
- if (extensionTargetMap == null) {
- extensionTargetMap = new HashMap();
- }
- return extensionTargetMap;
- }
-
- /**
- * Returns the targets owned by this project. If none are owned,
- * an empty array is returned.
- *
- * @param project
- * @return
- */
- public static ITarget[] getTargets(IResource resource) {
- IManagedBuildInfo buildInfo = getBuildInfo(resource);
-
- if (buildInfo != null) {
- List targets = buildInfo.getTargets();
- return (ITarget[])targets.toArray(new ITarget[targets.size()]);
- } else {
- return emptyTargets;
- }
- }
-
-
- /**
- * Answers the result of a best-effort search to find a target with the
- * specified ID, or null
if one is not found.
- *
- * @param resource
- * @param id
- * @return
- */
- public static ITarget getTarget(IResource resource, String id) {
- ITarget target = null;
- // Check if the target is spec'd in the build info for the resource
- if (resource != null) {
- IManagedBuildInfo buildInfo = getBuildInfo(resource);
- if (buildInfo != null)
- target = buildInfo.getTarget(id);
- }
- // OK, check the extension map
- if (target == null) {
- target = (ITarget)getExtensionTargetMap().get(id);
- }
- return target;
- }
-
- /**
- * Creates a new target for the resource based on the parentTarget.
- *
- * @param resource
- * @param parentTarget
- * @return new ITarget
with settings based on the parent passed in the arguments
- * @throws BuildException
- */
- public static ITarget createTarget(IResource resource, ITarget parentTarget)
- throws BuildException
- {
- IResource owner = parentTarget.getOwner();
-
- if (owner != null && owner.equals(resource))
- // Already added
- return parentTarget;
-
- if (resource instanceof IProject) {
- // Must be an extension target (why?)
- if (owner != null)
- throw new BuildException("addTarget: owner not null");
- } else {
- // Owner must be owned by the project containing this resource
- if (owner == null)
- throw new BuildException("addTarget: null owner");
- if (!owner.equals(resource.getProject()))
- throw new BuildException("addTarget: owner not project");
- }
-
- // Passed validation
- return new Target(resource, parentTarget);
- }
-
- /**
- * Sets the default configuration for the project. Note that this will also
- * update the default target if needed.
- *
- * @param project
- * @param newDefault
- */
- public static void setDefaultConfiguration(IProject project, IConfiguration newDefault) {
- if (project == null || newDefault == null) {
- return;
- }
- // Set the default in build information for the project
- IManagedBuildInfo info = getBuildInfo(project);
- if (info != null) {
- info.setDefaultConfiguration(newDefault);
- }
- }
-
- /**
- * @param config
- * @param option
- */
- private static void setDirty(IConfiguration config, IOption option) {
- // Set the build info dirty so builder will rebuild
- IResource resource = config.getOwner();
- IManagedBuildInfo info = getBuildInfo(resource);
- info.setDirty(true);
-
- // Continue if change is something that effect the scanner
- if (!(option.getValueType() == IOption.INCLUDE_PATH
- || option.getValueType() == IOption.PREPROCESSOR_SYMBOLS)) {
- return;
- }
- // Figure out if there is a listener for this change
- List listeners = (List) getBuildModelListeners().get(resource);
- if (listeners == null) {
- return;
- }
- ListIterator iter = listeners.listIterator();
- while (iter.hasNext()) {
- ((IScannerInfoChangeListener)iter.next()).changeNotification(resource, (IScannerInfo)getBuildInfo(resource, false));
- }
- }
-
- /**
- * Set the string value for an option for a given config.
- *
- * @param config The configuration the option belongs to.
- * @param option The option to set the value for.
- * @param value The boolean that the option should contain after the change.
- */
- public static void setOption(IConfiguration config, IOption option, boolean value) {
- try {
- config.setOption(option, value);
- setDirty(config, option);
- } catch (BuildException e) {
- return;
- }
- }
-
- /**
- * Set the string value for an option for a given config.
- *
- * @param config The configuration the option belongs to.
- * @param option The option to set the value for.
- * @param value The value that the option should contain after the change.
- */
- public static void setOption(IConfiguration config, IOption option, String value) {
- try {
- config.setOption(option, value);
- setDirty(config, option);
- } catch (BuildException e) {
- return;
- }
- }
-
- /**
- * Set the string array value for an option for a given config.
- *
- * @param config The configuration the option belongs to.
- * @param option The option to set the value for.
- * @param value The values the option should contain after the change.
- */
- public static void setOption(IConfiguration config, IOption option, String[] value) {
- try {
- config.setOption(option, value);
- setDirty(config, option);
- } catch (BuildException e) {
- return;
- }
- }
-
- /**
- * Saves the build information associated with a project and all resources
- * in the project to the build info file.
- *
- * @param project
- */
- public static void saveBuildInfo(IProject project) {
- // Create document
- Document doc = new DocumentImpl();
- Element rootElement = doc.createElement(ROOT_ELEM_NAME);
- doc.appendChild(rootElement);
-
- // Save the build info
- ManagedBuildInfo buildInfo = (ManagedBuildInfo) getBuildInfo(project);
- if (buildInfo != null)
- buildInfo.serialize(doc, rootElement);
-
- // Save the document
- ByteArrayOutputStream s = new ByteArrayOutputStream();
- OutputFormat format = new OutputFormat();
- format.setIndenting(true);
- format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$
- String xml = null;
- try {
- Serializer serializer
- = SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(new OutputStreamWriter(s, "UTF8"), format);
- serializer.asDOMSerializer().serialize(doc);
- xml = s.toString("UTF8"); //$NON-NLS-1$
- IFile rscFile = project.getFile(FILE_NAME);
- InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
- // update the resource content
- if (rscFile.exists()) {
- rscFile.setContents(inputStream, IResource.FORCE, null);
- } else {
- rscFile.create(inputStream, IResource.FORCE, null);
- }
- } catch (Exception e) {
- return;
- }
- }
-
- /**
- * @param resource
- */
- public static void removeBuildInfo(IResource resource) {
- try {
- resource.setSessionProperty(buildInfoProperty, null);
- } catch (CoreException e) {
- }
- }
-
- /**
- * Resets the build information for the project and configuration specified in the arguments.
- * The build information will contain the settings defined in the plugin manifest.
- *
- * @param project
- * @param configuration
- */
- public static void resetConfiguration(IProject project, IConfiguration configuration) {
- // Make sure the extensions are loaded
- loadExtensions();
-
- // Find out the parent of the configuration
- IConfiguration parentConfig = configuration.getParent();
- // Find the parent target the configuration
- ITarget parentTarget = parentConfig.getTarget();
-
- // Get the extension point information
- IExtensionPoint extensionPoint = ManagedBuilderCorePlugin.getDefault().getDescriptor().getExtensionPoint(EXTENSION_POINT_ID);
- IExtension[] extensions = extensionPoint.getExtensions();
- for (int i = 0; i < extensions.length; ++i) {
- IExtension extension = extensions[i];
- IConfigurationElement[] elements = extension.getConfigurationElements();
- for (int j = 0; j < elements.length; ++j) {
- IConfigurationElement element = elements[j];
- if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME) &&
- element.getAttribute(ITarget.ID).equals(parentTarget.getId())) {
- // We have the parent target so get the definition for the parent config
- IConfigurationElement[] targetElements = element.getChildren();
- for (int k = 0; k < targetElements.length; ++k) {
- IConfigurationElement targetElement = targetElements[k];
- if (targetElement.getName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME) &&
- targetElement.getAttribute(IConfiguration.ID).equals(parentConfig.getId())) {
- // We now have the plugin element the target was originally based on
- ((Configuration)configuration).reset(targetElement);
- }
- }
- }
- }
- }
- }
-
- // Private stuff
-
- public static void addExtensionTarget(Target target) {
- if (extensionTargets == null) {
- extensionTargets = new ArrayList();
- }
-
- extensionTargets.add(target);
- getExtensionTargetMap().put(target.getId(), target);
- }
-
- private static ManagedBuildInfo loadBuildInfo(IProject project) {
- ManagedBuildInfo buildInfo = null;
- IFile file = project.getFile(FILE_NAME);
- if (!file.exists())
- return null;
-
- try {
- InputStream stream = file.getContents();
- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document document = parser.parse(stream);
- Node rootElement = document.getFirstChild();
- if (rootElement.getNodeName().equals(ROOT_ELEM_NAME)) {
- buildInfo = new ManagedBuildInfo(project, (Element)rootElement);
- project.setSessionProperty(buildInfoProperty, buildInfo);
- }
- } catch (Exception e) {
- buildInfo = null;
- }
-
- return buildInfo;
- }
-
- private static void loadExtensions() {
- if (extensionTargetsLoaded)
- return;
- extensionTargetsLoaded = true;
-
- IExtensionPoint extensionPoint = ManagedBuilderCorePlugin.getDefault().getDescriptor().getExtensionPoint(EXTENSION_POINT_ID);
- IExtension[] extensions = extensionPoint.getExtensions();
- for (int i = 0; i < extensions.length; ++i) {
- IExtension extension = extensions[i];
- IConfigurationElement[] elements = extension.getConfigurationElements();
- for (int j = 0; j < elements.length; ++j) {
- IConfigurationElement element = elements[j];
- if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME)) {
- new Target(element);
- }
- }
- }
- }
-
- /**
- * @param project
- * @return
- */
- public static boolean manages(IResource resource) {
- // The managed build manager manages build information for the
- // resource IFF it it is a project and has a build file with the proper
- // root element
- IProject project = null;
- if (resource instanceof IProject){
- project = (IProject)resource;
- } else if (resource instanceof IFile) {
- project = ((IFile)resource).getProject();
- } else {
- return false;
- }
- IFile file = project.getFile(FILE_NAME);
- if (file.exists()) {
- try {
- InputStream stream = file.getContents();
- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document document = parser.parse(stream);
- Node rootElement = document.getFirstChild();
- if (rootElement.getNodeName().equals(ROOT_ELEM_NAME)) {
- return true;
- }
- } catch (Exception e) {
- return false;
- }
- }
- return false;
- }
-
- private static ManagedBuildInfo findBuildInfo(IResource resource, boolean create) {
- // Make sure the extension information is loaded first
- loadExtensions();
- ManagedBuildInfo buildInfo = null;
- try {
- buildInfo = (ManagedBuildInfo)resource.getSessionProperty(buildInfoProperty);
- } catch (CoreException e) {
- return buildInfo;
- }
-
- if (buildInfo == null && resource instanceof IProject) {
- buildInfo = loadBuildInfo((IProject)resource);
- }
-
- if (buildInfo == null && create) {
- try {
- buildInfo = new ManagedBuildInfo(resource);
- resource.setSessionProperty(buildInfoProperty, buildInfo);
- } catch (CoreException e) {
- buildInfo = null;
- }
- }
-
- return buildInfo;
- }
-
- public static IManagedBuildInfo getBuildInfo(IResource resource, boolean create) {
- return (IManagedBuildInfo) findBuildInfo(resource, create);
- }
-
- public static IManagedBuildInfo getBuildInfo(IResource resource) {
- return (IManagedBuildInfo) findBuildInfo(resource, false);
- }
-
- /*
- * @return
- */
- private static Map getBuildModelListeners() {
- if (buildModelListeners == null) {
- buildModelListeners = new HashMap();
- }
- return buildModelListeners;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IScannerInfoProvider#getScannerInformation(org.eclipse.core.resources.IResource)
- */
- public IScannerInfo getScannerInformation(IResource resource) {
- return (IScannerInfo) getBuildInfo(resource, false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IScannerInfoProvider#subscribe(org.eclipse.cdt.core.parser.IScannerInfoChangeListener)
- */
- public synchronized void subscribe(IResource resource, IScannerInfoChangeListener listener) {
- IResource project = null;
- if (resource instanceof IProject) {
- project = resource;
- } else if (resource instanceof IFile) {
- project = ((IFile)resource).getProject();
- } else {
- return;
- }
- // Get listeners for this resource
- Map map = getBuildModelListeners();
- List list = (List) map.get(project);
- if (list == null) {
- // Create a new list
- list = new ArrayList();
- }
- if (!list.contains(listener)) {
- // Add the new listener for the resource
- list.add(listener);
- map.put(project, list);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IScannerInfoProvider#unsubscribe(org.eclipse.cdt.core.parser.IScannerInfoChangeListener)
- */
- public synchronized void unsubscribe(IResource resource, IScannerInfoChangeListener listener) {
- IResource project = null;
- if (resource instanceof IProject) {
- project = resource;
- } else if (resource instanceof IFile) {
- project = ((IFile)resource).getProject();
- } else {
- return;
- }
- // Remove the listener
- Map map = getBuildModelListeners();
- List list = (List) map.get(project);
- if (list != null && !list.isEmpty()) {
- // The list is not empty so try to remove listener
- list.remove(listener);
- map.put(project, list);
- }
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
deleted file mode 100644
index a671aea8511..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.eclipse.cdt.managedbuilder.core;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * **********************************************************************/
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.Plugin;
-
-
-public class ManagedBuilderCorePlugin extends Plugin {
- //The shared instance.
- private static ManagedBuilderCorePlugin plugin;
- //Resource bundle.
- private static ResourceBundle resourceBundle;
-
- /**
- * @param descriptor
- */
- public ManagedBuilderCorePlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- try {
- resourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.managedbuilder.internal.core.PluginResources"); //$NON-NLS-1$
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- }
-
- /**
- * Returns the shared instance.
- */
- public static ManagedBuilderCorePlugin getDefault() {
- return plugin;
- }
-
-
- public static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";
- } catch (NullPointerException e) {
- return "#" + key + "#";
- }
- }
-
- public static String getFormattedString(String key, String arg) {
- return MessageFormat.format(getResourceString(key), new String[] { arg });
- }
-
- public static String getFormattedString(String key, String[] args) {
- return MessageFormat.format(getResourceString(key), args);
- }
-
- /**
- * Convenience method which returns the unique identifier of this plugin.
- */
- public static String getUniqueIdentifier() {
- if (getDefault() == null) {
- // If the default instance is not yet initialized,
- // return a static identifier. This identifier must
- // match the plugin id defined in plugin.xml
- return "org.eclipse.cdt.managedbuilder.core"; //$NON-NLS-1$
- }
- return getDefault().getDescriptor().getUniqueIdentifier();
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedCProjectNature.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedCProjectNature.java
deleted file mode 100644
index 235167976e8..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedCProjectNature.java
+++ /dev/null
@@ -1,182 +0,0 @@
-package org.eclipse.cdt.managedbuilder.core;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
-***********************************************************************/
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IProjectNature;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Plugin;
-
-public class ManagedCProjectNature implements IProjectNature {
- public static final String BUILDER_NAME = "genmakebuilder";
- public static final String BUILDER_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + "." + BUILDER_NAME;
- private static final String MNG_NATURE_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".managedBuildNature";
- private IProject project;
-
- /**
- * Utility method for adding a managed nature to a project.
- *
- * @param proj the project to add the managed nature to.
- * @param monitor a progress monitor to indicate the duration of the operation, or
- * null
if progress reporting is not required.
- */
- public static void addManagedNature(IProject project, IProgressMonitor monitor) throws CoreException {
- addNature(project, MNG_NATURE_ID, monitor);
- }
-
- public static void addManagedBuilder(IProject project, IProgressMonitor monitor) throws CoreException {
- // Add the builder to the project
- IProjectDescription description = project.getDescription();
- ICommand[] commands = description.getBuildSpec();
-
- // TODO Remove this when the new StandardBuild nature adds the cbuilder
- for (int i = 0; i < commands.length; i++) {
- ICommand command = commands[i];
- if (command.getBuilderName().equals("org.eclipse.cdt.core.cbuilder")) {
- // Remove the command
- Vector vec = new Vector(Arrays.asList(commands));
- vec.removeElementAt(i);
- vec.trimToSize();
- ICommand[] tempCommands = (ICommand[]) vec.toArray(new ICommand[commands.length-1]);
- description.setBuildSpec(tempCommands);
- break;
- }
- }
-
- commands = description.getBuildSpec();
- boolean found = false;
- // See if the builder is already there
- for (int i = 0; i < commands.length; ++i) {
- if (commands[i].getBuilderName().equals(getBuilderID())) {
- found = true;
- break;
- }
- }
- if (!found) {
- //add builder to project
- ICommand command = description.newCommand();
- command.setBuilderName(getBuilderID());
- ICommand[] newCommands = new ICommand[commands.length + 1];
- // Add it before other builders.
- System.arraycopy(commands, 0, newCommands, 1, commands.length);
- newCommands[0] = command;
- description.setBuildSpec(newCommands);
- project.setDescription(description, null);
- }
- }
-
- /**
- * Utility method for adding a nature to a project.
- *
- * @param proj the project to add the nature to.
- * @param natureId the id of the nature to assign to the project
- * @param monitor a progress monitor to indicate the duration of the operation, or
- * null
if progress reporting is not required.
- */
- public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
- IProjectDescription description = project.getDescription();
- String[] prevNatures = description.getNatureIds();
- for (int i = 0; i < prevNatures.length; i++) {
- if (natureId.equals(prevNatures[i]))
- return;
- }
- String[] newNatures = new String[prevNatures.length + 1];
- System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
- newNatures[prevNatures.length] = natureId;
- description.setNatureIds(newNatures);
- project.setDescription(description, monitor);
- }
-
- /**
- * Get the correct builderID
- */
- public static String getBuilderID() {
- Plugin plugin = (Plugin)ManagedBuilderCorePlugin.getDefault();
- IPluginDescriptor descriptor = plugin.getDescriptor();
- if (descriptor.getExtension(BUILDER_NAME) != null) {
- return descriptor.getUniqueIdentifier() + "." + BUILDER_NAME;
- }
- return BUILDER_ID;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IProjectNature#configure()
- */
- public void configure() throws CoreException {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IProjectNature#deconfigure()
- */
- public void deconfigure() throws CoreException {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IProjectNature#getProject()
- */
- public IProject getProject() {
- // Just return the project associated with the nature
- return project;
- }
-
-
- /**
- * Utility method to remove the managed nature from a project.
- *
- * @param project to remove the managed nature from
- * @param mon progress monitor to indicate the duration of the operation, or
- * null
if progress reporting is not required.
- * @throws CoreException
- */
- public static void removeManagedNature(IProject project, IProgressMonitor mon) throws CoreException {
- removeNature(project, MNG_NATURE_ID, mon);
- }
-
- /**
- * Utility method for removing a project nature from a project.
- *
- * @param proj the project to remove the nature from
- * @param natureId the nature id to remove
- * @param monitor a progress monitor to indicate the duration of the operation, or
- * null
if progress reporting is not required.
- */
- public static void removeNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
- IProjectDescription description = project.getDescription();
- String[] prevNatures = description.getNatureIds();
- List newNatures = new ArrayList(Arrays.asList(prevNatures));
- newNatures.remove(natureId);
- description.setNatureIds((String[])newNatures.toArray(new String[newNatures.size()]));
- project.setDescription(description, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
- */
- public void setProject(IProject project) {
- // Set the project for the nature
- this.project = project;
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BuildObject.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BuildObject.java
deleted file mode 100644
index 482e691ebd5..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BuildObject.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.cdt.managedbuilder.internal.core;
-
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-
-import org.eclipse.cdt.managedbuilder.core.IBuildObject;
-
-public class BuildObject implements IBuildObject {
-
- protected String id;
- protected String name;
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
- */
- public String getId() {
- return id;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IBuildObject#setId(java.lang.String)
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
- */
- public String getName() {
- return name;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IBuildObject#setName(java.lang.String)
- */
- public void setName(String name) {
- this.name = name;
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
deleted file mode 100644
index a223de8147c..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
+++ /dev/null
@@ -1,459 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.cdt.managedbuilder.internal.core;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.CCProjectNature;
-import org.eclipse.cdt.core.CProjectNature;
-import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- *
- */
-public class Configuration extends BuildObject implements IConfiguration {
-
- private ITarget target;
- private IConfiguration parent;
- private List toolReferences;
-
- /**
- * A fresh new configuration for a target.
- *
- * @param target
- * @param id
- */
- public Configuration(Target target, String id) {
- this.id = id;
- this.target = target;
-
- target.addConfiguration(this);
- }
-
- /**
- * Create a new configuration based on one already defined.
- *
- * @param target The Target
the receiver will be added to.
- * @param parent The IConfiguration
to copy the settings from.
- * @param id A unique ID for the configuration.
- */
- public Configuration(Target target, IConfiguration parent, String id) {
- this.id = id;
- this.name = parent.getName();
- this.target = target;
- this.parent = parent;
-
- // Check that the tool and the project match
- IProject project = (IProject) target.getOwner();
-
- // Get the tool references from the parent
- List parentToolRefs = ((Configuration)parent).getLocalToolReferences();
- Iterator iter = parentToolRefs.listIterator();
- while (iter.hasNext()) {
- ToolReference toolRef = (ToolReference)iter.next();
-
- // Make a new ToolReference based on the tool in the ref
- ToolReference newRef = new ToolReference(this, toolRef.getTool());
- List optRefs = toolRef.getLocalOptionRefs();
- Iterator optIter = optRefs.listIterator();
- while (optIter.hasNext()) {
- OptionReference optRef = (OptionReference)optIter.next();
- IOption opt = optRef.getOption();
- try {
- switch (opt.getValueType()) {
- case IOption.BOOLEAN:
- new OptionReference(newRef, opt).setValue(optRef.getBooleanValue());
- break;
- case IOption.STRING:
- new OptionReference(newRef, opt).setValue(optRef.getStringValue());
- break;
- case IOption.ENUMERATED:
- new OptionReference(newRef, opt).setValue(optRef.getSelectedEnum());
- break;
- case IOption.STRING_LIST :
- new OptionReference(newRef, opt).setValue(optRef.getStringListValue());
- break;
- case IOption.INCLUDE_PATH :
- new OptionReference(newRef, opt).setValue(optRef.getIncludePaths());
- break;
- case IOption.PREPROCESSOR_SYMBOLS :
- new OptionReference(newRef, opt).setValue(optRef.getDefinedSymbols());
- break;
- case IOption.LIBRARIES :
- new OptionReference(newRef, opt).setValue(optRef.getLibraries());
- break;
- case IOption.OBJECTS :
- new OptionReference(newRef, opt).setValue(optRef.getUserObjects());
- break;
- }
- } catch (BuildException e) {
- continue;
- }
- }
- }
-
- target.addConfiguration(this);
- }
-
- /**
- * Create a new Configuration
based on the specification in the plugin manifest.
- *
- * @param target The Target
the receiver will be added to.
- * @param element The element from the manifest that contains the default configuration settings.
- */
- public Configuration(Target target, IConfigurationElement element) {
- this.target = target;
-
- // id
- setId(element.getAttribute(IConfiguration.ID));
-
- // hook me up
- target.addConfiguration(this);
-
- // name
- setName(element.getAttribute(IConfiguration.NAME));
-
- IConfigurationElement[] configElements = element.getChildren();
- for (int l = 0; l < configElements.length; ++l) {
- IConfigurationElement configElement = configElements[l];
- if (configElement.getName().equals(IConfiguration.TOOL_REF)) {
- new ToolReference(this, configElement);
- }
- }
- }
-
- /**
- * Build a configuration from the project manifest file.
- *
- * @param target The Target
the configuration belongs to.
- * @param element The element from the manifest that contains the overridden configuration information.
- */
- public Configuration(Target target, Element element) {
- this.target = target;
-
- // id
- setId(element.getAttribute(IConfiguration.ID));
-
- // hook me up
- target.addConfiguration(this);
-
- // name
- if (element.hasAttribute(IConfiguration.NAME))
- setName(element.getAttribute(IConfiguration.NAME));
-
- if (element.hasAttribute(IConfiguration.PARENT)) {
- // See if the target has a parent
- ITarget targetParent = target.getParent();
- // If so, then get my parent from it
- if (targetParent != null) {
- parent = targetParent.getConfiguration(element.getAttribute(IConfiguration.PARENT));
- }
- else {
- parent = null;
- }
- }
-
- NodeList configElements = element.getChildNodes();
- for (int i = 0; i < configElements.getLength(); ++i) {
- Node configElement = configElements.item(i);
- if (configElement.getNodeName().equals(IConfiguration.TOOL_REF)) {
- new ToolReference(this, (Element)configElement);
- }
- }
-
- }
-
- /**
- * Persist receiver to project file.
- *
- * @param doc
- * @param element
- */
- public void serialize(Document doc, Element element) {
- element.setAttribute(IConfiguration.ID, id);
-
- if (name != null)
- element.setAttribute(IConfiguration.NAME, name);
-
- if (parent != null)
- element.setAttribute(IConfiguration.PARENT, parent.getId());
-
- // Serialize only the tool references defined in the configuration
- Iterator iter = getLocalToolReferences().listIterator();
- while (iter.hasNext()) {
- ToolReference toolRef = (ToolReference) iter.next();
- Element toolRefElement = doc.createElement(IConfiguration.TOOL_REF);
- element.appendChild(toolRefElement);
- toolRef.serialize(doc, toolRefElement);
- }
- }
-
- /* (non-javadoc)
- * A safety method to avoid NPEs. It answers the tool reference list in the
- * receiver. It does not look at the tool references defined in the parent.
- *
- * @return List
- */
- protected List getLocalToolReferences() {
- if (toolReferences == null) {
- toolReferences = new ArrayList();
- }
- return toolReferences;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#getName()
- */
- public String getName() {
- return (name == null && parent != null) ? parent.getName() : name;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#getTools()
- */
- public ITool[] getTools() {
- ITool[] tools = parent != null
- ? parent.getTools()
- : target.getTools();
-
- // Validate that the tools correspond to the nature
- IProject project = (IProject)target.getOwner();
- if (project != null) {
- List validTools = new ArrayList();
-
- // The target is associated with a real project
- for (int i = 0; i < tools.length; ++i) {
- ITool tool = tools[i];
- // Make sure the tool filter and project nature agree
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- try {
- if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- validTools.add(tool);
- }
- } catch (CoreException e) {
- continue;
- }
- break;
- case ITool.FILTER_CC:
- try {
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- validTools.add(tool);
- }
- } catch (CoreException e) {
- continue;
- }
- break;
- case ITool.FILTER_BOTH:
- validTools.add(tool);
- break;
- }
- }
- // Now put the valid tools back into the array
- tools = (ITool[]) validTools.toArray(new ITool[validTools.size()]);
- }
-
- // Replace tools with local overrides
- for (int i = 0; i < tools.length; ++i) {
- ITool tool = tools[i];
- if (tool == null) {
- // May have been filtered out
- continue;
- }
- ToolReference ref = getToolReference(tools[i]);
- if (ref != null)
- tools[i] = ref;
- }
-
- return tools;
- }
-
- /**
- * @param targetElement
- */
- public void reset(IConfigurationElement element) {
- // I just need to reset the tool references
- getLocalToolReferences().clear();
- IConfigurationElement[] configElements = element.getChildren();
- for (int l = 0; l < configElements.length; ++l) {
- IConfigurationElement configElement = configElements[l];
- if (configElement.getName().equals(IConfiguration.TOOL_REF)) {
- new ToolReference(this, configElement);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#getParent()
- */
- public IConfiguration getParent() {
- return parent;
- }
-
- /* (non-javadoc)
- *
- * @param tool
- * @return List
- */
- protected List getOptionReferences(ITool tool) {
- List references = new ArrayList();
-
- // Get all the option references I add for this tool
- ToolReference toolRef = getToolReference(tool);
- if (toolRef != null) {
- references.addAll(toolRef.getLocalOptionRefs());
- }
-
- // See if there is anything that my parents add that I don't
- if (parent != null) {
- List temp = ((Configuration)parent).getOptionReferences(tool);
- Iterator iter = temp.listIterator();
- while (iter.hasNext()) {
- OptionReference ref = (OptionReference) iter.next();
- if (!references.contains(ref)) {
- references.add(ref);
- }
- }
- }
-
- return references;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#getTarget()
- */
- public ITarget getTarget() {
- return (target == null && parent != null) ? parent.getTarget() : target;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#getOwner()
- */
- public IResource getOwner() {
- return getTarget().getOwner();
- }
-
- /**
- * Returns the reference for a given tool or null
if one is not
- * found.
- *
- * @param tool
- * @return ToolReference
- */
- private ToolReference getToolReference(ITool tool) {
- // See if the receiver has a reference to the tool
- ToolReference ref = null;
- Iterator iter = getLocalToolReferences().listIterator();
- while (iter.hasNext()) {
- ToolReference temp = (ToolReference)iter.next();
- if (temp.references(tool)) {
- ref = temp;
- break;
- }
- }
-
- return ref;
- }
-
- public void addToolReference(ToolReference toolRef) {
- getLocalToolReferences().add(toolRef);
- }
-
- public OptionReference createOptionReference(IOption option) {
- if (option instanceof OptionReference) {
- OptionReference optionRef = (OptionReference)option;
- ToolReference toolRef = optionRef.getToolReference();
- if (toolRef.getConfiguration().equals(this))
- return optionRef;
- else {
- toolRef = new ToolReference(this, toolRef);
- return toolRef.createOptionReference(option);
- }
- } else {
- ToolReference toolRef = getToolReference(option.getTool());
- if (toolRef == null)
- toolRef = new ToolReference(this, option.getTool());
- return toolRef.createOptionReference(option);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, boolean)
- */
- public void setOption(IOption option, boolean value) throws BuildException {
- // Is there a delta
- if (option.getBooleanValue() != value)
- createOptionReference(option).setValue(value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String)
- */
- public void setOption(IOption option, String value) throws BuildException {
- String oldValue;
- // Check whether this is an enumerated option
- if (option.getValueType() == IOption.ENUMERATED) {
- oldValue = option.getSelectedEnum();
- }
- else {
- oldValue = option.getStringValue();
- }
- if (!oldValue.equals(value))
- createOptionReference(option).setValue(value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String[])
- */
- public void setOption(IOption option, String[] value) throws BuildException {
- // Is there a delta
- String[] oldValue;
- switch (option.getValueType()) {
- case IOption.STRING_LIST :
- oldValue = option.getStringListValue();
- break;
- case IOption.INCLUDE_PATH :
- oldValue = option.getIncludePaths();
- break;
- case IOption.PREPROCESSOR_SYMBOLS :
- oldValue = option.getDefinedSymbols();
- break;
- case IOption.LIBRARIES :
- oldValue = option.getLibraries();
- break;
- case IOption.OBJECTS :
- oldValue = option.getUserObjects();
- break;
- default :
- oldValue = new String[0];
- break;
- }
- if(!Arrays.equals(value, oldValue))
- createOptionReference(option).setValue(value);
- }
-
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
deleted file mode 100644
index c60ede4c2fd..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
+++ /dev/null
@@ -1,442 +0,0 @@
-package org.eclipse.cdt.managedbuilder.internal.core;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * **********************************************************************/
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.CommandLauncher;
-import org.eclipse.cdt.core.ConsoleOutputStream;
-import org.eclipse.cdt.core.ErrorParserManager;
-import org.eclipse.cdt.core.model.ICModelMarker;
-import org.eclipse.cdt.core.resources.ACBuilder;
-import org.eclipse.cdt.core.resources.IConsole;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-public class GeneratedMakefileBuilder extends ACBuilder {
- // String constants
- private static final String MESSAGE = "ManagedMakeBuilder.message"; //$NON-NLS-1$
- private static final String BUILD_ERROR = MESSAGE + ".error"; //$NON-NLS-1$
- private static final String REFRESH_ERROR = BUILD_ERROR + ".refresh"; //$NON-NLS-1$
- private static final String BUILD_FINISHED = MESSAGE + ".finished"; //$NON-NLS-1$
- private static final String INCREMENTAL = MESSAGE + ".incremental"; //$NON-NLS-1$
- private static final String MAKE = MESSAGE + ".make"; //$NON-NLS-1$
- private static final String REBUILD = MESSAGE + ".rebuild"; //$NON-NLS-1$
- private static final String START = MESSAGE + ".starting"; //$NON-NLS-1$
- private static final String REFRESH = MESSAGE + ".updating"; //$NON-NLS-1$
- private static final String MARKERS = MESSAGE + ".creating.markers"; //$NON-NLS-1$
-
- // Local variables
- protected List resourcesToBuild;
- protected List ruleList;
-
-
- public class ResourceDeltaVisitor implements IResourceDeltaVisitor {
- private boolean buildNeeded = false;
-
- public boolean visit(IResourceDelta delta) throws CoreException {
- IResource resource = delta.getResource();
- // If the project has changed, then a build is needed and we can stop
- if (resource != null && resource.getProject() == getProject()) {
- buildNeeded = true;
- return false;
- }
-
- return true;
- }
-
- public boolean shouldBuild() {
- return buildNeeded;
- }
- }
-
- /**
- *
- */
- public GeneratedMakefileBuilder() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.internal.events.InternalBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
- String statusMsg = ManagedBuilderCorePlugin.getFormattedString(START, getProject().getName());
- if (statusMsg != null) {
- monitor.subTask(statusMsg);
- }
-
- // Get the build information
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
-
- if (kind == IncrementalProjectBuilder.FULL_BUILD || info.isDirty()) {
- fullBuild(monitor, info);
- }
- else if (kind == IncrementalProjectBuilder.AUTO_BUILD && info.isDirty()) {
- fullBuild(monitor, info);
- }
- else {
- // Create a delta visitor to make sure we should be rebuilding
- ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
- IResourceDelta delta = getDelta(getProject());
- if (delta == null) {
- fullBuild(monitor, info);
- }
- else {
- delta.accept(visitor);
- if (visitor.shouldBuild()) {
- incrementalBuild(delta, info, monitor);
- }
- }
- }
-
- // Scrub the build info of all the projects participating in the build
- info.setDirty(false);
- IProject[] deps = getProject().getReferencedProjects();
- for (int i = 0; i < deps.length; i++) {
- IProject project = deps[i];
- IManagedBuildInfo depInfo = ManagedBuildManager.getBuildInfo(project);
- // May not be a managed project
- if (depInfo != null) {
- depInfo.setDirty(false);
- }
- }
-
- // Ask build mechanism to compute deltas for project dependencies next time
- return deps;
- }
-
- /**
- * Check whether the build has been canceled. Cancellation requests
- * propagated to the caller by throwing OperationCanceledException
.
- *
- * @see org.eclipse.core.runtime.OperationCanceledException#OperationCanceledException()
- */
- public void checkCancel(IProgressMonitor monitor) {
- if (monitor != null && monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- }
-
- /**
- * @param monitor
- */
- protected void fullBuild(IProgressMonitor monitor, IManagedBuildInfo info) throws CoreException {
- // Always need one of these bad boys
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
-
- // Regenerate the makefiles for any managed projects this project depends on
- IProject[] deps = getProject().getReferencedProjects();
- for (int i = 0; i < deps.length; i++) {
- IProject depProject = deps[i];
- if (ManagedBuildManager.manages(depProject)) {
- IManagedBuildInfo depInfo = ManagedBuildManager.getBuildInfo(depProject);
- MakefileGenerator generator = new MakefileGenerator(depProject, depInfo, monitor);
- try {
- generator.regenerateMakefiles();
- } catch (CoreException e) {
- // Throw the exception back to the builder
- throw e;
- }
- }
- }
-
- // Need to report status to the user
- String statusMsg = ManagedBuilderCorePlugin.getFormattedString(REBUILD, getProject().getName());
- monitor.subTask(statusMsg);
-
- // Regenerate the makefiles for this project
- MakefileGenerator generator = new MakefileGenerator(getProject(), info, monitor);
- try {
- generator.regenerateMakefiles();
- } catch (CoreException e) {
- // Throw the exception back to the builder
- throw e;
- }
-
- // Now call make
- IPath topBuildDir = generator.getTopBuildDir();
- if (topBuildDir != null) {
- invokeMake(true, topBuildDir.removeFirstSegments(1), info, monitor);
- } else {
- monitor.done();
- }
- }
-
- /* (non-javadoc)
- * Answers an array of strings with the proper make targets
- *
- * @param fullBuild
- * @return
- */
- protected String[] getMakeTargets(boolean fullBuild) {
- List args = new ArrayList();
- if (fullBuild) {
- args.add("clean");
- }
- args.add("all");
- return (String[])args.toArray(new String[args.size()]);
- }
-
- /**
- * @return
- */
- protected List getResourcesToBuild() {
- if (resourcesToBuild == null) {
- resourcesToBuild = new ArrayList();
- }
- return resourcesToBuild;
- }
-
- /* (non-javadoc)
- * Answers the list of build rules that have been assembled. If there are none,
- * answers an empty list, never null
- *
- * @return
- */
- protected List getRuleList() {
- if (ruleList == null) {
- ruleList = new ArrayList();
- }
- return ruleList;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.resources.ACBuilder#getWorkingDirectory()
- */
- public IPath getWorkingDirectory() {
- IProject currProject = getProject();
- IPath workingDirectory = currProject.getLocation();
- return workingDirectory;
- }
-
- /**
- * @param delta
- * @param monitor
- */
- protected void incrementalBuild(IResourceDelta delta, IManagedBuildInfo info, IProgressMonitor monitor) throws CoreException {
- // Rebuild the resource tree in the delta
- String statusMsg = null;
-
- // Need to report status to the user
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
- statusMsg = ManagedBuilderCorePlugin.getFormattedString(INCREMENTAL, getProject().getName());
- monitor.subTask(statusMsg);
-
- // Regenerate the makefiles for any managed projects this project depends on
- IProject[] deps = getProject().getReferencedProjects();
- for (int i = 0; i < deps.length; i++) {
- IProject depProject = deps[i];
- if (ManagedBuildManager.manages(depProject)) {
- IManagedBuildInfo depInfo = ManagedBuildManager.getBuildInfo(depProject);
- MakefileGenerator generator = new MakefileGenerator(depProject, depInfo, monitor);
- try {
- generator.regenerateMakefiles();
- } catch (CoreException e) {
- // Throw the exception back to the builder
- throw e;
- }
- }
- }
-
- // Ask the makefile generator to generate any makefiles needed to build delta
- MakefileGenerator generator = new MakefileGenerator(getProject(), info, monitor);
- try {
- generator.generateMakefiles(delta);
- } catch (CoreException e) {
- // Throw the exception back to the builder
- throw e;
- }
-
- // Run the build
- IPath buildDir = new Path(info.getConfigurationName());
- invokeMake(false, buildDir, info, monitor);
- }
-
- protected void invokeMake(boolean fullBuild, IPath buildDir, IManagedBuildInfo info, IProgressMonitor monitor) {
- // Get the project and make sure there's a monitor to cancel the build
- IProject currentProject = getProject();
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
-
- try {
- // Figure out the working directory for the build and make sure there is a makefile there
- IPath workingDirectory = getWorkingDirectory().append(buildDir);
- IWorkspace workspace = currentProject.getWorkspace();
- if (workspace == null) {
- return;
- }
- IWorkspaceRoot root = workspace.getRoot();
- if (root == null) {
- return;
- }
- IPath makefile = workingDirectory.addTrailingSeparator().append(MakefileGenerator.MAKEFILE_NAME);
- if (root.getFileForLocation(makefile) == null) {
- return;
- }
-
- // Flag to the user that make is about to be called
- IPath makeCommand = new Path(info.getMakeCommand());
- if (makeCommand != null) {
- String[] msgs = new String[2];
- msgs[0] = makeCommand.toString();
- msgs[1] = currentProject.getName();
- monitor.beginTask(ManagedBuilderCorePlugin.getFormattedString(MAKE, msgs), IProgressMonitor.UNKNOWN);
-
- // Get a build console for the project
- IConsole console = CCorePlugin.getDefault().getConsole();
- console.start(currentProject);
- ConsoleOutputStream consoleOutStream = console.getOutputStream();
-
- // Remove all markers for this project
- removeAllMarkers(currentProject);
- IProject[] deps = currentProject.getReferencedProjects();
- for (int i = 0; i < deps.length; i++) {
- IProject project = deps[i];
- removeAllMarkers(project);
- }
-
- // Get the arguments to be passed to make from build model
- ArrayList makeArgs = new ArrayList();
- String args = info.getMakeArguments();
- if (args.length() > 0) {
- makeArgs.add(args);
- }
- makeArgs.addAll(Arrays.asList(getMakeTargets(fullBuild)));
- String[] makeTargets = (String[]) makeArgs.toArray(new String[makeArgs.size()]);
-
- // Get a launcher for the make command
- String errMsg = null;
- CommandLauncher launcher = new CommandLauncher();
- launcher.showCommand(true);
-
- // Set the environmennt, some scripts may need the CWD var to be set.
- Properties props = launcher.getEnvironment();
- props.put("CWD", workingDirectory.toOSString()); //$NON-NLS-1$
- props.put("PWD", workingDirectory.toOSString()); //$NON-NLS-1$
- String[] env = null;
- ArrayList envList = new ArrayList();
- Enumeration names = props.propertyNames();
- if (names != null) {
- while (names.hasMoreElements()) {
- String key = (String) names.nextElement();
- envList.add(key + "=" + props.getProperty(key)); //$NON-NLS-1$
- }
- env = (String[]) envList.toArray(new String[envList.size()]);
- }
-
- // Hook up an error parser
- ErrorParserManager epm = new ErrorParserManager(this);
- epm.setOutputStream(consoleOutStream);
- OutputStream stdout = epm.getOutputStream();
- OutputStream stderr = epm.getOutputStream();
-
- // Launch make
- Process proc = launcher.execute(makeCommand, makeTargets, env, workingDirectory);
- if (proc != null) {
- try {
- // Close the input of the process since we will never write to it
- proc.getOutputStream().close();
- } catch (IOException e) {
- }
-
- if (launcher.waitAndRead(stdout, stderr, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) {
- errMsg = launcher.getErrorMessage();
- }
-
- // Force a resync of the projects without allowing the user to cancel.
- // This is probably unkind, but short of this there is no way to insure
- // the UI is up-to-date with the build results
- monitor.subTask(ManagedBuilderCorePlugin.getResourceString(REFRESH));
- try {
- currentProject.refreshLocal(IResource.DEPTH_INFINITE, null);
- for (int j = 0; j < deps.length; ++j) {
- IProject project = deps[j];
- project.refreshLocal(IResource.DEPTH_INFINITE, null);
- }
- } catch (CoreException e) {
- monitor.subTask(ManagedBuilderCorePlugin.getResourceString(REFRESH_ERROR));
- }
- } else {
- errMsg = launcher.getErrorMessage();
- }
-
- // Report either the success or failure of our mission
- StringBuffer buf = new StringBuffer();
- if (errMsg != null && errMsg.length() > 0) {
- String errorDesc = ManagedBuilderCorePlugin.getResourceString(BUILD_ERROR);
- buf.append(errorDesc);
- buf.append(System.getProperty("line.separator", "\n"));
- buf.append("(").append(errMsg).append(")");
- } else {
- // Report a successful build
- String successMsg = ManagedBuilderCorePlugin.getFormattedString(BUILD_FINISHED, currentProject.getName());
- buf.append(successMsg);
- buf.append(System.getProperty("line.separator", "\n"));
- }
-
- // Write message on the console
- consoleOutStream.write(buf.toString().getBytes());
- consoleOutStream.flush();
- stdout.close();
- stderr.close();
-
- monitor.subTask(ManagedBuilderCorePlugin.getResourceString(MARKERS)); //$NON-NLS-1$
- epm.reportProblems();
- }
- } catch (Exception e) {
- CCorePlugin.log(e);
- forgetLastBuiltState();
- } finally {
- monitor.done();
- }
- }
-
- private void removeAllMarkers(IProject project) throws CoreException {
- IWorkspace workspace = project.getWorkspace();
-
- // remove all markers
- IMarker[] markers = project.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
- if (markers != null) {
- workspace.deleteMarkers(markers);
- }
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
deleted file mode 100644
index aadd19e8233..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
+++ /dev/null
@@ -1,968 +0,0 @@
-package org.eclipse.cdt.managedbuilder.internal.core;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * **********************************************************************/
-
-import java.io.ByteArrayInputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.search.ICSearchConstants;
-import org.eclipse.cdt.core.search.ICSearchScope;
-import org.eclipse.cdt.core.search.SearchEngine;
-import org.eclipse.cdt.internal.core.model.Util;
-import org.eclipse.cdt.internal.core.search.PathCollector;
-import org.eclipse.cdt.internal.core.search.PatternSearchJob;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.cdt.internal.core.search.matching.CSearchPattern;
-import org.eclipse.cdt.internal.core.sourcedependency.DependencyQueryJob;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.IResourceProxyVisitor;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-
-public class MakefileGenerator {
- // String constants for messages
- private static final String MESSAGE = "ManagedMakeBuilder.message"; //$NON-NLS-1$
- private static final String BUILD_ERROR = MESSAGE + ".error"; //$NON-NLS-1$
- private static final String COMMENT = "ManagedMakeBuilder.comment"; //$NON-NLS-1$
- private static final String MOD_LIST = COMMENT + ".module.list"; //$NON-NLS-1$
- private static final String SRC_LISTS = COMMENT + ".source.list"; //$NON-NLS-1$
- private static final String MOD_RULES = COMMENT + ".build.rule"; //$NON-NLS-1$
- private static final String MOD_INCL = COMMENT + ".module.make.includes"; //$NON-NLS-1$
- private static final String DEP_INCL = COMMENT + ".module.dep.includes"; //$NON-NLS-1$
- private static final String AUTO_DEP = COMMENT + ".autodeps"; //$NON-NLS-1$
-
- // String constants for makefile contents
- protected static final String COLON = ":";
- protected static final String DEPFILE_NAME = "subdir.dep"; //$NON-NLS-1$
- protected static final String DOT = ".";
- protected static final String MAKEFILE_NAME = "makefile"; //$NON-NLS-1$
- protected static final String MODFILE_NAME = "subdir.mk"; //$NON-NLS-1$
- protected static final String LINEBREAK = "\\";
- protected static final String NEWLINE = System.getProperty("line.separator");
- protected static final String LOGICAL_AND = "&&";
- protected static final String SEPARATOR = "/";
- protected static final String TAB = "\t";
- protected static final String WHITESPACE = " ";
- protected static final String WILDCARD = "%";
-
- // Local variables needed by generator
- protected IManagedBuildInfo info;
- protected List modifiedList;
- protected IProgressMonitor monitor;
- protected List subdirList;
- protected IProject project;
- protected List ruleList;
- protected IPath topBuildDir;
- private String target;
- private String extension;
-
- /**
- * This class is used to recursively walk the project and determine which
- * modules contribute buildable source files.
- */
- protected class ResourceProxyVisitor implements IResourceProxyVisitor {
- private MakefileGenerator generator;
- private IManagedBuildInfo info;
-
- /**
- * Constructs a new resource proxy visitor to quickly visit project
- * resources.
- */
- public ResourceProxyVisitor(MakefileGenerator generator, IManagedBuildInfo info) {
- this.generator = generator;
- this.info = info;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceProxyVisitor#visit(org.eclipse.core.resources.IResourceProxy)
- */
- public boolean visit(IResourceProxy proxy) throws CoreException {
- // No point in proceeding, is there
- if (generator == null) {
- return false;
- }
-
- // Is this a resource we should even consider
- if (proxy.getType() == IResource.FILE) {
- // Check extension to see if build model should build this file
- IResource resource = proxy.requestResource();
- String ext = resource.getFileExtension();
- if (info.buildsFileType(ext)) {
- if (!generator.isGeneratedResource(resource)) {
- generator.appendBuildSubdirectory(resource);
- }
- }
- return false;
- }
-
- // Recurse into subdirectories
- return true;
- }
-
- }
-
- public class ResourceDeltaVisitor implements IResourceDeltaVisitor {
- private MakefileGenerator generator;
- private IManagedBuildInfo info;
-
- /**
- *
- */
- public ResourceDeltaVisitor(MakefileGenerator generator, IManagedBuildInfo info) {
- this.generator = generator;
- this.info = info;
- }
-
- /* (non-javadoc)
- * Answers a list of resource names in the workspace that depend on the resource
- * specified in the argument.
- *
- * @param resource the root of the dependency tree
- * @return IResource[]
- */
- private IResource[] findDependencies(IResource resource) {
- PathCollector pathCollector = new PathCollector();
- ICSearchScope scope = SearchEngine.createWorkspaceScope();
- CSearchPattern pattern = CSearchPattern.createPattern(resource.getLocation().toOSString(), ICSearchConstants.INCLUDE, ICSearchConstants.REFERENCES, ICSearchConstants.EXACT_MATCH, true);
- IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
- indexManager.performConcurrentJob(
- new PatternSearchJob(
- (CSearchPattern) pattern,
- scope,
- pathCollector,
- indexManager),
- ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
- null, null);
-
- // We will get back an array of resource names relative to the workspace
- String[] deps = pathCollector.getPaths();
-
- // Convert them to something useful
- List depList = new ArrayList();
- IResource res = null;
- IWorkspaceRoot root = null;
- if (generator.project != null) {
- root = generator.project.getWorkspace().getRoot();
- }
- for (int index = 0; index < deps.length; ++index) {
- res = root.findMember(deps[index]);
- if (res != null) {
- depList.add(res);
- }
- }
-
- return (IResource[]) depList.toArray(new IResource[depList.size()]);
- }
-
- private void handleHeaderDependency(IResource resource, boolean moved) {
- // If this is a move and the resource is external to the project, touch that resource
- if (resource.getProject().equals(generator.project)) {
- generator.appendModifiedSubdirectory(resource);
- } else {
- if (moved) {
- try {
- resource.touch(new NullProgressMonitor());
- } catch (CoreException e) {
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
- */
- public boolean visit(IResourceDelta delta) throws CoreException {
- // Should the visitor keep iterating in current directory
- boolean keepLooking = false;
- IResource resource = delta.getResource();
-
- // What kind of resource change has occurred
- if (resource.getType() == IResource.FILE) {
- String ext = resource.getFileExtension();
- boolean moved = false;
- switch (delta.getKind()) {
- case IResourceDelta.ADDED:
- moved = delta.getFlags() == IResourceDelta.MOVED_TO;
- if (!generator.isGeneratedResource(resource)) {
- // This is a source file so just add its container
- if (info.buildsFileType(ext)) {
- generator.appendModifiedSubdirectory(resource);
- } else if (info.isHeaderFile(ext)) {
- // Add the container of the resource and any resources that depend on it
- generator.appendModifiedSubdirectory(resource);
- IResource[] deps = findDependencies(resource);
- for (int i = 0; i < deps.length; ++i){
- handleHeaderDependency(deps[i], moved);
- }
- }
- }
- break;
- case IResourceDelta.REMOVED:
- moved = delta.getFlags() == IResourceDelta.MOVED_FROM;
- if (!generator.isGeneratedResource(resource)) {
- // This is a source file so just add its container
- if (info.buildsFileType(ext)) {
- generator.appendModifiedSubdirectory(resource);
- } else if (info.isHeaderFile(ext)) {
- // Add the container of the resource and any resources that depend on it
- generator.appendModifiedSubdirectory(resource);
- IResource[] deps = findDependencies(resource);
- for (int i = 0; i < deps.length; ++i){
- handleHeaderDependency(deps[i], moved);
- }
- }
- }
- break;
- case IResourceDelta.CHANGED:
- if (!generator.isGeneratedResource(resource)) {
- if (info.buildsFileType(ext)) {
- keepLooking = true;
- } else if (info.isHeaderFile(ext)) {
- // Add the container of the resource and any resources that depend on it
- generator.appendModifiedSubdirectory(resource);
- IResource[] deps= findDependencies(resource);
- for (int i = 0; i < deps.length; ++i){
- handleHeaderDependency(deps[i], moved);
- }
- // That does it for this directory, so don't bother to keep looking
- }
- }
- break;
- default:
- keepLooking = true;
- break;
- }
- } if (resource.getType() == IResource.PROJECT) {
- // If there is a zero-length delta, something the project depends on has changed so just call make
- IResourceDelta[] children = delta.getAffectedChildren();
- if (children != null && children.length > 0) {
- keepLooking = true;
- }
- } else {
- // If the resource is part of the generated directory structure don't recurse
- if (!generator.isGeneratedResource(resource)) {
- keepLooking = true;
- }
- }
-
- return keepLooking;
- }
- }
-
- /**
- * @param project
- * @param info
- * @param monitor
- */
- public MakefileGenerator(IProject project, IManagedBuildInfo info, IProgressMonitor monitor) {
- super();
- // Save the project so we can get path and member information
- this.project = project;
- // Save the monitor reference for reporting back to the user
- this.monitor = monitor;
- // Get the build info for the project
- this.info = info;
- // Get the name of the build target
- target = info.getBuildArtifactName();
- // Get its extension
- extension = (new Path(target)).getFileExtension();
- if (extension == null) {
- extension = new String();
- }
- }
-
- /* (non-javadoc)
- * Calculates dependencies for all the source files in the argument. A source
- * file can depend on any number of header files, so the dependencies have to
- * be added to its dependency list.
- *
- * @param module
- * @return
- */
- protected StringBuffer addSourceDependencies(IContainer module) throws CoreException {
- // Calculate the new directory relative to the build output
- IPath moduleRelativePath = module.getProjectRelativePath();
- String relativePath = moduleRelativePath.toString();
- relativePath += relativePath.length() == 0 ? "" : SEPARATOR;
-
- // Create the buffer to hold the output for the module and a dep calculator
- StringBuffer buffer = new StringBuffer();
- buffer.append(ManagedBuilderCorePlugin.getResourceString(AUTO_DEP) + NEWLINE);
- IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
-
- /*
- * Visit each resource in the folder that we have a rule to build.
- * The dependency output for each resource will be in the format
- * StringBuffer
containing all of the sources contributed by
- * a container to the build.
- *
- * @param module
- * @return StringBuffer
- */
- protected StringBuffer addSources(IContainer module) throws CoreException {
- // Calculate the new directory relative to the build output
- IPath moduleRelativePath = module.getProjectRelativePath();
- String relativePath = moduleRelativePath.toString();
- relativePath += relativePath.length() == 0 ? "" : SEPARATOR;
-
- // String buffers
- StringBuffer buffer = new StringBuffer();
- StringBuffer cBuffer = new StringBuffer("C_SRCS += " + LINEBREAK + NEWLINE);
- cBuffer.append("${addprefix $(ROOT)/" + relativePath + "," + LINEBREAK + NEWLINE);
- StringBuffer ccBuffer = new StringBuffer("CC_SRCS += \\" + NEWLINE);
- ccBuffer.append("${addprefix $(ROOT)/" + relativePath + "," + LINEBREAK + NEWLINE);
- StringBuffer cxxBuffer = new StringBuffer("CXX_SRCS += \\" + NEWLINE);
- cxxBuffer.append("${addprefix $(ROOT)/" + relativePath + "," + LINEBREAK + NEWLINE);
- StringBuffer capcBuffer = new StringBuffer("CAPC_SRCS += \\" + NEWLINE);
- capcBuffer.append("${addprefix $(ROOT)/" + relativePath + "," + LINEBREAK + NEWLINE);
- StringBuffer cppBuffer = new StringBuffer("CPP_SRCS += \\" + NEWLINE);
- cppBuffer.append("${addprefix $(ROOT)/" + relativePath + "," + LINEBREAK + NEWLINE);
- StringBuffer ruleBuffer = new StringBuffer(ManagedBuilderCorePlugin.getResourceString(MOD_RULES) + NEWLINE);
-
- // Put the comment in
- buffer.append(ManagedBuilderCorePlugin.getResourceString(SRC_LISTS) + NEWLINE);
-
- // Visit the resources in this folder
- IResource[] resources = module.members();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (resource.getType() == IResource.FILE) {
- String ext = resource.getFileExtension();
- if (info.buildsFileType(ext)) {
- if (new String("c").equals(ext)) {
- cBuffer.append(resource.getName() + WHITESPACE + LINEBREAK + NEWLINE);
- } else if (new String("cc").equalsIgnoreCase(ext)) {
- ccBuffer.append(resource.getName() + WHITESPACE + LINEBREAK + NEWLINE);
- } else if (new String("cxx").equalsIgnoreCase(ext)) {
- cxxBuffer.append(resource.getName() + WHITESPACE + LINEBREAK + NEWLINE);
- } else if (new String("C").equals(ext)) {
- capcBuffer.append(resource.getName() + WHITESPACE + LINEBREAK + NEWLINE);
- } else {
- cppBuffer.append(resource.getName() + WHITESPACE + LINEBREAK + NEWLINE);
- }
-
- // Try to add the rule for the file
- addRule(relativePath, ruleBuffer, resource);
- }
- }
- }
-
- // Finish the commands in the buffers
- buffer.append(cBuffer.append("}" + NEWLINE + NEWLINE));
- buffer.append(ccBuffer.append("}" + NEWLINE + NEWLINE));
- buffer.append(cxxBuffer.append("}" + NEWLINE + NEWLINE));
- buffer.append(capcBuffer.append("}" + NEWLINE + NEWLINE));
- buffer.append(cppBuffer.append("}" + NEWLINE + NEWLINE));
-
- return buffer.append(ruleBuffer + NEWLINE);
- }
-
- /* (non-javadoc)
- * Answers a StrinBuffer
containing all of the required targets to
- * properly build the project.
- *
- * @return StringBuffer
- */
- protected StringBuffer addTargets(boolean rebuild) {
- StringBuffer buffer = new StringBuffer();
-
- // Assemble the information needed to generate the targets
- String cmd = info.getToolForTarget(extension);
- String flags = info.getFlagsForTarget(extension);
- String outflag = info.getOutputFlag(extension);
- String outputPrefix = info.getOutputPrefix(extension);
- String targets = rebuild ? "clean all" : "all";
-
- // Get all the projects the build target depends on
- IProject[] deps = null;
- try {
- deps = project.getReferencedProjects();
- } catch (CoreException e) {
- // There are 2 exceptions; the project does not exist or it is not open
- // and neither conditions apply if we are building for it ....
- }
-
- // Write out the all target first in case someone just runs make
- // all: targ_OperationCanceledException
.
- *
- * @see org.eclipse.core.runtime.OperationCanceledException#OperationCanceledException()
- */
- public void checkCancel() {
- if (monitor != null && monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- }
-
-
- /**
- * Clients call this method when an incremental rebuild is required. The argument
- * contains a set of resource deltas that will be used to determine which
- * subdirectories need a new makefile and dependency list (if any).
- *
- * @param delta
- * @throws CoreException
- */
- public void generateMakefiles(IResourceDelta delta) throws CoreException {
- /*
- * Let's do a sanity check right now.
- *
- * 1. This is an incremental build, so if the top-level directory is not
- * there, then a rebuild is needed.
- */
- IFolder folder = project.getFolder(info.getConfigurationName());
- if (!folder.exists()) {
- regenerateMakefiles();
- return;
- }
-
- // Visit the resources in the delta and compile a list of subdirectories to regenerate
- ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(this, info);
- delta.accept(visitor);
-
- // See if the user has cancelled the build
- checkCancel();
-
- // The top-level makefile needs this information
- ResourceProxyVisitor resourceVisitor = new ResourceProxyVisitor(this, info);
- project.accept(resourceVisitor, IResource.NONE);
- checkCancel();
-
- // Regenerate any fragments that are missing for the exisiting directories NOT modified
- Iterator iter = getSubdirList().listIterator();
- while (iter.hasNext()) {
- IContainer subdirectory = (IContainer)iter.next();
- if (!getModifiedList().contains(subdirectory)) {
- // Make sure a fragment makefile and dependency file exist
- IFile makeFragment = project.getFile(subdirectory.getFullPath().addTrailingSeparator().append(MODFILE_NAME));
- IFile depFragment = project.getFile(subdirectory.getFullPath().addTrailingSeparator().append(DEPFILE_NAME));
- if (!makeFragment.exists() || !depFragment.exists()) {
- // If one or both are missing, then add it to the list to be generated
- getModifiedList().add(subdirectory);
- }
- }
- }
-
- // Re-create the top-level makefile
- topBuildDir = createDirectory(info.getConfigurationName());
- IPath makefilePath = topBuildDir.addTrailingSeparator().append(MAKEFILE_NAME);
- IFile makefileHandle = createFile(makefilePath);
- populateTopMakefile(makefileHandle, false);
- checkCancel();
-
- // Regenerate any fragments for modified directories
- iter = getModifiedList().listIterator();
- while (iter.hasNext()) {
- populateFragmentMakefile((IContainer) iter.next());
- checkCancel();
- }
- }
-
- /* (non-javadoc)
- *
- * @return List
- */
- private List getModifiedList() {
- if (modifiedList == null) {
- modifiedList = new ArrayList();
- }
- return modifiedList;
- }
-
- /* (non-javadoc)
- * Answers the list of known build rules. This keeps me from generating duplicate
- * rules for known file extensions.
- *
- * @return List
- */
- private List getRuleList() {
- if (ruleList == null) {
- ruleList = new ArrayList();
- }
- return ruleList;
- }
-
- /* (non-javadoc)
- * Answers the list of subdirectories contributing source code to the build
- *
- * @return List
- */
- private List getSubdirList() {
- if (subdirList == null) {
- subdirList = new ArrayList();
- }
- return subdirList;
- }
-
- /* (non-javadoc)
- * @param string
- * @return IPath
- */
- private IPath createDirectory(String dirName) throws CoreException {
- // Create or get the handle for the build directory
- IFolder folder = project.getFolder(dirName);
- if (!folder.exists()) {
-
- // Make sure that parent folders exist
- IPath parentPath = (new Path(dirName)).removeLastSegments(1);
- // Assume that the parent exists if the path is empty
- if (!parentPath.isEmpty()) {
- IFolder parent = project.getFolder(parentPath);
- if (!parent.exists()) {
- createDirectory(parentPath.toString());
- }
- }
-
- // Now make the requested folder
- try {
- folder.create(true, true, null);
- }
- catch (CoreException e) {
- if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED)
- folder.refreshLocal(IResource.DEPTH_ZERO, null);
- else
- throw e;
- }
- }
- return folder.getFullPath();
- }
-
- /* (non-javadoc)
- * @param makefilePath
- * @param monitor
- * @return IFile
- */
- private IFile createFile(IPath makefilePath) throws CoreException {
- // Create or get the handle for the makefile
- IWorkspaceRoot root = CCorePlugin.getWorkspace().getRoot();
- IFile newFile = root.getFileForLocation(makefilePath);
- if (newFile == null) {
- newFile = root.getFile(makefilePath);
- }
- // Create the file if it does not exist
- ByteArrayInputStream contents = new ByteArrayInputStream(new byte[0]);
- try {
- newFile.create(contents, false, monitor);
- }
- catch (CoreException e) {
- // If the file already existed locally, just refresh to get contents
- if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED)
- newFile.refreshLocal(IResource.DEPTH_ZERO, null);
- else
- throw e;
- }
-
- return newFile;
- }
-
- /**
- * Answers the IPath
of the top directory generated for the build
- * output, or null
if none has been generated.
- *
- * @return IPath
- */
- public IPath getTopBuildDir() {
- return topBuildDir;
- }
-
- /**
- * Answers true
if the argument is found in a generated container
- * @param resource
- * @return boolean
- */
- public boolean isGeneratedResource(IResource resource) {
- // Is this a generated directory ...
- IPath path = resource.getProjectRelativePath();
- String[] configNames = info.getConfigurationNames();
- for (int i = 0; i < configNames.length; i++) {
- String name = configNames[i];
- IPath root = new Path(name);
- // It is if it is a root of the resource pathname
- if (root.isPrefixOf(path)) return true;
- }
-
- return false;
- }
-
- /* (non-javadoc)
- * Create the entire contents of the makefile.
- *
- * @param fileHandle The file to place the contents in.
- * @param rebuild FLag signalling that the user is doing a full rebuild
- * @throws CoreException
- */
- protected void populateTopMakefile(IFile fileHandle, boolean rebuild) throws CoreException {
- StringBuffer buffer = new StringBuffer();
-
- // Add the macro definitions
- buffer.append(addMacros());
-
- // Append the module list
- buffer.append(addSubdirectories());
-
- // Add targets
- buffer.append(addTargets(rebuild));
-
- // Save the file
- Util.save(buffer, fileHandle);
- }
-
- /* (non-javadoc)
- * @param module
- * @throws CoreException
- */
- protected void populateFragmentMakefile(IContainer module) throws CoreException {
- // Calcualte the new directory relative to the build output
- IPath moduleRelativePath = module.getProjectRelativePath();
- IPath buildRoot = getTopBuildDir().removeFirstSegments(1);
- if (buildRoot == null) {
- return;
- }
- IPath moduleOutputPath = buildRoot.append(moduleRelativePath);
-
- // Now create the directory
- IPath moduleOutputDir = createDirectory(moduleOutputPath.toString());
-
- // Create a module makefile
- IFile modMakefile = createFile(moduleOutputDir.addTrailingSeparator().append(MODFILE_NAME));
- StringBuffer makeBuf = new StringBuffer();
- makeBuf.append(addSources(module));
-
- // Create a module dep file
- IFile modDepfile = createFile(moduleOutputDir.addTrailingSeparator().append(DEPFILE_NAME));
- StringBuffer depBuf = new StringBuffer();
- depBuf.append(addSourceDependencies(module));
-
- // Save the files
- Util.save(makeBuf, modMakefile);
- Util.save(depBuf, modDepfile);
- }
-
-
- /**
- * @throws CoreException
- */
- public void regenerateMakefiles() throws CoreException {
- // Visit the resources in the project
- ResourceProxyVisitor visitor = new ResourceProxyVisitor(this, info);
- project.accept(visitor, IResource.NONE);
-
- // See if the user has cancelled the build
- checkCancel();
-
- // Populate the makefile if any source files have been found in the project
- if (getSubdirList().isEmpty()) {
- return;
- }
-
- // Create the top-level directory for the build output
- topBuildDir = createDirectory(info.getConfigurationName());
-
- // Create the top-level makefile
- IPath makefilePath = topBuildDir.addTrailingSeparator().append(MAKEFILE_NAME);
- IFile makefileHandle = createFile(makefilePath);
-
- populateTopMakefile(makefileHandle, true);
- checkCancel();
-
- // Now populate the module makefiles
- ListIterator iter = getSubdirList().listIterator();
- while (iter.hasNext()) {
- populateFragmentMakefile((IContainer)iter.next());
- checkCancel();
- }
- }
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
deleted file mode 100644
index 7edafd91490..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
+++ /dev/null
@@ -1,870 +0,0 @@
-package org.eclipse.cdt.managedbuilder.internal.core;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * **********************************************************************/
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.core.CCProjectNature;
-import org.eclipse.cdt.core.CProjectNature;
-import org.eclipse.cdt.core.parser.IScannerInfo;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
-
- // Local variables
- private boolean isDirty;
- private IResource owner;
- private Map targetMap;
- private List targets;
- private Map defaultConfigurations;
- private ITarget defaultTarget;
-
- public ManagedBuildInfo(IResource owner) {
- targetMap = new HashMap();
- targets = new ArrayList();
- defaultConfigurations = new HashMap();
- this.owner = owner;
- }
-
- public ManagedBuildInfo(IResource owner, Element element) {
- this(owner);
-
- // The id of the default configuration
- String defaultTargetId = null;
- List configIds = new ArrayList();
- Node child = element.getFirstChild();
- while (child != null) {
- if (child.getNodeName().equals("target")) {
- new Target(this, (Element)child);
- } else if (child.getNodeName().equals("defaultConfig")) {
- // We may not have read the config in yet, so just cache it
- configIds.add(((Element)child).getAttribute("id"));
- } else if (child.getNodeName().equals("defaultTarget")) {
- defaultTargetId = ((Element)child).getAttribute("id");
- }
- child = child.getNextSibling();
- }
- // All the available targets have been read in
- defaultTarget = (ITarget) targetMap.get(defaultTargetId);
- // Now we have a misserable O(N^2) operation (oh well, the data sets are small)
- ListIterator stringIter = configIds.listIterator();
- while (stringIter.hasNext()){
- String confId = (String) stringIter.next();
- ListIterator targIter = targets.listIterator();
- while (targIter.hasNext()) {
- Target targ = (Target) targIter.next();
- IConfiguration conf = targ.getConfiguration(confId);
- if (conf != null) {
- defaultConfigurations.put(targ.getId(), conf);
- break;
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#addTarget(org.eclipse.cdt.core.build.managed.ITarget)
- */
- public void addTarget(ITarget target) {
- targetMap.put(target.getId(), target);
- targets.add(target);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#buildsFileType(java.lang.String)
- */
- public boolean buildsFileType(String srcExt) {
- // Make sure the owner is treated as a project for the duration
- IProject project = (IProject)owner;
-
- // Check to see if there is a rule to build a file with this extension
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.buildsFileType(srcExt);
- }
- break;
- case ITool.FILTER_CC:
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.buildsFileType(srcExt);
- }
- break;
- case ITool.FILTER_BOTH:
- return tool.buildsFileType(srcExt);
- }
- } catch (CoreException e) {
- continue;
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getBuildArtifactName()
- */
- public String getBuildArtifactName() {
- // Get the default target and use its value
- String name = getDefaultTarget().getArtifactName();
- return name == null ? new String() : name;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getCleanCommand()
- */
- public String getCleanCommand() {
- // Get from the model
- String command = new String();
- ITarget target = getDefaultTarget();
- command = target.getCleanCommand();
- return command;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getConfigurationName()
- */
- public String getConfigurationName() {
- // Return the human-readable name of the default configuration
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- return config == null ? new String() : config.getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getConfigurationNames()
- */
- public String[] getConfigurationNames() {
- ArrayList configNames = new ArrayList();
- IConfiguration[] configs = getDefaultTarget().getConfigurations();
- for (int i = 0; i < configs.length; i++) {
- IConfiguration configuration = configs[i];
- configNames.add(configuration.getName());
- }
- configNames.trimToSize();
- return (String[])configNames.toArray(new String[configNames.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getDefaultConfiguration()
- */
- public IConfiguration getDefaultConfiguration(ITarget target) {
- // Get the default config associated with the defalt target
- IConfiguration config = (IConfiguration) defaultConfigurations.get(target.getId());
-
- // If null, look up the first configuration associated with the target
- if (config == null) {
- IConfiguration[] configs = getDefaultTarget().getConfigurations();
- if (configs.length > 0) {
- config = configs[0];
- }
- }
- return config;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getDefaultTarget()
- */
- public ITarget getDefaultTarget() {
- if (defaultTarget == null) {
- defaultTarget = (ITarget) targets.get(0);
- }
- return defaultTarget;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IScannerInfo#getDefinedSymbols()
- */
- public Map getDefinedSymbols() {
- IProject project = (IProject)owner;
- // Return the defined symbols for the default configuration
- HashMap symbols = new HashMap();
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
- for (int i = 0; i < tools.length; i++) {
- ITool tool = tools[i];
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (!project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- continue;
- }
- break;
- case ITool.FILTER_CC:
- if (!project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- continue;
- }
- break;
- case ITool.FILTER_BOTH:
- break;
- }
- } catch (CoreException e) {
- continue;
- }
- // Now extract the valid tool's options
- IOption[] opts = tool.getOptions();
- for (int j = 0; j < opts.length; j++) {
- IOption option = opts[j];
- if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
- try {
- ArrayList symbolList = new ArrayList();
- symbolList.addAll(Arrays.asList(option.getBuiltIns()));
- symbolList.addAll(Arrays.asList(option.getDefinedSymbols()));
- Iterator iter = symbolList.listIterator();
- while (iter.hasNext()) {
- String symbol = (String) iter.next();
- if (symbol.length() == 0){
- continue;
- }
- String key = new String();
- String value = new String();
- int index = symbol.indexOf("=");
- if (index != -1) {
- key = symbol.substring(0, index).trim();
- value = symbol.substring(index + 1).trim();
- } else {
- key = symbol.trim();
- }
- symbols.put(key, value);
- }
-
- } catch (BuildException e) {
- // we should never get here
- continue;
- }
- }
- }
- }
- return symbols;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getFlagsForSource(java.lang.String)
- */
- public String getFlagsForSource(String extension) {
- IProject project = (IProject)owner;
-
- // Get all the tools for the current config
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- if (tool.buildsFileType(extension)) {
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.getToolFlags();
- }
- break;
- case ITool.FILTER_CC:
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.getToolFlags();
- }
- break;
- case ITool.FILTER_BOTH:
- return tool.getToolFlags();
- }
- } catch (CoreException e) {
- continue;
- } catch (BuildException e) {
- // Give it your best shot with the next tool
- continue;
- }
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolFlags(java.lang.String)
- */
- public String getFlagsForTarget(String extension) {
- IProject project = (IProject)owner;
- // Treat null extensions as an empty string
- String ext = extension == null ? new String() : extension;
-
- // Get all the tools for the current config
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- if (tool.producesFileType(ext)) {
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.getToolFlags();
- }
- break;
- case ITool.FILTER_CC:
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.getToolFlags();
- }
- break;
- case ITool.FILTER_BOTH:
- return tool.getToolFlags();
- }
- } catch (CoreException e) {
- continue;
- } catch (BuildException e) {
- // Give it your best shot with the next tool
- continue;
- }
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
- */
- public String[] getIncludePaths() {
- IProject project = (IProject)owner;
-
- // Return the include paths for the default configuration
- ArrayList paths = new ArrayList();
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- IPath root = owner.getLocation().addTrailingSeparator().append(config.getName());
- ITool[] tools = config.getTools();
- for (int i = 0; i < tools.length; i++) {
- ITool tool = tools[i];
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (!project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- continue;
- }
- break;
- case ITool.FILTER_CC:
- if (!project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- continue;
- }
- break;
- case ITool.FILTER_BOTH:
- break;
- }
- } catch (CoreException e) {
- continue;
- }
- // The tool checks out for this project, get its options
- IOption[] opts = tool.getOptions();
- for (int j = 0; j < opts.length; j++) {
- IOption option = opts[j];
- if (option.getValueType() == IOption.INCLUDE_PATH) {
- try {
- // Get all the built-in paths from the option
- paths.addAll(Arrays.asList(option.getBuiltIns()));
- // Get all the user-defined paths from the option as absolute paths
- String[] userPaths = option.getIncludePaths();
- for (int index = 0; index < userPaths.length; ++index) {
- IPath userPath = new Path(userPaths[index]);
- if (userPath.isAbsolute()) {
- paths.add(userPath.toOSString());
- } else {
- IPath absPath = root.addTrailingSeparator().append(userPath);
- paths.add(absPath.makeAbsolute().toOSString());
- }
- }
- } catch (BuildException e) {
- // we should never get here, but continue anyway
- continue;
- }
- }
- }
- }
- paths.trimToSize();
- return (String[])paths.toArray(new String[paths.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getLibsForTarget(java.lang.String)
- */
- public String[] getLibsForTarget(String extension) {
- IProject project = (IProject)owner;
-
- ArrayList libs = new ArrayList();
- // Get all the tools for the current config
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (!project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- continue;
- }
- break;
- case ITool.FILTER_CC:
- if (!project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- continue;
- }
- break;
- case ITool.FILTER_BOTH:
- break;
- }
- } catch (CoreException e) {
- continue;
- }
- // The tool is OK for this project nature
- if (tool.producesFileType(extension)) {
- IOption[] opts = tool.getOptions();
- // Look for the lib option type
- for (int i = 0; i < opts.length; i++) {
- IOption option = opts[i];
- if (option.getValueType() == IOption.LIBRARIES) {
- try {
- String command = option.getCommand();
- String[] allLibs = option.getLibraries();
- for (int j = 0; j < allLibs.length; j++) {
- String string = allLibs[j];
- libs.add(command + string);
- }
- } catch (BuildException e) {
- continue;
- }
- }
- }
- }
- }
- libs.trimToSize();
- return (String[])libs.toArray(new String[libs.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getMakeArguments()
- */
- public String getMakeArguments() {
- String arguments = new String();
-
- // The make command may or may not have any flags
- ITarget target = getDefaultTarget();
- String command = target.getMakeCommand();
-
- // If it does, the flags will be everything between the '-' and the next space
- int indexOfArgs = command.indexOf('-');
- if (indexOfArgs != - 1) {
- try {
- String argsAndTargs = command.substring(indexOfArgs);
- int indexOfTargs = argsAndTargs.indexOf(' ');
- arguments = (indexOfTargs != -1) ?
- argsAndTargs.substring(0, indexOfTargs) :
- argsAndTargs;
- // Make sure the arg list does not contain f or C
-
- } catch (IndexOutOfBoundsException e) {
- }
- }
-
- return arguments.trim();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getMakeCommand()
- */
- public String getMakeCommand() {
- String command = new String();
- ITarget target = getDefaultTarget();
- command = target.getMakeCommand();
-
- // There may actually be arguments, so just get everything up to the first '-'
- int indexOfArgs = command.indexOf('-');
- if (indexOfArgs != -1) {
- // Return ecverything up to the first argument as the command
- return command.substring(0, indexOfArgs).trim();
- } else {
- return command.trim();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputExtension(java.lang.String)
- */
- public String getOutputExtension(String resourceExtension) {
- IProject project = (IProject)owner;
- // Get all the tools for the current config
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.getOutputExtension(resourceExtension);
- }
- break;
- case ITool.FILTER_CC:
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.getOutputExtension(resourceExtension);
- }
- break;
- case ITool.FILTER_BOTH:
- return tool.getOutputExtension(resourceExtension);
- }
- } catch (CoreException e) {
- continue;
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputFlag()
- */
- public String getOutputFlag(String outputExt) {
- IProject project = (IProject)owner;
- // Treat null extension as an empty string
- String ext = outputExt == null ? new String() : outputExt;
-
- // Get all the tools for the current config
- String flags = new String();
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (!project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- continue;
- }
- break;
- case ITool.FILTER_CC:
- if (!project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- continue;
- }
- break;
- case ITool.FILTER_BOTH:
- break;
- }
- } catch (CoreException e) {
- continue;
- }
- // It's OK
- if (tool.producesFileType(ext)) {
- flags = tool.getOutputFlag();
- }
- }
- return flags;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputPrefix(java.lang.String)
- */
- public String getOutputPrefix(String outputExtension) {
- IProject project = (IProject)owner;
- // Treat null extensions as empty string
- String ext = outputExtension == null ? new String() : outputExtension;
-
- // Get all the tools for the current config
- String flags = new String();
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (!project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- continue;
- }
- break;
- case ITool.FILTER_CC:
- if (!project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- continue;
- }
- break;
- case ITool.FILTER_BOTH:
- break;
- }
- } catch (CoreException e) {
- continue;
- }
- if (tool.producesFileType(ext)) {
- flags = tool.getOutputPrefix();
- }
- }
- return flags;
- }
-
- public IResource getOwner() {
- return owner;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getTarget(org.eclipse.cdt.core.build.managed.IConfiguration)
- */
- public ITarget getTarget(String id) {
- return (ITarget) targetMap.get(id);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getTargets(org.eclipse.cdt.core.build.managed.IConfiguration)
- */
- public List getTargets() {
- return targets;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolForSource(java.lang.String)
- */
- public String getToolForSource(String extension) {
- IProject project = (IProject)owner;
-
- // Get all the tools for the current config
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- if (tool.buildsFileType(extension)) {
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.getToolCommand();
- }
- break;
- case ITool.FILTER_CC:
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.getToolCommand();
- }
- break;
- case ITool.FILTER_BOTH:
- return tool.getToolCommand();
- }
- } catch (CoreException e) {
- continue;
- }
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolInvocation(java.lang.String)
- */
- public String getToolForTarget(String extension) {
- IProject project = (IProject)owner;
-
- // Treat a null argument as an empty string
- String ext = extension == null ? new String() : extension;
- // Get all the tools for the current config
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- if (tool.producesFileType(ext)) {
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.getToolCommand();
- }
- break;
- case ITool.FILTER_CC:
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.getToolCommand();
- }
- break;
- case ITool.FILTER_BOTH:
- return tool.getToolCommand();
- }
- } catch (CoreException e) {
- continue;
- }
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#getUserObjectsForTarget(java.lang.String)
- */
- public String[] getUserObjectsForTarget(String extension) {
- IProject project = (IProject)owner;
- ArrayList objs = new ArrayList();
- // Get all the tools for the current config
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (!project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- continue;
- }
- break;
- case ITool.FILTER_CC:
- if (!project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- continue;
- }
- break;
- case ITool.FILTER_BOTH:
- break;
- }
- } catch (CoreException e) {
- continue;
- }
- // The tool is OK for this project nature
- if (tool.producesFileType(extension)) {
- IOption[] opts = tool.getOptions();
- // Look for the user object option type
- for (int i = 0; i < opts.length; i++) {
- IOption option = opts[i];
- if (option.getValueType() == IOption.OBJECTS) {
- try {
- objs.addAll(Arrays.asList(option.getUserObjects()));
- } catch (BuildException e) {
- continue;
- }
- }
- }
- }
- }
- objs.trimToSize();
- return (String[])objs.toArray(new String[objs.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#isDirty()
- */
- public boolean isDirty() {
- return isDirty;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#isHeaderFile(java.lang.String)
- */
- public boolean isHeaderFile(String ext) {
- IProject project = (IProject)owner;
-
- // Check to see if there is a rule to build a file with this extension
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.isHeaderFile(ext);
- }
- break;
- case ITool.FILTER_CC:
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.isHeaderFile(ext);
- }
- break;
- case ITool.FILTER_BOTH:
- return tool.isHeaderFile(ext);
- }
- } catch (CoreException e) {
- continue;
- }
- }
- return false;
- }
-
- /**
- * Write the contents of the build model to the persistent store specified in the
- * argument.
- *
- * @param doc
- * @param element
- */
- public void serialize(Document doc, Element element) {
- // Write out each target and their default config
- for (int i = 0; i < targets.size(); ++i) {
- Element targetElement = doc.createElement("target");
- element.appendChild(targetElement);
- ((Target)targets.get(i)).serialize(doc, targetElement);
- IConfiguration config = getDefaultConfiguration((ITarget)targets.get(i));
- if (config != null) {
- Element configEl = doc.createElement("defaultConfig");
- element.appendChild(configEl);
- configEl.setAttribute("id", config.getId());
- }
- }
- // Persist the default target
- if (getDefaultTarget() != null){
- Element targEl = doc.createElement("defaultTarget");
- element.appendChild(targEl);
- targEl.setAttribute("id", getDefaultTarget().getId());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
- */
- public void setDefaultConfiguration(IConfiguration configuration) {
- // Get the target associated with the argument
- ITarget target = configuration.getTarget();
- // Make sure it is the default
- setDefaultTarget(target);
- defaultConfigurations.put(target.getId(), configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultTarget(org.eclipse.cdt.core.build.managed.ITarget)
- */
- public void setDefaultTarget(ITarget target) {
- if (defaultTarget != null && defaultTarget.getId().equals(target.getId())) {
- return;
- }
- defaultTarget = target;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#setDirty(boolean)
- */
- public void setDirty(boolean isDirty) {
- this.isDirty = isDirty;
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
deleted file mode 100644
index adb5019b83c..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.cdt.managedbuilder.internal.core;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-public class Option extends BuildObject implements IOption {
- // Static default return values
- private static final String EMPTY_STRING = new String();
- private static final String[] EMPTY_STRING_ARRAY = new String[0];
-
- // Private bookeeping attributes
- private List builtIns;
- private IOptionCategory category;
- private String command;
- private String defaultEnumName;
- private Map enumCommands;
- private ITool tool;
- private Object value;
- private int valueType;
-
-
- public Option(ITool tool) {
- this.tool = tool;
- }
-
- public Option(Tool tool, IConfigurationElement element) {
- this(tool);
-
- // Get the unique id of the option
- setId(element.getAttribute(ID));
-
- // Hook me up to a tool
- tool.addOption(this);
-
- // Get the option Name (this is what the user will see in the UI)
- setName(element.getAttribute(NAME));
-
- // Options can be grouped into categories
- String categoryId = element.getAttribute(CATEGORY);
- if (categoryId != null)
- setCategory(tool.getOptionCategory(categoryId));
-
- // Get the command defined for the option
- command = element.getAttribute(COMMAND);
-
- // Options hold different types of values
- String valueTypeStr = element.getAttribute(VALUE_TYPE);
- if (valueTypeStr == null)
- valueType = -1;
- else if (valueTypeStr.equals(TYPE_STRING))
- valueType = STRING;
- else if (valueTypeStr.equals(TYPE_STR_LIST))
- valueType = STRING_LIST;
- else if (valueTypeStr.equals(TYPE_BOOL))
- valueType = BOOLEAN;
- else if (valueTypeStr.equals(TYPE_ENUM))
- valueType = ENUMERATED;
- else if (valueTypeStr.equals(TYPE_INC_PATH))
- valueType = INCLUDE_PATH;
- else if (valueTypeStr.equals(TYPE_LIB))
- valueType = LIBRARIES;
- else if (valueTypeStr.equals(TYPE_USER_OBJS))
- valueType = OBJECTS;
- else
- valueType = PREPROCESSOR_SYMBOLS;
-
- // Now get the actual value
- enumCommands = new HashMap();
- switch (valueType) {
- case BOOLEAN:
- // Convert the string to a boolean
- value = new Boolean(element.getAttribute(DEFAULT_VALUE));
- break;
- case STRING:
- // Just get the value out of the option directly
- value = element.getAttribute(DEFAULT_VALUE);
- break;
- case ENUMERATED:
- List enumList = new ArrayList();
- IConfigurationElement[] enumElements = element.getChildren(ENUM_VALUE);
- for (int i = 0; i < enumElements.length; ++i) {
- String optName = enumElements[i].getAttribute(NAME);
- String optCommand = enumElements[i].getAttribute(COMMAND);
- enumList.add(optName);
- enumCommands.put(optName, optCommand);
- Boolean isDefault = new Boolean(enumElements[i].getAttribute(IS_DEFAULT));
- if (isDefault.booleanValue()) {
- defaultEnumName = optName;
- }
- }
- value = enumList;
- break;
- case STRING_LIST:
- case INCLUDE_PATH:
- case PREPROCESSOR_SYMBOLS:
- case LIBRARIES:
- case OBJECTS:
- List valueList = new ArrayList();
- builtIns = new ArrayList();
- IConfigurationElement[] valueElements = element.getChildren(LIST_VALUE);
- for (int i = 0; i < valueElements.length; ++i) {
- IConfigurationElement valueElement = valueElements[i];
- Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN));
- if (isBuiltIn.booleanValue()) {
- builtIns.add(valueElement.getAttribute(LIST_ITEM_VALUE));
- }
- else {
- valueList.add(valueElement.getAttribute(LIST_ITEM_VALUE));
- }
- }
- value = valueList;
- break;
- default :
- break;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getApplicableValues()
- */
- public String[] getApplicableValues() {
- List enumValues = (List)value;
- return enumValues != null
- ? (String[])enumValues.toArray(new String[enumValues.size()])
- : EMPTY_STRING_ARRAY;
- }
-
- public boolean getBooleanValue() {
- Boolean bool = (Boolean) value;
- return bool.booleanValue();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getBuiltIns()
- */
- public String[] getBuiltIns() {
- // Return the list of built-ins as an array
- return builtIns == null ?
- EMPTY_STRING_ARRAY:
- (String[])builtIns.toArray(new String[builtIns.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getCategory()
- */
- public IOptionCategory getCategory() {
- return category != null ? category : getTool().getTopOptionCategory();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getCommand()
- */
- public String getCommand() {
- return command;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getDefinedSymbols()
- */
- public String[] getDefinedSymbols() throws BuildException {
- if (valueType != PREPROCESSOR_SYMBOLS) {
- throw new BuildException("bad value type");
- }
- ArrayList v = (ArrayList)value;
- if (v == null) {
- return EMPTY_STRING_ARRAY;
- } else {
- v.trimToSize();
- return (String[]) v.toArray(new String[v.size()]);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
- */
- public String getEnumCommand(String name) {
- String cmd = (String) enumCommands.get(name);
- return cmd == null ? EMPTY_STRING : cmd;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getIncludePaths()
- */
- public String[] getIncludePaths() throws BuildException {
- if (valueType != INCLUDE_PATH) {
- throw new BuildException("bad value type");
- }
- ArrayList v = (ArrayList)value;
- if (v == null) {
- return EMPTY_STRING_ARRAY;
- } else {
- v.trimToSize();
- return (String[]) v.toArray(new String[v.size()]);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getLibraries()
- */
- public String[] getLibraries() throws BuildException {
- if (valueType != LIBRARIES) {
- throw new BuildException("bad value type");
- }
- ArrayList v = (ArrayList)value;
- if (v == null) {
- return EMPTY_STRING_ARRAY;
- } else {
- v.trimToSize();
- return (String[]) v.toArray(new String[v.size()]);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
- */
- public String getSelectedEnum() throws BuildException {
- if (valueType != ENUMERATED) {
- throw new BuildException("bad value type");
- }
- return defaultEnumName == null ? EMPTY_STRING : defaultEnumName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue()
- */
- public String[] getStringListValue() throws BuildException {
- if (valueType != STRING_LIST) {
- throw new BuildException("bad value type");
- }
- ArrayList v = (ArrayList)value;
- if (v == null) {
- return EMPTY_STRING_ARRAY;
- } else {
- v.trimToSize();
- return (String[]) v.toArray(new String[v.size()]);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getStringValue()
- */
- public String getStringValue() throws BuildException {
- if (valueType != STRING) {
- throw new BuildException("bad value type");
- }
- return value == null ? EMPTY_STRING : (String)value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getTool()
- */
- public ITool getTool() {
- return tool;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IOption#getUserObjects()
- */
- public String[] getUserObjects() throws BuildException {
- if (valueType != OBJECTS) {
- throw new BuildException("bad value type");
- }
- // This is the right puppy, so return its list value
- ArrayList v = (ArrayList)value;
- if (v == null) {
- return EMPTY_STRING_ARRAY;
- } else {
- v.trimToSize();
- return (String[]) v.toArray(new String[v.size()]);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getValueType()
- */
- public int getValueType() {
- return valueType;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#setCategory(org.eclipse.cdt.core.build.managed.IOptionCategory)
- */
- public void setCategory(IOptionCategory category) {
- this.category = category;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#setStringValue(org.eclipse.cdt.core.build.managed.IConfiguration, java.lang.String)
- */
- public IOption setValue(IConfiguration config, String value)
- throws BuildException
- {
- if (valueType != IOption.STRING
- || valueType != ENUMERATED)
- throw new BuildException("Bad value for type");
-
- if (config == null) {
- this.value = value;
- return this;
- } else {
- // Magic time
- return null;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#setStringValue(org.eclipse.cdt.core.build.managed.IConfiguration, java.lang.String[])
- */
- public IOption setValue(IConfiguration config, String[] value)
- throws BuildException
- {
- if (valueType != STRING_LIST
- || valueType != INCLUDE_PATH
- || valueType != PREPROCESSOR_SYMBOLS
- || valueType != LIBRARIES
- || valueType != OBJECTS)
- throw new BuildException("Bad value for type");
-
- if (config == null) {
- this.value = value;
- return this;
- } else {
- // More magic
- return null;
- }
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java
deleted file mode 100644
index 11ad290022b..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.cdt.managedbuilder.internal.core;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-/**
- *
- */
-public class OptionCategory extends BuildObject implements IOptionCategory {
-
- private IOptionCategory owner;
- private List children;
-
- private static final IOptionCategory[] emtpyCategories = new IOptionCategory[0];
-
- public OptionCategory(IOptionCategory owner) {
- this.owner = owner;
- }
-
- public OptionCategory(Tool tool, IConfigurationElement element) {
- String parentId = element.getAttribute(IOptionCategory.PARENT);
- if (parentId != null)
- owner = tool.getOptionCategory(element.getAttribute(IOptionCategory.PARENT));
- else
- owner = tool;
-
- // id
- setId(element.getAttribute(IOptionCategory.ID));
-
- // Name
- setName(element.getAttribute(IOptionCategory.NAME));
-
- // Hook me in
- if (owner instanceof Tool)
- ((Tool)owner).addChildCategory(this);
- else
- ((OptionCategory)owner).addChildCategory(this);
-
- tool.addOptionCategory(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getChildCategories()
- */
- public IOptionCategory[] getChildCategories() {
- if (children != null)
- return (IOptionCategory[])children.toArray(new IOptionCategory[children.size()]);
- else
- return emtpyCategories;
- }
-
- public void addChildCategory(OptionCategory category) {
- if (children == null)
- children = new ArrayList();
- children.add(category);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOwner()
- */
- public IOptionCategory getOwner() {
- return owner;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getTool()
- */
- public ITool getTool() {
- // This will stop at the Tool's top category
- return owner.getTool();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptions(org.eclipse.cdt.core.build.managed.ITool)
- */
- public IOption[] getOptions(IConfiguration configuration) {
- ITool tool = getTool();
- if (configuration != null) {
- // TODO don't like this much
- ITool[] tools = configuration.getTools();
- for (int i = 0; i < tools.length; ++i) {
- if (tools[i] instanceof ToolReference) {
- if (((ToolReference)tools[i]).references(tool)) {
- tool = tools[i];
- break;
- }
- } else if (tools[i].equals(tool))
- break;
- }
- }
-
- IOption[] allOptions = tool.getOptions();
- List myOptions = new ArrayList();
-
- for (int i = 0; i < allOptions.length; ++i) {
- IOption option = allOptions[i];
- if (option.getCategory().equals(this))
- myOptions.add(option);
- }
-
- return (IOption[])myOptions.toArray(new IOption[myOptions.size()]);
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
deleted file mode 100644
index b1bd81e8820..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.cdt.managedbuilder.internal.core;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- *
- */
-public class OptionReference implements IOption {
-
- // List of built-in values a tool defines
- private List builtIns;
- // Used for all option references that override the command
- private String command;
- // The option this reference overrides
- private IOption option;
- // The owner of the reference
- private ToolReference owner;
- // The actual value of the reference
- private Object value;
-
- /**
- * Constructor called when the option reference is created from an
- * existing IOption
- *
- * @param owner
- * @param option
- */
- public OptionReference(ToolReference owner, IOption option) {
- this.owner = owner;
- this.option = option;
-
- // Until the option reference is changed, all values will be extracted from original option
- owner.addOptionReference(this);
- }
-
- /**
- * This constructor will be called when the receiver is created from
- * the settings found in an extension point.
- *
- * @param owner
- * @param element
- */
- public OptionReference(ToolReference owner, IConfigurationElement element) {
- this.owner = owner;
- option = owner.getTool().getOption(element.getAttribute(ID));
-
- owner.addOptionReference(this);
-
- // value
- switch (option.getValueType()) {
- case BOOLEAN:
- value = new Boolean(element.getAttribute(DEFAULT_VALUE));
- break;
- case STRING:
- value = element.getAttribute(DEFAULT_VALUE);
- break;
- case ENUMERATED:
- String temp = element.getAttribute(DEFAULT_VALUE);
- if (temp == null) {
- try {
- temp = option.getSelectedEnum();
- } catch (BuildException e) {
- temp = new String();
- }
- }
- value = temp;
- break;
- case STRING_LIST:
- case INCLUDE_PATH:
- case PREPROCESSOR_SYMBOLS:
- case LIBRARIES:
- case OBJECTS:
- List valueList = new ArrayList();
- builtIns = new ArrayList();
- IConfigurationElement[] valueElements = element.getChildren(LIST_VALUE);
- for (int i = 0; i < valueElements.length; ++i) {
- IConfigurationElement valueElement = valueElements[i];
- Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN));
- if (isBuiltIn.booleanValue()) {
- builtIns.add(valueElement.getAttribute(LIST_ITEM_VALUE));
- }
- else {
- valueList.add(valueElement.getAttribute(LIST_ITEM_VALUE));
- } }
- value = valueList;
- break;
- }
- }
-
- /**
- * Created from project file.
- *
- * @param owner
- * @param element
- */
- public OptionReference(ToolReference owner, Element element) {
- this.owner = owner;
- option = owner.getTool().getOption(element.getAttribute(ID));
-
- // Bail now if there's no option for the reference
- if (option == null) {
- return;
- }
-
- // Hook the reference up
- owner.addOptionReference(this);
-
- // value
- switch (option.getValueType()) {
- case BOOLEAN:
- value = new Boolean(element.getAttribute(DEFAULT_VALUE));
- break;
- case STRING:
- case ENUMERATED:
- value = (String) element.getAttribute(DEFAULT_VALUE);
- break;
- case STRING_LIST:
- case INCLUDE_PATH:
- case PREPROCESSOR_SYMBOLS:
- case LIBRARIES:
- case OBJECTS:
- List valueList = new ArrayList();
- builtIns = new ArrayList();
- NodeList nodes = element.getElementsByTagName(LIST_VALUE);
- for (int i = 0; i < nodes.getLength(); ++i) {
- Node node = nodes.item(i);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Boolean isBuiltIn = new Boolean(((Element)node).getAttribute(LIST_ITEM_BUILTIN));
- if (isBuiltIn.booleanValue()) {
- builtIns.add(((Element)node).getAttribute(LIST_ITEM_VALUE));
- } else {
- valueList.add(((Element)node).getAttribute(LIST_ITEM_VALUE));
- }
- }
- }
- value = valueList;
- break;
- }
-
- }
-
- /**
- * Persist receiver to project file.
- *
- * @param doc
- * @param element
- */
- public void serialize(Document doc, Element element) {
- element.setAttribute(ID, option.getId());
-
- // value
- switch (option.getValueType()) {
- case BOOLEAN:
- element.setAttribute(DEFAULT_VALUE, ((Boolean)value).toString());
- break;
- case STRING:
- case ENUMERATED:
- element.setAttribute(DEFAULT_VALUE, (String)value);
- break;
- case STRING_LIST:
- case INCLUDE_PATH:
- case PREPROCESSOR_SYMBOLS:
- case LIBRARIES:
- case OBJECTS:
- ArrayList stringList = (ArrayList)value;
- ListIterator iter = stringList.listIterator();
- while (iter.hasNext()) {
- Element valueElement = doc.createElement(LIST_VALUE);
- valueElement.setAttribute(LIST_ITEM_VALUE, (String)iter.next());
- valueElement.setAttribute(LIST_ITEM_BUILTIN, "false");
- element.appendChild(valueElement);
- }
- // Serialize the built-ins that have been overridden
- if (builtIns != null) {
- iter = builtIns.listIterator();
- while (iter.hasNext()) {
- Element valueElement = doc.createElement(LIST_VALUE);
- valueElement.setAttribute(LIST_ITEM_VALUE, (String)iter.next());
- valueElement.setAttribute(LIST_ITEM_BUILTIN, "true");
- element.appendChild(valueElement);
- }
- }
- break;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getApplicableValues()
- */
- public String[] getApplicableValues() {
- return option.getApplicableValues();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getCategory()
- */
- public IOptionCategory getCategory() {
- return option.getCategory();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getCommand()
- */
- public String getCommand() {
- return option.getCommand();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getDefinedSymbols()
- */
- public String[] getDefinedSymbols() throws BuildException {
- if (value == null)
- return option.getDefinedSymbols();
- else if (getValueType() == PREPROCESSOR_SYMBOLS) {
- ArrayList list = (ArrayList)value;
- return (String[]) list.toArray(new String[list.size()]);
- }
- else
- throw new BuildException("bad value type");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
- */
- public String getEnumCommand(String name) {
- return option.getEnumCommand(name);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
- */
- public String getId() {
- // A reference has the same id as the option it references
- return option.getId();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getIncludePaths()
- */
- public String[] getIncludePaths() throws BuildException {
- if (value == null)
- return option.getIncludePaths();
- else if (getValueType() == INCLUDE_PATH) {
- ArrayList list = (ArrayList)value;
- return (String[]) list.toArray(new String[list.size()]);
- }
- else
- throw new BuildException("bad value type");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getLibraries()
- */
- public String[] getLibraries() throws BuildException {
- if (value == null)
- return option.getLibraries();
- else if (getValueType() == LIBRARIES) {
- ArrayList list = (ArrayList)value;
- return (String[]) list.toArray(new String[list.size()]);
- }
- else
- throw new BuildException("bad value type");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
- */
- public String getName() {
- // A reference has the same name as the option it references
- return option.getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getBooleanValue()
- */
- public boolean getBooleanValue() throws BuildException {
- if (value == null){
- return option.getBooleanValue();
- }
- else if (getValueType() == BOOLEAN) {
- Boolean bool = (Boolean) value;
- return bool.booleanValue();
- } else {
- throw new BuildException("bad value type");
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getBuiltIns()
- */
- public String[] getBuiltIns() {
- // Return any overridden built-ins here, or the default set
- // from the option this is a reference to
- return builtIns == null ?
- option.getBuiltIns():
- (String[])builtIns.toArray(new String[builtIns.size()]);
- }
-
- public IOption getOption() {
- return option;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
- */
- public String getSelectedEnum() throws BuildException {
- if (value == null) {
- // Return the default defined for the enumeration in the manifest.
- return option.getSelectedEnum();
- } else if (getValueType() == ENUMERATED) {
- // Value will contain the human-readable name of the enum
- return (String) value;
- } else {
- throw new BuildException("bad value type");
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue()
- */
- public String[] getStringListValue() throws BuildException {
- if (value == null)
- return option.getStringListValue();
- else if (getValueType() == STRING_LIST) {
- ArrayList list = (ArrayList)value;
- return (String[]) list.toArray(new String[list.size()]);
- }
- else
- throw new BuildException("bad value type");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getStringValue()
- */
- public String getStringValue() throws BuildException {
- if (value == null)
- return option.getStringValue();
- else if (getValueType() == STRING)
- return (String)value;
- else
- throw new BuildException("bad value type");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getTool()
- */
- public ITool getTool() {
- return owner;
- }
-
- /**
- * Answers the tool reference that contains the receiver.
- *
- * @return ToolReference
- */
- public ToolReference getToolReference() {
- return owner;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IOption#getUserObjects()
- */
- public String[] getUserObjects() throws BuildException {
- if (value == null)
- return option.getDefinedSymbols();
- else if (getValueType() == OBJECTS) {
- ArrayList list = (ArrayList)value;
- return (String[]) list.toArray(new String[list.size()]);
- }
- else
- throw new BuildException("bad value type");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getValueType()
- */
- public int getValueType() {
- return option.getValueType();
- }
-
- /**
- * Answers true
if the receiver is a reference to the
- * IOption
specified in the argument, esle answers false
.
- *
- * @param target
- * @return boolean
- */
- public boolean references(IOption target) {
- if (equals(target)) {
- // we are the target
- return true;
- } else if (option instanceof OptionReference) {
- // check the reference we are overriding
- return ((OptionReference)option).references(target);
- } else {
- // the real reference
- return option.equals(target);
- }
- }
-
- /**
- * Sets the boolean value of the receiver to the value specified in the argument.
- * If the receive is not a reference to a boolean option, method will throw an
- * exception.
- *
- * @param value
- * @throws BuildException
- */
- public void setValue(boolean value) throws BuildException {
- if (getValueType() == BOOLEAN)
- this.value = new Boolean(value);
- else
- throw new BuildException("bad value type");
- }
-
- /**
- * @param value
- * @throws BuildException
- */
- public void setValue(String value) throws BuildException {
- if (getValueType() == STRING || getValueType() == ENUMERATED)
- this.value = value;
- else
- throw new BuildException("bad value type");
- }
-
- /**
- * Sets the value of the receiver to be an array of items.
- *
- * @param value An array of strings to place in the option reference.
- * @throws BuildException
- */
- public void setValue(String [] value) throws BuildException {
- if (getValueType() == STRING_LIST
- || getValueType() == INCLUDE_PATH
- || getValueType() == PREPROCESSOR_SYMBOLS
- || getValueType() == LIBRARIES
- || getValueType() == OBJECTS) {
- // Just replace what the option reference is holding onto
- this.value = new ArrayList(Arrays.asList(value));
- }
- else
- throw new BuildException("bad value type");
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
deleted file mode 100644
index 0558db5c999..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-##########################################################################
-# Copyright (c) 2002,2003 Rational Software Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v0.5
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v05.html
-#
-# Contributors:
-# IBM Rational Software - Initial API and implementation
-##########################################################################
-
-# Generated makefile builder messages
-ManagedMakeBuilder.message.starting = Starting the build for project {0}
-ManagedMakeBuilder.message.rebuild = Regenerating makefiles for project {0}
-ManagedMakeBuilder.message.incremental = Updating makefiles for project {0}
-ManagedMakeBuilder.message.updating = Updating project files...
-ManagedMakeBuilder.message.make = Calling {0} for project {1}
-ManagedMakeBuilder.message.creating.markers = Generating markers...
-ManagedMakeBuilder.message.error = Build error
-ManagedMakeBuilder.message.error.refresh = Error refreshing project.
-ManagedMakeBuilder.message.finished = Build complete for project {0}
-ManagedMakeBuilder.comment.module.list = # Every subdirectory with source files must be described here
-ManagedMakeBuilder.comment.source.list = # Each subdirectory must contribute its source files here
-ManagedMakeBuilder.comment.build.rule = # Each subdirectory must supply rules for building sources it contributes
-ManagedMakeBuilder.comment.module.make.includes = # Include the makefiles for each source subdirectory
-ManagedMakeBuilder.comment.module.dep.includes = # Include automatically-generated dependency list:
-ManagedMakeBuilder.comment.autodeps = # Automatically-generated dependency list:
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
deleted file mode 100644
index 4ad06f66327..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
+++ /dev/null
@@ -1,526 +0,0 @@
-package org.eclipse.cdt.managedbuilder.internal.core;
-
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.StringTokenizer;
-
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class Target extends BuildObject implements ITarget {
-
- // Build model elements that come from the plugin or project files
- private String artifactName;
- private String binaryParserId;
- private String cleanCommand;
- private Map configMap;
- private List configurations;
- private String defaultExtension;
- private boolean isAbstract = false;
- private boolean isTest = false;
- private String makeCommand;
- private IResource owner;
- private ITarget parent;
- private List targetOSList;
- private Map toolMap;
- private List toolList;
-
- private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
- private static final String EMPTY_STRING = new String();
-
- public Target(IResource owner) {
- this.owner = owner;
- }
-
- /**
- * Create a target owned by a resource based on a parent target
- *
- * @param owner
- * @param parent
- */
- public Target(IResource owner, ITarget parent) {
- // Make the owner of the target the project resource
- this(owner);
-
- // Copy the parent's identity
- this.parent = parent;
- Random r = new Random();
- r.setSeed(System.currentTimeMillis());
- int id = r.nextInt();
- if (id < 0) {
- id *= -1;
- }
- setId(owner.getName() + "." + parent.getId() + "." + id);
- setName(parent.getName());
- this.artifactName = parent.getArtifactName();
- this.binaryParserId = parent.getBinaryParserId();
- this.defaultExtension = parent.getDefaultExtension();
- this.isTest = parent.isTestTarget();
- this.cleanCommand = parent.getCleanCommand();
-
- // Hook me up
- IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(owner, true);
- buildInfo.addTarget(this);
- }
-
- /**
- * This constructor is called to create a target defined by an extension point in
- * a plugin manifest file.
- *
- * @param element
- */
- public Target(IConfigurationElement element) {
- // id
- setId(element.getAttribute(ID));
-
- // hook me up
- ManagedBuildManager.addExtensionTarget(this);
-
- // Get the target name
- setName(element.getAttribute(NAME));
-
- // Get the name of the build artifact associated with target (usually
- // in the plugin specification).
- artifactName = element.getAttribute(ARTIFACT_NAME);
-
- // Get the ID of the binary parser
- binaryParserId = element.getAttribute(BINARY_PARSER);
-
- // Get the default extension
- defaultExtension = element.getAttribute(DEFAULT_EXTENSION);
-
- // parent
- String parentId = element.getAttribute(PARENT);
- if (parentId != null) {
- parent = ManagedBuildManager.getTarget(null, parentId);
- // copy over the parents configs
- IConfiguration[] parentConfigs = parent.getConfigurations();
- for (int i = 0; i < parentConfigs.length; ++i)
- addConfiguration(parentConfigs[i]);
- }
-
- // isAbstract
- isAbstract = ("true".equals(element.getAttribute(IS_ABSTRACT)));
-
- // Is this a test target
- isTest = ("true".equals(element.getAttribute(IS_TEST)));
-
- // Get the clean command
- cleanCommand = element.getAttribute(CLEAN_COMMAND);
- if (cleanCommand == null) {
- // See if it defined in the parent
- cleanCommand = parent.getCleanCommand();
- }
-
- // Get the make command
- makeCommand = element.getAttribute(MAKE_COMMAND);
- if (makeCommand == null) {
- // See if it defined in the parent
- makeCommand = parent.getMakeCommand();
- }
-
- // Get the comma-separated list of valid OS
- String os = element.getAttribute(OS_LIST);
- if (os != null) {
- targetOSList = new ArrayList();
- StringTokenizer tokens = new StringTokenizer(os, ",");
- while (tokens.hasMoreTokens()) {
- targetOSList.add(tokens.nextToken().trim());
- }
- }
-
- IConfigurationElement[] targetElements = element.getChildren();
- int k;
- // Load the tools first
- for (k = 0; k < targetElements.length; ++k) {
- IConfigurationElement targetElement = targetElements[k];
- if (targetElement.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
- new Tool(this, targetElement);
- }
- }
- // Then load the configurations which may have tool references
- for (k = 0; k < targetElements.length; ++k) {
- IConfigurationElement targetElement = targetElements[k];
- if (targetElement.getName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
- new Configuration(this, targetElement);
- }
- }
-
- }
-
- /**
- * Create target from project file.
- *
- * @param buildInfo
- * @param element
- */
- public Target(ManagedBuildInfo buildInfo, Element element) {
- this(buildInfo.getOwner());
-
- // id
- setId(element.getAttribute(ID));
-
- // hook me up
- buildInfo.addTarget(this);
-
- // name
- setName(element.getAttribute(NAME));
-
- // Get the name of the build artifact associated with target (should
- // contain what the user entered in the UI).
- artifactName = element.getAttribute(ARTIFACT_NAME);
-
- // Get the default extension
- defaultExtension = element.getAttribute(DEFAULT_EXTENSION);
-
- // parent
- String parentId = element.getAttribute(PARENT);
- if (parentId != null)
- parent = ManagedBuildManager.getTarget(null, parentId);
-
- // isAbstract
- if ("true".equals(element.getAttribute(IS_ABSTRACT)))
- isAbstract = true;
-
- // Is this a test target
- isTest = ("true".equals(element.getAttribute(IS_TEST)));
-
- // Get the clean command
- cleanCommand = element.getAttribute(CLEAN_COMMAND);
-
- // Get the make command
- if (element.hasAttribute(MAKE_COMMAND)) {
- makeCommand = element.getAttribute(MAKE_COMMAND);
- }
-
- Node child = element.getFirstChild();
- while (child != null) {
- if (child.getNodeName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
- new Configuration(this, (Element)child);
- }
- child = child.getNextSibling();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITarget#removeConfiguration(java.lang.String)
- */
- public void removeConfiguration(String id) {
- // Remove the specified configuration from the list and map
- Iterator iter = configurations.listIterator();
- while (iter.hasNext()) {
- IConfiguration config = (IConfiguration)iter.next();
- if (config.getId().equals(id)) {
- configurations.remove(config);
- configMap.remove(id);
- break;
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITarget#resetMakeCommand()
- */
- public void resetMakeCommand() {
- makeCommand = null;
- }
-
- /**
- * Persist receiver to project file.
- *
- * @param doc
- * @param element
- */
- public void serialize(Document doc, Element element) {
- element.setAttribute(ID, getId());
- element.setAttribute(NAME, getName());
- if (parent != null)
- element.setAttribute(PARENT, parent.getId());
- element.setAttribute(IS_ABSTRACT, isAbstract ? "true" : "false");
- element.setAttribute(ARTIFACT_NAME, getArtifactName());
- element.setAttribute(DEFAULT_EXTENSION, getDefaultExtension());
- element.setAttribute(IS_TEST, isTest ? "true" : "false");
- element.setAttribute(CLEAN_COMMAND, getCleanCommand());
- if (makeCommand != null) {
- element.setAttribute(MAKE_COMMAND, makeCommand);
- }
-
- if (configurations != null)
- for (int i = 0; i < configurations.size(); ++i) {
- Configuration config = (Configuration)configurations.get(i);
- Element configElement = doc.createElement(IConfiguration.CONFIGURATION_ELEMENT_NAME);
- element.appendChild(configElement);
- config.serialize(doc, configElement);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITarget#getMakeCommand()
- */
- public String getMakeCommand() {
- // Return the name of the make utility
- return (makeCommand == null) ? parent.getMakeCommand() : makeCommand;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getName()
- */
- public String getName() {
- return (name == null && parent != null) ? parent.getName() : name;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITarget#getParent()
- */
- public ITarget getParent() {
- return parent;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITarget#getTargetOSList()
- */
- public String[] getTargetOSList() {
- if (targetOSList == null) {
- // Ask parent for its list
- if (parent != null) {
- return parent.getTargetOSList();
- } else {
- // I have no parent and no defined list but never return null
- return new String[0];
- }
- }
- return (String[]) targetOSList.toArray(new String[targetOSList.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITarget#getOwner()
- */
- public IResource getOwner() {
- return owner;
- }
-
- private int getNumTools() {
- int n = getToolList().size();
- if (parent != null)
- n += ((Target)parent).getNumTools();
- return n;
- }
-
-
- private int addToolsToArray(ITool[] toolArray, int start) {
- int n = start;
- if (parent != null)
- n = ((Target)parent).addToolsToArray(toolArray, start);
-
- for (int i = 0; i < getToolList().size(); ++i) {
- toolArray[n++] = (ITool)getToolList().get(i);
- }
-
- return n;
- }
-
- private List getToolList() {
- if (toolList == null) {
- toolList = new ArrayList();
- toolList.clear();
- }
- return toolList;
- }
-
- private Map getToolMap() {
- if (toolMap == null) {
- toolMap = new HashMap();
- toolMap.clear();
- }
- return toolMap;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITarget#getTools()
- */
- public ITool[] getTools() {
- ITool[] toolArray = new ITool[getNumTools()];
- addToolsToArray(toolArray, 0);
- return toolArray;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITarget#hasMakeCommandOverride()
- */
- public boolean hasOverridenMakeCommand() {
- return (makeCommand != null && !makeCommand.equals(parent.getMakeCommand()));
- }
-
- /**
- * @param id
- * @return ITool
- */
- public ITool getTool(String id) {
- ITool result = null;
-
- // See if receiver has it in list
- result = (ITool) getToolMap().get(id);
-
- // If not, check if parent has it
- if (result == null && parent != null) {
- result = ((Target)parent).getTool(id);
- }
-
- return result;
- }
-
- /**
- * @param tool
- */
- public void addTool(ITool tool) {
- getToolList().add(tool);
- getToolMap().put(tool.getId(), tool);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITarget#getConfigurations()
- */
- public IConfiguration[] getConfigurations() {
- if (configurations != null)
- return (IConfiguration[])configurations.toArray(new IConfiguration[configurations.size()]);
- else
- return emptyConfigs;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITarget#getDefaultExtension()
- */
- public String getDefaultExtension() {
- return defaultExtension == null ? EMPTY_STRING : defaultExtension;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITarget#getCleanCommand()
- */
- public String getCleanCommand() {
- // Return the command used to remove files
- return cleanCommand == null ? EMPTY_STRING : cleanCommand;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITarget#getArtifactName()
- */
- public String getArtifactName() {
- if (artifactName == null) {
- // If I have a parent, ask it
- if (parent != null) {
- return parent.getArtifactName();
- } else {
- // I'm it and this is not good!
- return EMPTY_STRING;
- }
- } else {
- return artifactName;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITarget#getBinaryParserId()
- */
- public String getBinaryParserId() {
- if (binaryParserId == null) {
- // If I have a parent, ask it
- if (parent != null) {
- return parent.getBinaryParserId();
- } else {
- // I'm it and this is not good!
- return EMPTY_STRING;
- }
- }
- return binaryParserId;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITarget#getConfiguration()
- */
- public IConfiguration getConfiguration(String id) {
- return (IConfiguration)configMap.get(id);
- }
-
- /**
- * @param configuration
- */
- public void addConfiguration(IConfiguration configuration) {
- if (configurations == null) {
- configurations = new ArrayList();
- configMap = new HashMap();
- }
- configurations.add(configuration);
- configMap.put(configuration.getId(), configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITarget#isAbstract()
- */
- public boolean isAbstract() {
- return isAbstract;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITarget#isTestTarget()
- */
- public boolean isTestTarget() {
- return isTest;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITarget#createConfiguration()
- */
- public IConfiguration createConfiguration(String id) {
- return new Configuration(this, id);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITarget#createConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
- */
- public IConfiguration createConfiguration(IConfiguration parent, String id) {
- return new Configuration(this, parent, id);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITarget#setBuildArtifact(java.lang.String)
- */
- public void setBuildArtifact(String name) {
- if (name != null) {
- artifactName = name;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITarget#setMakeCommand(java.lang.String)
- */
- public void setMakeCommand(String command) {
- if (command != null && !getMakeCommand().equals(command)) {
- makeCommand = command;
- }
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
deleted file mode 100644
index 828eea82bf1..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
+++ /dev/null
@@ -1,411 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.cdt.managedbuilder.internal.core;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-/**
- * Represents a tool that can be invoked during a build.
- * Note that this class implements IOptionCategory to represent the top
- * category.
- */
-public class Tool extends BuildObject implements ITool, IOptionCategory {
-
- private static final String DEFAULT_SEPARATOR = ",";
- private static final IOptionCategory[] EMPTY_CATEGORIES = new IOptionCategory[0];
- private static final IOption[] EMPTY_OPTIONS = new IOption[0];
-
- private Map categoryMap;
- private List childOptionCategories;
- private String command;
- private List inputExtensions;
- private List interfaceExtensions;
- private int natureFilter;
- private Map optionMap;
- private List options;
- private String outputExtension;
- private String outputFlag;
- private String outputPrefix;
- private ITarget target;
-
- public Tool(Target target) {
- this.target = target;
- }
-
- /**
- * Constructor to create a new tool in the build model based on the information
- * defined in the plugin.xml manifest.
- *
- * @param target The target the receiver will belong to.
- * @param element The element containing the information.
- */
- public Tool(Target target, IConfigurationElement element) {
- this(target);
-
- // id
- setId(element.getAttribute(ITool.ID));
-
- // hook me up
- target.addTool(this);
-
- // name
- setName(element.getAttribute(ITool.NAME));
-
- // Get the nature filter
- String nature = element.getAttribute(NATURE);
- if (nature == null || "both".equals(nature)) {
- natureFilter = FILTER_BOTH;
- } else if ("cnature".equals(nature)) {
- natureFilter = FILTER_C;
- } else if ("ccnature".equals(nature)) {
- natureFilter = FILTER_CC;
- } else {
- natureFilter = FILTER_BOTH;
- }
-
- // Get the supported input file extension
- String inputs = element.getAttribute(ITool.SOURCES) == null ?
- new String() :
- element.getAttribute(ITool.SOURCES);
- StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
- while (tokenizer.hasMoreElements()) {
- getInputExtensions().add(tokenizer.nextElement());
- }
-
- // Get the interface (header file) extensions
- String headers = element.getAttribute(INTERFACE_EXTS);
- if (headers == null) {
- headers = new String();
- }
- tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR);
- while (tokenizer.hasMoreElements()) {
- getInterfaceExtensions().add(tokenizer.nextElement());
- }
-
- // Get the output extension
- outputExtension = element.getAttribute(ITool.OUTPUTS) == null ?
- new String() :
- element.getAttribute(ITool.OUTPUTS);
-
- // Get the tool invocation
- command = element.getAttribute(ITool.COMMAND) == null ?
- new String() :
- element.getAttribute(ITool.COMMAND);
-
- // Get the flag to control output
- outputFlag = element.getAttribute(ITool.OUTPUT_FLAG) == null ?
- new String() :
- element.getAttribute(ITool.OUTPUT_FLAG);
-
- // Get the output prefix
- outputPrefix = element.getAttribute(ITool.OUTPUT_PREFIX) == null ?
- new String() :
- element.getAttribute(ITool.OUTPUT_PREFIX);
-
- // set up the category map
- categoryMap = new HashMap();
- addOptionCategory(this);
-
- // Check for options
- IConfigurationElement[] toolElements = element.getChildren();
- for (int l = 0; l < toolElements.length; ++l) {
- IConfigurationElement toolElement = toolElements[l];
- if (toolElement.getName().equals(ITool.OPTION)) {
- new Option(this, toolElement);
- } else if (toolElement.getName().equals(ITool.OPTION_CAT)) {
- new OptionCategory(this, toolElement);
- }
- }
- }
-
- public IOptionCategory getOptionCategory(String id) {
- return (IOptionCategory)categoryMap.get(id);
- }
-
- void addOptionCategory(IOptionCategory category) {
- categoryMap.put(category.getId(), category);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#handlesFileType(java.lang.String)
- */
- public boolean buildsFileType(String extension) {
- if (extension == null) {
- return false;
- }
- return getInputExtensions().contains(extension);
- }
-
- void addChildCategory(IOptionCategory category) {
- if (childOptionCategories == null)
- childOptionCategories = new ArrayList();
- childOptionCategories.add(category);
- }
-
- public IOption[] getOptions() {
- if (options != null)
- return (IOption[])options.toArray(new IOption[options.size()]);
- else
- return EMPTY_OPTIONS;
- }
-
- public void addOption(Option option) {
- if (options == null) {
- options = new ArrayList();
- optionMap = new HashMap();
- }
- options.add(option);
- optionMap.put(option.getId(), option);
- }
-
- public IOptionCategory getTopOptionCategory() {
- return this;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getChildCategories()
- */
- public IOptionCategory[] getChildCategories() {
- if (childOptionCategories != null)
- return (IOptionCategory[])childOptionCategories.toArray(new IOptionCategory[childOptionCategories.size()]);
- else
- return EMPTY_CATEGORIES;
- }
-
- /* (non-Javadoc)
- * Safe accessor method to retrieve the list of valid source extensions
- * the receiver know how to build.
- *
- * @return List
- */
- private List getInputExtensions() {
- if (inputExtensions == null) {
- inputExtensions = new ArrayList();
- }
- return inputExtensions;
- }
-
- private List getInterfaceExtensions() {
- if (interfaceExtensions == null) {
- interfaceExtensions = new ArrayList();
- }
- return interfaceExtensions;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#createChildCategory()
- */
- public IOptionCategory createChildCategory() {
- IOptionCategory category = new OptionCategory(this);
-
- if (childOptionCategories == null)
- childOptionCategories = new ArrayList();
- childOptionCategories.add(category);
-
- return category;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getOutputFlag()
- */
- public String getOutputFlag() {
- return outputFlag == null ? new String() : outputFlag.trim();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getOutputPrefix()
- */
- public String getOutputPrefix() {
- return outputPrefix == null ? new String() : outputPrefix.trim();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOwner()
- */
- public IOptionCategory getOwner() {
- return null;
- }
-
- public ITarget getTarget() {
- return target;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getTool()
- */
- public ITool getTool() {
- return this;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getToolCommand()
- */
- public String getToolCommand() {
- return command.trim();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getToolFlags()
- */
- public String getToolFlags() throws BuildException {
- // Get all of the options
- StringBuffer buf = new StringBuffer();
- IOption[] opts = getOptions();
- for (int index = 0; index < opts.length; index++) {
- IOption option = opts[index];
- switch (option.getValueType()) {
- case IOption.BOOLEAN :
- if (option.getBooleanValue()) {
- buf.append(option.getCommand() + WHITE_SPACE);
- }
- break;
-
- case IOption.ENUMERATED :
- String enum = option.getEnumCommand(option.getSelectedEnum());
- if (enum.length() > 0) {
- buf.append(enum + WHITE_SPACE);
- }
- break;
-
- case IOption.STRING :
- String val = option.getStringValue();
- if (val.length() > 0) {
- buf.append(val + WHITE_SPACE);
- }
- break;
-
- case IOption.STRING_LIST :
- String listCmd = option.getCommand();
- String[] list = option.getStringListValue();
- for (int j = 0; j < list.length; j++) {
- String temp = list[j];
- buf.append(listCmd + temp + WHITE_SPACE);
- }
- break;
-
- case IOption.INCLUDE_PATH :
- String incCmd = option.getCommand();
- String[] paths = option.getIncludePaths();
- for (int j = 0; j < paths.length; j++) {
- String temp = paths[j];
- buf.append(incCmd + temp + WHITE_SPACE);
- }
- break;
-
- case IOption.PREPROCESSOR_SYMBOLS :
- String defCmd = option.getCommand();
- String[] symbols = option.getDefinedSymbols();
- for (int j = 0; j < symbols.length; j++) {
- String temp = symbols[j];
- buf.append(defCmd + temp + WHITE_SPACE);
- }
- break;
-
- default :
- break;
- }
-
- }
-
- return buf.toString().trim();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptions(org.eclipse.cdt.core.build.managed.ITool)
- */
- public IOption[] getOptions(IConfiguration configuration) {
- ITool tool = this;
- if (configuration != null) {
- // TODO don't like this much
- ITool[] tools = configuration.getTools();
- for (int i = 0; i < tools.length; ++i) {
- if (tools[i] instanceof ToolReference) {
- if (((ToolReference)tools[i]).references(tool)) {
- tool = tools[i];
- break;
- }
- } else if (tools[i].equals(tool))
- break;
- }
- }
-
- IOption[] allOptions = tool.getOptions();
- ArrayList myOptions = new ArrayList();
-
- for (int i = 0; i < allOptions.length; ++i) {
- IOption option = allOptions[i];
- if (option.getCategory().equals(this))
- myOptions.add(option);
- }
-
- myOptions.trimToSize();
- return (IOption[])myOptions.toArray(new IOption[myOptions.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITool#getNatureFilter()
- */
- public int getNatureFilter() {
- return natureFilter;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getOption(java.lang.String)
- */
- public IOption getOption(String id) {
- return (IOption)optionMap.get(id);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getOutput(java.lang.String)
- */
- public String getOutputExtension(String inputExtension) {
- // Examine the list of input extensions
- ListIterator iter = getInputExtensions().listIterator();
- while (iter.hasNext()) {
- if (((String)iter.next()).equals(inputExtension)) {
- return outputExtension;
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITool#isHeaderFile(java.lang.String)
- */
- public boolean isHeaderFile(String ext) {
- if (ext == null) {
- return false;
- }
- return getInterfaceExtensions().contains(ext);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#producesFileType(java.lang.String)
- */
- public boolean producesFileType(String outputExtension) {
- return this.outputExtension.equals(outputExtension);
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
deleted file mode 100644
index 91a13233d3c..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.cdt.managedbuilder.internal.core;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- *
- */
-public class ToolReference implements ITool {
-
- private ITool parent;
- private IConfiguration owner;
- private List optionReferences;
- private Map optionRefMap;
-
- /**
- * Created a tool reference on the fly based on an existing tool.
- *
- * @param owner The Configuration
the receiver will be added to.
- * @param parent The ITool
tool the reference will be based on.
- */
- public ToolReference(Configuration owner, ITool parent) {
- this.owner = owner;
- this.parent = parent;
-
- owner.addToolReference(this);
- }
-
- /**
- * Adds the option reference specified in the argument to the receiver.
- *
- * @param optionRef
- */
- public void addOptionReference(OptionReference optionRef) {
- getLocalOptionRefs().add(optionRef);
- }
-
- /**
- * Created tool reference from an extension defined in a plugin manifest.
- *
- * @param owner The Configuration
the receiver will be added to.
- * @param element The element containing build information for the reference.
- */
- public ToolReference(Configuration owner, IConfigurationElement element) {
- this.owner = owner;
-
- parent = ((Target)owner.getTarget()).getTool(element.getAttribute(ID));
-
- owner.addToolReference(this);
-
- IConfigurationElement[] toolElements = element.getChildren();
- for (int m = 0; m < toolElements.length; ++m) {
- IConfigurationElement toolElement = toolElements[m];
- if (toolElement.getName().equals(ITool.OPTION_REF)) {
- new OptionReference(this, toolElement);
- }
- }
- }
-
- /**
- * Create a new tool reference based on information contained in a project file.
- *
- * @param owner The Configuration
the receiver will be added to.
- * @param element The element defined in the project file containing build information
- * for the receiver.
- */
- public ToolReference(Configuration owner, Element element) {
- this.owner = owner;
-
- Target parentTarget = (Target)owner.getTarget();
- parent = ((Target)parentTarget.getParent()).getTool(element.getAttribute("id"));
-
- owner.addToolReference(this);
-
- NodeList configElements = element.getChildNodes();
- for (int i = 0; i < configElements.getLength(); ++i) {
- Node configElement = configElements.item(i);
- if (configElement.getNodeName().equals(ITool.OPTION_REF)) {
- new OptionReference(this, (Element)configElement);
- }
- }
- }
-
- /**
- * Persist receiver to project file.
- *
- * @param doc The persistent store for the reference information.
- * @param element The root element in the store the receiver must use
- * to persist settings.
- */
- public void serialize(Document doc, Element element) {
- element.setAttribute(ITool.ID, parent.getId());
- Iterator iter = getLocalOptionRefs().listIterator();
- while (iter.hasNext()) {
- OptionReference optionRef = (OptionReference) iter.next();
- Element optionRefElement = doc.createElement(ITool.OPTION_REF);
- element.appendChild(optionRefElement);
- optionRef.serialize(doc, optionRefElement);
- }
- }
-
- public IConfiguration getConfiguration() {
- return owner;
- }
-
- public ITool getTool() {
- return parent;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getToolCommand()
- */
- public String getToolCommand() {
- return parent.getToolCommand();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getToolFlags()
- */
- public String getToolFlags() throws BuildException {
- // Get all of the options
- StringBuffer buf = new StringBuffer();
- IOption[] opts = getOptions();
- for (int index = 0; index < opts.length; index++) {
- IOption option = opts[index];
- switch (option.getValueType()) {
- case IOption.BOOLEAN :
- if (option.getBooleanValue()) {
- buf.append(option.getCommand() + WHITE_SPACE);
- }
- break;
-
- case IOption.ENUMERATED :
- String enum = option.getEnumCommand(option.getSelectedEnum());
- if (enum.length() > 0) {
- buf.append(enum + WHITE_SPACE);
- }
- break;
-
- case IOption.STRING :
- String val = option.getStringValue();
- if (val.length() > 0) {
- buf.append(val + WHITE_SPACE);
- }
- break;
-
- case IOption.STRING_LIST :
- String cmd = option.getCommand();
- String[] list = option.getStringListValue();
- for (int j = 0; j < list.length; j++) {
- String temp = list[j];
- buf.append(cmd + temp + WHITE_SPACE);
- }
- break;
-
- case IOption.INCLUDE_PATH :
- String incCmd = option.getCommand();
- String[] paths = option.getIncludePaths();
- for (int j = 0; j < paths.length; j++) {
- String temp = paths[j];
- buf.append(incCmd + temp + WHITE_SPACE);
- }
- break;
-
- case IOption.PREPROCESSOR_SYMBOLS :
- String defCmd = option.getCommand();
- String[] symbols = option.getDefinedSymbols();
- for (int j = 0; j < symbols.length; j++) {
- String temp = symbols[j];
- buf.append(defCmd + temp + WHITE_SPACE);
- }
- break;
-
- default :
- break;
- }
-
- }
-
- return buf.toString().trim();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#createOption()
- */
- public IOption createOption() {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getOptions()
- */
- public IOption[] getOptions() {
- IOption[] options = parent.getOptions();
-
- // Replace with our references
- for (int i = 0; i < options.length; ++i) {
- OptionReference ref = getOptionReference(options[i]);
- if (ref != null)
- options[i] = ref;
- }
-
- return options;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getOutputFlag()
- */
- public String getOutputFlag() {
- // The tool reference does not override this value
- return parent.getOutputFlag();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getOutputPrefix()
- */
- public String getOutputPrefix() {
- // The tool reference does not override this value
- return parent.getOutputPrefix();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getTarget()
- */
- public ITarget getTarget() {
- return owner.getTarget();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getTopOptionCategory()
- */
- public IOptionCategory getTopOptionCategory() {
- // The tool reference does not override this value
- return parent.getTopOptionCategory();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITool#isHeaderFile(java.lang.String)
- */
- public boolean isHeaderFile(String ext) {
- // The tool reference does not override this value
- return parent.isHeaderFile(ext);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#producesFileType(java.lang.String)
- */
- public boolean producesFileType(String outputExtension) {
- // The tool reference does not override this value
- return parent.producesFileType(outputExtension);
- }
-
- protected List getAllOptionRefs() {
- // First get all the option references this tool reference contains
- return ((Configuration)owner).getOptionReferences(parent);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
- */
- public String getId() {
- // The tool reference does not override this value
- return parent.getId();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
- */
- public String getName() {
- // The tool reference does not override this value
- return parent.getName();
- }
-
- /**
- * Answers true
if the reference is a reference to the
- * tool specified in the argument.
- *
- * @param target the tool that should be tested
- * @return boolean
- */
- public boolean references(ITool target) {
- if (equals(target)) {
- // we are the target
- return true;
- }
- else if (parent instanceof ToolReference) {
- // check the reference we are overriding
- return ((ToolReference)parent).references(target);
- }
- else if (target instanceof ToolReference) {
- return parent.equals(((ToolReference)target).parent);
- }
- else {
- // the real reference
- return parent.equals(target);
- }
- }
-
- /* (non-javadoc)
- * Answers an option reference that overrides the option, or null
- *
- * @param option
- * @return OptionReference
- */
- private OptionReference getOptionReference(IOption option) {
- // Get all the option references for this option
- Iterator iter = getAllOptionRefs().listIterator();
- while (iter.hasNext()) {
- OptionReference optionRef = (OptionReference) iter.next();
- if (optionRef.references(option))
- return optionRef;
- }
-
- return null;
- }
-
- protected List getLocalOptionRefs() {
- if (optionReferences == null) {
- optionReferences = new ArrayList();
- optionReferences.clear();
- }
- return optionReferences;
- }
-
- /**
- * Answers a reference to the option. If the reference does not exist,
- * a new reference is created.
- *
- * @param option
- * @return OptionReference
- */
- public OptionReference createOptionReference(IOption option) {
- // Check if the option reference already exists
- OptionReference ref = getOptionReference(option);
- if (ref == null) {
- ref = new OptionReference(this, option);
- }
- return ref;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#handlesFileType(java.lang.String)
- */
- public boolean buildsFileType(String extension) {
- // The tool reference does not override this value
- return parent.buildsFileType(extension);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITool#getNatureFilter()
- */
- public int getNatureFilter() {
- // The tool reference does not override this value
- return parent.getNatureFilter();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getOption(java.lang.String)
- */
- public IOption getOption(String id) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getOutput(java.lang.String)
- */
- public String getOutputExtension(String inputExtension) {
- // The tool reference does not override this value
- return parent.getOutputExtension(inputExtension);
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/.classpath b/build/org.eclipse.cdt.managedbuilder.ui/.classpath
deleted file mode 100644
index 065ac06e197..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-10th July, 2002
-Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. -For purposes of the CPL, "Program" will mean the Content.
- -If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.
- -If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.
- - - \ No newline at end of file diff --git a/build/org.eclipse.cdt.managedbuilder.ui/build.properties b/build/org.eclipse.cdt.managedbuilder.ui/build.properties deleted file mode 100644 index 7258fc9dfd4..00000000000 --- a/build/org.eclipse.cdt.managedbuilder.ui/build.properties +++ /dev/null @@ -1,6 +0,0 @@ -bin.includes = plugin.xml,\ - plugin.properties,\ - about.html,\ - icons/,\ - mgdbuildui.jar -source.mgdbuildui.jar = src/ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/action-buildconfig.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/action-buildconfig.gif deleted file mode 100644 index bb64374a7be..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/action-buildconfig.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/action-deleteconfig.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/action-deleteconfig.gif deleted file mode 100644 index a06106af2d8..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/action-deleteconfig.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/action-editconfig.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/action-editconfig.gif deleted file mode 100644 index 820079ad6ba..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/action-editconfig.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/action-newconfig.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/action-newconfig.gif deleted file mode 100644 index 5b04a5e4610..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/action-newconfig.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/build_configs.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/build_configs.gif deleted file mode 100644 index bb64374a7be..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/build_configs.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-category.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-category.gif deleted file mode 100644 index 690bba071fc..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-category.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-compiler.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-compiler.gif deleted file mode 100644 index 20e7baed143..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-compiler.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-debug.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-debug.gif deleted file mode 100644 index 3052a80cd67..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-debug.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-librarian.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-librarian.gif deleted file mode 100644 index f966fc39d9b..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-librarian.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-linker.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-linker.gif deleted file mode 100644 index 91eec0f7dae..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-linker.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-preprocessor.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-preprocessor.gif deleted file mode 100644 index 082e49fbe66..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-preprocessor.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-profile.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-profile.gif deleted file mode 100644 index 45d614829bf..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-profile.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-release.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-release.gif deleted file mode 100644 index b7b23708e09..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-release.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-tool.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-tool.gif deleted file mode 100644 index 33981a5dbf1..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/build16/config-tool.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/wizban/newmngc_app.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/wizban/newmngc_app.gif deleted file mode 100644 index beefb8ee95d..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/wizban/newmngc_app.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/wizban/newmngcc_app.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/full/wizban/newmngcc_app.gif deleted file mode 100644 index 85e3f72d33c..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/full/wizban/newmngcc_app.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.properties b/build/org.eclipse.cdt.managedbuilder.ui/plugin.properties deleted file mode 100644 index ecc2ffcaea3..00000000000 --- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.properties +++ /dev/null @@ -1,75 +0,0 @@ -pluginName=C/C++ Managed Builder UI -providerName=Eclipse.org - -# The Wizards -MngCWizard.name=Managed Make C Project -MngCWizard.description=Create a new C project and let Eclipse create and manage the makefile -MngCCWizard.name=Managed Make C++ Project -MngCCWizard.description=Create a new C++ project and let Eclipse create and manage the makefile - -# Build Model Names -ConfigName.Rel=Release -ConfigName.Dbg=Debug -ToolName.preprocessor = Preprocessor -ToolName.compiler.c = C Compiler -ToolName.compiler.cpp = C++ Compiler -ToolName.archiver = Archiver -ToolName.linker.c = C Linker -ToolName.linker.cpp = C++ Linker -OptionCategory.Symbols = Symbols -OptionCategory.Preproc = Preprocessor -OptionCategory.Dirs = Directories -OptionCategory.General = General -OptionCategory.Optimize=Optimization -OptionCategory.Debug=Debugging -OptionCategory.Warn=Warnings -OptionCategory.Misc=Miscellaneous -OptionCategory.Libs=Libraries - -Option.Posix.PreprocOnly=Preprocess only (-E) -Option.Posix.Nostdinc=Do not search system directories (-nostdinc) - -Option.Posix.DefSym=Defined symbols (-D) -Option.Posix.UndefSym=Undefined symbols (-U) - -Option.Posix.InclPaths=Include Paths (-I) - -Option.Posix.OptLevel=Optimization Level -Option.Posix.Optimize.None=None (-O0) -Option.Posix.Optimize.Optimize=Optimize (-O1) -Option.Posix.Optimize.More=Optimize more (-O2) -Option.Posix.Optimize.Most=Optimize most (-O3) -Option.Posix.Optimize.Flags=Other optimization flags - -Option.Posix.DebugLevel=Debug Level -Option.Posix.Debug.None=None -Option.Posix.Debug.Min=Minimal (-g1) -Option.Posix.Debug.Def=Default (-g) -Option.Posix.Debug.Max=Maximum (-g3) -Option.Posix.Debug.Other=Other debugging flags -Option.Posix.Debug.gprof=Generate gprof information (-pg) -Option.Posix.Debug.prof=Generate prof information (-p) - -Option.Posix.Warn.Syntax=Check syntax only (-fsyntax-only) -Option.Posix.Warn.Pedandic=Pedantic (-pedantic) -Option.Posix.Warn.PedErrors=Pedantic warnings as errors (-pedantic-errors) -Option.Posix.Warn.nowarn=Inhibit all warnings (-w) -Option.Posix.Warn.allwarn=All warnings (-Wall) -Option.Posix.Warn.toerrs=Warnings as errors (-Werror) - -Option.Posix.Verbose=Verbose (-v) -Option.OtherFlags=Other flags -Option.Posix.Ansi=Support ANSI programs (-ansi) - -Option.Posix.Linker.NoStartFiles=Do not use standard start files (-nostartfiles) -Option.Posix.Linker.NoDefLibs=Do not use default libraries (-nodefaultlibs) -Option.Posix.Linker.NoStdLibs=No startup or default libs (-nostdlib) -Option.Posix.Linker.Strip=Remove symbol table (-s) -Option.Posix.Linker.Static=No shared libraries (-static) -Option.Posix.Linker.XLinker=Other options (-Xlinker [option]) -Option.Posix.Linker.Flags=Linker flags -Option.Posix.Libs=Libraries (-l) -Option.Posix.Libsearch=Library search path (-L) -Option.Posix.UserObjs=Other objects - -Option.Posix.Archiver.Flags=Archiver flags diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml deleted file mode 100644 index 32c43178444..00000000000 --- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml +++ /dev/null @@ -1,3755 +0,0 @@ - - -null
if none.
- */
- private String message = "";
-
- /**
- * The input value; the empty string by default.
- */
- private String value = "";
-
- /**
- * Error message label widget.
- */
- private Label errorMessageLabel;
-
- // Widgets
- private Button btnBrowse = null;
- private Button btnOK = null;
- private Text text = null;
-
- /**
- * Creates an input dialog with OK, Cancel, and a Browse button.
- *
- * @param shell the parent shell
- * @param dialogTitle the title of the dialog or null
if none
- * @param dialogMessage the dialog message, or null
if none
- * @param initialValue the initial input value, or null
if none
- * (equivalent to the empty string)
- */
- public BrowseEntryDialog(Shell shell, String dialogTitle, String dialogMessage, String initialValue) {
- super(shell);
- // We are editing the value argument if it is not an empty string
- if (dialogTitle != null) {
- title = dialogTitle;
- }
- // Cache the message to be shown in the label
- if (dialogMessage != null) {
- message = dialogMessage;
- }
- // Value for the text widget
- if (initialValue != null) {
- value = initialValue;
- }
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- value = text.getText().trim();
- } else {
- value = null;
- }
- super.buttonPressed(buttonId);
- }
-
- /* (non-Javadoc)
- * Method declared in Window.
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- if (title != null)
- shell.setText(title);
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite composite = ControlFactory.createComposite(parent, 4);
-
- // Create the label
- if (message != null) {
- Label label = new Label(composite, SWT.WRAP);
- label.setText(message);
- GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
- gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- gd.horizontalSpan = 4;
- label.setLayoutData(gd);
- label.setFont(parent.getFont());
- }
-
- text = new Text(composite, SWT.SINGLE | SWT.BORDER);
- GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan = 3;
- text.setLayoutData(gd);
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateButtonState();
- }
- });
-
- // Instantiate the browse button
- btnBrowse = ControlFactory.createPushButton(composite, ManagedBuilderUIPlugin.getResourceString(BROWSE));
- setButtonLayoutData(btnBrowse);
- btnBrowse.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- handleBrowsePressed();
- }
- });
-
- return composite;
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- // create OK and Cancel buttons by default
- btnOK = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
-
- text.setFocus();
- if (value != null) {
- text.setText(value);
- }
- updateButtonState();
- }
-
- protected String getValue() {
- return value;
- }
-
- protected void handleBrowsePressed() {
- // Popup a file browser widget
- DirectoryDialog dialog = new DirectoryDialog(getShell());
- // Create a hint if text widget contains value
- String widgetText;
- if ((widgetText = text.getText().trim()).length() > 0) {
- dialog.setFilterPath(widgetText);
- }
- // Open the selection dialog and populate the widget
- String directory;
- if ((directory = dialog.open()) != null) {
- /*
- * TODO: Convert the dialog to the proper format for platform (i.e.
- * if platform.pathStyle == Platform.POSIX then swap \\ to / )
- */
- text.setText(directory.trim());
- updateButtonState();
- }
- }
-
- protected void updateButtonState() {
- if (btnOK != null)
- btnOK.setEnabled(text.getText().trim().length() > 0);
- }
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionComboFieldEditor.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionComboFieldEditor.java
deleted file mode 100644
index 8288407edd5..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionComboFieldEditor.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
-***********************************************************************/
-
-import org.eclipse.cdt.utils.ui.controls.ControlFactory;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-public class BuildOptionComboFieldEditor extends FieldEditor {
-
- // Widgets and bookeeping variables
- private Combo optionSelector;
- private String [] options = new String[0];
- private String selected;
-
- /**
- * @param name
- * @param label
- * @param opts
- * @param sel
- * @param parent
- */
- public BuildOptionComboFieldEditor (String name, String label, String [] opts, String sel, Composite parent) {
- init(name, label);
- options = opts;
- selected = sel;
- createControl(parent);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
- */
- protected void adjustForNumColumns(int numColumns) {
- // For now grab the excess space
- GridData gd = (GridData)optionSelector.getLayoutData();
- gd.horizontalSpan = numColumns - 1;
- gd.grabExcessHorizontalSpace = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int)
- */
- protected void doFillIntoGrid(Composite parent, int numColumns) {
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = numColumns;
- parent.setLayoutData(gd);
-
- // Add the label
- Label label = getLabelControl(parent);
- GridData labelData = new GridData();
- labelData.horizontalSpan = 1;
- labelData.grabExcessHorizontalSpace = false;
- label.setLayoutData(labelData);
-
- // Now add the combo selector
- optionSelector = ControlFactory.createSelectCombo(parent, options, selected);
- GridData selectorData = (GridData) optionSelector.getLayoutData();
- selectorData.horizontalSpan = numColumns - 1;
- selectorData.grabExcessHorizontalSpace = true;
- optionSelector.setLayoutData(selectorData);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doLoad()
- */
- protected void doLoad() {
- // Retrieve the option string from the store
- String values = getPreferenceStore().getString(getPreferenceName());
-
- // Convert it to a string array
- options = BuildToolsSettingsStore.parseString(values);
- optionSelector.removeAll();
- optionSelector.setItems(options);
-
- // Set the index of selection in the combo box
- int index = optionSelector.indexOf(selected);
- optionSelector.select(index >= 0 ? index : 0);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
- */
- protected void doLoadDefault() {
- doLoad();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doStore()
- */
- protected void doStore() {
- // Save the selected item in the store
- int index = optionSelector.getSelectionIndex();
- String selected = index == -1 ? new String() : optionSelector.getItem(index);
- getPreferenceStore().setValue(getPreferenceName(), selected);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls()
- */
- public int getNumberOfControls() {
- // There is just the label from the parent and the combo
- return 2;
- }
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java
deleted file mode 100644
index 22e80dc56e1..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java
+++ /dev/null
@@ -1,440 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * **********************************************************************/
-
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
-import org.eclipse.cdt.utils.ui.controls.ControlFactory;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-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.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Widget;
-
-public class BuildOptionListFieldEditor extends FieldEditor {
- // Label constants
- private static final String TITLE = "BuildPropertyCommon.label.title"; //$NON-NLS-1$
- private static final String NEW = "BuildPropertyCommon.label.new"; //$NON-NLS-1$
- private static final String REMOVE = "BuildPropertyCommon.label.remove"; //$NON-NLS-1$
- private static final String UP = "BuildPropertyCommon.label.up"; //$NON-NLS-1$
- private static final String DOWN = "BuildPropertyCommon.label.down"; //$NON-NLS-1$
- private static final String EDIT = "BuildPropertyCommon.label.editVar"; //$NON-NLS-1$
-
- // UI constants
- private static final int VERTICAL_DIALOG_UNITS_PER_CHAR = 8;
- private static final int HORIZONTAL_DIALOG_UNITS_PER_CHAR = 4;
- private static final int LIST_HEIGHT_IN_CHARS = 10;
- private static final int LIST_HEIGHT_IN_DLUS =
- LIST_HEIGHT_IN_CHARS * VERTICAL_DIALOG_UNITS_PER_CHAR;
-
- // The top-level control for the field editor.
- private Composite top;
- // The list of tags.
- private List list;
-
- // The group control for the list and button composite
- private Group controlGroup;
-
- private String fieldName;
- private SelectionListener selectionListener;
-
- // The button for adding the contents of the text field to the list
- private Button addButton;
- // The button for swapping the currently-selected list item down
- private Button downButton;
- // The button to start the edit process
- private Button editButton;
- // The button for removing the currently-selected list item.
- private Button removeButton;
- // The button for swapping the currently selected item up
- private Button upButton;
-
- /**
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
- public BuildOptionListFieldEditor (String name, String labelText, Composite parent) {
- super(name, labelText, parent);
- this.fieldName = labelText;
- }
-
- /* (non-Javadoc)
- * Event handler for the addButton widget
- */
- protected void addPressed() {
- setPresentsDefaultValue(false);
- // Prompt user for a new item
- String input = getNewInputObject();
-
- // Add it to the list
- if (input != null && input.length() > 0) {
- int index = list.getSelectionIndex();
- if (index >= 0) {
- list.add(input, index + 1);
- list.setSelection(index + 1);
- }
- else {
- list.add(input, 0);
- list.setSelection(0);
- }
- selectionChanged();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
- */
- protected void adjustForNumColumns(int numColumns) {
- ((GridData)top.getLayoutData()).horizontalSpan = numColumns;
- }
-
- /* (non-Javadoc)
- * Creates the Add, Remove, Up, and Down button in the button composite.
- *
- * @param container the box for the buttons
- */
- private void createButtons(Composite container) {
- addButton = createPushButton(container, ManagedBuilderUIPlugin.getResourceString(NEW));
- editButton = createPushButton(container, ManagedBuilderUIPlugin.getResourceString(EDIT));
- removeButton = createPushButton(container, ManagedBuilderUIPlugin.getResourceString(REMOVE));
- upButton = createPushButton(container, ManagedBuilderUIPlugin.getResourceString(UP));
- downButton = createPushButton(container, ManagedBuilderUIPlugin.getResourceString(DOWN));
- }
-
- /**
- * @param items
- * @return
- */
- protected String createList(String[] items) {
- return BuildToolsSettingsStore.createList(items);
- }
-
- /* (non-Javadoc)
- * Rather than using the ControlFactory helper methods, this field
- * editor is using this helper method. Other field editors use a similar
- * set of method calls, so this seems like the safest approach
- *
- * @param parent the button composite
- * @param label the label to place in the button
- * @return
- */
- private Button createPushButton(Composite parent, String label) {
- Button button = new Button(parent, SWT.PUSH);
- button.setText(label);
- button.setFont(parent.getFont());
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.heightHint = convertVerticalDLUsToPixels(button, IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(button, IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- button.setLayoutData(data);
- button.addSelectionListener(getSelectionListener());
- return button;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int)
- */
- protected void doFillIntoGrid(Composite parent, int numColumns) {
- top = parent;
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = numColumns;
- top.setLayoutData(gd);
-
- controlGroup = ControlFactory.createGroup(top, getLabelText(), 2);
- GridData groupData = new GridData(GridData.FILL_HORIZONTAL);
- groupData.horizontalSpan = numColumns;
- controlGroup.setLayoutData(groupData);
-
- // Make the list
- list = new List(controlGroup, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
-
- // Create a grid data that takes up the extra space in the dialog and spans one column.
- GridData listData = new GridData(GridData.FILL_HORIZONTAL);
- listData.heightHint =
- convertVerticalDLUsToPixels(list, LIST_HEIGHT_IN_DLUS);
- listData.horizontalSpan = 1;
-
- list.setLayoutData(listData);
- list.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- selectionChanged();
- }
- });
-
- list.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- list = null;
- }
- });
- list.addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- // Popup the editor on the selected item from the list
- editSelection();
- }
- });
-
- // Create a composite for the buttons
- Composite buttonGroup = new Composite(controlGroup, SWT.NONE);
- GridData buttonData = new GridData();
- buttonData.horizontalSpan = 1;
- buttonData.verticalAlignment = GridData.BEGINNING;
- buttonGroup.setLayoutData(buttonData);
-
- GridLayout buttonLayout = new GridLayout();
- buttonLayout.numColumns = 1;
- buttonLayout.marginHeight = 0;
- buttonLayout.marginWidth = 0;
- buttonGroup.setLayout(buttonLayout);
-
- buttonGroup.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- addButton = null;
- editButton = null;
- removeButton = null;
- upButton = null;
- downButton = null;
- }
- });
-
- // Create the buttons
- createButtons(buttonGroup);
- }
-
- /* (non-Javadoc)
- * Creates a selection listener that handles the selection events
- * for the button controls and single-click events in the list to
- * trigger a selection change.
- */
- public void createSelectionListener() {
- selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- Widget widget = event.widget;
- if (widget == addButton) {
- addPressed();
- } else if (widget == editButton) {
- editPressed();
- } else if (widget == removeButton) {
- removePressed();
- } else if (widget == upButton) {
- upPressed();
- } else if (widget == downButton) {
- downPressed();
- } else if (widget == list) {
- selectionChanged();
- }
- }
-
- };
- }
-
-
-
- /* (non-Javadoc)
- * Event handler for the down button
- */
- protected void downPressed() {
- swap(false);
- }
-
- private void editPressed() {
- editSelection();
- }
-
- /* (non-Javadoc)
- *
- */
- protected void editSelection() {
- // Edit the selection index
- int index = list.getSelectionIndex();
- if (index != -1) {
- String selItem = list.getItem(index);
- if (selItem != null) {
- InputDialog dialog = new InputDialog(getShell(), ManagedBuilderUIPlugin.getResourceString(TITLE), fieldName, selItem, null);
- String newItem = null;
- if (dialog.open() == InputDialog.OK) {
- newItem = dialog.getValue();
- if (newItem != null && !newItem.equals(selItem)) {
- list.setItem(index, newItem);
- selectionChanged();
- }
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doLoad()
- */
- protected void doLoad() {
- if (list != null) {
- String s = getPreferenceStore().getString(getPreferenceName());
- String[] array = parseString(s);
- for (int i = 0; i < array.length; i++){
- list.add(array[i]);
- }
- list.setSelection(0);
- selectionChanged();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
- */
- protected void doLoadDefault() {
- if (list != null) {
- list.removeAll();
- String s = getPreferenceStore().getDefaultString(getPreferenceName());
- String[] array = parseString(s);
- for (int i = 0; i < array.length; i++){
- list.add(array[i]);
- }
- list.setSelection(0);
- selectionChanged();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doStore()
- */
- protected void doStore() {
- String s = createList(list.getItems());
- if (s != null)
- getPreferenceStore().setValue(getPreferenceName(), s);
- }
-
- protected String getNewInputObject() {
- // Create a dialog to prompt for a new symbol or path
- InputDialog dialog = new InputDialog(getShell(), ManagedBuilderUIPlugin.getResourceString(TITLE), fieldName, new String(), null);
- String input = new String();
- if (dialog.open() == InputDialog.OK) {
- input = dialog.getValue();
- }
- return input;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls()
- */
- public int getNumberOfControls() {
- // The group control has a list and buttons so we want it to get at
- // least 2 columns to display in.
- return 2;
- }
-
- /* (non-Javadoc)
- * Returns this field editor's selection listener.
- * The listener is created if nessessary.
- *
- * @return the selection listener
- */
- private SelectionListener getSelectionListener() {
- if (selectionListener == null)
- createSelectionListener();
- return selectionListener;
- }
-
- /* (non-Javadoc)
- * Returns this field editor's shell.
- *
- * @return the shell
- */
- protected Shell getShell() {
- if (addButton == null)
- return null;
- return addButton.getShell();
- }
-
- /* (non-Javadoc)
- * @param stringList
- * @return
- */
- protected String[] parseString(String stringList) {
- return BuildToolsSettingsStore.parseString(stringList);
- }
-
- /* (non-Javadoc)
- * Event handler for the removeButton selected event
- */
- protected void removePressed() {
- // Remove the selected item from the list
- setPresentsDefaultValue(false);
- int index = list.getSelectionIndex();
- if (index >= 0) {
- list.remove(index);
- list.setSelection(index - 1);
- selectionChanged();
- }
- }
-
- /* (non-Javadoc)
- * Clean up the list and button control states after the event
- * handlers fire.
- */
- protected void selectionChanged() {
- int index = list.getSelectionIndex();
- int size = list.getItemCount();
-
- // Enable the edit button if there is at least one item in the list
- editButton.setEnabled(size > 0);
- // Enable the remove button if there is at least one item in the list
- removeButton.setEnabled(size > 0);
- // Enable the up button IFF there is more than 1 item and selection index is not first item
- upButton.setEnabled(size > 1 && index > 0);
- // Enable the down button IFF there is more than 1 item and selection index not last item
- downButton.setEnabled(size > 1 && index >= 0 && index < size - 1);
- }
-
- /* (non-Javadoc)
- * Swaps the location of two list elements. If the argument is true
- * the list item is swapped with the item preceeding it in the list. Otherwise
- * it is swapped with the item following it.
- *
- * @param moveUp
- */
- private void swap(boolean moveUp) {
- setPresentsDefaultValue(false);
- int index = list.getSelectionIndex();
- int target = moveUp ? index - 1 : index + 1;
-
- if (index >= 0) {
- String[] selection = list.getSelection();
- Assert.isTrue(selection.length == 1);
- list.remove(index);
- list.add(selection[0], target);
- list.setSelection(target);
- }
- selectionChanged();
- }
-
- /* (non-Javadoc)
- * Event handler for the up button. It simply swaps the selected
- * item with the list item above it.
- */
- protected void upPressed() {
- swap(true);
- }
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java
deleted file mode 100644
index b317069dc04..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java
+++ /dev/null
@@ -1,619 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * **********************************************************************/
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.SortedMap;
-
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
-import org.eclipse.cdt.utils.ui.controls.ControlFactory;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.preference.IPreferencePageContainer;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPropertyPage;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropertyPage, IPreferencePageContainer {
- /*
- * String constants
- */
- private static final String PREFIX = "BuildPropertyPage"; //$NON-NLS-1$
- private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
- private static final String NAME_LABEL = LABEL + ".NameText"; //$NON-NLS-1$
- private static final String BUILD_TOOLS_LABEL = LABEL + ".BuildToolTree"; //$NON-NLS-1$
- private static final String PLATFORM_LABEL = LABEL + ".Platform"; //$NON-NLS-1$
- private static final String CONFIG_LABEL = LABEL + ".Configuration"; //$NON-NLS-1$
- private static final String ACTIVE_LABEL = LABEL + ".Active"; //$NON-NLS-1$
- private static final String SETTINGS_LABEL = LABEL + ".Settings"; //$NON-NLS-1$
- private static final String TREE_LABEL = LABEL + ".ToolTree"; //$NON-NLS-1$
- private static final String OPTIONS_LABEL = LABEL + ".ToolOptions"; //$NON-NLS-1$
- private static final String ADD_CONF = LABEL + ".AddConfButton"; //$NON-NLS-1$
- private static final String TIP = PREFIX + ".tip"; //$NON-NLS-1$
- private static final String PLAT_TIP = TIP + ".platform"; //$NON-NLS-1$
- private static final String CONF_TIP = TIP + ".config"; //$NON-NLS-1$
- private static final String ADD_TIP = TIP + ".addconf"; //$NON-NLS-1$
- private static final String MANAGE_TITLE = PREFIX + ".manage.title"; //$NON-NLS-1$
- private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 20, 30 };
-
- /*
- * Dialog widgets
- */
- private Combo targetSelector;
- private Combo configSelector;
- private Button manageConfigs;
- private TreeViewer optionList;
- private SashForm sashForm;
- private Group sashGroup;
- private Composite settingsPageContainer;
- private ScrolledComposite containerSC;
-
- /*
- * Bookeeping variables
- */
- private ITarget [] targets;
- private ITarget selectedTarget;
- private IConfiguration [] configurations;
- private IConfiguration selectedConfiguration;
- private BuildToolSettingsPage currentSettingsPage;
- private Map configToPageListMap;
- private BuildToolsSettingsStore settingsStore;
- private IOptionCategory selectedCategory;
- private Point lastShellSize;
-
- /**
- * The minimum page size; 200 by 200 by default.
- *
- * @see #setMinimumPageSize
- */
- private Point minimumPageSize = new Point(200, 200);
-
- /**
- * Layout for the page container.
- *
- */
- private class PageLayout extends Layout {
- public void layout(Composite composite, boolean force) {
- Rectangle rect = composite.getClientArea();
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- children[i].setSize(rect.width, rect.height);
- }
- }
- public Point computeSize(Composite composite, int wHint, int hHint, boolean force) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) {
- return new Point(wHint, hHint);
- }
- int x = minimumPageSize.x;
- int y = minimumPageSize.y;
-
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- Point size = children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
- x = Math.max(x, size.x);
- y = Math.max(y, size.y);
- }
- if (wHint != SWT.DEFAULT) {
- x = wHint;
- }
- if (hHint != SWT.DEFAULT) {
- y = hHint;
- }
- return new Point(x, y);
- }
- }
-
- /**
- * Default constructor
- */
- public BuildPropertyPage() {
- configToPageListMap = new HashMap();
- }
-
- protected Control createContents(Composite parent) {
- // Initialize the key data
- targets = ManagedBuildManager.getTargets(getProject());
-
- // Create the container we return to the property page editor
- Composite composite = ControlFactory.createComposite(parent, 1);
- GridData gd;
-
- // Add a config selection area
- Group configGroup = ControlFactory.createGroup(composite, ManagedBuilderUIPlugin.getResourceString(ACTIVE_LABEL), 1);
- gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.grabExcessHorizontalSpace = true;
- configGroup.setLayoutData(gd);
- // Use the form layout inside the group composite
- FormLayout form = new FormLayout();
- form.marginHeight = 5;
- form.marginWidth = 5;
- configGroup.setLayout(form);
-
- Label platformLabel = ControlFactory.createLabel(configGroup, ManagedBuilderUIPlugin.getResourceString(PLATFORM_LABEL));
- targetSelector = ControlFactory.createSelectCombo(configGroup, getPlatformNames(), null);
- targetSelector.addListener(SWT.Selection, new Listener () {
- public void handleEvent(Event e) {
- handleTargetSelection();
- }
- });
- targetSelector.setToolTipText(ManagedBuilderUIPlugin.getResourceString(PLAT_TIP));
- Label configLabel = ControlFactory.createLabel(configGroup, ManagedBuilderUIPlugin.getResourceString(CONFIG_LABEL));
- configSelector = new Combo(configGroup, SWT.READ_ONLY|SWT.DROP_DOWN);
- configSelector.addListener(SWT.Selection, new Listener () {
- public void handleEvent(Event e) {
- handleConfigSelection();
- }
- });
- configSelector.setToolTipText(ManagedBuilderUIPlugin.getResourceString(CONF_TIP));
- manageConfigs = ControlFactory.createPushButton(configGroup, ManagedBuilderUIPlugin.getResourceString(ADD_CONF));
- manageConfigs.setToolTipText(ManagedBuilderUIPlugin.getResourceString(ADD_TIP));
- manageConfigs.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleManageConfig();
- }
- });
- // Now do the form layout for the widgets
- FormData fd = new FormData();
- // Anchor the labels in the centre of their respective combos
- fd.top = new FormAttachment(targetSelector, 0, SWT.CENTER);
- platformLabel.setLayoutData(fd);
- fd = new FormData();
- fd.top = new FormAttachment(configSelector, 0, SWT.CENTER);
- configLabel.setLayoutData(fd);
- // Anchor platform combo left to the config selector
- fd = new FormData();
- fd.left = new FormAttachment(configSelector, 0, SWT.LEFT);
- fd.right = new FormAttachment(100, 0);
- targetSelector.setLayoutData(fd);
- // Anchor button right to combo and left to group
- fd = new FormData();
- fd.top = new FormAttachment(configSelector, 0, SWT.CENTER);
- fd.right = new FormAttachment(100,0);
- manageConfigs.setLayoutData(fd);
- // Anchor config combo left 5 pixels from label, top 5% below the centre, and right to the button
- fd = new FormData();
- fd.left = new FormAttachment(configLabel, 5);
- fd.top = new FormAttachment(55,0);
- fd.right = new FormAttachment(manageConfigs, -5 , SWT.LEFT);
- configSelector.setLayoutData(fd);
-
- // Create the sash form
- sashGroup = ControlFactory.createGroup(composite, ManagedBuilderUIPlugin.getResourceString(SETTINGS_LABEL), 1);
- sashGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
- sashForm = new SashForm(sashGroup, SWT.NONE);
- sashForm.setOrientation(SWT.HORIZONTAL);
- sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 5;
- layout.marginWidth = 5;
- sashForm.setLayout(layout);
-
- createSelectionArea(sashForm);
- createEditArea(sashForm);
- initializeSashForm();
-
- // Do not call this until the widgets are constructed
- handleTargetSelection();
- return composite;
- }
-
- /* (non-Javadoc)
- * Add the tabs relevant to the project to edit area tab folder.
- */
- protected void createEditArea(Composite parent) {
- containerSC = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
- containerSC.setExpandHorizontal(true);
- containerSC.setExpandVertical(true);
-
- // Add a container for the build settings page
- settingsPageContainer = new Composite(containerSC, SWT.NULL);
- settingsPageContainer.setLayout(new PageLayout());
-
- containerSC.setContent(settingsPageContainer);
- containerSC.setMinSize(settingsPageContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- settingsPageContainer.layout();
- }
-
- protected void createSelectionArea (Composite parent) {
- // Create a label and list viewer
- Composite composite = ControlFactory.createComposite(parent, 1);
- optionList = new TreeViewer(composite, SWT.SINGLE|SWT.H_SCROLL|SWT.V_SCROLL|SWT.BORDER);
- optionList.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleOptionSelection();
- }
- });
- optionList.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
- optionList.setLabelProvider(new ToolListLabelProvider());
- }
-
- /**
- * Method displayOptionsForTool.
- * @param toolReference
- */
- private void displayOptionsForCategory(IOptionCategory category) {
- // Do nothing if the selected category is is unchanged
- if (category == selectedCategory) {
- return;
- }
- selectedCategory = category;
-
- // Cache the current build setting page
- BuildToolSettingsPage oldPage = currentSettingsPage;
- currentSettingsPage = null;
-
- // Create a new settings page if necessary
- List pages = getPagesForConfig();
- ListIterator iter = pages.listIterator();
- while (iter.hasNext()) {
- BuildToolSettingsPage page = (BuildToolSettingsPage) iter.next();
- if (page.getCategory().equals(category)) {
- currentSettingsPage = page;
- break;
- }
- }
- if (currentSettingsPage == null) {
- currentSettingsPage = new BuildToolSettingsPage(selectedConfiguration, category);
- pages.add(currentSettingsPage);
- currentSettingsPage.setContainer(this);
- if (currentSettingsPage.getControl() == null) {
- currentSettingsPage.createControl(settingsPageContainer);
- }
- }
-
- // Make all the other pages invisible
- Control[] children = settingsPageContainer.getChildren();
- Control currentControl = currentSettingsPage.getControl();
- for (int i = 0; i < children.length; i++) {
- if (children[i] != currentControl)
- children[i].setVisible(false);
- }
- currentSettingsPage.setVisible(true);
- if (oldPage != null)
- oldPage.setVisible(false);
-
- // Set the size of the scrolled area
- containerSC.setMinSize(currentSettingsPage.computeSize());
- settingsPageContainer.layout();
- }
-
- /* (non-Javadoc)
- * @return an array of names for the configurations defined for the chosen target
- */
- private String [] getConfigurationNames () {
- String [] names = new String[configurations.length];
- for (int index = 0; index < configurations.length; ++index) {
- names[index] = configurations[index].getName();
- }
- return names;
- }
-
- /**
- * @return
- */
- protected Point getLastShellSize() {
- if (lastShellSize == null) {
- Shell shell = getShell();
- if (shell != null)
- lastShellSize = shell.getSize();
- }
- return lastShellSize;
- }
-
- private List getPagesForConfig() {
- List pages = (List) configToPageListMap.get(selectedConfiguration.getId());
- if (pages == null) {
- pages = new ArrayList();
- configToPageListMap.put(selectedConfiguration.getId(), pages);
- }
- return pages;
- }
-
- private String [] getPlatformNames() {
- String [] names = new String[targets.length];
- for (int index = 0; index < targets.length; ++index) {
- names[index] = targets[index].getName();
- }
- return names;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferencePageContainer#getPreferenceStore()
- */
- public IPreferenceStore getPreferenceStore()
- {
- return settingsStore;
- }
-
- private IProject getProject() {
- Object element= getElement();
- if (element != null && element instanceof IProject) {
- return (IProject)element;
- }
- return null;
- }
-
- /**
- * @return
- */
- public IConfiguration getSelectedConfiguration() {
- return selectedConfiguration;
- }
-
- /*
- * Event Handlers
- */
- private void handleConfigSelection () {
- // If there is nothing in config selection widget just bail
- if (configSelector.getItemCount() == 0) return;
-
- // Cache the selected config
- selectedConfiguration = configurations[configSelector.getSelectionIndex()];
-
- // Set the content provider for the list viewer
- ToolListContentProvider provider = new ToolListContentProvider();
- optionList.setContentProvider(provider);
- optionList.setInput(selectedConfiguration);
- optionList.expandAll();
-
- // Recreate the settings store for the configuration
- settingsStore = new BuildToolsSettingsStore(selectedConfiguration);
-
- // Select the first tool or option category in the list that has options
- Object[] elements = provider.getElements(selectedConfiguration);
- Object primary = elements.length > 0 ? elements[0] : null;
-
- if (primary != null && primary instanceof ITool) {
- // Check to see if there are any options.
- ITool tool = (ITool)primary;
- IOptionCategory top = tool.getTopOptionCategory();
- IOption[] topOpts = top.getOptions(selectedConfiguration);
- if (topOpts != null && topOpts.length == 0) {
- // Get the children categories and start looking
- IOptionCategory[] children = top.getChildCategories();
- for (int i = 0; i < children.length; i++) {
- IOptionCategory category = children[i];
- IOption[] catOpts = category.getOptions(selectedConfiguration);
- if (catOpts != null && catOpts.length > 0) {
- primary = category;
- break;
- }
- }
- }
- }
-
- if (primary != null) {
- optionList.setSelection(new StructuredSelection(primary));
- }
- }
-
- // Event handler for the manage configuration button event
- private void handleManageConfig () {
- ManageConfigDialog manageDialog = new ManageConfigDialog(getShell(), ManagedBuilderUIPlugin.getResourceString(MANAGE_TITLE), selectedTarget);
- if (manageDialog.open() == ManageConfigDialog.OK) {
- boolean updateConfigs = false;
-
- // Get the build output name
- String newBuildOutput = manageDialog.getBuildArtifactName();
- if (!selectedTarget.getArtifactName().equals(newBuildOutput)) {
- selectedTarget.setBuildArtifact(newBuildOutput);
- }
-
- // Get the new make command
- if (manageDialog.useDefaultMakeCommand()) {
- // This is a cheap assignment to null so do it to be doubly sure
- selectedTarget.resetMakeCommand();
- } else {
- String makeCommand = manageDialog.getMakeCommand();
- selectedTarget.setMakeCommand(makeCommand);
- }
-
- // Check to see if any configurations have to be deleted
- List deletedConfigs = manageDialog.getDeletedConfigIds();
- Iterator iter = deletedConfigs.listIterator();
- while (iter.hasNext()) {
- String id = (String)iter.next();
-
- // Remove the configurations from the target
- selectedTarget.removeConfiguration(id);
-
- // Clean up the UI
- configurations = selectedTarget.getConfigurations();
- configSelector.removeAll();
- configSelector.setItems(getConfigurationNames());
- configSelector.select(0);
- updateConfigs = true;
- }
-
- // Check to see if any have to be added
- SortedMap newConfigs = manageDialog.getNewConfigs();
- Set keys = newConfigs.keySet();
- Iterator keyIter = keys.iterator();
- Random r = new Random();
- r.setSeed(System.currentTimeMillis());
- while (keyIter.hasNext()) {
- String name = (String) keyIter.next();
- IConfiguration parent = (IConfiguration) newConfigs.get(name);
- if (parent != null) {
- int id = r.nextInt();
- if (id < 0) {
- id *= -1;
- }
- String newId = parent.getId() + "." + id;
- IConfiguration newConfig = selectedTarget.createConfiguration(parent, newId);
- newConfig.setName(name);
- // Update the config lists
- configurations = selectedTarget.getConfigurations();
- configSelector.removeAll();
- configSelector.setItems(getConfigurationNames());
- configSelector.select(configSelector.indexOf(name));
- updateConfigs = true;
- }
- }
- if (updateConfigs){
- handleConfigSelection();
- }
- }
- return;
- }
-
- private void handleOptionSelection() {
- // Get the selection from the tree list
- IStructuredSelection selection = (IStructuredSelection) optionList.getSelection();
-
- // Set the option page based on the selection
- Object element = selection.getFirstElement();
- if (element instanceof IOptionCategory) {
- displayOptionsForCategory((IOptionCategory)element);
- }
- }
-
- private void handleTargetSelection() {
- // Is there anything in the selector widget
- if (targetSelector.getItemCount() == 0) {
- manageConfigs.setEnabled(false);
- return;
- }
-
- // Enable the manage button
- manageConfigs.setEnabled(true);
-
- // Cache the platform at the selection index
- selectedTarget = targets[targetSelector.getSelectionIndex()];
-
- // Update the contents of the configuration widget
- populateConfigurations();
- }
-
- /*
- * (non-javadoc)
- * Initialize the relative weights (widths) of the 2 sides of the sash.
- */
- protected void initializeSashForm() {
- sashForm.setWeights(DEFAULT_SASH_WEIGHTS);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- // Empty the page list
- List pages = getPagesForConfig();
- pages.clear();
-
- // Get the build manager to reset build info for project
- ManagedBuildManager.resetConfiguration(getProject(), getSelectedConfiguration());
-
- // Recreate the settings store for the configuration
- settingsStore = new BuildToolsSettingsStore(getSelectedConfiguration());
-
- // Reset the category selection and run selection event handler
- selectedCategory = null;
- handleOptionSelection();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- // Force each settings page to update
- List pages = getPagesForConfig();
- ListIterator iter = pages.listIterator();
- while (iter.hasNext()) {
- BuildToolSettingsPage page = (BuildToolSettingsPage) iter.next();
- page.performOk();
- }
-
- // Write out the build model info
- ManagedBuildManager.setDefaultConfiguration(getProject(), getSelectedConfiguration());
- ManagedBuildManager.saveBuildInfo(getProject());
- return true;
- }
-
- private void populateConfigurations() {
- // If the config select widget is not there yet, just stop
- if (configSelector == null) return;
-
- // Find the configurations defined for the platform
- configurations = selectedTarget.getConfigurations();
-
- // Clear and replace the contents of the selector widget
- configSelector.removeAll();
- configSelector.setItems(getConfigurationNames());
-
- // Make sure the active configuration is selected
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
- IConfiguration defaultConfig = info.getDefaultConfiguration(selectedTarget);
- int index = configSelector.indexOf(defaultConfig.getName());
- configSelector.select(index == -1 ? 0 : index);
- handleConfigSelection();
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferencePageContainer#updateButtons()
- */
- public void updateButtons() {
- }
- /**
- * @see org.eclipse.jface.preference.IPreferencePageContainer#updateMessage()
- */
- public void updateMessage() {
- }
- /**
- * @see org.eclipse.jface.preference.IPreferencePageContainer#updateTitle()
- */
- public void updateTitle() {
- }
-}
\ No newline at end of file
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java
deleted file mode 100644
index a61611ce11c..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * **********************************************************************/
-
-import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.swt.graphics.Point;
-
-public class BuildToolSettingsPage extends FieldEditorPreferencePage {
-
- // Variables to help map this page back to an option category and tool
- private IConfiguration configuration;
- private IOptionCategory category;
-
- BuildToolSettingsPage(IConfiguration configuration, IOptionCategory category) {
- // Must be a grid layout and we don't want another set of buttons
- super(GRID);
- noDefaultAndApplyButton();
-
- // Cache the option category this page is created for
- this.configuration = configuration;
- this.category = category;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#computeSize()
- */
- public Point computeSize() {
- // TODO Auto-generated method stub
- return super.computeSize();
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
- protected void createFieldEditors() {
- // Get the preference store for the build settings
- IPreferenceStore settings = getPreferenceStore();
- setPreferenceStore(settings);
-
- // Iterate over the options in the category and create a field editor for each
- IOption[] options = category.getOptions(configuration);
- for (int index = 0; index < options.length; ++index) {
- // Get the option
- IOption opt = options[index];
- // Figure out which type the option is and add a proper field editor for it
- switch (opt.getValueType()) {
- case IOption.STRING :
- StringFieldEditor stringField = new StringFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
- addField(stringField);
- break;
- case IOption.BOOLEAN :
- BooleanFieldEditor booleanField = new BooleanFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
- addField(booleanField);
- break;
- case IOption.ENUMERATED :
- String sel;
- try {
- sel = opt.getSelectedEnum();
- } catch (BuildException e) {
- // If we get this exception, then the option type is wrong
- break;
- }
- BuildOptionComboFieldEditor comboField = new BuildOptionComboFieldEditor(opt.getId(), opt.getName(), opt.getApplicableValues(), sel, getFieldEditorParent());
- addField(comboField);
- break;
- case IOption.STRING_LIST :
- case IOption.INCLUDE_PATH :
- case IOption.PREPROCESSOR_SYMBOLS :
- case IOption.LIBRARIES :
- case IOption.OBJECTS:
- BuildOptionListFieldEditor listField = new BuildOptionListFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
- addField(listField);
- break;
- default :
- SummaryFieldEditor summaryField = new SummaryFieldEditor(opt.getId(), opt.getName(), category.getTool(), getFieldEditorParent());
- addField(summaryField);
- break;
-// default :
-// break;
- }
- }
- }
-
- /**
- * @return the option category the page was created for
- */
- public IOptionCategory getCategory() {
- return category;
- }
-
- /**
- * @see IPreferencePage#performOk()
- */
- public boolean performOk() {
- // Write the field editor contents out to the preference store
- boolean ok = super.performOk();
-
- // Write the preference store values back to the build model
- IOption[] options = category.getOptions(configuration);
- for (int i = 0; i < options.length; i++) {
- IOption option = options[i];
-
- // Transfer value from preference store to options
- switch (option.getValueType()) {
- case IOption.BOOLEAN :
- boolean boolVal = getPreferenceStore().getBoolean(option.getId());
- ManagedBuildManager.setOption(configuration, option, boolVal);
- break;
- case IOption.ENUMERATED :
- String enumVal = getPreferenceStore().getString(option.getId());
- ManagedBuildManager.setOption(configuration, option, enumVal);
- break;
- case IOption.STRING :
- String strVal = getPreferenceStore().getString(option.getId());
- ManagedBuildManager.setOption(configuration, option, strVal);
- break;
- case IOption.STRING_LIST :
- case IOption.INCLUDE_PATH :
- case IOption.PREPROCESSOR_SYMBOLS :
- case IOption.LIBRARIES :
- case IOption.OBJECTS:
- String listStr = getPreferenceStore().getString(option.getId());
- String[] listVal = BuildToolsSettingsStore.parseString(listStr);
- ManagedBuildManager.setOption(configuration, option, listVal);
- break;
- default :
- break;
- }
- }
-
- return ok;
- }
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java
deleted file mode 100644
index ab25886350b..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java
+++ /dev/null
@@ -1,441 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * **********************************************************************/
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-public class BuildToolsSettingsStore implements IPreferenceStore {
- public static final String DEFAULT_SEPERATOR = ";";
-
- // List of listeners on the property store
- private ListenerList listenerList;
- private Map optionMap;
- private boolean dirtyFlag;
- private IConfiguration owner;
-
- public BuildToolsSettingsStore (IConfiguration config) {
- listenerList = new ListenerList();
- dirtyFlag = false;
- owner = config;
-
- // Now populate the options map
- populateOptionMap();
- }
-
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- listenerList.add(listener);
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String)
- */
- public boolean contains(String name) {
- return getOptionMap().containsKey(name);
- }
-
- /**
- * Answers a String
containing the strings passed in the
- * argument separated by the DEFAULT_SEPERATOR
- *
- * @param items An array of strings
- * @return
- */
- public static String createList(String[] items) {
- StringBuffer path = new StringBuffer(""); //$NON-NLS-1$
-
- for (int i = 0; i < items.length; i++) {
- path.append(items[i]);
- if (i < (items.length - 1)) {
- path.append(DEFAULT_SEPERATOR);
- }
- }
- return path.toString();
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#firePropertyChangeEvent(java.lang.String, java.lang.Object, java.lang.Object)
- */
- public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
- Object[] listeners = listenerList.getListeners();
- if (listeners.length > 0 && (oldValue == null || !oldValue.equals(newValue)))
- {
- PropertyChangeEvent pe = new PropertyChangeEvent(this, name, oldValue, newValue);
- for (int i = 0; i < listeners.length; ++i)
- {
- IPropertyChangeListener l = (IPropertyChangeListener)listeners[i];
- l.propertyChange( pe );
- }
- }
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String)
- */
- public boolean getBoolean(String name) {
- Object b = getOptionMap().get(name);
- if (b instanceof Boolean)
- {
- return ((Boolean)b).booleanValue();
- }
- return false;
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String)
- */
- public boolean getDefaultBoolean(String name) {
- return false;
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultDouble(java.lang.String)
- */
- public double getDefaultDouble(String name) {
- return 0;
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultFloat(java.lang.String)
- */
- public float getDefaultFloat(String name) {
- return 0;
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultInt(java.lang.String)
- */
- public int getDefaultInt(String name) {
- return 0;
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultLong(java.lang.String)
- */
- public long getDefaultLong(String name) {
- return 0;
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultString(java.lang.String)
- */
- public String getDefaultString(String name) {
- return new String();
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#getDouble(java.lang.String)
- */
- public double getDouble(String name) {
- return getDefaultDouble(name);
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#getFloat(java.lang.String)
- */
- public float getFloat(String name) {
- return getDefaultFloat(name);
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#getInt(java.lang.String)
- */
- public int getInt(String name) {
- return getDefaultInt(name);
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String)
- */
- public long getLong(String name) {
- return getDefaultLong(name);
- }
-
- /* (non-javadoc)
- * Answers the map containing the strings associated with each option
- * ID.
- *
- * @return
- */
- private Map getOptionMap() {
- if (optionMap == null) {
- optionMap = new HashMap();
- }
- return optionMap;
- }
-
- private void getOptionsForCategory(IOptionCategory cat) {
- IOptionCategory [] children = cat.getChildCategories();
- // If there are child categories, add their options
- for (int i = 0; i < children.length; ++i) {
- getOptionsForCategory(children[i]);
- }
- // Else get the options for this category and add them to the map
- IOption [] options = cat.getOptions(owner);
- for (int j = 0; j < options.length; ++j) {
- IOption opt = options[j];
- String name = opt.getId();
- Object value;
- // Switch on the type of option
- switch (opt.getValueType()) {
- case IOption.BOOLEAN :
- try {
- value = new Boolean(opt.getBooleanValue());
- } catch (BuildException e) {
- // Exception occurs if there's an option value type mismatch
- break;
- }
- getOptionMap().put(name, value);
- break;
-
- case IOption.ENUMERATED :
- value = createList(opt.getApplicableValues());
- getOptionMap().put(name, value);
- break;
-
- case IOption.STRING :
- try {
- value = opt.getStringValue();
- } catch (BuildException e) {
- break;
- }
- getOptionMap().put(name, value);
- break;
-
- case IOption.STRING_LIST :
- try {
- value = createList(opt.getStringListValue());
- } catch (BuildException e) {
- break;
- }
- getOptionMap().put(name, value);
- break;
- case IOption.INCLUDE_PATH :
- try {
- value = createList(opt.getIncludePaths());
- } catch (BuildException e) {
- break;
- }
- getOptionMap().put(name, value);
- break;
- case IOption.PREPROCESSOR_SYMBOLS :
- try {
- value = createList(opt.getDefinedSymbols());
- } catch (BuildException e) {
- break;
- }
- getOptionMap().put(name, value);
- break;
- case IOption.LIBRARIES :
- try {
- value = createList(opt.getLibraries());
- } catch (BuildException e) {
- break;
- }
- getOptionMap().put(name, value);
- break;
- case IOption.OBJECTS :
- try {
- value = createList(opt.getUserObjects());
- } catch (BuildException e) {
- break;
- }
- getOptionMap().put(name, value);
- break;
- default :
- break;
- }
- }
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String)
- */
- public String getString(String name) {
- Object s = getOptionMap().get(name);
-
- if ( s instanceof String )
- {
- return (String)s;
- }
- return getDefaultString(name);
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String)
- */
- public boolean isDefault(String name) {
- return false;
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#needsSaving()
- */
- public boolean needsSaving() {
- return dirtyFlag;
- }
-
- public static String[] parseString(String stringList) {
- StringTokenizer tokenizer = new StringTokenizer(stringList, BuildToolsSettingsStore.DEFAULT_SEPERATOR);
- ArrayList list = new ArrayList();
- while (tokenizer.hasMoreElements()) {
- list.add(tokenizer.nextElement());
- }
- return (String[]) list.toArray(new String[list.size()]);
- }
-
- /**
- *
- */
- private void populateOptionMap() {
- // Each configuration has a list of tools
- ITool [] tools = owner.getTools();
- for (int index = 0; index < tools.length; ++index) {
- ITool tool = tools[index];
- IOptionCategory cat = tool.getTopOptionCategory();
- getOptionsForCategory(cat);
- }
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#putValue(java.lang.String, java.lang.String)
- */
- public void putValue(String name, String value) {
- Object oldValue = getOptionMap().get(name);
- if (oldValue == null || !oldValue.equals(value))
- {
- getOptionMap().put(name, value);
- setDirty(true);
- }
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, double)
- */
- public void setDefault(String name, double value) {
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, float)
- */
- public void setDefault(String name, float value) {
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, int)
- */
- public void setDefault(String name, int value) {
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, long)
- */
- public void setDefault(String name, long value) {
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, java.lang.String)
- */
- public void setDefault(String name, String defaultObject) {
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, boolean)
- */
- public void setDefault(String name, boolean value) {
- }
-
- protected void setDirty( boolean isDirty )
- {
- dirtyFlag = isDirty;
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#setToDefault(java.lang.String)
- */
- public void setToDefault(String name) {
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, double)
- */
- public void setValue(String name, double value) {
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, float)
- */
- public void setValue(String name, float value) {
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, int)
- */
- public void setValue(String name, int value) {
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, long)
- */
- public void setValue(String name, long value) {
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, java.lang.String)
- */
- public void setValue(String name, String value) {
- Object oldValue = getString(name);
- if (oldValue == null || !oldValue.equals(value))
- {
- getOptionMap().put(name, value);
- setDirty(true);
- firePropertyChangeEvent(name, oldValue, value);
- }
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, boolean)
- */
- public void setValue(String name, boolean value) {
- boolean oldValue = getBoolean(name);
- if (oldValue != value)
- {
- getOptionMap().put(name, new Boolean(value));
- setDirty(true);
- firePropertyChangeEvent(name, new Boolean(oldValue), new Boolean(value));
- }
-
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ManageConfigDialog.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ManageConfigDialog.java
deleted file mode 100644
index ddad7215c23..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ManageConfigDialog.java
+++ /dev/null
@@ -1,466 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
-***********************************************************************/
-
-import java.util.ArrayList;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
-import org.eclipse.cdt.utils.ui.controls.ControlFactory;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-public class ManageConfigDialog extends Dialog {
- // String constants
- private static final String CMN_PREFIX = "BuildPropertyCommon"; //$NON-NLS-1$
- private static final String CMN_LABEL = CMN_PREFIX + ".label"; //$NON-NLS-1$
- private static final String NEW = CMN_LABEL + ".new"; //$NON-NLS-1$
- private static final String REMOVE = CMN_LABEL + ".remove"; //$NON-NLS-1$
- private static final String PREFIX = "ManageConfig"; //$NON-NLS-1$
- private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
- private static final String RESTORE = LABEL + ".restore"; //$NON-NLS-1$
- private static final String GROUP = LABEL + ".makecmdgroup"; //$NON-NLS-1$
- private static final String DEF_BTN = LABEL + ".makecmddef"; //$NON-NLS-1$
- private static final String OUTPUT_GROUP = LABEL + ".output.group"; //$NON-NLS-1$
- private static final String OUTPUT_LABEL = LABEL + ".output.label"; //$NON-NLS-1$
- private static final String CONFIGS = LABEL + ".configs"; //$NON-NLS-1$
- private static final String CURRENT_CONFIGS = CONFIGS + ".current"; //$NON-NLS-1$
- private static final String DELETED_CONFIGS = CONFIGS + ".deleted"; //$NON-NLS-1$
- private static final String CONF_DLG = LABEL + ".new.config.dialog"; //$NON-NLS-1$
-
- // The name of the build artifact
- private String buildArtifact;
- // The list of configurations to delete
- private SortedMap deletedConfigs;
- // Map of configuration names and ids
- private SortedMap existingConfigs;
- // The make command associated with the target
- private String makeCommand;
- // The target the configs belong to
- private ITarget managedTarget;
- // Map of new configurations chosen by the user
- private SortedMap newConfigs;
- // The title of the dialog.
- private String title = "";
- // State of the check box on exit
- private boolean useDefaultMake;
-
- // Widgets
- protected Text buildArtifactEntry;
- protected List currentConfigList;
- protected List deletedConfigList;
- protected Button makeCommandDefault;
- protected Text makeCommandEntry;
- protected Button newBtn;
- protected Button okBtn;
- protected Button removeBtn;
- protected Button restoreBtn;
-
- /**
- * @param parentShell
- */
- protected ManageConfigDialog(Shell parentShell, String title, ITarget target) {
- super(parentShell);
- this.title = title;
- this.managedTarget = target;
-
- // Figure out the default make command
- makeCommand = managedTarget.getMakeCommand();
-
- // Get the name of the build artifact
- buildArtifact = managedTarget.getArtifactName();
-
- // Get the defined configurations from the target
- getExistingConfigs().clear();
- IConfiguration [] configs = managedTarget.getConfigurations();
- for (int i = 0; i < configs.length; i++) {
- IConfiguration configuration = configs[i];
- getExistingConfigs().put(configuration.getName(), configuration.getId());
- }
-
- getDeletedConfigs().clear();
- getNewConfigs().clear();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
- */
- protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- useDefaultMake = makeCommandDefault.getSelection();
- makeCommand = makeCommandEntry.getText().trim();
- buildArtifact = buildArtifactEntry.getText().trim();
- } else {
- useDefaultMake = true;
- buildArtifact = managedTarget.getArtifactName();
- }
- super.buttonPressed(buttonId);
- }
-
- /* (non-Javadoc)
- * Method declared in Window.
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- if (title != null)
- shell.setText(title);
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- // create OK and Cancel buttons by default
- okBtn = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
-
- updateButtons();
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite comp = ControlFactory.createComposite(parent, 1);
-
- // Create a group for the build output
- Group outputGroup = ControlFactory.createGroup(comp, ManagedBuilderUIPlugin.getResourceString(OUTPUT_GROUP), 1);
- outputGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
- Label outputLabel = ControlFactory.createLabel(outputGroup, ManagedBuilderUIPlugin.getResourceString(OUTPUT_LABEL));
- outputLabel.setLayoutData(new GridData());
- buildArtifactEntry = ControlFactory.createTextField(outputGroup);
- buildArtifactEntry.setText(buildArtifact);
- buildArtifactEntry.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- buildArtifactEntry = null;
- }
- });
-
- // Create the make command group area
- Group makeCommandGroup = ControlFactory.createGroup(comp, ManagedBuilderUIPlugin.getResourceString(GROUP), 1);
- GridData gd = new GridData(GridData.FILL_BOTH);
- makeCommandGroup.setLayoutData(gd);
- makeCommandDefault = ControlFactory.createCheckBox(makeCommandGroup, ManagedBuilderUIPlugin.getResourceString(DEF_BTN));
- setButtonLayoutData(makeCommandDefault);
- makeCommandDefault.setSelection(!managedTarget.hasOverridenMakeCommand());
- makeCommandDefault.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- handleUseDefaultPressed();
- }
- });
- makeCommandDefault.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- makeCommandDefault = null;
- }
- });
- makeCommandEntry = ControlFactory.createTextField(makeCommandGroup);
- makeCommandEntry.setEditable(!makeCommandDefault.getSelection());
- makeCommandEntry.setText(makeCommand);
- makeCommandEntry.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- makeCommandEntry = null;
- }
- });
-
-
- // Create the config list group area
- Group configListGroup = ControlFactory.createGroup(comp, ManagedBuilderUIPlugin.getResourceString(CONFIGS), 3);
- gd = new GridData(GridData.FILL_BOTH);
- configListGroup.setLayoutData(gd);
-
- // Create the 2 labels first to align the buttons and list controls
- Label currentConfigLabel = ControlFactory.createLabel(configListGroup, ManagedBuilderUIPlugin.getResourceString(CURRENT_CONFIGS));
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- currentConfigLabel.setLayoutData(gd);
- Label deletedConfigLabel = ControlFactory.createLabel(configListGroup, ManagedBuilderUIPlugin.getResourceString(DELETED_CONFIGS));
- deletedConfigLabel.setLayoutData(new GridData());
-
- // Create the current config list
- Composite currentComp = ControlFactory.createComposite(configListGroup, 1);
- gd = new GridData(GridData.FILL_BOTH);
- gd.horizontalSpan = 1;
- currentComp.setLayoutData(gd);
- currentConfigList = new List(currentComp, SWT.SINGLE|SWT.V_SCROLL|SWT.H_SCROLL|SWT.BORDER);
- gd = new GridData(GridData.FILL_BOTH);
- gd.widthHint = 100;
- currentConfigList.setLayoutData(gd);
- currentConfigList.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- currentConfigList = null;
- }
- });
-
- // Create a composite for the buttons
- Composite buttonBar = ControlFactory.createComposite(configListGroup, 1);
- buttonBar.setLayoutData(new GridData());
-
- newBtn = ControlFactory.createPushButton(buttonBar, ManagedBuilderUIPlugin.getResourceString(NEW));
- setButtonLayoutData(newBtn);
- newBtn.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- handleNewPressed();
- }
- });
- newBtn.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- newBtn = null;
- }
- });
- removeBtn = ControlFactory.createPushButton(buttonBar, ManagedBuilderUIPlugin.getResourceString(REMOVE));
- setButtonLayoutData(removeBtn);
- removeBtn.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- handleRemovePressed();
- }
- });
- removeBtn.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- removeBtn = null;
- }
- });
- restoreBtn = ControlFactory.createPushButton(buttonBar, ManagedBuilderUIPlugin.getResourceString(RESTORE));
- setButtonLayoutData(restoreBtn);
- restoreBtn.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- handleRestorePressed();
- }
- });
- restoreBtn.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- restoreBtn = null;
- }
- });
-
- // Create the deleted config list
- Composite deletedComp = ControlFactory.createComposite(configListGroup, 1);
- gd = new GridData(GridData.FILL_BOTH);
- gd.horizontalSpan = 1;
- deletedComp.setLayoutData(gd);
- deletedConfigList = new List(deletedComp, SWT.SINGLE|SWT.V_SCROLL|SWT.H_SCROLL|SWT.BORDER);
- gd = new GridData(GridData.FILL_BOTH);
- gd.widthHint = 100;
- deletedConfigList.setLayoutData(gd);
- deletedConfigList.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- deletedConfigList = null;
- }
- });
-
- // Do the final widget prep
- currentConfigList.setItems(getConfigurationNames());
- currentConfigList.select(0);
- newBtn.setFocus();
- return comp;
- }
-
- /**
- *
- */
- protected void handleUseDefaultPressed() {
- // If the state of the button is unchecked, then we want to enable the edit widget
- makeCommandEntry.setEditable(!makeCommandDefault.getSelection());
- }
-
- /**
- * Answers the value in the build artifact entry widget.
- *
- * @return
- */
- public String getBuildArtifactName() {
- return buildArtifact;
- }
-
- private String [] getConfigurationNames() {
- return (String[]) getExistingConfigs().keySet().toArray(new String[getExistingConfigs().size()]);
- }
-
- /* (non-javadoc)
- * Answers a SortedMap
of IConfiguration
names to unique IDs.
- *
- * @return
- */
- protected SortedMap getDeletedConfigs() {
- if (deletedConfigs == null) {
- deletedConfigs = new TreeMap();
- }
- return deletedConfigs;
- }
-
- /**
- * Answers a List
of unique IDs corresponding to the IConfigurations
- * the user wishes to remove from the ITarget
- * @return
- */
- public ArrayList getDeletedConfigIds() {
- return new ArrayList(getDeletedConfigs().values());
- }
-
- protected SortedMap getExistingConfigs() {
- if (existingConfigs == null) {
- existingConfigs = new TreeMap();
- }
- return existingConfigs;
- }
-
- /**
- * Answers the value in the make command entry widget.
- *
- * @return
- */
- public String getMakeCommand() {
- return makeCommand;
- }
-
- /**
- * Answers a map of configuration names to IConfiguration
.
- * The name is selected by the user and should be unique for the target
- * it will be added to. The configuration is the what the new
- * configuration will be based on.
- *
- * @return Map
- */
- public SortedMap getNewConfigs() {
- if (newConfigs == null) {
- newConfigs = new TreeMap();
- }
- return newConfigs;
- }
-
- /*
- * @return the IProject
associated with the target
- */
- private IProject getProject() {
- return managedTarget.getOwner().getProject();
- }
-
- /*
- * Event handler for the add button
- */
- protected void handleNewPressed() {
- // Find the defined target
- ITarget parentTarget = null;
- ITarget [] targets = ManagedBuildManager.getDefinedTargets(getProject());
- for (int i = 0; i < targets.length; i++) {
- ITarget target = targets[i];
- if (target.getId().equals(managedTarget.getParent().getId())) {
- parentTarget = target;
- break;
- }
- }
- // Get all the predefined configs
- IConfiguration [] allDefinedConfigs = null;
- if (parentTarget != null) {
- allDefinedConfigs = parentTarget.getConfigurations();
- }
-
- // There should be predefined configurations ....
- if (allDefinedConfigs != null && allDefinedConfigs.length != 0) {
- NewConfigurationDialog dialog = new NewConfigurationDialog(getShell(),
- allDefinedConfigs,
- managedTarget,
- ManagedBuilderUIPlugin.getResourceString(CONF_DLG));
- if (dialog.open() == NewConfigurationDialog.OK) {
- // Get the new name and configuration to base the new config on
- String newConfigName = dialog.getNewName();
- getNewConfigs().put(newConfigName, dialog.getParentConfiguration());
- currentConfigList.add(newConfigName);
- currentConfigList.setSelection(currentConfigList.getItemCount() - 1);
- }
- }
-
- // Update the buttons based on the choices
- updateButtons();
- }
-
- /* (non-javadoc)
- * Event handler for the remove button
- */
- protected void handleRemovePressed() {
- // Determine which configuration was selected
- int selectionIndex = currentConfigList.getSelectionIndex();
- if (selectionIndex != -1){
- String selectedConfigName = currentConfigList.getItem(selectionIndex);
- String selectedConfigId = null;
-
- // If this is a newly added config, remove it from that map
- if (getNewConfigs().containsKey(selectedConfigName)) {
- selectedConfigId = (String) getNewConfigs().get(selectedConfigName);
- getNewConfigs().remove(selectedConfigName);
- }
-
- // If it is not a new item, the ID is in the existing list
- selectedConfigId = (String) getExistingConfigs().get(selectedConfigName);
- getDeletedConfigs().put(selectedConfigName, selectedConfigId);
-
- // Clean up the UI lists
- currentConfigList.remove(selectionIndex);
- currentConfigList.setSelection(selectionIndex - 1);
- deletedConfigList.add(selectedConfigName);
- deletedConfigList.setSelection(deletedConfigList.getItemCount() - 1);
- updateButtons();
- }
- }
-
- /* (non-javadoc)
- * Event handler for the restore button
- */
- protected void handleRestorePressed() {
- // Determine which configuration was selected
- int selectionIndex = deletedConfigList.getSelectionIndex();
- // Move the selected element from the deleted list to the current list
- if (selectionIndex != -1){
- // Get the name of the item to delete
- String selectedConfigName = deletedConfigList.getItem(selectionIndex);
- String selectedConfigId = (String) getDeletedConfigs().get(selectedConfigName);
-
- // If this was a new config (it won't be in the existing list) then add it back there
- if (!getExistingConfigs().containsKey(selectedConfigName)) {
- getNewConfigs().put(selectedConfigName, selectedConfigId);
- }
-
- // Remove it from the deleted map
- getDeletedConfigs().remove(selectedConfigName);
-
- // Clean up the UI
- deletedConfigList.remove(selectionIndex);
- deletedConfigList.setSelection(selectionIndex - 1);
- currentConfigList.add(selectedConfigName);
- currentConfigList.setSelection(currentConfigList.getItemCount());
- updateButtons();
- }
- }
-
- private void updateButtons() {
- // Disable the remove button if there is only 1 configuration
- removeBtn.setEnabled(currentConfigList.getItemCount() > 1);
- // Enable the restore button if there is anything in the deleted list
- restoreBtn.setEnabled(deletedConfigList.getItemCount() > 0);
- }
-
- public boolean useDefaultMakeCommand () {
- return useDefaultMake;
- }
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/NewConfigurationDialog.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/NewConfigurationDialog.java
deleted file mode 100644
index 2a98b4a464d..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/NewConfigurationDialog.java
+++ /dev/null
@@ -1,219 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
-import org.eclipse.cdt.utils.ui.controls.ControlFactory;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
-***********************************************************************/
-
-public class NewConfigurationDialog extends Dialog {
- // String constants
- private static final String PREFIX = "NewConfiguration"; //$NON-NLS-1$
- private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
- private static final String ERROR = PREFIX + ".error"; //$NON-NLS-1$
- private static final String NAME = LABEL + ".name"; //$NON-NLS-1$
- private static final String COPY = LABEL + ".copy"; //$NON-NLS-1$
- private static final String TITLE = ERROR + ".title"; //$NON-NLS-1$
- private static final String DUPLICATE = ERROR + ".duplicateName"; //$NON-NLS-1$
-
- // Widgets
- private Combo configSelector;
- private Button btnOk;
- private Text configName;
-
- // Bookeeping
- private IConfiguration[] definedConfigurations;
- private IConfiguration parentConfig;
- private ITarget target;
- private String newName;
- private String [] allNames;
- private String title = "";
-
-
- /**
- * @param parentShell
- */
- protected NewConfigurationDialog(Shell parentShell, IConfiguration[] configs, ITarget managedTarget, String title) {
- super(parentShell);
- this.title = title;
- setShellStyle(getShellStyle()|SWT.RESIZE);
- newName = new String();
- parentConfig = null;
- definedConfigurations = configs == null ? new IConfiguration[0] : configs;
- allNames = getConfigurationNames();
- this.target = managedTarget;
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog. Cache the name and base config selections.
- * We don't have to worry that the index or name is wrong because we
- * enable the OK button IFF those conditions are met.
- */
- protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- newName = configName.getText().trim();
- String baseConfigName = configSelector.getItem(configSelector.getSelectionIndex());
- for (int i = 0; i < definedConfigurations.length; i++) {
- IConfiguration config = definedConfigurations[i];
- if (config.getName().equals(baseConfigName)) {
- parentConfig = config;
- break;
- }
- }
- } else {
- newName = null;
- parentConfig = null;
- }
- super.buttonPressed(buttonId);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- if (title != null)
- shell.setText(title);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
- */
- protected void createButtonsForButtonBar(Composite parent) {
- btnOk = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- configName.setFocus();
- if (configName != null) {
- configName.setText(newName);
- }
- updateButtonState();
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite composite = ControlFactory.createComposite(parent, 3);
- GridData gd;
-
- // Add a label and a text widget
- Label nameLabel = ControlFactory.createLabel(composite, ManagedBuilderUIPlugin.getResourceString(NAME));
- gd = new GridData();
- gd.horizontalSpan = 1;
- nameLabel.setLayoutData(gd);
- configName = ControlFactory.createTextField(composite);
- gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan = 2;
- configName.setLayoutData(gd);
- configName.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateButtonState();
- }
- });
-
- // Add a label and combo box to select the base config
- Label configLabel = ControlFactory.createLabel(composite, ManagedBuilderUIPlugin.getResourceString(COPY));
- gd = new GridData();
- gd.horizontalSpan = 1;
- configLabel.setLayoutData(gd);
- configSelector = ControlFactory.createSelectCombo(composite, allNames, newName);
- gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan = 2;
- configSelector.setLayoutData(gd);
- configSelector.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateButtonState();
- }
- });
-
- return composite;
- }
-
- /**
- * @return the IConfiguration
the user selected as
- * the parent of the new configuration.
- */
- public IConfiguration getParentConfiguration() {
- return parentConfig;
- }
-
- /*
- * Returns an array of configuration names
- */
- private String [] getConfigurationNames() {
- String [] names = new String[definedConfigurations.length];
- for (int index = 0; index < definedConfigurations.length; ++index) {
- IConfiguration config = definedConfigurations[index];
- names[index] = config.getName();
- }
- return names;
- }
-
- /**
- * @return String
containing the name chosen by the user for the
- * new configuration.
- */
- public String getNewName() {
- return newName;
- }
-
- protected boolean isDuplicateName(String newName) {
- // Return true if there is already a config of that name defined on the target
- IConfiguration [] configs = target.getConfigurations();
- for (int index = 0; index < configs.length; index++) {
- IConfiguration configuration = configs[index];
- if (configuration.getName() == newName) {
- return true;
- }
- }
- return false;
- }
-
- /*
- * Enable the OK button if there is a valid name in the text widget
- * and there is a valid selection in the base configuration combo
- */
- private void updateButtonState() {
- if (btnOk != null) {
- int selectionIndex = configSelector.getSelectionIndex();
- btnOk.setEnabled(validateName() && selectionIndex != -1);
- }
- }
-
- private boolean validateName() {
- String currentName = configName.getText().trim();
- int nameLength = currentName.length();
- // Make sure the name is not a duplicate
- if (isDuplicateName(currentName)) {
- MessageDialog.openError(getShell(),
- ManagedBuilderUIPlugin.getResourceString(TITLE),
- ManagedBuilderUIPlugin.getFormattedString(DUPLICATE, currentName)); //$NON-NLS-1$
- return false;
- }
- // TODO make sure there are no invalid chars in name
- return (nameLength > 0);
- }
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/SummaryFieldEditor.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/SummaryFieldEditor.java
deleted file mode 100644
index ad2ed4c10c8..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/SummaryFieldEditor.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
-***********************************************************************/
-
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-public class SummaryFieldEditor extends FieldEditor {
- // Whitespace character
- private static final String WHITESPACE = " ";
-
- // The top level composite
- protected Composite parent;
- // The tool this category belongs to
- protected ITool tool;
- // The text widget to hold summary of all commands for the tool
- protected Text summary;
-
- /**
- * @param name
- * @param labelText
- * @param parent
- */
- public SummaryFieldEditor(String name, String labelText, ITool tool, Composite parent) {
- super(name, labelText, parent);
- this.tool = tool;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
- */
- protected void adjustForNumColumns(int numColumns) {
- // For now grab the excess space
- GridData gd = (GridData) summary.getLayoutData();
- gd.horizontalSpan = numColumns - 1;
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int)
- */
- protected void doFillIntoGrid(Composite parent, int numColumns) {
- this.parent = parent;
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = numColumns;
- this.parent.setLayoutData(gd);
-
- // Add the label
- Label label = getLabelControl(parent);
- GridData labelData = new GridData();
- labelData.horizontalSpan = numColumns;
- label.setLayoutData(labelData);
-
- // Create the multi-line, read-only field
- summary = new Text(parent, SWT.MULTI|SWT.READ_ONLY|SWT.WRAP);
- GridData summaryData = new GridData(GridData.FILL_BOTH);
- summaryData.horizontalSpan = numColumns;
- summary.setLayoutData(summaryData);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doLoad()
- */
- protected void doLoad() {
- // Look at the data store for every option defined for the tool
-// IOption[] options = tool.getOptions();
-// for (int index = 0; index < options.length; ++index) {
-// IOption option = options[index];
-// String command = option.getCommand();
-// if (command == null) {
-// command = "";
-// }
-// String id = option.getId();
-// String values = getPreferenceStore().getString(id);
-// String[] valuesList = BuildToolsSettingsStore.parseString(values);
-// for (int j = 0; j < valuesList.length; ++j) {
-// String entry = valuesList[j];
-// summary.append(command + entry + WHITESPACE);
-// }
-// }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
- */
- protected void doLoadDefault() {
- doLoad();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doStore()
- */
- protected void doStore() {
- // This is a read-only summary field, so don't store data
- return;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls()
- */
- public int getNumberOfControls() {
- // There is just the label from the parent and the text field
- return 2;
- }
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListContentProvider.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListContentProvider.java
deleted file mode 100644
index 2114a8f88c3..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListContentProvider.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * Timesys - Initial API and implementation
- * IBM Rational Software
- * *********************************************************************/
-
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-public class ToolListContentProvider implements ITreeContentProvider{
- private static Object[] EMPTY_ARRAY = new Object[0];
- private IConfiguration root;
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object parentElement) {
- // If parent is configuration, return a list of its option categories
- if (parentElement instanceof IConfiguration) {
- IConfiguration config = (IConfiguration)parentElement;
- ITool [] tools = config.getTools();
- IOptionCategory [] categories = new IOptionCategory[tools.length];
- // The categories are accessed through the tool
- for (int index = 0; index < tools.length; ++index) {
- categories[index] = tools[index].getTopOptionCategory();
- }
- return categories;
- } else if (parentElement instanceof IOptionCategory) {
- // Categories can have child categories
- IOptionCategory cat = (IOptionCategory)parentElement;
- IOptionCategory [] children = cat.getChildCategories();
- if (children == null) {
- return EMPTY_ARRAY;
- } else {
- return children;
- }
- } else {
- return EMPTY_ARRAY;
- }
- }
-
- /**
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- */
- public Object getParent(Object element) {
- if (element instanceof IOptionCategory) {
- // Find the parent category
- IOptionCategory cat = (IOptionCategory)element;
- IOptionCategory parent = cat.getOwner();
- // Then we need to get the configuration we belong to
- if (parent == null) {
- ITool tool = cat.getTool();
- return root;
- }
- return parent;
- }
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
- public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- root = (IConfiguration) newInput;
- }
-}
-
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListLabelProvider.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListLabelProvider.java
deleted file mode 100644
index f1b1d7311c7..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListLabelProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * **********************************************************************/
-
-import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIImages;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-class ToolListLabelProvider extends LabelProvider {
- private final Image IMG_TOOL = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_BUILD_TOOL);
- private final Image IMG_CAT = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_BUILD_CAT);
- private static final String TREE_LABEL = "BuildPropertyPage.label.ToolTree"; //$NON-NLS-1$
-
- public Image getImage(Object element) {
- // If the element is a configuration, return the folder image
- if (element instanceof IOptionCategory) {
- IOptionCategory cat = (IOptionCategory)element;
- IOptionCategory [] children = cat.getChildCategories();
- if (children.length > 0){
- return IMG_TOOL;
- } else {
- return IMG_CAT;
- }
- } else {
- throw unknownElement(element);
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(Object)
- */
- public String getText(Object element) {
- if (element instanceof IOptionCategory) {
- IOptionCategory cat = (IOptionCategory)element;
- return cat.getName();
- }
- else {
- throw unknownElement(element);
- }
- }
-
- protected RuntimeException unknownElement(Object element) {
- return new RuntimeException("Unknown type of element in tree of type " + element.getClass().getName());
- }
-}
\ No newline at end of file
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
deleted file mode 100644
index 4d8a8bd566a..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
+++ /dev/null
@@ -1,229 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.wizards;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
-***********************************************************************/
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderHelpContextIds;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
-import org.eclipse.cdt.utils.ui.controls.ControlFactory;
-import org.eclipse.core.boot.BootLoader;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class CProjectPlatformPage extends WizardPage {
- /*
- * Bookeeping variables
- */
- private ArrayList selectedConfigurations;
- protected ITarget selectedTarget;
- protected String[] targetNames;
- protected ArrayList targets;
-
- /*
- * Dialog variables and string constants
- */
- protected Combo platformSelection;
- protected CheckboxTableViewer tableViewer;
- private static final String PREFIX = "PlatformBlock"; //$NON-NLS-1$
- private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
- private static final String TIP = PREFIX + ".tip"; //$NON-NLS-1$
- private static final String PLATFORM_TIP = TIP + ".platform"; //$NON-NLS-1$
- private static final String PLATFORM_LABEL = LABEL + ".platform"; //$NON-NLS-1$
- private static final String CONFIG_LABEL = LABEL + ".configs"; //$NON-NLS-1$
-
- /**
- * Constructor.
- * @param wizard
- * @param pageName
- */
- public CProjectPlatformPage(String pageName) {
- super(pageName);
- setPageComplete(false);
- populateTargets();
- selectedTarget = null;
- selectedConfigurations = new ArrayList(0);
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizardPage#canFlipToNextPage()
- */
- public boolean canFlipToNextPage() {
- return validatePage();
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- // Create the composite control for the tab
- Composite composite = ControlFactory.createComposite(parent, 6);
-
- // Create the platform selection label and combo widgets
- Label platformLabel = ControlFactory.createLabel(composite, ManagedBuilderUIPlugin.getResourceString(PLATFORM_LABEL));
- platformLabel.setLayoutData(new GridData());
-
- platformSelection = ControlFactory.createSelectCombo(composite, targetNames, null);
-// platformSelection.setToolTipText(ManagedBuilderUIPlugin.getResourceString(PLATFORM_TIP));
- platformSelection.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- handleTargetSelection();
- }
- });
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 5;
- platformSelection.setLayoutData(gd);
-
- // Create a check box table of valid configurations
- Label configLabel = ControlFactory.createLabel(composite, ManagedBuilderUIPlugin.getResourceString(CONFIG_LABEL));
- configLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.MULTI
- | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
- gd = new GridData(GridData.FILL_BOTH);
- gd.horizontalSpan = 6;
- table.setLayoutData(gd);
- table.setHeaderVisible(true);
- table.setLinesVisible(false);
-
- // Add a table layout to the table
- TableLayout tableLayout = new TableLayout();
- table.setHeaderVisible(false);
- table.setLayout(tableLayout);
-
- // Add the viewer
- tableViewer = new CheckboxTableViewer(table);
- tableViewer.setLabelProvider(new ConfigurationLabelProvider());
- tableViewer.setContentProvider(new ConfigurationContentProvider());
- tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- // will default to false until a selection is made
- handleConfigurationSelectionChange();
- }
- });
-
- // Select the first target in the list
- handleTargetSelection();
-
- // Setup the help information
- WorkbenchHelp.setHelp(composite, ManagedBuilderHelpContextIds.MAN_PROJ_PLATFORM_HELP);
-
- // Do the nasty
- setErrorMessage(null);
- setMessage(null);
- setControl(composite);
- }
-
- public IConfiguration[] getSelectedConfigurations() {
- return (IConfiguration[]) selectedConfigurations.toArray(new IConfiguration[selectedConfigurations.size()]);
- }
-
- /**
- * Returns the name of the selected platform.
- *
- * @return String containing platform name or null
if an invalid selection
- * has been made.
- */
- public ITarget getSelectedTarget() {
- return selectedTarget;
- }
-
- private void handleConfigurationSelectionChange() {
- // Get the selections from the table viewer
- selectedConfigurations.clear();
- selectedConfigurations.addAll(Arrays.asList(tableViewer.getCheckedElements()));
- }
-
- /**
- * Returns whether this page's controls currently all contain valid
- * values.
- *
- * @return true
if all controls are valid, and
- * false
if at least one is invalid
- */
- protected void handleTargetSelection() {
- /*
- * The index in the combo is the offset into the target list
- */
- int index;
- if (platformSelection != null
- && (index = platformSelection.getSelectionIndex()) != -1) {
- selectedTarget = (ITarget) targets.get(index);
- }
- populateConfigurations();
- setPageComplete(validatePage());
- }
-
- /**
- * Populate the table viewer with the known configurations.
- * By default, all the configurations are selected.
- */
- private void populateConfigurations() {
- // Make the root of the content provider the new target
- tableViewer.setInput(selectedTarget);
- tableViewer.setAllChecked(true);
- handleConfigurationSelectionChange();
- }
-
- private void populateTargetNames() {
- targetNames = new String[targets.size()];
- ListIterator iter = targets.listIterator();
- int index = 0;
- while (iter.hasNext()) {
- targetNames[index++] = ((ITarget) iter.next()).getName();
- }
- }
-
- private void populateTargets() {
- // Get a list of platforms defined by plugins
- ITarget[] allTargets = ManagedBuildManager.getDefinedTargets(null);
- targets = new ArrayList();
- String os = BootLoader.getOS();
- // Add all of the concrete targets to the target list
- for (int index = 0; index < allTargets.length; ++index) {
- ITarget target = allTargets[index];
- if (!target.isAbstract() && !target.isTestTarget()) {
- List targetOSList = Arrays.asList(target.getTargetOSList());
- if (targetOSList.contains(os)) {
- targets.add(target);
- }
- }
- }
- targets.trimToSize();
- populateTargetNames();
- }
-
- /**
- * @return
- */
- private boolean validatePage() {
- // TODO Auto-generated method stub
- return true;
- }
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConfigurationContentProvider.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConfigurationContentProvider.java
deleted file mode 100644
index 27db61034bd..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConfigurationContentProvider.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.wizards;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
-***********************************************************************/
-
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-public class ConfigurationContentProvider implements IStructuredContentProvider {
- // The contents of the parent of the table is a list of configurations
- public Object[] getElements(Object parent) {
- // The content is a list of configurations
- IConfiguration[] configs = ((ITarget) parent).getConfigurations();
- return (configs.length == 0) ? new Object[0] : configs;
- }
-
- public void dispose() {
- }
-
- public void inputChanged(
- Viewer viewer,
- Object oldInput,
- Object newInput) {
- }
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConfigurationLabelProvider.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConfigurationLabelProvider.java
deleted file mode 100644
index 229c1bfbc7c..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConfigurationLabelProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.wizards;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
-***********************************************************************/
-
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIImages;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-public class ConfigurationLabelProvider extends LabelProvider implements ITableLabelProvider {
- private final Image IMG_CFG =
- ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_BUILD_CONFIG);
-
- //
- public String getColumnText(Object obj, int index) {
- if (obj instanceof IConfiguration) {
- return ((IConfiguration) obj).getName();
- }
- return new String();
- }
-
- public Image getColumnImage(Object obj, int index) {
- return IMG_CFG;
- }
-}
-
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedCCProjectWizard.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedCCProjectWizard.java
deleted file mode 100644
index f03be1dab46..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedCCProjectWizard.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.wizards;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * **********************************************************************/
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-public class NewManagedCCProjectWizard extends NewManagedProjectWizard {
- private static final String WZ_TITLE = "MngCCWizard.title"; //$NON-NLS-1$
- private static final String WZ_DESC = "MngCCWizard.description"; //$NON-NLS-1$
- private static final String SETTINGS_TITLE = "MngCCWizardSettings.title"; //$NON-NLS-1$
- private static final String SETTINGS_DESC = "MngCCWizardSettings.description"; //$NON-NLS-1$
- private static final String MSG_CREATE = "MngCCWizard.message.creating"; //$NON-NLS-1$
-
- public NewManagedCCProjectWizard() {
- this(ManagedBuilderUIPlugin.getResourceString(WZ_TITLE), ManagedBuilderUIPlugin.getResourceString(WZ_DESC));
- }
-
- public NewManagedCCProjectWizard(String title, String desc) {
- super(title, desc);
- }
-
- public void addPages() {
- // Add the default page for all new managed projects
- super.addPages();
- }
-
- protected void doRun(IProgressMonitor monitor) throws CoreException {
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
- monitor.beginTask(ManagedBuilderUIPlugin.getResourceString(MSG_CREATE), 8); //$NON-NLS-1$
- super.doRun(new SubProgressMonitor(monitor, 7));
- // Add C++ Nature.
- if (newProject != null) {
- // Add C++ Nature to the newly created project.
- CCorePlugin.getDefault().convertProjectFromCtoCC(newProject, new SubProgressMonitor(monitor, 1));
- }
- monitor.done();
- }
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedCProjectWizard.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedCProjectWizard.java
deleted file mode 100644
index d935a187ba3..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedCProjectWizard.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.wizards;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * **********************************************************************/
-
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
-
-public class NewManagedCProjectWizard extends NewManagedProjectWizard {
- // String constants
- private static final String WZ_TITLE = "MngCWizard.title";
- private static final String WZ_DESC = "MngCWizard.description";
- private static final String SETTINGS_TITLE= "MngCWizardSettings.title"; //$NON-NLS-1$
- private static final String SETTINGS_DESC= "MngCWizardSettings.description"; //$NON-NLS-1$
-
- public NewManagedCProjectWizard() {
- this(ManagedBuilderUIPlugin.getResourceString(WZ_TITLE), ManagedBuilderUIPlugin.getResourceString(WZ_DESC));
- }
-
- public NewManagedCProjectWizard(String title, String description) {
- super(title, description);
- }
-
- public void addPages() {
- // Add the default page for all new managed projects
- super.addPages();
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java
deleted file mode 100644
index 11a21b25bbb..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.wizards;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * **********************************************************************/
-
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedProjectOptionBlock;
-import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
-import org.eclipse.cdt.ui.dialogs.ReferenceBlock;
-import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
-import org.eclipse.cdt.ui.wizards.NewCProjectWizard;
-import org.eclipse.cdt.ui.wizards.NewCProjectWizardOptionPage;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.Preferences;
-
-public class NewManagedProjectOptionPage extends NewCProjectWizardOptionPage {
-
- public class ManagedWizardOptionBlock extends ManagedProjectOptionBlock {
-
- public ManagedWizardOptionBlock(ICOptionContainer parent) {
- super(parent);
- }
-
- protected void addTabs() {
- addTab(new ReferenceBlock());
- }
- }
-
- /**
- * @param pageName
- */
- public NewManagedProjectOptionPage(String pageName) {
- super(pageName);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.ui.wizards.NewCProjectWizardOptionPage#createOptionBlock()
- */
- protected TabFolderOptionBlock createOptionBlock() {
- return new ManagedWizardOptionBlock(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.ui.dialogs.ICOptionContainer#getProject()
- */
- public IProject getProject() {
- return ((NewCProjectWizard)getWizard()).getNewProject();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.ui.dialogs.ICOptionContainer#getPreferenceStore()
- */
- public Preferences getPreferences() {
- return ManagedBuilderUIPlugin.getDefault().getPluginPreferences();
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java
deleted file mode 100644
index 968f821f726..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package org.eclipse.cdt.managedbuilder.ui.wizards;
-
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * **********************************************************************/
-
-import java.util.Random;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
-import org.eclipse.cdt.ui.wizards.NewCProjectWizard;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-
-public class NewManagedProjectWizard extends NewCProjectWizard {
-
- /* (non-Javadoc)
- * String constants
- */
- protected static final String PREFIX = "MngMakeProjectWizard"; //$NON-NLS-1$
- protected static final String OP_ERROR = PREFIX + ".op_error"; //$NON-NLS-1$
- protected static final String WZ_TITLE = PREFIX + ".title"; //$NON-NLS-1$
- protected static final String WZ_DESC = PREFIX + ".description"; //$NON-NLS-1$
- protected static final String CONF_TITLE = PREFIX + ".config.title"; //$NON-NLS-1$
- protected static final String CONF_DESC = PREFIX + ".config.desc"; //$NON-NLS-1$
- protected static final String OPTIONS_TITLE = PREFIX + ".options.title"; //$NON-NLS-1$
- protected static final String OPTIONS_DESC = PREFIX + ".options.desc"; //$NON-NLS-1$
- protected static final String MSG_ADD_NATURE = PREFIX + ".message.add_nature"; //$NON-NLS-1$
- protected static final String MSG_ADD_BUILDER = PREFIX + ".message.add_builder"; //$NON-NLS-1$
- protected static final String MSG_SAVE = PREFIX + ".message.save"; //$NON-NLS-1$
- protected static final String SETTINGS_TITLE = "MngMakeWizardSettings.title"; //$NON-NLS-1$
- protected static final String SETTINGS_DESC = "MngMakeWizardSettings.description"; //$NON-NLS-1$
-
- // Wizard pages
- protected CProjectPlatformPage targetConfigurationPage;
- protected NewManagedProjectOptionPage optionPage;
-
- public NewManagedProjectWizard() {
- this(ManagedBuilderUIPlugin.getResourceString(WZ_TITLE), ManagedBuilderUIPlugin.getResourceString(WZ_DESC));
- }
-
- public NewManagedProjectWizard(String title, String description) {
- super(title, description);
- }
-
- public void addPages() {
- // Add the default page for all new projects
- super.addPages();
-
- // Add the configuration selection page
- targetConfigurationPage = new CProjectPlatformPage(PREFIX);
- targetConfigurationPage.setTitle(ManagedBuilderUIPlugin.getResourceString(CONF_TITLE));
- targetConfigurationPage.setDescription(ManagedBuilderUIPlugin.getResourceString(CONF_DESC));
- addPage(targetConfigurationPage);
-
- // Add the options (tabbed) page
- optionPage = new NewManagedProjectOptionPage(PREFIX);
- optionPage.setTitle(ManagedBuilderUIPlugin.getResourceString(OPTIONS_TITLE));
- optionPage.setDescription(ManagedBuilderUIPlugin.getResourceString(OPTIONS_DESC));
- addPage(optionPage);
- }
-
- protected void doRun(IProgressMonitor monitor) throws CoreException {
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
-
- // super.doRun() just creates the project and does not assign a builder to it.
- super.doRun(new SubProgressMonitor(monitor, 5));
-
- // Add the managed build nature
- try {
- monitor.subTask(ManagedBuilderUIPlugin.getResourceString(MSG_ADD_NATURE));
- ManagedCProjectNature.addManagedNature(newProject, new SubProgressMonitor(monitor, 1));
- } catch (CoreException e) {
- // Bail out of the project creation
- }
- // Add the builder
- try {
- monitor.subTask(ManagedBuilderUIPlugin.getResourceString(MSG_ADD_BUILDER));
- ManagedCProjectNature.addManagedBuilder(newProject, new SubProgressMonitor(monitor, 1));
- } catch (CoreException e) {
- // Bail out of the project creation
- }
-
- // Modify the project settings
- if (newProject != null) {
- optionPage.performApply(new SubProgressMonitor(monitor, 2));
- }
-
- // Add the target to the project
- ITarget newTarget = null;
- try {
- ITarget parent = targetConfigurationPage.getSelectedTarget();
- newTarget = ManagedBuildManager.createTarget(newProject, parent);
- if (newTarget != null) {
- String artifactName = newProject.getName();
- artifactName += parent.getDefaultExtension().length() == 0 ? "" : "." + parent.getDefaultExtension();
- newTarget.setBuildArtifact(artifactName);
- IConfiguration [] selectedConfigs = targetConfigurationPage.getSelectedConfigurations();
- Random r = new Random();
- r.setSeed(System.currentTimeMillis());
- for (int i = 0; i < selectedConfigs.length; i++) {
- IConfiguration config = selectedConfigs[i];
- int id = r.nextInt();
- if (id < 0) {
- id *= -1;
- }
- newTarget.createConfiguration(config, config.getId() + "." + id);
- }
- // Now add the first config in the list as the default
- IConfiguration[] newConfigs = newTarget.getConfigurations();
- if (newConfigs.length > 0) {
- ManagedBuildManager.setDefaultConfiguration(newProject, newConfigs[0]);
- }
- }
- } catch (BuildException e) {
- // TODO Flag the error to the user
- }
-
- // Associate the project with the managed builder so the clients can get proper information
- try {
- ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(newProject);
- desc.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
- desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
-
- desc.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
- // org.eclipse.cdt.core.ELF or "org.eclipse.cdt.core.PE"
- desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, newTarget.getBinaryParserId());
- } catch (CoreException e) {
- // TODO Flag the error to the user
- }
-
- // Save the build options
- monitor.subTask(ManagedBuilderUIPlugin.getResourceString(MSG_SAVE));
- ManagedBuildManager.saveBuildInfo(newProject);
- monitor.done();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.ui.wizards.NewCProjectWizard#doRunPrologue(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void doRunPrologue(IProgressMonitor monitor) {
- // Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.ui.wizards.NewCProjectWizard#doRunEpilogue(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void doRunEpilogue(IProgressMonitor monitor) {
- // Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.ui.wizards.NewCProjectWizard#getProjectID()
- */
- public String getProjectID() {
- return "org.eclipse.cdt.make.core.make";
-// return ManagedBuilderCorePlugin.getUniqueIdentifier() + ".make"; //$NON-NLS-1$
- }
-
-}
diff --git a/core/org.eclipse.cdt.core.aix/.classpath b/core/org.eclipse.cdt.core.aix/.classpath
deleted file mode 100644
index 065ac06e197..00000000000
--- a/core/org.eclipse.cdt.core.aix/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-