Bug 17885 Preference Pages don't resize well
Build: 20020521 The Java preference pages don't look very good when the user makes the preference page dialog narrower or shorter by manually resizing it. Here is a breakdown of problems by page: Builder: "Filtered resources" text field should shrink to fit the dialog width more. Classpath Variables: List box should shrink to fit and should scroll if necessary. Code Formatter: Text box should shrink to fit and should scroll if necessary (the scroll bars are there, why aren't they used?). Step Filtering: List box should shrink horizontally to fit and should scroll if necessary (compare vertical and horizontal behaviour when shrinking the preference page dialog). Editor: In the Syntax tab page, the "Preview" text box should shrink to fit and scroll if necessary. Installed JREs: The table viewer should shrink to fit and scroll if necessary. Javadoc: The "Javadoc command" text field should shrink to fit more. Organize Imports: The list box should shrink to fit and scroll if necessary. Templates: The table viewer should shrink to fit and scroll if necessary.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/JavaEditorPreferencePage.java
fPreviewViewer= new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
		fPreviewViewer.configure(new JavaSourceViewerConfiguration(fJavaTextTools, null));
		fPreviewViewer.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
		fPreviewViewer.setEditable(false);
		
		initializeViewerColors(fPreviewViewer);
		
		String content= loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); 
		IDocument document= new Document(content);
		IDocumentPartitioner partitioner= fJavaTextTools.createDocumentPartitioner();
		partitioner.connect(document);
		document.setDocumentPartitioner(partitioner);
		
		fPreviewViewer.setDocument(document);
		
		fOverlayStore.addPropertyChangeListener(new IPropertyChangeListener() {
			public void propertyChange(PropertyChangeEvent event) {
				String p= event.getProperty();
				if (p.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND) ||
					p.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT))
				{
					initializeViewerColors(fPreviewViewer);
				}
				
				fPreviewViewer.invalidateTextPresentation();
			}
		});
		
		return fPreviewViewer.getControl();