label= new Label(stylesComposite, SWT.LEFT); label.setText(PreferencesMessages.JavaEditorPreferencePage_color); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent= 20; label.setLayoutData(gd);
fColorEditorLabel= new Label(stylesComposite, SWT.LEFT); fColorEditorLabel.setText(PreferencesMessages.JavaEditorPreferencePage_color); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent= 20; fColorEditorLabel.setLayoutData(gd);
	private Control createSyntaxPage(final Composite parent) {				Composite colorComposite= new Composite(parent, SWT.NONE);		GridLayout layout= new GridLayout();		layout.marginHeight= 0;		layout.marginWidth= 0;		colorComposite.setLayout(layout);		Link link= new Link(colorComposite, SWT.NONE);		link.setText(PreferencesMessages.JavaEditorColoringConfigurationBlock_link);		link.addSelectionListener(new SelectionAdapter() {			public void widgetSelected(SelectionEvent e) {				PreferencesUtil.createPreferenceDialogOn(parent.getShell(), e.text, null, null); //$NON-NLS-1$			}		});		// TODO replace by link-specific tooltips when		// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88866 gets fixed//		link.setToolTipText(PreferencesMessages.JavaEditorColoringConfigurationBlock_link_tooltip); 				GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);		gridData.widthHint= 150; // only expand further if anyone else requires it		gridData.horizontalSpan= 2;		link.setLayoutData(gridData);		addFiller(colorComposite, 1);				Label label;		label= new Label(colorComposite, SWT.LEFT);		label.setText(PreferencesMessages.JavaEditorPreferencePage_coloring_element); 		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(SWT.FILL, SWT.BEGINNING, true, false);		editorComposite.setLayoutData(gd);					fListViewer= new TreeViewer(editorComposite, SWT.SINGLE | SWT.BORDER);		fListViewer.setLabelProvider(new ColorListLabelProvider());		fListViewer.setContentProvider(new ColorListContentProvider());		fListViewer.setSorter(new ViewerSorter() {			public int category(Object element) {				// don't sort the top level categories				if (fJavaCategory.equals(element))					return 0;				if (fJavadocCategory.equals(element))					return 1;				if (fCommentsCategory.equals(element))					return 2;				// to sort semantic settings after partition based ones://				if (element instanceof SemanticHighlightingColorListItem)//					return 1;				return 0;			}		});		gd= new GridData(SWT.BEGINNING, SWT.BEGINNING, false, true);		gd.heightHint= convertHeightInCharsToPixels(9);		int maxWidth= 0;		for (Iterator it= fListModel.iterator(); it.hasNext();) {			HighlightingColorListItem item= (HighlightingColorListItem) it.next();			maxWidth= Math.max(maxWidth, convertWidthInCharsToPixels(item.getDisplayName().length()));		}		ScrollBar vBar= ((Scrollable) fListViewer.getControl()).getVerticalBar();		if (vBar != null)			maxWidth += vBar.getSize().x * 3; // scrollbars and tree indentation guess		gd.widthHint= maxWidth;				fListViewer.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));				fEnableCheckbox= new Button(stylesComposite, SWT.CHECK);		fEnableCheckbox.setText(PreferencesMessages.JavaEditorPreferencePage_enable); 		gd= new GridData(GridData.FILL_HORIZONTAL);		gd.horizontalAlignment= GridData.BEGINNING;		gd.horizontalSpan= 2;		fEnableCheckbox.setLayoutData(gd);				label= new Label(stylesComposite, SWT.LEFT);		label.setText(PreferencesMessages.JavaEditorPreferencePage_color); 		gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);		gd.horizontalIndent= 20;		label.setLayoutData(gd);			fSyntaxForegroundColorEditor= new ColorSelector(stylesComposite);		Button foregroundColorButton= fSyntaxForegroundColorEditor.getButton();		gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);		foregroundColorButton.setLayoutData(gd);				fBoldCheckBox= new Button(stylesComposite, SWT.CHECK);		fBoldCheckBox.setText(PreferencesMessages.JavaEditorPreferencePage_bold); 		gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);		gd.horizontalIndent= 20;		gd.horizontalSpan= 2;		fBoldCheckBox.setLayoutData(gd);				fItalicCheckBox= new Button(stylesComposite, SWT.CHECK);		fItalicCheckBox.setText(PreferencesMessages.JavaEditorPreferencePage_italic); 		gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);		gd.horizontalIndent= 20;		gd.horizontalSpan= 2;		fItalicCheckBox.setLayoutData(gd);				fStrikethroughCheckBox= new Button(stylesComposite, SWT.CHECK);		fStrikethroughCheckBox.setText(PreferencesMessages.JavaEditorPreferencePage_strikethrough); 		gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);		gd.horizontalIndent= 20;		gd.horizontalSpan= 2;		fStrikethroughCheckBox.setLayoutData(gd);				fUnderlineCheckBox= new Button(stylesComposite, SWT.CHECK);		fUnderlineCheckBox.setText(PreferencesMessages.JavaEditorPreferencePage_underline); 		gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);		gd.horizontalIndent= 20;		gd.horizontalSpan= 2;		fUnderlineCheckBox.setLayoutData(gd);				label= new Label(colorComposite, SWT.LEFT);		label.setText(PreferencesMessages.JavaEditorPreferencePage_preview); 		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);				fListViewer.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(getPreferenceStore(), item.getColorKey(), fSyntaxForegroundColorEditor.getColorValue());			}		});			fBoldCheckBox.addSelectionListener(new SelectionListener() {			public void widgetDefaultSelected(SelectionEvent e) {				// do nothing			}			public void widgetSelected(SelectionEvent e) {				HighlightingColorListItem item= getHighlightingColorListItem();				getPreferenceStore().setValue(item.getBoldKey(), fBoldCheckBox.getSelection());			}		});						fItalicCheckBox.addSelectionListener(new SelectionListener() {			public void widgetDefaultSelected(SelectionEvent e) {				// do nothing			}			public void widgetSelected(SelectionEvent e) {				HighlightingColorListItem item= getHighlightingColorListItem();				getPreferenceStore().setValue(item.getItalicKey(), fItalicCheckBox.getSelection());			}		});		fStrikethroughCheckBox.addSelectionListener(new SelectionListener() {			public void widgetDefaultSelected(SelectionEvent e) {				// do nothing			}			public void widgetSelected(SelectionEvent e) {				HighlightingColorListItem item= getHighlightingColorListItem();				getPreferenceStore().setValue(item.getStrikethroughKey(), fStrikethroughCheckBox.getSelection());			}		});				fUnderlineCheckBox.addSelectionListener(new SelectionListener() {			public void widgetDefaultSelected(SelectionEvent e) {				// do nothing			}			public void widgetSelected(SelectionEvent e) {				HighlightingColorListItem item= getHighlightingColorListItem();				getPreferenceStore().setValue(item.getUnderlineKey(), fUnderlineCheckBox.getSelection());			}		});						fEnableCheckbox.addSelectionListener(new SelectionListener() {			public void widgetDefaultSelected(SelectionEvent e) {				// do nothing			}			public void widgetSelected(SelectionEvent e) {				HighlightingColorListItem item= getHighlightingColorListItem();				if (item instanceof SemanticHighlightingColorListItem) {					boolean enable= fEnableCheckbox.getSelection();					getPreferenceStore().setValue(((SemanticHighlightingColorListItem) item).getEnableKey(), enable);					fEnableCheckbox.setSelection(enable);					fSyntaxForegroundColorEditor.getButton().setEnabled(enable);					fBoldCheckBox.setEnabled(enable);					fItalicCheckBox.setEnabled(enable);					fStrikethroughCheckBox.setEnabled(enable);					fUnderlineCheckBox.setEnabled(enable);					uninstallSemanticHighlighting();					installSemanticHighlighting();				}			}		});				colorComposite.layout(false);						return colorComposite;	}