~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to results/plugins/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorSearchActionProvider.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*******************************************************************************
2
 
 * Copyright (c) 2006 Wind River Systems, Inc. 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
 
 *     Anton Leherbauer (Wind River Systems) - initial API and implementation
10
 
 *******************************************************************************/
11
 
package org.eclipse.cdt.internal.ui.navigator;
12
 
 
13
 
import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
14
 
import org.eclipse.jface.action.IMenuManager;
15
 
import org.eclipse.jface.viewers.ISelection;
16
 
import org.eclipse.ui.IActionBars;
17
 
import org.eclipse.ui.IViewPart;
18
 
import org.eclipse.ui.actions.ActionContext;
19
 
import org.eclipse.ui.navigator.CommonActionProvider;
20
 
import org.eclipse.ui.navigator.ICommonActionExtensionSite;
21
 
import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
22
 
 
23
 
/**
24
 
 * Common Navigator action provider for the C-search sub menus.
25
 
 * 
26
 
 * @see org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup
27
 
 */
28
 
public class CNavigatorSearchActionProvider extends CommonActionProvider {
29
 
 
30
 
        private SelectionSearchGroup fSearchGroup;
31
 
        
32
 
        /*
33
 
         * @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite)
34
 
         */
35
 
        @Override
36
 
        public void init(ICommonActionExtensionSite site) {
37
 
                ICommonViewerWorkbenchSite workbenchSite= null;
38
 
                if (site.getViewSite() instanceof ICommonViewerWorkbenchSite) {
39
 
                        workbenchSite= (ICommonViewerWorkbenchSite) site.getViewSite();
40
 
                }
41
 
                if (workbenchSite != null) {
42
 
                        if (workbenchSite.getPart() != null && workbenchSite.getPart() instanceof IViewPart) {
43
 
                                fSearchGroup= new SelectionSearchGroup(workbenchSite.getSite());
44
 
                        }
45
 
                }
46
 
        }
47
 
 
48
 
        /*
49
 
         * @see org.eclipse.ui.actions.ActionGroup#dispose()
50
 
         */
51
 
        @Override
52
 
        public void dispose() {
53
 
                if (fSearchGroup != null) {
54
 
                        fSearchGroup.dispose();
55
 
                        fSearchGroup = null;
56
 
                }
57
 
                super.dispose();
58
 
        }
59
 
 
60
 
        /*
61
 
         * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
62
 
         */
63
 
        @Override
64
 
        public void fillActionBars(IActionBars actionBars) {
65
 
                if (fSearchGroup != null) {
66
 
                        fSearchGroup.fillActionBars(actionBars);
67
 
                }
68
 
        }
69
 
 
70
 
        /*
71
 
         * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
72
 
         */
73
 
        @Override
74
 
        public void fillContextMenu(IMenuManager menu) {
75
 
                if (fSearchGroup != null) {
76
 
                        ISelection selection = getContext().getSelection();
77
 
                        if (SelectionSearchGroup.canActionBeAdded(selection)){
78
 
                                fSearchGroup.fillContextMenu(menu);
79
 
                        }
80
 
                }
81
 
        }
82
 
 
83
 
        /*
84
 
         * @see org.eclipse.ui.actions.ActionGroup#setContext(org.eclipse.ui.actions.ActionContext)
85
 
         */
86
 
        @Override
87
 
        public void setContext(ActionContext context) {
88
 
                super.setContext(context);
89
 
                if (fSearchGroup != null) {
90
 
                        fSearchGroup.setContext(context);
91
 
                }
92
 
        }
93
 
 
94
 
        /*
95
 
         * @see org.eclipse.ui.actions.ActionGroup#updateActionBars()
96
 
         */
97
 
        @Override
98
 
        public void updateActionBars() {
99
 
                if (fSearchGroup != null) {
100
 
                        fSearchGroup.updateActionBars();
101
 
                }
102
 
        }
103
 
        
104
 
}