Skip to main content
summaryrefslogtreecommitdiffstats
blob: 1870fe61c617bb22d6fff2d84a6fa7ffeb5a907e (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
/***********************************************************************
 * Copyright (c) 2008 by SAP AG, Walldorf. 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     SAP AG - initial API and implementation
 ***********************************************************************/
package org.eclipse.jst.jee.ui.internal.navigator.ejb;

import java.util.List;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jst.javaee.core.JavaEEObject;
import org.eclipse.jst.javaee.ejb.EJBJar;
import org.eclipse.jst.jee.ui.internal.Messages;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
/**
 * Deployment Descriptor root node. 
 * 
 * @author Dimitar Giormov
 *
 */
public class GroupEJBProvider extends AbstractEjbGroupProvider implements IAdaptable {

	private GroupEjbSession groupEjbSession;
	private GroupEjbMessageDriven groupEjbMessageDriven;
	private GroupEjbEntity groupEjbEntity;
	private String projectName = null;


	public GroupEJBProvider(EJBJar ejbJar) {
		super(ejbJar);

		groupEjbSession = new GroupEjbSession(ejbJar);
		groupEjbMessageDriven = new GroupEjbMessageDriven(ejbJar);
		groupEjbEntity = new GroupEjbEntity(ejbJar);

		children.add(groupEjbSession);
		children.add(groupEjbMessageDriven);
		children.add(groupEjbEntity);
	}

	@Override
	public List getChildren() {
		return children;
	}

	public EJBJar getEjbJar() {
		return (EJBJar) javaee;
	}

	@Override
	public String getText() {
		return NLS.bind(Messages.DEPLOYMENT_DESCRIPTOR, projectName);
	}

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	@Override
	public Image getImage() {
		return null;
	}

	@Override
	public void reinit(JavaEEObject modelObject) {
		super.reinit(modelObject);
		groupEjbSession.reinit(modelObject);
		groupEjbMessageDriven.reinit(modelObject);
		groupEjbEntity.reinit(modelObject);
	}

	public Object getAdapter(Class adapter) {
		if (IProject.class == adapter){
			return ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName());
		}
		return null;
	}
}

Back to the top