Search in sources :

Example 11 with SolutionBrowserPanel

use of org.pentaho.mantle.client.solutionbrowser.SolutionBrowserPanel in project pentaho-platform by pentaho.

the class OpenFileCommand method performOperation.

protected void performOperation(boolean feedback) {
    final IPluginPerspective activePerspective = PerspectiveManager.getInstance().getActivePerspective();
    final SolutionBrowserPanel solutionBrowserPerspective = SolutionBrowserPanel.getInstance();
    boolean forceReload = false;
    if (FileChooserDialog.getIsDirty()) {
        forceReload = true;
        WaitPopup.getInstance().setVisibleById(true, spinnerId);
        FileChooserDialog.setIsDirty(Boolean.FALSE);
    }
    RepositoryFileTreeManager.getInstance().fetchRepositoryFileTree(new AsyncCallback<RepositoryFileTree>() {

        public void onFailure(Throwable caught) {
        }

        public void onSuccess(RepositoryFileTree tree) {
            // TODO Uncomment the line below and delete the line after that once gwtwidets have been branched
            WaitPopup.getInstance().setVisibleById(false, spinnerId);
            final FileChooserDialog dialog = new FileChooserDialog(FileChooserMode.OPEN, lastPath, tree, false, true, solutionBrowserPerspective.getSolutionTree().isShowHiddenFiles());
            dialog.setSubmitOnEnter(MantleApplication.submitOnEnter);
            dialog.addFileChooserListener(new FileChooserListener() {

                public void dialogCanceled() {
                    // retain current active perspective
                    PerspectiveManager.getInstance().setPerspective(activePerspective.getId());
                }

                @Override
                public void fileSelected(RepositoryFile repositoryFile, String filePath, String fileName, String title) {
                    dialog.hide();
                    solutionBrowserPerspective.openFile(repositoryFile, openMethod);
                }

                @Override
                public void fileSelectionChanged(RepositoryFile repositoryFile, String filePath, String fileName, String title) {
                // TODO Auto-generated method stub
                }
            });
            dialog.center();
        }
    }, forceReload, null, null, SolutionBrowserPanel.getInstance().getSolutionTree().isShowHiddenFiles());
}
Also used : FileChooserListener(org.pentaho.gwt.widgets.client.filechooser.FileChooserListener) RepositoryFile(org.pentaho.gwt.widgets.client.filechooser.RepositoryFile) IPluginPerspective(org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective) SolutionBrowserPanel(org.pentaho.mantle.client.solutionbrowser.SolutionBrowserPanel) RepositoryFileTree(org.pentaho.gwt.widgets.client.filechooser.RepositoryFileTree) FileChooserDialog(org.pentaho.gwt.widgets.client.filechooser.FileChooserDialog)

Aggregations

SolutionBrowserPanel (org.pentaho.mantle.client.solutionbrowser.SolutionBrowserPanel)11 RepositoryFile (org.pentaho.gwt.widgets.client.filechooser.RepositoryFile)7 SolutionFileHandler (org.pentaho.mantle.client.events.SolutionFileHandler)4 FileChooserDialog (org.pentaho.gwt.widgets.client.filechooser.FileChooserDialog)3 FileChooserListener (org.pentaho.gwt.widgets.client.filechooser.FileChooserListener)3 RequestBuilder (com.google.gwt.http.client.RequestBuilder)2 RequestException (com.google.gwt.http.client.RequestException)2 PromptDialogBox (org.pentaho.gwt.widgets.client.dialogs.PromptDialogBox)2 RepositoryFileTree (org.pentaho.gwt.widgets.client.filechooser.RepositoryFileTree)2 JsArrayString (com.google.gwt.core.client.JsArrayString)1 Frame (com.google.gwt.user.client.ui.Frame)1 Label (com.google.gwt.user.client.ui.Label)1 IDialogCallback (org.pentaho.gwt.widgets.client.dialogs.IDialogCallback)1 FileFilter (org.pentaho.gwt.widgets.client.filechooser.FileFilter)1 ExportFileCommand (org.pentaho.mantle.client.commands.ExportFileCommand)1 FilePropertiesCommand (org.pentaho.mantle.client.commands.FilePropertiesCommand)1 ImportFileCommand (org.pentaho.mantle.client.commands.ImportFileCommand)1 NewFolderCommand (org.pentaho.mantle.client.commands.NewFolderCommand)1 RunInBackgroundCommand (org.pentaho.mantle.client.commands.RunInBackgroundCommand)1 ShareFileCommand (org.pentaho.mantle.client.commands.ShareFileCommand)1