01: /*******************************************************************************
02: * Copyright (c) 2003, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.editor.plugin;
11:
12: import org.eclipse.jface.action.Action;
13: import org.eclipse.jface.action.IMenuManager;
14: import org.eclipse.jface.action.Separator;
15: import org.eclipse.jface.viewers.IStructuredSelection;
16: import org.eclipse.jface.viewers.StructuredSelection;
17: import org.eclipse.pde.core.IBaseModel;
18: import org.eclipse.pde.internal.ui.PDEUIMessages;
19: import org.eclipse.pde.internal.ui.editor.PDEFormTextEditorContributor;
20: import org.eclipse.pde.internal.ui.nls.GetNonExternalizedStringsAction;
21: import org.eclipse.pde.internal.ui.util.SWTUtil;
22: import org.eclipse.swt.custom.BusyIndicator;
23:
24: public class ManifestEditorContributor extends
25: PDEFormTextEditorContributor {
26:
27: private ExternalizeAction fExternalizeAction;
28:
29: class ExternalizeAction extends Action {
30: public ExternalizeAction() {
31: }
32:
33: public void run() {
34: if (getEditor() != null) {
35: BusyIndicator.showWhile(SWTUtil.getStandardDisplay(),
36: new Runnable() {
37: public void run() {
38: GetNonExternalizedStringsAction fGetExternAction = new GetNonExternalizedStringsAction();
39: IStructuredSelection selection = new StructuredSelection(
40: getEditor().getCommonProject());
41: fGetExternAction.selectionChanged(
42: ExternalizeAction.this ,
43: selection);
44: fGetExternAction
45: .run(ExternalizeAction.this );
46: }
47: });
48: }
49: }
50: }
51:
52: public ManifestEditorContributor() {
53: super ("&Plugin"); //$NON-NLS-1$
54: }
55:
56: public void contextMenuAboutToShow(IMenuManager mm,
57: boolean addClipboard) {
58: super .contextMenuAboutToShow(mm, addClipboard);
59: IBaseModel model = getEditor().getAggregateModel();
60: if (model != null && model.isEditable()) {
61: mm.add(new Separator());
62: mm.add(fExternalizeAction);
63: }
64: }
65:
66: protected void makeActions() {
67: super .makeActions();
68: fExternalizeAction = new ExternalizeAction();
69: fExternalizeAction
70: .setText(PDEUIMessages.ManifestEditorContributor_externStringsActionName);
71: }
72:
73: public boolean supportsContentAssist() {
74: return true;
75: }
76:
77: public boolean supportsFormatAction() {
78: return true;
79: }
80:
81: public boolean supportsCorrectionAssist() {
82: return true;
83: }
84:
85: public boolean supportsHyperlinking() {
86: return true;
87: }
88: }
|