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

@ -287,7 +287,8 @@ ScannerConfigOptionsDialog.boProvider.browse.button=Browse...
ScannerConfigOptionsDialog.boProvider.browse.openFileDialog=Build output file:
ScannerConfigOptionsDialog.boProvider.load.button=Load
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.runCommandDialog='gcc' 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 sipEnabledButton;
private Text sipRunCommandText;
private Text sipRunArgsText;
private boolean isValid = true;
@ -68,7 +69,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
// Add the profile UI contribution.
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();
gd.grabExcessHorizontalSpace = true;
@ -80,7 +81,8 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
((GridData)bopEnabledButton.getLayoutData()).horizontalSpan = 3;
((GridData)bopEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true;
bopEnabledButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@Override
public void widgetSelected(SelectionEvent e) {
handleModifyOpenFileText();
}
});
@ -93,7 +95,8 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
bopLoadButton = ControlFactory.createPushButton(profileGroup, B_LOAD);
((GridData) bopLoadButton.getLayoutData()).minimumWidth = 120;
bopLoadButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
@Override
public void widgetSelected(SelectionEvent event) {
handleBOPLoadFileButtonSelected();
}
});
@ -115,7 +118,8 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
((GridData) browseButton.getLayoutData()).minimumWidth = 120;
browseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
@Override
public void widgetSelected(SelectionEvent event) {
handleBOPBrowseButtonSelected();
}
@ -149,7 +153,8 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
((GridData)sipEnabledButton.getLayoutData()).horizontalSpan = 3;
((GridData)sipEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true;
sipEnabledButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@Override
public void widgetSelected(SelectionEvent e) {
// bopLoadButton.setEnabled(sipEnabledButton.getSelection());
}
});
@ -160,7 +165,6 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
// text field
sipRunCommandText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
//((GridData) sipRunCommandText.getLayoutData()).horizontalSpan = 2;
sipRunCommandText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
handleModifyRunCommandText();
@ -172,7 +176,8 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
((GridData) siBrowseButton.getLayoutData()).minimumWidth = 120;
siBrowseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
@Override
public void widgetSelected(SelectionEvent event) {
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);
// set the shell variable; must be after setControl
synchronized (lock) {
@ -216,6 +235,10 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
getContainer().updateContainer();
}
protected void handleModifyRunArgsText() {
getContainer().updateContainer();
}
private String getBopOpenFileText() {
// from project relative path to absolute path
String fileName = bopOpenFileText.getText().trim();
@ -258,15 +281,16 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
setBopOpenFileText(builderInfo.getBuildOutputFilePath());
sipEnabledButton.setSelection(builderInfo.isProviderOutputParserEnabled(providerId));
sipRunCommandText.setText(builderInfo.getProviderRunCommand(providerId));
sipRunArgsText.setText(builderInfo.getProviderRunArguments(providerId));
}
private String getProviderIDForSelectedProfile() {
IScannerConfigBuilderInfo2 builderInfo = getContainer().getBuildInfo();
// Provider IDs for selected profile
List providerIDs = builderInfo.getProviderIdList();
List<String> providerIDs = builderInfo.getProviderIdList();
if(providerIDs.size() == 0)
return "";
return (String)providerIDs.iterator().next();
return ""; //$NON-NLS-1$
return providerIDs.iterator().next();
}
private void handleBOPLoadFileButtonSelected() {
@ -281,7 +305,8 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
readerJob.setPriority(Job.LONG);
readerJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
@Override
public void done(IJobChangeEvent event) {
synchronized (lock) {
if (!instance.shell.isDisposed()) {
instance.shell.getDisplay().asyncExec(new Runnable() {
@ -311,21 +336,24 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
/* (non-Javadoc)
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#isValid()
*/
public boolean isValid() {
@Override
public boolean isValid() {
return isValid;
}
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#getErrorMessage()
*/
public String getErrorMessage() {
@Override
public String getErrorMessage() {
return (isValid) ? null : SI_ERROR;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#populateBuildInfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2)
*/
protected void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) {
@Override
protected void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) {
if (buildInfo != null) {
buildInfo.setBuildOutputFileActionEnabled(true);
buildInfo.setBuildOutputFilePath(getBopOpenFileText());
@ -333,13 +361,15 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
String providerId = getProviderIDForSelectedProfile();
buildInfo.setProviderOutputParserEnabled(providerId, sipEnabledButton.getSelection());
buildInfo.setProviderRunCommand(providerId, sipRunCommandText.getText().trim());
buildInfo.setProviderRunArguments(providerId, sipRunArgsText.getText().trim());
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#restoreFromBuildinfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2)
*/
protected void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
@Override
protected void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
if (buildInfo != null) {
setBopOpenFileText(buildInfo.getBuildOutputFilePath());
bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled());
@ -347,6 +377,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
String providerId = getProviderIDForSelectedProfile();
sipEnabledButton.setSelection(buildInfo.isProviderOutputParserEnabled(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_ID = "profileId"; //$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 Label fTableDefinition;
private Combo scopeComboBox;