Esempio n. 1
0
 private StubModelsResolver() {
   GlobalSModelEventsManager.getInstance()
       .addGlobalCommandListener(
           new SModelCommandListener() {
             @Override
             public void eventsHappenedInCommand(List<SModelEvent> events) {
               // make it more optimal
               myStubModulesCache.clear();
             }
           });
 }
  @Override
  public void init() {
    if (INSTANCE != null) {
      throw new IllegalStateException("double initialization");
    }

    INSTANCE = this;
    myRepositoryListener.subscribeTo(MPSModuleRepository.getInstance());

    GlobalSModelEventsManager.getInstance()
        .addGlobalCommandListener(
            new SModelCommandListener() {
              @Override
              public void eventsHappenedInCommand(List<SModelEvent> events) {
                for (SModelEvent e : events) {
                  if (!LanguageAspect.STRUCTURE.is(e.getModelDescriptor())) continue;
                  invalidateCache();
                }
              }
            });
  }
Esempio n. 3
0
 public void dispose() {
   GlobalSModelEventsManager.getInstance().removeGlobalCommandListener(myListener);
 }
Esempio n. 4
0
 protected DependencyAwareCache() {
   GlobalSModelEventsManager.getInstance().addGlobalCommandListener(myListener);
 }