• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UICommand类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jboss.forge.addon.ui.command.UICommand的典型用法代码示例。如果您正苦于以下问题:Java UICommand类的具体用法?Java UICommand怎么用?Java UICommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UICommand类属于org.jboss.forge.addon.ui.command包,在下文中一共展示了UICommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getCommandInput

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
@Override
@GET
@Path("/commandInput/{name}/{namespace}/{projectName}/{path: .*}")
@Produces(MediaType.APPLICATION_JSON)
public Response getCommandInput(@PathParam("name") final String name,
                                @PathParam("namespace") String namespace, @PathParam("projectName") String projectName,
                                @PathParam("path") String resourcePath) throws Exception {
    return withUIContext(namespace, projectName, resourcePath, false, new RestUIFunction<Response>() {
        @Override
        public Response apply(RestUIContext context) throws Exception {
            CommandInputDTO answer = null;
            UICommand command = getCommandByName(context, name);
            if (command != null) {
                CommandController controller = createController(context, command);
                answer = UICommands.createCommandInputDTO(context, command, controller);
            }
            if (answer != null) {
                return Response.ok(answer).build();
            } else {
                return Response.status(Status.NOT_FOUND).build();
            }
        }
    });
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:25,代码来源:CommandsResource.java


示例2: getRecentCommands

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
public synchronized List<UICommand> getRecentCommands(List<UICommand> commands, UIContext context)
{
   List<UICommand> enabledList = new ArrayList<>();

   for (UICommand command : commands)
   {
      UICommandMetadata metadata = command.getMetadata(context);

      // It's necessary to check if the command is still apparent on the list
      if (recentCommands.contains(metadata.getName()) && Commands.isEnabled(command, context))
      {
         enabledList.add(command);
      }
   }

   return enabledList;
}
 
开发者ID:forge,项目名称:intellij-idea-plugin,代码行数:18,代码来源:PluginService.java


示例3: getEnabledCommands

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
public synchronized List<UICommand> getEnabledCommands(UIContext uiContext)
{
   List<UICommand> result;

   if (isCacheCommands())
   {
      result = commandLoadingThread.getCommands(uiContext);
      commandLoadingThread.reload(uiContext);
   }
   else
   {
      result = CommandUtil.getEnabledCommands(uiContext);
   }

   return result;
}
 
开发者ID:forge,项目名称:intellij-idea-plugin,代码行数:17,代码来源:PluginService.java


示例4: run

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
@Override
public void run()
{
   UIContext uiContext = UIContextFactory.create(project, editor, selectedFiles);

   List<UICommand> candidates = PluginService.getInstance().getEnabledCommands(uiContext);

   JBPopup list = new CommandListPopupBuilder()
            .setUIContext(uiContext)
            .setCommands(candidates)
            .setRecentCommands(PluginService.getInstance().getRecentCommands(candidates, uiContext))
            .build();

   if (project != null)
   {
      list.showCenteredInCurrentWindow(project);
   }
   else
   {
      list.showInCenterOf(component);
   }
}
 
开发者ID:forge,项目名称:intellij-idea-plugin,代码行数:23,代码来源:CommandListPopupCallBack.java


示例5: build

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
public JBPopup build()
{
   active = true;

   List<UICommand> allCommands = new ArrayList<>();
   allCommands.addAll(commands);
   allCommands.addAll(recentCommmands);

   Map<UICommand, UICommandMetadata> metadataIndex = indexMetadata(allCommands, uiContext);
   Map<String, List<UICommand>> categories = categorizeCommands(commands, recentCommmands, metadataIndex);
   List<Object> elements = categoriesToList(sortCategories(categories, metadataIndex));
   Map<Object, String> filterIndex = indexFilterData(elements, categories, metadataIndex);

   JBList list = buildJBList(elements, metadataIndex);

   return buildPopup(list, filterIndex);
}
 
开发者ID:forge,项目名称:intellij-idea-plugin,代码行数:18,代码来源:CommandListPopupBuilder.java


示例6: categorizeCommands

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
public static Map<String, List<UICommand>> categorizeCommands(List<UICommand> commands,
                                                              List<UICommand> recentCommands,
                                                              Map<UICommand, UICommandMetadata> index)
{
    Map<String, List<UICommand>> categories = new HashMap<>();

    for (UICommand command : commands)
    {
        UICommandMetadata metadata = index.get(command);
        String category = categoryName(metadata.getCategory());

        if (!categories.containsKey(category))
        {
            categories.put(category, new ArrayList<UICommand>());
        }

        categories.get(category).add(command);
    }

    if (!recentCommands.isEmpty())
    {
        categories.put(RECENT_COMMANDS, recentCommands);
    }

    return categories;
}
 
开发者ID:forge,项目名称:intellij-idea-plugin,代码行数:27,代码来源:CommandUtil.java


示例7: getCommand

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
private CommandController getCommand(String name, Path initialPath, HttpHeaders headers) throws Exception {
    RestUIContext context = createUIContext(initialPath, headers);
    UICommand command = commandFactory.getNewCommandByName(context, commandMap.get(name));
    CommandController controller = controllerFactory.createController(context,
                                                                      new RestUIRuntime(Collections.emptyList()), command);
    controller.initialize();
    return controller;
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:9,代码来源:LaunchResource.java


示例8: wrap

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
static JavaSourceCommandWrapper wrap(UICommand toWrap, JavaSourceDecorator<JavaClassSource> decorator) {
   if (toWrap instanceof AbstractJavaSourceCommand) {
      AbstractJavaSourceCommand wrapped = (AbstractJavaSourceCommand<JavaClassSource>) toWrap;
      return new JavaSourceCommandWrapper(wrapped, decorator);
   }
   throw new IllegalArgumentException(toWrap + " is not a subclass of " + AbstractJavaSourceCommand.class);
}
 
开发者ID:forge,项目名称:springboot-addon,代码行数:8,代码来源:JavaSourceCommandWrapper.java


示例9: transform

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
@Override
public UICommand transform(UIContext context, UICommand original)
{
   final Project project = helper.getProject(context);
   if (project != null && project.hasFacet(SpringBootFacet.class))
   {
      if (original instanceof org.jboss.forge.addon.javaee.rest.ui.RestNewEndpointCommand)
      {
         return JavaSourceCommandWrapper.wrap(original,
                  new RestNewEndpointDecorator((RestNewEndpointCommand) original));
      }

      if (original instanceof JPASetupWizard)
      {
         return jpaSetupWizard.get();
      }

      if (original instanceof JPANewEntityCommand)
      {
         return JavaSourceCommandWrapper.wrap(original,
                  new CreateSpringBootJPASupportDecorator((AbstractJavaSourceCommand) original));
      }

      if (original.getClass().getName().contains("RestEndpointFromEntityCommand"))
      {
         return new RestGenerateFromEntitiesCommand(original, helper);
      }

      if (original.getClass().getName().contains("CrossOriginResourceSharingFilterCommand"))
      {
         return new RestCORSFilterCommand((AbstractJavaSourceCommand<JavaClassSource>) original);
      }
   }

   return original;
}
 
开发者ID:forge,项目名称:springboot-addon,代码行数:37,代码来源:SpringBootCommandTransformer.java


示例10: useCommand

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
protected void useCommand(RestUIContext context, String commandName, boolean shouldExecute) {
    try {
        UICommand command = commandFactory.getCommandByName(context, commandName);
        if (command == null) {
            LOG.warn("No such command! '" + commandName + "'");
            return;
        }
        CommandController controller = commandControllerFactory.createController(context, runtime, command);
        if (controller == null) {
            LOG.warn("No such controller! '" + commandName + "'");
            return;
        }
        controller.initialize();
        WizardCommandController wizardCommandController = assertWizardController(controller);

        Map<String, InputComponent<?, ?>> inputs = controller.getInputs();
        Set<Map.Entry<String, InputComponent<?, ?>>> entries = inputs.entrySet();
        for (Map.Entry<String, InputComponent<?, ?>> entry : entries) {
            String key = entry.getKey();
            InputComponent component = entry.getValue();
            Object value = InputComponents.getValueFor(component);
            Object completions = null;
            UICompleter<?> completer = InputComponents.getCompleterFor(component);
            if (completer != null) {
                completions = completer.getCompletionProposals(context, component, "");
            }
            LOG.info(key + " = " + component + " value: " + value + " completions: " + completions);
        }
        validate(controller);
        wizardCommandController = wizardCommandController.next();

        if (shouldExecute) {
            Result result = controller.execute();
            printResult(result);
        }
    } catch (Exception e) {
        LOG.error("Failed to create the " + commandName + " controller! " + e, e);
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:40,代码来源:ProjectGenerator.java


示例11: createCommandInfoDTO

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
public static CommandInfoDTO createCommandInfoDTO(RestUIContext context, UICommand command) {
    CommandInfoDTO answer;
    UICommandMetadata metadata = command.getMetadata(context);
    String metadataName = unshellifyName(metadata.getName());
    String id = shellifyName(metadataName);
    String description = metadata.getDescription();
    String category = toStringOrNull(metadata.getCategory());
    String docLocation = toStringOrNull(metadata.getDocLocation());
    boolean enabled = command.isEnabled(context);
    answer = new CommandInfoDTO(id, metadataName, description, category, docLocation, enabled);
    return answer;
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:13,代码来源:UICommands.java


示例12: createCommandInputDTO

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
public static CommandInputDTO createCommandInputDTO(RestUIContext context, UICommand command, CommandController controller) throws Exception {
    CommandInfoDTO info = createCommandInfoDTO(context, command);
    CommandInputDTO inputInfo = new CommandInputDTO(info);
    Map<String, InputComponent<?, ?>> inputs = controller.getInputs();
    if (inputs != null) {
        Set<Map.Entry<String, InputComponent<?, ?>>> entries = inputs.entrySet();
        for (Map.Entry<String, InputComponent<?, ?>> entry : entries) {
            String key = entry.getKey();
            InputComponent<?, ?> input = entry.getValue();
            PropertyDTO dto = UICommands.createInputDTO(context, input);
            inputInfo.addProperty(key, dto);
        }
    }
    return inputInfo;
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:16,代码来源:UICommands.java


示例13: createCommandInfoDTO

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
protected CommandInfoDTO createCommandInfoDTO(RestUIContext context, String name) {
    CommandInfoDTO answer = null;
    if (isValidCommandName(name)) {
        UICommand command = getCommandByName(context, name);
        if (command != null) {
            answer = UICommands.createCommandInfoDTO(context, command);
        }
    }
    return answer;
        
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:12,代码来源:CommandsResource.java


示例14: createController

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
protected CommandController createController(RestUIContext context, UICommand command) throws Exception {
    RestUIRuntime runtime = new RestUIRuntime();
    CommandController controller = commandControllerFactory.createController(context, runtime,
            command);
    controller.initialize();
    return controller;
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:8,代码来源:CommandsResource.java


示例15: getCommand

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
private CommandController getCommand(String name, Path initialPath, HttpHeaders headers) throws Exception
{
   RestUIContext context = createUIContext(initialPath, headers);
   UICommand command = commandFactory.getNewCommandByName(context, commandMap.get(name));
   CommandController controller = controllerFactory.createController(context,
            new RestUIRuntime(Collections.emptyList()), command);
   controller.initialize();
   return controller;
}
 
开发者ID:fabric8-launcher,项目名称:launchpad-backend,代码行数:10,代码来源:LaunchResource.java


示例16: testWildflySwarmSetup

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
@Test
public void testWildflySwarmSetup() throws Exception
{
   try (CommandController controller = uiTestHarness.createCommandController(SetupCommand.class,
            project.getRoot()))
   {
      controller.initialize();
      Assert.assertTrue(controller.isValid());
      final AtomicBoolean flag = new AtomicBoolean();
      controller.getContext().addCommandExecutionListener(new AbstractCommandExecutionListener()
      {
         @Override
         public void postCommandExecuted(UICommand command, UIExecutionContext context, Result result)
         {
            if (result.getMessage().equals("WildFly Swarm is now set up! Enjoy!"))
            {
               flag.set(true);
            }
         }
      });
      controller.execute();
      Assert.assertTrue(flag.get());
      WildFlySwarmFacet facet = project.getFacet(WildFlySwarmFacet.class);
      Assert.assertTrue(facet.isInstalled());

      MavenPluginAdapter swarmPlugin = (MavenPluginAdapter) project.getFacet(MavenPluginFacet.class)
               .getEffectivePlugin(WildFlySwarmFacet.PLUGIN_COORDINATE);
      Assert.assertEquals("wildfly-swarm-plugin", swarmPlugin.getCoordinate().getArtifactId());
      Assert.assertEquals(1, swarmPlugin.getExecutions().size());
      Assert.assertEquals(0, swarmPlugin.getConfig().listConfigurationElements().size());
   }
}
 
开发者ID:forge,项目名称:wildfly-swarm-addon,代码行数:33,代码来源:SetupCommandTest.java


示例17: testWildflySwarmSetupWithNullParameters

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
@Test
public void testWildflySwarmSetupWithNullParameters() throws Exception
{
   try (CommandController controller = uiTestHarness.createCommandController(SetupCommand.class,
            project.getRoot()))
   {
      controller.initialize();
      controller.setValueFor("httpPort", null);
      controller.setValueFor("contextPath", null);
      controller.setValueFor("portOffset", null);
      Assert.assertTrue(controller.isValid());

      final AtomicBoolean flag = new AtomicBoolean();
      controller.getContext().addCommandExecutionListener(new AbstractCommandExecutionListener()
      {
         @Override
         public void postCommandExecuted(UICommand command, UIExecutionContext context, Result result)
         {
            if (result.getMessage().equals("WildFly Swarm is now set up! Enjoy!"))
            {
               flag.set(true);
            }
         }
      });
      controller.execute();
      Assert.assertTrue(flag.get());
      WildFlySwarmFacet facet = project.getFacet(WildFlySwarmFacet.class);
      Assert.assertTrue(facet.isInstalled());

      MavenPluginAdapter swarmPlugin = (MavenPluginAdapter) project.getFacet(MavenPluginFacet.class)
               .getEffectivePlugin(WildFlySwarmFacet.PLUGIN_COORDINATE);
      Assert.assertEquals("wildfly-swarm-plugin", swarmPlugin.getCoordinate().getArtifactId());
      Assert.assertEquals(1, swarmPlugin.getExecutions().size());
      Assert.assertEquals(0, swarmPlugin.getConfig().listConfigurationElements().size());
   }
}
 
开发者ID:forge,项目名称:wildfly-swarm-addon,代码行数:37,代码来源:SetupCommandTest.java


示例18: testWildflySwarmSetupWithZeroParameters

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
@Test
public void testWildflySwarmSetupWithZeroParameters() throws Exception
{
   try (CommandController controller = uiTestHarness.createCommandController(SetupCommand.class,
            project.getRoot()))
   {
      controller.initialize();
      controller.setValueFor("httpPort", 0);
      controller.setValueFor("portOffset", 0);
      Assert.assertTrue(controller.isValid());

      final AtomicBoolean flag = new AtomicBoolean();
      controller.getContext().addCommandExecutionListener(new AbstractCommandExecutionListener()
      {
         @Override
         public void postCommandExecuted(UICommand command, UIExecutionContext context, Result result)
         {
            if (result.getMessage().equals("WildFly Swarm is now set up! Enjoy!"))
            {
               flag.set(true);
            }
         }
      });
      controller.execute();
      Assert.assertTrue(flag.get());
      WildFlySwarmFacet facet = project.getFacet(WildFlySwarmFacet.class);
      Assert.assertTrue(facet.isInstalled());

      MavenPluginAdapter swarmPlugin = (MavenPluginAdapter) project.getFacet(MavenPluginFacet.class)
               .getEffectivePlugin(WildFlySwarmFacet.PLUGIN_COORDINATE);
      Assert.assertEquals("wildfly-swarm-plugin", swarmPlugin.getCoordinate().getArtifactId());
      Assert.assertEquals(1, swarmPlugin.getExecutions().size());
      Assert.assertEquals(0, swarmPlugin.getConfig().listConfigurationElements().size());
   }
}
 
开发者ID:forge,项目名称:wildfly-swarm-addon,代码行数:36,代码来源:SetupCommandTest.java


示例19: testExecution

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
@Test
public void testExecution() throws Exception
{
   Assert.assertTrue(project.hasFacet(WildFlySwarmFacet.class));
   try (CommandController controller = uiTestHarness.createCommandController(CreateMainClassCommand.class,
            project.getRoot()))
   {
      controller.initialize();
      controller.setValueFor("targetPackage", "org.example");
      Assert.assertTrue(controller.isValid());
      final AtomicBoolean flag = new AtomicBoolean();
      controller.getContext().addCommandExecutionListener(new AbstractCommandExecutionListener()
      {
         @Override
         public void postCommandExecuted(UICommand command, UIExecutionContext context, Result result)
         {
            if (result.getMessage().equals("Main Class org.example.Main was created"))
            {
               flag.set(true);
            }
         }
      });
      controller.execute();
      Assert.assertTrue("Class not created", flag.get());
   }
   JavaResource javaResource = project.getFacet(JavaSourceFacet.class).getJavaResource("org.example.Main");
   Assert.assertTrue(javaResource.exists());
   WildFlySwarmFacet facet = project.getFacet(WildFlySwarmFacet.class);
   Assert.assertEquals("org.example.Main", facet.getConfiguration().getMainClass());
}
 
开发者ID:forge,项目名称:wildfly-swarm-addon,代码行数:31,代码来源:CreateMainClassCommandTest.java


示例20: getSetupFlow

import org.jboss.forge.addon.ui.command.UICommand; //导入依赖的package包/类
@Override
public NavigationResult getSetupFlow(ScaffoldSetupContext setupContext)
{
   Project project = setupContext.getProject();
   NavigationResultBuilder builder = NavigationResultBuilder.create();
   List<Class<? extends UICommand>> setupCommands = new ArrayList<>();
   if (!project.hasFacet(JPAFacet.class))
   {
      builder.add(JPASetupWizard.class);
   }
   if (!project.hasFacet(CDIFacet.class))
   {
      setupCommands.add(CDISetupCommand.class);
   }
   if (!project.hasFacet(EJBFacet.class))
   {
      setupCommands.add(EJBSetupWizard.class);
   }
   if (!project.hasFacet(ServletFacet.class))
   {
      // TODO: FORGE-1296. Ensure that this wizard only sets up Servlet 3.0+
      setupCommands.add(ServletSetupWizard.class);
   }
   if (!project.hasFacet(RestFacet.class))
   {
      setupCommands.add(RestSetupWizard.class);
   }

   if (setupCommands.size() > 0)
   {
      Metadata compositeSetupMetadata = Metadata.forCommand(setupCommands.get(0))
               .name("Setup Facets")
               .description("Setup all dependent facets for the AngularJS scaffold.");
      builder.add(compositeSetupMetadata, setupCommands);
   }
   return builder.build();
}
 
开发者ID:forge,项目名称:angularjs-addon,代码行数:38,代码来源:AngularScaffoldProvider.java



注:本文中的org.jboss.forge.addon.ui.command.UICommand类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NullChange类代码示例发布时间:2022-05-22
下一篇:
Java Anchor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap