示例#1
0
 @Override
 public boolean contains(SNode node) {
   if (!(SNodeOperations.isInstanceOf(node, "jetbrains.mps.lang.core.structure.INamedConcept"))
       || !(node.isInstanceOfConcept(kindConceptFqName))) {
     return false;
   }
   if (scope.contains(node)) {
     return true;
   }
   if (SetSequence.fromSet(names).contains(node.getName())) {
     return false;
   }
   return parentScope.contains(node);
 }
示例#2
0
 public boolean canExecute(final KeyEvent keyEvent, final EditorContext editorContext) {
   EditorCell contextCell = editorContext.getContextCell();
   if ((contextCell == null)) {
     return false;
   }
   SNode contextNode = contextCell.getSNode();
   if (contextNode == null) {
     return false;
   }
   if (contextNode.isInstanceOfConcept("jetbrains.mps.build.packaging.structure.Module")) {
     return true;
   }
   return false;
 }
示例#3
0
 public boolean canExecute(final KeyEvent keyEvent, final EditorContext editorContext) {
   EditorCell contextCell = editorContext.getContextCell();
   if ((contextCell == null)) {
     return false;
   }
   SNode contextNode = contextCell.getSNode();
   if (contextNode == null) {
     return false;
   }
   if (contextNode.isInstanceOfConcept("jetbrains.mps.lang.quotation.structure.Quotation")) {
     return this.canExecute_internal(
         keyEvent, editorContext, contextNode, this.getSelectedNodes(editorContext));
   }
   return false;
 }
 public boolean canExecute(final KeyEvent keyEvent, final EditorContext editorContext) {
   EditorCell contextCell = editorContext.getContextCell();
   if ((contextCell == null)) {
     return false;
   }
   SNode contextNode = contextCell.getSNode();
   if (contextNode == null) {
     return false;
   }
   if (contextNode.isInstanceOfConcept(
       "jetbrains.mps.baseLanguage.structure.ParenthesizedExpression")) {
     return true;
   }
   return false;
 }
示例#5
0
 public HidingByNameScope(
     SNode hidingRoot, SNode kind, @NotNull Scope scope, @NotNull Scope parentScope) {
   // hiding root: all subconcepts of hidingRoot hide each other
   this.scope = scope;
   this.parentScope = parentScope;
   this.hidingRootConceptFqName = NameUtil.nodeFQName(hidingRoot);
   this.kindConceptFqName = NameUtil.nodeFQName(kind);
   // todo: maybe lazy in getAvailableElements?
   // todo: I need this micro optimizations?
   Iterable<SNode> tmpResult = scope.getAvailableElements(null);
   this.names = new HashSet<String>(Sequence.fromIterable(tmpResult).count());
   for (SNode node : Sequence.fromIterable(tmpResult)) {
     if (node.isInstanceOfConcept(hidingRootConceptFqName)) {
       SetSequence.fromSet(this.names).addElement(node.getName());
     }
   }
 }