Skip to main content
summaryrefslogtreecommitdiffstats
blob: 082d5ae87cba7aeed028498889bb1c34e50ef983 (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
/*******************************************************************************
 * Copyright (c) 2001, 2005 IBM Corporation and others.
 * 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:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jem.internal.beaninfo.ui;
/*
 *  $RCSfile: BPBeaninfoListElement.java,v $
 *  $Revision: 1.5 $  $Date: 2005/08/24 21:07:12 $ 
 */

import org.eclipse.jem.internal.beaninfo.core.BeaninfoEntry;
import org.eclipse.jem.internal.beaninfo.core.SearchpathEntry;

/**
 * @version 	1.0
 * @author
 */
public class BPBeaninfoListElement extends BPListElement {

	BPSearchListElement[] searchpaths;
	
	/**
	 * Constructor for BPBeaninfoListElement.
	 * The searchPaths is the initial list, it is assumed that
	 * the beaninfoEntry has these searchpaths in them too.
	 */
	public BPBeaninfoListElement(BeaninfoEntry entry, BPSearchListElement[] searchpaths, boolean missing) {
		super(entry, missing);
		this.searchpaths = searchpaths != null ? searchpaths : new BPSearchListElement[0];
	}

	/**
	 * Mark the entry as exported.
	 */
	public void setExported(boolean exported) {
		((BeaninfoEntry) entry).setIsExported(exported);
	}

	/*
	 * @see BPListElement#canExportBeChanged()
	 */
	public boolean canExportBeChanged() {
		return true;
	}

	/*
	 * @see BPListElement#isExported()
	 */
	public boolean isExported() {
		return ((BeaninfoEntry) entry).isExported();
	}
	
	/**
	 * Return the current list of Searchpaths for this Beaninfo Element.
	 */
	public BPSearchListElement[] getSearchpaths() {
		return searchpaths;
	}
	
	/**
	 * Set the new list. This will update the beaninfo entry too.
	 */
	public void setSearchpaths(BPSearchListElement[] searchpaths) {
		this.searchpaths = searchpaths;
		
		SearchpathEntry[] spEntries = new SearchpathEntry[searchpaths.length];
		for (int i = 0; i < searchpaths.length; i++) {
			BPSearchListElement bps = searchpaths[i];
			spEntries[i] = (SearchpathEntry) bps.getEntry();
		}
		
		((BeaninfoEntry) entry).setSearchPaths(spEntries);
	}
}

Back to the top