mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Bug 299892 - Add missing group actions in outline view
Patch from Marc-Andre Laperle
This commit is contained in:
parent
db0b2d61e1
commit
42224beaf8
3 changed files with 130 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Copyright (c) 2000, 2009 IBM Corporation and others.
|
# Copyright (c) 2000, 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
|
||||||
|
@ -53,10 +53,22 @@ ToggleLinkingAction.label=Lin&k With Editor
|
||||||
ToggleLinkingAction.tooltip=Link with Editor
|
ToggleLinkingAction.tooltip=Link with Editor
|
||||||
ToggleLinkingAction.description=Link with active editor
|
ToggleLinkingAction.description=Link with active editor
|
||||||
|
|
||||||
IncludesGroupingAction.label=Group includes
|
IncludesGroupingAction.label=Group Includes
|
||||||
IncludesGroupingAction.tooltip=Group includes statements
|
IncludesGroupingAction.tooltip=Group includes statements
|
||||||
IncludesGroupingAction.description=Group includes statements
|
IncludesGroupingAction.description=Group includes statements
|
||||||
|
|
||||||
|
NamespacesGroupingAction.label=Group Namespaces
|
||||||
|
NamespacesGroupingAction.tooltip=Group namespaces
|
||||||
|
NamespacesGroupingAction.description=Group namespaces
|
||||||
|
|
||||||
|
MemberGroupingAction.label=Group Methods
|
||||||
|
MemberGroupingAction.tooltip=Group method definitions
|
||||||
|
MemberGroupingAction.description=Group method definitions
|
||||||
|
|
||||||
|
MacroGroupingAction.label = Group Macros
|
||||||
|
MacroGroupingAction.tooltip = Group macro definitions
|
||||||
|
MacroGroupingAction.description = Group macro definitions
|
||||||
|
|
||||||
COutlineInformationControl.viewMenu.sort.label=Sort
|
COutlineInformationControl.viewMenu.sort.label=Sort
|
||||||
|
|
||||||
ChangeBuildConfigMenuAction.title=Sorry
|
ChangeBuildConfigMenuAction.title=Sorry
|
||||||
|
|
|
@ -211,6 +211,40 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This action toggles macro grouping
|
||||||
|
*
|
||||||
|
* @since 5.2
|
||||||
|
*/
|
||||||
|
protected static class MacroGroupingAction extends Action {
|
||||||
|
|
||||||
|
public MacroGroupingAction(AbstractCModelOutlinePage outlinePage) {
|
||||||
|
super(ActionMessages.getString("MacroGroupingAction.label")); //$NON-NLS-1$
|
||||||
|
setDescription(ActionMessages.getString("MacroGroupingAction.description")); //$NON-NLS-1$
|
||||||
|
setToolTipText(ActionMessages.getString("MacroGroupingAction.tooltip")); //$NON-NLS-1$
|
||||||
|
CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_HIDE_MACROS);
|
||||||
|
this.setImageDescriptor(CPluginImages.DESC_OBJS_MACRO);
|
||||||
|
this.setDisabledImageDescriptor(CPluginImages.DESC_OBJS_MACRO);
|
||||||
|
|
||||||
|
|
||||||
|
boolean enabled= isMacroGroupingEnabled();
|
||||||
|
setChecked(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the action.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
PreferenceConstants.getPreferenceStore().setValue(PreferenceConstants.OUTLINE_GROUP_MACROS, isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isMacroGroupingEnabled () {
|
||||||
|
return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_MACROS);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This action toggles whether this C Outline page links
|
* This action toggles whether this C Outline page links
|
||||||
* its selection to the active editor.
|
* its selection to the active editor.
|
||||||
|
@ -248,7 +282,6 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
||||||
protected String fContextMenuId;
|
protected String fContextMenuId;
|
||||||
private Menu fMenu;
|
private Menu fMenu;
|
||||||
protected OpenIncludeAction fOpenIncludeAction;
|
protected OpenIncludeAction fOpenIncludeAction;
|
||||||
private IncludeGroupingAction fIncludeGroupingAction;
|
|
||||||
private ToggleLinkingAction fToggleLinkingAction;
|
private ToggleLinkingAction fToggleLinkingAction;
|
||||||
private ActionGroup fMemberFilterActionGroup;
|
private ActionGroup fMemberFilterActionGroup;
|
||||||
private ActionGroup fSelectionSearchGroup;
|
private ActionGroup fSelectionSearchGroup;
|
||||||
|
@ -563,8 +596,10 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
||||||
|
|
||||||
fToggleLinkingAction= new ToggleLinkingAction();
|
fToggleLinkingAction= new ToggleLinkingAction();
|
||||||
menu.add(fToggleLinkingAction);
|
menu.add(fToggleLinkingAction);
|
||||||
fIncludeGroupingAction= new IncludeGroupingAction(this);
|
|
||||||
menu.add(fIncludeGroupingAction);
|
menu.add(new Separator("group.layout")); //$NON-NLS-1$
|
||||||
|
menu.add(new IncludeGroupingAction(this));
|
||||||
|
menu.add(new MacroGroupingAction(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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
|
||||||
|
@ -13,6 +13,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.editor;
|
package org.eclipse.cdt.internal.ui.editor;
|
||||||
|
|
||||||
|
import org.eclipse.jface.action.Action;
|
||||||
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.StackLayout;
|
import org.eclipse.swt.custom.StackLayout;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
@ -21,6 +23,7 @@ import org.eclipse.swt.layout.FillLayout;
|
||||||
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.Link;
|
import org.eclipse.swt.widgets.Link;
|
||||||
|
import org.eclipse.ui.IActionBars;
|
||||||
import org.eclipse.ui.actions.ActionGroup;
|
import org.eclipse.ui.actions.ActionGroup;
|
||||||
import org.eclipse.ui.dialogs.PreferencesUtil;
|
import org.eclipse.ui.dialogs.PreferencesUtil;
|
||||||
|
|
||||||
|
@ -32,6 +35,8 @@ import org.eclipse.cdt.ui.actions.MemberFilterActionGroup;
|
||||||
import org.eclipse.cdt.ui.actions.OpenViewActionGroup;
|
import org.eclipse.cdt.ui.actions.OpenViewActionGroup;
|
||||||
import org.eclipse.cdt.ui.refactoring.actions.CRefactoringActionGroup;
|
import org.eclipse.cdt.ui.refactoring.actions.CRefactoringActionGroup;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
|
import org.eclipse.cdt.internal.ui.actions.ActionMessages;
|
||||||
import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
|
import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,5 +156,77 @@ public class CContentOutlinePage extends AbstractCModelOutlinePage {
|
||||||
protected ActionGroup createMemberFilterActionGroup() {
|
protected ActionGroup createMemberFilterActionGroup() {
|
||||||
return new MemberFilterActionGroup(getTreeViewer(), "COutlineViewer"); //$NON-NLS-1$
|
return new MemberFilterActionGroup(getTreeViewer(), "COutlineViewer"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This action toggles namespace grouping
|
||||||
|
*
|
||||||
|
* @since 5.2
|
||||||
|
*/
|
||||||
|
protected static class NamespaceGroupingAction extends Action {
|
||||||
|
|
||||||
|
public NamespaceGroupingAction(AbstractCModelOutlinePage outlinePage) {
|
||||||
|
super(ActionMessages.getString("NamespacesGroupingAction.label")); //$NON-NLS-1$
|
||||||
|
setDescription(ActionMessages.getString("NamespacesGroupingAction.description")); //$NON-NLS-1$
|
||||||
|
setToolTipText(ActionMessages.getString("NamespacesGroupingAction.tooltip")); //$NON-NLS-1$
|
||||||
|
this.setImageDescriptor(CPluginImages.DESC_OBJS_NAMESPACE);
|
||||||
|
this.setDisabledImageDescriptor(CPluginImages.DESC_OBJS_NAMESPACE);
|
||||||
|
|
||||||
|
boolean enabled= isNamspacesGroupingEnabled();
|
||||||
|
setChecked(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the action.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
PreferenceConstants.getPreferenceStore().setValue(PreferenceConstants.OUTLINE_GROUP_NAMESPACES, isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNamspacesGroupingEnabled () {
|
||||||
|
return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_NAMESPACES);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This action toggles member definition grouping
|
||||||
|
*
|
||||||
|
* @since 5.2
|
||||||
|
*/
|
||||||
|
protected static class MemberGroupingAction extends Action {
|
||||||
|
|
||||||
|
public MemberGroupingAction(AbstractCModelOutlinePage outlinePage) {
|
||||||
|
super(ActionMessages.getString("MemberGroupingAction.label")); //$NON-NLS-1$
|
||||||
|
setDescription(ActionMessages.getString("MemberGroupingAction.description")); //$NON-NLS-1$
|
||||||
|
setToolTipText(ActionMessages.getString("MemberGroupingAction.tooltip")); //$NON-NLS-1$
|
||||||
|
CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_SHOW_PUBLIC);
|
||||||
|
|
||||||
|
boolean enabled= isMemberGroupingEnabled();
|
||||||
|
setChecked(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the action.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
PreferenceConstants.getPreferenceStore().setValue(PreferenceConstants.OUTLINE_GROUP_MEMBERS, isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isMemberGroupingEnabled () {
|
||||||
|
return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_MEMBERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void registerActionBars(IActionBars actionBars) {
|
||||||
|
super.registerActionBars(actionBars);
|
||||||
|
IMenuManager menu= actionBars.getMenuManager();
|
||||||
|
|
||||||
|
menu.appendToGroup("group.layout", new MemberGroupingAction(this)); //$NON-NLS-1$
|
||||||
|
menu.appendToGroup("group.layout", new NamespaceGroupingAction(this)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue