mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
apply setting in worksapce runnnable to reduce change notifications
This commit is contained in:
parent
b06d6f62f6
commit
9bc3504cfd
1 changed files with 58 additions and 44 deletions
|
@ -13,6 +13,8 @@ import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
|
||||||
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
import org.eclipse.cdt.utils.ui.controls.RadioButtonsArea;
|
import org.eclipse.cdt.utils.ui.controls.RadioButtonsArea;
|
||||||
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||||
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;
|
||||||
|
@ -223,11 +225,16 @@ public class SettingsBlock extends AbstractCOptionPage {
|
||||||
browse.setText(MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_BROWSE));
|
browse.setText(MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_BROWSE));
|
||||||
browse.addSelectionListener(new SelectionAdapter() {
|
browse.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), getContainer().getProject(), true, "Selection Locations to build from.");
|
ContainerSelectionDialog dialog =
|
||||||
if ( dialog.open() == ContainerSelectionDialog.OK ) {
|
new ContainerSelectionDialog(
|
||||||
|
getShell(),
|
||||||
|
getContainer().getProject(),
|
||||||
|
true,
|
||||||
|
"Selection Locations to build from.");
|
||||||
|
if (dialog.open() == ContainerSelectionDialog.OK) {
|
||||||
Object[] selection = dialog.getResult();
|
Object[] selection = dialog.getResult();
|
||||||
if (selection.length > 0) {
|
if (selection.length > 0) {
|
||||||
buildLocation.setText(((IPath)selection[0]).toOSString());
|
buildLocation.setText(((IPath) selection[0]).toOSString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,47 +277,54 @@ public class SettingsBlock extends AbstractCOptionPage {
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
monitor.beginTask("Applying Settings...", 1);
|
IWorkspace workspace = MakeUIPlugin.getWorkspace();
|
||||||
IMakeBuilderInfo info;
|
// To avoid multi-build
|
||||||
if (getContainer().getProject() != null) {
|
IWorkspaceRunnable operation = new IWorkspaceRunnable() {
|
||||||
info = MakeCorePlugin.createBuildInfo(getContainer().getProject(), fBuilderID);
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
} else {
|
monitor.beginTask("Applying Settings...", 1);
|
||||||
info = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, false);
|
IMakeBuilderInfo info;
|
||||||
}
|
if (getContainer().getProject() != null) {
|
||||||
info.setStopOnError(isStopOnError());
|
info = MakeCorePlugin.createBuildInfo(getContainer().getProject(), fBuilderID);
|
||||||
info.setUseDefaultBuildCmd(useDefaultBuildCmd());
|
} else {
|
||||||
if (!useDefaultBuildCmd()) {
|
info = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, false);
|
||||||
String bldLine = getBuildLine();
|
}
|
||||||
int start = 0;
|
info.setStopOnError(isStopOnError());
|
||||||
int end = -1;
|
info.setUseDefaultBuildCmd(useDefaultBuildCmd());
|
||||||
if (!bldLine.startsWith("\"")) { //$NON-NLS-1$
|
if (!useDefaultBuildCmd()) {
|
||||||
end = bldLine.indexOf(' ');
|
String bldLine = getBuildLine();
|
||||||
} else {
|
int start = 0;
|
||||||
start = 1;
|
int end = -1;
|
||||||
end = bldLine.indexOf('"', 1);
|
if (!bldLine.startsWith("\"")) { //$NON-NLS-1$
|
||||||
|
end = bldLine.indexOf(' ');
|
||||||
|
} else {
|
||||||
|
start = 1;
|
||||||
|
end = bldLine.indexOf('"', 1);
|
||||||
|
}
|
||||||
|
IPath path;
|
||||||
|
if (end == -1) {
|
||||||
|
path = new Path(bldLine);
|
||||||
|
} else {
|
||||||
|
path = new Path(bldLine.substring(start, end));
|
||||||
|
}
|
||||||
|
info.setBuildCommand(path);
|
||||||
|
String args = ""; //$NON-NLS-1$
|
||||||
|
if (end != -1) {
|
||||||
|
args = bldLine.substring(end + 1);
|
||||||
|
}
|
||||||
|
info.setBuildArguments(args);
|
||||||
|
}
|
||||||
|
info.setAutoBuildEnable(autoButton.getSelection());
|
||||||
|
info.setAutoBuildTarget(targetAuto.getText().trim());
|
||||||
|
info.setIncrementalBuildEnable(incrButton.getSelection());
|
||||||
|
info.setIncrementalBuildTarget(targetIncr.getText().trim());
|
||||||
|
info.setFullBuildEnable(fullButton.getSelection());
|
||||||
|
info.setFullBuildTarget(targetFull.getText().trim());
|
||||||
|
if (buildLocation != null) {
|
||||||
|
info.setBuildLocation(new Path(buildLocation.getText().trim()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
IPath path;
|
};
|
||||||
if (end == -1) {
|
workspace.run(operation, monitor);
|
||||||
path = new Path(bldLine);
|
|
||||||
} else {
|
|
||||||
path = new Path(bldLine.substring(start, end));
|
|
||||||
}
|
|
||||||
info.setBuildCommand(path);
|
|
||||||
String args = ""; //$NON-NLS-1$
|
|
||||||
if (end != -1) {
|
|
||||||
args = bldLine.substring(end + 1);
|
|
||||||
}
|
|
||||||
info.setBuildArguments(args);
|
|
||||||
}
|
|
||||||
info.setAutoBuildEnable(autoButton.getSelection());
|
|
||||||
info.setAutoBuildTarget(targetAuto.getText().trim());
|
|
||||||
info.setIncrementalBuildEnable(incrButton.getSelection());
|
|
||||||
info.setIncrementalBuildTarget(targetIncr.getText().trim());
|
|
||||||
info.setFullBuildEnable(fullButton.getSelection());
|
|
||||||
info.setFullBuildTarget(targetFull.getText().trim());
|
|
||||||
if (buildLocation != null) {
|
|
||||||
info.setBuildLocation(new Path(buildLocation.getText().trim()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void performDefaults() {
|
public void performDefaults() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue