1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-13 11:15:38 +02:00

Bug 322755 - Move "Editor problem annotation" preference

This commit is contained in:
Anton Leherbauer 2010-10-28 10:08:16 +00:00
parent 87f0ba4453
commit e137bca742
3 changed files with 44 additions and 59 deletions

View file

@ -44,7 +44,6 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
@ -52,12 +51,9 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.PreferenceConstants; import org.eclipse.cdt.ui.PreferenceConstants;
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo; import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.cdt.internal.ui.dialogs.StatusUtil; import org.eclipse.cdt.internal.ui.dialogs.StatusUtil;
import org.eclipse.cdt.internal.ui.preferences.OverlayPreferenceStore.OverlayKey; import org.eclipse.cdt.internal.ui.preferences.OverlayPreferenceStore.OverlayKey;
@ -66,7 +62,7 @@ import org.eclipse.cdt.internal.ui.util.SWTUtil;
import org.eclipse.cdt.internal.ui.util.TableLayoutComposite; import org.eclipse.cdt.internal.ui.util.TableLayoutComposite;
/** /**
* CEditorHoverConfigurationBlock * Configures C/C++ Editor hover preferences.
*/ */
public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationBlock { public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationBlock {
static final String DELIMITER= PreferencesMessages.CEditorHoverConfigurationBlock_delimiter; static final String DELIMITER= PreferencesMessages.CEditorHoverConfigurationBlock_delimiter;
@ -150,8 +146,6 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB
private TableColumn fNameColumn; private TableColumn fNameColumn;
private TableColumn fModifierColumn; private TableColumn fModifierColumn;
private Text fDescription; private Text fDescription;
//private Button fShowHoverAffordanceCheckbox;
private Button fShowEditorAnnotationCheckbox;
private PreferencePage fMainPreferencePage; private PreferencePage fMainPreferencePage;
@ -171,8 +165,6 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB
ArrayList<OverlayKey> overlayKeys= new ArrayList<OverlayKey>(); ArrayList<OverlayKey> overlayKeys= new ArrayList<OverlayKey>();
//overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER)); //overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER));
//overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_EVALUATE_TEMPORARY_PROBLEMS));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS));
@ -181,39 +173,35 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB
return keys; return keys;
} }
/* /**
* @see org.eclipse.cdt.internal.ui.preferences.IPreferenceConfigurationBlock#createControl(org.eclipse.swt.widgets.Composite) * Creates page for hover preferences.
*
* @param parent the parent composite
* @return the control for the preference page
*/ */
public Control createControl(Composite parent) { public Control createControl(Composite parent) {
Composite hoverComposite= new Composite(parent, SWT.NONE); ScrolledPageContent scrolled= new ScrolledPageContent(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrolled.setExpandHorizontal(true);
scrolled.setExpandVertical(true);
Composite hoverComposite= new Composite(scrolled, SWT.NONE);
GridLayout layout= new GridLayout(); GridLayout layout= new GridLayout();
layout.numColumns= 2; layout.numColumns= 2;
layout.marginWidth= 0;
layout.marginHeight= 0;
hoverComposite.setLayout(layout); hoverComposite.setLayout(layout);
GridData gd= new GridData(GridData.FILL_BOTH); hoverComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
hoverComposite.setLayoutData(gd);
//String rollOverLabel= PreferencesMessages.getString("CEditorHoverConfigurationBlock.annotationRollover"); //$NON-NLS-1$ //String rollOverLabel= PreferencesMessages.getString("CEditorHoverConfigurationBlock.annotationRollover"); //$NON-NLS-1$
//addCheckBox(hoverComposite, rollOverLabel, PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER, 0); //$NON-NLS-1$ //addCheckBox(hoverComposite, rollOverLabel, PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER, 0); //$NON-NLS-1$
// Affordance checkbox //addFiller(hoverComposite);
//fShowHoverAffordanceCheckbox= new Button(hoverComposite, SWT.CHECK);
//fShowHoverAffordanceCheckbox.setText(PreferencesMessages.getString("CEditorHoverConfigurationBlock.showAffordance")); //$NON-NLS-1$
//fShowHoverAffordanceCheckbox.setLayoutData(gd);
// Disable/enable editor problem annotaion checkbox
fShowEditorAnnotationCheckbox = new Button(hoverComposite, SWT.CHECK);
fShowEditorAnnotationCheckbox.setText(PreferencesMessages.CEditorPreferencePage_behaviourPage_EnableEditorProblemAnnotation);
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent= 0;
gd.horizontalSpan= 2;
fShowEditorAnnotationCheckbox.setLayoutData(gd);
addFiller(hoverComposite);
Label label= new Label(hoverComposite, SWT.NONE); Label label= new Label(hoverComposite, SWT.NONE);
label.setText(PreferencesMessages.CEditorHoverConfigurationBlock_hoverPreferences); label.setText(PreferencesMessages.CEditorHoverConfigurationBlock_hoverPreferences);
gd= new GridData(GridData.FILL_HORIZONTAL); GridData gd= new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment= GridData.BEGINNING; gd.horizontalAlignment= GridData.BEGINNING;
gd.horizontalSpan= 2; gd.horizontalSpan= 2;
label.setLayoutData(gd); label.setLayoutData(gd);
@ -222,7 +210,7 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB
addColumnLayoutData(layouter); addColumnLayoutData(layouter);
// Hover table // Hover table
fHoverTable= new Table(layouter, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK); fHoverTable= new Table(layouter, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK);
fHoverTable.setHeaderVisible(true); fHoverTable.setHeaderVisible(true);
fHoverTable.setLinesVisible(true); fHoverTable.setLinesVisible(true);
@ -345,11 +333,13 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB
initialize(); initialize();
Dialog.applyDialogFont(hoverComposite); scrolled.setContent(hoverComposite);
final Point size= hoverComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
scrolled.setMinSize(size.x, size.y);
PlatformUI.getWorkbench().getHelpSystem().setHelp(hoverComposite, ICHelpContextIds.C_EDITOR_HOVERS_PAGE); Dialog.applyDialogFont(scrolled);
return hoverComposite; return scrolled;
} }
private void addColumnLayoutData(TableLayoutComposite layouter) { private void addColumnLayoutData(TableLayoutComposite layouter) {
@ -376,9 +366,6 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB
} }
void initializeFields() { void initializeFields() {
//fShowHoverAffordanceCheckbox.setSelection(fStore.getBoolean(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE));
fShowEditorAnnotationCheckbox.setSelection(fStore.getBoolean(PreferenceConstants.EDITOR_EVALUATE_TEMPORARY_PROBLEMS));
fModifierEditor.setEnabled(false); fModifierEditor.setEnabled(false);
CEditorTextHoverDescriptor[] hoverDescs= getContributedHovers(); CEditorTextHoverDescriptor[] hoverDescs= getContributedHovers();
@ -412,8 +399,6 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB
fStore.setValue(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS, buf.toString()); fStore.setValue(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS, buf.toString());
fStore.setValue(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS, maskBuf.toString()); fStore.setValue(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS, maskBuf.toString());
//fStore.setValue(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE, fShowHoverAffordanceCheckbox.getSelection());
fStore.setValue(PreferenceConstants.EDITOR_EVALUATE_TEMPORARY_PROBLEMS, fShowEditorAnnotationCheckbox.getSelection());
CUIPlugin.getDefault().resetCEditorTextHoverDescriptors(); CUIPlugin.getDefault().resetCEditorTextHoverDescriptors();
} }
@ -421,16 +406,12 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB
* @see org.eclipse.cdt.internal.ui.preferences.IPreferenceConfigurationBlock#performDefaults() * @see org.eclipse.cdt.internal.ui.preferences.IPreferenceConfigurationBlock#performDefaults()
*/ */
public void performDefaults() { public void performDefaults() {
fStatus= new StatusInfo();
restoreFromPreferences(); restoreFromPreferences();
initializeFields(); initializeFields();
updateStatus(null); updateStatus(null);
} }
private void restoreFromPreferences() { private void restoreFromPreferences() {
//fShowHoverAffordanceCheckbox.setSelection(fStore.getBoolean(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE));
String compiledTextHoverModifiers= fStore.getString(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS); String compiledTextHoverModifiers= fStore.getString(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS);
StringTokenizer tokenizer= new StringTokenizer(compiledTextHoverModifiers, CEditorTextHoverDescriptor.VALUE_SEPARATOR); StringTokenizer tokenizer= new StringTokenizer(compiledTextHoverModifiers, CEditorTextHoverDescriptor.VALUE_SEPARATOR);
@ -548,14 +529,14 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB
} }
private void addFiller(Composite composite) { // private void addFiller(Composite composite) {
PixelConverter pixelConverter= new PixelConverter(composite); // PixelConverter pixelConverter= new PixelConverter(composite);
Label filler= new Label(composite, SWT.LEFT ); // Label filler= new Label(composite, SWT.LEFT );
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); // GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan= 2; // gd.horizontalSpan= 2;
gd.heightHint= pixelConverter.convertHeightInCharsToPixels(1) / 2; // gd.heightHint= pixelConverter.convertHeightInCharsToPixels(1) / 2;
filler.setLayoutData(gd); // filler.setLayoutData(gd);
} // }
/* /*
* @see DialogPage#dispose() * @see DialogPage#dispose()

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2009 IBM Corporation and others. * Copyright (c) 2005, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -77,6 +77,7 @@ public class CEditorPreferencePage extends AbstractPreferencePage {
ArrayList<OverlayKey> overlayKeys = new ArrayList<OverlayKey>(); ArrayList<OverlayKey> overlayKeys = new ArrayList<OverlayKey>();
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CEditor.SUB_WORD_NAVIGATION)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CEditor.SUB_WORD_NAVIGATION));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_EVALUATE_TEMPORARY_PROBLEMS));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, CEditor.MATCHING_BRACKETS_COLOR)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, CEditor.MATCHING_BRACKETS_COLOR));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CEditor.MATCHING_BRACKETS)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CEditor.MATCHING_BRACKETS));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, CEditor.INACTIVE_CODE_COLOR)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, CEditor.INACTIVE_CODE_COLOR));
@ -133,6 +134,9 @@ public class CEditorPreferencePage extends AbstractPreferencePage {
String label= PreferencesMessages.CEditorPreferencePage_behaviorPage_subWordNavigation; String label= PreferencesMessages.CEditorPreferencePage_behaviorPage_subWordNavigation;
addCheckBox(behaviorComposite, label, CEditor.SUB_WORD_NAVIGATION, 0); addCheckBox(behaviorComposite, label, CEditor.SUB_WORD_NAVIGATION, 0);
label = PreferencesMessages.CEditorPreferencePage_behaviourPage_EnableEditorProblemAnnotation;
addCheckBox(behaviorComposite, label, PreferenceConstants.EDITOR_EVALUATE_TEMPORARY_PROBLEMS, 0);
label = PreferencesMessages.CEditorPreferencePage_behaviorPage_matchingBrackets; label = PreferencesMessages.CEditorPreferencePage_behaviorPage_matchingBrackets;
addCheckBox(behaviorComposite, label, CEditor.MATCHING_BRACKETS, 0); addCheckBox(behaviorComposite, label, CEditor.MATCHING_BRACKETS, 0);

View file

@ -148,7 +148,7 @@ CBufferPreferences_CodeReaderBuffer_Size=Size (MB)
#Open Type Preferences #Open Type Preferences
#Editor Preferences #Editor Preferences
CEditorPreferencePage_behaviourPage_EnableEditorProblemAnnotation=Enable editor problem annotation CEditorPreferencePage_behaviourPage_EnableEditorProblemAnnotation=Report &problems as you type
#Appearance Preferences #Appearance Preferences
AppearancePreferencePage_description= Appearance of C/C++ elements in viewers: AppearancePreferencePage_description= Appearance of C/C++ elements in viewers: