mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
added project to createion of make target for initial default settings
This commit is contained in:
parent
ffaa2d3da7
commit
428e119084
4 changed files with 43 additions and 33 deletions
|
@ -15,7 +15,7 @@ import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
public interface IMakeTargetManager {
|
public interface IMakeTargetManager {
|
||||||
IMakeTarget createTarget(String targetName, String targetID);
|
IMakeTarget createTarget(IProject project, String targetName, String targetID) throws CoreException;
|
||||||
void addTarget(IContainer container, IMakeTarget target) throws CoreException;
|
void addTarget(IContainer container, IMakeTarget target) throws CoreException;
|
||||||
void removeTarget(IMakeTarget target) throws CoreException;
|
void removeTarget(IMakeTarget target) throws CoreException;
|
||||||
void renameTarget(IMakeTarget target, String name) throws CoreException;
|
void renameTarget(IMakeTarget target, String name) throws CoreException;
|
||||||
|
|
|
@ -33,10 +33,15 @@ public class MakeTarget implements IMakeTarget {
|
||||||
private IContainer container;
|
private IContainer container;
|
||||||
private MakeTargetManager manager;
|
private MakeTargetManager manager;
|
||||||
|
|
||||||
MakeTarget(MakeTargetManager manager, String targetBuilderID, String name) {
|
MakeTarget(MakeTargetManager manager, IProject project, String targetBuilderID, String name) throws CoreException {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.targetBuilderID = targetBuilderID;
|
this.targetBuilderID = targetBuilderID;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(project, manager.getBuilderID(targetBuilderID));
|
||||||
|
buildCommand = info.getBuildCommand();
|
||||||
|
buildArguments = info.getBuildArguments();
|
||||||
|
isDefaultBuildCmd = info.isDefaultBuildCmd();
|
||||||
|
isStopOnError = info.isStopOnError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setContainer(IContainer container) {
|
void setContainer(IContainer container) {
|
||||||
|
|
|
@ -58,8 +58,8 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
||||||
public MakeTargetManager() {
|
public MakeTargetManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMakeTarget createTarget(String name, String targetBuilderID) {
|
public IMakeTarget createTarget(IProject project, String name, String targetBuilderID) throws CoreException {
|
||||||
return new MakeTarget(this, targetBuilderID, name);
|
return new MakeTarget(this, project, targetBuilderID, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTarget(IContainer container, IMakeTarget target) throws CoreException {
|
public void addTarget(IContainer container, IMakeTarget target) throws CoreException {
|
||||||
|
@ -123,7 +123,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getTargetBuilders(IProject project) {
|
public String[] getTargetBuilders(IProject project) {
|
||||||
if (fProjects.contains(project)) {
|
if (fProjects.contains(project) || hasTargetBuilder(project)) {
|
||||||
try {
|
try {
|
||||||
Vector ids = new Vector();
|
Vector ids = new Vector();
|
||||||
IProjectDescription description = project.getDescription();
|
IProjectDescription description = project.getDescription();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class ProjectTargets {
|
||||||
private static final String TARGET_STOP_ON_ERROR = "stopOnError";
|
private static final String TARGET_STOP_ON_ERROR = "stopOnError";
|
||||||
private static final String TARGET_USE_DEFAULT_CMD = "useDefaultCommand";
|
private static final String TARGET_USE_DEFAULT_CMD = "useDefaultCommand";
|
||||||
private static final String TARGET_ARGUMENTS = "buildArguments";
|
private static final String TARGET_ARGUMENTS = "buildArguments";
|
||||||
private static final String TARGET_COMMAND ="buildCommand";
|
private static final String TARGET_COMMAND = "buildCommand";
|
||||||
private static final String TARGET = "buidlTarget";
|
private static final String TARGET = "buidlTarget";
|
||||||
|
|
||||||
private HashMap targetMap = new HashMap();
|
private HashMap targetMap = new HashMap();
|
||||||
|
@ -79,29 +79,34 @@ public class ProjectTargets {
|
||||||
} else {
|
} else {
|
||||||
container = project;
|
container = project;
|
||||||
}
|
}
|
||||||
MakeTarget target = new MakeTarget(manager, 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);
|
|
||||||
}
|
|
||||||
try {
|
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);
|
add(target);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
MakeCorePlugin.log(e);
|
MakeCorePlugin.log(e);
|
||||||
|
@ -188,7 +193,7 @@ public class ProjectTargets {
|
||||||
doc.appendChild(targetsRootElement);
|
doc.appendChild(targetsRootElement);
|
||||||
Iterator container = targetMap.entrySet().iterator();
|
Iterator container = targetMap.entrySet().iterator();
|
||||||
while (container.hasNext()) {
|
while (container.hasNext()) {
|
||||||
List targets = (List) ((Map.Entry)container.next()).getValue();
|
List targets = (List) ((Map.Entry) container.next()).getValue();
|
||||||
for (int i = 0; i < targets.size(); i++) {
|
for (int i = 0; i < targets.size(); i++) {
|
||||||
MakeTarget target = (MakeTarget) targets.get(i);
|
MakeTarget target = (MakeTarget) targets.get(i);
|
||||||
targetsRootElement.appendChild(createTargetElement(doc, target));
|
targetsRootElement.appendChild(createTargetElement(doc, target));
|
||||||
|
|
Loading…
Add table
Reference in a new issue