use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.
the class HelperWrapper method getUserExplorerLastData.
public UserExplorerLastData getUserExplorerLastData() {
UserExplorerLastData userExplorerLastData = new UserExplorerLastData();
if (activeOptionsArgumentCaptor != null) {
userExplorerLastData.setOptions(activeOptionsArgumentCaptor.getValue());
}
if (packageArgumentCaptor == null) {
return userExplorerLastData;
}
Package value = packageArgumentCaptor.getValue();
FolderListing folderListing = folderListingArgumentCaptor.getValue();
if (folderListing != null) {
userExplorerLastData.setFolderItem(projectArgumentCaptor.getValue().getRepository(), projectArgumentCaptor.getValue().getBranch().getName(), moduleArgumentCaptor.getValue(), folderListing.getItem());
}
if (value != null && includePackage) {
userExplorerLastData.setPackage(projectArgumentCaptor.getValue().getRepository(), projectArgumentCaptor.getValue().getBranch().getName(), moduleArgumentCaptor.getValue(), value);
} else if (includePackage) {
userExplorerLastData.setPackage(projectArgumentCaptor.getValue().getRepository(), projectArgumentCaptor.getValue().getBranch().getName(), moduleArgumentCaptor.getValue(), new Package());
}
return userExplorerLastData;
}
use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.
the class BaseViewPresenter method onResourceRenamed.
// Refresh when a Resource has been renamed, if it exists in the active package
public void onResourceRenamed(@Observes final ResourceRenamedEvent event) {
if (!baseView.isVisible()) {
return;
}
final Path sourcePath = event.getPath();
final Path destinationPath = event.getDestinationPath();
boolean refresh = false;
if (Utils.isInFolderItem(activeContextItems.getActiveFolderItem(), sourcePath)) {
refresh = true;
} else if (Utils.isInFolderItem(activeContextItems.getActiveFolderItem(), destinationPath)) {
refresh = true;
}
if (refresh) {
explorerService.call(new RemoteCallback<FolderListing>() {
@Override
public void callback(final FolderListing folderListing) {
baseView.setItems(folderListing);
}
}).getFolderListing(activeContextItems.getActiveProject(), activeContextItems.getActiveModule(), activeContextItems.getActiveFolderItem(), activeOptions.getOptions());
}
}
use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.
the class BaseViewPresenterUpdateTest method hideTagWhenActiveContentExists.
@Test
public void hideTagWhenActiveContentExists() throws Exception {
when(activeContextOptions.canShowTag()).thenReturn(false);
final FolderListing folderListing = mock(FolderListing.class);
when(activeContextItems.getActiveContent()).thenReturn(folderListing);
presenter.update();
verify(view).setItems(folderListing);
}
use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.
the class BaseBreadcrumbNavigatorTest method testLoadContentOnlyFolder.
@Test
public void testLoadContentOnlyFolder() {
final BreadcrumbNavigator navigator = spy(new BreadcrumbNavigator(activeOptions, hiddenTypeDef, user));
final FolderItem item = new FolderItem(path, "item1", FolderItemType.FILE);
final List<FolderItem> content = new ArrayList<FolderItem>() {
{
add(new FolderItem(mock(Path.class), "Folder1", FolderItemType.FOLDER));
}
};
final List<FolderItem> segments = new ArrayList<FolderItem>();
final FolderListing listing = new FolderListing(item, content, segments);
navigator.loadContent(listing);
verify(navigator).setupBreadcrumb(listing);
verify(navigator).setupUpFolder(listing);
verify(navigator).setupContent(listing);
verify(navigator).showNavigatorPanel();
}
use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.
the class BaseBreadcrumbNavigatorTest method testLoadContentFileAndFolder.
@Test
public void testLoadContentFileAndFolder() {
final BreadcrumbNavigator navigator = spy(new BreadcrumbNavigator(activeOptions, hiddenTypeDef, user));
final FolderItem item = new FolderItem(path, "item1", FolderItemType.FILE);
final List<FolderItem> content = new ArrayList<FolderItem>() {
{
add(new FolderItem(mock(Path.class), "File1", FolderItemType.FILE));
add(new FolderItem(mock(Path.class), "Folder1", FolderItemType.FOLDER));
}
};
final List<FolderItem> segments = new ArrayList<FolderItem>();
final FolderListing listing = new FolderListing(item, content, segments);
navigator.loadContent(listing);
verify(navigator).setupBreadcrumb(listing);
verify(navigator).setupUpFolder(listing);
verify(navigator).setupContent(listing);
verify(navigator).showNavigatorPanel();
}
Aggregations