Search in sources :

Example 1 with DescriptiveRunnable

use of org.uberfire.commons.async.DescriptiveRunnable in project kie-wb-common by kiegroup.

the class ExplorerServiceHelper method store.

public void store(final WorkspaceProject project, final Module selectedModule, final FolderListing folderListing, final Package selectedPackage, final ActiveOptions options) {
    final org.uberfire.java.nio.file.Path userNavPath = userServices.buildPath("explorer", "user.nav");
    final org.uberfire.java.nio.file.Path lastUserNavPath = userServices.buildPath("explorer", "last.user.nav");
    final Module _selectedModule = selectedModule;
    final FolderItem _selectedItem = folderListing.getItem();
    final org.guvnor.common.services.project.model.Package _selectedPackage;
    if (selectedPackage != null) {
        _selectedPackage = selectedPackage;
    } else if (folderListing.getItem().getItem() instanceof Package) {
        _selectedPackage = (Package) folderListing.getItem().getItem();
    } else {
        _selectedPackage = null;
    }
    this.executorService.execute(new DescriptiveRunnable() {

        @Override
        public String getDescription() {
            return "Serialize Navigation State";
        }

        @Override
        public void run() {
            try {
                store(userNavPath, lastUserNavPath, project, _selectedModule, _selectedPackage, _selectedItem, options);
            } catch (final Exception e) {
                LOGGER.error("Can't serialize user's state navigation", e);
            }
        }
    });
}
Also used : Package(org.guvnor.common.services.project.model.Package) FolderItem(org.kie.workbench.common.screens.explorer.model.FolderItem) Package(org.guvnor.common.services.project.model.Package) Module(org.guvnor.common.services.project.model.Module) DescriptiveRunnable(org.uberfire.commons.async.DescriptiveRunnable)

Example 2 with DescriptiveRunnable

use of org.uberfire.commons.async.DescriptiveRunnable in project kie-wb-common by kiegroup.

the class ExplorerServiceImpl method getFolderListing.

@Override
public FolderListing getFolderListing(final WorkspaceProject project, final Module module, final FolderItem item, final ActiveOptions options) {
    // TODO: BUSINESS_CONTENT, TECHNICAL_CONTENT
    final FolderListing result = helper.getFolderListing(item, options);
    if (result != null) {
        final org.uberfire.java.nio.file.Path userNavPath = userServices.buildPath("explorer", "user.nav");
        final org.uberfire.java.nio.file.Path lastUserNavPath = userServices.buildPath("explorer", "last.user.nav");
        this.executorService.execute(new DescriptiveRunnable() {

            @Override
            public String getDescription() {
                return "Serialize Navigation State";
            }

            @Override
            public void run() {
                try {
                    Package pkg = null;
                    if (item.getItem() instanceof Package) {
                        pkg = (Package) item.getItem();
                    }
                    helper.store(userNavPath, lastUserNavPath, project, module, pkg, item, options);
                } catch (final Exception e) {
                    LOGGER.error("Can't serialize user's state navigation", e);
                }
            }
        });
    }
    return result;
}
Also used : FolderListing(org.kie.workbench.common.screens.explorer.model.FolderListing) Package(org.guvnor.common.services.project.model.Package) DescriptiveRunnable(org.uberfire.commons.async.DescriptiveRunnable)

Aggregations

Package (org.guvnor.common.services.project.model.Package)2 DescriptiveRunnable (org.uberfire.commons.async.DescriptiveRunnable)2 Module (org.guvnor.common.services.project.model.Module)1 FolderItem (org.kie.workbench.common.screens.explorer.model.FolderItem)1 FolderListing (org.kie.workbench.common.screens.explorer.model.FolderListing)1