01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package org.terracotta.dso.actions;
05:
06: import org.eclipse.jdt.core.IJavaElement;
07: import org.eclipse.jdt.core.IJavaProject;
08: import org.eclipse.jface.viewers.ISelection;
09: import org.eclipse.swt.widgets.Menu;
10:
11: /**
12: * Popup action submenu that holds actions that are Java project-related.
13: *
14: * @see org.eclipse.jdt.core.IJavaProject
15: * @see BaseMenuCreator
16: * @see AdaptableAction
17: * @see ExcludedTypeAction
18: * @see LockHandler
19: */
20:
21: public class ProjectHandler extends BaseMenuCreator {
22: private IJavaProject m_javaProject;
23: private AdaptableAction m_adaptableAction;
24: private ExcludedTypeAction m_excludedAction;
25: private LockHandler m_lockHandler;
26:
27: public ProjectHandler() {
28: super ();
29:
30: m_adaptableAction = new AdaptableAction();
31: m_excludedAction = new ExcludedTypeAction();
32: m_lockHandler = new LockHandler();
33: }
34:
35: protected IJavaElement getJavaElement(ISelection selection) {
36: return m_javaProject = ActionUtil
37: .findSelectedJavaProject(selection);
38: }
39:
40: protected void fillMenu(Menu menu) {
41: if (m_javaProject != null) {
42: m_adaptableAction.setJavaElement(m_javaProject);
43: addMenuAction(menu, m_adaptableAction);
44:
45: m_excludedAction.setJavaElement(m_javaProject);
46: addMenuAction(menu, m_excludedAction);
47:
48: m_lockHandler.fillMenu(menu);
49: }
50: }
51: }
|