mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
[236186] - fixing bugs with make targets, contributed by Andrew Gvozdev
This commit is contained in:
parent
1f982fd80c
commit
a10ab1f0bf
2 changed files with 33 additions and 30 deletions
|
@ -375,6 +375,9 @@ public class ProjectTargets {
|
||||||
option = getString(node, TARGET_ARGUMENTS);
|
option = getString(node, TARGET_ARGUMENTS);
|
||||||
if (option != null) {
|
if (option != null) {
|
||||||
target.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, option);
|
target.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, option);
|
||||||
|
} else if (!target.isDefaultBuildCmd()) {
|
||||||
|
// Clear build-arguments set in target constructor to project defaults
|
||||||
|
target.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
option = getString(node, BAD_TARGET);
|
option = getString(node, BAD_TARGET);
|
||||||
if (option != null) {
|
if (option != null) {
|
||||||
|
|
|
@ -80,6 +80,30 @@ public class MakeTargetDialog extends Dialog {
|
||||||
protected IMakeTarget fTarget;
|
protected IMakeTarget fTarget;
|
||||||
private boolean initializing = true;
|
private boolean initializing = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Listener class to verify correctness of input and display an error message
|
||||||
|
*/
|
||||||
|
private class UpdateStatusLineListener implements Listener {
|
||||||
|
|
||||||
|
private void setStatusLine() {
|
||||||
|
fStatusLine.setErrorMessage(null);
|
||||||
|
|
||||||
|
if (targetNameText.getText().trim().equals("")) { //$NON-NLS-1$
|
||||||
|
fStatusLine.setErrorMessage(
|
||||||
|
MakeUIPlugin.getResourceString("MakeTargetDialog.message.mustSpecifyName")); //$NON-NLS-1$
|
||||||
|
} else if (commandText.isEnabled() && commandText.getText().trim().equals("")) { //$NON-NLS-1$
|
||||||
|
fStatusLine.setErrorMessage(
|
||||||
|
MakeUIPlugin.getResourceString("MakeTargetDialog.message.mustSpecifyBuildCommand")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleEvent(Event e) {
|
||||||
|
setStatusLine();
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param parentShell
|
* @param parentShell
|
||||||
*/
|
*/
|
||||||
|
@ -91,7 +115,7 @@ public class MakeTargetDialog extends Dialog {
|
||||||
buildCommand = target.getBuildCommand();
|
buildCommand = target.getBuildCommand();
|
||||||
buildArguments = target.getBuildArguments();
|
buildArguments = target.getBuildArguments();
|
||||||
targetName = target.getName();
|
targetName = target.getName();
|
||||||
targetString = target.getBuildAttribute(IMakeTarget.BUILD_TARGET, "all"); //$NON-NLS-1$
|
targetString = target.getBuildAttribute(IMakeTarget.BUILD_TARGET, ""); //$NON-NLS-1$
|
||||||
targetBuildID = target.getTargetBuilderID();
|
targetBuildID = target.getTargetBuilderID();
|
||||||
runAllBuilders = target.runAllBuilders();
|
runAllBuilders = target.runAllBuilders();
|
||||||
}
|
}
|
||||||
|
@ -116,6 +140,8 @@ public class MakeTargetDialog extends Dialog {
|
||||||
buildCommand = buildInfo.getBuildCommand();
|
buildCommand = buildInfo.getBuildCommand();
|
||||||
buildArguments = buildInfo.getBuildArguments();
|
buildArguments = buildInfo.getBuildArguments();
|
||||||
targetString = buildInfo.getIncrementalBuildTarget();
|
targetString = buildInfo.getIncrementalBuildTarget();
|
||||||
|
|
||||||
|
setShellStyle(getShellStyle() | SWT.RESIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void configureShell(Shell newShell) {
|
protected void configureShell(Shell newShell) {
|
||||||
|
@ -168,26 +194,8 @@ public class MakeTargetDialog extends Dialog {
|
||||||
targetNameText = ControlFactory.createTextField(composite, SWT.SINGLE | SWT.BORDER);
|
targetNameText = ControlFactory.createTextField(composite, SWT.SINGLE | SWT.BORDER);
|
||||||
((GridData) (targetNameText.getLayoutData())).horizontalAlignment = GridData.FILL;
|
((GridData) (targetNameText.getLayoutData())).horizontalAlignment = GridData.FILL;
|
||||||
((GridData) (targetNameText.getLayoutData())).grabExcessHorizontalSpace = true;
|
((GridData) (targetNameText.getLayoutData())).grabExcessHorizontalSpace = true;
|
||||||
targetNameText.addListener(SWT.Modify, new Listener() {
|
|
||||||
|
|
||||||
public void handleEvent(Event e) {
|
targetNameText.addListener(SWT.Modify, new UpdateStatusLineListener());
|
||||||
String newName = targetNameText.getText().trim();
|
|
||||||
if (newName.equals("")) { //$NON-NLS-1$
|
|
||||||
fStatusLine.setErrorMessage(MakeUIPlugin.getResourceString("MakeTargetDialog.message.mustSpecifyName")); //$NON-NLS-1$
|
|
||||||
} else
|
|
||||||
try {
|
|
||||||
if (fTarget != null && fTarget.getName().equals(newName)
|
|
||||||
|| fTargetManager.findTarget(fContainer, newName) == null) {
|
|
||||||
fStatusLine.setErrorMessage(null);
|
|
||||||
} else {
|
|
||||||
fStatusLine.setErrorMessage(MakeUIPlugin.getResourceString("MakeTargetDialog.message.targetWithNameExists")); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
} catch (CoreException ex) {
|
|
||||||
fStatusLine.setErrorMessage(ex.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
updateButtons();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createSettingControls(Composite parent) {
|
protected void createSettingControls(Composite parent) {
|
||||||
|
@ -254,17 +262,9 @@ public class MakeTargetDialog extends Dialog {
|
||||||
commandText = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER);
|
commandText = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER);
|
||||||
((GridData) (commandText.getLayoutData())).horizontalAlignment = GridData.FILL;
|
((GridData) (commandText.getLayoutData())).horizontalAlignment = GridData.FILL;
|
||||||
((GridData) (commandText.getLayoutData())).grabExcessHorizontalSpace = true;
|
((GridData) (commandText.getLayoutData())).grabExcessHorizontalSpace = true;
|
||||||
commandText.addListener(SWT.Modify, new Listener() {
|
|
||||||
|
|
||||||
public void handleEvent(Event e) {
|
commandText.addListener(SWT.Modify, new UpdateStatusLineListener());
|
||||||
if (commandText.getText().equals("")) { //$NON-NLS-1$
|
|
||||||
fStatusLine.setErrorMessage(MakeUIPlugin.getResourceString("MakeTargetDialog.message.mustSpecifyBuildCommand")); //$NON-NLS-1$
|
|
||||||
} else {
|
|
||||||
fStatusLine.setErrorMessage(null);
|
|
||||||
}
|
|
||||||
updateButtons();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (isDefaultCommand) {
|
if (isDefaultCommand) {
|
||||||
commandText.setEnabled(false);
|
commandText.setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue