本文整理汇总了Java中org.jboss.forge.addon.ui.command.UICommand.getMetadata方法的典型用法代码示例。如果您正苦于以下问题:Java UICommand.getMetadata方法的具体用法?Java UICommand.getMetadata怎么用?Java UICommand.getMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.forge.addon.ui.command.UICommand
的用法示例。
在下文中一共展示了UICommand.getMetadata方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: addRecentCommand
import org.jboss.forge.addon.ui.command.UICommand; //导入方法依赖的package包/类
public synchronized void addRecentCommand(UICommand command, UIContext context)
{
UICommandMetadata metadata = command.getMetadata(context);
// To make sure it will be the last element on the list
recentCommands.remove(metadata.getName());
recentCommands.add(metadata.getName());
if (recentCommands.size() > RECENT_COMMANDS_LIMIT)
{
recentCommands.remove(0);
}
}
示例4: indexMetadata
import org.jboss.forge.addon.ui.command.UICommand; //导入方法依赖的package包/类
public static Map<UICommand, UICommandMetadata> indexMetadata(List<UICommand> commands, UIContext context)
{
Map<UICommand, UICommandMetadata> index = new HashMap<>();
for (UICommand command : commands)
{
UICommandMetadata metadata = command.getMetadata(context);
index.put(command, metadata);
}
return index;
}
示例5: setup
import org.jboss.forge.addon.ui.command.UICommand; //导入方法依赖的package包/类
public void setup(File repoDir)
{
furnace = FurnaceFactory.getInstance(Thread.currentThread().getContextClassLoader(), Thread.currentThread().getContextClassLoader());
furnace.addRepository(AddonRepositoryMode.IMMUTABLE, repoDir);
Future<Furnace> future = furnace.startAsync();
try
{
future.get();
}
catch (InterruptedException | ExecutionException e)
{
throw new RuntimeException("Furnace failed to start.", e);
}
availableCommands = new HashMap<>();
AddonRegistry addonRegistry = furnace.getAddonRegistry();
commandFactory = addonRegistry.getServices(CommandFactory.class).get();
IDEUIContext context = new IDEUIContext();
for (UICommand cmd : commandFactory.getCommands())
{
UICommandMetadata metadata = cmd.getMetadata(context);
if (!availableCommands.containsKey(metadata.getCategory().getName()))
{
availableCommands.put(metadata.getCategory().getName(), new ArrayList<String>());
}
availableCommands.get(metadata.getCategory().getName()).add(metadata.getName());
}
controllerFactory = (CommandControllerFactory) addonRegistry
.getServices(CommandControllerFactory.class.getName()).get();
}