File chooser dialog hangs when DockableWindow exists in ArcMap 10.1 (Java AddIn)

692
3
09-25-2012 03:49 PM
PetraZieger
New Contributor II
Hello,
we developed a Java AddIn, with some dialogs (Java File Chooser, Java Message Dialog). They work in ArcMap 10.0 very fine. In ArcMap 10.1 the dialog and ArcMap hangs. I think, it's a bug in 10.1, but I don't know who to prove this. I found an ESRI-File-Chooser-AddIn-Example in Java, which works good (AddLayerButton):

http://resources.arcgis.com/en/help/arcobjects-java/concepts/engine/index.html#//00010000061m000000

I add a new Button on the Toolbar (ParaTest) with the possibility to open a an DockableWindow. There is only a JButton (ClickMe) inside a JPanel without further functionality. With the ParaTest-Button I can show/hide the dockableWindow. The init-methode of the dockableWindow creates the DockabelWindow, so the DockabelWindow exists, already when ArcMap hat started (when the AddIn is already loaded). Consequently in both cases (with shown and hidden DockableWindow) the AddLayer-Button does not work and the File Chooser dialog hangs and I have to kill the ArcMap process.

Obviously the DockableWindow (also in the hidden case) causes a crash of the java file chooser dialog.

The little Addin with the two buttons and the dockablewindow is attached (source code and also the ready-to-use esriAddin. Everybody, who hat 10.1 installed, can help me. Does the AddIn behaves on other computers in the same way as I described?

Has anybody an idea, how to implement a file chooser as a Java-Addin with ArcObjects 10.1?

Greetings from Wachtberg in Germany,
Petra
0 Kudos
3 Replies
PetraZieger
New Contributor II
Hello again,
I contacted the support from ESRI and they identified a bug in the ArcObjects Java API in 10.1. This is the reason why Java dialogs (like the file chooser) don't work in ArcMap 10.1.

The Bug hat the number NIM085371 (The "Java Add Layer" button in "Simple add-in in ArcMap" sample for ArcObjects JAVA SDK 10.1 freezes ArcMap.) You can find the status of the Bug here:

http://support.esri.com/en/bugs/nimbus/TklNMDg1Mzcx

This is a general problem with every Java-dialog (message dialog, number dialog oder fileChooser dialog). For the message dialog and number dialog there is a workaround: Use the ArcGIS-Objects inside of the API (not so nice but o.k.). But there is no fileChooser-Object in the ArcObjects API 10.0 or 10.1, so I decided to go back to the version 10.0. In ArcMap 10.0 every Java-dialog works without problems!

Greetings from Wachtberg,
Petra Zieger
0 Kudos
LeoDonahue
Occasional Contributor III
Petra,

I'm not on version 10.1 yet, but I'm having a hard time believing that the ArcObjects API is causing JFileChooser to crash ArcMap.  Did ESRI say there was a bug in the sample code, or a bug in the ArcObjects API?  When I read the Bug Report, I'm reading it as the sample is causing the problem, not the ArcObjects API.

Have you tried creating a Java Button Add-in that launches a JFrame which contains a JFileChooser?  Does that also crash ArcMap?

Are you using a 64 bit Java Runtime for your 10.1 Java Add-in?
0 Kudos
PetraZieger
New Contributor II
Hello Leo,
I'm sure, it's a bug in the java-API and not in the sample-code.
The discription of the bug is not really good, you are right....

The small AddLayer-AddIn with the sample code works in 10.0 and in 10.1 very good,
when there is no dockable window in the AddIn. When there is a dockable window,
the code only works with 10.0 and not with 10.1. It is a bug in the Java-API 10.1.

You find my Add-Layer-AddIn in the attachment to this replay. You can test it in your environment.

We still use a 32-bit-java-environment.

One more tipp: If you have checked the option
"Create console window for ArcGIS applications (ArcMap/ArcCatalog)" with the tool
C:\Program Files (x86)\ArcGIS\Desktop10.0\Bin\JavaConfigTool.exe (you can check it as admin)
the filechooser will always be behind your ArcMap-Window.....
Perhapst you think nothing happens...
....than minimize ArcMap and see the dialog behind?!

Greetings
Petra
0 Kudos