1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

bug 288032: [Scanner Discovery] One can't change arguments of scanner discovery command

This commit is contained in:
Andrew Gvozdev 2009-08-30 02:45:15 +00:00
parent 0c33320268
commit 9982386c07
3 changed files with 49 additions and 17 deletions

View file

@ -288,6 +288,7 @@ ScannerConfigOptionsDialog.boProvider.browse.openFileDialog=Build output file:
ScannerConfigOptionsDialog.boProvider.load.button=Load ScannerConfigOptionsDialog.boProvider.load.button=Load
ScannerConfigOptionsDialog.siProvider.parser.enabled.button=Enable generate scanner info command ScannerConfigOptionsDialog.siProvider.parser.enabled.button=Enable generate scanner info command
ScannerConfigOptionsDialog.siProvider.command.label=Compiler invocation command ScannerConfigOptionsDialog.siProvider.command.label=Compiler invocation command
ScannerConfigOptionsDialog.siProvider.args.label=Compiler invocation arguments
ScannerConfigOptionsDialog.siProvider.browse.button=Browse... ScannerConfigOptionsDialog.siProvider.browse.button=Browse...
ScannerConfigOptionsDialog.siProvider.browse.runCommandDialog='gcc' command: ScannerConfigOptionsDialog.siProvider.browse.runCommandDialog='gcc' command:
ScannerConfigOptionsDialog.siProvider.command.errorMessage=Must enter compiler invocation command ScannerConfigOptionsDialog.siProvider.command.errorMessage=Must enter compiler invocation command

View file

@ -55,6 +55,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
private Button bopLoadButton; private Button bopLoadButton;
private Button sipEnabledButton; private Button sipEnabledButton;
private Text sipRunCommandText; private Text sipRunCommandText;
private Text sipRunArgsText;
private boolean isValid = true; private boolean isValid = true;
@ -68,7 +69,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
// Add the profile UI contribution. // Add the profile UI contribution.
Group profileGroup = ControlFactory.createGroup(page, Group profileGroup = ControlFactory.createGroup(page,
MakeUIPlugin.getResourceString(PROFILE_GROUP_LABEL), 3); MakeUIPlugin.getResourceString("ScannerConfigOptionsDialog.profile.group.label"), 3); //$NON-NLS-1$
GridData gd = (GridData) profileGroup.getLayoutData(); GridData gd = (GridData) profileGroup.getLayoutData();
gd.grabExcessHorizontalSpace = true; gd.grabExcessHorizontalSpace = true;
@ -80,6 +81,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
((GridData)bopEnabledButton.getLayoutData()).horizontalSpan = 3; ((GridData)bopEnabledButton.getLayoutData()).horizontalSpan = 3;
((GridData)bopEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true; ((GridData)bopEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true;
bopEnabledButton.addSelectionListener(new SelectionAdapter() { bopEnabledButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
handleModifyOpenFileText(); handleModifyOpenFileText();
} }
@ -93,6 +95,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
bopLoadButton = ControlFactory.createPushButton(profileGroup, B_LOAD); bopLoadButton = ControlFactory.createPushButton(profileGroup, B_LOAD);
((GridData) bopLoadButton.getLayoutData()).minimumWidth = 120; ((GridData) bopLoadButton.getLayoutData()).minimumWidth = 120;
bopLoadButton.addSelectionListener(new SelectionAdapter() { bopLoadButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
handleBOPLoadFileButtonSelected(); handleBOPLoadFileButtonSelected();
} }
@ -115,6 +118,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
((GridData) browseButton.getLayoutData()).minimumWidth = 120; ((GridData) browseButton.getLayoutData()).minimumWidth = 120;
browseButton.addSelectionListener(new SelectionAdapter() { browseButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
handleBOPBrowseButtonSelected(); handleBOPBrowseButtonSelected();
} }
@ -149,6 +153,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
((GridData)sipEnabledButton.getLayoutData()).horizontalSpan = 3; ((GridData)sipEnabledButton.getLayoutData()).horizontalSpan = 3;
((GridData)sipEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true; ((GridData)sipEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true;
sipEnabledButton.addSelectionListener(new SelectionAdapter() { sipEnabledButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
// bopLoadButton.setEnabled(sipEnabledButton.getSelection()); // bopLoadButton.setEnabled(sipEnabledButton.getSelection());
} }
@ -160,7 +165,6 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
// text field // text field
sipRunCommandText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER); sipRunCommandText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
//((GridData) sipRunCommandText.getLayoutData()).horizontalSpan = 2;
sipRunCommandText.addModifyListener(new ModifyListener() { sipRunCommandText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) { public void modifyText(ModifyEvent e) {
handleModifyRunCommandText(); handleModifyRunCommandText();
@ -172,6 +176,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
((GridData) siBrowseButton.getLayoutData()).minimumWidth = 120; ((GridData) siBrowseButton.getLayoutData()).minimumWidth = 120;
siBrowseButton.addSelectionListener(new SelectionAdapter() { siBrowseButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
handleSIPBrowseButtonSelected(); handleSIPBrowseButtonSelected();
} }
@ -192,6 +197,20 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
} }
}); });
// si command arguments label
Label siArgsLabel = ControlFactory.createLabel(profileGroup, SI_ARGS);
((GridData) siArgsLabel.getLayoutData()).horizontalSpan = 3;
// text field
sipRunArgsText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
((GridData) sipRunArgsText.getLayoutData()).horizontalSpan = 3;
sipRunArgsText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
handleModifyRunArgsText();
}
});
setControl(page); setControl(page);
// set the shell variable; must be after setControl // set the shell variable; must be after setControl
synchronized (lock) { synchronized (lock) {
@ -216,6 +235,10 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
getContainer().updateContainer(); getContainer().updateContainer();
} }
protected void handleModifyRunArgsText() {
getContainer().updateContainer();
}
private String getBopOpenFileText() { private String getBopOpenFileText() {
// from project relative path to absolute path // from project relative path to absolute path
String fileName = bopOpenFileText.getText().trim(); String fileName = bopOpenFileText.getText().trim();
@ -258,15 +281,16 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
setBopOpenFileText(builderInfo.getBuildOutputFilePath()); setBopOpenFileText(builderInfo.getBuildOutputFilePath());
sipEnabledButton.setSelection(builderInfo.isProviderOutputParserEnabled(providerId)); sipEnabledButton.setSelection(builderInfo.isProviderOutputParserEnabled(providerId));
sipRunCommandText.setText(builderInfo.getProviderRunCommand(providerId)); sipRunCommandText.setText(builderInfo.getProviderRunCommand(providerId));
sipRunArgsText.setText(builderInfo.getProviderRunArguments(providerId));
} }
private String getProviderIDForSelectedProfile() { private String getProviderIDForSelectedProfile() {
IScannerConfigBuilderInfo2 builderInfo = getContainer().getBuildInfo(); IScannerConfigBuilderInfo2 builderInfo = getContainer().getBuildInfo();
// Provider IDs for selected profile // Provider IDs for selected profile
List providerIDs = builderInfo.getProviderIdList(); List<String> providerIDs = builderInfo.getProviderIdList();
if(providerIDs.size() == 0) if(providerIDs.size() == 0)
return ""; return ""; //$NON-NLS-1$
return (String)providerIDs.iterator().next(); return providerIDs.iterator().next();
} }
private void handleBOPLoadFileButtonSelected() { private void handleBOPLoadFileButtonSelected() {
@ -281,6 +305,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
readerJob.setPriority(Job.LONG); readerJob.setPriority(Job.LONG);
readerJob.addJobChangeListener(new JobChangeAdapter() { readerJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) { public void done(IJobChangeEvent event) {
synchronized (lock) { synchronized (lock) {
if (!instance.shell.isDisposed()) { if (!instance.shell.isDisposed()) {
@ -311,6 +336,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#isValid() * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#isValid()
*/ */
@Override
public boolean isValid() { public boolean isValid() {
return isValid; return isValid;
} }
@ -318,6 +344,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#getErrorMessage() * @see org.eclipse.jface.dialogs.IDialogPage#getErrorMessage()
*/ */
@Override
public String getErrorMessage() { public String getErrorMessage() {
return (isValid) ? null : SI_ERROR; return (isValid) ? null : SI_ERROR;
} }
@ -325,6 +352,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#populateBuildInfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2) * @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#populateBuildInfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2)
*/ */
@Override
protected void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) { protected void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) {
if (buildInfo != null) { if (buildInfo != null) {
buildInfo.setBuildOutputFileActionEnabled(true); buildInfo.setBuildOutputFileActionEnabled(true);
@ -333,12 +361,14 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
String providerId = getProviderIDForSelectedProfile(); String providerId = getProviderIDForSelectedProfile();
buildInfo.setProviderOutputParserEnabled(providerId, sipEnabledButton.getSelection()); buildInfo.setProviderOutputParserEnabled(providerId, sipEnabledButton.getSelection());
buildInfo.setProviderRunCommand(providerId, sipRunCommandText.getText().trim()); buildInfo.setProviderRunCommand(providerId, sipRunCommandText.getText().trim());
buildInfo.setProviderRunArguments(providerId, sipRunArgsText.getText().trim());
} }
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#restoreFromBuildinfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2) * @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#restoreFromBuildinfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2)
*/ */
@Override
protected void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) { protected void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
if (buildInfo != null) { if (buildInfo != null) {
setBopOpenFileText(buildInfo.getBuildOutputFilePath()); setBopOpenFileText(buildInfo.getBuildOutputFilePath());
@ -347,6 +377,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
String providerId = getProviderIDForSelectedProfile(); String providerId = getProviderIDForSelectedProfile();
sipEnabledButton.setSelection(buildInfo.isProviderOutputParserEnabled(providerId)); sipEnabledButton.setSelection(buildInfo.isProviderOutputParserEnabled(providerId));
sipRunCommandText.setText(buildInfo.getProviderRunCommand(providerId)); sipRunCommandText.setText(buildInfo.getProviderRunCommand(providerId));
sipRunArgsText.setText(buildInfo.getProviderRunArguments(providerId));
} }
} }

View file

@ -72,7 +72,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
private static final String PROFILE_PAGE = "profilePage"; //$NON-NLS-1$ private static final String PROFILE_PAGE = "profilePage"; //$NON-NLS-1$
private static final String PROFILE_ID = "profileId"; //$NON-NLS-1$ private static final String PROFILE_ID = "profileId"; //$NON-NLS-1$
private static final String PROFILE_NAME = "name"; //$NON-NLS-1$ private static final String PROFILE_NAME = "name"; //$NON-NLS-1$
private static final int DEFAULT_HEIGHT = 110; private static final int DEFAULT_HEIGHT = 150;
private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 10, 20 }; private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 10, 20 };
private Label fTableDefinition; private Label fTableDefinition;
private Combo scopeComboBox; private Combo scopeComboBox;