Bug 82394 [preferences][templates] NPE trying to edit code templates
build i0104-1600 I went into my preferences and tried to change my code template for a new Java file (change the copyright to be 2005 now) but clicking on the Edit button did nothing. When I checked my log file, I found the following exception: !ENTRY org.eclipse.ui 4 0 2005-01-07 13:36:38.677 !MESSAGE java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.ui.preferences.EditTemplateDialog.getPrefix(Unknown Source) at org.eclipse.jdt.internal.ui.preferences.EditTemplateDialog.createEditor(Unknown Source) at org.eclipse.jdt.internal.ui.preferences.EditTemplateDialog.createDialogArea(Unknown Source) at org.eclipse.jface.dialogs.Dialog.createContents(Unknown Source) at org.eclipse.jface.window.Window.create(Unknown Source) at org.eclipse.jface.dialogs.Dialog.create(Unknown Source) at org.eclipse.jdt.internal.ui.dialogs.StatusDialog.create(Unknown Source) at org.eclipse.jdt.internal.ui.preferences.EditTemplateDialog.create(Unknown Source) at org.eclipse.jface.window.Window.open(Unknown Source) at org.eclipse.jdt.internal.ui.preferences.CodeTemplateBlock.edit(Unknown Source) at org.eclipse.jdt.internal.ui.preferences.CodeTemplateBlock.doButtonPressed(Unknown Source) at org.eclipse.jdt.internal.ui.preferences.CodeTemplateBlock$CodeTemplateAdapter.customButtonPressed(Unknown Source) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.buttonPressed(Unknown Source) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.doButtonSelected(Unknown Source) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.access$2(Unknown Source) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField$2.widgetSelected(Unknown Source) at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source) at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source) at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source) at org.eclipse.jface.window.Window.runEventLoop(Unknown Source) at org.eclipse.jface.window.Window.open(Unknown Source) at org.eclipse.ui.internal.OpenPreferencesAction.run(Unknown Source) at org.eclipse.jface.action.Action.runWithEvent(Unknown Source) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(Unknown Source) at org.eclipse.jface.action.ActionContributionItem.access$2(Unknown Source) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(Unknown Source) at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source) at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source) at org.eclipse.ui.internal.Workbench.runEventLoop(Unknown Source) at org.eclipse.ui.internal.Workbench.runUI(Unknown Source) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Unknown Source) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(Unknown Source) at org.eclipse.ui.internal.ide.IDEApplication.run(Unknown Source) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(Unknown Source) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at java.lang.reflect.Method.invoke(Method.java:391) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:684)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/EditTemplateDialog.java
if (name.equals(fContextTypes[i][1])) {
				return fContextTypes[i][0];	
			}
		}
		return name;
	}
	protected void doSourceChanged(IDocument document) {
		String text= document.get();
		fValidationStatus.setOK();
		TemplateContextType contextType= fContextTypeRegistry.getContextType(getContextId(fContextCombo.getText()));
		if (contextType != null) {
			try {
				contextType.validate(text);
			} catch (TemplateException e) {
				fValidationStatus.setError(e.getLocalizedMessage());
			}
		}
		updateUndoAction();
		updateButtons();
	}	
	private static GridData getButtonGridData(Button button) {
		GridData data= new GridData(GridData.FILL_HORIZONTAL);	
		return data;
	}
	private static Label createLabel(Composite parent, String name) {
		Label label= new Label(parent, SWT.NULL);
		label.setText(name);
		label.setLayoutData(new GridData());
		return label;
	}