Search in sources :

Example 6 with TabItem

use of org.eclipse.che.ide.api.parts.PartStackView.TabItem in project che by eclipse.

the class EditorPartStackPresenter method onCloseNonPinnedEditors.

/** {@inheritDoc} */
@Override
public void onCloseNonPinnedEditors(CloseNonPinnedEditorsEvent event) {
    EditorPartPresenter editorPart = event.getEditorTab().getRelativeEditorPart();
    if (!containsPart(editorPart)) {
        return;
    }
    Iterable<TabItem> nonPinned = filter(parts.keySet(), new Predicate<TabItem>() {

        @Override
        public boolean apply(@Nullable TabItem input) {
            return input instanceof EditorTab && !((EditorTab) input).isPinned();
        }
    });
    for (final TabItem tabItem : nonPinned) {
        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {

            @Override
            public void execute() {
                eventBus.fireEvent(FileEvent.createCloseFileEvent((EditorTab) tabItem));
            }
        });
    }
}
Also used : TabItem(org.eclipse.che.ide.api.parts.PartStackView.TabItem) EditorTab(org.eclipse.che.ide.api.parts.EditorTab) Scheduler(com.google.gwt.core.client.Scheduler) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter)

Example 7 with TabItem

use of org.eclipse.che.ide.api.parts.PartStackView.TabItem in project che by eclipse.

the class EditorPartStackPresenterTest method onTabItemClickedTest.

@Test
public void onTabItemClickedTest() {
    TabItem tabItem = mock(TabItem.class);
    when(editorPaneTabMenuItem.getData()).thenReturn(tabItem);
    presenter.paneMenuTabItemHandler.onItemClicked(editorPaneTabMenuItem);
    verify(view).selectTab((PartPresenter) anyObject());
}
Also used : TabItem(org.eclipse.che.ide.api.parts.PartStackView.TabItem) Test(org.junit.Test)

Aggregations

TabItem (org.eclipse.che.ide.api.parts.PartStackView.TabItem)7 EditorTab (org.eclipse.che.ide.api.parts.EditorTab)4 Scheduler (com.google.gwt.core.client.Scheduler)2 Nullable (org.eclipse.che.commons.annotation.Nullable)2 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)2 Path (org.eclipse.che.ide.resource.Path)2 AbstractEditorPresenter (org.eclipse.che.ide.api.editor.AbstractEditorPresenter)1 EditorWithErrors (org.eclipse.che.ide.api.editor.EditorWithErrors)1 EditorState (org.eclipse.che.ide.api.editor.EditorWithErrors.EditorState)1 PartPresenter (org.eclipse.che.ide.api.parts.PartPresenter)1 PartStackStateChangedEvent (org.eclipse.che.ide.api.parts.PartStackStateChangedEvent)1 PropertyListener (org.eclipse.che.ide.api.parts.PropertyListener)1 BasePresenter (org.eclipse.che.ide.api.parts.base.BasePresenter)1 VirtualFile (org.eclipse.che.ide.api.resources.VirtualFile)1 PartButton (org.eclipse.che.ide.part.widgets.partbutton.PartButton)1 Test (org.junit.Test)1