예제 #1
0
 public void execute(final SNode node, final EditorContext editorContext) {
   SNode executor =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.execution.configurations.structure.RunConfigurationExecutor", null);
   SLinkOperations.setTarget(executor, "configuration", node, false);
   SPropertyOperations.set(
       executor, "virtualPackage", SPropertyOperations.getString(node, "virtualPackage"));
   SModelOperations.addRootNode(SNodeOperations.getModel(node), executor);
   NavigationSupport.getInstance()
       .openNode(editorContext.getOperationContext(), executor, true, false);
 }
예제 #2
0
 @Override
 public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) {
   FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.goto.definition");
   final SNode targetNode =
       APICellAdapter.getSNodeWRTReference(
           ((EditorCell) MapSequence.fromMap(_params).get("cell")));
   NavigationSupport.getInstance()
       .openNode(
           ((IOperationContext) MapSequence.fromMap(_params).get("context")),
           targetNode,
           true,
           !(SNodeOperations.isRoot(targetNode)));
 }
 private static void execute_id7oNS25df64x(@NotNull SNode __thisNode__, Project project) {
   SNode targetNode =
       SLinkOperations.getTarget(
           __thisNode__,
           MetaAdapterFactory.getReferenceLink(
               0xde1ad86d6e504a02L,
               0xb306d4d17f64c375L,
               0x36ac6f29ae8c1fb5L,
               0x4904fd89e74fc6fL,
               "target"));
   jetbrains.mps.project.Project mpsProject = ProjectHelper.toMPSProject(project);
   if (mpsProject == null) {
     return;
   }
   NavigationSupport.getInstance()
       .openNode(mpsProject, targetNode, true, !(SNodeOperations.isRoot(targetNode)));
 }
 public void execute(final SNode node, final EditorContext editorContext) {
   List<SNode> configs =
       SModelOperations.getRoots(
           SNodeOperations.getModel(node),
           "jetbrains.mps.lang.generator.structure.MappingConfiguration");
   if (ListSequence.fromList(configs).count() > 1) {
     Iterable<SNode> sameVPackConfigs =
         ListSequence.fromList(configs)
             .where(
                 new IWhereFilter<SNode>() {
                   public boolean accept(SNode it) {
                     return Comparing.equal(
                         SPropertyOperations.getString(it, "virtualPackage"),
                         SPropertyOperations.getString(node, "virtualPackage"));
                   }
                 });
     if (Sequence.fromIterable(sameVPackConfigs).isNotEmpty()) {
       configs = Sequence.fromIterable(sameVPackConfigs).toListSequence();
     }
   }
   if (ListSequence.fromList(configs).count() > 1) {
     // TODO: let user to choose mapping config?
   }
   //  add new rule
   SNode rule =
       SNodeFactoryOperations.addNewChild(
           ListSequence.fromList(configs).first(),
           "rootMappingRule",
           "jetbrains.mps.lang.generator.structure.Root_MappingRule");
   SLinkOperations.setTarget(
       rule,
       "applicableConcept",
       SLinkOperations.getTarget(
           AttributeOperations.getAttribute(
               node,
               new IAttributeDescriptor.NodeAttribute(
                   "jetbrains.mps.lang.generator.structure.RootTemplateAnnotation")),
           "applicableConcept",
           false),
       false);
   SLinkOperations.setTarget(rule, "template", node, false);
   //  open in editor
   NavigationSupport.getInstance()
       .openNode(editorContext.getOperationContext(), rule, true, true);
 }
 public void execute(final SNode node, final EditorContext editorContext) {
   SNode project =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.buildlanguage.structure.Project", null);
   List<String> externalProps =
       ListSequence.fromListAndArray(
           new ArrayList<String>(), "input.dir", "output.dir", "deploy.dir");
   for (String prop : ListSequence.fromList(externalProps)) {
     SNode property =
         SNodeFactoryOperations.createNewNode(
             "jetbrains.mps.buildlanguage.structure.ExternalPropertyDeclaration", null);
     SPropertyOperations.set(property, "name", prop);
     SLinkOperations.setTarget(
         property,
         "type",
         SNodeFactoryOperations.createNewNode(
             "jetbrains.mps.buildlanguage.structure.FileType", null),
         true);
     ListSequence.fromList(SLinkOperations.getTargets(project, "property", true))
         .addElement(property);
   }
   SModel model = editorContext.getModel();
   model.addRoot(project);
   SLinkOperations.setTarget(node, "project", project, false);
   SLinkOperations.setTarget(
       node,
       "targetDeclaration",
       SLinkOperations.getTarget(
           SLinkOperations.getTarget(project, "default", true), "targetDeclaration", false),
       false);
   NavigationSupport.getInstance()
       .openNode(
           editorContext.getOperationContext(),
           project,
           true,
           !(SNodeOperations.isRoot(project)));
 }
예제 #6
0
 public void editNode(final SNode node, final IOperationContext context, final boolean focus) {
   ModelAccess.assertLegalWrite();
   NavigationSupport.getInstance()
       .openNode(context, node, focus, !(node.getModel() != null && node.getModel().isRoot(node)));
 }
예제 #7
0
 @Override
 public void execute(final SNode node, final EditorContext editorContext) {
   List<SNode> configs =
       SModelOperations.roots(
           SNodeOperations.getModel(node),
           MetaAdapterFactory.getConcept(
               0xb401a68083254110L,
               0x8fd384331ff25befL,
               0xff0bea0475L,
               "jetbrains.mps.lang.generator.structure.MappingConfiguration"));
   if (ListSequence.fromList(configs).count() > 1) {
     Iterable<SNode> sameVPackConfigs =
         ListSequence.fromList(configs)
             .where(
                 new IWhereFilter<SNode>() {
                   public boolean accept(SNode it) {
                     return EqualUtil.equals(
                         SPropertyOperations.getString(
                             it,
                             MetaAdapterFactory.getProperty(
                                 0xceab519525ea4f22L,
                                 0x9b92103b95ca8c0cL,
                                 0x10802efe25aL,
                                 0x115eca8579fL,
                                 "virtualPackage")),
                         SPropertyOperations.getString(
                             node,
                             MetaAdapterFactory.getProperty(
                                 0xceab519525ea4f22L,
                                 0x9b92103b95ca8c0cL,
                                 0x10802efe25aL,
                                 0x115eca8579fL,
                                 "virtualPackage")));
                   }
                 });
     if (Sequence.fromIterable(sameVPackConfigs).isNotEmpty()) {
       configs = Sequence.fromIterable(sameVPackConfigs).toListSequence();
     }
   }
   if (ListSequence.fromList(configs).count() > 1) {
     // TODO: let user to choose mapping config?
   }
   //  add new rule
   SNode rule =
       SNodeFactoryOperations.addNewChild(
           ListSequence.fromList(configs).first(),
           MetaAdapterFactory.getContainmentLink(
               0xb401a68083254110L,
               0x8fd384331ff25befL,
               0xff0bea0475L,
               0x10fbbe00519L,
               "createRootRule"),
           SNodeFactoryOperations.asInstanceConcept(
               MetaAdapterFactory.getConcept(
                   0xb401a68083254110L,
                   0x8fd384331ff25befL,
                   0x10fbbd5854aL,
                   "jetbrains.mps.lang.generator.structure.CreateRootRule")));
   SLinkOperations.setTarget(
       rule,
       MetaAdapterFactory.getReferenceLink(
           0xb401a68083254110L,
           0x8fd384331ff25befL,
           0x10fbbd5854aL,
           0x10fbbd5854dL,
           "templateNode"),
       node);
   //  open in editor
   NavigationSupport.getInstance()
       .openNode(editorContext.getOperationContext(), rule, true, true);
 }