mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
work in progress- make target provider/make target
This commit is contained in:
parent
bebc49da06
commit
7e7e45a917
22 changed files with 749 additions and 87 deletions
|
@ -8,6 +8,7 @@
|
|||
<project>org.eclipse.cdt.core.qnx</project>
|
||||
<project>org.eclipse.cdt.core.solaris</project>
|
||||
<project>org.eclipse.cdt.core.win32</project>
|
||||
<project>org.eclipse.core.resources</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
pluginName=C/C++ Standard make Build Core
|
||||
providerName=Eclipse.org
|
||||
|
||||
extensionTargetBuilder.name=Target Builder Extension
|
||||
natureMake.name=CDT Make Nature
|
||||
builderMake.name=CDT Makefile Builder
|
|
@ -15,6 +15,9 @@
|
|||
<import plugin="org.apache.xerces"/>
|
||||
</requires>
|
||||
|
||||
|
||||
<extension-point id="MakeTargetBuilder" name="%extensionTargetBuilder.name" schema="schema/MakeTargetBuilder.exsd"/>
|
||||
|
||||
<extension
|
||||
id="MakeScannerProvider"
|
||||
point="org.eclipse.cdt.core.ScannerInfoProvider">
|
||||
|
@ -44,8 +47,10 @@
|
|||
id="makeBuilder"
|
||||
name="%builderMake.name"
|
||||
point="org.eclipse.core.resources.builders">
|
||||
<builder hasNature="true">
|
||||
<run class="org.eclipse.cdt.make.core.MakeBuilder">
|
||||
<builder
|
||||
hasNature="true">
|
||||
<run
|
||||
class="org.eclipse.cdt.make.core.MakeBuilder">
|
||||
<parameter
|
||||
name="defaultCommand"
|
||||
value="make">
|
||||
|
@ -61,4 +66,12 @@
|
|||
class="org.eclipse.cdt.make.internal.core.MakeProject">
|
||||
</cproject>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.make.core.MakeTargetBuilder">
|
||||
<builder
|
||||
builderID="org.eclipse.cdt.core.make.makeBuilder"
|
||||
id="org.eclipse.cdt.make.MakeTargetBuilder">
|
||||
</builder>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
105
build/org.eclipse.cdt.make.core/schema/MakeTargetBuilder.exsd
Normal file
105
build/org.eclipse.cdt.make.core/schema/MakeTargetBuilder.exsd
Normal file
|
@ -0,0 +1,105 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.eclipse.cdt.make.core">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.schema plugin="org.eclipse.cdt.make.core" id="MakeTargetBuilder" name="%extensionTargetBuilder.name"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
This extension point is used to identify builders that support IMakeBuidlerInfo an arguments.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<complexType>
|
||||
<sequence>
|
||||
</sequence>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="builder">
|
||||
<complexType>
|
||||
<attribute name="builderID" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Eclipse builder ID of the builder that supports target builds. (Must support IMakeInfo as argument).
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
id used to identify this target builder
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="since"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="examples"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
[Enter extension point usage example here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="apiInfo"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
[Enter information about supplied implementation of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -11,14 +11,29 @@
|
|||
package org.eclipse.cdt.make.core;
|
||||
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
public interface IMakeTarget {
|
||||
IMakeTargetProvider getProvider();
|
||||
String getName();
|
||||
IContainer getContainer();
|
||||
String getTargetBuilderID();
|
||||
|
||||
String getBuilderID();
|
||||
|
||||
boolean isStopOnError();
|
||||
void setStopOnError(boolean stopOnError);
|
||||
|
||||
boolean isDefaultBuildCmd();
|
||||
void setUseDefaultBuildCmd(boolean useDefault);
|
||||
|
||||
IPath getBuildCommand();
|
||||
void setBuildCommand(IPath command);
|
||||
|
||||
String getBuildArguments();
|
||||
void setBuildArguments();
|
||||
|
||||
IContainer getContainer();
|
||||
|
||||
void build(IProgressMonitor monitor) throws CoreException;
|
||||
}
|
||||
|
|
|
@ -11,13 +11,16 @@
|
|||
package org.eclipse.cdt.make.core;
|
||||
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public interface IMakeTargetProvider {
|
||||
IMakeTarget addTarget(IContainer container, String targetBuilderID, String targetName) throws CoreException;
|
||||
void removeTarget(IMakeTarget target) throws CoreException;
|
||||
void renameTarget(IMakeTarget target, String name) throws CoreException;
|
||||
|
||||
IMakeTarget[] getTargets();
|
||||
IMakeTarget[] getTargets(IContainer container);
|
||||
|
||||
IMakeBuilderInfo getBuilderInfo(IMakeTarget target);
|
||||
IMakeTarget[] getTargets(IContainer container) throws CoreException;
|
||||
IProject[] getTargetBuilderProjects() throws CoreException;
|
||||
|
||||
void addListener(IMakeTargetListener listener);
|
||||
void removeListener(IMakeTargetListener listener);
|
||||
|
|
|
@ -67,7 +67,7 @@ public class MakeBuilder extends ACBuilder {
|
|||
*/
|
||||
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
|
||||
boolean bPerformBuild = true;
|
||||
IMakeBuilderInfo info = MakeCorePlugin.create(args, MakeBuilder.BUILDER_ID);
|
||||
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(args, MakeBuilder.BUILDER_ID);
|
||||
if (!shouldBuild(kind, info)) {
|
||||
return new IProject[0];
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class MakeBuilder extends ACBuilder {
|
|||
if (monitor == null) {
|
||||
monitor = new NullProgressMonitor();
|
||||
}
|
||||
monitor.beginTask("Invoking Make Builder: " + currProject.getName(), IProgressMonitor.UNKNOWN);
|
||||
monitor.beginTask(MakeCorePlugin.getResourceString("MakeBuilder.Invoking_Make_Builder") + currProject.getName(), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
|
||||
|
||||
try {
|
||||
IPath buildCommand = info.getBuildCommand();
|
||||
|
@ -118,7 +118,7 @@ public class MakeBuilder extends ACBuilder {
|
|||
isClean = true;
|
||||
// Before launching give visual cues via the monitor
|
||||
subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
|
||||
subMonitor.subTask("Invoking Command: " + buildCommand.toString());
|
||||
subMonitor.subTask(MakeCorePlugin.getResourceString("MakeBuilder.Invoking_Command") + buildCommand.toString()); //$NON-NLS-1$
|
||||
|
||||
String errMsg = null;
|
||||
CommandLauncher launcher = new CommandLauncher();
|
||||
|
@ -174,7 +174,7 @@ public class MakeBuilder extends ACBuilder {
|
|||
isCanceled = monitor.isCanceled();
|
||||
monitor.setCanceled(false);
|
||||
subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
|
||||
subMonitor.subTask("Updating project...");
|
||||
subMonitor.subTask(MakeCorePlugin.getResourceString("MakeBuilder.Updating_project")); //$NON-NLS-1$
|
||||
|
||||
try {
|
||||
currProject.refreshLocal(IResource.DEPTH_INFINITE, subMonitor);
|
||||
|
|
|
@ -91,7 +91,7 @@ public class MakeCorePlugin extends Plugin {
|
|||
}
|
||||
|
||||
protected void initializeDefaultPluginPreferences() {
|
||||
IMakeBuilderInfo info = create(getPluginPreferences(), MakeBuilder.BUILDER_ID, true);
|
||||
IMakeBuilderInfo info = createBuildInfo(getPluginPreferences(), MakeBuilder.BUILDER_ID, true);
|
||||
try {
|
||||
info.setBuildCommand(new Path("make")); //$NON-NLS-1$
|
||||
info.setBuildLocation(new Path("")); //$NON-NLS-1$
|
||||
|
@ -108,15 +108,15 @@ public class MakeCorePlugin extends Plugin {
|
|||
getPluginPreferences().setDefault(CCorePlugin.PREF_BINARY_PARSER, CCorePlugin.PLUGIN_ID + ".ELF"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static IMakeBuilderInfo create(Preferences prefs, String builderID, boolean useDefaults) {
|
||||
public static IMakeBuilderInfo createBuildInfo(Preferences prefs, String builderID, boolean useDefaults) {
|
||||
return BuildInfoFactory.create(prefs, builderID, useDefaults);
|
||||
}
|
||||
|
||||
public static IMakeBuilderInfo create(IProject project, String builderID) throws CoreException {
|
||||
public static IMakeBuilderInfo createBuildInfo(IProject project, String builderID) throws CoreException {
|
||||
return BuildInfoFactory.create(project, builderID);
|
||||
}
|
||||
|
||||
public static IMakeBuilderInfo create(Map args, String builderID) {
|
||||
public static IMakeBuilderInfo createBuildInfo(Map args, String builderID) {
|
||||
return BuildInfoFactory.create(args, builderID);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,8 +100,8 @@ public class MakeProjectNature implements IProjectNature {
|
|||
*/
|
||||
public void configure() throws CoreException {
|
||||
addBuildSpec();
|
||||
IMakeBuilderInfo info = MakeCorePlugin.create(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID, false);
|
||||
IMakeBuilderInfo projectInfo = MakeCorePlugin.create(getProject(), MakeBuilder.BUILDER_ID);
|
||||
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID, false);
|
||||
IMakeBuilderInfo projectInfo = MakeCorePlugin.createBuildInfo(getProject(), MakeBuilder.BUILDER_ID);
|
||||
projectInfo.setBuildLocation(info.getBuildLocation());
|
||||
|
||||
|
||||
|
|
|
@ -12,12 +12,17 @@ package org.eclipse.cdt.make.core;
|
|||
|
||||
import java.util.EventObject;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
||||
public class MakeTargetEvent extends EventObject {
|
||||
public final int TARGET_ADD = 1;
|
||||
public final int TARGET_CHANGED = 2;
|
||||
public final int TARGET_REMOVED = 3;
|
||||
public static final int TARGET_ADD = 1;
|
||||
public static final int TARGET_CHANGED = 2;
|
||||
public static final int TARGET_REMOVED = 3;
|
||||
public static final int PROJECT_ADDED = 4;
|
||||
public static final int PROJECT_REMOVED = 5;
|
||||
|
||||
IMakeTarget target;
|
||||
IProject project;
|
||||
int type;
|
||||
|
||||
/**
|
||||
|
@ -29,6 +34,12 @@ public class MakeTargetEvent extends EventObject {
|
|||
this.target = target;
|
||||
}
|
||||
|
||||
public MakeTargetEvent(Object source, int type, IProject project) {
|
||||
super(source);
|
||||
this.type = type;
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
|
|
@ -1,2 +1,11 @@
|
|||
|
||||
MakeBuilder.buildError=Error launching builder ({0})
|
||||
MakeBuilder.Invoking_Make_Builder=Invoking Make Builder:
|
||||
MakeBuilder.Invoking_Command=Invoking Command:
|
||||
MakeBuilder.Updating_project=Updating project...
|
||||
|
||||
BuildInfoFactory.Missing_Builder=Missing Builder:
|
||||
|
||||
MakeTargetProvider.add_to_workspace_root=Cannot add build targets to workspace root
|
||||
MakeTargetProvider.target_exists=Target exists
|
||||
MakeTargetProvider.failed_initializing_targets=Failed initializing build targets
|
||||
|
|
|
@ -221,7 +221,7 @@ public class BuildInfoFactory {
|
|||
builder = MakeProjectNature.getBuildSpec(project, builderID);
|
||||
if (builder == null) {
|
||||
throw new CoreException(
|
||||
new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, "Missing Builder: " + builderID, null));
|
||||
new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeCorePlugin.getResourceString("BuildInfoFactory.Missing_Builder") + builderID, null)); //$NON-NLS-1$
|
||||
}
|
||||
args = builder.getArguments();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* This class is used to maintain a list of listeners, and
|
||||
* is used in the implementations of several classes within JFace
|
||||
* which allow you to register listeners of various kinds.
|
||||
* It is a fairly lightweight object, occupying minimal space when
|
||||
* no listeners are registered.
|
||||
* <p>
|
||||
* Note that the <code>add</code> method checks for and eliminates
|
||||
* duplicates based on identity (not equality). Likewise, the
|
||||
* <code>remove</code> method compares based on identity.
|
||||
* </p>
|
||||
* <p>
|
||||
* Use the <code>getListeners</code> 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, <code>FooListener.eventHappened</code>, is:
|
||||
* <pre>
|
||||
* Object[] listeners = myListenerList.getListeners();
|
||||
* for (int i = 0; i < listeners.length; ++i) {
|
||||
* ((FooListener) listeners[i]).eventHappened(event);
|
||||
* }
|
||||
* </pre>
|
||||
* </p>
|
||||
*/
|
||||
public class ListenerList {
|
||||
/**
|
||||
* The initial capacity of the list. Always >= 1.
|
||||
*/
|
||||
private int capacity;
|
||||
|
||||
/**
|
||||
* The current number of listeners.
|
||||
* Maintains invariant: 0 <= size <= listeners.length.
|
||||
*/
|
||||
private int size;
|
||||
|
||||
/**
|
||||
* The list of listeners. Initially <code>null</code> 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.
|
||||
* <p>
|
||||
* 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.
|
||||
* </p>
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @return <code>true</code> if there are no registered listeners, and
|
||||
* <code>false</code> 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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* 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 org.eclipse.cdt.make.core.IMakeTarget;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
public class MakeTarget implements IMakeTarget {
|
||||
|
||||
MakeTarget(String targetBuilderID, String targetName) {
|
||||
// dinglis-TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
void setName(String name) {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
void setContainer(IContainer container) {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getTargetBuilderID() {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getBuilderID() {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isStopOnError() {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setStopOnError(boolean stopOnError) {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public boolean isDefaultBuildCmd() {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setUseDefaultBuildCmd(boolean useDefault) {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public IPath getBuildCommand() {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setBuildCommand(IPath command) {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public String getBuildArguments() {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setBuildArguments() {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public IContainer getContainer() {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public void build(IProgressMonitor monitor) throws CoreException {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -10,55 +10,213 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.make.internal.core;
|
||||
|
||||
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
||||
import org.eclipse.cdt.make.core.IMakeTargetListener;
|
||||
import org.eclipse.cdt.make.core.IMakeTargetProvider;
|
||||
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.IResourceChangeEvent;
|
||||
import org.eclipse.core.resources.IResourceChangeListener;
|
||||
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;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
public class MakeTargetProvider implements IMakeTargetProvider {
|
||||
public class MakeTargetProvider implements IMakeTargetProvider, IResourceChangeListener {
|
||||
private static String TARGET_BUILD_EXT = MakeCorePlugin.getUniqueIdentifier() + ".MakeTargetBuilder"; //$NON-NLS-1$
|
||||
|
||||
private static String BUILD_TARGET_ELEMENT = "buildTargets"; //$NON-NLS-1$
|
||||
private static String TARGET_ELEMENT = "target"; //$NON-NLS-1$
|
||||
|
||||
private ListenerList listeners = new ListenerList();
|
||||
private HashMap projectMap = new HashMap();
|
||||
private HashMap builderMap;
|
||||
|
||||
public MakeTargetProvider() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.IMakeTargetProvider#getTargets()
|
||||
*/
|
||||
public IMakeTarget[] getTargets() {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
return null;
|
||||
public IMakeTarget addTarget(IContainer container, String targetBuilderID, String targetName) throws CoreException {
|
||||
if (container instanceof IWorkspaceRoot) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeCorePlugin.getResourceString("MakeTargetProvider.add_to_workspace_root"), null)); //$NON-NLS-1$
|
||||
}
|
||||
IProject project = container.getProject();
|
||||
HashMap targetMap = (HashMap) projectMap.get(project);
|
||||
if (targetMap == null) {
|
||||
targetMap = initializeTargets(project);
|
||||
}
|
||||
ArrayList list = (ArrayList) targetMap.get(container);
|
||||
MakeTarget target = new MakeTarget(targetBuilderID, targetName);
|
||||
if (list != null && list.contains(target)) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeCorePlugin.getResourceString("MakeTargetProvider.target_exists"), null)); //$NON-NLS-1$
|
||||
}
|
||||
target.setContainer(container);
|
||||
if (list == null) {
|
||||
list = new ArrayList();
|
||||
targetMap.put(container, list);
|
||||
}
|
||||
list.add(target);
|
||||
notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_ADD, target));
|
||||
return target;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.IMakeTargetProvider#getTargets(org.eclipse.core.resources.IContainer)
|
||||
*/
|
||||
public IMakeTarget[] getTargets(IContainer container) {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
return null;
|
||||
public void removeTarget(IMakeTarget target) throws CoreException {
|
||||
IProject project = target.getContainer().getProject();
|
||||
HashMap targetMap = (HashMap) projectMap.get(project);
|
||||
if (targetMap == null) {
|
||||
targetMap = initializeTargets(project);
|
||||
}
|
||||
ArrayList list = (ArrayList) targetMap.get(target.getContainer());
|
||||
if (list != null && !list.contains(target)) {
|
||||
return;
|
||||
}
|
||||
list.remove(target);
|
||||
if (list.size() == 0) {
|
||||
targetMap.remove(list);
|
||||
}
|
||||
if (targetMap.size() == 0) {
|
||||
projectMap.remove(project);
|
||||
}
|
||||
notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_REMOVED, target));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.IMakeTargetProvider#getBuilderInfo(org.eclipse.cdt.make.core.IMakeTarget)
|
||||
*/
|
||||
public IMakeBuilderInfo getBuilderInfo(IMakeTarget target) {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
return null;
|
||||
public void renameTarget(IMakeTarget target, String name) throws CoreException {
|
||||
IProject project = target.getContainer().getProject();
|
||||
HashMap targetMap = (HashMap) projectMap.get(project);
|
||||
if (targetMap == null) {
|
||||
targetMap = initializeTargets(project);
|
||||
}
|
||||
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("MakeTargetProvider.target_does_not_exists"), null)); //$NON-NLS-1$
|
||||
}
|
||||
((MakeTarget) target).setName(name);
|
||||
notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_CHANGED, target));
|
||||
}
|
||||
|
||||
public IMakeTarget[] getTargets(IContainer container) throws CoreException {
|
||||
IProject project = container.getProject();
|
||||
HashMap targetMap = (HashMap) projectMap.get(project);
|
||||
if (targetMap == null) {
|
||||
targetMap = initializeTargets(project);
|
||||
}
|
||||
ArrayList list = (ArrayList) targetMap.get(container);
|
||||
if (list != null) {
|
||||
return (IMakeTarget[]) list.toArray(new IMakeTarget[list.size()]);
|
||||
}
|
||||
return new IMakeTarget[0];
|
||||
}
|
||||
|
||||
private HashMap initializeTargets(IProject project) throws CoreException {
|
||||
HashMap targetMap = new HashMap();
|
||||
IPath targetFilePath = MakeCorePlugin.getDefault().getStateLocation().append(project.getName());
|
||||
File targetFile = targetFilePath.toFile();
|
||||
if (targetFile.exists()) {
|
||||
try {
|
||||
FileInputStream file = new FileInputStream(targetFile);
|
||||
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
Document document = parser.parse(file);
|
||||
Node node = document.getFirstChild();
|
||||
if (node.getNodeName().equals(BUILD_TARGET_ELEMENT)) {
|
||||
NodeList list = node.getChildNodes();
|
||||
for( int i = 0; i < list.getLength(); i++) {
|
||||
Node item = list.item(i);
|
||||
if ( item.getNodeName().equals(TARGET_ELEMENT)) {
|
||||
NamedNodeMap attr = item.getAttributes();
|
||||
MakeTarget target = new MakeTarget(attr.getNamedItem("targetID").getNodeValue(), attr.getNamedItem("name").getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
// targetMap.put(container, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new CoreException(
|
||||
new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeCorePlugin.getResourceString("MakeTargetProvider.failed_initializing_targets"), e)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
return targetMap;
|
||||
}
|
||||
|
||||
public IProject[] getTargetBuilderProjects() throws CoreException {
|
||||
Vector tProj = new Vector();
|
||||
IProject project[] = ResourcesPlugin.getWorkspace().getRoot().getProjects();
|
||||
for (int i = 0; i < project.length; i++) {
|
||||
IProjectDescription description = project[i].getDescription();
|
||||
ICommand builder[] = description.getBuildSpec();
|
||||
for (int j = 0; j < builder.length; j++) {
|
||||
if (builderMap.containsValue(builder[j].getBuilderName())) {
|
||||
tProj.add(project[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (IProject[]) tProj.toArray(new IProject[tProj.size()]);
|
||||
}
|
||||
|
||||
public void startup() {
|
||||
initializeBuilders();
|
||||
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
|
||||
}
|
||||
|
||||
private void initializeBuilders() {
|
||||
builderMap = new HashMap();
|
||||
|
||||
IExtensionPoint point = MakeCorePlugin.getDefault().getDescriptor().getExtensionPoint(MakeTargetProvider.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyListeners(MakeTargetEvent event) {
|
||||
Object[] list = listeners.getListeners();
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
((IMakeTargetListener) list[i]).targetChanged(event);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.IMakeTargetProvider#addListener(org.eclipse.cdt.make.core.IMakeTargetListener)
|
||||
*/
|
||||
public void addListener(IMakeTargetListener listener) {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.IMakeTargetProvider#removeListener(org.eclipse.cdt.make.core.IMakeTargetListener)
|
||||
*/
|
||||
public void removeListener(IMakeTargetListener listener) {
|
||||
// dinglis-TODO Auto-generated method stub
|
||||
|
||||
listeners.remove(listeners);
|
||||
}
|
||||
|
||||
public void resourceChanged(IResourceChangeEvent event) {
|
||||
// dinglis-TODO listen for project that add/remove a target type builder
|
||||
|
||||
}
|
||||
}
|
|
@ -10,6 +10,8 @@
|
|||
<project>org.eclipse.cdt.core.win32</project>
|
||||
<project>org.eclipse.cdt.make.core</project>
|
||||
<project>org.eclipse.cdt.ui</project>
|
||||
<project>org.eclipse.core.resources</project>
|
||||
<project>org.eclipse.ui.workbench</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
|
|
BIN
build/org.eclipse.cdt.make.ui/icons/obj16/make_target.gif
Normal file
BIN
build/org.eclipse.cdt.make.ui/icons/obj16/make_target.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 161 B |
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* 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.ui;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.resource.ImageRegistry;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
|
||||
public class MakeUIImages {
|
||||
|
||||
/**
|
||||
* Bundle of all images used by the Make plugin.
|
||||
*/
|
||||
|
||||
// The plugin registry
|
||||
private static ImageRegistry imageRegistry = new ImageRegistry();
|
||||
|
||||
// Subdirectory (under the package containing this class) where 16 color images are
|
||||
private static URL fgIconBaseURL;
|
||||
static {
|
||||
try {
|
||||
fgIconBaseURL = new URL(MakeUIPlugin.getDefault().getDescriptor().getInstallURL(), "icons/"); //$NON-NLS-1$
|
||||
} catch (MalformedURLException e) {
|
||||
MakeUIPlugin.log(e);
|
||||
}
|
||||
}
|
||||
private static final String NAME_PREFIX = MakeUIPlugin.getUniqueIdentifier() + '.';
|
||||
private static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length();
|
||||
|
||||
public static final String OBJ = "obj16/"; //$NON-NLS-1$
|
||||
|
||||
// For the build image
|
||||
public static final String IMG_OBJS_MAKE_TARGET = NAME_PREFIX + "make_target.gif"; //$NON-NLS-1$
|
||||
public static final ImageDescriptor DESC_BUILD_TARGET = createManaged(OBJ, IMG_OBJS_MAKE_TARGET);
|
||||
|
||||
private static ImageDescriptor createManaged(String prefix, String name) {
|
||||
return createManaged(imageRegistry, prefix, name);
|
||||
}
|
||||
|
||||
private static ImageDescriptor createManaged(ImageRegistry registry, String prefix, String name) {
|
||||
ImageDescriptor result = ImageDescriptor.createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
|
||||
registry.put(name, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Image getImage(String key) {
|
||||
return imageRegistry.get(key);
|
||||
}
|
||||
|
||||
private static ImageDescriptor create(String prefix, String name) {
|
||||
return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
|
||||
}
|
||||
|
||||
private static URL makeIconFileURL(String prefix, String name) {
|
||||
StringBuffer buffer = new StringBuffer(prefix);
|
||||
buffer.append(name);
|
||||
try {
|
||||
return new URL(fgIconBaseURL, buffer.toString());
|
||||
} catch (MalformedURLException e) {
|
||||
MakeUIPlugin.log(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets all available image descriptors for the given action.
|
||||
*/
|
||||
public static void setImageDescriptors(IAction action, String type, String relPath) {
|
||||
relPath = relPath.substring(NAME_PREFIX_LENGTH);
|
||||
action.setDisabledImageDescriptor(create("d" + type, relPath)); //$NON-NLS-1$
|
||||
action.setHoverImageDescriptor(create("c" + type, relPath)); //$NON-NLS-1$
|
||||
action.setImageDescriptor(create("e" + type, relPath)); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to access the image registry from the JavaPlugin class.
|
||||
*/
|
||||
static ImageRegistry getImageRegistry() {
|
||||
return imageRegistry;
|
||||
}
|
||||
}
|
|
@ -262,9 +262,9 @@ public class SettingsBlock extends AbstractCOptionPage {
|
|||
monitor.beginTask("Applying Settings...", 1);
|
||||
IMakeBuilderInfo info;
|
||||
if (getContainer().getProject() != null) {
|
||||
info = MakeCorePlugin.create(getContainer().getProject(), fBuilderID);
|
||||
info = MakeCorePlugin.createBuildInfo(getContainer().getProject(), fBuilderID);
|
||||
} else {
|
||||
info = MakeCorePlugin.create(fPrefs, fBuilderID, false);
|
||||
info = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, false);
|
||||
}
|
||||
info.setStopOnError(isStopOnError());
|
||||
info.setUseDefaultBuildCmd(useDefaultBuildCmd());
|
||||
|
@ -305,9 +305,9 @@ public class SettingsBlock extends AbstractCOptionPage {
|
|||
public void performDefaults() {
|
||||
IMakeBuilderInfo info;
|
||||
if (getContainer().getProject() != null) {
|
||||
info = MakeCorePlugin.create(fPrefs, fBuilderID, false);
|
||||
info = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, false);
|
||||
} else {
|
||||
info = MakeCorePlugin.create(fPrefs, fBuilderID, true);
|
||||
info = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, true);
|
||||
}
|
||||
if (info.isStopOnError())
|
||||
stopRadioButtons.setSelectValue(STOP_ARG);
|
||||
|
@ -359,11 +359,11 @@ public class SettingsBlock extends AbstractCOptionPage {
|
|||
super.setContainer(container);
|
||||
if (getContainer().getProject() != null) {
|
||||
try {
|
||||
fBuildInfo = MakeCorePlugin.create(getContainer().getProject(), fBuilderID);
|
||||
fBuildInfo = MakeCorePlugin.createBuildInfo(getContainer().getProject(), fBuilderID);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
} else {
|
||||
fBuildInfo = MakeCorePlugin.create(fPrefs, fBuilderID, false);
|
||||
fBuildInfo = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
|||
MakeProjectNature.addNature(project[i], new SubProgressMonitor(monitor, 1));
|
||||
QualifiedName qlocation = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildLocation");
|
||||
String location = project[i].getPersistentProperty(qlocation);
|
||||
IMakeBuilderInfo newInfo = MakeCorePlugin.create(project[i], MakeBuilder.BUILDER_ID);
|
||||
IMakeBuilderInfo newInfo = MakeCorePlugin.createBuildInfo(project[i], MakeBuilder.BUILDER_ID);
|
||||
newInfo.setBuildCommand(new Path(location));
|
||||
|
||||
//remove old properties
|
||||
|
|
|
@ -7,9 +7,10 @@ package org.eclipse.cdt.make.ui.views;
|
|||
|
||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
||||
import org.eclipse.cdt.make.core.IMakeTargetListener;
|
||||
import org.eclipse.cdt.make.core.IMakeTargetProvider;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.core.MakeTargetEvent;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
|
||||
|
@ -27,12 +28,9 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
|||
*/
|
||||
public Object[] getChildren(Object obj) {
|
||||
if (obj instanceof IContainer) {
|
||||
if (viewer != null) {
|
||||
Object input = viewer.getInput();
|
||||
if (input instanceof IMakeTargetProvider) {
|
||||
IMakeTargetProvider provider = (IMakeTargetProvider)obj;
|
||||
return provider.getTargets((IContainer)obj);
|
||||
}
|
||||
try {
|
||||
return MakeCorePlugin.getDefault().getTargetProvider().getTargets((IContainer)obj);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
return new Object[0];
|
||||
|
@ -69,12 +67,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
|||
*/
|
||||
public void dispose() {
|
||||
if (viewer != null) {
|
||||
Object obj = viewer.getInput();
|
||||
if (obj instanceof IMakeTargetProvider) {
|
||||
IMakeTargetProvider provider = (IMakeTargetProvider)obj;
|
||||
provider.removeListener(this);
|
||||
provider = null;
|
||||
}
|
||||
MakeCorePlugin.getDefault().getTargetProvider().removeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,17 +75,10 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
|||
* @see IContentProvider#inputChanged(Viewer, Object, Object)
|
||||
*/
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
if (this.viewer == null) {
|
||||
MakeCorePlugin.getDefault().getTargetProvider().addListener(this);
|
||||
}
|
||||
this.viewer = viewer;
|
||||
if (oldInput != null) {
|
||||
if (oldInput instanceof IMakeTargetProvider) {
|
||||
((IMakeTargetProvider)oldInput).removeListener(this);
|
||||
}
|
||||
}
|
||||
if (newInput != null) {
|
||||
if (newInput instanceof IMakeTargetProvider) {
|
||||
((IMakeTargetProvider)newInput).addListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -6,6 +6,7 @@ package org.eclipse.cdt.make.ui.views;
|
|||
*/
|
||||
|
||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
||||
import org.eclipse.cdt.make.internal.ui.MakeUIImages;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
|
@ -20,6 +21,7 @@ public class MakeLabelProvider extends LabelProvider {
|
|||
public Image getImage(Object obj) {
|
||||
Image image = null;
|
||||
if (obj instanceof IMakeTarget) {
|
||||
return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKE_TARGET);
|
||||
} else if (obj instanceof IContainer) {
|
||||
return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
|
||||
}
|
||||
|
@ -35,6 +37,6 @@ public class MakeLabelProvider extends LabelProvider {
|
|||
} else if (obj instanceof IContainer) {
|
||||
return ((IContainer)obj).getName();
|
||||
}
|
||||
return "";
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue