eclipse-che / che

Kubernetes based Cloud Development Environments for Enterprise Teams
http://eclipse.org/che
Eclipse Public License 2.0
6.99k stars 1.19k forks source link

close file issue #5286

Closed ahmedchemek closed 7 years ago

ahmedchemek commented 7 years ago

Hello, I added a new type of editor to Che, the problem is when I want to close the editor just the view disappears but the Head that contains the name of the file remains open. this is the close method in the Presenter : public void close(final boolean save) { view.setVisible(false); partStack.removePart(this); }

ghost commented 7 years ago

@vzhukovskii can you assist please?

vzhukovs commented 7 years ago

Hello @ahmedchemek! You should inject into your component org.eclipse.che.ide.api.editor.EditorAgent and call org.eclipse.che.ide.api.editor.EditorAgent#closeEditor then your tab with editor will be completely closed.

ahmedchemek commented 7 years ago

Hi @vzhukovskii !! I injected org.eclipse.che.ide.api.editor.EditorAgent in my Presenter and in the methode close i added : public void close(final boolean save) { view.setVisible(false); partStack.removePart(this); editorAgent.closeEditor(this); } but i have the same result

vzhukovs commented 7 years ago

You don't need to modify the method public void close(final boolean save). Just when you want to close programmatically your custom editor you should call only editorAgent.closeEditor(editorPresenterToClose);

TylerJewell commented 7 years ago

@ahmedchemek - please be mindful that this is a public forum for the entire community. We need to remove the perception of emotion from the discussions so that we can help you effectively. So, there is no need to use exclamation (!!) marks or bold. Just plain, simple English will be ok.

ahmedchemek commented 7 years ago

@TylerJewell ok sorry. @vzhukovskii where i should write editorAgent.closeEditor(editorPresenterToClose); ?

ahmedchemek commented 7 years ago

@eivantsov when executing close, i have this in the console: com.google.web.bindery.event.shared.UmbrellaException: Exception caught: (TypeError) : Cannot read property 'c0' of null

ghost commented 7 years ago

@ahmedchemek this exception can be ignored. It is unrelated.

vzhukovs commented 7 years ago

@ahmedchemek in any place where you want to close editor programmatically.

ahmedchemek commented 7 years ago

@vzhukovskii i writed it in the close method but always not working

ghost commented 7 years ago

@ahmedchemek is this still an issue?

ghost commented 7 years ago

@ahmedchemek I am closing the issue. Feel free to reopen if the problem persists.