1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00
This commit is contained in:
David Inglis 2006-05-11 16:38:16 +00:00
parent 975237b92a
commit 825bc6be8c
4 changed files with 58 additions and 11 deletions

View file

@ -140,9 +140,9 @@ public class MakeBuilder extends ACBuilder {
// remove all markers for this project
removeAllMarkers(currProject);
IPath workingDirectory = null;
if (!info.getBuildLocation().isEmpty()) {
IResource res = currProject.getParent().findMember(info.getBuildLocation());
IPath workingDirectory = info.getBuildLocation();
if (workingDirectory != null && !workingDirectory.isEmpty()) {
IResource res = currProject.getParent().findMember(workingDirectory);
if (res instanceof IContainer && res.exists()) {
workingDirectory = res.getLocation();
}

View file

@ -21,6 +21,8 @@ import org.eclipse.cdt.core.CommandLauncher;
import org.eclipse.cdt.core.IMarkerGenerator;
import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
import org.eclipse.cdt.make.core.MakeBuilder;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IExternalScannerInfoProvider;
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
@ -30,8 +32,10 @@ import org.eclipse.cdt.make.internal.core.StreamMonitor;
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerInfoConsoleParserFactory;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@ -157,7 +161,29 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
* @return boolean
*/
protected boolean initialize() {
fWorkingDirectory = resource.getProject().getLocation();
IProject currProject = resource.getProject();
IMakeBuilderInfo info;
try {
info = MakeCorePlugin.createBuildInfo(resource.getProject(), MakeBuilder.BUILDER_ID);
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new RuntimeException(e);
}
IPath workingDirectory = info.getBuildLocation();
if (workingDirectory != null && !workingDirectory.isEmpty()) {
IResource res = currProject.getParent().findMember(workingDirectory);
if (res instanceof IContainer && res.exists()) {
workingDirectory = res.getLocation();
}
}
if (workingDirectory == null) {
workingDirectory = currProject.getLocation();
}
//fWorkingDirectory = resource.getProject().getLocation();
fWorkingDirectory = workingDirectory;
fCompileCommand = new Path(buildInfo.getProviderRunCommand(providerId));
fCompileArguments = ScannerConfigUtil.tokenizeStringWithQuotes(buildInfo.getProviderRunArguments(providerId), "\"");//$NON-NLS-1$
return (fCompileCommand != null);

View file

@ -68,7 +68,8 @@ SettingsBlock.makeCmd.use_default=Use default
SettingsBlock.makeCmd.label=Build command:
SettingsBlock.makeDir.group_label=Build Directory
SettingsBlock.makeDir.label=Build directory:
SettingsBlock.makeDir.browse=Browse...
SettingsBlock.makeDir.browseLocal=Local...
SettingsBlock.makeDir.browseWorkspace=Workspace...
SettingsBlock.makeWorkbench.group_label=Workbench Build Behavior
SettingsBlock.makeWorkbench.type=Workbench build type:
SettingsBlock.makeWorkbench.target=Make build target:

View file

@ -43,6 +43,7 @@ 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.DirectoryDialog;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
@ -72,8 +73,9 @@ public class SettingsBlock extends AbstractCOptionPage {
private static final String MAKE_WORKBENCH_BUILD_CLEAN = PREFIX + ".makeWorkbench.clean"; //$NON-NLS-1$
private static final String MAKE_BUILD_DIR_GROUP = PREFIX + ".makeDir.group_label"; //$NON-NLS-1$
private static final String MAKE_BUILD_DIR_LABEL = PREFIX + ".makeDir.label"; //$NON-NLS-1$
private static final String MAKE_BUILD_DIR_BROWSE = PREFIX + ".makeDir.browse"; //$NON-NLS-1$
private static final String MAKE_BUILD_DIR_LABEL = PREFIX + ".makeDir.label"; //$NON-NLS-1$
private static final String MAKE_BUILD_DIR_BROWSE_LOCAL = PREFIX + ".makeDir.browseLocal"; //$NON-NLS-1$
private static final String MAKE_BUILD_DIR_BROWSE_WORKSPACE = PREFIX + ".makeDir.browseWorkspace"; //$NON-NLS-1$
private static final String MAKE_BUILD_AUTO_TARGET = PREFIX + ".makeWorkbench.autoBuildTarget"; //$NON-NLS-1$
private static final String MAKE_BUILD_INCREMENTAL_TARGET = PREFIX + ".makeWorkbench.incrementalBuildTarget"; //$NON-NLS-1$
@ -314,7 +316,7 @@ public class SettingsBlock extends AbstractCOptionPage {
protected void createBuilderWorkingDirControls(Composite parent) {
Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_GROUP), 1);
GridLayout layout = new GridLayout();
layout.numColumns = 4;
layout.numColumns = 5;
layout.makeColumnsEqualWidth = false;
group.setLayout(layout);
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@ -330,9 +332,27 @@ public class SettingsBlock extends AbstractCOptionPage {
getContainer().updateContainer();
}
});
Button browse = new Button(group, SWT.NONE);
browse.setText(MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_BROWSE));
browse.addSelectionListener(new SelectionAdapter() {
Button browseLocal = new Button(group, SWT.NONE);
browseLocal.setText(MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_BROWSE_LOCAL));
browseLocal.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE);
dialog.setText(MakeUIPlugin.getResourceString("SettingsBlock.title.selectLocationToBuildFrom"));
dialog.setFilterPath(getContainer().getProject().toString());
String directory = dialog.open();
if (directory != null) {
if (directory.trim().length() > 0) {
buildLocation.setText(directory);
}
}
}
});
Button browseWorkspace = new Button(group, SWT.NONE);
browseWorkspace.setText(MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_BROWSE_WORKSPACE));
browseWorkspace.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), getContainer().getProject(), true,