KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > propertiesfileeditor > PropertiesFileEditorActionContributor


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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 package org.eclipse.jdt.internal.ui.propertiesfileeditor;
12
13 import org.eclipse.jface.action.IStatusLineManager;
14
15 import org.eclipse.ui.IActionBars;
16 import org.eclipse.ui.IEditorPart;
17 import org.eclipse.ui.texteditor.ITextEditor;
18
19 import org.eclipse.ui.editors.text.TextEditorActionContributor;
20
21 import org.eclipse.jdt.ui.actions.JdtActionConstants;
22
23
24 /**
25  * Action contributor for Properties file editor.
26  *
27  * @since 3.1
28  */

29 public class PropertiesFileEditorActionContributor extends TextEditorActionContributor {
30
31     
32     /*
33      * @see EditorActionBarContributor#setActiveEditor(IEditorPart)
34      */

35     public void setActiveEditor(IEditorPart part) {
36         super.setActiveEditor(part);
37
38         IActionBars actionBars= getActionBars();
39         IStatusLineManager manager= actionBars.getStatusLineManager();
40         manager.setMessage(null);
41         manager.setErrorMessage(null);
42
43         ITextEditor textEditor= null;
44         if (part instanceof ITextEditor)
45             textEditor= (ITextEditor)part;
46
47         actionBars.setGlobalActionHandler(JdtActionConstants.OPEN, getAction(textEditor, JdtActionConstants.OPEN));
48     }
49
50     /*
51      * @see IEditorActionBarContributor#dispose()
52      */

53     public void dispose() {
54         setActiveEditor(null);
55         super.dispose();
56     }
57 }
58
Popular Tags