KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > display > ClearDisplayAction


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

11 package org.eclipse.jdt.internal.debug.ui.display;
12
13
14 import org.eclipse.jdt.internal.debug.ui.IJavaDebugHelpContextIds;
15 import org.eclipse.jdt.internal.debug.ui.JavaDebugImages;
16 import org.eclipse.jface.action.Action;
17 import org.eclipse.ui.IWorkbenchPart;
18 import org.eclipse.ui.help.WorkbenchHelp;
19
20 /**
21  * Clears the display.
22  */

23 public class ClearDisplayAction extends Action {
24     
25     private IWorkbenchPart fWorkbenchPart;
26
27     public ClearDisplayAction(IWorkbenchPart workbenchPart) {
28         fWorkbenchPart= workbenchPart;
29         
30         setText(DisplayMessages.getString("ClearDisplay.label")); //$NON-NLS-1$
31
setToolTipText(DisplayMessages.getString("ClearDisplay.tooltip")); //$NON-NLS-1$
32
setDescription(DisplayMessages.getString("ClearDisplay.description")); //$NON-NLS-1$
33
WorkbenchHelp.setHelp(this, IJavaDebugHelpContextIds.CLEAR_DISPLAY_VIEW_ACTION);
34         
35         JavaDebugImages.setLocalImageDescriptors(this, "clear_co.gif"); //$NON-NLS-1$
36
}
37
38     /**
39      * @see Action#run
40      */

41     public void run() {
42         Object JavaDoc value= fWorkbenchPart.getAdapter(IDataDisplay.class);
43         if (value instanceof IDataDisplay) {
44             IDataDisplay dataDisplay= (IDataDisplay) value;
45             dataDisplay.clear();
46         }
47     }
48 }
49
Popular Tags