blob: ee3c7060fc5bcdb0463d4ec3720864e937369a0f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
/*******************************************************************************
* Copyright (c) 2000, 2003 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.ui.externaltools.internal.ant.editor;
/**********************************************************************
This file is 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
**********************************************************************/
// Copyright:
// GEBIT Gesellschaft fuer EDV-Beratung
// und Informatik-Technologien mbH,
// Berlin, Duesseldorf, Frankfurt (Germany) 2002
// All rights reserved.
//
import java.util.ResourceBundle;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.editors.text.TextEditorActionContributor;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.RetargetTextEditorAction;
/**
* Contributes interesting Java actions to the desktop's Edit menu and the toolbar.
*
* @author Alf Schiefelbein
*/
public class PlantyActionContributor extends TextEditorActionContributor {
protected RetargetTextEditorAction fContentAssistProposal;
// protected RetargetTextEditorAction fContentAssistTip;
/**
* Default constructor.
*/
public PlantyActionContributor() {
super();
fContentAssistProposal= new RetargetTextEditorAction(ResourceBundle.getBundle("org.eclipse.ui.externaltools.internal.ant.editor.AntEditorMessages"), "ContentAssistProposal."); //$NON-NLS-1$ //$NON-NLS-2$
// fContentAssistTip= new RetargetTextEditor(ResourceBundle.getBundle("org.eclipse.ui.externaltools.internal.ant.editor.AntEditorMessages"), "ContentAssistTip."); //$NON-NLS-1$
}
private void doSetActiveEditor(IEditorPart part) {
super.setActiveEditor(part);
ITextEditor editor= null;
if (part instanceof ITextEditor)
editor= (ITextEditor) part;
fContentAssistProposal.setAction(getAction(editor, "ContentAssistProposal")); //$NON-NLS-1$
// fContentAssistTip.setAction(getAction(editor, "ContentAssistTip")); //$NON-NLS-1$
}
/*
* @see IEditorActionBarContributor#init(IActionBars)
*/
public void init(IActionBars bars) {
super.init(bars);
IMenuManager menuManager= bars.getMenuManager();
IMenuManager editMenu= menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (editMenu != null) {
editMenu.add(new org.eclipse.jface.action.Separator());
editMenu.add(fContentAssistProposal);
// editMenu.add(fContentAssistTip);
}
}
/*
* @see IEditorActionBarContributor#setActiveEditor(IEditorPart)
*/
public void setActiveEditor(IEditorPart part) {
doSetActiveEditor(part);
}
/*
* @see IEditorActionBarContributor#dispose()
*/
public void dispose() {
doSetActiveEditor(null);
super.dispose();
}
}
|