| /******************************************************************************* |
| * Copyright (c) 2006, 2013 Oracle. All rights reserved. |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License 2.0, which accompanies this distribution |
| * and is available at https://www.eclipse.org/legal/epl-2.0/. |
| * |
| * Contributors: |
| * Oracle - initial API and implementation |
| ******************************************************************************/ |
| package org.eclipse.jpt.jpa.ui.internal.details; |
| |
| import org.eclipse.jface.resource.ImageDescriptor; |
| import org.eclipse.jface.resource.ResourceManager; |
| import org.eclipse.jpt.common.ui.WidgetFactory; |
| import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; |
| import org.eclipse.jpt.jpa.core.MappingKeys; |
| import org.eclipse.jpt.jpa.core.context.JpaContextModel; |
| import org.eclipse.jpt.jpa.core.context.ManyToManyMapping; |
| import org.eclipse.jpt.jpa.ui.JptJpaUiImages; |
| import org.eclipse.jpt.jpa.ui.details.JpaComposite; |
| import org.eclipse.jpt.jpa.ui.details.JpaUiFactory; |
| import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; |
| import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition; |
| import org.eclipse.swt.widgets.Composite; |
| |
| public class ManyToManyMappingUiDefinition |
| extends AbstractMappingUiDefinition |
| { |
| // singleton |
| private static final ManyToManyMappingUiDefinition INSTANCE = |
| new ManyToManyMappingUiDefinition(); |
| |
| |
| /** |
| * Return the singleton. |
| */ |
| public static MappingUiDefinition instance() { |
| return INSTANCE; |
| } |
| |
| |
| /** |
| * Ensure single instance. |
| */ |
| private ManyToManyMappingUiDefinition() { |
| super(); |
| } |
| |
| public String getKey() { |
| return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY; |
| } |
| |
| public String getLabel() { |
| return JptJpaUiDetailsMessages.MANY_TO_MANY_MAPPING_UI_PROVIDER_LABEL; |
| } |
| |
| public String getLinkLabel() { |
| return JptJpaUiDetailsMessages.MANY_TO_MANY_MAPPING_UI_PROVIDER_LINK_LABEL; |
| } |
| |
| @Override |
| public ImageDescriptor getImageDescriptor() { |
| return JptJpaUiImages.MANY_TO_MANY; |
| } |
| |
| @SuppressWarnings("unchecked") |
| public JpaComposite buildMappingComposite(JpaUiFactory factory, PropertyValueModel<? extends JpaContextModel> mappingModel, PropertyValueModel<Boolean> enabledModel, Composite parentComposite, WidgetFactory widgetFactory, ResourceManager resourceManager) { |
| return factory.createManyToManyMappingComposite((PropertyValueModel<ManyToManyMapping>) mappingModel, enabledModel, parentComposite, widgetFactory, resourceManager); |
| } |
| } |