Package org.jboss.forge.addon.ui.metadata

Examples of org.jboss.forge.addon.ui.metadata.UICommandMetadata


      {
         ShellContext shellContext = (ShellContext) uiContext;
         if (shellContext.isVerbose() && failure != null)
         {
            PrintStream err = shellContext.getProvider().getOutput().err();
            UICommandMetadata metadata = command.getMetadata(shellContext);
            if (metadata != null)
               ShellMessages.error(err, "Error while executing '" + metadata.getName() + "'");
            failure.printStackTrace(err);
         }
      }
   }
View Full Code Here


   }

   private ProcessedCommand generateCommand(final CommandController command, final ShellContext shellContext,
            final Map<String, InputComponent<?, ?>> inputs)
   {
      UICommandMetadata metadata = (command instanceof WizardCommandController) ? ((WizardCommandController) command)
               .getInitialMetadata() : command.getMetadata();
      String cmdName = ShellUtil.shellifyName(metadata.getName()).toLowerCase();
      String cmdDescription = metadata.getDescription();
      final ProcessedCommand parameter = new ProcessedCommand(cmdName, cmdDescription,
               (Class<? extends CommandValidator<?>>) null, null);

      for (Entry<String, InputComponent<?, ?>> entry : inputs.entrySet())
      {
View Full Code Here

   {
      String result = "!!! Failed to load Metadata via `" + UICommand.class.getName()
               + ".getMetadata(UIContext ctx)` !!!";
      try
      {
         UICommandMetadata metadata = command.getMetadata(context);
         result = metadata.toString();
      }
      catch (Exception e)
      {
         log.log(Level.SEVERE, "Could not call method " + UICommand.class.getName()
                  + "`getMetadata(UIContext ctx)` of type [" + command + "].", e);
View Full Code Here

               {
                  command = null;
               }
               else
               {
                  UICommandMetadata metadata = subflow.peek().controller.getCommand().getMetadata(context);
                  command = createCommand((Class<? extends UICommand>) metadata.getType());
               }
            }
            else
            {
               command = createCommand(result[0]);
View Full Code Here

   public CommandLineParser generateParser(UICommand command,
            Map<String, InputComponent<?, Object>> inputs)
   {
      ParserBuilder builder = new ParserBuilder();

      UICommandMetadata metadata = command.getMetadata();
      CommandInt parameter = new CommandInt(ShellUtil.shellifyName(metadata.getName()), metadata.getDescription());

      for (InputComponent<?, Object> input : inputs.values())
      {
         Object defaultValue = InputComponents.getValueFor(input);
         boolean isMultiple = input instanceof ManyValued;
View Full Code Here

   public String getCommandName(UIContext context, UICommand cmd)
   {
      String name = null;
      try
      {
         UICommandMetadata metadata = cmd.getMetadata(context);
         name = metadata.getName();
         if (!context.getProvider().isGUI())
         {
            name = shellifyName(name);
         }
      }
View Full Code Here

      CommandController result = null;
      Iterable<UICommand> commands = commandFactory.getCommands();
      UIContextImpl context = getUIContextInstance(initialSelection);
      for (UICommand command : commands)
      {
         UICommandMetadata metadata = command.getMetadata(context);
         if (name.equals(metadata.getName()))
         {
            result = factory.createSingleController(context, getUIRuntimeInstance(), command);
            break;
         }
      }
View Full Code Here

   }

   private ProcessedCommand generateCommand(final CommandController command, final ShellContext shellContext,
            final Map<String, InputComponent<?, ?>> inputs)
   {
      UICommandMetadata metadata = (command instanceof WizardCommandController) ? ((WizardCommandController) command)
               .getInitialMetadata() : command.getMetadata();
      ProcessedCommand parameter = new ProcessedCommand(ShellUtil.shellifyName(metadata.getName()),
               metadata.getDescription(), ForgeCommandValidator.INSTANCE);

      for (final InputComponent<?, ?> input : inputs.values())
      {
         final Object defaultValue = InputComponents.getValueFor(input);
         final boolean isMultiple = input instanceof ManyValued;
View Full Code Here

      }

      for (CommandController controller : controllers)
      {
         String name = manager.getCommandName(context.getUIContext(), controller.getCommand());
         UICommandMetadata metadata = controller.getMetadata();
         display.add(metadata.getCategory()
                  + " > "
                  + new TerminalString(name, new TerminalColor(controller.isEnabled() ? Color.CYAN : Color.RED,
                           Color.DEFAULT)).toString() + " - " + metadata.getDescription());
      }

      UIOutput output = context.getUIContext().getProvider().getOutput();
      PrintStream out = output.out();
      out.println(Parser.formatDisplayList(display.toArray(new String[display.size()]),
View Full Code Here

               {
                  command = null;
               }
               else
               {
                  UICommandMetadata metadata = subflow.peek().controller.getCommand().getMetadata(context);
                  command = createCommand((Class<? extends UICommand>) metadata.getType());
               }
            }
            else
            {
               command = createCommand(result[0]);
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.ui.metadata.UICommandMetadata

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.