fSemanticHighlightingEnabled= addCheckBox(colorComposite, PreferencesMessages.getString("JavaEditorPreferencePage.semanticHighlighting.option"), PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED, 0); fSemanticHighlightingEnabled.addSelectionListener(new SelectionAdapter(){ public void widgetSelected(SelectionEvent e) { fHighlightingColorListViewer.getControl().setRedraw(false); if (fSemanticHighlightingEnabled.getSelection()) { fHighlightingColorList.addAll(fSemanticHighlightingColorList); fHighlightingColorListViewer.add(fSemanticHighlightingColorList.toArray()); } else { int fullSize= fHighlightingColorList.size(); fHighlightingColorList.removeAll(fSemanticHighlightingColorList); HighlightingColorListItem item= getHighlightingColorListItem(); if (!fHighlightingColorList.contains(item)) { int i= 0; while (item != fHighlightingColorListViewer.getElementAt(i)) i++; while (!fHighlightingColorList.contains(fHighlightingColorListViewer.getElementAt(i)) && i < fullSize) i++; while (!fHighlightingColorList.contains(fHighlightingColorListViewer.getElementAt(i)) && i >= 0) i--;  fHighlightingColorListViewer.setSelection(new StructuredSelection(fHighlightingColorListViewer.getElementAt(i))); } fHighlightingColorListViewer.remove(fSemanticHighlightingColorList.toArray()); } fHighlightingColorListViewer.getControl().setRedraw(true); fHighlightingColorListViewer.reveal(getHighlightingColorListItem()); } });
addCheckBox(colorComposite, PreferencesMessages.getString("JavaEditorPreferencePage.semanticHighlighting.option"), PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED, 0);
	private Control createSyntaxPage(Composite parent) {				Composite colorComposite= new Composite(parent, SWT.NONE);		colorComposite.setLayout(new GridLayout());		Group backgroundComposite= new Group(colorComposite, SWT.SHADOW_ETCHED_IN);		GridLayout layout= new GridLayout();		layout.numColumns= 3;		backgroundComposite.setLayout(layout);		backgroundComposite.setText(PreferencesMessages.getString("JavaEditorPreferencePage.backgroundColor"));//$NON-NLS-1$			SelectionListener backgroundSelectionListener= new SelectionListener() {			public void widgetSelected(SelectionEvent e) {								boolean custom= fBackgroundCustomRadioButton.getSelection();				fBackgroundColorButton.setEnabled(custom);				fOverlayStore.setValue(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR, !custom);			}			public void widgetDefaultSelected(SelectionEvent e) {}		};		fBackgroundDefaultRadioButton= new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);		fBackgroundDefaultRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.systemDefault")); //$NON-NLS-1$		fBackgroundDefaultRadioButton.addSelectionListener(backgroundSelectionListener);		fBackgroundCustomRadioButton= new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);		fBackgroundCustomRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.custom")); //$NON-NLS-1$		fBackgroundCustomRadioButton.addSelectionListener(backgroundSelectionListener);				fBackgroundColorEditor= new ColorEditor(backgroundComposite);		fBackgroundColorButton= fBackgroundColorEditor.getButton();		fSemanticHighlightingEnabled= addCheckBox(colorComposite, PreferencesMessages.getString("JavaEditorPreferencePage.semanticHighlighting.option"), PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED, 0); //$NON-NLS-1$		fSemanticHighlightingEnabled.addSelectionListener(new SelectionAdapter(){			public void widgetSelected(SelectionEvent e) {				fHighlightingColorListViewer.getControl().setRedraw(false);				if (fSemanticHighlightingEnabled.getSelection()) {					fHighlightingColorList.addAll(fSemanticHighlightingColorList);					fHighlightingColorListViewer.add(fSemanticHighlightingColorList.toArray());				} else {					int fullSize= fHighlightingColorList.size();					fHighlightingColorList.removeAll(fSemanticHighlightingColorList);					HighlightingColorListItem item= getHighlightingColorListItem();					if (!fHighlightingColorList.contains(item)) {						int i= 0;						while (item != fHighlightingColorListViewer.getElementAt(i))							i++;						while (!fHighlightingColorList.contains(fHighlightingColorListViewer.getElementAt(i)) && i < fullSize)							i++;						while (!fHighlightingColorList.contains(fHighlightingColorListViewer.getElementAt(i)) && i >= 0)							i--;						// Assume non-empty list						fHighlightingColorListViewer.setSelection(new StructuredSelection(fHighlightingColorListViewer.getElementAt(i)));					}					fHighlightingColorListViewer.remove(fSemanticHighlightingColorList.toArray());				}				fHighlightingColorListViewer.getControl().setRedraw(true);				fHighlightingColorListViewer.reveal(getHighlightingColorListItem());			}		});						Label label= new Label(colorComposite, SWT.LEFT);		label.setText(PreferencesMessages.getString("JavaEditorPreferencePage.foreground")); //$NON-NLS-1$		label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));		Composite editorComposite= new Composite(colorComposite, SWT.NONE);		layout= new GridLayout();		layout.numColumns= 2;		layout.marginHeight= 0;		layout.marginWidth= 0;		editorComposite.setLayout(layout);		GridData gd= new GridData(GridData.FILL_BOTH);		editorComposite.setLayoutData(gd);				fHighlightingColorListViewer= new TableViewer(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);		fHighlightingColorListViewer.setLabelProvider(new ColorListLabelProvider());		fHighlightingColorListViewer.setContentProvider(new ColorListContentProvider());		fHighlightingColorListViewer.setSorter(new WorkbenchViewerSorter());		gd= new GridData(GridData.FILL_BOTH);		gd.heightHint= convertHeightInCharsToPixels(5);		fHighlightingColorListViewer.getControl().setLayoutData(gd);								Composite stylesComposite= new Composite(editorComposite, SWT.NONE);		layout= new GridLayout();		layout.marginHeight= 0;		layout.marginWidth= 0;		layout.numColumns= 2;		stylesComposite.setLayout(layout);		stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));				label= new Label(stylesComposite, SWT.LEFT);		label.setText(PreferencesMessages.getString("JavaEditorPreferencePage.color")); //$NON-NLS-1$		gd= new GridData();		gd.horizontalAlignment= GridData.BEGINNING;		label.setLayoutData(gd);		fSyntaxForegroundColorEditor= new ColorEditor(stylesComposite);		Button foregroundColorButton= fSyntaxForegroundColorEditor.getButton();		gd= new GridData(GridData.FILL_HORIZONTAL);		gd.horizontalAlignment= GridData.BEGINNING;		foregroundColorButton.setLayoutData(gd);				fBoldCheckBox= new Button(stylesComposite, SWT.CHECK);		fBoldCheckBox.setText(PreferencesMessages.getString("JavaEditorPreferencePage.bold")); //$NON-NLS-1$		gd= new GridData(GridData.FILL_HORIZONTAL);		gd.horizontalAlignment= GridData.BEGINNING;		gd.horizontalSpan= 2;		fBoldCheckBox.setLayoutData(gd);				fItalicCheckBox= new Button(stylesComposite, SWT.CHECK);		fItalicCheckBox.setText(PreferencesMessages.getString("JavaEditorPreferencePage.italic")); //$NON-NLS-1$		gd= new GridData(GridData.FILL_HORIZONTAL);		gd.horizontalAlignment= GridData.BEGINNING;		gd.horizontalSpan= 2;		fItalicCheckBox.setLayoutData(gd);				label= new Label(colorComposite, SWT.LEFT);		label.setText(PreferencesMessages.getString("JavaEditorPreferencePage.preview")); //$NON-NLS-1$		label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));				Control previewer= createPreviewer(colorComposite);		gd= new GridData(GridData.FILL_BOTH);		gd.widthHint= convertWidthInCharsToPixels(20);		gd.heightHint= convertHeightInCharsToPixels(5);		previewer.setLayoutData(gd);				fHighlightingColorListViewer.addSelectionChangedListener(new ISelectionChangedListener() {			public void selectionChanged(SelectionChangedEvent event) {				handleSyntaxColorListSelection();			}		});				foregroundColorButton.addSelectionListener(new SelectionListener() {			public void widgetDefaultSelected(SelectionEvent e) {				// do nothing			}			public void widgetSelected(SelectionEvent e) {				HighlightingColorListItem item= getHighlightingColorListItem();				PreferenceConverter.setValue(fOverlayStore, item.getColorKey(), fSyntaxForegroundColorEditor.getColorValue());			}		});		fBackgroundColorButton.addSelectionListener(new SelectionListener() {			public void widgetDefaultSelected(SelectionEvent e) {				// do nothing			}			public void widgetSelected(SelectionEvent e) {				PreferenceConverter.setValue(fOverlayStore, PreferenceConstants.EDITOR_BACKGROUND_COLOR, fBackgroundColorEditor.getColorValue());								}		});		fBoldCheckBox.addSelectionListener(new SelectionListener() {			public void widgetDefaultSelected(SelectionEvent e) {				// do nothing			}			public void widgetSelected(SelectionEvent e) {				HighlightingColorListItem item= getHighlightingColorListItem();				fOverlayStore.setValue(item.getBoldKey(), fBoldCheckBox.getSelection());			}		});						fItalicCheckBox.addSelectionListener(new SelectionListener() {			public void widgetDefaultSelected(SelectionEvent e) {				// do nothing			}			public void widgetSelected(SelectionEvent e) {				HighlightingColorListItem item= getHighlightingColorListItem();				fOverlayStore.setValue(item.getItalicKey(), fItalicCheckBox.getSelection());			}		});						return colorComposite;	}