Skip to main content
summaryrefslogtreecommitdiffstats
blob: 598c93a19372c7af942de85f99caf47944d0b9d2 (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
/***********************************************************************
 * 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.net.URL;
import java.util.ArrayList;
import java.util.List;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
import org.eclipse.jst.javaee.ejb.EJBJar;
import org.eclipse.jst.javaee.ejb.EnterpriseBeans;
import org.eclipse.jst.jee.ui.internal.Messages;
import org.eclipse.jst.jee.ui.internal.navigator.AbstractDDNode;
import org.eclipse.swt.graphics.Image;

/**
 * Entity Beans group Deployment Descriptor node that has a number of sub nodes 
 * 
 * @author Dimitar Giormov
 *
 */
public class GroupEjbEntity extends AbstractDDNode {

	public GroupEjbEntity(EJBJar parent) {
		super(parent);
    image = null;
    text = Messages.ENTITY_BEANS;
	}

	@Override
	public List getChildren() {
		List children = new ArrayList();
		List entities = null;
		 EnterpriseBeans enterpriseBeans = ((EJBJar) adapterNode).getEnterpriseBeans();
		 if (enterpriseBeans != null)
			 entities = enterpriseBeans.getEntityBeans();
		if (entities != null && entities.size() >0){
			children.addAll(entities);
		}
		return children;
	}

	@Override
	public boolean hasChildren() {
		return !getChildren().isEmpty();
	}
	
	@Override
	public Image getImage() {
	  URL url = (URL) J2EEPlugin.getPlugin().getImage("cmpEntity_obj"); //$NON-NLS-1$
      return ImageDescriptor.createFromURL(url).createImage();
	}
}

Back to the top