Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Hirsl2005-05-05 16:58:24 +0000
committerVladimir Hirsl2005-05-05 16:58:24 +0000
commit6447835c74f3f7e71fd15a88981d646e7ece455e (patch)
treeb07b4004641b7ed97ef902e60b1dd214c67b2574 /build/org.eclipse.cdt.make.ui
parentea15dddbc9002ac8f04828687e9a374a59eee06f (diff)
downloadorg.eclipse.cdt-6447835c74f3f7e71fd15a88981d646e7ece455e.tar.gz
org.eclipse.cdt-6447835c74f3f7e71fd15a88981d646e7ece455e.tar.xz
org.eclipse.cdt-6447835c74f3f7e71fd15a88981d646e7ece455e.zip
Added Variables... button to Discovered options page.
Resolved some concurrency issues.
Diffstat (limited to 'build/org.eclipse.cdt.make.ui')
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties1
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryPage.java51
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java51
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java51
4 files changed, 108 insertions, 46 deletions
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 b3a44855f61..8a0bc654bd1 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
@@ -271,6 +271,7 @@ ScannerConfigOptionsDialog.siProvider.browse.button=Browse...
ScannerConfigOptionsDialog.siProvider.browse.runCommandDialog='gcc' command:
ScannerConfigOptionsDialog.siProvider.command.errorMessage=Must enter compiler invocation command
ScannerConfigOptionsDialog.apply.progressMessage=Setting scanner configuration discovery options...
+ScannerConfigOptionsDialog.common.variables.button=Variables...
ScannerConfigOptionsDialog.unsavedchanges.title=Setting C/C++ Make Project Discovery Options
ScannerConfigOptionsDialog.unsavedchanges.message=The C/C++ Make Project Discovery Options property page contains unsaved modifications. Do you want to save changes so that other discovery related settings can be updated?
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryPage.java
index 6620412b52a..f3daff028bd 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryPage.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryPage.java
@@ -10,9 +10,19 @@
***********************************************************************/
package org.eclipse.cdt.make.ui.dialogs;
+import org.eclipse.cdt.internal.ui.util.SWTUtil;
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
+import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.debug.ui.StringVariableSelectionDialog;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
/**
* Abstract SCD profile page
@@ -22,6 +32,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
public abstract class AbstractDiscoveryPage extends DialogPage {
protected static final String PREFIX = "ScannerConfigOptionsDialog"; //$NON-NLS-1$
protected static final String PROFILE_GROUP_LABEL = PREFIX + ".profile.group.label"; //$NON-NLS-1$
+ private static final String VARIABLES_BUTTON = PREFIX + ".common.variables.button"; //$NON-NLS-1$
protected AbstractDiscoveryOptionsBlock fContainer; // parent
@@ -59,6 +70,46 @@ public abstract class AbstractDiscoveryPage extends DialogPage {
super(title, image);
}
+ protected Button addVariablesButton(Composite parent, final Text control) {
+ Button variablesButton = ControlFactory.createPushButton(parent,
+ MakeUIPlugin.getResourceString(VARIABLES_BUTTON));
+ ((GridData) variablesButton.getLayoutData()).widthHint =
+ SWTUtil.getButtonWidthHint(variablesButton);
+
+ variablesButton.addSelectionListener(new SelectionAdapter() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent arg0) {
+ handleVariablesButtonSelected(control);
+ }
+ });
+ return variablesButton;
+ }
+
+ /**
+ * A variable entry button has been pressed for the given text field. Prompt
+ * the user for a variable and enter the result in the given field.
+ */
+ private void handleVariablesButtonSelected(Text textField) {
+ String variable = getVariable();
+ if (variable != null) {
+ textField.append(variable);
+ }
+ }
+
+ /**
+ * Prompts the user to choose and configure a variable and returns the
+ * resulting string, suitable to be used as an attribute.
+ */
+ private String getVariable() {
+ StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
+ dialog.open();
+ return dialog.getVariableExpression();
+ }
+
protected abstract boolean isValid();
protected abstract void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo);
protected abstract void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo);
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java
index 7eec7c3869b..c40c9a89155 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java
@@ -44,8 +44,6 @@ import org.eclipse.swt.widgets.Text;
* @author vhirsl
*/
public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage {
- private static final int DEFAULT_HEIGHT = 60;
-
private static final String BO_PROVIDER_PARSER_ENABLED_BUTTON = PREFIX + ".boProvider.parser.enabled.button"; //$NON-NLS-1$
private static final String BO_PROVIDER_OPEN_LABEL = PREFIX + ".boProvider.open.label"; //$NON-NLS-1$
private static final String BO_PROVIDER_BROWSE_BUTTON = PREFIX + ".boProvider.browse.button"; //$NON-NLS-1$
@@ -99,8 +97,24 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage {
// load label
Label loadLabel = ControlFactory.createLabel(profileGroup,
MakeUIPlugin.getResourceString(BO_PROVIDER_OPEN_LABEL));
- ((GridData) loadLabel.getLayoutData()).horizontalSpan = 3;
+ ((GridData) loadLabel.getLayoutData()).horizontalSpan = 2;
+ // load button
+ bopLoadButton = ControlFactory.createPushButton(profileGroup,
+ MakeUIPlugin.getResourceString(BO_PROVIDER_LOAD_BUTTON));
+ ((GridData) bopLoadButton.getLayoutData()).widthHint =
+ SWTUtil.getButtonWidthHint(bopLoadButton);
+ bopLoadButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent event) {
+ handleBOPLoadFileButtonSelected();
+ }
+
+ });
+ if (getContainer().getProject() == null) { // project properties
+ bopLoadButton.setVisible(false);
+ }
+
// text field
bopOpenFileText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
bopOpenFileText.addModifyListener(new ModifyListener() {
@@ -108,6 +122,7 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage {
handleModifyOpenFileText();
}
});
+ bopLoadButton.setEnabled(loadButtonInitialEnabled && handleModifyOpenFileText());
// browse button
Button browseButton = ControlFactory.createPushButton(profileGroup,
@@ -141,22 +156,8 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage {
}
});
- // load button
- bopLoadButton = ControlFactory.createPushButton(profileGroup,
- MakeUIPlugin.getResourceString(BO_PROVIDER_LOAD_BUTTON));
- ((GridData) bopLoadButton.getLayoutData()).widthHint =
- SWTUtil.getButtonWidthHint(bopLoadButton);
- bopLoadButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent event) {
- handleBOPLoadFileButtonSelected();
- }
-
- });
- bopLoadButton.setEnabled(loadButtonInitialEnabled);
- if (getContainer().getProject() == null) { // project properties
- bopLoadButton.setVisible(false);
- }
+ // variable button
+ addVariablesButton(profileGroup, bopOpenFileText);
setControl(page);
// set the shell variable; must be after setControl
@@ -169,11 +170,12 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage {
initializeValues();
}
- protected void handleModifyOpenFileText() {
+ protected boolean handleModifyOpenFileText() {
String fileName = getBopOpenFileText();
bopLoadButton.setEnabled(bopEnabledButton.getSelection() &&
fileName.length() > 0 &&
(new File(fileName)).exists());
+ return bopLoadButton.getEnabled();
}
private String getBopOpenFileText() {
@@ -235,15 +237,18 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage {
public void run() {
if (!instance.shell.isDisposed()) {
- instance.bopLoadButton.setEnabled(instance.bopEnabledButton.getSelection());
+ loadButtonInitialEnabled = instance.bopEnabledButton.getSelection() && handleModifyOpenFileText();
+ instance.bopLoadButton.setEnabled(loadButtonInitialEnabled);
+ }
+ else {
+ loadButtonInitialEnabled = true;
}
- loadButtonInitialEnabled = instance.bopEnabledButton.getSelection();//true;
}
});
}
else {
- loadButtonInitialEnabled = instance.bopEnabledButton.getSelection();//true;
+ loadButtonInitialEnabled = true;
}
}
//lock.release();
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java
index 780e683734e..0019ba6a086 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java
@@ -44,8 +44,6 @@ import org.eclipse.swt.widgets.Text;
* @author vhirsl
*/
public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
- private static final int DEFAULT_HEIGHT = 160;
-
private static final String BO_PROVIDER_PARSER_ENABLED_BUTTON = PREFIX + ".boProvider.parser.enabled.button"; //$NON-NLS-1$
private static final String BO_PROVIDER_OPEN_LABEL = PREFIX + ".boProvider.open.label"; //$NON-NLS-1$
private static final String BO_PROVIDER_BROWSE_BUTTON = PREFIX + ".boProvider.browse.button"; //$NON-NLS-1$
@@ -111,8 +109,24 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
// load label
Label loadLabel = ControlFactory.createLabel(profileGroup,
MakeUIPlugin.getResourceString(BO_PROVIDER_OPEN_LABEL));
- ((GridData) loadLabel.getLayoutData()).horizontalSpan = 3;
+ ((GridData) loadLabel.getLayoutData()).horizontalSpan = 2;
+ // load button
+ bopLoadButton = ControlFactory.createPushButton(profileGroup,
+ MakeUIPlugin.getResourceString(BO_PROVIDER_LOAD_BUTTON));
+ ((GridData) bopLoadButton.getLayoutData()).widthHint =
+ SWTUtil.getButtonWidthHint(bopLoadButton);
+ bopLoadButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent event) {
+ handleBOPLoadFileButtonSelected();
+ }
+
+ });
+ if (getContainer().getProject() == null) { // project properties
+ bopLoadButton.setVisible(false);
+ }
+
// text field
bopOpenFileText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
bopOpenFileText.addModifyListener(new ModifyListener() {
@@ -120,6 +134,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
handleModifyOpenFileText();
}
});
+ bopLoadButton.setEnabled(loadButtonInitialEnabled && handleModifyOpenFileText());
// browse button
Button browseButton = ControlFactory.createPushButton(profileGroup,
@@ -153,22 +168,8 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
}
});
- // load button
- bopLoadButton = ControlFactory.createPushButton(profileGroup,
- MakeUIPlugin.getResourceString(BO_PROVIDER_LOAD_BUTTON));
- ((GridData) bopLoadButton.getLayoutData()).widthHint =
- SWTUtil.getButtonWidthHint(bopLoadButton);
- bopLoadButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent event) {
- handleBOPLoadFileButtonSelected();
- }
-
- });
- bopLoadButton.setEnabled(loadButtonInitialEnabled);
- if (getContainer().getProject() == null) { // project properties
- bopLoadButton.setVisible(false);
- }
+ // variable button
+ addVariablesButton(profileGroup, bopOpenFileText);
ControlFactory.createSeparator(profileGroup, 3);
@@ -238,11 +239,12 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
initializeValues();
}
- protected void handleModifyOpenFileText() {
+ protected boolean handleModifyOpenFileText() {
String fileName = getBopOpenFileText();
bopLoadButton.setEnabled(bopEnabledButton.getSelection() &&
fileName.length() > 0 &&
new File(fileName).exists());
+ return bopLoadButton.getEnabled();
}
protected void handleModifyRunCommandText() {
@@ -313,15 +315,18 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
public void run() {
if (!instance.shell.isDisposed()) {
- instance.bopLoadButton.setEnabled(instance.bopEnabledButton.getSelection());
+ loadButtonInitialEnabled = instance.bopEnabledButton.getSelection() && handleModifyOpenFileText();
+ instance.bopLoadButton.setEnabled(loadButtonInitialEnabled);
+ }
+ else {
+ loadButtonInitialEnabled = true;
}
- loadButtonInitialEnabled = instance.bopEnabledButton.getSelection();//true;
}
});
}
else {
- loadButtonInitialEnabled = instance.bopEnabledButton.getSelection();//true;
+ loadButtonInitialEnabled = true;
}
}
//lock.release();

Back to the top