// TODO split this into smaller methods, investigate override / overload semantics // This assumes that the model was linked properly and not changed in an incompatible way // which is quite hard anyway ... public IScope createFeatureCallSerializationScope(EObject context) { if (!(context instanceof XAbstractFeatureCall)) { return IScope.NULLSCOPE; } XAbstractFeatureCall call = (XAbstractFeatureCall) context; JvmIdentifiableElement feature = call.getFeature(); // this and super - logical container aware FeatureScopes if (feature instanceof JvmType) { return getTypeScope(call, (JvmType) feature); } if (feature instanceof JvmConstructor) { return getThisOrSuperScope(call, (JvmConstructor) feature); } if (feature instanceof JvmExecutable) { return getExecutableScope(call, feature); } if (feature instanceof JvmFormalParameter || feature instanceof JvmField || feature instanceof XVariableDeclaration || feature instanceof XSwitchExpression) { return new SingletonScope( EObjectDescription.create(feature.getSimpleName(), feature), IScope.NULLSCOPE); } return IScope.NULLSCOPE; }
protected void computeFeatureCallHighlighting( XAbstractFeatureCall featureCall, IHighlightedPositionAcceptor acceptor) { JvmIdentifiableElement feature = featureCall.getFeature(); if (feature != null && !feature.eIsProxy()) { if (feature instanceof JvmField) { if (((JvmField) feature).isStatic()) { highlightFeatureCall(featureCall, acceptor, STATIC_FIELD); } else { highlightFeatureCall(featureCall, acceptor, FIELD); } } else if (feature instanceof JvmOperation && !featureCall.isOperation()) { JvmOperation jvmOperation = (JvmOperation) feature; if (jvmOperation.isStatic()) highlightFeatureCall(featureCall, acceptor, STATIC_METHOD_INVOCATION); } if (!(featureCall instanceof XBinaryOperation || featureCall instanceof XUnaryOperation || featureCall instanceof XPostfixOperation)) { if (featureCall.isExtension()) { highlightFeatureCall(featureCall, acceptor, EXTENSION_METHOD_INVOCATION); } else { // Extensions without implicit first argument XExpression implicitReceiver = featureCall.getImplicitReceiver(); if (implicitReceiver != null && implicitReceiver instanceof XAbstractFeatureCall) { if (isExtension(((XAbstractFeatureCall) implicitReceiver).getFeature())) highlightFeatureCall(featureCall, acceptor, EXTENSION_METHOD_INVOCATION); } } } if (feature instanceof JvmAnnotationTarget && DeprecationUtil.isDeprecated((JvmAnnotationTarget) feature)) { highlightFeatureCall(featureCall, acceptor, DEPRECATED_MEMBERS); } } }
public void assertIdentifiableTypeIsResolved( final JvmIdentifiableElement identifiable, final IResolvedTypes types) { final LightweightTypeReference type = types.getActualType(identifiable); String _string = identifiable.toString(); Assert.assertNotNull(_string, type); String _string_1 = identifiable.toString(); String _plus = (_string_1 + " / "); String _plus_1 = (_plus + type); String _identifier = type.getIdentifier(); Assert.assertNotNull(_plus_1, _identifier); }
protected IScope getExecutableScope(XAbstractFeatureCall call, JvmIdentifiableElement feature) { QualifiedName name = QualifiedName.create(feature.getSimpleName()); if (call.isOperation()) { QualifiedName operator = getOperator(call, name); if (operator == null) { return IScope.NULLSCOPE; } return new SingletonScope(EObjectDescription.create(operator, feature), IScope.NULLSCOPE); } if (call instanceof XAssignment) { String propertyName = Strings.toFirstLower(feature.getSimpleName().substring(3)); return new SingletonScope(EObjectDescription.create(propertyName, feature), IScope.NULLSCOPE); } if (call.isExplicitOperationCallOrBuilderSyntax() || ((JvmExecutable) feature).getParameters().size() > 1 || (!call.isExtension() && ((JvmExecutable) feature).getParameters().size() == 1)) { return new SingletonScope(EObjectDescription.create(name, feature), IScope.NULLSCOPE); } if (feature.getSimpleName().startsWith("get") || feature.getSimpleName().startsWith("is")) { List<IEObjectDescription> result = Lists.newArrayListWithCapacity(2); result.add(EObjectDescription.create(name, feature)); if (feature.getSimpleName().startsWith("get")) { String propertyName = Strings.toFirstLower(feature.getSimpleName().substring(3)); result.add(EObjectDescription.create(propertyName, feature)); } else { String propertyName = Strings.toFirstLower(feature.getSimpleName().substring(2)); result.add(EObjectDescription.create(propertyName, feature)); } return new SimpleScope(result); } return new SingletonScope(EObjectDescription.create(name, feature), IScope.NULLSCOPE); }
public String check(IEObjectDescription input) { if (input instanceof IValidatedEObjectDescription) { final IValidatedEObjectDescription validatedDescription = (IValidatedEObjectDescription) input; JvmIdentifiableElement identifiable = validatedDescription.getEObjectOrProxy(); if (identifiable.eIsProxy()) identifiable = (JvmIdentifiableElement) EcoreUtil.resolve(identifiable, context); String issueCode; if (identifiable.eIsProxy()) issueCode = UNRESOLVABLE_PROXY; else if (!validatedDescription.isValid()) { if (Strings.isEmpty(validatedDescription.getIssueCode())) issueCode = FEATURE_NOT_VISIBLE; else return validatedDescription.getIssueCode(); } else issueCode = dispatcher.invoke(identifiable, context, reference, validatedDescription); validatedDescription.setIssueCode(issueCode); return issueCode; } return null; }
protected IScope createTypeScope( JvmIdentifiableElement context, EReference reference, IScope parentScope) { if (context == null) return parentScope; if (context.eContainer() instanceof JvmIdentifiableElement) { parentScope = createTypeScope((JvmIdentifiableElement) context.eContainer(), reference, parentScope); } if (context instanceof JvmGenericType) { JvmGenericType genericType = (JvmGenericType) context; List<IEObjectDescription> descriptions = Lists.newArrayList(); if (genericType.getSimpleName() != null) { QualifiedName inferredDeclaringTypeName = QualifiedName.create(genericType.getSimpleName()); descriptions.add(EObjectDescription.create(inferredDeclaringTypeName, genericType)); } for (JvmTypeParameter param : genericType.getTypeParameters()) { if (param.getSimpleName() != null) { QualifiedName paramName = QualifiedName.create(param.getSimpleName()); descriptions.add(EObjectDescription.create(paramName, param)); } } if (!descriptions.isEmpty()) return MapBasedScope.createScope(parentScope, descriptions); } else if (context instanceof JvmOperation) { JvmOperation operation = (JvmOperation) context; List<IEObjectDescription> descriptions = null; for (JvmTypeParameter param : operation.getTypeParameters()) { if (param.getSimpleName() != null) { if (descriptions == null) descriptions = Lists.newArrayList(); QualifiedName paramName = QualifiedName.create(param.getSimpleName()); descriptions.add(EObjectDescription.create(paramName, param)); } } if (descriptions != null && !descriptions.isEmpty()) return MapBasedScope.createScope(parentScope, descriptions); } return parentScope; }
public String gitLink(final JvmIdentifiableElement ie) { String _xblockexpression = null; { String _switchResult = null; String _qualifiedName = ie.getQualifiedName(); final String name = _qualifiedName; boolean _matched = false; if (!_matched) { if (Objects.equal(name, null)) { _matched = true; return ("broken-link in " + ie); } } if (!_matched) { boolean _startsWith = name.startsWith("org.eclipse.xtext.common.types.xtext.ui"); if (_startsWith) { _matched = true; String _plus = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.common.types.ui/src/"); _switchResult = _plus; } } if (!_matched) { boolean _and = false; boolean _startsWith_1 = name.startsWith("org.eclipse.xtext.common.types."); if (!_startsWith_1) { _and = false; } else { String _simpleName = ie.getSimpleName(); boolean _contains = GitExtensions.JVM_EMF_CLASSES.contains(_simpleName); _and = (_startsWith_1 && _contains); } if (_and) { _matched = true; String _plus_1 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.common.types/emf-gen/"); _switchResult = _plus_1; } } if (!_matched) { boolean _startsWith_2 = name.startsWith("org.eclipse.xtext.common.types."); if (_startsWith_2) { _matched = true; String _plus_2 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.common.types/src/"); _switchResult = _plus_2; } } if (!_matched) { boolean _startsWith_3 = name.startsWith("org.eclipse.xtext.ui.shared."); if (_startsWith_3) { _matched = true; String _plus_3 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.ui.shared/src/"); _switchResult = _plus_3; } } if (!_matched) { boolean _startsWith_4 = name.startsWith("org.eclipse.xtext.xtend2.lib."); if (_startsWith_4) { _matched = true; String _plus_4 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.xtend2.lib/src/"); _switchResult = _plus_4; } } if (!_matched) { boolean _startsWith_5 = name.startsWith("org.eclipse.xtext.xtend2.ui."); if (_startsWith_5) { _matched = true; String _plus_5 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.xtend2.ui/src/"); _switchResult = _plus_5; } } if (!_matched) { boolean _startsWith_6 = name.startsWith("org.eclipse.xtext.xtend2."); if (_startsWith_6) { _matched = true; String _plus_6 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.xtend2/src/"); _switchResult = _plus_6; } } if (!_matched) { boolean _startsWith_7 = name.startsWith("org.eclipse.xtext.xbase.ui."); if (_startsWith_7) { _matched = true; String _plus_7 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.xbase.ui/src/"); _switchResult = _plus_7; } } if (!_matched) { boolean _startsWith_8 = name.startsWith("org.eclipse.xtext.xbase.lib."); if (_startsWith_8) { _matched = true; String _plus_8 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.xbase.lib/src/"); _switchResult = _plus_8; } } if (!_matched) { boolean _and_1 = false; boolean _startsWith_9 = name.startsWith("org.eclipse.xtext.xbase."); if (!_startsWith_9) { _and_1 = false; } else { String _simpleName_1 = ie.getSimpleName(); boolean _contains_1 = GitExtensions.XBASE_EMF_CLASSES.contains(_simpleName_1); _and_1 = (_startsWith_9 && _contains_1); } if (_and_1) { _matched = true; String _plus_9 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.xbase/emf-gen/"); _switchResult = _plus_9; } } if (!_matched) { boolean _startsWith_10 = name.startsWith("org.eclipse.xtext.xbase."); if (_startsWith_10) { _matched = true; String _plus_10 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.xbase/src/"); _switchResult = _plus_10; } } if (!_matched) { boolean _and_2 = false; boolean _or = false; boolean _startsWith_11 = name.startsWith("org.eclipse.xtext.generator."); if (_startsWith_11) { _or = true; } else { boolean _startsWith_12 = name.startsWith("org.eclipse.xtext.ui.generator."); _or = (_startsWith_11 || _startsWith_12); } if (!_or) { _and_2 = false; } else { String _simpleName_2 = ie.getSimpleName(); boolean _notEquals = (!Objects.equal("IGenerator", _simpleName_2)); _and_2 = (_or && _notEquals); } if (_and_2) { _matched = true; String _plus_11 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.generator/src/"); _switchResult = _plus_11; } } if (!_matched) { boolean _startsWith_13 = name.startsWith("org.eclipse.xtext.ui."); if (_startsWith_13) { _matched = true; String _plus_12 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.ui/src/"); _switchResult = _plus_12; } } if (!_matched) { boolean _startsWith_14 = name.startsWith("org.eclipse.xtext.junit4."); if (_startsWith_14) { _matched = true; String _plus_13 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.junit4/src/"); _switchResult = _plus_13; } } if (!_matched) { boolean _startsWith_15 = name.startsWith("org.eclipse.xtext.junit."); if (_startsWith_15) { _matched = true; String _plus_14 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.junit/src/"); _switchResult = _plus_14; } } if (!_matched) { boolean _startsWith_16 = name.startsWith("org.eclipse.xtext.ui."); if (_startsWith_16) { _matched = true; String _plus_15 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.ui/src/"); _switchResult = _plus_15; } } if (!_matched) { boolean _startsWith_17 = name.startsWith("org.eclipse.xtext.util."); if (_startsWith_17) { _matched = true; String _plus_16 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.util/src/"); _switchResult = _plus_16; } } if (!_matched) { boolean _and_3 = false; boolean _startsWith_18 = name.startsWith("org.eclipse.xtext."); if (!_startsWith_18) { _and_3 = false; } else { String _simpleName_3 = ie.getSimpleName(); boolean _contains_2 = GitExtensions.XTEXT_EMF_CLASSES.contains(_simpleName_3); _and_3 = (_startsWith_18 && _contains_2); } if (_and_3) { _matched = true; String _plus_17 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext/emf-gen/"); _switchResult = _plus_17; } } if (!_matched) { boolean _startsWith_19 = name.startsWith("org.eclipse.xtext."); if (_startsWith_19) { _matched = true; String _plus_18 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext/src/"); _switchResult = _plus_18; } } if (!_matched) { boolean _startsWith_20 = name.startsWith("org.eclipse.emf.mwe.utils."); if (_startsWith_20) { _matched = true; String _plus_19 = (GitExtensions.MWE_BASE_DIR + "org.eclipse.emf.mwe.utils/src/"); _switchResult = _plus_19; } } if (!_matched) { boolean _startsWith_21 = name.startsWith("org.eclipse.emf.mwe2.runtime."); if (_startsWith_21) { _matched = true; String _plus_20 = (GitExtensions.MWE_BASE_DIR + "org.eclipse.emf.mwe2.runtime/src/"); _switchResult = _plus_20; } } if (!_matched) { boolean _startsWith_22 = name.startsWith("org.eclipse.emf.mwe2.launch."); if (_startsWith_22) { _matched = true; String _plus_21 = (GitExtensions.MWE_BASE_DIR + "org.eclipse.emf.mwe2.launch/src/"); _switchResult = _plus_21; } } if (!_matched) { boolean _startsWith_23 = name.startsWith("org.eclipse.emf.common."); if (_startsWith_23) { _matched = true; String _plus_22 = (GitExtensions.EMF_BASE_DIR + "org.eclipse.emf.common/src/"); _switchResult = _plus_22; } } if (!_matched) { boolean _startsWith_24 = name.startsWith("org.eclipse.emf."); if (_startsWith_24) { _matched = true; String _plus_23 = (GitExtensions.EMF_BASE_DIR + "org.eclipse.emf.ecore/src/"); _switchResult = _plus_23; } } if (!_matched) { boolean _or_1 = false; boolean _startsWith_25 = name.startsWith("org.eclipse.xtext.xbase.lib."); if (_startsWith_25) { _or_1 = true; } else { boolean _startsWith_26 = name.startsWith("org.eclipse.xtend2.lib."); _or_1 = (_startsWith_25 || _startsWith_26); } if (_or_1) { _matched = true; String _plus_24 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.xbase.lib/src/"); _switchResult = _plus_24; } } if (!_matched) { boolean _startsWith_27 = name.startsWith("org.eclipse.xtext.xbase.ui."); if (_startsWith_27) { _matched = true; String _plus_25 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.xbase.ui/src/"); _switchResult = _plus_25; } } if (!_matched) { boolean _startsWith_28 = name.startsWith("org.eclipse.xtext.xbase."); if (_startsWith_28) { _matched = true; String _plus_26 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtext.xbase/src/"); _switchResult = _plus_26; } } if (!_matched) { boolean _startsWith_29 = name.startsWith("org.eclipse.xtend.lib."); if (_startsWith_29) { _matched = true; String _plus_27 = (GitExtensions.XTEXT_BASE_DIR + "org.eclipse.xtend.lib/src/"); _switchResult = _plus_27; } } if (!_matched) { boolean _startsWith_30 = name.startsWith("org.eclipse.xtend.ui."); if (_startsWith_30) { _matched = true; String _plus_28 = (GitExtensions.XTEND_BASE_DIR + "org.eclipse.xtend.ui/src/"); _switchResult = _plus_28; } } if (!_matched) { boolean _startsWith_31 = name.startsWith("org.eclipse.xtend.core."); if (_startsWith_31) { _matched = true; String _plus_29 = (GitExtensions.XTEND_BASE_DIR + "org.eclipse.xtend.core/src/"); _switchResult = _plus_29; } } if (!_matched) { boolean _startsWith_32 = name.startsWith("org.xtext."); if (_startsWith_32) { _matched = true; String _xblockexpression_1 = null; { String[] _split = name.split("\\."); final String languageID = _split[2]; String[] _split_1 = name.split("\\."); final String pluginSuffix = _split_1[3]; String _xifexpression = null; boolean _equals = Objects.equal(pluginSuffix, "examples"); if (_equals) { _xifexpression = "examples"; } else { _xifexpression = "languages"; } final String subdir = _xifexpression; StringConcatenation _builder = new StringConcatenation(); _builder.append(GitExtensions.SEVENLANGUAGES_BASEDIR, ""); _builder.append(subdir, ""); _builder.append("/org.xtext."); _builder.append(languageID, ""); { boolean _contains_3 = GitExtensions.SEVEN_LANGUAGE_PLUGIN_SUFFIXES.contains(pluginSuffix); if (_contains_3) { _builder.append("."); _builder.append(pluginSuffix, ""); } } _builder.append("/src/"); _xblockexpression_1 = (_builder.toString()); } _switchResult = _xblockexpression_1; } } if (!_matched) { _switchResult = ""; } final String prefix = _switchResult; String _xifexpression = null; int _length = prefix.length(); boolean _notEquals_1 = (_length != 0); if (_notEquals_1) { String _switchResult_1 = null; Resource _eResource = null; if (ie != null) { _eResource = ie.eResource(); } URI _uRI = null; if (_eResource != null) { _uRI = _eResource.getURI(); } final URI uri = _uRI; boolean _matched_1 = false; if (!_matched_1) { String _scheme = uri.scheme(); boolean _equals = Objects.equal(_scheme, "java"); if (_equals) { _matched_1 = true; String _qualifiedName_1 = ie.getQualifiedName(); String _replaceAll = _qualifiedName_1.replaceAll("\\.", "/"); String _replaceAll_1 = _replaceAll.replaceAll("\\$.*$", ""); String _plus_30 = (prefix + _replaceAll_1); String _plus_31 = (_plus_30 + "."); String _plus_32 = (_plus_31 + "java"); _switchResult_1 = _plus_32; } } if (!_matched_1) { String _packageName = ((JvmDeclaredType) ie).getPackageName(); String _replaceAll_2 = _packageName.replaceAll("\\.", "/"); String _plus_33 = (prefix + _replaceAll_2); String _plus_34 = (_plus_33 + "/"); String _lastSegment = uri.lastSegment(); String _plus_35 = (_plus_34 + _lastSegment); _switchResult_1 = _plus_35; } _xifexpression = _switchResult_1; } else { _xifexpression = null; } _xblockexpression = (_xifexpression); } return _xblockexpression; }
protected String getVarName(JvmIdentifiableElement ex) { return ex.getSimpleName(); }
public String genJavaDocLink(final JvmIdentifiableElement ie) { String _xblockexpression = null; { String _qualifiedName = ie.getQualifiedName(); boolean _operator_equals = ObjectExtensions.operator_equals(_qualifiedName, null); if (_operator_equals) { return null; } String _qualifiedName_1 = ie.getQualifiedName(); String _replaceAll = _qualifiedName_1.replaceAll("\\.", "/"); String _replaceAll_1 = _replaceAll.replaceAll("\\$", "."); final String file = _replaceAll_1; String _switchResult = null; String _qualifiedName_2 = ie.getQualifiedName(); final String name = _qualifiedName_2; boolean matched = false; if (!matched) { boolean _startsWith = name.startsWith("org.eclipse.emf.mwe"); if (_startsWith) { matched = true; _switchResult = ""; } } if (!matched) { boolean _startsWith_1 = name.startsWith("org.eclipse.xtext."); if (_startsWith_1) { matched = true; _switchResult = "http://download.eclipse.org/modeling/tmf/xtext/javadoc/2.2.0/"; } } if (!matched) { boolean _startsWith_2 = name.startsWith("org.eclipse.emf."); if (_startsWith_2) { matched = true; _switchResult = "http://download.eclipse.org/modeling/emf/emf/javadoc/2.6.0/"; } } if (!matched) { boolean _startsWith_3 = name.startsWith("com.google.inject."); if (_startsWith_3) { matched = true; _switchResult = "http://google-guice.googlecode.com/svn/trunk/javadoc/"; } } if (!matched) { boolean _startsWith_4 = name.startsWith("org.eclipse.jdt."); if (_startsWith_4) { matched = true; _switchResult = "http://help.eclipse.org/helios/topic/org.eclipse.jdt.doc.isv/reference/api/"; } } if (!matched) { boolean _startsWith_5 = name.startsWith("java."); if (_startsWith_5) { matched = true; _switchResult = "http://download.oracle.com/javase/1.5.0/docs/api/"; } } if (!matched) { boolean _startsWith_6 = name.startsWith("org.eclipse."); if (_startsWith_6) { matched = true; _switchResult = "http://help.eclipse.org/helios/topic/org.eclipse.platform.doc.isv/reference/api/"; } } if (!matched) { _switchResult = ""; } final String prefix = _switchResult; String _xifexpression = null; boolean _operator_notEquals = ObjectExtensions.operator_notEquals(prefix, ""); if (_operator_notEquals) { String _operator_plus = StringExtensions.operator_plus(prefix, file); String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, ".html"); _xifexpression = _operator_plus_1; } else { _xifexpression = null; } _xblockexpression = (_xifexpression); } return _xblockexpression; }