Bug 61743 NPE in MessageDialog with null parent shell
I-build 2004-05-11 I have code that does the following: MessageDialog.openInformation(null, "Showing element", "Showning an integer of value: "+((Integer)match.getElement()).intValue()); This leads to a null pointer with the follwing stack trace: Thread [main] (Suspended (exception NullPointerException)) MessageDialog.<init>(Shell, String, Image, String, int, String[], int) line: 126 MessageDialog.openInformation(Shell, String, String) line: 305 TestUIParticipant.showMatch(Match, int, int, boolean) line: 57 JavaSearchResultPage.showMatch(Match, int, int, boolean) line: 153 AbstractTextSearchViewPage$9.run() line: 723 <snip> The API doc for MessageDialog say that I'm allowed to pass in null for the parent shell.
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IconAndMessageDialog.java
GridData.HORIZONTAL_ALIGN_CENTER
							| GridData.VERTICAL_ALIGN_BEGINNING));
		}
		
		if (message != null) {
			messageLabel = new Label(composite, getMessageLabelStyle());
			messageLabel.setText(message);
			GridData data = new GridData(GridData.GRAB_HORIZONTAL
					| GridData.HORIZONTAL_ALIGN_FILL
					| GridData.VERTICAL_ALIGN_BEGINNING);
			data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
			messageLabel.setLayoutData(data);
		}
		return composite;
	}
	/**
	 * Returns the style for the message label.
	 * 
	 * @return the style for the message label
	 * 
	 * @since 3.0
	 */
	protected int getMessageLabelStyle() {
		return SWT.WRAP;
	}
	/*
	 * @see Dialog.createButtonBar()
	 */
	protected Control createButtonBar(Composite parent) {
		Composite composite = new Composite(parent, SWT.NONE);