Search in sources :

Example 1 with ImportFileCommand

use of org.pentaho.mantle.client.commands.ImportFileCommand in project pentaho-platform by pentaho.

the class FileCommand method execute.

public void execute() {
    if (popupMenu != null) {
        popupMenu.hide();
    }
    SolutionBrowserPanel sbp = SolutionBrowserPanel.getInstance();
    FilesListPanel flp = sbp.getFilesListPanel();
    if (flp.getSelectedFileItems() == null || flp.getSelectedFileItems().size() < 1) {
        return;
    }
    List<FileItem> selectedItems = flp.getSelectedFileItems();
    FileItem selectedItem = selectedItems.get(0);
    if (mode == COMMAND.RUN || mode == COMMAND.NEWWINDOW) {
        if (selectedItem != null) {
            sbp.openFile(selectedItem.getRepositoryFile(), mode);
        }
    } else if (mode == COMMAND.PROPERTIES) {
        new FilePropertiesCommand(fileSummary == null ? fileSummaryProvider.getRepositoryFiles().get(0) : fileSummary).execute();
    } else if (mode == COMMAND.EDIT) {
        sbp.editFile();
    } else if (mode == COMMAND.CREATE_FOLDER) {
        new NewFolderCommand(fileSummary).execute();
    } else if (mode == COMMAND.BACKGROUND) {
        new RunInBackgroundCommand(selectedItem).execute(true);
    } else if (mode == COMMAND.SCHEDULE_NEW) {
        ScheduleHelper.createSchedule(selectedItem.getRepositoryFile(), new ScheduleCallback(selectedItem.getRepositoryFile()));
    } else if (mode == COMMAND.SHARE) {
        new ShareFileCommand().execute();
    } else if (mode == COMMAND.IMPORT) {
        new ImportFileCommand(fileSummary == null ? fileSummaryProvider.getRepositoryFiles().get(0) : fileSummary).execute();
    } else if (mode == COMMAND.EXPORT) {
        new ExportFileCommand(fileSummary == null ? fileSummaryProvider.getRepositoryFiles().get(0) : fileSummary).execute();
    } else if (mode == COMMAND.FAVORITE) {
        sbp.addFavorite(selectedItem.getRepositoryFile().getPath(), selectedItem.getRepositoryFile().getTitle());
        FavoritePickList.getInstance().save("favorites");
    } else if (mode == COMMAND.FAVORITE_REMOVE) {
        sbp.removeFavorite(selectedItem.getRepositoryFile().getPath());
        FavoritePickList.getInstance().save("favorites");
    }
}
Also used : ScheduleCallback(org.pentaho.mantle.client.solutionbrowser.ScheduleCallback) ShareFileCommand(org.pentaho.mantle.client.commands.ShareFileCommand) ImportFileCommand(org.pentaho.mantle.client.commands.ImportFileCommand) FilePropertiesCommand(org.pentaho.mantle.client.commands.FilePropertiesCommand) NewFolderCommand(org.pentaho.mantle.client.commands.NewFolderCommand) SolutionBrowserPanel(org.pentaho.mantle.client.solutionbrowser.SolutionBrowserPanel) RunInBackgroundCommand(org.pentaho.mantle.client.commands.RunInBackgroundCommand) ExportFileCommand(org.pentaho.mantle.client.commands.ExportFileCommand)

Example 2 with ImportFileCommand

use of org.pentaho.mantle.client.commands.ImportFileCommand in project pentaho-platform by pentaho.

the class FolderCommand method execute.

public void execute() {
    if (popupMenu != null) {
        popupMenu.hide();
    }
    SolutionBrowserPanel sbp = SolutionBrowserPanel.getInstance();
    if (mode == COMMAND.PROPERTIES) {
        new FilePropertiesCommand(repositoryFile).execute();
    } else if (mode == COMMAND.DELETE) {
        TreeItem item = sbp.getSolutionTree().getSelectedItem();
        RepositoryFileTree tree = (RepositoryFileTree) item.getUserObject();
        new DeleteFolderCommand(tree.getFile()).execute();
    } else if (mode == COMMAND.CREATE_FOLDER) {
        TreeItem item = sbp.getSolutionTree().getSelectedItem();
        RepositoryFileTree tree = (RepositoryFileTree) item.getUserObject();
        new NewFolderCommand(tree.getFile()).execute();
    } else if (mode == COMMAND.EXPORT) {
        new ExportFileCommand(repositoryFile).execute();
    } else if (mode == COMMAND.IMPORT) {
        new ImportFileCommand(repositoryFile).execute();
    } else if (mode == COMMAND.PASTE) {
        new PasteFilesCommand().execute();
    } else if (mode == COMMAND.EMPTY_TRASH) {
        new DeletePermanentFileCommand().execute();
    }
}
Also used : ImportFileCommand(org.pentaho.mantle.client.commands.ImportFileCommand) DeletePermanentFileCommand(org.pentaho.mantle.client.commands.DeletePermanentFileCommand) TreeItem(com.google.gwt.user.client.ui.TreeItem) FilePropertiesCommand(org.pentaho.mantle.client.commands.FilePropertiesCommand) NewFolderCommand(org.pentaho.mantle.client.commands.NewFolderCommand) PasteFilesCommand(org.pentaho.mantle.client.commands.PasteFilesCommand) RepositoryFileTree(org.pentaho.gwt.widgets.client.filechooser.RepositoryFileTree) ExportFileCommand(org.pentaho.mantle.client.commands.ExportFileCommand) DeleteFolderCommand(org.pentaho.mantle.client.commands.DeleteFolderCommand)

Aggregations

ExportFileCommand (org.pentaho.mantle.client.commands.ExportFileCommand)2 FilePropertiesCommand (org.pentaho.mantle.client.commands.FilePropertiesCommand)2 ImportFileCommand (org.pentaho.mantle.client.commands.ImportFileCommand)2 NewFolderCommand (org.pentaho.mantle.client.commands.NewFolderCommand)2 TreeItem (com.google.gwt.user.client.ui.TreeItem)1 RepositoryFileTree (org.pentaho.gwt.widgets.client.filechooser.RepositoryFileTree)1 DeleteFolderCommand (org.pentaho.mantle.client.commands.DeleteFolderCommand)1 DeletePermanentFileCommand (org.pentaho.mantle.client.commands.DeletePermanentFileCommand)1 PasteFilesCommand (org.pentaho.mantle.client.commands.PasteFilesCommand)1 RunInBackgroundCommand (org.pentaho.mantle.client.commands.RunInBackgroundCommand)1 ShareFileCommand (org.pentaho.mantle.client.commands.ShareFileCommand)1 ScheduleCallback (org.pentaho.mantle.client.solutionbrowser.ScheduleCallback)1 SolutionBrowserPanel (org.pentaho.mantle.client.solutionbrowser.SolutionBrowserPanel)1