KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > memory > PinMemoryBlockAction


1 /*******************************************************************************
2  * Copyright (c) 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.debug.internal.ui.views.memory;
13
14 import org.eclipse.jface.action.IAction;
15 import org.eclipse.jface.viewers.ISelection;
16 import org.eclipse.ui.IViewActionDelegate;
17 import org.eclipse.ui.IViewPart;
18
19 /**
20  * Action for pinning the display of the memory view to
21  * the current memory block. The view would not change
22  * selection when a new memory block is added if the diplay is pinned.
23  *
24  */

25 public class PinMemoryBlockAction implements IViewActionDelegate {
26
27     private MemoryView fView;
28     public void init(IViewPart view) {
29         if (view instanceof MemoryView)
30             fView = (MemoryView)view;
31
32     }
33
34     public void run(IAction action) {
35         if (fView == null)
36             return;
37         
38         boolean pin = !fView.isPinMBDisplay();
39         fView.setPinMBDisplay(pin);
40         
41         action.setChecked(pin);
42     }
43
44     public void selectionChanged(IAction action, ISelection selection) {
45     }
46
47 }
48
Popular Tags