Skip to main content
summaryrefslogtreecommitdiffstats
blob: 52947eca676551220c171c5c2b753a2a56542098 (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
/*******************************************************************************
 * Copyright (c) 2008, 2012 Oracle. 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:
 *     Oracle - initial API and implementation
 ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.structure;

import org.eclipse.jpt.common.ui.internal.jface.AbstractItemTreeContentProvider;
import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter;
import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaStructureNode;

public class JpaFileItemContentProvider
	extends AbstractItemTreeContentProvider<JpaFile, JpaStructureNode>
{
	public JpaFileItemContentProvider(JpaFile jpaFile, Manager manager) {
		super(jpaFile, manager);
	}

	public Object getParent() {
		return null;
	}

	@Override
	protected CollectionValueModel<JpaStructureNode> buildChildrenModel() {
		return new ChildrenModel(this.item);
	}

	public static class ChildrenModel
		extends CollectionAspectAdapter<JpaFile, JpaStructureNode>
	{
		public ChildrenModel(JpaFile jpaFile) {
			super(JpaFile.ROOT_STRUCTURE_NODES_COLLECTION, jpaFile);
		}

		@Override
		protected Iterable<JpaStructureNode> getIterable() {
			return this.subject.getRootStructureNodes();
		}

		@Override
		public int size_() {
			return this.subject.getRootStructureNodesSize();
		}
	}
}

Back to the top