Permalink
Browse files

Set module specification to 1.0.

Added email address and name into UI Options Panel. Users can now successfully
change their ~/.gitconfig user name + password.
Added artwork into misc/ folder (logo borrowed from msysgit project)
Added icon for Git VCS.
Fixed missing icons in VersioningPanel.
  • Loading branch information...
1 parent ad7f93f commit 474f376112eb654e4791347c8a4a67d24d587c0e @myabc committed Apr 4, 2008
View
@@ -4,4 +4,4 @@ OpenIDE-Module: org.netbeans.modules.git/1
OpenIDE-Module-Layer: org/netbeans/modules/git/resources/git-layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/git/Bundle.properties
OpenIDE-Module-Requires: org.netbeans.api.javahelp.Help
-OpenIDE-Module-Specification-Version: 1.6
+OpenIDE-Module-Specification-Version: 1.0
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ width="97"
+ height="188"
+ version="1.0"
+ sodipodi:docbase="/home/gene099"
+ sodipodi:docname="gitlogo.svg">
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="Git Logo">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs5" />
+ <sodipodi:namedview
+ inkscape:window-height="632"
+ inkscape:window-width="1098"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:zoom="4.0212766"
+ inkscape:cx="56.955026"
+ inkscape:cy="55.854568"
+ inkscape:window-x="174"
+ inkscape:window-y="60"
+ inkscape:current-layer="svg2"
+ showguides="false" />
+ <g
+ id="g1915"
+ transform="translate(-3.915344e-5,-1.587301e-8)">
+ <path
+ style="fill:none"
+ d="M 0,94 C 0,62.666667 0,31.333333 0,0 C 32.333333,0 64.666667,0 97,0 C 97,62.666667 97,125.33333 97,188 C 64.666667,188 32.333333,188 0,188 C 0,156.66667 0,125.33333 0,94 z "
+ id="path1919" />
+ <path
+ style="fill:#666;fill-opacity:1"
+ d="M 37.664899,184.58554 C 21.895418,182.55403 5.6661972,167.64367 3.3987193,150.1511 C 1.2240485,135.52701 4.3614628,118.45697 16.450174,108.80568 C 21.75244,105.19169 28.965047,101.14246 35.325463,101.62434 C 35.515961,108.09863 35.134965,115.96793 35.325463,122.44222 C 27.749678,123.28567 20.416427,131.89654 20.569051,139.78073 C 20.754756,150.04074 25.295526,159.46754 35.166718,162.53826 C 46.085307,166.2122 58.583978,165.16727 68.691405,159.05921 C 77.041121,152.55358 77.813587,140.44085 73.446467,131.22303 C 71.482045,126.15057 67.247476,122.42665 61.5,122.44222 L 61.5,140.5 L 45.29359,140.5 L 45.29359,101.62434 L 94.37037,101.62434 L 94.37037,115.60423 L 80.927975,115.72857 C 93.471899,122.87923 94.757645,138.31236 94.114862,149.01935 C 94.566741,167.41218 76.395502,182.4083 58.372879,184.41334 C 51.852471,184.9022 46.335496,184.92793 37.664899,184.58554 z "
+ id="path1927"
+ sodipodi:nodetypes="ccccccccccccccccccc" />
+ <path
+ style="fill:#d8382d;fill-opacity:1"
+ d="M 2.6030317,93.90175 L 2.5,73.5 L 94.5,73.5 L 94.489423,94 L 2.6030317,93.90175 z "
+ id="path1925"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:#40bf4c;fill-opacity:1"
+ d="M 37.666668,66.333336 L 37.666668,44.5 L 2,44.5 L 2,25.5 L 37.666668,25.5 L 37.666668,1 L 59,1 L 59,25.5 L 94.5,25.5 L 94.5,44.5 L 59,44.5 L 58.648317,66.287772 L 37.666668,66.333336 z "
+ id="path1917"
+ sodipodi:nodetypes="ccccccccccccc" />
+ </g>
+</svg>
@@ -42,7 +42,6 @@
package org.netbeans.modules.git;
import java.io.File;
-import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -92,6 +91,7 @@
private static final String DEFAULT_EXPORT_FILENAME = "%b_%r_%h"; // NOI18N
private static final GitModuleConfig INSTANCE = new GitModuleConfig();
+ private static String email;
private static String userName;
public static GitModuleConfig getDefault() {
@@ -192,20 +192,27 @@ public void setExportFilename(String path) {
}
/**
+ * This method returns the email address specified in $HOME/.gitconfig
+ * or a default email address if none is found.
+ */
+ public String getEmail() {
+ email = GitConfigFiles.getInstance().getEmail();
+ if (email.length() == 0) {
+ // nothing
+ // TODO: does NetBeans provide this with product registration?
+ // if not, then get this information in setup wizard.
+ }
+ return email;
+ }
+
+ /**
* This method returns the username specified in $HOME/.gitconfig
* or a default username if none is found.
*/
public String getUserName() {
userName = GitConfigFiles.getInstance().getUserName();
if (userName.length() == 0) {
String userId = System.getProperty("user.name"); // NOI18N
- String hostName;
- try {
- hostName = InetAddress.getLocalHost().getHostName();
- } catch (Exception ex) {
- return userName;
- }
- userName = userId + " <" + userId + "@" + hostName + ">"; // NOI18N
}
return userName;
}
@@ -214,6 +221,10 @@ public void addGitkExtension() {
GitConfigFiles.getInstance().setProperty("XXXXX", "");
}
+ public void setEmail(String email) {
+ GitConfigFiles.getInstance().setEmail(email);
+ }
+
public void setUserName(String name) {
GitConfigFiles.getInstance().setUserName(name);
}
@@ -238,20 +249,27 @@ public Boolean isExecPathValid(String name) {
public Properties getProperties(File file) {
Properties props = new Properties();
- GitConfigFiles hgconfig = new GitConfigFiles(file);
- String name = hgconfig.getUserName(false);
+ GitConfigFiles gitconfig = new GitConfigFiles(file);
+ String email = gitconfig.getEmail(false);
+ String name = gitconfig.getUserName(false);
+ if (email.length() == 0)
+ email = getEmail();
+ if (email.length() > 0)
+ props.setProperty("email", email);
+ else
+ props.setProperty("email", "");
if (name.length() == 0)
name = getUserName();
if (name.length() > 0)
- props.setProperty("username", name); // NOI18N
+ props.setProperty("name", name); // NOI18N
else
- props.setProperty("username", ""); // NOI18N
- name = hgconfig.getDefaultPull(false);
+ props.setProperty("name", ""); // NOI18N
+ name = gitconfig.getDefaultPull(false);
if (name.length() > 0)
props.setProperty("default-pull", name); // NOI18N
else
props.setProperty("default-pull", ""); // NOI18N
- name = hgconfig.getDefaultPush(false);
+ name = gitconfig.getDefaultPush(false);
if (name.length() > 0)
props.setProperty("default-push", name); // NOI18N
else
@@ -260,33 +278,33 @@ public Properties getProperties(File file) {
}
public void clearProperties(File file, String section) {
- getHgConfigFiles(file).clearProperties(section);
+ getGitConfigFiles(file).clearProperties(section);
}
public void removeProperty(File file, String section, String name) {
- getHgConfigFiles(file).removeProperty(section, name);
+ getGitConfigFiles(file).removeProperty(section, name);
}
public void setProperty(File file, String name, String value) {
- getHgConfigFiles(file).setProperty(name, value);
+ getGitConfigFiles(file).setProperty(name, value);
}
public void setProperty(File file, String section, String name, String value, boolean allowEmpty) {
- getHgConfigFiles(file).setProperty(section, name, value, allowEmpty);
+ getGitConfigFiles(file).setProperty(section, name, value, allowEmpty);
}
public void setProperty(File file, String section, String name, String value) {
- getHgConfigFiles(file).setProperty(section, name, value);
+ getGitConfigFiles(file).setProperty(section, name, value);
}
/*
* Get all properties for a particular section
*/
public Properties getProperties(File file, String section) {
- return getHgConfigFiles(file).getProperties(section);
+ return getGitConfigFiles(file).getProperties(section);
}
- private GitConfigFiles getHgConfigFiles(File file) {
+ private GitConfigFiles getGitConfigFiles(File file) {
if (file == null) {
return GitConfigFiles.getInstance();
} else {
@@ -67,8 +67,9 @@
public static final String GIT_EXTENSIONS = "extensions"; // NOI18N
public static final String GIT_EXTENSIONS_GITK = "gitk"; // NOI18N
public static final String GIT_EXTENSIONS_FETCH = "fetch"; // NOI18N
- public static final String GIT_UI_SECTION = "ui"; // NOI18N
- public static final String GIT_USERNAME = "username"; // NOI18N
+ public static final String GIT_USER_SECTION = "user"; // NOI18N
+ public static final String GIT_USER_NAME = "name"; // NOI18N
+ public static final String GIT_EMAIL = "email"; // NOI18N
public static final String GIT_PATHS_SECTION = "paths"; // NOI18N
public static final String GIT_DEFAULT_PUSH = "default-push"; // NOI18N
public static final String GIT_DEFAULT_PUSH_VALUE = "default-push"; // NOI18N
@@ -116,8 +117,10 @@ public GitConfigFiles(File file) {
}
public void setProperty(String name, String value) {
- if (name.equals(GIT_USERNAME)) {
- setProperty(GIT_UI_SECTION, GIT_USERNAME, value);
+ if (name.equals(GIT_USER_NAME)) {
+ setProperty(GIT_USER_SECTION, GIT_USER_NAME, value);
+ } else if (name.equals(GIT_EMAIL)) {
+ setProperty(GIT_USER_SECTION, GIT_EMAIL, value);
} else if (name.equals(GIT_DEFAULT_PUSH)) {
setProperty(GIT_PATHS_SECTION, GIT_DEFAULT_PUSH_VALUE, value);
} else if (name.equals(GIT_DEFAULT_PULL)) {
@@ -154,14 +157,22 @@ public void setProperty(String section, String name, String value, boolean allow
public void setProperty(String section, String name, String value) {
setProperty(section, name,value, false);
}
+
+ public void setEmail(String value) {
+ setProperty(GIT_USER_SECTION, GIT_EMAIL, value);
+ }
public void setUserName(String value) {
- setProperty(GIT_UI_SECTION, GIT_USERNAME, value);
+ setProperty(GIT_USER_SECTION, GIT_USER_NAME, value);
}
public String getUserName() {
return getUserName(true);
}
+
+ public String getEmail() {
+ return getEmail(true);
+ }
public Properties getProperties(String section) {
Ini.Section inisection = getSection(gitConfig, section, false);
@@ -213,7 +224,14 @@ public String getUserName(Boolean reload) {
if (reload) {
doReload();
}
- return getProperty(GIT_UI_SECTION, GIT_USERNAME);
+ return getProperty(GIT_USER_SECTION, GIT_USER_NAME);
+ }
+
+ public String getEmail(Boolean reload) {
+ if (reload) {
+ doReload();
+ }
+ return getProperty(GIT_USER_SECTION, GIT_EMAIL);
}
public String getProperty(String section, String name) {
@@ -45,7 +45,7 @@ CTL_Properties_Action_OK = OK
AdvancedOption_DisplayName_Git=Git
AdvancedOption_Tooltip_Git=Git Global Options
-GitPanel.jLabel1.text=Git &User Name\:
+GitPanel.jLabel1.text=Email Address:
GitPanel.jLabel3.text=(Changes will not take effect until the IDE is restarted.)
@@ -85,8 +85,6 @@ GitPanel.labelVariables.acsd=Lets you select a Variable
GitPanel.jLabel4.text=Use this button to specify the extensions to be loaded by Git
-
-GitPanel.jPanel2.border.title=Git Extensions
GitPanel.manageButton.text=&Manage Extensions
LBL_Properties_Progress=Scanning Git Extensions
@@ -121,4 +119,5 @@ ACSD_executablePathTextField=Specify the path for the Git executable
ACSD_exportFileNameTextField=Specifies the default path name for export
ACSD_btnAdd=Add property
ACSD_btnRemove=Remove selected properties
-ACSD_txtAreaValue=Property value
+ACSD_txtAreaValue=Property value
+GitPanel.jLabel5.text=Name:
@@ -155,7 +155,7 @@ private File getExecutableFile() {
}
private Boolean validateFields() {
- String username = panel.userNameTextField.getText();
+ String username = panel.emailTextField.getText();
if (!GitModuleConfig.getDefault().isUserNameValid(username)) {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(GitPanel.class, "MSG_WARN_USER_NAME_TEXT"), // NOI18N
Oops, something went wrong.

0 comments on commit 474f376

Please sign in to comment.