Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[xtext-dev] How to provide custom IAllContainerState?


Hi,

I am trying to provide a custom IAllContainerState for my editor.

In my editor plugin, I have bound to the StateBasedContainerManager:

        public Class<? extends IContainer.Manager> bindIContainer$Manager() {
          return StateBasedContainerManager.class;
        }

In my editor.ui plugin, I have tried the following:
        public Provider<IAllContainersState> provideIAllContainersState() {
          return MySharedAccess.getCustomContainerState();
        }

MySharedAccess extends from Access and provides the following method:

        public static Provider<IAllContainersState> getCutomContainerState() {
                return Access.<IAllContainersState>provider(CustomContainerState.class);
        }

My container state is called, however I don't think I am doing this correctly.  Whenever my editor is opened, the CustomContainerState.doInitHandle(URI uri) is called. I did not expect this to happen because I thought the results of the handle, and container visibility is cached.  

I debugged this a bit, and found that every time ContainerState.initHandle(uri) is called, a different instance of my CustomContainerState is used.  I compared the result with the default settings. In the case of the default settings, IAllContainersState object is a singleton, and the same instance is used over and over again.

I could not quite figure out how to set this up, can you provide some tips?

Thanks!
Samantha

Back to the top