private void registerLanguageKeyMaps(Language language) {
   SModel editorModelDescriptor = LanguageAspect.EDITOR.get(language);
   SModel editorModel = (editorModelDescriptor != null ? editorModelDescriptor.getSModel() : null);
   List<KeyMap> keyMaps;
   if (editorModel != null) {
     keyMaps = ListSequence.fromList(new ArrayList<KeyMap>());
     for (SNode keyMapDeclaration :
         ListSequence.fromList(
             SModelOperations.getRoots(
                 editorModel, "jetbrains.mps.lang.editor.structure.CellKeyMapDeclaration"))) {
       try {
         Class<KeyMap> keyMapClass = findKeyMapClassByDeclaration(keyMapDeclaration);
         if (keyMapClass != null) {
           KeyMap keyMap = keyMapClass.newInstance();
           if (keyMap.isApplicableToEveryModel()) {
             ListSequence.fromList(keyMaps).addElement(keyMap);
           }
         }
       } catch (Throwable t) {
         LOG.error(t);
       }
     }
   } else {
     keyMaps = Collections.emptyList();
   }
   MapSequence.fromMap(myLanguagesToKeyMaps).put(language, keyMaps);
 }
 public static boolean static_canBeARoot(SModel model, final IOperationContext operationContext) {
   return LanguageAspect.EDITOR.is(model) || SModelStereotype.isGeneratorModel(model);
 }
Example #3
0
 public static boolean static_canBeARoot(
     final IOperationContext operationContext, final CanBeARootContext _context) {
   return LanguageAspect.EDITOR.is(_context.getModel());
 }