 |
| Author |
Message |
|
Canab
Member
Joined: Mon Oct 16, 2006 12:02 am Posts: 268 Location: Lviv, Ukraine
|
 Ant panel plugin
Panel is just for adding build files and run targets  Drag&Drop supported. File list is saving in ProjectDir\obj folder. It is necessary to have either path to ant bin folder in %PATH% environment variable, or set path to ant installation directory in plugin settings.  DLL: http://fd-ant-plugin.googlecode.com/files/AntPlugin-r9.zipSource: http://code.google.com/p/fd-ant-plugin/source/checkout
Last edited by Canab on Fri Mar 26, 2010 3:49 pm, edited 9 times in total.
|
| Thu Feb 18, 2010 8:55 am |
|
 |
|
wvxvw
Member
Joined: Sun May 11, 2008 3:01 pm Posts: 860
|
 Re: Ant panel plugin
Just what I needed, it's been very annoying to switch to command prompt back and forth! Thanks a lot! 
_________________ http://www.couchsurfing.com/people/wvxvw
|
| Thu Feb 18, 2010 9:48 am |
|
 |
|
Canab
Member
Joined: Mon Oct 16, 2006 12:02 am Posts: 268 Location: Lviv, Ukraine
|
 Re: Ant panel plugin
Quote: it's been very annoying to switch to command prompt back and forth! me to  , and tomorrow I lose my patience 
|
| Thu Feb 18, 2010 10:05 am |
|
 |
|
Canab
Member
Joined: Mon Oct 16, 2006 12:02 am Posts: 268 Location: Lviv, Ukraine
|
 Re: Ant panel plugin
fixed little UI bug (tree shouldn't collapse on double click)
|
| Thu Feb 18, 2010 11:20 am |
|
 |
|
st0nerhat
Member
Joined: Tue Jan 19, 2010 7:14 pm Posts: 11
|
 Re: Ant panel plugin
Is there a way we can collaborate? See viewtopic.php?f=4&t=5977.
|
| Fri Feb 19, 2010 10:58 pm |
|
 |
|
Canab
Member
Joined: Mon Oct 16, 2006 12:02 am Posts: 268 Location: Lviv, Ukraine
|
 Re: Ant panel plugin
Quote: Is there a way we can collaborate? It is already possible to use two plugins together, its fun )) But I am afraid I haven't any free time for continue to work on it. You can use my code if it will be helpful.
|
| Sat Feb 20, 2010 12:17 am |
|
 |
|
wvxvw
Member
Joined: Sun May 11, 2008 3:01 pm Posts: 860
|
 Re: Ant panel plugin
Hi, I was trying to add drag-drop functionality to your plugin... but failed  I don't understand why drag-drop events simply don't fire on the plugin area. Do you maybe have any hints? I'm suspicious of docking that may somehow prevent those events, but, maybe I'm looking into wrong direction... Quite brilliantly, right after I've typed this I realized that I was setting DragEnabled and adding drag handlers to different things! So, yeah, now it's solved  Sorry for the noise!  OK, so, here we go, if you don't mind, please add this tiny patch: Code: Index: PluginMain.cs =================================================================== --- PluginMain.cs (revision 4) +++ PluginMain.cs (working copy) @@ -160,6 +160,7 @@ { pluginUI = new PluginUI(this); pluginUI.Text = "Ant"; + pluginUI.StartDragHandling(); pluginPanel = PluginBase.MainForm.CreateDockablePanel( pluginUI, PLUGIN_GUID, pluginImage, DockState.DockRight); } Index: PluginUI.Designer.cs =================================================================== --- PluginUI.Designer.cs (revision 4) +++ PluginUI.Designer.cs (working copy) @@ -1,4 +1,10 @@ -namespace AntPlugin +using System; +using System.Collections.Generic; +namespace AntPlugin { partial class PluginUI { @@ -135,5 +141,45 @@ private System.Windows.Forms.ImageList imageList; private System.Windows.Forms.ToolStripButton runButton; + internal void StartDragHandling() + { + this.treeView.AllowDrop = true; + this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler(PluginUI_DragDrop); + this.treeView.DragOver += new System.Windows.Forms.DragEventHandler(PluginUI_DragOver); + } + + void PluginUI_DragOver(object sender, System.Windows.Forms.DragEventArgs e) + { + String[] s = (String[])e.Data.GetData(DataFormats.FileDrop); + List<String> xmls = new List<String>(); + for (Int32 i = 0; i < s.Length; i++) + { + if (s[i].EndsWith(".xml", true, null)) + { + xmls.Add(s[i]); + } + } + if (xmls.Count > 0) + { + e.Effect = DragDropEffects.Copy; + } + } + + void PluginUI_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) + { + String[] s = (String[])e.Data.GetData(DataFormats.FileDrop); + List<String> xmls = new List<String>(); + for (Int32 i = 0; i < s.Length; i++) + { + if (s[i].EndsWith(".xml", true, null)) + { + xmls.Add(s[i]); + } + } + if (xmls.Count > 0) + { + this.pluginMain.AddBuildFiles(xmls.ToArray()); + } + } } }
_________________ http://www.couchsurfing.com/people/wvxvw
Last edited by wvxvw on Sat Feb 20, 2010 6:38 pm, edited 1 time in total.
|
| Sat Feb 20, 2010 5:32 pm |
|
 |
|
Canab
Member
Joined: Mon Oct 16, 2006 12:02 am Posts: 268 Location: Lviv, Ukraine
|
 Re: Ant panel plugin
Quote: Hi, I was trying to add drag-drop functionality to your plugin... I had the same idea (about dragging), could you post patch here? I will apply it ))
|
| Sat Feb 20, 2010 6:13 pm |
|
 |
|
wvxvw
Member
Joined: Sun May 11, 2008 3:01 pm Posts: 860
|
 Re: Ant panel plugin
Hi, sorry, didn't see your response, yup, posted it in the last message  Oh, I'll need to check if there is file format before getting files list... + maybe I could just remember the result in DragEnter and spare the checking in DragOver... yeah, I think I'll do, so, don't apply it yet, I'll improve  OK, here's the normal thing: Code: Index: PluginMain.cs =================================================================== --- PluginMain.cs (revision 4) +++ PluginMain.cs (working copy) @@ -160,6 +160,7 @@ { pluginUI = new PluginUI(this); pluginUI.Text = "Ant"; + pluginUI.StartDragHandling(); pluginPanel = PluginBase.MainForm.CreateDockablePanel( pluginUI, PLUGIN_GUID, pluginImage, DockState.DockRight); } Index: PluginUI.Designer.cs =================================================================== --- PluginUI.Designer.cs (revision 4) +++ PluginUI.Designer.cs (working copy) @@ -1,4 +1,7 @@ -namespace AntPlugin +using System.Windows.Forms; +using System; +using System.Collections.Generic; +namespace AntPlugin { partial class PluginUI { @@ -7,6 +10,8 @@ /// </summary> private System.ComponentModel.IContainer components = null; + private String[] dropFiles = null; + /// <summary> /// Clean up any resources being used. /// </summary> @@ -135,5 +140,62 @@ private System.Windows.Forms.ImageList imageList; private System.Windows.Forms.ToolStripButton runButton; + internal void StartDragHandling() + { + this.treeView.AllowDrop = true; + this.treeView.DragEnter += new DragEventHandler(treeView_DragEnter); + this.treeView.DragDrop += new DragEventHandler(treeView_DragDrop); + this.treeView.DragOver += new DragEventHandler(treeView_DragOver); + } + + void treeView_DragEnter(object sender, DragEventArgs e) + { + String[] formats = e.Data.GetFormats(); + Boolean hasFiles = false; + for (Int32 i = 0; i < formats.Length; i++) + { + if (formats[i] == DataFormats.FileDrop) + { + hasFiles = true; + break; + } + } + if (!hasFiles) + { + this.dropFiles = null; + return; + } + String[] s = (String[])e.Data.GetData(DataFormats.FileDrop); + List<String> xmls = new List<String>(); + for (Int32 i = 0; i < s.Length; i++) + { + if (s[i].EndsWith(".xml", true, null)) + { + xmls.Add(s[i]); + } + } + if (xmls.Count > 0) + { + e.Effect = DragDropEffects.Copy; + this.dropFiles = xmls.ToArray(); + } + else this.dropFiles = null; + } + + void treeView_DragOver(object sender, DragEventArgs e) + { + if (this.dropFiles != null) + { + e.Effect = DragDropEffects.Copy; + } + } + + void treeView_DragDrop(object sender, DragEventArgs e) + { + if (this.dropFiles != null) + { + this.pluginMain.AddBuildFiles(this.dropFiles); + } + } } }
_________________ http://www.couchsurfing.com/people/wvxvw
|
| Sat Feb 20, 2010 6:38 pm |
|
 |
|
Canab
Member
Joined: Mon Oct 16, 2006 12:02 am Posts: 268 Location: Lviv, Ukraine
|
 Re: Ant panel plugin
Thanks, Updated. I was not able to apply patch, TSVN shows a stupid error: "An unknown line type was found". So, I moved code by hands (with little modifications - it's not necessary to check ...if (!hasFiles)..., because in this case e.Data.GetData(DataFormats.FileDrop) returns an empty array and it will work properly).
|
| Sat Feb 20, 2010 9:22 pm |
|
 |
|
wvxvw
Member
Joined: Sun May 11, 2008 3:01 pm Posts: 860
|
 Re: Ant panel plugin
Ah, OK, good to know. Thanks! Just realized I forgot to set dropFiles to null after drop / dragOut...
_________________ http://www.couchsurfing.com/people/wvxvw
|
| Sat Feb 20, 2010 10:11 pm |
|
 |
|
maxo
Member
Joined: Wed Mar 24, 2010 8:12 pm Posts: 7 Location: London, UK
|
 Re: Ant panel plugin
When I try to run ant script, I get error message: "Running process: C:\WINDOWS\system32\cmd.exe /c "C:\ant\bin\ant" -buildfile E:\as\myProject\build\build.xml build Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar"
|
| Wed Mar 24, 2010 9:11 pm |
|
 |
|
wvxvw
Member
Joined: Sun May 11, 2008 3:01 pm Posts: 860
|
 Re: Ant panel plugin
This should be a warning, not an error... Maybe try to update Ant distro?
_________________ http://www.couchsurfing.com/people/wvxvw
|
| Wed Mar 24, 2010 10:31 pm |
|
 |
|
Canab
Member
Joined: Mon Oct 16, 2006 12:02 am Posts: 268 Location: Lviv, Ukraine
|
 Re: Ant panel plugin
Quote: Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar" tools.jar is in jdk, not in jre try to configure JAVA_HOME system variable http://forums.sun.com/thread.jspa?threadID=757039
|
| Thu Mar 25, 2010 7:11 am |
|
 |
|
maxo
Member
Joined: Wed Mar 24, 2010 8:12 pm Posts: 7 Location: London, UK
|
 Re: Ant panel plugin
wvxvw wrote: This should be a warning, not an error... Maybe try to update Ant distro? The build fails, so I suppose it's an error...
|
| Thu Mar 25, 2010 10:26 am |
|
|
Who is online |
Users browsing this forum: No registered users and 3 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum
|
|
 |