1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

2004-07-19 Chris Wiebe

This patch cleans up code using the ToggleLinkingAction
	(subclass off AbstractToggleLinkingAction).

	* browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingPart.java
	* browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/ToggleLinkingAction.java

	* src/org/eclipse/cdt/internal/ui/cview/MainActionGroup.java
	* src/org/eclipse/cdt/internal/ui/cview/ToggleLinkingAction.java
	* src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java
This commit is contained in:
Alain Magloire 2004-07-19 20:14:07 +00:00
parent b944b852c0
commit 7afc083bda
6 changed files with 114 additions and 18 deletions

View file

@ -1,3 +1,14 @@
2004-07-19 Chris Wiebe
This patch cleans up code using the ToggleLinkingAction
(subclass off AbstractToggleLinkingAction).
* browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingPart.java
* browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/ToggleLinkingAction.java
* src/org/eclipse/cdt/internal/ui/cview/MainActionGroup.java
* src/org/eclipse/cdt/internal/ui/cview/ToggleLinkingAction.java
* src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java
2004-07-16 Tanya Wolff
Fix for 70221: unexternalized strings

View file

@ -124,7 +124,7 @@ public abstract class CBrowsingPart extends ViewPart implements IMenuListener, I
// private OpenEditorActionGroup fOpenEditorGroup;
// private CCPActionGroup fCCPActionGroup;
// private BuildActionGroup fBuildActionGroup;
// private ToggleLinkingAction fToggleLinkingAction;
private ToggleLinkingAction fToggleLinkingAction;
// protected CompositeActionGroup fActionGroups;
@ -435,8 +435,8 @@ public abstract class CBrowsingPart extends ViewPart implements IMenuListener, I
// if (fHasCustomFilter)
// fCustomFiltersActionGroup.fillActionBars(actionBars);
//
// IMenuManager menu= actionBars.getMenuManager();
// menu.add(fToggleLinkingAction);
IMenuManager menu= actionBars.getMenuManager();
menu.add(fToggleLinkingAction);
}
//---- IWorkbenchPart ------------------------------------------------------
@ -548,7 +548,7 @@ public abstract class CBrowsingPart extends ViewPart implements IMenuListener, I
// if (fHasCustomFilter)
// fCustomFiltersActionGroup= new CustomFiltersActionGroup(this, fViewer);
//
// fToggleLinkingAction= new ToggleLinkingAction(this);
fToggleLinkingAction= new ToggleLinkingAction(this);
}
private void doWorkingSetChanged(PropertyChangeEvent event) {
@ -933,10 +933,10 @@ public abstract class CBrowsingPart extends ViewPart implements IMenuListener, I
if (!needsToProcessSelectionChanged(part, selection))
return;
// if (fToggleLinkingAction.isChecked() && (part instanceof ITextEditor)) {
// setSelectionFromEditor(part, selection);
// return;
// }
if (fToggleLinkingAction.isChecked() && (part instanceof ITextEditor)) {
setSelectionFromEditor(part, selection);
return;
}
if (!(selection instanceof IStructuredSelection))
return;

View file

@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright (c) 2000, 2004 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.browser.cbrowsing;
import org.eclipse.cdt.internal.ui.actions.AbstractToggleLinkingAction;
/**
* This action toggles whether this package explorer links its selection to the active
* editor.
*
* @since 2.1
*/
public class ToggleLinkingAction extends AbstractToggleLinkingAction {
CBrowsingPart fCBrowsingPart;
/**
* Constructs a new action.
*/
public ToggleLinkingAction(CBrowsingPart part) {
setChecked(part.isLinkingEnabled());
fCBrowsingPart= part;
}
/**
* Runs the action.
*/
public void run() {
fCBrowsingPart.setLinkingEnabled(isChecked());
}
}

View file

@ -149,7 +149,7 @@ public class MainActionGroup extends CViewActionGroup {
collapseAllAction = new CollapseAllAction(getCView());
toggleLinkingAction = new ToggleLinkingAction(getCView(), CViewMessages.getString("ToggleLinkingAction.label")); //$NON-NLS-1$
toggleLinkingAction = new ToggleLinkingAction(getCView()); //$NON-NLS-1$
toggleLinkingAction.setToolTipText(CViewMessages.getString("ToggleLinkingAction.toolTip")); //$NON-NLS-1$
toggleLinkingAction.setImageDescriptor(getImageDescriptor("elcl16/synced.gif"));//$NON-NLS-1$
toggleLinkingAction.setHoverImageDescriptor(getImageDescriptor("clcl16/synced.gif"));//$NON-NLS-1$

View file

@ -11,27 +11,31 @@
package org.eclipse.cdt.internal.ui.cview;
import org.eclipse.cdt.internal.ui.actions.AbstractToggleLinkingAction;
/**
* This action toggles whether this navigator links its selection to the active
* editor.
*
* @since 2.0
*/
public class ToggleLinkingAction extends CViewAction {
public class ToggleLinkingAction extends AbstractToggleLinkingAction {
CView fCView;
/**
* Constructs a new action.
*/
public ToggleLinkingAction(CView cview, String label) {
super(cview, label);
setChecked(cview.isLinkingEnabled());
public ToggleLinkingAction(CView cView) {
fCView = cView;
setChecked(cView.isLinkingEnabled());
}
/**
* Runs the action.
*/
public void run() {
getCView().setLinkingEnabled(isChecked());
fCView.setLinkingEnabled(isChecked());
}
}

View file

@ -11,13 +11,13 @@ import java.util.Iterator;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider;
import org.eclipse.cdt.internal.ui.cview.CViewMessages;
import org.eclipse.cdt.internal.ui.actions.AbstractToggleLinkingAction;
import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
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.cdt.ui.actions.MemberFilterActionGroup;
import org.eclipse.cdt.ui.actions.OpenViewActionGroup;
import org.eclipse.cdt.ui.actions.RefactoringActionGroup;
@ -58,6 +58,7 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
private String fContextMenuId;
private OpenIncludeAction fOpenIncludeAction;
private ToggleLinkingAction fToggleLinkingAction;
private MemberFilterActionGroup fMemberFilterActionGroup;
@ -65,6 +66,40 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
private ActionGroup fRefactoringActionGroup;
private ActionGroup fOpenViewActionGroup;
/**
* This action toggles whether this C Outline page links
* its selection to the active editor.
*
* @since 3.0
*/
public class ToggleLinkingAction extends AbstractToggleLinkingAction {
CContentOutlinePage fOutlinePage;
/**
* Constructs a new action.
*
* @param outlinePage the Java outline page
*/
public ToggleLinkingAction(CContentOutlinePage outlinePage) {
//boolean isLinkingEnabled= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE);
boolean isLinkingEnabled= true;
setChecked(isLinkingEnabled);
fOutlinePage= outlinePage;
}
/**
* Runs the action.
*/
public void run() {
//TODO synchronize selection with editor
//PreferenceConstants.getPreferenceStore().setValue(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, isChecked());
//if (isChecked() && fEditor != null)
// fEditor.synchronizeOutlinePage(fEditor.computeHighlightRangeSourceReference(), false);
}
}
public CContentOutlinePage(CEditor editor) {
this("#TranslationUnitOutlinerContext", editor); //$NON-NLS-1$
}
@ -250,7 +285,13 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
fMemberFilterActionGroup= new MemberFilterActionGroup(treeViewer, "COutlineViewer"); //$NON-NLS-1$
fMemberFilterActionGroup.fillActionBars(actionBars);
}
/* IMenuManager menu= actionBars.getMenuManager();
menu.add(new Separator("EndFilterGroup")); //$NON-NLS-1$
fToggleLinkingAction= new ToggleLinkingAction(this);
menu.add(fToggleLinkingAction);
*/ }
/* (non-Javadoc)
* Method declared on ISelectionProvider.