public String getJavaStubSource(IEObjectDescription description) {
    if (!isJvmDeclaredType(description)) {
      return null;
    }
    QualifiedName qualifiedName = description.getQualifiedName();

    StringBuilder classSignatureBuilder = new StringBuilder();
    if (qualifiedName.getSegments().size() > 1) {
      String string = qualifiedName.toString();
      classSignatureBuilder.append("package " + string.substring(0, string.lastIndexOf('.')) + ";");
      classSignatureBuilder.append("\n");
    }
    classSignatureBuilder.append("public ");
    if (description.getEClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) {
      if (description.getUserData(JvmTypesResourceDescriptionStrategy.IS_INTERFACE) != null) {
        classSignatureBuilder.append("interface ");
      } else {
        classSignatureBuilder.append("class ");
      }
    } else if (description.getEClass() == TypesPackage.Literals.JVM_ENUMERATION_TYPE) {
      classSignatureBuilder.append("enum ");
    } else if (description.getEClass() == TypesPackage.Literals.JVM_ANNOTATION_TYPE) {
      classSignatureBuilder.append("@interface ");
    }
    classSignatureBuilder.append(qualifiedName.getLastSegment());
    String typeParameters =
        description.getUserData(JvmTypesResourceDescriptionStrategy.TYPE_PARAMETERS);
    if (typeParameters != null) {
      classSignatureBuilder.append(typeParameters);
    }
    classSignatureBuilder.append("{}");
    return classSignatureBuilder.toString();
  }
 public boolean isConformant(final SJClass c1, final SJClass c2) {
   boolean _or = false;
   boolean _or_1 = false;
   boolean _or_2 = false;
   boolean _or_3 = false;
   boolean _equals = Objects.equal(c1, SmallJavaTypeProvider.nullType);
   if (_equals) {
     _or_3 = true;
   } else {
     boolean _conformToLibraryTypes = this.conformToLibraryTypes(c1, c2);
     _or_3 = _conformToLibraryTypes;
   }
   if (_or_3) {
     _or_2 = true;
   } else {
     boolean _equals_1 = Objects.equal(c1, c2);
     _or_2 = _equals_1;
   }
   if (_or_2) {
     _or_1 = true;
   } else {
     QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(c2);
     String _string = _fullyQualifiedName.toString();
     boolean _equals_2 = Objects.equal(_string, SmallJavaLib.LIB_OBJECT);
     _or_1 = _equals_2;
   }
   if (_or_1) {
     _or = true;
   } else {
     boolean _isSubclassOf = this.isSubclassOf(c1, c2);
     _or = _isSubclassOf;
   }
   return _or;
 }
 public String nameOf(final String operationName) {
   String _xblockexpression = null;
   {
     final JvmOperation op = this.operations.get(operationName);
     QualifiedName _apply = this.subject.apply(op);
     String _string = _apply.toString();
     _xblockexpression = (_string);
   }
   return _xblockexpression;
 }
 protected QualifiedName resolveWildcard(QualifiedName relativeName) {
   int segmentCount = relativeName.getSegmentCount();
   if (segmentCount == 1) {
     return getImportedNamespacePrefix().append(relativeName);
   }
   for (int i = 0; i < segmentCount; i++) {
     if (relativeName.getSegment(i).indexOf('$') != -1) {
       return null;
     }
   }
   return getImportedNamespacePrefix().append(relativeName.toString("$"));
 }
 public boolean conformsToString(final SJClass c) {
   boolean _or = false;
   boolean _equals = Objects.equal(c, SmallJavaTypeProvider.stringType);
   if (_equals) {
     _or = true;
   } else {
     QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(c);
     String _string = _fullyQualifiedName.toString();
     boolean _equals_1 = Objects.equal(_string, SmallJavaLib.LIB_STRING);
     _or = _equals_1;
   }
   return _or;
 }
Example #6
0
 private ICommand createSubmachineStateCommand(ConfigureRequest req) {
   SelectSubmachineDialog dialog =
       new SelectSubmachineDialog(new Shell(), req.getElementToConfigure().eResource());
   dialog.setElements(new Object[] {req.getElementToConfigure()});
   if (Dialog.OK == dialog.open()) {
     QualifiedName selectedSubmachine = dialog.getSelectedSubmachine();
     if (selectedSubmachine != null) {
       return new SetValueCommand(
           new SetRequest(
               req.getElementToConfigure(),
               SGraphPackage.Literals.STATE__SUBSTATECHART_ID,
               selectedSubmachine.toString()));
     }
   }
   return null;
 }
 protected Object _addToScope(final EventDefinition event) {
   Object _xblockexpression = null;
   {
     QualifiedName _qualifiedName = this.provider.qualifiedName(event);
     String _string = _qualifiedName.toString();
     String fqName = _string;
     Type _type = event.getType();
     boolean _isBoolean = this.isBoolean(_type);
     if (_isBoolean) {
       ExecutionEvent _executionEvent = new ExecutionEvent(fqName, java.lang.Boolean.class, null);
       this.executionContext.declareEvent(_executionEvent);
     } else {
       Type _type_1 = event.getType();
       boolean _isInteger = this.isInteger(_type_1);
       if (_isInteger) {
         ExecutionEvent _executionEvent_1 =
             new ExecutionEvent(fqName, java.lang.Integer.class, null);
         this.executionContext.declareEvent(_executionEvent_1);
       } else {
         Type _type_2 = event.getType();
         boolean _isReal = this.isReal(_type_2);
         if (_isReal) {
           ExecutionEvent _executionEvent_2 =
               new ExecutionEvent(fqName, java.lang.Float.class, null);
           this.executionContext.declareEvent(_executionEvent_2);
         } else {
           Type _type_3 = event.getType();
           boolean _isVoid = this.isVoid(_type_3);
           if (_isVoid) {
             ExecutionEvent _executionEvent_3 = new ExecutionEvent(fqName, java.lang.Void.class);
             this.executionContext.declareEvent(_executionEvent_3);
           } else {
             Type _type_4 = event.getType();
             boolean _isString = this.isString(_type_4);
             if (_isString) {
               ExecutionEvent _executionEvent_4 =
                   new ExecutionEvent(fqName, java.lang.String.class, "");
               this.executionContext.declareEvent(_executionEvent_4);
             }
           }
         }
       }
     }
     _xblockexpression = (null);
   }
   return _xblockexpression;
 }
 protected Object _addToScope(final VariableDefinition variable) throws NumberFormatException {
   Object _xblockexpression = null;
   {
     QualifiedName _qualifiedName = this.provider.qualifiedName(variable);
     String _string = _qualifiedName.toString();
     String fqName = _string;
     Type _type = variable.getType();
     boolean _isBoolean = this.isBoolean(_type);
     if (_isBoolean) {
       ExecutionVariable _executionVariable =
           new ExecutionVariable(fqName, java.lang.Boolean.class, ((Boolean) false));
       this.executionContext.declareVariable(_executionVariable);
     } else {
       Type _type_1 = variable.getType();
       boolean _isInteger = this.isInteger(_type_1);
       if (_isInteger) {
         ExecutionVariable _executionVariable_1 =
             new ExecutionVariable(fqName, java.lang.Integer.class, ((Integer) 0));
         this.executionContext.declareVariable(_executionVariable_1);
       } else {
         Type _type_2 = variable.getType();
         boolean _isReal = this.isReal(_type_2);
         if (_isReal) {
           float _parseFloat = Float.parseFloat("0.0");
           ExecutionVariable _executionVariable_2 =
               new ExecutionVariable(fqName, java.lang.Float.class, ((Float) _parseFloat));
           this.executionContext.declareVariable(_executionVariable_2);
         } else {
           Type _type_3 = variable.getType();
           boolean _isString = this.isString(_type_3);
           if (_isString) {
             ExecutionVariable _executionVariable_3 =
                 new ExecutionVariable(fqName, java.lang.String.class, "");
             this.executionContext.declareVariable(_executionVariable_3);
           }
         }
       }
     }
     _xblockexpression = (null);
   }
   return _xblockexpression;
 }
 public String qualifiedName() {
   ExampleGroup _firstSpec = this._modelStore.firstSpec();
   QualifiedName _fullyQualifiedName = this.subject.getFullyQualifiedName(_firstSpec);
   String _string = _fullyQualifiedName == null ? (String) null : _fullyQualifiedName.toString();
   return _string;
 }