mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
update
This commit is contained in:
parent
d3c32bb369
commit
cc174bfe8c
22 changed files with 736 additions and 230 deletions
|
@ -25,9 +25,11 @@ public interface IMakeTarget {
|
||||||
boolean isDefaultBuildCmd();
|
boolean isDefaultBuildCmd();
|
||||||
void setUseDefaultBuildCmd(boolean useDefault);
|
void setUseDefaultBuildCmd(boolean useDefault);
|
||||||
|
|
||||||
|
void setBuildTarget(String target);
|
||||||
|
String getBuildTarget();
|
||||||
|
|
||||||
IPath getBuildCommand();
|
IPath getBuildCommand();
|
||||||
void setBuildCommand(IPath command);
|
void setBuildCommand(IPath command);
|
||||||
|
|
||||||
String getBuildArguments();
|
String getBuildArguments();
|
||||||
void setBuildArguments(String arguments);
|
void setBuildArguments(String arguments);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@ 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 addTarget(IContainer container, String targetBuilderID, String targetName) throws CoreException;
|
IMakeTarget createTarget(String targetName, String targetID);
|
||||||
|
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;
|
||||||
|
|
||||||
|
@ -23,8 +24,9 @@ public interface IMakeTargetManager {
|
||||||
IMakeTarget findTarget(IContainer container, String name);
|
IMakeTarget findTarget(IContainer container, String name);
|
||||||
|
|
||||||
IProject[] getTargetBuilderProjects() throws CoreException;
|
IProject[] getTargetBuilderProjects() throws CoreException;
|
||||||
|
|
||||||
String getBuilderID(String targetBuilderID);
|
String getBuilderID(String targetID);
|
||||||
|
|
||||||
String[] getTargetBuilders(IProject project);
|
String[] getTargetBuilders(IProject project);
|
||||||
|
|
||||||
void addListener(IMakeTargetListener listener);
|
void addListener(IMakeTargetListener listener);
|
||||||
|
|
|
@ -19,9 +19,11 @@ import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
public class MakeTarget implements IMakeTarget {
|
public class MakeTarget implements IMakeTarget {
|
||||||
|
|
||||||
|
private String target;
|
||||||
private String buildArguments;
|
private String buildArguments;
|
||||||
private IPath buildCommand;
|
private IPath buildCommand;
|
||||||
private boolean isDefaultBuildCmd;
|
private boolean isDefaultBuildCmd;
|
||||||
|
@ -29,13 +31,18 @@ public class MakeTarget implements IMakeTarget {
|
||||||
private String name;
|
private String name;
|
||||||
private String targetBuilderID;
|
private String targetBuilderID;
|
||||||
private IContainer container;
|
private IContainer container;
|
||||||
|
private MakeTargetManager manager;
|
||||||
MakeTarget(IContainer container, String targetBuilderID, String name) {
|
|
||||||
this.container = container;
|
MakeTarget(MakeTargetManager manager, String targetBuilderID, String name) {
|
||||||
|
this.manager = manager;
|
||||||
this.targetBuilderID = targetBuilderID;
|
this.targetBuilderID = targetBuilderID;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setContainer(IContainer container) {
|
||||||
|
this.container = container;
|
||||||
|
}
|
||||||
|
|
||||||
void setName(String name) {
|
void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +72,7 @@ public class MakeTarget implements IMakeTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPath getBuildCommand() {
|
public IPath getBuildCommand() {
|
||||||
return buildCommand;
|
return buildCommand != null ? buildCommand: new Path("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBuildCommand(IPath command) {
|
public void setBuildCommand(IPath command) {
|
||||||
|
@ -73,7 +80,7 @@ public class MakeTarget implements IMakeTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBuildArguments() {
|
public String getBuildArguments() {
|
||||||
return buildArguments;
|
return buildArguments != null ? buildArguments : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBuildArguments(String arguments) {
|
public void setBuildArguments(String arguments) {
|
||||||
|
@ -100,16 +107,29 @@ public class MakeTarget implements IMakeTarget {
|
||||||
|
|
||||||
public void build(IProgressMonitor monitor) throws CoreException {
|
public void build(IProgressMonitor monitor) throws CoreException {
|
||||||
IProject project = container.getProject();
|
IProject project = container.getProject();
|
||||||
String builderID = MakeCorePlugin.getDefault().getTargetManager().getBuilderID(targetBuilderID);
|
String builderID = manager.getBuilderID(targetBuilderID);
|
||||||
HashMap infoMap = new HashMap();
|
HashMap infoMap = new HashMap();
|
||||||
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(infoMap, builderID);
|
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(infoMap, builderID);
|
||||||
info.setBuildArguments(buildArguments);
|
if ( buildArguments != null) {
|
||||||
info.setBuildCommand(buildCommand);
|
info.setBuildArguments(buildArguments);
|
||||||
|
}
|
||||||
|
if ( buildCommand != null ) {
|
||||||
|
info.setBuildCommand(buildCommand);
|
||||||
|
}
|
||||||
info.setUseDefaultBuildCmd(isDefaultBuildCmd);
|
info.setUseDefaultBuildCmd(isDefaultBuildCmd);
|
||||||
info.setStopOnError(isStopOnError);
|
info.setStopOnError(isStopOnError);
|
||||||
info.setFullBuildEnable(true);
|
info.setFullBuildEnable(true);
|
||||||
info.setFullBuildTarget(buildArguments);
|
info.setFullBuildTarget(target);
|
||||||
info.setBuildLocation(container.getLocation());
|
info.setBuildLocation(container.getLocation());
|
||||||
project.build(IncrementalProjectBuilder.FULL_BUILD, builderID, infoMap, monitor);
|
project.build(IncrementalProjectBuilder.FULL_BUILD, builderID, infoMap, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBuildTarget(String target) {
|
||||||
|
this.target = target;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBuildTarget() {
|
||||||
|
return target;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,8 @@ import org.eclipse.core.runtime.Status;
|
||||||
public class MakeTargetManager implements IMakeTargetManager, IResourceChangeListener {
|
public class MakeTargetManager implements IMakeTargetManager, IResourceChangeListener {
|
||||||
private static String TARGET_BUILD_EXT = "MakeTargetBuilder"; //$NON-NLS-1$
|
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 ListenerList listeners = new ListenerList();
|
||||||
private HashMap projectMap = new HashMap();
|
private HashMap projectMap = new HashMap();
|
||||||
private HashMap builderMap;
|
private HashMap builderMap;
|
||||||
|
@ -56,19 +58,23 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
||||||
public MakeTargetManager() {
|
public MakeTargetManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMakeTarget addTarget(IContainer container, String targetBuilderID, String targetName) throws CoreException {
|
public IMakeTarget createTarget(String name, String targetBuilderID) {
|
||||||
|
return new MakeTarget(this, targetBuilderID, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addTarget(IContainer container, IMakeTarget target) throws CoreException {
|
||||||
if (container instanceof IWorkspaceRoot) {
|
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$
|
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeCorePlugin.getResourceString("MakeTargetManager.add_to_workspace_root"), null)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
ProjectTargets projectTargets = (ProjectTargets) projectMap.get(container.getProject());
|
IProject project = container.getProject();
|
||||||
|
ProjectTargets projectTargets = (ProjectTargets) projectMap.get(project);
|
||||||
if (projectTargets == null) {
|
if (projectTargets == null) {
|
||||||
projectTargets = readTargets(container.getProject());
|
projectTargets = readTargets(project);
|
||||||
}
|
}
|
||||||
MakeTarget target = new MakeTarget(container, targetBuilderID, targetName);
|
((MakeTarget)target).setContainer(container);
|
||||||
projectTargets.add(target);
|
projectTargets.add((MakeTarget)target);
|
||||||
writeTargets(projectTargets);
|
writeTargets(projectTargets);
|
||||||
notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_ADD, target));
|
notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_ADD, target));
|
||||||
return target;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeTarget(IMakeTarget target) throws CoreException {
|
public void removeTarget(IMakeTarget target) throws CoreException {
|
||||||
|
@ -231,7 +237,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeTargets(ProjectTargets projectTargets) throws CoreException {
|
protected void writeTargets(ProjectTargets projectTargets) throws CoreException {
|
||||||
IPath targetFilePath = MakeCorePlugin.getDefault().getStateLocation().append(projectTargets.getProject().getName());
|
IPath targetFilePath = MakeCorePlugin.getDefault().getStateLocation().append(projectTargets.getProject().getName()).addFileExtension(TARGETS_EXT);
|
||||||
File targetFile = targetFilePath.toFile();
|
File targetFile = targetFilePath.toFile();
|
||||||
try {
|
try {
|
||||||
FileOutputStream file = new FileOutputStream(targetFile);
|
FileOutputStream file = new FileOutputStream(targetFile);
|
||||||
|
@ -244,15 +250,21 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ProjectTargets readTargets(IProject project) {
|
protected ProjectTargets readTargets(IProject project) {
|
||||||
IPath targetFilePath = MakeCorePlugin.getDefault().getStateLocation().append(project.getName());
|
IPath targetFilePath = MakeCorePlugin.getDefault().getStateLocation().append(project.getName()).addFileExtension(TARGETS_EXT);
|
||||||
File targetFile = targetFilePath.toFile();
|
File targetFile = targetFilePath.toFile();
|
||||||
|
ProjectTargets projectTargets = null;
|
||||||
if (targetFile.exists()) {
|
if (targetFile.exists()) {
|
||||||
try {
|
try {
|
||||||
return new ProjectTargets(project, new FileInputStream(targetFile));
|
projectTargets = new ProjectTargets(this, project, new FileInputStream(targetFile));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ProjectTargets(project);
|
if ( projectTargets == null) {
|
||||||
|
projectTargets = new ProjectTargets(this, project);
|
||||||
|
}
|
||||||
|
projectMap.put(project, projectTargets);
|
||||||
|
return projectTargets;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initializeBuilders() {
|
protected void initializeBuilders() {
|
||||||
|
|
|
@ -7,6 +7,8 @@ import java.io.OutputStreamWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
@ -31,19 +33,31 @@ import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
public class ProjectTargets {
|
public class ProjectTargets {
|
||||||
private static String BUILD_TARGET_ELEMENT = "buildTargets"; //$NON-NLS-1$
|
|
||||||
private static String TARGET_ELEMENT = "target"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
|
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 HashMap targetMap = new HashMap();
|
||||||
private IProject project;
|
|
||||||
|
|
||||||
public ProjectTargets(IProject project) {
|
private IProject project;
|
||||||
|
private MakeTargetManager manager;
|
||||||
|
|
||||||
|
public ProjectTargets(MakeTargetManager manager, IProject project) {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
|
this.manager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectTargets(IProject project, InputStream input) {
|
public ProjectTargets(MakeTargetManager manager, IProject project, InputStream input) {
|
||||||
this(project);
|
this(manager, project);
|
||||||
|
|
||||||
Document document = null;
|
Document document = null;
|
||||||
try {
|
try {
|
||||||
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
|
@ -59,29 +73,34 @@ public class ProjectTargets {
|
||||||
if (node.getNodeName().equals(TARGET_ELEMENT)) {
|
if (node.getNodeName().equals(TARGET_ELEMENT)) {
|
||||||
IContainer container = null;
|
IContainer container = null;
|
||||||
NamedNodeMap attr = node.getAttributes();
|
NamedNodeMap attr = node.getAttributes();
|
||||||
String path = attr.getNamedItem("targetID").getNodeValue();
|
String path = attr.getNamedItem(TARGET_ATTR_PATH).getNodeValue();
|
||||||
if (path != null) {
|
if (path != null && !path.equals("")) {
|
||||||
container = project.getFolder(path);
|
container = project.getFolder(path);
|
||||||
} else {
|
} else {
|
||||||
container = project;
|
container = project;
|
||||||
}
|
}
|
||||||
MakeTarget target = new MakeTarget(container, attr.getNamedItem("targetID").getNodeValue(), attr.getNamedItem("name").getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
|
MakeTarget target = new MakeTarget(manager, attr.getNamedItem(TARGET_ATTR_ID).getNodeValue(), attr.getNamedItem(TARGET_ATTR_NAME).getNodeValue());
|
||||||
String option = getString(node, "stopOnError");
|
target.setContainer(container);
|
||||||
|
String option = getString(node, TARGET_STOP_ON_ERROR);
|
||||||
if (option != null) {
|
if (option != null) {
|
||||||
target.setStopOnError(Boolean.valueOf(option).booleanValue());
|
target.setStopOnError(Boolean.valueOf(option).booleanValue());
|
||||||
}
|
}
|
||||||
option = getString(node, "useDefaultCommand");
|
option = getString(node, TARGET_USE_DEFAULT_CMD);
|
||||||
if (option != null) {
|
if (option != null) {
|
||||||
target.setUseDefaultBuildCmd(Boolean.valueOf(option).booleanValue());
|
target.setUseDefaultBuildCmd(Boolean.valueOf(option).booleanValue());
|
||||||
}
|
}
|
||||||
option = getString(node, "buildCommand");
|
option = getString(node, TARGET_COMMAND);
|
||||||
if (option != null) {
|
if (option != null) {
|
||||||
target.setBuildCommand(new Path(option));
|
target.setBuildCommand(new Path(option));
|
||||||
}
|
}
|
||||||
option = getString(node, "buildArguments");
|
option = getString(node, TARGET_ARGUMENTS);
|
||||||
if (option != null) {
|
if (option != null) {
|
||||||
target.setBuildArguments(option);
|
target.setBuildArguments(option);
|
||||||
}
|
}
|
||||||
|
option = getString(node, TARGET);
|
||||||
|
if (option != null) {
|
||||||
|
target.setBuildTarget(option);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
add(target);
|
add(target);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
@ -113,17 +132,17 @@ public class ProjectTargets {
|
||||||
}
|
}
|
||||||
return new IMakeTarget[0];
|
return new IMakeTarget[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMakeTarget findTarget(IContainer container, String name) {
|
public IMakeTarget findTarget(IContainer container, String name) {
|
||||||
ArrayList list = (ArrayList) targetMap.get(container);
|
ArrayList list = (ArrayList) targetMap.get(container);
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
Iterator targets = list.iterator();
|
Iterator targets = list.iterator();
|
||||||
while( targets.hasNext()) {
|
while (targets.hasNext()) {
|
||||||
IMakeTarget target = (IMakeTarget)targets.next();
|
IMakeTarget target = (IMakeTarget) targets.next();
|
||||||
if ( target.getName().equals(name) ) {
|
if (target.getName().equals(name)) {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -165,11 +184,46 @@ public class ProjectTargets {
|
||||||
|
|
||||||
protected Document getAsXML() throws IOException {
|
protected Document getAsXML() throws IOException {
|
||||||
Document doc = new DocumentImpl();
|
Document doc = new DocumentImpl();
|
||||||
Element configRootElement = doc.createElement(BUILD_TARGET_ELEMENT);
|
Element targetsRootElement = doc.createElement(BUILD_TARGET_ELEMENT);
|
||||||
doc.appendChild(configRootElement);
|
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;
|
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 {
|
public void saveTargets(OutputStream output) throws IOException {
|
||||||
Document doc = getAsXML();
|
Document doc = getAsXML();
|
||||||
OutputFormat format = new OutputFormat();
|
OutputFormat format = new OutputFormat();
|
||||||
|
|
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 161 B |
BIN
build/org.eclipse.cdt.make.ui/icons/obj16/error_obj.gif
Normal file
BIN
build/org.eclipse.cdt.make.ui/icons/obj16/error_obj.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 161 B |
|
@ -12,12 +12,10 @@ WizardConvertMakeProject.description=Convert a C/C++ Project to use a simple mak
|
||||||
|
|
||||||
MenuMakeNew.label=Make Builds
|
MenuMakeNew.label=Make Builds
|
||||||
|
|
||||||
ActionMakeBuildCreate.label=Build/Create Make Target...
|
ActionMakeCreateTarget.label=Create Make Target...
|
||||||
ActionMakeAll.label=Make all
|
ActionMakeBuildTarget.label=Build Make Target...
|
||||||
ActionMakeClean.label=Make clean
|
|
||||||
ActionMakeRebuild.label=Make rebuild
|
|
||||||
ActionMakeUpdate.label=Update Old Make Project...
|
|
||||||
|
|
||||||
|
ActionMakeUpdate.label=Update Old Make Project...
|
||||||
|
|
||||||
CommandMakeBuildCreate.name=Build/Create Make Target
|
CommandMakeBuildCreate.name=Build/Create Make Target
|
||||||
CommandMakeBuildCreate.description=Build or create a new make build target
|
CommandMakeBuildCreate.description=Build or create a new make build target
|
||||||
|
@ -28,4 +26,5 @@ PropertyMakeProject.name= C/C++ Make Project
|
||||||
ViewCatagoryMake.name=Make
|
ViewCatagoryMake.name=Make
|
||||||
ViewMake.name=Make Targets
|
ViewMake.name=Make Targets
|
||||||
|
|
||||||
ActionSetMake.label=Make Action Set
|
ActionSetMake.label=Make Actions
|
||||||
|
ActionSetUpdateMake.label=Update Make Projects
|
||||||
|
|
|
@ -77,11 +77,18 @@
|
||||||
adaptable="false"
|
adaptable="false"
|
||||||
id="org.eclipse.cdt.make.ui.popupMenu.CViewContribution">
|
id="org.eclipse.cdt.make.ui.popupMenu.CViewContribution">
|
||||||
<action
|
<action
|
||||||
label="%ActionMakeBuildCreate.label"
|
label="%ActionMakeCreateTarget.label"
|
||||||
class="org.eclipse.cdt.make.ui.actions.CreateBuildAction"
|
class="org.eclipse.cdt.make.ui.actions.CreateTargetAction"
|
||||||
menubarPath="buildGroup"
|
menubarPath="buildGroup"
|
||||||
enablesFor="1"
|
enablesFor="1"
|
||||||
id="org.eclipse.cdt.make.ui.CViewCreateBuildAction">
|
id="org.eclipse.cdt.make.ui.CViewCreateTargetAction">
|
||||||
|
</action>
|
||||||
|
<action
|
||||||
|
label="%ActionMakeBuildTarget.label"
|
||||||
|
class="org.eclipse.cdt.make.ui.actions.BuildTargetAction"
|
||||||
|
menubarPath="buildGroup"
|
||||||
|
enablesFor="1"
|
||||||
|
id="org.eclipse.cdt.make.ui.CViewBuildTargetAction">
|
||||||
</action>
|
</action>
|
||||||
<filter
|
<filter
|
||||||
name="projectNature"
|
name="projectNature"
|
||||||
|
@ -93,11 +100,11 @@
|
||||||
adaptable="false"
|
adaptable="false"
|
||||||
id="org.eclipse.cdt.make.ui.popupMenu.NavigatorContribution">
|
id="org.eclipse.cdt.make.ui.popupMenu.NavigatorContribution">
|
||||||
<action
|
<action
|
||||||
label="%ActionMakeBuildCreate.label"
|
label="%ActionMakeBuildTarget.label"
|
||||||
class="org.eclipse.cdt.make.ui.actions.CreateBuildAction"
|
class="org.eclipse.cdt.make.ui.actions.BuildTargetAction"
|
||||||
menubarPath="additions"
|
menubarPath="additions"
|
||||||
enablesFor="1"
|
enablesFor="1"
|
||||||
id="org.eclipse.cdt.make.ui.NavigatorCreateBuildAction">
|
id="org.eclipse.cdt.make.ui.NavigatorBuildTargetAction">
|
||||||
</action>
|
</action>
|
||||||
<filter
|
<filter
|
||||||
name="projectNature"
|
name="projectNature"
|
||||||
|
@ -144,6 +151,7 @@
|
||||||
label="%ActionMakeUpdate.label"
|
label="%ActionMakeUpdate.label"
|
||||||
class="org.eclipse.cdt.make.ui.actions.UpdateMakeProjectAction"
|
class="org.eclipse.cdt.make.ui.actions.UpdateMakeProjectAction"
|
||||||
enablesFor="+"
|
enablesFor="+"
|
||||||
|
icon="icons/ctool16/update_old.gif"
|
||||||
id="org.eclipse.cdt.make.ui.UpdateProjectMakeAction">
|
id="org.eclipse.cdt.make.ui.UpdateProjectMakeAction">
|
||||||
</action>
|
</action>
|
||||||
</objectContribution>
|
</objectContribution>
|
||||||
|
@ -187,7 +195,7 @@
|
||||||
</category>
|
</category>
|
||||||
<view
|
<view
|
||||||
name="%ViewMake.name"
|
name="%ViewMake.name"
|
||||||
icon="icons/cview16/make.gif"
|
icon="icons/cview16/make_target.gif"
|
||||||
category="org.eclipse.cdt.make.ui"
|
category="org.eclipse.cdt.make.ui"
|
||||||
class="org.eclipse.cdt.make.ui.views.MakeView"
|
class="org.eclipse.cdt.make.ui.views.MakeView"
|
||||||
id="org.eclipse.cdt.make.ui.views.MakeView">
|
id="org.eclipse.cdt.make.ui.views.MakeView">
|
||||||
|
@ -196,12 +204,48 @@
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.actionSets">
|
point="org.eclipse.ui.actionSets">
|
||||||
<actionSet
|
<actionSet
|
||||||
label="%ActionUpdateActionSet.label"
|
label="%ActionSetUpdateMake.label"
|
||||||
id="org.eclipse.cdt.make.ui.updateActionSet">
|
id="org.eclipse.cdt.make.ui.updateActionSet">
|
||||||
<action
|
<action
|
||||||
label="org.eclipse.cdt.make.ui.action1"
|
label="%ActionMakeUpdate.label"
|
||||||
class="org.eclipse.cdt.make.ui.actions.UpdateMakeProjectAction"
|
class="org.eclipse.cdt.make.ui.actions.UpdateMakeProjectAction"
|
||||||
id="org.eclipse.cdt.make.ui.action1">
|
id="org.eclipse.cdt.make.ui.UpdateMakeAction"
|
||||||
|
icon="icons/ctool16/update_old.gif"
|
||||||
|
toolbarPath="Normal"
|
||||||
|
tooltip="%ActionMakeUpdate.tooltip">
|
||||||
|
<enablement>
|
||||||
|
<and>
|
||||||
|
<not>
|
||||||
|
<objectState
|
||||||
|
name="nature"
|
||||||
|
value="org.eclipse.cdt.make.core.makeNature">
|
||||||
|
</objectState>
|
||||||
|
</not>
|
||||||
|
<objectState
|
||||||
|
name="nature"
|
||||||
|
value="org.eclipse.cdt.core.cnature">
|
||||||
|
</objectState>
|
||||||
|
<or>
|
||||||
|
<objectState
|
||||||
|
name="projectPersistentProperty"
|
||||||
|
value="org.eclipse.cdt.core.buildLocation">
|
||||||
|
</objectState>
|
||||||
|
<objectState
|
||||||
|
name="projectPersistentProperty"
|
||||||
|
value="org.eclipse.cdt.core.buildFullArguments">
|
||||||
|
</objectState>
|
||||||
|
<objectState
|
||||||
|
name="projectPersistentProperty"
|
||||||
|
value="org.eclipse.cdt.core.buildIncrementalArguments">
|
||||||
|
</objectState>
|
||||||
|
<objectState
|
||||||
|
name="projectPersistentProperty"
|
||||||
|
value="org.eclipse.cdt.make.goals">
|
||||||
|
</objectState>
|
||||||
|
</or>
|
||||||
|
</and>
|
||||||
|
</enablement>
|
||||||
|
|
||||||
</action>
|
</action>
|
||||||
</actionSet>
|
</actionSet>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
|
@ -41,6 +41,13 @@ SettingsBlock.makeWorkbench.auto=Build on resource save (Auto Build)
|
||||||
SettingsBlock.makeWorkbench.incremental=Build (Incremental Build)
|
SettingsBlock.makeWorkbench.incremental=Build (Incremental Build)
|
||||||
SettingsBlock.makeWorkbench.full=Rebuild (Full Build)
|
SettingsBlock.makeWorkbench.full=Rebuild (Full Build)
|
||||||
|
|
||||||
|
TargetBlock.target.group_label=Target
|
||||||
|
TargetBlock.target.label=Target Name:
|
||||||
|
|
||||||
|
BuildTarget.target.group_label=Build Target
|
||||||
|
BuildTarget.target.label=Build Target:
|
||||||
|
|
||||||
|
|
||||||
# String constants for the build include path and preprocessor symbols
|
# String constants for the build include path and preprocessor symbols
|
||||||
BuildPathInfoBlock.label=Paths and Symbols
|
BuildPathInfoBlock.label=Paths and Symbols
|
||||||
BuildPathInfoBlock.paths=Include paths:
|
BuildPathInfoBlock.paths=Include paths:
|
||||||
|
|
|
@ -39,9 +39,13 @@ public class MakeUIImages {
|
||||||
public static final String OBJ = "obj16/"; //$NON-NLS-1$
|
public static final String OBJ = "obj16/"; //$NON-NLS-1$
|
||||||
|
|
||||||
// For the build image
|
// For the build image
|
||||||
public static final String IMG_OBJS_BUILD_TARGET = NAME_PREFIX + "target.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_BUILD_TARGET = NAME_PREFIX + "target_obj.gif"; //$NON-NLS-1$
|
||||||
public static final ImageDescriptor DESC_BUILD_TARGET = createManaged(OBJ, IMG_OBJS_BUILD_TARGET);
|
public static final ImageDescriptor DESC_BUILD_TARGET = createManaged(OBJ, IMG_OBJS_BUILD_TARGET);
|
||||||
|
|
||||||
|
public static final String IMG_OBJS_ERROR = NAME_PREFIX + "error_obj.gif";
|
||||||
|
public static final ImageDescriptor DESC_OBJ_ERROR = createManaged(OBJ, IMG_OBJS_ERROR);
|
||||||
|
|
||||||
|
|
||||||
public static final String IMG_TOOLS_MAKE_TARGET_BUILD = NAME_PREFIX + "target_build.gif"; //$NON-NLS-1$
|
public static final String IMG_TOOLS_MAKE_TARGET_BUILD = NAME_PREFIX + "target_build.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_TOOLS_MAKE_TARGET_ADD = NAME_PREFIX + "target_add.gif"; //$NON-NLS-1$
|
public static final String IMG_TOOLS_MAKE_TARGET_ADD = NAME_PREFIX + "target_add.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_TOOLS_MAKE_TARGET_DELETE = NAME_PREFIX + "target_delete.gif"; //$NON-NLS-1$
|
public static final String IMG_TOOLS_MAKE_TARGET_DELETE = NAME_PREFIX + "target_delete.gif"; //$NON-NLS-1$
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
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
|
||||||
|
* <code>clearErrorMessage</code> 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,7 +25,7 @@ import org.eclipse.ui.IWorkbenchWindow;
|
||||||
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
||||||
import org.eclipse.ui.actions.ActionDelegate;
|
import org.eclipse.ui.actions.ActionDelegate;
|
||||||
|
|
||||||
public class CreateBuildAction extends ActionDelegate implements IObjectActionDelegate, IWorkbenchWindowActionDelegate {
|
public class BuildTargetAction extends ActionDelegate implements IObjectActionDelegate, IWorkbenchWindowActionDelegate {
|
||||||
|
|
||||||
IWorkbenchPart fPart;
|
IWorkbenchPart fPart;
|
||||||
IContainer fContainer;
|
IContainer fContainer;
|
||||||
|
@ -33,16 +33,15 @@ public class CreateBuildAction extends ActionDelegate implements IObjectActionDe
|
||||||
public void run(IAction action) {
|
public void run(IAction action) {
|
||||||
if ( fContainer != null ) {
|
if ( fContainer != null ) {
|
||||||
BuildTargetDialog dialog = new BuildTargetDialog(fPart.getSite().getShell(), fContainer);
|
BuildTargetDialog dialog = new BuildTargetDialog(fPart.getSite().getShell(), fContainer);
|
||||||
dialog.setOpenMode(BuildTargetDialog.OPEN_MODE_BUILD);
|
|
||||||
String name;
|
String name;
|
||||||
try {
|
try {
|
||||||
name = (String) fContainer.getSessionProperty(new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"));
|
name = (String) fContainer.getSessionProperty(new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"));
|
||||||
IMakeTarget target = MakeCorePlugin.getDefault().getTargetManager().findTarget(fContainer, name);
|
IMakeTarget target = MakeCorePlugin.getDefault().getTargetManager().findTarget(fContainer, name);
|
||||||
dialog.setSelectedTarget(target);
|
dialog.setTarget(target);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
dialog.open();
|
dialog.open();
|
||||||
IMakeTarget target = dialog.getSelectedTarget();
|
IMakeTarget target = dialog.getTarget();
|
||||||
if ( target != null ) {
|
if ( target != null ) {
|
||||||
try {
|
try {
|
||||||
fContainer.setSessionProperty(new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"), target.getName());
|
fContainer.setSessionProperty(new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"), target.getName());
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* 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.core.model.ICContainer;
|
||||||
|
import org.eclipse.cdt.make.ui.dialogs.MakeTargetDialog;
|
||||||
|
import org.eclipse.core.resources.IContainer;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.jface.action.IAction;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
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 class CreateTargetAction extends ActionDelegate implements IObjectActionDelegate, IWorkbenchWindowActionDelegate {
|
||||||
|
|
||||||
|
IWorkbenchPart fPart;
|
||||||
|
IContainer fContainer;
|
||||||
|
|
||||||
|
public void run(IAction action) {
|
||||||
|
if ( fContainer != null ) {
|
||||||
|
MakeTargetDialog dialog;
|
||||||
|
try {
|
||||||
|
dialog = new MakeTargetDialog(fPart.getSite().getShell(), fContainer);
|
||||||
|
dialog.open();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||||
|
fPart = targetPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(IWorkbenchWindow window) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectionChanged(IAction action, ISelection selection) {
|
||||||
|
if ( selection instanceof IStructuredSelection ) {
|
||||||
|
IStructuredSelection sel = (IStructuredSelection)selection;
|
||||||
|
if ( sel.getFirstElement() instanceof ICContainer ) {
|
||||||
|
fContainer = (IContainer) ((ICContainer)sel.getFirstElement()).getUnderlyingResource();
|
||||||
|
} else if (sel.getFirstElement() instanceof IContainer ) {
|
||||||
|
fContainer = (IContainer)sel.getFirstElement();
|
||||||
|
} else {
|
||||||
|
fContainer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,8 +17,10 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
|
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||||
import org.eclipse.jface.operation.IRunnableContext;
|
import org.eclipse.jface.operation.IRunnableContext;
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.IEditorInput;
|
import org.eclipse.ui.IEditorInput;
|
||||||
import org.eclipse.ui.IEditorPart;
|
import org.eclipse.ui.IEditorPart;
|
||||||
import org.eclipse.ui.IEditorReference;
|
import org.eclipse.ui.IEditorReference;
|
||||||
|
@ -67,7 +69,16 @@ public class TargetBuild {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static public void run(boolean fork, IRunnableContext context, final IMakeTarget[] targets) {
|
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 {
|
try {
|
||||||
context.run(fork, true, new IRunnableWithProgress() {
|
context.run(fork, true, new IRunnableWithProgress() {
|
||||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||||
|
@ -91,8 +102,6 @@ public class TargetBuild {
|
||||||
});
|
});
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
return;
|
return;
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
MakeUIPlugin.logException(e, "Build Error", "Error Building Projects");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,159 +1,21 @@
|
||||||
package org.eclipse.cdt.make.ui.dialogs;
|
package org.eclipse.cdt.make.ui.dialogs;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
|
|
||||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
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.utils.ui.controls.ControlFactory;
|
|
||||||
import org.eclipse.cdt.utils.ui.controls.RadioButtonsArea;
|
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.jface.dialogs.TitleAreaDialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
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.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
|
||||||
|
|
||||||
public class BuildTargetDialog extends TitleAreaDialog {
|
public class BuildTargetDialog extends Dialog {
|
||||||
private IMakeTarget fSelection;
|
|
||||||
public static int OPEN_MODE_BUILD = 1;
|
public BuildTargetDialog(Shell shell, IContainer fContainer) {
|
||||||
public static int OPEN_MODE_CREATE_NEW = 2;
|
super(shell);
|
||||||
public static int OPEN_MODE_RENAME = 2;
|
|
||||||
|
|
||||||
private int openMode;
|
|
||||||
|
|
||||||
private static final String PREFIX = "SettingsBlock"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
private static final String MAKE_SETTING_GROUP = PREFIX + ".makeSetting.group_label"; //$NON-NLS-1$
|
|
||||||
private static final String MAKE_SETTING_KEEP_GOING = PREFIX + ".makeSetting.keepOnGoing"; //$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 KEEP_ARG = "keep"; //$NON-NLS-1$
|
|
||||||
private static final String STOP_ARG = "stop"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
RadioButtonsArea stopRadioButtons;
|
|
||||||
Text buildCommand;
|
|
||||||
Button defButton;
|
|
||||||
|
|
||||||
IMakeBuilderInfo fBuildInfo;
|
|
||||||
IMakeTargetManager fTargetManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param parentShell
|
|
||||||
*/
|
|
||||||
public BuildTargetDialog(Shell parentShell, IContainer container) {
|
|
||||||
super(parentShell);
|
|
||||||
fTargetManager = MakeCorePlugin.getDefault().getTargetManager();
|
|
||||||
String[] id = fTargetManager.getTargetBuilders(container.getProject());
|
|
||||||
if (id.length > 0) {
|
|
||||||
fBuildInfo = MakeCorePlugin.createBuildInfo(new HashMap(), id[0]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public void setTarget(IMakeTarget target) {
|
||||||
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
protected Control createDialogArea(Composite parent) {
|
|
||||||
Control control = super.createDialogArea(parent);
|
|
||||||
|
|
||||||
createSettingControls(parent);
|
|
||||||
createBuildCmdControls(parent);
|
|
||||||
|
|
||||||
return control;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createSettingControls(Composite parent) {
|
public IMakeTarget getTarget() {
|
||||||
String[][] radios = new String[][] { { MakeUIPlugin.getResourceString(MAKE_SETTING_STOP_ERROR), STOP_ARG }, {
|
|
||||||
MakeUIPlugin.getResourceString(MAKE_SETTING_KEEP_GOING), KEEP_ARG }
|
|
||||||
};
|
|
||||||
stopRadioButtons = new RadioButtonsArea(parent, MakeUIPlugin.getResourceString(MAKE_SETTING_GROUP), 1, radios);
|
|
||||||
GridLayout layout = new GridLayout();
|
|
||||||
layout.marginHeight = 0;
|
|
||||||
layout.marginWidth = 0;
|
|
||||||
stopRadioButtons.setLayout(layout);
|
|
||||||
if (fBuildInfo.isStopOnError())
|
|
||||||
stopRadioButtons.setSelectValue(STOP_ARG);
|
|
||||||
else
|
|
||||||
stopRadioButtons.setSelectValue(KEEP_ARG);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
stopRadioButtons.setEnabled(true);
|
|
||||||
} else {
|
|
||||||
buildCommand.setEnabled(true);
|
|
||||||
stopRadioButtons.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;
|
|
||||||
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) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
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 {
|
|
||||||
stopRadioButtons.setEnabled(false);
|
|
||||||
}
|
|
||||||
defButton.setSelection(fBuildInfo.isDefaultBuildCmd());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOpenMode(int mode) {
|
|
||||||
openMode = mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSelectedTarget(IMakeTarget target) {
|
|
||||||
fSelection = target;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IMakeTarget getSelectedTarget() {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,348 @@
|
||||||
|
/*
|
||||||
|
* 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.*;
|
||||||
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
|
import org.eclipse.cdt.utils.ui.controls.RadioButtonsArea;
|
||||||
|
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 {
|
||||||
|
|
||||||
|
private 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_KEEP_GOING = SETTING_PREFIX + ".makeSetting.keepOnGoing"; //$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$
|
||||||
|
|
||||||
|
private static final String KEEP_ARG = "keep"; //$NON-NLS-1$
|
||||||
|
private static final String STOP_ARG = "stop"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
Text targetNameText;
|
||||||
|
RadioButtonsArea stopRadioButtons;
|
||||||
|
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;
|
||||||
|
private 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();
|
||||||
|
targetName = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
createSettingControls(composite);
|
||||||
|
createBuildCmdControls(composite);
|
||||||
|
createTargetControl(composite);
|
||||||
|
|
||||||
|
return composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createNameControl(Composite parent) {
|
||||||
|
Composite composite = ControlFactory.createComposite(parent, 2);
|
||||||
|
((GridLayout) composite.getLayout()).makeColumnsEqualWidth = false;
|
||||||
|
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.setText(targetName);
|
||||||
|
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) {
|
||||||
|
String[][] radios = new String[][] { { MakeUIPlugin.getResourceString(MAKE_SETTING_STOP_ERROR), STOP_ARG }, {
|
||||||
|
MakeUIPlugin.getResourceString(MAKE_SETTING_KEEP_GOING), KEEP_ARG }
|
||||||
|
};
|
||||||
|
stopRadioButtons = new RadioButtonsArea(parent, MakeUIPlugin.getResourceString(MAKE_SETTING_GROUP), 1, radios);
|
||||||
|
if (isStopOnError)
|
||||||
|
stopRadioButtons.setSelectValue(STOP_ARG);
|
||||||
|
else
|
||||||
|
stopRadioButtons.setSelectValue(KEEP_ARG);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
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);
|
||||||
|
stopRadioButtons.setEnabled(true);
|
||||||
|
} else {
|
||||||
|
commandText.setEnabled(true);
|
||||||
|
stopRadioButtons.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 {
|
||||||
|
stopRadioButtons.setEnabled(false);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isStopOnError() {
|
||||||
|
return stopRadioButtons.getSelectedValue().equals(STOP_ARG);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
if (fTarget == null) {
|
||||||
|
target = fTargetManager.createTarget(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) {
|
||||||
|
try {
|
||||||
|
fTargetManager.addTarget(fContainer, target);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
MakeUIPlugin.errorDialog(getShell(), "Make Target Error", "Error adding target", e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!target.getName().equals(targetNameText.getText().trim())) {
|
||||||
|
try {
|
||||||
|
fTargetManager.renameTarget(target, targetNameText.getText().trim());
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.okPressed();
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,9 +8,11 @@ package org.eclipse.cdt.make.ui.views;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.make.internal.ui.MakeUIImages;
|
import org.eclipse.cdt.make.internal.ui.MakeUIImages;
|
||||||
import org.eclipse.cdt.make.ui.dialogs.BuildTargetDialog;
|
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.IContainer;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.actions.SelectionListenerAction;
|
import org.eclipse.ui.actions.SelectionListenerAction;
|
||||||
|
@ -30,9 +32,12 @@ public class AddTargetAction extends SelectionListenerAction {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
if (canAdd()) {
|
if (canAdd()) {
|
||||||
BuildTargetDialog dialog = new BuildTargetDialog(shell, (IContainer) getStructuredSelection().getFirstElement());
|
try {
|
||||||
dialog.setOpenMode(BuildTargetDialog.OPEN_MODE_CREATE_NEW);
|
MakeTargetDialog dialog = new MakeTargetDialog(shell, (IContainer) getStructuredSelection().getFirstElement());
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
MakeUIPlugin.errorDialog(shell, "Internal Error", "", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.eclipse.cdt.make.core.IMakeTarget;
|
||||||
import org.eclipse.cdt.make.internal.ui.MakeUIImages;
|
import org.eclipse.cdt.make.internal.ui.MakeUIImages;
|
||||||
import org.eclipse.cdt.make.ui.actions.TargetBuild;
|
import org.eclipse.cdt.make.ui.actions.TargetBuild;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.actions.SelectionListenerAction;
|
import org.eclipse.ui.actions.SelectionListenerAction;
|
||||||
|
@ -32,9 +31,8 @@ public class BuildTargetAction extends SelectionListenerAction {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
if (canBuild()) {
|
if (canBuild()) {
|
||||||
ProgressMonitorDialog pd = new ProgressMonitorDialog(shell);
|
|
||||||
IMakeTarget[] targets = (IMakeTarget[]) getSelectedElements().toArray(new IMakeTarget[0]);
|
IMakeTarget[] targets = (IMakeTarget[]) getSelectedElements().toArray(new IMakeTarget[0]);
|
||||||
TargetBuild.run(true, pd, targets);
|
TargetBuild.runWithProgressDialog(shell, targets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,12 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
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.MakeUIImages;
|
||||||
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
@ -46,7 +50,10 @@ public class DeleteTargetAction extends SelectionListenerAction {
|
||||||
msg = MessageFormat.format("Are you sure you want to delete ''{0}''?", new Object[] { target.getName()});
|
msg = MessageFormat.format("Are you sure you want to delete ''{0}''?", new Object[] { target.getName()});
|
||||||
} else {
|
} else {
|
||||||
title = "Confirm Multiple Target Deletion";
|
title = "Confirm Multiple Target Deletion";
|
||||||
msg = MessageFormat.format("Are you sure you want to delete these {0} targets?", new Object[] { new Integer(targets.size())});
|
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);
|
return MessageDialog.openQuestion(shell, title, msg);
|
||||||
}
|
}
|
||||||
|
@ -54,12 +61,22 @@ public class DeleteTargetAction extends SelectionListenerAction {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (canDelete() && confirmDelete() == false)
|
if (canDelete() && confirmDelete() == false)
|
||||||
return;
|
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) {
|
protected boolean updateSelection(IStructuredSelection selection) {
|
||||||
return super.updateSelection(selection) && canDelete();
|
return super.updateSelection(selection) && canDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -9,9 +9,10 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
import org.eclipse.cdt.make.core.IMakeTarget;
|
||||||
import org.eclipse.cdt.make.internal.ui.MakeUIImages;
|
import org.eclipse.cdt.make.internal.ui.MakeUIImages;
|
||||||
import org.eclipse.cdt.make.ui.dialogs.BuildTargetDialog;
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.cdt.make.ui.dialogs.MakeTargetDialog;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.actions.SelectionListenerAction;
|
import org.eclipse.ui.actions.SelectionListenerAction;
|
||||||
|
@ -31,10 +32,13 @@ public class EditTargetAction extends SelectionListenerAction {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
if (canRename()) {
|
if (canRename()) {
|
||||||
BuildTargetDialog dialog = new BuildTargetDialog(shell, (IContainer) getStructuredSelection().getFirstElement());
|
MakeTargetDialog dialog;
|
||||||
dialog.setOpenMode(BuildTargetDialog.OPEN_MODE_CREATE_NEW);
|
try {
|
||||||
dialog.setSelectedTarget((IMakeTarget) getStructuredSelection().getFirstElement());
|
dialog = new MakeTargetDialog(shell, (IMakeTarget) getStructuredSelection().getFirstElement());
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
MakeUIPlugin.errorDialog(shell, "Internal Error", "", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue