Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Action "show source selected element only"

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.81
diff -u -r1.81 ChangeLog
--- ChangeLog	4 Apr 2003 20:38:39 -0000	1.81
+++ ChangeLog	5 Apr 2003 02:02:35 -0000
@@ -1,5 +1,31 @@
 2003-04-04 Alain Magloire
 
+	The TextEditor provides a way to select a range to be edited.
+	We provide the same functionnality; "Show Source of Selected Element Only"
+
+	* icons/full/clcl16/segment_edit.gif:
+	* icons/full/dlcl16/segment_edit.gif:
+	* icons/full/elcl16/segment_edit.gif:
+	* src/org/eclipse/cdt/internal/ui/CPluginImages.java:
+	descriptor for segment_edit.gif.
+
+	* src/org/eclipse/cdt/ui/PreferenceConstants.java:
+	Move the preference constants so they can be visible to other plugins.
+	* src/org/eclipse/cdt/internal/ui/cview/CView.java:
+	* src/org/eclipse/cdt/internal/preference/CPlugigPreferencePage.java:
+
+	* src/org/eclipse/cdt/internal/editor/CContentOutlinePage.java:
+	* src/org/eclipse/cdt/internal/editor/CEditorActionContributor.java:
+	* src/org/eclipse/cdt/internal/editor/CEditorMessages.properties:
+	* src/org/eclipse/cdt/internal/editor/CTextEditorActiionConstant.java:
+	* src/org/eclipse/cdt/internal/editor/ICEditorActionDefinitonsIds.java:
+	* src/org/eclipse/cdt/internal/editor/TogglePresentationAction.java:
+	 
+	
+	
+
+2003-04-04 Alain Magloire
+
 	The way to register actions change from 2.0 to 2.1
 	Action must have an ID.  This fixes the editor to
 	be activate on Ctrl+space.
Index: icons/full/clcl16/segment_edit.gif
===================================================================
RCS file: icons/full/clcl16/segment_edit.gif
diff -N icons/full/clcl16/segment_edit.gif
Binary files /dev/null and segment_edit.gif differ
Index: icons/full/dlcl16/segment_edit.gif
===================================================================
RCS file: icons/full/dlcl16/segment_edit.gif
diff -N icons/full/dlcl16/segment_edit.gif
Binary files /dev/null and segment_edit.gif differ
Index: icons/full/elcl16/segment_edit.gif
===================================================================
RCS file: icons/full/elcl16/segment_edit.gif
diff -N icons/full/elcl16/segment_edit.gif
Binary files /dev/null and segment_edit.gif differ
Index: src/org/eclipse/cdt/internal/ui/CPluginImages.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java,v
retrieving revision 1.9
diff -u -r1.9 CPluginImages.java
--- src/org/eclipse/cdt/internal/ui/CPluginImages.java	3 Apr 2003 15:38:35 -0000	1.9
+++ src/org/eclipse/cdt/internal/ui/CPluginImages.java	5 Apr 2003 02:02:38 -0000
@@ -112,11 +112,13 @@
 	public static final String IMG_MENU_SHIFT_RIGHT= NAME_PREFIX + "shift_r_edit.gif";
 	public static final String IMG_MENU_SHIFT_LEFT= NAME_PREFIX + "shift_l_edit.gif";
 	public static final String IMG_MENU_OPEN_INCLUDE= NAME_PREFIX + "open_incl.gif";
+	public static final String IMG_MENU_SEGMENT_EDIT= NAME_PREFIX + "segment_edit.gif";
 	public static final String IMG_CLEAR_CONSOLE= NAME_PREFIX + "clear_co.gif";
 	public static final String IMG_ALPHA_SORTING= NAME_PREFIX + "alphab_sort_co.gif";
 	public static final String IMG_TOOL_GOTO_PREV_ERROR= NAME_PREFIX + "prev_error_nav.gif";
 	public static final String IMG_TOOL_GOTO_NEXT_ERROR= NAME_PREFIX + "next_error_nav.gif";
-	public static final String IMG_EDIT_PROPERTIES= NAME_PREFIX + "prop_edt.gif";
+	public static final String IMG_EDIT_PROPERTIES= NAME_PREFIX + "prop_edt.gif";	
+
 	public static final ImageDescriptor DESC_OBJS_TEMPLATE= createManaged(T_OBJ, IMG_OBJS_TEMPLATE);
 	
 	public static final ImageDescriptor DESC_OVR_STATIC= create(T_OVR, "static_co.gif");
Index: src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java,v
retrieving revision 1.2
diff -u -r1.2 ICHelpContextIds.java
--- src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java	29 Oct 2002 21:40:58 -0000	1.2
+++ src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java	5 Apr 2003 02:02:38 -0000
@@ -36,5 +36,7 @@
 	public static final String CLEAR_CONSOLE_ACTION= PREFIX + "clear_console_action_context";
 	public static final String CLEAR_CONSOLE_VIEW= PREFIX + "clear_console_view_context";
 
+	public static final String TOGGLE_PRESENTATION_ACTION= 	PREFIX + "toggle_presentation_action_context"; //$NON-NLS-1$
+	public static final String TOGGLE_TEXTHOVER_ACTION= PREFIX + "toggle_texthover_action_context"; //$NON-NLS-1$
 
 }
Index: src/org/eclipse/cdt/internal/ui/cview/CView.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java,v
retrieving revision 1.19
diff -u -r1.19 CView.java
--- src/org/eclipse/cdt/internal/ui/cview/CView.java	2 Apr 2003 15:05:58 -0000	1.19
+++ src/org/eclipse/cdt/internal/ui/cview/CView.java	5 Apr 2003 02:02:42 -0000
@@ -30,6 +30,7 @@
 import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
 import org.eclipse.cdt.ui.CElementContentProvider;
 import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.PreferenceConstants;
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
@@ -1107,7 +1108,7 @@
 
 		boolean refreshViewer= false;
 
-		if (event.getProperty() == CPluginPreferencePage.PREF_SHOW_CU_CHILDREN) {
+		if (event.getProperty() == PreferenceConstants.PREF_SHOW_CU_CHILDREN) {
 			boolean showCUChildren= CPluginPreferencePage.showCompilationUnitChildren();
 			((CElementContentProvider)viewer.getContentProvider()).setProvideMembers(showCUChildren);
 			refreshViewer= true;
Index: src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java,v
retrieving revision 1.7
diff -u -r1.7 CContentOutlinePage.java
--- src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java	19 Mar 2003 20:21:08 -0000	1.7
+++ src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java	5 Apr 2003 02:02:43 -0000
@@ -38,6 +38,7 @@
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IFileEditorInput;
 import org.eclipse.ui.IStorageEditorInput;
+import org.eclipse.ui.part.IPageSite;
 import org.eclipse.ui.part.Page;
 import org.eclipse.ui.texteditor.IDocumentProvider;
 import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
@@ -47,6 +48,7 @@
 	private WorkingCopy fInput;
 	private ProblemTreeViewer treeViewer;
 	private ListenerList selectionChangedListeners = new ListenerList();
+	private TogglePresentationAction fTogglePresentation;
 	
 	private OpenIncludeAction fOpenIncludeAction;
 	private SearchForReferencesAction fSearchForReferencesAction;
@@ -55,6 +57,9 @@
 		super();
 		fEditor= editor;
 		fInput= null;
+
+		fTogglePresentation= new TogglePresentationAction();
+		fTogglePresentation.setEditor(editor);
 		
 		fOpenIncludeAction= new OpenIncludeAction(this);
 		fSearchForReferencesAction= new SearchForReferencesAction(this);
@@ -147,6 +152,12 @@
 		Control control= treeViewer.getControl();
 		Menu menu= manager.createContextMenu(control);
 		control.setMenu(menu);
+
+		// register global actions
+		IPageSite site= getSite();
+		IActionBars bars= site.getActionBars();		
+		bars.setGlobalActionHandler(ICEditorActionDefinitionIds.TOGGLE_PRESENTATION, fTogglePresentation);
+
 		
 		//IFileEditorInput editorInput= (IFileEditorInput)fEditor.getEditorInput();
 		IEditorInput editorInput= (IEditorInput)fEditor.getEditorInput();
Index: src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java,v
retrieving revision 1.7
diff -u -r1.7 CEditorActionContributor.java
--- src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java	20 Feb 2003 20:21:04 -0000	1.7
+++ src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java	5 Apr 2003 02:02:43 -0000
@@ -87,6 +87,7 @@
 	protected SelectionAction fShiftLeft;
 	protected SelectionAction fShiftRight;
 	private TextOperationAction caAction;
+	private TogglePresentationAction fTogglePresentation;
 	//private ToggleTextHoverAction fToggleTextHover;
 	private GotoErrorAction fPreviousError;
 	private GotoErrorAction fNextError;
@@ -108,6 +109,8 @@
 		fAddInclude = new RetargetTextEditorAction(bundle, "AddIncludeOnSelection.");
 		fOpenOnSelection = new RetargetTextEditorAction(bundle, "OpenOnSelection.");
 
+		// actions that are "contributed" to editors, they are considered belonging to the active editor
+		fTogglePresentation= new TogglePresentationAction();
 		//fToggleTextHover= new ToggleTextHoverAction();
 		fPreviousError= new GotoErrorAction("Editor.PreviousError.", false); //$NON-NLS-1$
 		CPluginImages.setImageDescriptors(fPreviousError, CPluginImages.T_TOOL, CPluginImages.IMG_TOOL_GOTO_PREV_ERROR);
@@ -150,10 +153,10 @@
 	public void contributeToToolBar(IToolBarManager tbm) {
 		super.contributeToToolBar(tbm);
 		tbm.add(new Separator());
-		//tbm.add(fTogglePresentation);
+		tbm.add(fTogglePresentation);
 		//tbm.add(fToggleTextHover);
 		tbm.add(fNextError);
-		tbm.add(fPreviousError);
+		tbm.add(fPreviousError);		
 	}
 	
 	/**
@@ -172,6 +175,8 @@
 		fShiftLeft.setEditor(textEditor);
 		fNextError.setEditor(textEditor);
 		fPreviousError.setEditor(textEditor);
+		fTogglePresentation.setEditor(textEditor);
+
 		//caAction.setEditor(textEditor);
 		//caAction.update();
 		fContentAssist.setAction(getAction(textEditor, "ContentAssistProposal")); //$NON-NLS-1$
Index: src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties,v
retrieving revision 1.1
diff -u -r1.1 CEditorMessages.properties
--- src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties	26 Jun 2002 20:55:44 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties	5 Apr 2003 02:02:44 -0000
@@ -88,11 +88,11 @@
 RunToLine.label=R&un to Line
 RunToLine.tooltip=Run to line
 
-TogglePresentation.tooltip.checked=Show Complete Source
-TogglePresentation.tooltip.unchecked=Show Source of Selected Element Only
+TogglePresentation.label=Show Source of Selected Element Only
+TogglePresentation.tooltip=Show Source of Selected Element Only
 
-ToggleTextHover.tooltip.checked=Hide Text Hover
-ToggleTextHover.tooltip.unchecked=Show Text Hover
+ToggleTextHover.label=Show Text Hover
+ToggleTextHover.tooltip=Show Text Hover
 
 NextError.label=Ne&xt Problem@Ctrl+P
 NextError.tooltip=Go to Next Problem
Index: src/org/eclipse/cdt/internal/ui/editor/CTextEditorActionConstants.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CTextEditorActionConstants.java,v
retrieving revision 1.1
diff -u -r1.1 CTextEditorActionConstants.java
--- src/org/eclipse/cdt/internal/ui/editor/CTextEditorActionConstants.java	26 Jun 2002 20:55:44 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/editor/CTextEditorActionConstants.java	5 Apr 2003 02:02:44 -0000
@@ -20,7 +20,6 @@
 	 */
 	static final String STATUS_INPUT_MODE= "InputMode";
 
-
 }
 
 
Index: src/org/eclipse/cdt/internal/ui/editor/ICEditorActionDefinitionIds.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ICEditorActionDefinitionIds.java,v
retrieving revision 1.1
diff -u -r1.1 ICEditorActionDefinitionIds.java
--- src/org/eclipse/cdt/internal/ui/editor/ICEditorActionDefinitionIds.java	4 Apr 2003 20:33:45 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/editor/ICEditorActionDefinitionIds.java	5 Apr 2003 02:02:44 -0000
@@ -40,6 +40,13 @@
 	 * Action definition ID of the source -> add include action
 	 * (value <code>"org.eclipse.cdt.ui.edit.text.c.add.include"</code>).
 	 */
-	public static final String ADD_INCLUDE= "org.eclipse.cdt.ui.edit.text.c.add.include"; //$NON-NLS-1$
+	public static final String ADD_INCLUDE= "org.eclipse.cdt.ui.edit.text.c.add.include"; //$NON-NLS-1$	
+
+	/**
+	 * Action definition ID of the toggle presentation toolbar button action
+	 * (value <code>"org.eclipse.cdt.ui.edit.text.java.toggle.presentation"</code>).
+	 */
+	public static final String TOGGLE_PRESENTATION= "org.eclipse.cdt.ui.edit.text.c.toggle.presentation"; //$NON-NLS-1$
+
 
 }
Index: src/org/eclipse/cdt/internal/ui/editor/TogglePresentationAction.java
===================================================================
RCS file: src/org/eclipse/cdt/internal/ui/editor/TogglePresentationAction.java
diff -N src/org/eclipse/cdt/internal/ui/editor/TogglePresentationAction.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/internal/ui/editor/TogglePresentationAction.java	5 Apr 2003 02:02:45 -0000
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.ui.editor;
+
+
+
+import org.eclipse.cdt.internal.ui.CPluginImages;
+import org.eclipse.cdt.internal.ui.ICHelpContextIds;
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.PreferenceConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.TextEditorAction;
+
+
+/**
+ * A toolbar action which toggles the presentation model of the
+ * connected text editor. The editor shows either the highlight range
+ * only or always the whole document.
+ */
+public class TogglePresentationAction extends TextEditorAction implements IPropertyChangeListener {
+		
+	private IPreferenceStore fStore;
+
+	/**
+	 * Constructs and updates the action.
+	 */
+	public TogglePresentationAction() {
+		super(CEditorMessages.getResourceBundle(), "TogglePresentation.", null); //$NON-NLS-1$
+		CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, CPluginImages.IMG_MENU_SEGMENT_EDIT);
+		setToolTipText(CEditorMessages.getString("TogglePresentation.tooltip")); //$NON-NLS-1$
+		setActionDefinitionId(ICEditorActionDefinitionIds.TOGGLE_PRESENTATION);
+		WorkbenchHelp.setHelp(this,	ICHelpContextIds.TOGGLE_PRESENTATION_ACTION);		
+		update();
+	}
+	
+	/*
+	 * @see IAction#actionPerformed
+	 */
+	public void run() {
+		
+		ITextEditor editor= getTextEditor();
+		if (editor == null)
+			return;
+		
+		IRegion remembered= editor.getHighlightRange();
+		editor.resetHighlightRange();
+		
+		boolean showAll= !editor.showsHighlightRangeOnly();
+		setChecked(showAll);
+		
+		editor.showHighlightRangeOnly(showAll);
+		if (remembered != null)
+			editor.setHighlightRange(remembered.getOffset(), remembered.getLength(), true);
+		
+		fStore.removePropertyChangeListener(this);
+		fStore.setValue(PreferenceConstants.EDITOR_SHOW_SEGMENTS, showAll);
+		fStore.addPropertyChangeListener(this);
+	}
+	
+	/*
+	 * @see TextEditorAction#update
+	 */
+	public void update() {
+		ITextEditor editor= getTextEditor();
+		boolean checked= (editor != null && editor.showsHighlightRangeOnly());
+		setChecked(checked);
+		setEnabled(editor != null);
+	}
+	
+	/*
+	 * @see TextEditorAction#setEditor(ITextEditor)
+	 */
+	public void setEditor(ITextEditor editor) {
+		
+		super.setEditor(editor);
+		
+		if (editor != null) {
+			
+			if (fStore == null) {
+				fStore= CUIPlugin.getDefault().getPreferenceStore();
+				fStore.addPropertyChangeListener(this);
+			}
+			synchronizeWithPreference(editor);
+			
+		} else if (fStore != null) {
+			fStore.removePropertyChangeListener(this);
+			fStore= null;
+		}
+		
+		update();
+	}
+	
+	/**
+	 * Synchronizes the appearance of the editor with what the preference store tells him.
+	 */
+	private void synchronizeWithPreference(ITextEditor editor) {
+		
+		if (editor == null)
+			return;
+		
+		boolean showSegments= fStore.getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS);
+		setChecked(showSegments);
+		
+		if (editor.showsHighlightRangeOnly() != showSegments) {
+			IRegion remembered= editor.getHighlightRange();
+			editor.resetHighlightRange();
+			editor.showHighlightRangeOnly(showSegments);
+			if (remembered != null)
+				editor.setHighlightRange(remembered.getOffset(), remembered.getLength(), true);
+		}
+	}
+
+	/*
+	 * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
+	 */
+	public void propertyChange(PropertyChangeEvent event) {
+		if (event.getProperty().equals(PreferenceConstants.EDITOR_SHOW_SEGMENTS))
+			synchronizeWithPreference(getTextEditor());
+	}
+}
Index: src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java,v
retrieving revision 1.8
diff -u -r1.8 CPluginPreferencePage.java
--- src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java	2 Apr 2003 21:30:23 -0000	1.8
+++ src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java	5 Apr 2003 02:02:45 -0000
@@ -8,6 +8,7 @@
 import org.eclipse.cdt.core.CCorePlugin;
 import org.eclipse.cdt.internal.ui.ICHelpContextIds;
 import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.PreferenceConstants;
 import org.eclipse.jface.preference.BooleanFieldEditor;
 import org.eclipse.jface.preference.FieldEditorPreferencePage;
 import org.eclipse.jface.preference.IPreferenceStore;
@@ -21,8 +22,6 @@
  */
 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 SHOW_CU_CHILDREN_LABEL= "CBasePreferencePage.CUChildren.label";
@@ -47,10 +46,10 @@
 	protected void createFieldEditors() {
 		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);
 
-		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);
 
 		BooleanFieldEditor useNewParserEditor= new BooleanFieldEditor(CCorePlugin.PREF_USE_NEW_PARSER, CUIPlugin.getResourceString(USE_NEW_PARSER_LABEL), parent);
@@ -59,11 +58,11 @@
 	
 
 	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() {
-		return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_SHOW_CU_CHILDREN);
+		return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREF_SHOW_CU_CHILDREN);
 	}
 	
 	public static boolean useNewParser() {
@@ -81,9 +80,10 @@
 	 * Initializes the default values of this page in the preference bundle.
 	 */
 	public static void initDefaults(IPreferenceStore prefs) {
-		prefs.setDefault(PREF_LINK_TO_EDITOR, true);
-		prefs.setDefault(PREF_SHOW_CU_CHILDREN, true);
+		prefs.setDefault(PreferenceConstants.PREF_LINK_TO_EDITOR, true);
+		prefs.setDefault(PreferenceConstants.PREF_SHOW_CU_CHILDREN, true);
 		prefs.setDefault(CCorePlugin.PREF_USE_NEW_PARSER, CCorePlugin.getDefault().useNewParser());
+		prefs.setDefault(PreferenceConstants.EDITOR_SHOW_SEGMENTS, false);
 	}
 	
 	/* (non-Javadoc)
Index: src/org/eclipse/cdt/ui/PreferenceConstants.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/PreferenceConstants.java
diff -N src/org/eclipse/cdt/ui/PreferenceConstants.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/ui/PreferenceConstants.java	5 Apr 2003 02:02:46 -0000
@@ -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$
+
+}
\ No newline at end of file



Back to the top