Package org.rstudio.studio.client.workbench.views.source.editors.text.status

Examples of org.rstudio.studio.client.workbench.views.source.editors.text.status.StatusBarPopupMenu


        
         @Override
         public void onResponseReceived(SlideNavigation slideNavigation)
         {
            // create the menu and make sure we have some slides to return
            StatusBarPopupMenu menu =  new StatusBarPopupMenu();
            if (slideNavigation.getTotalSlides() == 0)
            {
               onCompleted.execute(new StatusBarPopupRequest(menu, null));
               return;
            }
           
            MenuItem defaultMenuItem = null;
            int length = slideNavigation.getItems().length();
            for (int i=0; i<length; i++)
            {
               SlideNavigationItem item = slideNavigation.getItems().get(i);
               String title = item.getTitle();
               if (StringUtil.isNullOrEmpty(title))
                  title = "(Untitled Slide)";
              
               StringBuilder indentBuilder = new StringBuilder();
               for (int level=0; level<item.getIndent(); level++)
                  indentBuilder.append("&nbsp;&nbsp;");
              
               SafeHtmlBuilder labelBuilder = new SafeHtmlBuilder();
               labelBuilder.appendHtmlConstant(indentBuilder.toString());
               labelBuilder.appendEscaped(title);

               final int targetSlide = i;
               final MenuItem menuItem = new MenuItem(
                  labelBuilder.toSafeHtml(),
                  new Command()
                  {
                     public void execute()
                     {
                        navigateToSlide(editor, targetSlide);
                     }          
                  });
               menu.addItem(menuItem);
              
               // see if this is the default menu item
               if (defaultMenuItem == null &&
                   item.getLine() >= (docDisplay_.getSelectionStart().getRow()))
               {
View Full Code Here


            // build menu with all file types - also track whether we need
            // to add the current type (may be the case for types which we
            // support but don't want to expose on the menu -- e.g. Rmd
            // files when knitr isn't installed)
            boolean addCurrentType = true;
            final StatusBarPopupMenu menu = new StatusBarPopupMenu();
            TextFileType[] fileTypes = fileTypeCommands_.statusBarFileTypes();
            for (TextFileType type : fileTypes)
            {
               menu.addItem(createMenuItemForType(type));
               if (addCurrentType && type.equals(fileType_))
                  addCurrentType = false;
            }
           
            // add the current type if isn't on the menu
            if (addCurrentType)
               menu.addItem(createMenuItemForType(fileType_));
        
            // show the menu
            menu.showRelativeToUpward((UIObject) statusBar_.getLanguage())
         }
      });     

      statusBar_.getScope().addMouseDownHandler(new MouseDownHandler()
      {
         public void onMouseDown(MouseDownEvent event)
         {
            // Unlike the other status bar elements, the function outliner
            // needs its menu built on demand
            JsArray<Scope> tree = docDisplay_.getScopeTree();
            final StatusBarPopupMenu menu = new StatusBarPopupMenu();
            MenuItem defaultItem = null;
            if (fileType_.isRpres())
            {
               String path = docUpdateSentinel_.getPath();
               if (path != null)
View Full Code Here

      });
   }
  
   private void showStatusBarPopupMenu(StatusBarPopupRequest popupRequest)
   {
      final StatusBarPopupMenu menu = popupRequest.getMenu();
      MenuItem defaultItem = popupRequest.getDefaultMenuItem();
      if (defaultItem != null)
      {
         menu.selectItem(defaultItem);
         Scheduler.get().scheduleFinally(new RepeatingCommand()
         {
            public boolean execute()
            {
               menu.ensureSelectedIsVisible();
               return false;
            }
         });
      }
      menu.showRelativeToUpward((UIObject) statusBar_.getScope());
   }
View Full Code Here

TOP

Related Classes of org.rstudio.studio.client.workbench.views.source.editors.text.status.StatusBarPopupMenu

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.