Package org.jboss.forge.addon.shell.ui

Examples of org.jboss.forge.addon.shell.ui.ShellContextImpl


   @Override
   public CommandContainer getCommand(String name, String completeLine) throws CommandNotFoundException
   {
      waitUntilStarted();
     
      ShellContextImpl shellContext = shell.createUIContext();
      try
      {
         return getForgeCommand(shellContext, name, completeLine);
      }
      catch (CommandNotFoundException cnfe)
View Full Code Here


   @Override
   public InputStream getManualDocument(String command)
   {
      for (UICommand cmd : manager.getAllCommands())
      {
         ShellContextImpl context = shell.newShellContext();
         try
         {
            if (command.equals(manager.getCommandName(context, cmd)))
            {
               Class<? extends UICommand> commandType = cmd.getMetadata(context).getType();
               InputStream stream = null;
               for (String ext : extensions)
               {
                  stream = commandType.getClassLoader().getResourceAsStream(
                           commandType.getName().replaceAll("\\.", File.separator) + "." + ext);
                  if (stream != null)
                     return stream;
               }
            }
         }
         finally
         {
            context.destroy();
         }
      }
      return null;
   }
View Full Code Here

      }
   }

   private CommandContainer getForgeCommand(String name, String completeLine) throws CommandNotFoundException
   {
      ShellContextImpl shellContext = shell.newShellContext();
      AbstractShellInteraction cmd = commandManager.findCommand(shellContext, name);
      if (cmd == null)
      {
         throw new CommandNotFoundException(name);
      }
      try
      {
         CommandLineParser parser = cmd.getParser(shellContext, completeLine == null ? name : completeLine);
         CommandAdapter command = new CommandAdapter(shell, cmd);
         return new AeshCommandContainer(parser, command);
      }
      catch (Exception e)
      {
         throw new RuntimeException("Error while creating parser: " + e.getMessage(), e);
      }
      finally
      {
         shellContext.destroy();
      }
   }
View Full Code Here

      return allCommands;
   }

   private Set<String> getForgeCommandNames()
   {
      ShellContextImpl newShellContext = shell.newShellContext();
      try
      {
         return commandManager.getAllCommandNames(newShellContext);
      }
      finally
      {
         newShellContext.destroy();
      }
   }
View Full Code Here

   }

   public ShellContextImpl newShellContext()
   {
      Imported<UIContextListener> listeners = addonRegistry.getServices(UIContextListener.class);
      ShellContextImpl shellContextImpl = new ShellContextImpl(this, currentResource, listeners);
      return shellContextImpl;
   }
View Full Code Here

   }

   public ShellContextImpl createUIContext()
   {
      Imported<UIContextListener> listeners = addonRegistry.getServices(UIContextListener.class);
      ShellContextImpl shellContextImpl = new ShellContextImpl(this, currentResource, listeners);
      for (CommandExecutionListener listener : executionListeners)
      {
         shellContextImpl.addCommandExecutionListener(listener);
      }
      ExportManager exportManager = console.getExportManager();
      if (exportManager != null)
      {
         Map<Object, Object> attributeMap = shellContextImpl.getAttributeMap();
         for (String variableName : exportManager.getAllNames())
         {
            // Variable name ends with "=". Aesh Bug?
            if (variableName.endsWith("="))
            {
View Full Code Here

   }

   public ShellContextImpl createUIContext()
   {
      Imported<UIContextListener> listeners = addonRegistry.getServices(UIContextListener.class);
      ShellContextImpl shellContextImpl = new ShellContextImpl(this, currentResource, listeners);
      for (CommandExecutionListener listener : executionListeners)
      {
         shellContextImpl.addCommandExecutionListener(listener);
      }
      ExportManager exportManager = console.getExportManager();
      if (exportManager != null)
      {
         Map<Object, Object> attributeMap = shellContextImpl.getAttributeMap();
         for (String variableName : exportManager.getAllNames())
         {
            String variableValue = exportManager.getValue(variableName);
            attributeMap.put(variableName, variableValue);
         }
View Full Code Here

   }

   public ShellContextImpl newShellContext()
   {
      Imported<UIContextListener> listeners = addonRegistry.getServices(UIContextListener.class);
      ShellContextImpl shellContextImpl = new ShellContextImpl(this, currentResource, listeners);
      return shellContextImpl;
   }
View Full Code Here

      }
   }

   private CommandContainer getForgeCommand(String name, String completeLine) throws CommandNotFoundException
   {
      ShellContextImpl shellContext = shell.newShellContext();
      AbstractShellInteraction cmd = commandManager.findCommand(shellContext, name);
      if (cmd == null)
      {
         throw new CommandNotFoundException(name);
      }
      try
      {
         CommandLineParser parser = cmd.getParser(shellContext, completeLine == null ? name : completeLine);
         CommandAdapter command = new CommandAdapter(shell, cmd);
         return new AeshCommandContainer(parser, command);
      }
      catch (Exception e)
      {
         throw new RuntimeException("Error while creating parser: " + e.getMessage(), e);
      }
      finally
      {
         shellContext.destroy();
      }
   }
View Full Code Here

      return allCommands;
   }

   private Set<String> getForgeCommandNames()
   {
      ShellContextImpl newShellContext = shell.newShellContext();
      try
      {
         return commandManager.getAllCommandNames(newShellContext);
      }
      finally
      {
         newShellContext.destroy();
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.shell.ui.ShellContextImpl

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.