本文整理汇总了Java中com.intellij.platform.ProjectTemplate类的典型用法代码示例。如果您正苦于以下问题:Java ProjectTemplate类的具体用法?Java ProjectTemplate怎么用?Java ProjectTemplate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectTemplate类属于com.intellij.platform包,在下文中一共展示了ProjectTemplate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createTemplates
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
@NotNull
@Override
public ProjectTemplate[] createTemplates(@Nullable String group, WizardContext context) {
// myGroups contains only not-null keys
if (group == null) {
return ProjectTemplate.EMPTY_ARRAY;
}
List<ProjectTemplate> templates = null;
for (Pair<URL, ClassLoader> url : myGroups.getValue().get(group)) {
try {
for (String child : UrlUtil.getChildrenRelativePaths(url.first)) {
if (child.endsWith(ZIP)) {
if (templates == null) {
templates = new SmartList<ProjectTemplate>();
}
templates.add(new LocalArchivedTemplate(new URL(url.first.toExternalForm() + '/' + child), url.second));
}
}
}
catch (IOException e) {
LOG.error(e);
}
}
return ContainerUtil.isEmpty(templates) ? ProjectTemplate.EMPTY_ARRAY : templates.toArray(new ProjectTemplate[templates.size()]);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ArchivedTemplatesFactory.java
示例2: validate
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
@Override
public boolean validate() throws ConfigurationException {
ProjectTemplate template = getSelectedTemplate();
if (template == null) {
throw new ConfigurationException(StringUtil.capitalize(ProjectBundle.message("project.new.wizard.from.template.error", myWizardContext.getPresentationName())), "Error");
}
if (myWizardContext.isCreatingNewProject()) {
if (!myNamePathComponent.validateNameAndPath(myWizardContext, myFormatPanel.isDefault())) return false;
}
if (!myModuleNameLocationComponent.validateModulePaths()) return false;
if (!myWizardContext.isCreatingNewProject()) {
myModuleNameLocationComponent.validateExistingModuleName(myWizardContext.getProject());
}
ValidationInfo info = template.validateSettings();
if (info != null) {
throw new ConfigurationException(info.message, "Error");
}
if (mySettingsStep != null) {
return mySettingsStep.validate();
}
return true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:SelectTemplateStep.java
示例3: getTemplatesMap
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
public static MultiMap<TemplatesGroup, ProjectTemplate> getTemplatesMap(WizardContext context) {
ProjectTemplatesFactory[] factories = ProjectTemplatesFactory.EP_NAME.getExtensions();
final MultiMap<TemplatesGroup, ProjectTemplate> groups = new MultiMap<TemplatesGroup, ProjectTemplate>();
for (ProjectTemplatesFactory factory : factories) {
for (String group : factory.getGroups()) {
ProjectTemplate[] templates = factory.createTemplates(group, context);
List<ProjectTemplate> values = Arrays.asList(templates);
if (!values.isEmpty()) {
Icon icon = factory.getGroupIcon(group);
String parentGroup = factory.getParentGroup(group);
TemplatesGroup templatesGroup = new TemplatesGroup(group, null, icon, factory.getGroupWeight(group), parentGroup, group, null);
groups.putValues(templatesGroup, values);
}
}
}
return groups;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:CreateFromTemplateMode.java
示例4: getAvailableTemplates
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
public Collection<ProjectTemplate> getAvailableTemplates() {
if (myCurrentCard != FRAMEWORKS_CARD) {
return Collections.emptyList();
}
else {
Collection<ProjectTemplate> templates = myTemplatesMap.get(getSelectedGroup());
List<FrameworkSupportNode> nodes = myFrameworksPanel.getSelectedNodes();
if (nodes.isEmpty()) return templates;
final List<String> selectedFrameworks = ContainerUtil.map(nodes, NODE_STRING_FUNCTION);
return ContainerUtil.filter(templates, new Condition<ProjectTemplate>() {
@Override
public boolean value(ProjectTemplate template) {
if (!(template instanceof ArchivedProjectTemplate)) return true;
List<String> frameworks = ((ArchivedProjectTemplate)template).getFrameworks();
return frameworks.containsAll(selectedFrameworks);
}
});
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ProjectTypeStep.java
示例5: setTemplates
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
public void setTemplates(List<ProjectTemplate> list, boolean preserveSelection) {
Collections.sort(list, new Comparator<ProjectTemplate>() {
@Override
public int compare(ProjectTemplate o1, ProjectTemplate o2) {
return Comparing.compare(o1 instanceof ArchivedProjectTemplate, o2 instanceof ArchivedProjectTemplate);
}
});
int index = preserveSelection ? myList.getSelectedIndex() : -1;
//noinspection unchecked
myList.setModel(new CollectionListModel(list));
if (myList.isEnabled()) {
myList.setSelectedIndex(index == -1 ? 0 : index);
}
updateSelection();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ProjectTemplateList.java
示例6: createTemplates
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
@NotNull
@Override
public ProjectTemplate[] createTemplates(@Nullable String group, WizardContext context) {
Project project = context.getProject();
if (project != null && !Projects.isGradleProject(project)) {
return EMPTY_PROJECT_TEMPLATES;
}
TemplateManager manager = TemplateManager.getInstance();
List<File> templates = manager.getTemplates(Template.CATEGORY_PROJECTS);
List<ProjectTemplate> tt = new ArrayList<ProjectTemplate>();
for (File template : templates) {
final String templateName = template.getName();
if (NewProjectWizardState.PROJECT_TEMPLATE_NAME.equals(templateName) ||
NewProjectWizardState.IMPORT_EXISTING_PROJECT_TEMPLATE_NAME.equals(templateName) ||
project == null && !NewProjectWizardState.MODULE_TEMPLATE_NAME.equals(templateName)) {
continue;
}
TemplateMetadata metadata = manager.getTemplate(template);
if (metadata == null || !metadata.isSupported()) {
continue;
}
tt.add(new AndroidProjectTemplate(template, metadata, project, context.getDisposable()));
}
return tt.toArray(new ProjectTemplate[tt.size()]);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:TemplateWizardProjectTemplateFactory.java
示例7: createTemplates
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
@NotNull
@Override
public ProjectTemplate[] createTemplates(@Nullable final String group, final WizardContext wizardContext) {
if(!wizardContext.isCreatingNewProject()) {
// ignore new module wizard
return EMPTY_TEMPLATES;
}
final List<ProjectTemplate> templates = new ArrayList<ProjectTemplate>();
templates.add(new DefracProjectTemplate("Generic", "Creates a new Multi-Platform project with a main entry point", new DefracModuleBuilder.Generic()));
if(DefracPlatform.IOS.isAvailableOnHostOS()) {
templates.add(new DefracProjectTemplate("iOS", "Creates a new iOS project based on native UIKit components", new DefracModuleBuilder.IOS()));
}
templates.add(new DefracProjectTemplate("Empty", "Creates an empty Multi-Platform project", new DefracModuleBuilder.Empty()));
return templates.toArray(new ProjectTemplate[templates.size()]);
}
开发者ID:defrac,项目名称:defrac-plugin-intellij,代码行数:21,代码来源:DefracProjectTemplatesFactory.java
示例8: runWizard
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
protected void runWizard(String group, String name, Project project, @Nullable Consumer<ModuleWizardStep> adjuster) throws IOException {
createWizard(project);
SelectTemplateStep step = (SelectTemplateStep)myWizard.getCurrentStepObject();
boolean condition = step.setSelectedTemplate(group, name);
if (!condition) {
throw new IllegalArgumentException(group + "/" + name + " template not found");
}
ProjectTemplate template = step.getSelectedTemplate();
assertNotNull(template);
if (adjuster != null) {
adjuster.consume(step);
}
runWizard(adjuster);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:ProjectWizardTestCase.java
示例9: createTemplates
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
@NotNull
@Override
public ProjectTemplate[] createTemplates(String group, WizardContext context) {
Collection<Pair<URL, ClassLoader>> urls = myGroups.getValue().get(group);
List<ProjectTemplate> templates = new ArrayList<ProjectTemplate>();
for (Pair<URL, ClassLoader> url : urls) {
try {
List<String> children = UrlUtil.getChildrenRelativePaths(url.first);
for (String child : children) {
if (child.endsWith(ZIP)) {
URL templateUrl = new URL(url.first.toExternalForm() + "/" + child);
String name = child.substring(0, child.length() - ZIP.length()).replace('_', ' ');
templates.add(new LocalArchivedTemplate(name, templateUrl, url.second));
}
}
}
catch (IOException e) {
LOG.error(e);
}
}
return templates.toArray(new ProjectTemplate[templates.size()]);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:ArchivedTemplatesFactory.java
示例10: validate
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
@Override
public boolean validate() throws ConfigurationException {
ProjectTemplate template = getSelectedTemplate();
if (template == null) {
throw new ConfigurationException(StringUtil.capitalize(ProjectBundle.message("project.new.wizard.from.template.error", myWizardContext.getPresentationName())), "Error");
}
if (myWizardContext.isCreatingNewProject()) {
if (!myNamePathComponent.validateNameAndPath(myWizardContext, myFormatPanel.isDefault())) return false;
}
if (!validateModulePaths()) return false;
if (!myWizardContext.isCreatingNewProject()) {
validateExistingModuleName();
}
ValidationInfo info = template.validateSettings();
if (info != null) {
throw new ConfigurationException(info.message, "Error");
}
if (mySettingsStep != null) {
return mySettingsStep.validate();
}
return true;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:SelectTemplateStep.java
示例11: createTemplates
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
@NotNull
@Override
public ProjectTemplate[] createTemplates(@Nullable String group, WizardContext context) {
return new ProjectTemplate[]{
new TYPO3CMSClassicLayoutDirectoryProjectGenerator(),
new TYPO3CMSComposerLayoutDirectoryProjectGenerator()
};
}
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:9,代码来源:TYPO3CMSProjectTemplatesFactory.java
示例12: createTemplates
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
@NotNull
@Override
public ProjectTemplate[] createTemplates(@Nullable String group, WizardContext context) {
final ArrayList<EduIntelliJProjectTemplate> templates = new ArrayList<>();
final List<Course> courses = EduCourseUpdater.getInstance().getRemoteCourses();
for (Course course : courses) {
templates.add(new EduRemoteCourseTemplate(course));
}
Collections.addAll(templates, ApplicationManager.getApplication().getExtensions(EduIntelliJProjectTemplate.EP_NAME));
return templates.toArray(new ProjectTemplate[templates.size()]);
}
开发者ID:medvector,项目名称:educational-plugin,代码行数:12,代码来源:EduIntelliJTemplateFactory.java
示例13: createTemplates
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
@NotNull
@Override
public ProjectTemplate[] createTemplates(@Nullable String group, WizardContext context) {
return new ProjectTemplate[] {
new CatberryProjectGenerator()
};
}
开发者ID:catberry,项目名称:catberry-idea-plugin,代码行数:8,代码来源:CatberryProjectTemplateFactory.java
示例14: getHelpId
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
@Override
public String getHelpId() {
String helpId = myWizardContext.isCreatingNewProject() ? "New_Project_Main_Settings" : "Add_Module_Main_Settings";
ProjectTemplate projectTemplate = getSelectedTemplate();
if (projectTemplate instanceof WebProjectTemplate) {
WebProjectTemplate webProjectTemplate = (WebProjectTemplate) projectTemplate;
String subHelpId = webProjectTemplate.getHelpId();
if (subHelpId != null) {
helpId = helpId + ":" + subHelpId;
}
}
return helpId;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:SelectTemplateStep.java
示例15: setupPanels
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
private void setupPanels(@Nullable ProjectTemplate template) {
restorePanel(myNamePathComponent, 4);
restorePanel(getModulePanel(), myWizardContext.isCreatingNewProject() ? 8 : 6);
restorePanel(myExpertPanel, myWizardContext.isCreatingNewProject() ? 1 : 0);
if (mySettingsStep != null) mySettingsStep.disposeUIResources();
mySettingsStep = myModuleBuilder == null ? null : myModuleBuilder.modifySettingsStep(this);
String description = null;
if (template != null) {
description = template.getDescription();
if (StringUtil.isNotEmpty(description)) {
StringBuilder sb = new StringBuilder("<html><body><font ");
sb.append(SystemInfo.isMac ? "" : "face=\"Verdana\" size=\"-1\"").append('>');
sb.append(description).append("</font></body></html>");
description = sb.toString();
myDescriptionPane.setText(description);
}
}
myExpertPlaceholder.setVisible(!(myModuleBuilder instanceof TemplateModuleBuilder) && myExpertPanel.getComponentCount() > 0);
for (int i = 0; i < 6; i++) {
getModulePanel().getComponent(i).setVisible(!(myModuleBuilder instanceof EmptyModuleBuilder));
}
myDescriptionPanel.setVisible(StringUtil.isNotEmpty(description));
mySettingsPanel.revalidate();
mySettingsPanel.repaint();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:SelectTemplateStep.java
示例16: buildItems
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
private List<TemplateItem> buildItems(MultiMap<TemplatesGroup, ProjectTemplate> map) {
List<TemplateItem> items = new ArrayList<TemplateItem>();
List<TemplatesGroup> groups = new ArrayList<TemplatesGroup>(map.keySet());
Collections.sort(groups);
for (TemplatesGroup group : groups) {
for (ProjectTemplate template : map.get(group)) {
TemplateItem templateItem = new TemplateItem(template, group);
items.add(templateItem);
}
}
return items;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ProjectTypesList.java
示例17: createSteps
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
@Nullable
@Override
protected StepSequence createSteps(@NotNull WizardContext context, @NotNull ModulesProvider modulesProvider) {
MultiMap<TemplatesGroup, ProjectTemplate> map = getTemplatesMap(context);
StepSequence sequence = new StepSequence();
for (ProjectTemplate template : map.values()) {
sequence.addStepsForBuilder(template.createModuleBuilder(), context, modulesProvider);
}
mySelectTemplateStep = new SelectTemplateStep(context, sequence, map);
sequence.addCommonStep(mySelectTemplateStep);
return sequence;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:CreateFromTemplateMode.java
示例18: getModuleBuilder
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
@Nullable
@Override
public AbstractModuleBuilder getModuleBuilder() {
final ProjectTemplate template = mySelectTemplateStep.getSelectedTemplate();
if (template == null) {
return null;
}
return template.createModuleBuilder();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:CreateFromTemplateMode.java
示例19: setTemplatesList
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
private void setTemplatesList(TemplatesGroup group, Collection<ProjectTemplate> templates, boolean preserveSelection) {
List<ProjectTemplate> list = new ArrayList<ProjectTemplate>(templates);
ModuleBuilder moduleBuilder = group.getModuleBuilder();
if (moduleBuilder != null && !(moduleBuilder instanceof TemplateModuleBuilder)) {
list.add(0, new BuilderBasedTemplate(moduleBuilder));
}
myTemplatesList.setTemplates(list, preserveSelection);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ProjectTypeStep.java
示例20: getSelectedBuilder
import com.intellij.platform.ProjectTemplate; //导入依赖的package包/类
private ModuleBuilder getSelectedBuilder() {
ProjectTemplate template = getSelectedTemplate();
if (template != null) {
return myBuilders.get(template);
}
return getSelectedGroup().getModuleBuilder();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ProjectTypeStep.java
注:本文中的com.intellij.platform.ProjectTemplate类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论