laptop and a wrench

Bug

ArcMap isn't refreshed when using a modal JFileChooser in a Java Add-In.

Last Published: August 25, 2014 ArcGIS for Desktop
Bug ID Number NIM062344
SubmittedOctober 27, 2010
Last ModifiedJune 5, 2024
Applies toArcGIS for Desktop
Version found10.0
Program languageJava
Operating SystemWindows OS
Operating System Version2008
StatusWill Not Be Addressed

Additional Information

We apologize that we were unable to address this issue within the current product support cycle. If the issue continues to affect your work in a supported release, please contact Technical Support.

Workaround

Show a non-modal dialog as with the code below.SwingUtilities.invokeLater(new Runnable() { public void run() { try{ JFileChooser fileChooser = new JFileChooser(); // Create a filter only to show .shp files in file chooser ShapeFileFilter filterSHP = new ShapeFileFilter(); filterSHP.addExtension("shp"); fileChooser.setFileFilter(filterSHP); int returnVal = fileChooser.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); IFeatureWorkspace workSpace = (IFeatureWorkspace) workspaceFactory.openFromFile(file.getParent(), 0); IFeatureClass featureClass = null; featureClass = workSpace.openFeatureClass(file.getName().substring(0,(file.getName().length()-4))); IFeatureLayer layer = null; layer = new FeatureLayer(); layer.setFeatureClassByRef(featureClass); layer.setName(featureClass.getAliasName()); mxDoc = (IMxDocument) app.getDocument(); mxDoc.getFocusMap().addLayer(layer); mxDoc.getActiveView().partialRefresh(esriViewDrawPhase.esriViewGeography, layer, null); } } catch (Exception e) { e.printStackTrace(); } } });

Steps to Reproduce

Bug ID: NIM062344

Software:

  • ArcGIS for Desktop

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options