1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-15 20:25:46 +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. * Copyright (c) 2002,2003 Rational Software Corporation and others. All rights
* All rights reserved. This program and the accompanying materials * reserved. This program and the accompanying materials are made available
* are made available under the terms of the Common Public License v0.5 * under the terms of the Common Public License v0.5 which accompanies this
* which accompanies this distribution, and is available at * distribution, and is available at http://www.eclipse.org/legal/cpl-v05.html
* http://www.eclipse.org/legal/cpl-v05.html
* *
* Contributors: * Contributors: QNX Software Systems - Move to Make plugin
* QNX Software Systems - Move to Make plugin ******************************************************************************/
***********************************************************************/
package org.eclipse.cdt.make.internal.ui; package org.eclipse.cdt.make.internal.ui;
import org.eclipse.cdt.make.core.IMakeBuilderInfo; import org.eclipse.cdt.make.core.IMakeBuilderInfo;
import org.eclipse.cdt.make.core.MakeBuilder; import org.eclipse.cdt.make.core.MakeBuilder;
import org.eclipse.cdt.make.core.MakeCorePlugin; import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.ui.dialogs.AbstractErrorParserBlock; 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.resources.IProject;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Preferences;
import org.eclipse.swt.widgets.Composite;
public class ErrorParserBlock extends AbstractErrorParserBlock { public class ErrorParserBlock extends AbstractErrorParserBlock {
// make builder enabled
IMakeBuilderInfo fBuildInfo;
boolean useBuildInfo = false;
public ErrorParserBlock(Preferences prefs) { public ErrorParserBlock(Preferences prefs) {
super(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) * @see org.eclipse.cdt.ui.dialogs.ErrorParserBlock#getErrorParserIDs(org.eclipse.core.resources.IProject)
*/ */
protected String[] getErrorParserIDs(IProject project) { protected String[] getErrorParserIDs(IProject project) {
IMakeBuilderInfo info; if (getContainer().getProject() != null && fBuildInfo == null) {
try { try {
info = MakeCorePlugin.createBuildInfo(project, MakeBuilder.BUILDER_ID); fBuildInfo = MakeCorePlugin.createBuildInfo(getContainer().getProject(), MakeBuilder.BUILDER_ID);
} catch (CoreException e) { } catch (CoreException e) {
return new String[0]; }
} }
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 { public void saveErrorParsers(IProject project, String[] parserIDs) throws CoreException {
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(project, MakeBuilder.BUILDER_ID); if (getContainer().getProject() != null && fBuildInfo == null) {
info.setErrorParsers(parserIDs); 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.group_label=Target
TargetBlock.target.label=Target Name: TargetBlock.target.label=Target Name:
ErrorParserBlock.label.missingBuilderInformation=Builder is missing or disabled on project.
BuildTarget.target.group_label=Make Target BuildTarget.target.group_label=Make Target
BuildTarget.target.label=Make Target: BuildTarget.target.label=Make Target:
@ -142,7 +144,7 @@ MakeTargetDialog.exception.makeTargetError=Make Target Error
MakeTargetDialog.exception.errorAddingTarget=Error adding target MakeTargetDialog.exception.errorAddingTarget=Error adding target
SettingsBlock.title.selectLocationToBuildFrom=Selection Location to build from. 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.monitor.applyingSettings=Applying Settings...
SettingsBlock.message.mustEnterBuildCommand=Must enter a build command 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.group_label=Build output parser options
ScannerConfigOptionsDialog.siBuilder.parser.enable.label=Enable build output parser ScannerConfigOptionsDialog.siBuilder.parser.enable.label=Enable build output parser
ScannerConfigOptionsDialog.siBuilder.parser.label=Make 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.group_label=Generate scanner info command options
ScannerConfigOptionsDialog.siProvider.cmd.enable.label=Enable generate scanner info command ScannerConfigOptionsDialog.siProvider.cmd.enable.label=Enable generate scanner info command
ScannerConfigOptionsDialog.siProvider.cmd.use_default=Use default ScannerConfigOptionsDialog.siProvider.cmd.use_default=Use default

View file

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

View file

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