| /******************************************************************************* |
| * Copyright (c) 2015 BSI Business Systems Integration AG. |
| * 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: |
| * BSI Business Systems Integration AG - initial API and implementation |
| ******************************************************************************/ |
| package org.eclipse.scout.sdk.s2e.ui.internal.template; |
| |
| import org.eclipse.jdt.core.ICompilationUnit; |
| import org.eclipse.jdt.core.dom.Type; |
| import org.eclipse.jdt.core.dom.TypeDeclaration; |
| |
| /** |
| * <h3>{@link TreeFieldProposal}</h3> |
| * |
| * @author Matthias Villiger |
| * @since 5.2.0 |
| */ |
| public class TreeFieldProposal extends FormFieldProposal { |
| |
| protected static final String TREE_SUPER_TYPE_GROUP = "TREE_SUPER_TYPE"; |
| |
| public TreeFieldProposal(String name, int relevance, String imageId, ICompilationUnit cu, TypeProposalContext context) { |
| super(name, relevance, imageId, cu, context); |
| } |
| |
| @Override |
| protected TypeDeclaration createFormFieldType(Type superType) { |
| return getFactory().newTreeField(getProposalContext().getDefaultName()) |
| .withNlsMethod(getNlsMethodName()) |
| .withReadOnlyNameSuffix(getProposalContext().getSuffix()) |
| .withSuperType(superType) |
| .in(getProposalContext().getDeclaringType()) |
| .atPosition(getProposalContext().getInsertPosition()) |
| .insert() |
| .get(); |
| } |
| } |