You are viewing a plain text version of this content. The canonical link for it is here.
Posted to nmaven-commits@incubator.apache.org by br...@apache.org on 2008/07/03 08:27:02 UTC
svn commit: r673616 [2/2] - in
/incubator/nmaven/branches/NMAVEN_0.14/assemblies: ./
NMaven.ProjectImporter/ NMaven.ProjectImporter/Console/
NMaven.ProjectImporter/Console/src/ NMaven.ProjectImporter/Console/src/main/
NMaven.ProjectImporter/Console/src...
Added: incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/NMavenImportProjectForm.Designer.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/NMavenImportProjectForm.Designer.cs?rev=673616&view=auto
==============================================================================
--- incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/NMavenImportProjectForm.Designer.cs (added)
+++ incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/NMavenImportProjectForm.Designer.cs Thu Jul 3 01:27:01 2008
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+
+
+namespace NMaven.VisualStudio.Addin
+{
+ partial class NMavenImportProjectForm
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.btnBrowse = new System.Windows.Forms.Button();
+ this.lblBrowseDotNetSolutionFile = new System.Windows.Forms.Label();
+ this.txtBrowseDotNetSolutionFile = new System.Windows.Forms.TextBox();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.btnGenerate = new System.Windows.Forms.Button();
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtGroupId = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // btnBrowse
+ //
+ this.btnBrowse.Location = new System.Drawing.Point(434, 21);
+ this.btnBrowse.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+ this.btnBrowse.Name = "btnBrowse";
+ this.btnBrowse.Size = new System.Drawing.Size(80, 23);
+ this.btnBrowse.TabIndex = 9;
+ this.btnBrowse.Text = "&Browse";
+ this.btnBrowse.UseVisualStyleBackColor = true;
+ this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
+ //
+ // lblBrowseDotNetSolutionFile
+ //
+ this.lblBrowseDotNetSolutionFile.AutoSize = true;
+ this.lblBrowseDotNetSolutionFile.Location = new System.Drawing.Point(8, 27);
+ this.lblBrowseDotNetSolutionFile.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+ this.lblBrowseDotNetSolutionFile.Name = "lblBrowseDotNetSolutionFile";
+ this.lblBrowseDotNetSolutionFile.Size = new System.Drawing.Size(107, 13);
+ this.lblBrowseDotNetSolutionFile.TabIndex = 8;
+ this.lblBrowseDotNetSolutionFile.Text = "Dot Net Solution File:";
+ //
+ // txtBrowseDotNetSolutionFile
+ //
+ this.txtBrowseDotNetSolutionFile.Location = new System.Drawing.Point(118, 24);
+ this.txtBrowseDotNetSolutionFile.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+ this.txtBrowseDotNetSolutionFile.Name = "txtBrowseDotNetSolutionFile";
+ this.txtBrowseDotNetSolutionFile.Size = new System.Drawing.Size(312, 20);
+ this.txtBrowseDotNetSolutionFile.TabIndex = 7;
+ //
+ // btnCancel
+ //
+ this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.btnCancel.Location = new System.Drawing.Point(450, 86);
+ this.btnCancel.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size(64, 21);
+ this.btnCancel.TabIndex = 6;
+ this.btnCancel.Text = "&Cancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // btnGenerate
+ //
+ this.btnGenerate.Location = new System.Drawing.Point(342, 86);
+ this.btnGenerate.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+ this.btnGenerate.Name = "btnGenerate";
+ this.btnGenerate.Size = new System.Drawing.Size(104, 21);
+ this.btnGenerate.TabIndex = 5;
+ this.btnGenerate.Text = "&Generate Poms";
+ this.btnGenerate.UseVisualStyleBackColor = true;
+ this.btnGenerate.Click += new System.EventHandler(this.btnGenerate_Click);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(10, 59);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(53, 13);
+ this.label1.TabIndex = 10;
+ this.label1.Text = "Group ID:";
+ //
+ // txtGroupId
+ //
+ this.txtGroupId.Location = new System.Drawing.Point(118, 55);
+ this.txtGroupId.Margin = new System.Windows.Forms.Padding(2);
+ this.txtGroupId.Name = "txtGroupId";
+ this.txtGroupId.Size = new System.Drawing.Size(171, 20);
+ this.txtGroupId.TabIndex = 11;
+ //
+ // NMavenImportProjectForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(524, 131);
+ this.ControlBox = false;
+ this.Controls.Add(this.txtGroupId);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.btnBrowse);
+ this.Controls.Add(this.lblBrowseDotNetSolutionFile);
+ this.Controls.Add(this.txtBrowseDotNetSolutionFile);
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.btnGenerate);
+ this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+ this.Name = "NMavenImportProjectForm";
+ this.ShowInTaskbar = false;
+ this.Text = "NMaven Import Dot Net Solution";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button btnBrowse;
+ private System.Windows.Forms.Label lblBrowseDotNetSolutionFile;
+ private System.Windows.Forms.TextBox txtBrowseDotNetSolutionFile;
+ private System.Windows.Forms.Button btnCancel;
+ private System.Windows.Forms.Button btnGenerate;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtGroupId;
+ }
+}
\ No newline at end of file
Added: incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/NMavenImportProjectForm.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/NMavenImportProjectForm.cs?rev=673616&view=auto
==============================================================================
--- incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/NMavenImportProjectForm.cs (added)
+++ incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/NMavenImportProjectForm.cs Thu Jul 3 01:27:01 2008
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using System.IO;
+
+
+using Extensibility;
+using EnvDTE;
+using EnvDTE80;
+
+using NMaven.ProjectImporter.NMaven;
+
+namespace NMaven.VisualStudio.Addin
+{
+ public partial class NMavenImportProjectForm : Form
+ {
+ private DTE2 applicationObject;
+
+ public NMavenImportProjectForm(DTE2 applicationObject)
+ {
+ this.applicationObject = applicationObject;
+ InitializeComponent();
+
+ if (applicationObject != null && applicationObject.Solution != null && applicationObject.Solution.FileName != null)
+ {
+ txtBrowseDotNetSolutionFile.Text = applicationObject.Solution.FileName;
+ try
+ {
+ FileInfo assemblyInfo = findFile(new FileInfo(applicationObject.Solution.FileName).Directory, "AssemblyInfo.*");
+ String prefix = getAssemblyCompany(assemblyInfo);
+ txtGroupId.Text = (prefix==null||prefix.Equals("")?"":(prefix.Replace(" ","") + ".")) + new FileInfo(applicationObject.Solution.FileName).Name.Replace(".sln", "");
+ }
+ catch (Exception e) { MessageBox.Show(e.Message + Environment.NewLine + e.StackTrace); }
+
+ }
+
+ }
+
+ private void btnBrowse_Click(object sender, EventArgs e)
+ {
+
+ OpenFileDialog ofd = new OpenFileDialog();
+
+ if (!"".Equals(txtBrowseDotNetSolutionFile.Text) && System.IO.File.Exists(txtBrowseDotNetSolutionFile.Text))
+ {
+ ofd.FileName = txtBrowseDotNetSolutionFile.Text;
+ }
+ else
+ {
+ txtBrowseDotNetSolutionFile.Text = "";
+ ofd.InitialDirectory = @"c:\";
+ }
+
+ ofd.Filter = "Solution Files (*.sln)|*.sln|All Files (*.*)|*.*";
+ ofd.FilterIndex = 1;
+ ofd.CheckFileExists = true;
+ ofd.RestoreDirectory = true;
+
+ if (ofd.ShowDialog() == DialogResult.OK)
+ {
+ txtBrowseDotNetSolutionFile.Text = ofd.FileName;
+ }
+
+ }
+
+
+
+ private void btnGenerate_Click(object sender, EventArgs e)
+ {
+ if (!"".Equals(txtBrowseDotNetSolutionFile.Text) && System.IO.File.Exists(txtBrowseDotNetSolutionFile.Text))
+ {
+ // Generate here
+
+ NMavenImporter importer = new NMavenImporter(new String[2] {txtBrowseDotNetSolutionFile.Text, "-DgroupId=" + txtGroupId.Text });
+ importer.GeneratePom();
+
+ string str = string.Format("NMaven Import Project has Successfully Generated Pom Files!!!\n\n Parent Pom XML File: {0} ", importer.GeneratedSolutionPomFile);
+
+
+
+ foreach (string pom in importer.GeneratedProjectPomFiles)
+ {
+ str = str + string.Format("\n Project Pom XML File: {0} ", pom);
+ }
+
+ MessageBox.Show(str, "NMaven Import Done:");
+
+ // Close the Dialog Here
+ this.DialogResult = DialogResult.OK;
+ this.Close();
+ }
+ else
+ {
+ string str = string.Format("Solution File Not Found: {0} " , txtBrowseDotNetSolutionFile.Text);
+ MessageBox.Show(str, "NMaven Import Error:", MessageBoxButtons.OK,MessageBoxIcon.Error);
+ }
+
+ }
+
+ private void btnCancel_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.Cancel;
+ this.Close();
+ }
+
+
+
+ private String getAssemblyCompany (FileInfo file)
+ {
+ String result = null;
+
+ try
+ {
+ String data = File.ReadAllText(file.FullName);
+ String[] splitData = data.Split(new string[] { System.Environment.NewLine }, System.StringSplitOptions.RemoveEmptyEntries);
+
+ foreach (String d in splitData)
+ {
+ if (d.Contains ("AssemblyCompany") )
+ {
+ int start = d.IndexOf("(");
+ int end = d.LastIndexOf(")");
+ result = d.Substring(start , end - start).Replace("\"", "").Replace("(","").Replace(")","");
+ }
+ }
+
+ }
+ catch (Exception e)
+ {
+ MessageBox.Show("cannot read file: "+ file.FullName + Environment.NewLine + e.StackTrace);
+ }
+
+ return result;
+ }
+ // find AssemblyInfo.cs or AssemblyInfo.vb
+ //
+ private FileInfo findFile(DirectoryInfo searchDir, string searchPattern)
+ {
+ FileInfo file = null;
+
+ FileInfo[] files = searchDir.GetFiles(searchPattern);
+
+ if (files != null && files.Length > 0)
+ {
+ return files[0];
+ }
+
+ DirectoryInfo[] directories = searchDir.GetDirectories();
+ foreach (DirectoryInfo dir in directories)
+ {
+ FileInfo files2 = findFile(dir, searchPattern);
+
+ if (files2 != null)
+ {
+ return files2;
+ }
+ }
+
+ return file;
+ }
+ }
+}
\ No newline at end of file
Added: incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/NMavenImportProjectForm.resx
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/NMavenImportProjectForm.resx?rev=673616&view=auto
==============================================================================
--- incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/NMavenImportProjectForm.resx (added)
+++ incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/NMavenImportProjectForm.resx Thu Jul 3 01:27:01 2008
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Modified: incubator/nmaven/branches/NMAVEN_0.14/assemblies/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/NMAVEN_0.14/assemblies/pom.xml?rev=673616&r1=673615&r2=673616&view=diff
==============================================================================
--- incubator/nmaven/branches/NMAVEN_0.14/assemblies/pom.xml (original)
+++ incubator/nmaven/branches/NMAVEN_0.14/assemblies/pom.xml Thu Jul 3 01:27:01 2008
@@ -43,7 +43,8 @@
<module>NMaven.Plugin.Loader</module>
<module>NMaven.Plugin.MojoGenerator</module>
<module>NMaven.Plugin.Runner</module>
- <module>NMaven.Service/Embedder</module>
+ <module>NMaven.Service/Embedder</module>
+ <module>NMaven.ProjectImporter</module>
</modules>
<profiles>
<profile>