mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
hyperlinks & descriptions
This commit is contained in:
@@ -37,8 +37,14 @@ import java.util.ArrayList;
|
||||
|
||||
public class JavaModuleType extends ModuleType<JavaModuleBuilder> {
|
||||
|
||||
public static ModuleType getModuleType() {
|
||||
return ModuleTypeManager.getInstance().findByID(JAVA_MODULE);
|
||||
}
|
||||
|
||||
private static final String JAVA_MODULE = "JAVA_MODULE";
|
||||
|
||||
public JavaModuleType() {
|
||||
this("JAVA_MODULE");
|
||||
this(JAVA_MODULE);
|
||||
}
|
||||
|
||||
protected JavaModuleType(@NonNls String id) {
|
||||
|
||||
+11
-1
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.platform.templates;
|
||||
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.ModuleTypeManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -27,17 +29,20 @@ public class GithubBasedProjectTemplate extends AbstractGithubTagDownloadedProje
|
||||
private String myGithubRepositoryName;
|
||||
private String myHomepageUrl;
|
||||
private String myDescription;
|
||||
private final String myModuleType;
|
||||
|
||||
public GithubBasedProjectTemplate(String displayName,
|
||||
String githubUserName,
|
||||
String githubRepositoryName,
|
||||
String homepageUrl,
|
||||
String description) {
|
||||
String description,
|
||||
String moduleType) {
|
||||
myDisplayName = displayName;
|
||||
myGithubUserName = githubUserName;
|
||||
myGithubRepositoryName = githubRepositoryName;
|
||||
myHomepageUrl = homepageUrl;
|
||||
myDescription = description;
|
||||
myModuleType = moduleType;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -66,4 +71,9 @@ public class GithubBasedProjectTemplate extends AbstractGithubTagDownloadedProje
|
||||
public String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModuleType getModuleType() {
|
||||
return ModuleTypeManager.getInstance().findByID("JAVA_MODULE");
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -28,6 +28,6 @@ public class GithubBasedTemplatesFactory implements ProjectTemplatesFactory {
|
||||
@NotNull
|
||||
@Override
|
||||
public ProjectTemplate[] createTemplates() {
|
||||
return new ProjectTemplate[]{new GithubBasedProjectTemplate("Web Application", null, "JetBrains/idea-templates", null, null)};
|
||||
return new ProjectTemplate[]{new GithubBasedProjectTemplate("Web Application", null, "JetBrains/idea-templates", null, null, "JAVA_MODULE")};
|
||||
}
|
||||
}
|
||||
|
||||
+16
-10
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.platform.templates.GithubProjectGeneratorPeer">
|
||||
<grid id="27dc6" binding="myComponent" layout-manager="GridLayoutManager" row-count="4" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="myComponent" layout-manager="GridLayoutManager" row-count="5" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
@@ -10,7 +10,7 @@
|
||||
<children>
|
||||
<component id="7efaf" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<labelFor value="7379c"/>
|
||||
@@ -19,17 +19,17 @@
|
||||
</component>
|
||||
<hspacer id="cb5b0">
|
||||
<constraints>
|
||||
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<vspacer id="61e03">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="7379c" class="javax.swing.JComboBox" binding="myComboBox">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -37,7 +37,7 @@
|
||||
</component>
|
||||
<component id="6cca1" class="javax.swing.JLabel" binding="myErrorMessage">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="4" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="3" column="0" row-span="1" col-span="4" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-52429"/>
|
||||
@@ -47,15 +47,15 @@
|
||||
</component>
|
||||
<component id="dd95a" class="javax.swing.JButton" binding="myReloadButton">
|
||||
<constraints>
|
||||
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="&Reload"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="e74f1" class="com.intellij.ui.components.JBLabel">
|
||||
<component id="e74f1" class="com.intellij.ui.components.JBLabel" binding="myHomepageLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="2" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="2" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Homepage:"/>
|
||||
@@ -63,7 +63,13 @@
|
||||
</component>
|
||||
<component id="e1779" class="com.intellij.ui.HyperlinkLabel" binding="myHyperlink">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="1" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="5b63b" class="com.intellij.ui.components.JBLabel" binding="myDescriptionLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="4" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
|
||||
+16
-3
@@ -7,6 +7,7 @@ import com.intellij.openapi.ui.ValidationInfo;
|
||||
import com.intellij.platform.WebProjectGenerator;
|
||||
import com.intellij.ui.HyperlinkLabel;
|
||||
import com.intellij.ui.ListCellRendererWrapper;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -34,6 +35,8 @@ public class GithubProjectGeneratorPeer implements WebProjectGenerator.Generator
|
||||
private HyperlinkLabel myHyperlink;
|
||||
private JLabel myErrorMessage;
|
||||
private JButton myReloadButton;
|
||||
private JBLabel myHomepageLabel;
|
||||
private JBLabel myDescriptionLabel;
|
||||
|
||||
public GithubProjectGeneratorPeer(@NotNull AbstractGithubTagDownloadedProjectGenerator generator) {
|
||||
String ghUserName = generator.getGithubUserName();
|
||||
@@ -42,9 +45,19 @@ public class GithubProjectGeneratorPeer implements WebProjectGenerator.Generator
|
||||
"master",
|
||||
String.format("https://github.com/%s/%s/zipball/master", ghUserName, ghRepoName)
|
||||
);
|
||||
myHyperlink.setHyperlinkText(generator.getHomepageUrl());
|
||||
myHyperlink.setHyperlinkTarget(generator.getHomepageUrl());
|
||||
myHyperlink.revalidate();
|
||||
String url = generator.getHomepageUrl();
|
||||
if (url != null) {
|
||||
myHomepageLabel.setVisible(true);
|
||||
myHyperlink.setVisible(true);
|
||||
myHyperlink.setHyperlinkText(url);
|
||||
myHyperlink.setHyperlinkTarget(url);
|
||||
myHyperlink.revalidate();
|
||||
}
|
||||
else {
|
||||
myHomepageLabel.setVisible(false);
|
||||
myHyperlink.setVisible(false);
|
||||
}
|
||||
myDescriptionLabel.setText(generator.getDescription());
|
||||
|
||||
myComboBox.setRenderer(new ListCellRendererWrapper<GithubTagInfo>() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user