blob: 6ce32b98543447e0119a335e1e8194dd8b8efdcd [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* 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/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*/
package org.eclipse.osbp.xtext.perspective.linking;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.osbp.xtext.oxtype.linking.JvmTypeAwareLinkingHelper;
import org.eclipse.osbp.xtext.perspective.PerspectiveDslPackage;
import org.eclipse.xtext.xbase.lib.StringExtensions;
public class PerspectiveJvmLinkingHelper extends JvmTypeAwareLinkingHelper {
public PerspectiveJvmLinkingHelper() {
register(
PerspectiveDslPackage.Literals.PERSPECTIVE_SELECTION__REF,
PerspectiveDslPackage.Literals.PERSPECTIVE_SELECTION__REF_TYPE_JVM,
new IJvmLinkCrossRefStringEnhancer() {
@Override
public String enhance(EObject context,
EStructuralFeature feature, String crossRefString) {
return crossRefString + "Select";
}
}, null);
register(PerspectiveDslPackage.Literals.PERSPECTIVE_TABLE__REF,
PerspectiveDslPackage.Literals.PERSPECTIVE_TABLE__REF_TYPE_JVM,
new IJvmLinkCrossRefStringEnhancer() {
@Override
public String enhance(EObject context,
EStructuralFeature feature, String crossRefString) {
return crossRefString + "Table";
}
}, null);
register(PerspectiveDslPackage.Literals.PERSPECTIVE_GRID__REF,
PerspectiveDslPackage.Literals.PERSPECTIVE_GRID__REF_TYPE_JVM,
new IJvmLinkCrossRefStringEnhancer() {
@Override
public String enhance(EObject context,
EStructuralFeature feature, String crossRefString) {
return crossRefString + "Grid";
}
}, null);
register(PerspectiveDslPackage.Literals.PERSPECTIVE_CHART__REF,
PerspectiveDslPackage.Literals.PERSPECTIVE_CHART__REF_TYPE_JVM,
new IJvmLinkCrossRefStringEnhancer() {
@Override
public String enhance(EObject context,
EStructuralFeature feature, String crossRefString) {
return crossRefString + "Chart";
}
}, null);
register(
PerspectiveDslPackage.Literals.PERSPECTIVE_REPORT__REF,
PerspectiveDslPackage.Literals.PERSPECTIVE_REPORT__REF_TYPE_JVM,
new IJvmLinkCrossRefStringEnhancer() {
@Override
public String enhance(EObject context,
EStructuralFeature feature, String crossRefString) {
return crossRefString + "Report";
}
}, null);
register(
PerspectiveDslPackage.Literals.PERSPECTIVE_TOPOLOGY__REF,
PerspectiveDslPackage.Literals.PERSPECTIVE_TOPOLOGY__REF_TYPE_JVM,
new IJvmLinkCrossRefStringEnhancer() {
@Override
public String enhance(EObject context,
EStructuralFeature feature, String crossRefString) {
return crossRefString + "Topology";
}
}, null);
register(
PerspectiveDslPackage.Literals.PERSPECTIVE_DIALOG__REF,
PerspectiveDslPackage.Literals.PERSPECTIVE_DIALOG__REF_TYPE_JVM,
new IJvmLinkCrossRefStringEnhancer() {
@Override
public String enhance(EObject context,
EStructuralFeature feature, String crossRefString) {
return crossRefString + "Dialog";
}
}, null);
register(PerspectiveDslPackage.Literals.PERSPECTIVE__TOOLBAR,
PerspectiveDslPackage.Literals.PERSPECTIVE__TOOLBAR_TYPE_JVM,
new IJvmLinkCrossRefStringEnhancer() {
@Override
public String enhance(EObject context,
EStructuralFeature feature, String crossRefString) {
return crossRefString + "Toolbar";
}
}, null);
register(
PerspectiveDslPackage.Literals.PERSPECTIVE_DATA_INTERCHANGE__REF,
PerspectiveDslPackage.Literals.PERSPECTIVE_DATA_INTERCHANGE__REF_TYPE_JVM,
new IJvmLinkCrossRefStringEnhancer() {
@Override
public String enhance(EObject context,
EStructuralFeature feature, String crossRefString) {
// as the class is created by the package, we supply extra segment so the package calculation can discard the last segment
return crossRefString + "." + StringExtensions.toFirstUpper(crossRefString) + "TriggerView";
}
}, null);
}
}