예제 #1
0
  public static void assertDeepModelEquals(SModel expectedModel, SModel actualModel) {
    ModelAccess.instance().checkReadAccess();

    assertSameImports(expectedModel, actualModel);
    assertSameModelImports(expectedModel, actualModel);
    assertSameLanguageAspects(expectedModel, actualModel);

    assertSameNodesCollections("root", expectedModel.getRootNodes(), actualModel.getRootNodes());
  }
  public void dispose() {
    checkDisposed();

    for (SModelDescriptor sm : new LinkedHashSet<SModelDescriptor>(myModelDescriptors)) {
      remove(sm);
    }
    ModelAccess.instance().removeCommandListener(myModelAccessListener);
    myDisposed = true;
  }
  public void flush() {
    checkDisposed();

    if (myEvents.isEmpty()) return;
    ModelAccess.instance()
        .runWriteAction(
            new Runnable() {
              public void run() {
                List<SModelEvent> wrappedEvents = Collections.unmodifiableList(myEvents);
                myEvents = new ArrayList<SModelEvent>();
                eventsHappened(wrappedEvents);
              }
            });
  }
  public static List<INodeSubstituteAction> createActions(
      final SNode parentNode,
      final SNode currentChild,
      final SNode childConcept,
      final IChildNodeSetter childSetter,
      final IOperationContext context) {
    final List<INodeSubstituteAction>[] result = new List[1];
    // enable R/O access
    ModelAccess.instance()
        .runReadAction(
            new Runnable() {
              public void run() {
                TypeChecker.getInstance().enableTypesComputingForCompletion();
                result[0] =
                    createActions_internal(
                        parentNode, currentChild, childConcept, childSetter, context);
                TypeChecker.getInstance().clearTypesComputedForCompletion();
              }
            });

    return result[0];
  }
 public EventsCollector() {
   ModelAccess.instance().addCommandListener(myModelAccessListener);
   myIsInCommand = ModelAccess.instance().isInsideCommand();
 }