blob: fff536aa975f2f4588b8939fad968351de19e4ae [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2008, 2009 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.core.runtime.content.IContentType;
import org.eclipse.jpt.core.JpaStructureNode;
import org.eclipse.jpt.ui.JpaPlatformUi;
import org.eclipse.jpt.ui.details.DefaultTypeMappingUiProvider;
import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.commands.PersistentTypeMapAsHandler;
/**
* This menu contribution is responsible to populate the Map As menu with the
* registered mapping types defined in the <code>JptPlatformUi</code> for
* <code>PersistentType</code> objects.
*
* @see JpaPlatform
* @see JpaPlatformUi
* @see PersistentType
*
* @version 2.2
* @since 2.0
*/
public class PersistentTypeMapAsContribution extends MapAsContribution
{
/**
* Creates a new <code>PersistentTypeMapAsContribution</code>.
*/
public PersistentTypeMapAsContribution() {
super();
}
@Override
protected String getCommandId() {
return PersistentTypeMapAsHandler.COMMAND_ID;
}
@Override
protected String getCommandParameterId() {
return PersistentTypeMapAsHandler.COMMAND_PARAMETER_ID;
}
@Override
protected Iterator<? extends TypeMappingUiProvider<?>>
mappingUiProviders(JpaPlatformUi jpaPlatformUi, IContentType contentType) {
return jpaPlatformUi.typeMappingUiProviders(contentType);
}
@Override
protected DefaultTypeMappingUiProvider<?> getDefaultProvider(JpaPlatformUi platformUi, JpaStructureNode node) {
return platformUi.getDefaultTypeMappingUiProvider(node.getContentType());
}
}