1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-13 19:25:38 +02:00

fix for bug 72228

This commit is contained in:
David Inglis 2004-08-19 15:32:26 +00:00
parent b9768b37d5
commit db30e1599c
4 changed files with 175 additions and 99 deletions

View file

@ -1,48 +1,97 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
/*******************************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others. All rights
* reserved. This program and the accompanying materials are made available
* under the terms of the Common Public License v0.5 which accompanies this
* distribution, and is available at http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* QNX Software Systems - Move to Make plugin
***********************************************************************/
* Contributors: QNX Software Systems - Move to Make plugin
******************************************************************************/
package org.eclipse.cdt.make.internal.ui;
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.ui.dialogs.AbstractErrorParserBlock;
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.swt.widgets.Composite;
public class ErrorParserBlock extends AbstractErrorParserBlock {
// make builder enabled
IMakeBuilderInfo fBuildInfo;
boolean useBuildInfo = false;
public ErrorParserBlock(Preferences prefs) {
super(prefs);
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
if (useBuildInfo == true && fBuildInfo == null) {
Composite composite = ControlFactory.createComposite(parent, 1);
setControl(composite);
ControlFactory.createEmptySpace(composite);
ControlFactory.createLabel(composite, MakeUIPlugin.getResourceString("ErrorParserBlock.label.missingBuilderInformation")); //$NON-NLS-1$
return;
}
super.createControl(parent);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.ui.dialogs.ErrorParserBlock#getErrorParserIDs(org.eclipse.core.resources.IProject)
*/
protected String[] getErrorParserIDs(IProject project) {
IMakeBuilderInfo info;
try {
info = MakeCorePlugin.createBuildInfo(project, MakeBuilder.BUILDER_ID);
} catch (CoreException e) {
return new String[0];
if (getContainer().getProject() != null && fBuildInfo == null) {
try {
fBuildInfo = MakeCorePlugin.createBuildInfo(getContainer().getProject(), MakeBuilder.BUILDER_ID);
} catch (CoreException e) {
}
}
return info.getErrorParsers();
if (fBuildInfo != null) {
return fBuildInfo.getErrorParsers();
}
return new String[0];
}
/* (non-Javadoc)
* @see org.eclipse.cdt.ui.dialogs.ErrorParserBlock#saveErrorParsers(org.eclipse.core.resources.IProject, java.lang.String[])
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.ui.dialogs.ErrorParserBlock#saveErrorParsers(org.eclipse.core.resources.IProject,
* java.lang.String[])
*/
public void saveErrorParsers(IProject project, String[] parserIDs) throws CoreException {
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(project, MakeBuilder.BUILDER_ID);
info.setErrorParsers(parserIDs);
if (getContainer().getProject() != null && fBuildInfo == null) {
try {
fBuildInfo = MakeCorePlugin.createBuildInfo(getContainer().getProject(), MakeBuilder.BUILDER_ID);
} catch (CoreException e) {
}
}
if (fBuildInfo != null) {
fBuildInfo.setErrorParsers(parserIDs);
}
}
}
public void setContainer(ICOptionContainer container) {
super.setContainer(container);
if (getContainer().getProject() != null) {
try {
fBuildInfo = MakeCorePlugin.createBuildInfo(getContainer().getProject(), MakeBuilder.BUILDER_ID);
} catch (CoreException e) {
}
useBuildInfo = true;
} else {
}
}
}

View file

@ -65,6 +65,8 @@ SettingsBlock.makeWorkbench.cleanTarget=Clean Target
TargetBlock.target.group_label=Target
TargetBlock.target.label=Target Name:
ErrorParserBlock.label.missingBuilderInformation=Builder is missing or disabled on project.
BuildTarget.target.group_label=Make Target
BuildTarget.target.label=Make Target:
@ -142,7 +144,7 @@ MakeTargetDialog.exception.makeTargetError=Make Target Error
MakeTargetDialog.exception.errorAddingTarget=Error adding target
SettingsBlock.title.selectLocationToBuildFrom=Selection Location to build from.
SettingsBlock.label.missingBuilderInformation=Missing builder information on project.
SettingsBlock.label.missingBuilderInformation=Builder is missing or disabled on project.
SettingsBlock.monitor.applyingSettings=Applying Settings...
SettingsBlock.message.mustEnterBuildCommand=Must enter a build command
@ -241,7 +243,7 @@ ScannerConfigOptionsDialog.description=Set the scanner configuration discovery o
ScannerConfigOptionsDialog.siBuilder.parser.group_label=Build output parser options
ScannerConfigOptionsDialog.siBuilder.parser.enable.label=Enable build output parser
ScannerConfigOptionsDialog.siBuilder.parser.label=Make build output parser:
ScannerConfigOptionsDialog.label.missingBuilderInformation=Missing builder information on project.
ScannerConfigOptionsDialog.label.missingBuilderInformation=Builder is missing or disabled on project.
ScannerConfigOptionsDialog.siProvider.cmd.group_label=Generate scanner info command options
ScannerConfigOptionsDialog.siProvider.cmd.enable.label=Enable generate scanner info command
ScannerConfigOptionsDialog.siProvider.cmd.use_default=Use default

View file

@ -107,7 +107,7 @@ public class DiscoveryOptionsBlock extends AbstractCOptionPage {
private Map providerParsers = new HashMap();
private String initialProviderParserId = null;
private boolean fCreatePathContainer = false;
public DiscoveryOptionsBlock() {
super(MakeUIPlugin.getResourceString(DIALOG_TITLE));
setDescription(MakeUIPlugin.getResourceString(DIALOG_DESCRIPTION));
@ -147,6 +147,10 @@ public class DiscoveryOptionsBlock extends AbstractCOptionPage {
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(org.eclipse.core.runtime.IProgressMonitor)
*/
public void performApply(IProgressMonitor monitor) throws CoreException {
// Missing builder info
if (!fInitialized) {
return;
}
if (monitor == null) {
monitor = new NullProgressMonitor();
}
@ -164,7 +168,13 @@ public class DiscoveryOptionsBlock extends AbstractCOptionPage {
needsSCNature = false;
fCreatePathContainer = true;
}
buildInfo = MakeCorePlugin.createScannerConfigBuildInfo(project, ScannerConfigBuilder.BUILDER_ID);
try {
buildInfo = MakeCorePlugin.createScannerConfigBuildInfo(project, ScannerConfigBuilder.BUILDER_ID);
} catch (CoreException e) {
// disabled builder... just log it
MakeCorePlugin.log(e);
return;
}
if (fCreatePathContainer) {
createDiscoveredPathContainer(project, monitor);
// create a new discovered scanner config store
@ -223,6 +233,10 @@ public class DiscoveryOptionsBlock extends AbstractCOptionPage {
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
*/
public void performDefaults() {
// Missing builder info
if (!fInitialized) {
return;
}
IScannerConfigBuilderInfo info;
// Populate with the default values
if (getContainer().getProject() != null) {
@ -267,7 +281,7 @@ public class DiscoveryOptionsBlock extends AbstractCOptionPage {
*/
public void createControl(Composite parent) {
// Create the composite control for the tab
int tabColumns = 2;
int tabColumns = 1;
Font font = parent.getFont();
Composite composite = ControlFactory.createComposite(parent, tabColumns);
((GridLayout)composite.getLayout()).makeColumnsEqualWidth = false;
@ -302,17 +316,18 @@ public class DiscoveryOptionsBlock extends AbstractCOptionPage {
showMissingBuilder = true;
}
if (showMissingBuilder || (!needsSCNature && !fInitialized)) {
ControlFactory.createEmptySpace(parent);
ControlFactory.createLabel(parent, MakeUIPlugin.getResourceString(MISSING_BUILDER_MSG));
return false;
}
Group scGroup = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(SC_GROUP_LABEL), numColumns);
scGroup.setFont(parent.getFont());
((GridData)scGroup.getLayoutData()).grabExcessHorizontalSpace = true;
((GridData)scGroup.getLayoutData()).horizontalSpan = numColumns;
((GridData)scGroup.getLayoutData()).horizontalAlignment = GridData.FILL;
if (showMissingBuilder || (!needsSCNature && !fInitialized)) {
ControlFactory.createLabel(scGroup, MakeUIPlugin.getResourceString(MISSING_BUILDER_MSG));
return false;
}
// Add checkbox
scEnabledButton = ControlFactory.createCheckBox(scGroup, MakeUIPlugin.getResourceString(SC_ENABLED_LABEL));
scEnabledButton.setFont(parent.getFont());
@ -506,6 +521,7 @@ public class DiscoveryOptionsBlock extends AbstractCOptionPage {
esiProviderCommand.setEnabled(isScannerConfigDiscoveryEnabled() && isProviderCommandEnabled()
&& !useDefaultESIProviderCmd());
esiProviderParserComboBox.setEnabled(isScannerConfigDiscoveryEnabled() && isProviderCommandEnabled());
enableProblemGenerationButton.setEnabled(isScannerConfigDiscoveryEnabled());
}
private boolean useDefaultESIProviderCmd() {
@ -574,13 +590,14 @@ public class DiscoveryOptionsBlock extends AbstractCOptionPage {
}
buildInfo.setESIProviderArguments(args);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#isValid()
*/
public boolean isValid() {
if (isProviderCommandEnabled() == true && useDefaultESIProviderCmd() == false) {
if (fInitialized && isProviderCommandEnabled() && !useDefaultESIProviderCmd()) {
String cmd = getSIProviderCommandLine();
if (cmd == null || cmd.length() == 0) {
return false;

View file

@ -1,16 +1,13 @@
/*******************************************************************************
* Copyright (c) 2000, 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
* Copyright (c) 2000, 2004 QNX Software Systems and others. All rights
* reserved. This program and the accompanying materials are made available
* under the terms of the Common Public License v1.0 which accompanies this
* distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
* 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.MakeCorePlugin;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
@ -80,7 +77,7 @@ public class SettingsBlock extends AbstractCOptionPage {
private static final String MAKE_BUILD_INCREMENTAL_TARGET = PREFIX + ".makeWorkbench.incrementalBuildTarget"; //$NON-NLS-1$
private static final String MAKE_BUILD_FULL_TARGET = PREFIX + ".makeWorkbench.fullBuildTarget"; //$NON-NLS-1$
private static final String MAKE_BUILD_CLEAN_TARGET = PREFIX + ".makeWorkbench.cleanTarget"; //$NON-NLS-1$
Button stopOnErrorButton;
Button defButton;
@ -128,6 +125,7 @@ public class SettingsBlock extends AbstractCOptionPage {
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);
@ -147,10 +145,11 @@ public class SettingsBlock extends AbstractCOptionPage {
((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) {
getContainer().updateContainer();
}
@ -174,6 +173,7 @@ public class SettingsBlock extends AbstractCOptionPage {
protected void createWorkBenchBuildControls(Composite parent) {
SelectionAdapter selectionAdapter = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
targetAuto.setEnabled(autoButton.getSelection());
targetFull.setEnabled(fullButton.getSelection());
@ -196,19 +196,19 @@ public class SettingsBlock extends AbstractCOptionPage {
autoButton = ControlFactory.createCheckBox(group, MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_AUTO));
autoButton.addSelectionListener(selectionAdapter);
autoButton.setSelection(fBuildInfo.isAutoBuildEnable());
// if (!MakeUIPlugin.getWorkspace().isAutoBuilding()) {
// autoButton.setEnabled(false);
// }
// if (!MakeUIPlugin.getWorkspace().isAutoBuilding()) {
// autoButton.setEnabled(false);
// }
targetAuto = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER);
targetAuto.setText(fBuildInfo.getAutoBuildTarget());
((GridData) (targetAuto.getLayoutData())).horizontalAlignment = GridData.FILL;
((GridData) (targetAuto.getLayoutData())).grabExcessHorizontalSpace = true;
addControlAccessibleListener(targetAuto, MakeUIPlugin.getResourceString(MAKE_BUILD_AUTO_TARGET));
String noteTitle= MakeUIPlugin.getResourceString("SettingsBlock.makeWorkbench.note"); //$NON-NLS-1$
String noteMessage= MakeUIPlugin.getResourceString("SettingsBlock.makeWorkbench.autobuildMessage"); //$NON-NLS-1$
Composite noteControl= createNoteComposite(JFaceResources.getDialogFont(), group, noteTitle, noteMessage);
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan= 2;
String noteTitle = MakeUIPlugin.getResourceString("SettingsBlock.makeWorkbench.note"); //$NON-NLS-1$
String noteMessage = MakeUIPlugin.getResourceString("SettingsBlock.makeWorkbench.autobuildMessage"); //$NON-NLS-1$
Composite noteControl = createNoteComposite(JFaceResources.getDialogFont(), group, noteTitle, noteMessage);
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
noteControl.setLayoutData(gd);
incrButton = ControlFactory.createCheckBox(group, MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_INCR));
incrButton.addSelectionListener(selectionAdapter);
@ -238,54 +238,49 @@ public class SettingsBlock extends AbstractCOptionPage {
}
protected Composite createNoteComposite(
Font font,
Composite composite,
String title,
String message) {
Composite messageComposite = new Composite(composite, SWT.NONE);
GridLayout messageLayout = new GridLayout();
messageLayout.numColumns = 2;
messageLayout.marginWidth = 0;
messageLayout.marginHeight = 0;
messageComposite.setLayout(messageLayout);
messageComposite.setLayoutData(
new GridData(GridData.HORIZONTAL_ALIGN_FILL));
messageComposite.setFont(font);
protected Composite createNoteComposite(Font font, Composite composite, String title, String message) {
Composite messageComposite = new Composite(composite, SWT.NONE);
GridLayout messageLayout = new GridLayout();
messageLayout.numColumns = 2;
messageLayout.marginWidth = 0;
messageLayout.marginHeight = 0;
messageComposite.setLayout(messageLayout);
messageComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
messageComposite.setFont(font);
final Label noteLabel = new Label(messageComposite, SWT.BOLD);
noteLabel.setText(title);
noteLabel.setFont(JFaceResources.getBannerFont());
noteLabel.setLayoutData(
new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
final Label noteLabel = new Label(messageComposite, SWT.BOLD);
noteLabel.setText(title);
noteLabel.setFont(JFaceResources.getBannerFont());
noteLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
final IPropertyChangeListener fontListener =
new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
if (JFaceResources.BANNER_FONT.equals(event.getProperty())) {
noteLabel.setFont(
JFaceResources.getFont(JFaceResources.BANNER_FONT));
}
final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
if (JFaceResources.BANNER_FONT.equals(event.getProperty())) {
noteLabel.setFont(JFaceResources.getFont(JFaceResources.BANNER_FONT));
}
};
JFaceResources.getFontRegistry().addListener(fontListener);
noteLabel.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
JFaceResources.getFontRegistry().removeListener(fontListener);
}
});
}
};
JFaceResources.getFontRegistry().addListener(fontListener);
noteLabel.addDisposeListener(new DisposeListener() {
Label messageLabel = new Label(messageComposite, SWT.WRAP);
messageLabel.setText(message);
messageLabel.setFont(font);
return messageComposite;
}
public void widgetDisposed(DisposeEvent event) {
JFaceResources.getFontRegistry().removeListener(fontListener);
}
});
Label messageLabel = new Label(messageComposite, SWT.WRAP);
messageLabel.setText(message);
messageLabel.setFont(font);
return messageComposite;
}
public void addControlAccessibleListener(Control control, String controlName) {
control.getAccessible().addAccessibleListener(new ControlAccessibleListener(controlName));
}
private class ControlAccessibleListener extends AccessibleAdapter {
private String controlName;
ControlAccessibleListener(String name){
ControlAccessibleListener(String name) {
controlName = name;
}
public void getName(AccessibleEvent e) {
@ -306,6 +301,7 @@ public class SettingsBlock extends AbstractCOptionPage {
((GridData) (buildLocation.getLayoutData())).horizontalAlignment = GridData.FILL;
((GridData) (buildLocation.getLayoutData())).grabExcessHorizontalSpace = true;
buildLocation.addListener(SWT.Modify, new Listener() {
public void handleEvent(Event e) {
getContainer().updateContainer();
}
@ -313,17 +309,14 @@ public class SettingsBlock extends AbstractCOptionPage {
Button browse = new Button(group, SWT.NONE);
browse.setText(MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_BROWSE));
browse.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ContainerSelectionDialog dialog =
new ContainerSelectionDialog(
getShell(),
getContainer().getProject(),
true,
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), getContainer().getProject(), true,
MakeUIPlugin.getResourceString("SettingsBlock.title.selectLocationToBuildFrom")); //$NON-NLS-1$
if (dialog.open() == Window.OK) {
Object[] selection = dialog.getResult();
if (selection.length > 0) {
buildLocation.setText(((IPath) selection[0]).toOSString());
buildLocation.setText( ((IPath)selection[0]).toOSString());
}
}
}
@ -363,17 +356,28 @@ public class SettingsBlock extends AbstractCOptionPage {
}
public void performApply(IProgressMonitor monitor) throws CoreException {
// Missing builder info
if (fBuildInfo == null) {
return;
}
if (monitor == null) {
monitor = new NullProgressMonitor();
}
IWorkspace workspace = MakeUIPlugin.getWorkspace();
// To avoid multi-build
IWorkspaceRunnable operation = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
monitor.beginTask(MakeUIPlugin.getResourceString("SettingsBlock.monitor.applyingSettings"), 1); //$NON-NLS-1$
IMakeBuilderInfo info;
IMakeBuilderInfo info = null;
if (getContainer().getProject() != null) {
info = MakeCorePlugin.createBuildInfo(getContainer().getProject(), fBuilderID);
try {
info = MakeCorePlugin.createBuildInfo(getContainer().getProject(), fBuilderID);
} catch (CoreException e) {
// disabled builder... just log it
MakeCorePlugin.log(e);
return;
}
} else {
info = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, false);
}
@ -423,6 +427,10 @@ public class SettingsBlock extends AbstractCOptionPage {
}
public void performDefaults() {
// Missing builder info
if (fBuildInfo == null) {
return;
}
IMakeBuilderInfo info;
if (getContainer().getProject() != null) {
info = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, false);
@ -500,4 +508,4 @@ public class SettingsBlock extends AbstractCOptionPage {
}
return null;
}
}
}