mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Make the preference constant visible for other plugins.
This commit is contained in:
parent
85420ddf38
commit
c15e5acca5
3 changed files with 54 additions and 9 deletions
|
@ -30,6 +30,7 @@ import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||||
import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
|
import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
|
||||||
import org.eclipse.cdt.ui.CElementContentProvider;
|
import org.eclipse.cdt.ui.CElementContentProvider;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
import org.eclipse.cdt.ui.PreferenceConstants;
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IFolder;
|
import org.eclipse.core.resources.IFolder;
|
||||||
|
@ -1107,7 +1108,7 @@ public class CView extends ViewPart implements IMenuListener, ISetSelectionTarge
|
||||||
|
|
||||||
boolean refreshViewer= false;
|
boolean refreshViewer= false;
|
||||||
|
|
||||||
if (event.getProperty() == CPluginPreferencePage.PREF_SHOW_CU_CHILDREN) {
|
if (event.getProperty() == PreferenceConstants.PREF_SHOW_CU_CHILDREN) {
|
||||||
boolean showCUChildren= CPluginPreferencePage.showCompilationUnitChildren();
|
boolean showCUChildren= CPluginPreferencePage.showCompilationUnitChildren();
|
||||||
((CElementContentProvider)viewer.getContentProvider()).setProvideMembers(showCUChildren);
|
((CElementContentProvider)viewer.getContentProvider()).setProvideMembers(showCUChildren);
|
||||||
refreshViewer= true;
|
refreshViewer= true;
|
||||||
|
|
|
@ -8,6 +8,7 @@ package org.eclipse.cdt.internal.ui.preferences;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
import org.eclipse.cdt.ui.PreferenceConstants;
|
||||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
|
@ -21,8 +22,6 @@ import org.eclipse.ui.help.WorkbenchHelp;
|
||||||
*/
|
*/
|
||||||
public class CPluginPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
|
public class CPluginPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
|
||||||
|
|
||||||
private static final String PREF_LINK_TO_EDITOR= "linkToEditor"; //$NON-NLS-1$
|
|
||||||
public static final String PREF_SHOW_CU_CHILDREN= "CUChildren"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
private static final String LINK_TO_EDITOR_LABEL= "CBasePreferencePage.linkToEditor.label";
|
private static final String LINK_TO_EDITOR_LABEL= "CBasePreferencePage.linkToEditor.label";
|
||||||
private static final String SHOW_CU_CHILDREN_LABEL= "CBasePreferencePage.CUChildren.label";
|
private static final String SHOW_CU_CHILDREN_LABEL= "CBasePreferencePage.CUChildren.label";
|
||||||
|
@ -47,10 +46,10 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
|
||||||
protected void createFieldEditors() {
|
protected void createFieldEditors() {
|
||||||
Composite parent= getFieldEditorParent();
|
Composite parent= getFieldEditorParent();
|
||||||
|
|
||||||
BooleanFieldEditor linkEditor= new BooleanFieldEditor(PREF_LINK_TO_EDITOR, CUIPlugin.getResourceString(LINK_TO_EDITOR_LABEL), parent);
|
BooleanFieldEditor linkEditor= new BooleanFieldEditor(PreferenceConstants.PREF_LINK_TO_EDITOR, CUIPlugin.getResourceString(LINK_TO_EDITOR_LABEL), parent);
|
||||||
addField(linkEditor);
|
addField(linkEditor);
|
||||||
|
|
||||||
BooleanFieldEditor showCUChildrenEditor= new BooleanFieldEditor(PREF_SHOW_CU_CHILDREN, CUIPlugin.getResourceString(SHOW_CU_CHILDREN_LABEL), parent);
|
BooleanFieldEditor showCUChildrenEditor= new BooleanFieldEditor(PreferenceConstants.PREF_SHOW_CU_CHILDREN, CUIPlugin.getResourceString(SHOW_CU_CHILDREN_LABEL), parent);
|
||||||
addField(showCUChildrenEditor);
|
addField(showCUChildrenEditor);
|
||||||
|
|
||||||
BooleanFieldEditor useNewParserEditor= new BooleanFieldEditor(CCorePlugin.PREF_USE_NEW_PARSER, CUIPlugin.getResourceString(USE_NEW_PARSER_LABEL), parent);
|
BooleanFieldEditor useNewParserEditor= new BooleanFieldEditor(CCorePlugin.PREF_USE_NEW_PARSER, CUIPlugin.getResourceString(USE_NEW_PARSER_LABEL), parent);
|
||||||
|
@ -59,11 +58,11 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
|
||||||
|
|
||||||
|
|
||||||
public static boolean isLinkToEditor() {
|
public static boolean isLinkToEditor() {
|
||||||
return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_LINK_TO_EDITOR);
|
return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREF_LINK_TO_EDITOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean showCompilationUnitChildren() {
|
public static boolean showCompilationUnitChildren() {
|
||||||
return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_SHOW_CU_CHILDREN);
|
return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREF_SHOW_CU_CHILDREN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean useNewParser() {
|
public static boolean useNewParser() {
|
||||||
|
@ -81,9 +80,10 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
|
||||||
* Initializes the default values of this page in the preference bundle.
|
* Initializes the default values of this page in the preference bundle.
|
||||||
*/
|
*/
|
||||||
public static void initDefaults(IPreferenceStore prefs) {
|
public static void initDefaults(IPreferenceStore prefs) {
|
||||||
prefs.setDefault(PREF_LINK_TO_EDITOR, true);
|
prefs.setDefault(PreferenceConstants.PREF_LINK_TO_EDITOR, true);
|
||||||
prefs.setDefault(PREF_SHOW_CU_CHILDREN, true);
|
prefs.setDefault(PreferenceConstants.PREF_SHOW_CU_CHILDREN, true);
|
||||||
prefs.setDefault(CCorePlugin.PREF_USE_NEW_PARSER, CCorePlugin.getDefault().useNewParser());
|
prefs.setDefault(CCorePlugin.PREF_USE_NEW_PARSER, CCorePlugin.getDefault().useNewParser());
|
||||||
|
prefs.setDefault(PreferenceConstants.EDITOR_SHOW_SEGMENTS, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* (c) Copyright IBM Corp. 2000, 2001.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.ui;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preference constants used in the JDT-UI preference store. Clients should only read the
|
||||||
|
* JDT-UI preference store using these values. Clients are not allowed to modify the
|
||||||
|
* preference store programmatically.
|
||||||
|
*
|
||||||
|
* @since 2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PreferenceConstants {
|
||||||
|
|
||||||
|
private PreferenceConstants() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A named preference that controls whether the cview's selection is linked to the active editor.
|
||||||
|
* <p>
|
||||||
|
* Value is of type <code>Boolean</code>.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public static final String PREF_LINK_TO_EDITOR= "org.eclipse.cdt.ui.editor.linkToEditor"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A named preference that speficies whether children of a translation unit are shown in the package explorer.
|
||||||
|
* <p>
|
||||||
|
* Value is of type <code>Boolean</code>.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public static final String PREF_SHOW_CU_CHILDREN= "org.eclipse.cdt.ui.editor.CUChildren"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A named preference that controls if segmented view (show selected element only) is turned on or off.
|
||||||
|
* <p>
|
||||||
|
* Value is of type <code>Boolean</code>.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public static final String EDITOR_SHOW_SEGMENTS= "org.eclipse.cdt.ui.editor.showSegments"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue