From ad08a349a9427207a7122ee6d916c366d9cfb6c5 Mon Sep 17 00:00:00 2001 From: David Inglis Date: Tue, 8 Jun 2004 19:05:08 +0000 Subject: [PATCH] added Note: to help clearify workbench auto build option --- .../make/internal/ui/MakeResources.properties | 2 + .../cdt/make/ui/dialogs/SettingsBlock.java | 59 +++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties index 3dc95168814..0d37c9d9ee2 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties @@ -43,6 +43,8 @@ SettingsBlock.makeWorkbench.group_label=Workbench Build Behavior SettingsBlock.makeWorkbench.type=Workbench build type: SettingsBlock.makeWorkbench.target=Make build target: SettingsBlock.makeWorkbench.auto=Build on resource save (Auto Build) +SettingsBlock.makeWorkbench.note=Note: +SettingsBlock.makeWorkbench.autobuildMessage=See Workbench automatic build preference. SettingsBlock.makeWorkbench.incremental=Build (Incremental Build) SettingsBlock.makeWorkbench.full=Rebuild (Full Build) SettingsBlock.makeWorkbench.clean=Clean diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java index b5959df0de4..5c632cb6457 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java @@ -20,10 +20,16 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Preferences; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.window.Window; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Font; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; @@ -175,10 +181,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); +// } targetAuto = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER); targetAuto.setText(fBuildInfo.getAutoBuildTarget()); ((GridData) (targetAuto.getLayoutData())).horizontalAlignment = GridData.FILL; ((GridData) (targetAuto.getLayoutData())).grabExcessHorizontalSpace = true; + 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); incrButton.setSelection(fBuildInfo.isIncrementalBuildEnabled()); @@ -202,8 +217,52 @@ public class SettingsBlock extends AbstractCOptionPage { ((GridData) (targetClean.getLayoutData())).horizontalAlignment = GridData.FILL; ((GridData) (targetClean.getLayoutData())).grabExcessHorizontalSpace = true; selectionAdapter.widgetSelected(null); + } + 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 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); + } + }); + + Label messageLabel = new Label(messageComposite, SWT.WRAP); + messageLabel.setText(message); + messageLabel.setFont(font); + return messageComposite; + } + protected void createBuilderWorkingDirControls(Composite parent) { Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_GROUP), 1); GridLayout layout = new GridLayout();