KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > feature > FeatureEditorContributor


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.pde.internal.ui.editor.feature;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.jface.action.IMenuManager;
15 import org.eclipse.jface.action.Separator;
16 import org.eclipse.pde.internal.ui.editor.PDEFormTextEditorContributor;
17 import org.eclipse.pde.internal.ui.wizards.site.OpenProjectWizardAction;
18 import org.eclipse.swt.dnd.Clipboard;
19 import org.eclipse.ui.IEditorPart;
20
21 public class FeatureEditorContributor extends PDEFormTextEditorContributor {
22     private EditorBuildFeatureAction fBuildAction;
23
24     private SynchronizeVersionsAction fSynchronizeAction;
25
26     private OpenProjectWizardAction fNewSiteAction;
27
28     public FeatureEditorContributor() {
29         super("&Feature"); //$NON-NLS-1$
30
}
31
32     public void contextMenuAboutToShow(IMenuManager mng) {
33         super.contextMenuAboutToShow(mng);
34         mng.add(new Separator());
35         mng.add(fSynchronizeAction);
36         mng.add(fBuildAction);
37     }
38
39     public Action getBuildAction() {
40         return fBuildAction;
41     }
42
43     public Action getSynchronizeAction() {
44         return fSynchronizeAction;
45     }
46
47     public Action getNewSiteAction() {
48         return fNewSiteAction;
49     }
50
51     protected void makeActions() {
52         super.makeActions();
53         fBuildAction = new EditorBuildFeatureAction();
54         fSynchronizeAction = new SynchronizeVersionsAction();
55         fNewSiteAction = new OpenProjectWizardAction();
56     }
57
58     public void setActiveEditor(IEditorPart targetEditor) {
59         super.setActiveEditor(targetEditor);
60         if (targetEditor instanceof FeatureEditor) {
61             fBuildAction.setActiveEditor((FeatureEditor) targetEditor);
62             fSynchronizeAction.setActiveEditor((FeatureEditor) targetEditor);
63         }
64     }
65
66     protected boolean hasKnownTypes(Clipboard clipboard) {
67         return true;
68     }
69 }
70
Popular Tags