package org.rstudio.studio.client.projects;

import org.rstudio.core.client.command.CommandBinder;
import org.rstudio.core.client.command.Handler;
import org.rstudio.core.client.widget.MessageDialog;
import org.rstudio.studio.client.application.events.EventBus;
import org.rstudio.studio.client.common.GlobalDisplay;
import org.rstudio.studio.client.common.filetypes.events.OpenProjectFileEvent;
import org.rstudio.studio.client.common.filetypes.events.OpenProjectFileHandler;
import org.rstudio.studio.client.workbench.commands.Commands;

import com.google.inject.Inject;
import com.google.inject.Singleton;

@Singleton
public class Projects implements OpenProjectFileHandler
{
   public interface Binder extends CommandBinder<Commands, Projects> {}
   
   @Inject
   public Projects(GlobalDisplay globalDisplay,
                   EventBus eventBus,
                   Binder binder,
                   Commands commands)
   {
      globalDisplay_ = globalDisplay;
      
      binder.bind(commands, this);
      
      eventBus.addHandler(OpenProjectFileEvent.TYPE, this);
   }
   
   @Handler
   public void onNewProject()
   {
      globalDisplay_.showMessage(MessageDialog.INFO, 
                                 "RStudio", 
                                 "New Project: Not Implemented");
      
   }
   
   @Handler
   public void onOpenProject()
   {
      globalDisplay_.showMessage(MessageDialog.INFO, 
                                 "RStudio", 
                                 "Open Project: Not Implemented");
   }

   private final GlobalDisplay globalDisplay_;

   @Override
   public void onOpenProjectFile(OpenProjectFileEvent event)
   {
  
   }
}

@@ -255,16 +255,69 @@
 entBus;%0A
+import org.rstudio.studio.client.common.FileDialogs;%0A
 import o
@@ -656,16 +656,268 @@
 leton;%0A%0A
+// TODO: Auto-create the .Rproj file when opening directory or .RData%0A%0A// TODO: Aggregate the global environment into the save dialog%0A//          - Eliminate desktop native codepath%0A//          - Remember not to prompt for save again after first pass%0A%0A
 @Singlet
@@ -1112,16 +1112,60 @@
 isplay,%0A
+                   FileDialogs fileDialogs,%0A
         
@@ -1309,16 +1309,50 @@
 isplay;%0A
+      fileDialogs_ = fileDialogs;%0A
       %0A 
@@ -1747,173 +1747,105 @@
     
-globalDisplay_.showMessage(MessageDialog.INFO, %0A                                 %22RStudio%22, %0A                                 %22
+%0A   %7D%0A%0A   @Override%0A   public void on
 Open
- 
 Project
-: Not Implemented%22);
+File(OpenProjectFileEvent event)%0A   %7B%0A  
 %0A   %7D%0A
+   
 %0A   
@@ -1892,94 +1892,53 @@
 y_;%0A
-%0A
    
-@Override%0A   public void onOpenProjectFile(OpenProjectFileEvent event)%0A   %7B%0A  
+private final FileDialogs fileDialogs_;%0A
 %0A  
- %7D
 %0A%7D%0A

add todo comments to projects