1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 11:25:35 +02:00

Fixed the null pointer exception in the build property page when it is displayd for the unsupported projects

This commit is contained in:
Mikhail Sennikovsky 2005-10-05 12:23:59 +00:00
parent 93e9e40c4a
commit a8e370f493
2 changed files with 18 additions and 9 deletions

View file

@ -101,6 +101,7 @@ public class BuildPropertyPage extends AbstractBuildPropertyPage implements IWor
private Point lastShellSize; private Point lastShellSize;
protected ManagedBuildOptionBlock fOptionBlock; protected ManagedBuildOptionBlock fOptionBlock;
protected boolean displayedConfig = false; protected boolean displayedConfig = false;
private boolean noContentOnPage = false;
/** /**
* Default constructor * Default constructor
@ -148,11 +149,7 @@ public class BuildPropertyPage extends AbstractBuildPropertyPage implements IWor
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject()); IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
if (info.getVersion() == null) { if (info.getVersion() == null) {
// Display a message page instead of the properties control // Display a message page instead of the properties control
final Label invalidInfo = new Label(parent, SWT.LEFT); noContent(parent,ManagedBuilderUIMessages.getResourceString("BuildPropertyPage.error.version_low")); //$NON-NLS-1$
invalidInfo.setFont(parent.getFont());
invalidInfo.setText(ManagedBuilderUIMessages.getResourceString("BuildPropertyPage.error.version_low")); //$NON-NLS-1$
invalidInfo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_CENTER, true, true));
noDefaultAndApplyButton();
return; return;
} }
projectTypes = ManagedBuildManager.getDefinedProjectTypes(); projectTypes = ManagedBuildManager.getDefinedProjectTypes();
@ -233,10 +230,15 @@ public class BuildPropertyPage extends AbstractBuildPropertyPage implements IWor
} }
private void contentForClosedProject(Composite parent) { private void contentForClosedProject(Composite parent) {
Label label = new Label(parent, SWT.LEFT); noContent(parent, ManagedBuilderUIMessages.getResourceString(MSG_CLOSEDPROJECT));
label.setText(ManagedBuilderUIMessages.getResourceString(MSG_CLOSEDPROJECT)); }
label.setFont(parent.getFont());
protected void noContent(Composite composite, String message) {
Label label = new Label(composite, SWT.LEFT);
label.setText(message);
label.setFont(composite.getFont());
noContentOnPage = true;
noDefaultAndApplyButton(); noDefaultAndApplyButton();
} }
@ -247,7 +249,7 @@ public class BuildPropertyPage extends AbstractBuildPropertyPage implements IWor
public boolean performOk() { public boolean performOk() {
// If the user did not visit this page, then there is nothing to do. // If the user did not visit this page, then there is nothing to do.
if (!displayedConfig) return true; if (!displayedConfig || noContentOnPage) return true;
if (!applyOptionBlock()) return false; if (!applyOptionBlock()) return false;
if (!applyDefaultConfiguration()) return false; if (!applyDefaultConfiguration()) return false;
@ -261,6 +263,8 @@ public class BuildPropertyPage extends AbstractBuildPropertyPage implements IWor
} }
public boolean performCancel() { public boolean performCancel() {
if(noContentOnPage)
return true;
EnvironmentVariableProvider.fUserSupplier.checkInexistentConfigurations(clonedConfiguration.getManagedProject()); EnvironmentVariableProvider.fUserSupplier.checkInexistentConfigurations(clonedConfiguration.getManagedProject());
@ -318,6 +322,9 @@ public class BuildPropertyPage extends AbstractBuildPropertyPage implements IWor
* @see org.eclipse.jface.preference.PreferencePage#performDefaults() * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/ */
protected void performDefaults() { protected void performDefaults() {
if(noContentOnPage)
return;
fOptionBlock.performDefaults(); fOptionBlock.performDefaults();
super.performDefaults(); super.performDefaults();
} }

View file

@ -508,6 +508,8 @@ public class ResourceBuildPropertyPage extends AbstractBuildPropertyPage impleme
} }
public boolean performCancel() { public boolean performCancel() {
// If there is no content on the page, then there is nothing to do
if (noContentOnPage) return true;
EnvironmentVariableProvider.fUserSupplier.checkInexistentConfigurations(clonedConfiguration.getManagedProject()); EnvironmentVariableProvider.fUserSupplier.checkInexistentConfigurations(clonedConfiguration.getManagedProject());