Class JavaSemanticNode

    • Field Detail

      • debugDisablePrettyToString

        public static boolean debugDisablePrettyToString
        When debugging problems in toLanguageString - i.e. generating a language description from a changed model, set this to true to prevent the debugger from generating the thing during it's variable display

        public static final java.lang.String STOP_SEARCHING_SENTINEL
        Return from findMemberInBody when an Object has been found
        See Also:
        Constant Field Values
    • Constructor Detail

      • JavaSemanticNode

        public JavaSemanticNode()
    • Method Detail

      • getJavaModel

        public JavaModel getJavaModel()
      • findMethod

        public java.lang.Object findMethod​(java.lang.String name,
                                           java.util.List<? extends java.lang.Object> parametersOrExpressions,
                                           java.lang.Object fromChild,
                                           java.lang.Object refType,
                                           boolean staticOnly,
                                           java.lang.Object inferredType)
      • definesMethod

        public java.lang.Object definesMethod​(java.lang.String name,
                                              java.util.List<?> parametersOrExpressions,
                                              ITypeParamContext ctx,
                                              java.lang.Object refType,
                                              boolean isTransformed,
                                              boolean staticOnly,
                                              java.lang.Object inferredType,
                                              java.util.List<JavaType> methodTypeArgs)
      • definesConstructor

        public java.lang.Object definesConstructor​(java.util.List<?> parametersOrExpressions,
                                                   ITypeParamContext ctx,
                                                   boolean isTransformed)
      • declaresConstructor

        public java.lang.Object declaresConstructor​(java.util.List<?> parametersOrExpressions,
                                                    ITypeParamContext ctx)
      • findMember

        public java.lang.Object findMember​(java.lang.String name,
                                           java.util.EnumSet<JavaSemanticNode.MemberType> type,
                                           java.lang.Object fromChild,
                                           java.lang.Object refType,
                                           TypeContext ctx,
                                           boolean skipIfaces)
      • findMemberOwner

        public java.lang.Object findMemberOwner​(java.lang.String name,
                                                java.util.EnumSet<JavaSemanticNode.MemberType> type)
      • definesMember

        public java.lang.Object definesMember​(java.lang.String name,
                                              java.util.EnumSet<JavaSemanticNode.MemberType> type,
                                              java.lang.Object refType,
                                              TypeContext ctx,
                                              boolean skipIfaces,
                                              boolean isTransformed)
      • findType

        public java.lang.Object findType​(java.lang.String name)
      • findType

        public java.lang.Object findType​(java.lang.String name,
                                         java.lang.Object refType,
                                         TypeContext context)
      • definesType

        public java.lang.Object definesType​(java.lang.String name,
                                            TypeContext ctx)
      • getEnclosingIType

        public ITypeDeclaration getEnclosingIType()
        Used by the JavaType classes which may be parented by something other than a JavaModel
      • getStructuralEnclosingType

        public BodyTypeDeclaration getStructuralEnclosingType()
        Like the regular getEnclosingType but does not try to initialize an anonymous type from a new expression
      • getEnclosingBlockStatement

        public IBlockStatement getEnclosingBlockStatement()
        Will retrieve the node which holds the list of statements, for searching for variables, etc.
      • getEnclosingStatement

        public Statement getEnclosingStatement()
      • displayTypeError

        public boolean displayTypeError​(java.lang.String... args)
        Used for errors involving type resolution. These errors can be disabled during certain operations like transform
      • getMessageString

        protected java.lang.String getMessageString​(java.lang.String... args)
      • runtimeError

        public void runtimeError​(java.lang.Class<? extends java.lang.RuntimeException> excClass,
                                 java.lang.String... args)
      • displayError

        public void displayError​(java.lang.String... args)
        Used for errors that should always be displayed
      • displayWarning

        public void displayWarning​(java.lang.String... args)
      • displayVerboseWarning

        public void displayVerboseWarning​(java.lang.String... args)
      • displayFormattedError

        public void displayFormattedError​(java.lang.String err)
      • toFileString

        public java.lang.String toFileString()
      • isStatic

        public boolean isStatic()
      • canInsertStatementBefore

        public boolean canInsertStatementBefore​(Expression fromExpr)
      • suggestCompletions

        public int suggestCompletions​(java.lang.String prefix,
                                      java.lang.Object currentType,
                                      ExecutionContext ctx,
                                      java.lang.String command,
                                      int cursor,
                                      java.util.Set<java.lang.String> candidates,
                                      java.lang.Object continuation,
                                      int max)
        Used to create a list of suggestions to complete this node. Returns the character offset into the parse-tree (or command string if there's no parse tree) where the completion should start. Parameters: prefix is the starting sequence of chars in the identifier to complete. All candidates returned will start with the prefix if it's provided. currentType provides a context for the current type if the node is not embedded in a model - i.e. an identifier expression on its own but known to live in a specific type If ctx is not null, it's an execution context we can use to evaluate the "root value" - i.e. in a.b the value of the variable 'a' is evaluated and the returned instance can be used to suggest candidates. This is useful in live-programming situations. The command String parameter is used to determine the offset returned for where the completion starts for the case where the parseNode tree is not available.
      • addNodeCompletions

        public java.lang.String addNodeCompletions​(JavaModel origModel,
                                                   JavaSemanticNode origNode,
                                                   java.lang.String matchPrefix,
                                                   int offset,
                                                   java.lang.String dummyIdentifier,
                                                   java.util.Set<java.lang.String> candidates,
                                                   boolean nextNameInPath,
                                                   int max)
        This works like suggestCompletions but designed to conform to the requirements of IntelliJ. We don't support the live programming use case in this version and have access (possibly) to the original model and original node which most closely approximates this node which is being parsed (so we can use more context to do a better job of matching because those values are all resolved).
      • applyPartialValue

        public boolean applyPartialValue​(java.lang.Object value)
        When Parser.enablePartialValues is set, and we do not complete parsing the input we'll have a set of errors which represent model fragments. In some cases, it would be nice to put the model together as well as possible for code hinting. This method can append fragments onto it... if so return true.
      • visitTypeReferences

        public void visitTypeReferences​(CycleInfo cycle,
                                        TypeContext ctx)
        overridden by nodes to visit values in the reference chain
      • detectCycles

        public void detectCycles()
        Called to kick off the cycle detection for this node
      • isReferenceValueObject

        public boolean isReferenceValueObject()
      • isDynamicType

        public boolean isDynamicType()
      • needsDataBinding

        public boolean needsDataBinding()
      • transformTemplate

        public int transformTemplate​(int ix,
                                     boolean statefulContext)
        A pass over the semantic node tree to convert template statements into layer cake statements.
      • getEnclosingTag

        public Element getEnclosingTag()
      • getRootTag

        public Element getRootTag()
      • getEnclosingTemplate

        public Template getEnclosingTemplate()
      • getExecMode

        public int getExecMode()
        Elements of Template objects (tags) can either run on the client or on the server or both based on this flag. Right now, it's set at the Template level since those are the only types which support mixed client/server mode.
      • toGenerateString

        public java.lang.String toGenerateString()
      • isCollapsibleNode

        public boolean isCollapsibleNode()
        Return true for nodes like simple ClassType expressions "a.b.c" which can collapse into a simpler node type in the IDE.
      • refreshNode

        public JavaSemanticNode refreshNode()
        Needs to be implemented for IDE support on nodes which can be referenced outside of the same file. If the model in which this references lives has been removed (or really replaced by another version of the same model), we need to find the node in the other model that corresponds to this node and return it.
        Specified by:
        refreshNode in interface ISemanticNode
        refreshNode in class SemanticNode
      • getDependencyDisabledText

        public java.lang.String getDependencyDisabledText()
        Description copied from interface: ISemanticNode
        Returns null or the text describing a dependency which is disabled to augment the error - e.g. for when a Layer is disabled and you want to reflect that in the error message you give to the user.
        Specified by:
        getDependencyDisabledText in interface ISemanticNode
        getDependencyDisabledText in class SemanticNode
      • addDependentType

        public static void addDependentType​(java.util.Set<java.lang.Object> types,
                                            java.lang.Object type,
                                            JavaSemanticNode.DepTypeCtx ctx)
      • getImportedTypeName

        public java.lang.String getImportedTypeName​(java.lang.String typeName)