コード例 #1
0
ファイル: ShowDoc_Action.java プロジェクト: ramakantmoka/MPS
 @Override
 public boolean isApplicable(AnActionEvent event, final Map<String, Object> _params) {
   SAbstractConcept concept = event.getData(MPSCommonDataKeys.NODE).getConcept();
   LanguageRuntime languageRuntime =
       LanguageRegistry.getInstance(event.getData(MPSCommonDataKeys.MPS_PROJECT))
           .getLanguage(concept.getLanguage());
   DocumentationAspectDescriptor docDescriptor =
       languageRuntime.getAspect(DocumentationAspectDescriptor.class);
   return docDescriptor != null;
 }
コード例 #2
0
 @Override
 protected SubstituteMenuLookup getSubstituteMenuLookup(TransformationMenuContext context) {
   final EditorContext editorContext = context.getEditorContext();
   return new DefaultSubstituteMenuLookup(
       LanguageRegistry.getInstance(editorContext.getRepository()),
       MetaAdapterFactory.getConcept(
           0xcb6d57037c8e46a9L,
           0xb993c1373dc0942fL,
           0x7ce1116e3a6fb0beL,
           "jetbrains.mps.lang.editor.menus.substitute.testLanguage.structure.TestSubstituteChild"));
 }
コード例 #3
0
 @Nullable
 @Override
 protected SubstituteMenuLookup getLookup(SubstituteMenuContext _context) {
   final EditorContext editorContext = _context.getEditorContext();
   return new DefaultSubstituteMenuLookup(
       LanguageRegistry.getInstance(editorContext.getRepository()),
       MetaAdapterFactory.getConcept(
           0x798100da4f0a421aL,
           0xb99171f8c50ce5d2L,
           0x3395e884b61c2404L,
           "jetbrains.mps.build.structure.BuildSource_JavaCP"));
 }
コード例 #4
0
 @Nullable
 @Override
 protected SubstituteMenuLookup getSubstituteMenuLookup(TransformationMenuContext _context) {
   final EditorContext editorContext = _context.getEditorContext();
   return new DefaultSubstituteMenuLookup(
       LanguageRegistry.getInstance(editorContext.getRepository()),
       MetaAdapterFactory.getConcept(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0xfbdeb6fecfL,
           "jetbrains.mps.baseLanguage.structure.BinaryOperation"));
 }
コード例 #5
0
ファイル: ShowDoc_Action.java プロジェクト: ramakantmoka/MPS
 @Override
 public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) {
   SAbstractConcept concept = event.getData(MPSCommonDataKeys.NODE).getConcept();
   LanguageRuntime languageRuntime =
       LanguageRegistry.getInstance(event.getData(MPSCommonDataKeys.MPS_PROJECT))
           .getLanguage(concept.getLanguage());
   DocumentationAspectDescriptor docDescriptor =
       languageRuntime.getAspect(DocumentationAspectDescriptor.class);
   String docText = docDescriptor.getConceptDocumentation(concept);
   if (docText != null) {
     JOptionPane.showMessageDialog(null, docText);
   }
 }
コード例 #6
0
ファイル: FacetRegistry.java プロジェクト: lilongthinker/MPS
 public IFacet lookup(IFacet.Name fn) {
   LanguageRegistry langReg = LanguageRegistry.getInstance();
   if (langReg != null) {
     LanguageRuntime lr = langReg.getLanguage(fn.getNamespace());
     if (lr != null) {
       IFacetManifest fm = lr.getFacetProvider().getDescriptor(null).getManifest();
       IFacet fct = fm.lookup(fn);
       if (fct != null) {
         return fct;
       }
     }
   }
   // fallback to the "old" mechanism
   LOG.debug("facet not found, loading using deprecated mechanism " + fn);
   return MapSequence.fromMap(facetMap).get(fn);
 }
コード例 #7
0
ファイル: AnalyzerRules.java プロジェクト: JetBrains/MPS
 public void apply() {
   if (myNodesToApply.isEmpty()) {
     return;
   }
   SNode first = myNodesToApply.iterator().next();
   SModel model = first.getModel();
   if (model == null) {
     LOG.warning(
         "Checking node which is not attached to the model: "
             + first.getPresentation()
             + " "
             + first.getNodeId());
     return;
   }
   // XXX could I demand here that model has to be attached to a repository, so that I can use one
   // to obtain LanguageRegistry?
   for (SLanguage language : SModelOperations.getAllLanguageImports(model)) {
     LanguageRuntime languageRuntime = LanguageRegistry.getInstance().getLanguage(language);
     if (languageRuntime == null) {
       continue;
     }
     DataFlowAspectDescriptor aspect = languageRuntime.getAspect(DataFlowAspectDescriptor.class);
     if (aspect == null) {
       continue;
     }
     for (DataFlowConstructor rule : aspect.getConstructors(myAnalyzerId)) {
       myRules.add(rule);
     }
   }
   Set<SNode> descendants = new LinkedHashSet<SNode>();
   for (SNode myNodeToApply : myNodesToApply) {
     descendants.addAll(
         SNodeOperations.getNodeDescendants(
             myNodeToApply, null, false, new SAbstractConcept[] {}));
   }
   for (SNode descendant : descendants) {
     getRules(descendant).forEach(rule -> rule.performActions(myProgram, descendant));
   }
 }