Examples of UICommandMetadata


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

      List<String> display = new ArrayList<>();

      Iterable<UICommand> commands = commandFactory.getCommands();
      for (UICommand command : commands)
      {
         UICommandMetadata metadata = command.getMetadata(uiContext);
         String name = commandFactory.getCommandName(uiContext, command);
         boolean enabled = command.isEnabled(uiContext);
         display.add(metadata.getCategory()
                  + " > "
                  + new TerminalString(name, new TerminalColor(enabled ? Color.CYAN : Color.RED,
                           Color.DEFAULT)).toString() + " - " + metadata.getDescription());
      }
      UIOutput output = uiContext.getProvider().getOutput();
      PrintStream out = output.out();
      out.println(Parser.formatDisplayList(display.toArray(new String[display.size()]),
               terminalSize.getHeight(), terminalSize.getWidth()));
View Full Code Here

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

      Assert.assertNotNull(commands);

      int count = 0;
      for (UICommand command : commands)
      {
         UICommandMetadata metadata = command.getMetadata(new MockUIContext());
         Assert.assertTrue(ExampleCommand.class.equals(metadata.getType())
                  || ExampleNoUICommand.class.equals(metadata.getType())
                  || ExampleAnnotatedCommand.class.equals(metadata.getType())
                  || DifferentNameCommand.class.equals(metadata.getType())
                  );
         count++;
      }

      Assert.assertEquals(6, count);
View Full Code Here

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

      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

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

      UIContextImpl context = getUIContextInstance(initialSelection);
      for (UICommand command : commands)
      {
         if (command instanceof UIWizard)
         {
            UICommandMetadata metadata = command.getMetadata(context);
            if (name.equals(metadata.getName()))
            {
               result = factory.createWizardController(context, getUIRuntimeInstance(), (UIWizard) command);
               break;
            }
         }
View Full Code Here

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

   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

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

   @Test
   public void testCommandMetadata() throws Exception
   {
      try (CommandController controller = testHarness.createCommandController("Annotation Commands: Number 1"))
      {
         UICommandMetadata metadata = controller.getMetadata();
         Assert.assertEquals("Annotation Commands: Number 1", metadata.getName());
         Assert.assertEquals(Categories.create("Root", "Branch"), metadata.getCategory());
      }
      try (CommandController controller = testHarness.createCommandController("Annotation Commands: Number 2"))
      {
         UICommandMetadata metadata = controller.getMetadata();
         Assert.assertEquals("Annotation Commands: Number 2", metadata.getName());
         Assert.assertEquals(Categories.createDefault(), metadata.getCategory());
      }
   }
View Full Code Here

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

{

   @Test
   public void testMetadataBuilder()
   {
      UICommandMetadata metadata = new MockCommand().getMetadata(null);
      Assert.assertEquals(MockCommand.class.getName(), metadata.getName());
      Assert.assertEquals(Categories.createDefault(), metadata.getCategory());
      Assert.assertEquals(UICommandMetadata.NO_DESCRIPTION, metadata.getDescription());
      Assert.assertEquals(MockCommand.class.getResource("MockCommand.txt"), metadata.getDocLocation());
   }
View Full Code Here

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

   }

   @Test
   public void testMetadataBuilderNameOverride()
   {
      UICommandMetadata metadata = new MockCommand3().getMetadata(null);
      Assert.assertEquals("A Name", metadata.getName());
      Assert.assertEquals(Categories.createDefault(), metadata.getCategory());
      Assert.assertEquals(UICommandMetadata.NO_DESCRIPTION, metadata.getDescription());
      Assert.assertNull(metadata.getDocLocation());
   }
View Full Code Here

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

   }

   @Test
   public void testMetadataBuilderWithDescriptionAndCategory()
   {
      UICommandMetadata metadata = new MockCommand2().getMetadata(null);
      Assert.assertEquals(MockCommand2.class.getName(), metadata.getName());
      Assert.assertNotNull(metadata.getCategory());
      Assert.assertEquals("A Category", metadata.getCategory().getName());
      Assert.assertNull(metadata.getCategory().getSubCategory());
      Assert.assertEquals("A Description", metadata.getDescription());
      Assert.assertNull(metadata.getDocLocation());
   }
View Full Code Here

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

      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
TOP
Copyright © 2018 www.massapi.com. 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.