Skip to main content
summaryrefslogtreecommitdiffstats
blob: 8947f9b43b29f1fa748d2b33e81af35ad81b19a5 (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
/*******************************************************************************
 * Copyright (c) 2008 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.ui.internal.menus;

import java.util.Iterator;
import org.eclipse.jpt.core.JpaStructureNode;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.ui.JpaPlatformUi;
import org.eclipse.jpt.ui.details.MappingUiProvider;
import org.eclipse.jpt.ui.internal.commands.PersistentAttributeMapAsHandler;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;

/**
 * This menu contribution is responsible to populate the Map As menu with the
 * registered attribute mapping types defined in the <code>JptPlatformUi</code>
 * for <code>PersistentAttribute</code> objects.
 *
 * @see PersistentAttribute
 *
 * @version 2.0
 * @since 2.0
 */
public class PersistentAttributeMapAsContribution extends MapAsContribution
{
	/**
	 * Creates a new <code>PersistentAttributeMapAsContribution</code>.
	 */
	public PersistentAttributeMapAsContribution() {
		super();
	}

	/*
	 * (non-Javadoc)
	 */
	@Override
	protected String commandId() {
		return PersistentAttributeMapAsHandler.COMMAND_ID;
	}
	
	@Override
	protected String commandParameterId() {
		return PersistentAttributeMapAsHandler.COMMAND_PARAMETER_ID;
	}

	/*
	 * (non-Javadoc)
	 */
	@Override
	protected Iterator<? extends MappingUiProvider<?>> 
			mappingUiProviders(JpaPlatformUi jpaPlatformUi, JpaStructureNode node) {
		if (node instanceof JavaPersistentAttribute) {
			return jpaPlatformUi.javaAttributeMappingUiProviders();
		}
		else if (node instanceof OrmPersistentAttribute) {
			return jpaPlatformUi.ormAttributeMappingUiProviders();
		}
		else {
			return EmptyIterator.instance();
		}
	}
}

Back to the top