Пример #1
0
  public static org.lgna.project.ast.NamedUserType getNamedUserTypeFromSuperType(
      org.lgna.project.ast.JavaType superType) {
    // <lg> Added to support generality in reuse
    if (superType.isAssignableTo(org.lgna.story.SScene.class)) {
      return getSceneUserType();
    }
    // </lg>

    org.lgna.project.ast.AbstractType<?, ?, ?> parameter0Type =
        ConstructorArgumentUtilities.getContructor0Parameter0Type(superType);
    ExtendsTypeCriterion criterion;
    if (parameter0Type != null) {
      criterion =
          new ExtendsTypeWithConstructorParameterTypeCriterion(
              superType, ConstructorArgumentUtilities.getContructor0Parameter0Type(superType));
    } else {
      criterion = new DefaultConstructorExtendsTypeCriterion(superType);
    }
    org.alice.ide.IDE ide = org.alice.ide.IDE.getActiveInstance();
    if (ide != null) {
      org.lgna.project.Project project = ide.getProject();
      if (project != null) {
        java.util.Set<org.lgna.project.ast.NamedUserType> existingTypes =
            project.getNamedUserTypes();
        for (org.lgna.project.ast.NamedUserType existingType : existingTypes) {
          if (criterion.accept(existingType)) {
            return existingType;
          }
        }
      }
    }
    return createTypeFor(superType, createClassNameFromSuperType(superType), null, null);
  }
 public FillInExpressionListPropertyEdit(
     edu.cmu.cs.dennisc.codec.BinaryDecoder binaryDecoder, Object step) {
   super(binaryDecoder, step);
   org.alice.ide.IDE ide = org.alice.ide.IDE.getActiveInstance();
   org.lgna.project.Project project = ide.getProject();
   java.util.UUID prevExpressionId = binaryDecoder.decodeId();
   this.prevExpression =
       org.lgna.project.ProgramTypeUtilities.lookupNode(project, prevExpressionId);
   java.util.UUID nextExpressionId = binaryDecoder.decodeId();
   this.nextExpression =
       org.lgna.project.ProgramTypeUtilities.lookupNode(project, nextExpressionId);
 }
Пример #3
0
 public static org.lgna.project.ast.NamedUserType getSceneUserType() {
   if (sceneUserTypeStack.isEmpty()) {
     // note: currently necessary for scene editor set up
     org.alice.ide.IDE ide = org.alice.ide.IDE.getActiveInstance();
     if (ide != null) {
       org.lgna.project.Project project = ide.getProject();
       if (project != null) {
         for (org.lgna.project.ast.UserField field :
             project.getProgramType().getDeclaredFields()) {
           if (field.valueType.getValue().isAssignableTo(org.lgna.story.SScene.class)) {
             return (org.lgna.project.ast.NamedUserType) field.valueType.getValue();
           }
         }
       }
     }
     return null;
   } else {
     return sceneUserTypeStack.peek();
   }
 }