Ann: DiffFile plugin v1.0
Announcing DiffFile plugin version 1.0. The plugin adds a new option to
the editor popup menu. Selecting "Show differences..." will bring up a
file chooser. After choosing the file to "diff" the internal diff viewer
will appear in a dialog showing the selected file on the left and the
file in the editor on the right.
The source comes with the plugin and it's available on the twiki right
now at:
http://www.intellij.org/twiki/bin/view/Main/DiffFilePlugin
Known bugs:
1. The diff viewer always starts out scrolled all the way to the
right.
NB: I don't do too much Swing work in the first place and this is my
first plugin, but it works for what I need. Be gentle with me. ;)
~Mike
请先登录再写评论。
This plugin is 'hanging' IDEA build #639 on Win2000. I have to use task
manager to kill IDEA.
"Mike Abney" <michaelno.abneyspam@retek-nospam-.com> wrote in message
news:Xns925E8B2A8F164michaelabney1990@213.182.181.98...
>
>
>
>
>
Interesting. That's the same as my configuration: Win 2000 and IDEA 639 on
JDK 1.4.0_01.
What does a CTRL+Break dump look like?
"Brad" <lanebr@hotmail.com> wrote in news:aiektl$jf3$1@is.intellij.net:
It seems to be some kind of conflict with the jad plugin. If I remove one or
the other it works fine. Here is the dump when I have both 'installed':
IdeaJad: (c) 2002 tagtraum industries - http://www.tagtraum.com/
IdeaJad: Initialized DecompileAction...
Full thread dump Java HotSpot(TM) Client VM (1.4.0_01-b03 mixed mode):
"AWT-EventQueue-1" prio=7 tid=0x0EC59D88 nid=0x6e0 waiting on monitor
[10e6f000.
.10e6fdb4]
at java.lang.Object.wait(Native Method)
- waiting on (a com.intellij.ide.q) at java.lang.Object.wait(Object.java:426) at java.awt.EventQueue.getNextEvent(EventQueue.java:329) - locked <036D1ED0> (a com.intellij.ide.q) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh read.java:155) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre ad.java:144) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130) at java.awt.EventDispatchThread.run(EventDispatchThread.java:98) "TimerQueue" daemon prio=5 tid=0x0EEA78D0 nid=0x8bc waiting on monitor [10cbf000 ..10cbfdb4] at java.lang.Object.wait(Native Method) - waiting on <03CB5DD0> (a javax.swing.TimerQueue) at javax.swing.TimerQueue.run(TimerQueue.java:231) - locked <03CB5DD0> (a javax.swing.TimerQueue) at java.lang.Thread.run(Thread.java:536) "StoreRefreshStatusThread" prio=2 tid=0x0F0C7810 nid=0x924 waiting on monitor [1 0b7f000..10b7fdb4] at java.lang.Thread.sleep(Native Method) at com.intellij.openapi.vfs.b.b.bc.run(bc.java:3) "WatchForChangesThread" prio=7 tid=0x0F109DA0 nid=0x568 runnable [10b3f000..10b3 fdb4] at com.intellij.vfs.local.win32.FileWatcher.waitForChangeImpl(Native Met hod) at com.intellij.vfs.local.win32.FileWatcher.b(FileWatcher.java:10) at com.intellij.openapi.vfs.b.b.bd.run(bd.java:6) "AlarmThread" prio=7 tid=0x0F0B5E10 nid=0x520 waiting on monitor [1093f000..1093 fdb4] at java.lang.Object.wait(Native Method) - waiting on <036CF598> (a java.lang.Object) at com.intellij.util.be.run(be.java:44) - locked <036CF598> (a java.lang.Object) "AlarmThread" prio=7 tid=0x0F087508 nid=0x4c8 waiting on monitor [108ff000..108f fdb4] at java.lang.Object.wait(Native Method) - waiting on <036CF600> (a java.lang.Object) at java.lang.Object.wait(Object.java:426) at com.intellij.util.be.run(be.java:16) - locked <036CF600>]]> (a java.lang.Object)
"AWT-EventQueue-0" prio=5 tid=0x0F05BAC0 nid=0x8ec runnable
at
com.intellij.openapi.diagnostic.Logger.isDebugEnabled(Logger.java:6)
at com.intellij.openapi.actionSystem.b.a.getId(a.java:268)
at
com.intellij.openapi.actionSystem.DefaultActionGroup.a(DefaultActionG
roup.java:77)
at
com.intellij.openapi.actionSystem.DefaultActionGroup.a(DefaultActionG
roup.java:36)
at
com.intellij.openapi.actionSystem.DefaultActionGroup.a(DefaultActionG
roup.java:63)
at
com.intellij.openapi.actionSystem.DefaultActionGroup.add(DefaultActio
nGroup.java:4)
at com.intellij.openapi.actionSystem.b.a.a(a.java:269)
at com.intellij.openapi.actionSystem.b.a.b(a.java:319)
at com.intellij.openapi.actionSystem.b.a.a(a.java:76)
- locked ]]> (a java.lang.Object)
at com.intellij.idea.n.r(n.java:53)
at com.intellij.idea.n.g(n.java:65)
at com.intellij.idea.n.a(n.java:54)
at com.intellij.idea.k.run(k.java:2)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:443)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:191)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:144)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
"AWT-Windows" daemon prio=7 tid=0x0EEFC7D8 nid=0x81c runnable
at sun.awt.windows.WToolkit.eventLoop(Native Method)
at sun.awt.windows.WToolkit.run(WToolkit.java:240)
at java.lang.Thread.run(Thread.java:536)
"AWT-Shutdown" prio=5 tid=0x0EEFC510 nid=0x854 waiting on monitor
[f7df000..f7df
db4]
at java.lang.Object.wait(Native Method)
- waiting on (a java.lang.Object) at java.lang.Object.wait(Object.java:426) at sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:259) - locked <03658548>]]> (a java.lang.Object)
at java.lang.Thread.run(Thread.java:536)
"License checker" prio=5 tid=0x0ECCB7F8 nid=0x384 runnable
at java.net.PlainDatagramSocketImpl.receive(Native Method)
- locked (a java.net.PlainDatagramSocketImpl) at java.net.DatagramSocket.receive(DatagramSocket.java:670) - locked <036589A8> (a java.net.DatagramPacket) - locked <036589C8>]]> (a java.net.MulticastSocket)
at com.intellij.ide.d.i.d(i.java:12)
at com.intellij.idea.i.run(i.java:2)
at java.lang.Thread.run(Thread.java:536)
"Thread-1" prio=5 tid=0x00235208 nid=0x7f8 waiting on monitor
"Signal Dispatcher" daemon prio=10 tid=0x008B5530 nid=0x810 waiting on
monitor [
0..0]
"Finalizer" daemon prio=9 tid=0x009562C0 nid=0x8d8 waiting on monitor
[ed8f000..
ed8fdb4]
at java.lang.Object.wait(Native Method)
- waiting on (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111) - locked <03416A00> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159) "Reference Handler" daemon prio=10 tid=0x0EAD0298 nid=0x664 waiting on monitor [ ed4f000..ed4fdb4] at java.lang.Object.wait(Native Method) - waiting on <03416A68> (a java.lang.ref.Reference$Lock) at java.lang.Object.wait(Object.java:426) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:113) - locked <03416A68> (a java.lang.ref.Reference$Lock) "VM Thread" prio=5 tid=0x008E7B00 nid=0x798 runnable "VM Periodic Task Thread" prio=10 tid=0x008B41C8 nid=0x820 waiting on monitor "Suspend Checker Thread" prio=10 tid=0x008B4B38 nid=0x7b8 runnable "Mike Abney" ]]> wrote in message
news:Xns925E97B29B48Dmichaelabney1990@213.182.181.98...
>
>
>
A few comments:
1) The correct way to get the parent for the window is to use:
WindowManager.getInstance().suggestParentWindow(project);
2) You can get the file contents directly from the VirtualFile (contentsToCharArray).
I think you can also get a VirtualFile for the "other" file, even if it is not
in the Project path; try
LocalFileSystem.getInstance().findFileByPath(path)
where "path" should have forward-slashes.
3) perhaps calling gotoFirstDiff on the DiffPanel would solve the scrolling issue.
I did not try it yet. Or it may have to do with not calling setFileType; those
are the only two differences from how I am doing it.
Mike Abney wrote:
--
Erb
==============================================================
"Most of you are familiar with the virtues of a programmer.
There are three, of course: laziness, impatience, and hubris."
- Larry Wall
==============================================================
One more thing: One is supposed to dispose the DiffPanel explicitly
when the window is disposed.
Erb wrote:
>> Announcing DiffFile plugin version 1.0. The plugin adds a new option to
>> the editor popup menu. Selecting "Show differences..." will bring up a
>> file chooser. After choosing the file to "diff" the internal diff viewer
>> will appear in a dialog showing the selected file on the left and the
>> file in the editor on the right.
>> The source comes with the plugin and it's available on the twiki right
>> now at: http://www.intellij.org/twiki/bin/view/Main/DiffFilePlugin
>>
>> Known bugs:
>> 1. The diff viewer always starts out scrolled all the way to the
>> right.
>> NB: I don't do too much Swing work in the first place and this is my
>> first plugin, but it works for what I need. Be gentle with me. ;)
>>
>> ~Mike
--
Erb
==============================================================
"Most of you are familiar with the virtues of a programmer.
There are three, of course: laziness, impatience, and hubris."
- Larry Wall
==============================================================
Thanks for the help!
1) Ah. That's what I get for not reading the API thoroughly before use.
2) I've made this change, but I'm not finding much value in using
VirtualFile over regular java.io.File (except for the obvious
contentsTo... methods). Do we know of (or do any JetBrains folks reading
this feel like giving us) any reasons to choose one over the other?
3) Yes, I had already found that gotoFirstDiff does solve the problem.
As for setFileType, that provides syntax highlighting. :)
On another note, I'm really starting to wonder why the DiffPanelFactory
wants any of its arguments. It doesn't seem to use them at all.
Finally, I'm also trying to figure out what the DialogWrapper class
gives me. If there are any helpful hints, please let me know.
Version 1.1 of the plugin will appear on the wiki shortly. First I'm
going to spend a bit more time trying to figure out the exact problem
Brad is having, but I think I've got an idea of what's causing it.
~Mike
Erb <IDEA@erb.8m.com> wrote in news:aiepgv$mdd$1@is.intellij.net:
Okay, I believe the problem is that the jad plugin and mine were both
using the same menu accelerator key (d). I have changed mine to 's' for
now. I'm thinking this is a problem with the way IDEA handles
accelerator conflicts. Assuming my change (which will be posted onto the
wiki shortly) fixes your problem, I'll post a bug report to the bugs
newsgroup.
Thanks for the report.
~Mike
"Brad" <lanebr@hotmail.com> wrote in news:aiep3g$m7t$1@is.intellij.net:
Mike Abney wrote:
I've posted a short, incomplete starting point in the PluginDocs section of the Wiki.
http://www.intellij.org/twiki/bin/view/Main/PluginDocumentation#How_to_use_DialogWrapper_font_b_
--
Erb
==============================================================
"Most of you are familiar with the virtues of a programmer.
There are three, of course: laziness, impatience, and hubris."
- Larry Wall
==============================================================