View unanswered posts | View active topics



Reply to topic  [ 78 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Ant panel plugin 
Author Message
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 337
Location: Lviv, Ukraine
Panel is just for adding build files and run targets :)

Drag&Drop supported.

File list is saved in a folder ProjectDir\obj

It is necessary to have either a path to ant bin folder in %PATH% environment variable,
or set path to ant installation directory in plugin settings.

Image

Source:
https://github.com/canab/fd-ant-plugin

Fork with compiled DLL
https://github.com/SlavaRa/fd-antpanel-plugin


Last edited by Canab on Sun Jun 07, 2015 10:43 am, edited 14 times in total.



Thu Feb 18, 2010 8:55 am
Profile WWW
Member

Joined: Sun May 11, 2008 3:01 pm
Posts: 895
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
Profile
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 337
Location: Lviv, Ukraine
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
Profile WWW
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 337
Location: Lviv, Ukraine
fixed little UI bug (tree shouldn't collapse on double click)


Thu Feb 18, 2010 11:20 am
Profile WWW
Member

Joined: Tue Jan 19, 2010 7:14 pm
Posts: 12
Is there a way we can collaborate?
See viewtopic.php?f=4&t=5977.


Fri Feb 19, 2010 10:58 pm
Profile
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 337
Location: Lviv, Ukraine
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
Profile WWW
Member

Joined: Sun May 11, 2008 3:01 pm
Posts: 895
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
Profile
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 337
Location: Lviv, Ukraine
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
Profile WWW
Member

Joined: Sun May 11, 2008 3:01 pm
Posts: 895
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
Profile
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 337
Location: Lviv, Ukraine
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
Profile WWW
Member

Joined: Sun May 11, 2008 3:01 pm
Posts: 895
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
Profile
Member

Joined: Wed Mar 24, 2010 8:12 pm
Posts: 7
Location: London, UK
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
Profile
Member

Joined: Sun May 11, 2008 3:01 pm
Posts: 895
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
Profile
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 337
Location: Lviv, Ukraine
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
Profile WWW
Member

Joined: Wed Mar 24, 2010 8:12 pm
Posts: 7
Location: London, UK
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
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 78 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

Who is online

Users browsing this forum: No registered users and 1 guest


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

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.