Package org.rstudio.core.client.files

Examples of org.rstudio.core.client.files.FileSystemItem


        
         addClickHandler(new ClickHandler()
         {
            public void onClick(ClickEvent event)
            {
               final FileSystemItem projDir = RStudioGinjector.INSTANCE.
                         getSession().getSessionInfo().getActiveProjectDir();
              
               RStudioGinjector.INSTANCE.getFileDialogs().openFile(
                     "Choose File",
                     RStudioGinjector.INSTANCE.getRemoteFileSystemContext(),
                     projDir,
                     new ProgressOperationWithInput<FileSystemItem>()
                     {
                        public void execute(FileSystemItem input,
                                            ProgressIndicator indicator)
                        {
                           if (input == null)
                              return;

                           indicator.onCompleted();
                          
                           String proj = projDir.getPath();
                           if (input.getPath().startsWith(proj + "/"))
                           {
                              String projRelative =
                                input.getPath().substring(proj.length() + 1);
                              setText(projRelative);
View Full Code Here


      // ~/bar/README
      for (ArrayList<Integer> dupeList : dupeInfo.dupes())
      {
         for (Integer index : dupeList)
         {
            FileSystemItem fsi = FileSystemItem.createFile(
                  paths.get(index));
            String name = includeExtension ? fsi.getName() : fsi.getStem();
            labels.set(index, disambiguate(name,
                                           fsi.getParentPathString()));
         }
      }


      return labels;
View Full Code Here

  
   @Override
   public void onOpenProjectFile(final OpenProjectFileEvent event)
   {
      // project options for current project
      FileSystemItem projFile = event.getFile();
      if (projFile.getPath().equals(
                  session_.getSessionInfo().getActiveProjectFile()))
      {
         onProjectOptions();
         return;
      }
     
      // prompt to confirm
      String projectPath = projFile.getParentPathString();
      globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, 
         "Confirm Open Project",                            
         "Do you want to open the project " + projectPath + "?",                        
          new Operation()
          {
View Full Code Here

      return filename + " \u2014 " + disambiguatingPath;
   }

   private static ArrayList<String> toPathElements(String path)
   {
      FileSystemItem fsi = FileSystemItem.createFile(path);
      return new ArrayList<String>(
            Arrays.asList(fsi.getParentPathString().split("/")));
   }
View Full Code Here

         return ;
        
      // case: single file which is not a folder
      if ((files.size()) == 1 && !files.get(0).isDirectory())
      {
         final FileSystemItem file = files.get(0);
        
         showFileExport(caption,
                        description,
                        file.getStem(),
                        file.getExtension(),    
                        new ProgressOperationWithInput<String>(){
            public void execute(String name, ProgressIndicator progress)
            {
               // progress complete
               progress.onCompleted();
              
               // execute the download (open in a new window)
               globalDisplay_.openWindow(server_.getFileExportUrl(name, file));
              
            }
         });
      }
     
      // case: folder or multiple files
      else
      {
         // determine the default zip file name based on the selection
         String defaultArchiveName;
         if (files.size() == 1)
            defaultArchiveName = files.get(0).getStem();
         else
            defaultArchiveName = "rstudio-export";
        
         // prompt user
         final String ZIP = ".zip";
         showFileExport(caption,
                        description,
                        defaultArchiveName,
                        ZIP,
                        new ProgressOperationWithInput<String>(){
           
            public void execute(String archiveName, ProgressIndicator progress)
            {
               // progress complete
               progress.onCompleted();
              
               // force zip extension in case the user deleted it
               if (!archiveName.endsWith(ZIP))
                  archiveName += ZIP;
              
               // build list of filenames
               ArrayList<String> filenames = new ArrayList<String>();
               for (FileSystemItem file : files)
                  filenames.add(file.getName());
              
               // execute the download (open in a new window)
               globalDisplay_.openWindow(server_.getFileExportUrl(archiveName,
                                                                  parentDir,
                                                                  filenames));
View Full Code Here

            QuotaStatus quotaStatus = event.getData();
            eventBus_.fireEvent(new QuotaStatusEvent(quotaStatus));
         }
         else if (type.equals(ClientEvent.FileEdit))
         {
            FileSystemItem file = event.getData();
            eventBus_.fireEvent(new FileEditEvent(file));
         }
         else if (type.equals(ClientEvent.ShowContent))
         {
            ContentItem content = event.getData();
View Full Code Here

   private void viewPublicKey()
   {
      progressIndicator_.onProgress("Reading public key...");
     
      // compute path to public key
      FileSystemItem privKey =
               FileSystemItem.createFile(txtSshKeyPath_.getText());
      FileSystemItem keyDir = privKey.getParentPath();
      final String keyPath = keyDir.completePath(privKey.getStem() + ".pub");
     
      server_.gitSshPublicKey(keyPath,
                              new ServerRequestCallback<String> () {
        
         @Override
View Full Code Here

   private void satelliteEditFile(JavaScriptObject file,
                                  JavaScriptObject position,
                                  boolean highlightLine)
   {
      FileSystemItem fsi = file.cast();
      FilePosition pos = position.cast();
      editFile(fsi, pos);
   }
View Full Code Here

   }

   void openFile(String filePath)
   {
      // get the file system item
      FileSystemItem file = FileSystemItem.createFile(filePath);
     
      if (file.isDirectory())
         return;
     
      // this used to be possible but shouldn't be anymore
      // (since we screen out .rproj from calling sendMessage
      // within DesktopMain.cpp
      if (file.getExtension().equalsIgnoreCase(".rproj"))
         return;
     
      // open the file. pass false for second param to prevent
      // the default handler (the browser) from taking it
      fileTypeRegistry_.openFile(file, false);
View Full Code Here

         {
            public void execute()
            {
               String file = operation(caption, dir);

               FileSystemItem item =
                     StringUtil.isNullOrEmpty(file)
                     ? null
                     : FileSystemItem.createFile(file);

               if (item != null && shouldUpdateDetails())
               {
                  server_.stat(item.getPath(), new ServerRequestCallback<FileSystemItem>()
                  {
                     @Override
                     public void onResponseReceived(FileSystemItem response)
                     {
                        operation.execute(response, new NullProgressIndicator());
View Full Code Here

TOP

Related Classes of org.rstudio.core.client.files.FileSystemItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.