@@ -79,12 +79,13 @@ public final class SceneExplorerTopComponent extends TopComponent implements Exp
7979 private static final Logger logger = Logger .getLogger (SceneExplorerTopComponent .class .getName ());
8080 private static SceneExplorerTopComponent instance ;
8181 private static final String PREFERRED_ID = "SceneExplorerTopComponent" ;
82- // private final Result<AbstractSceneExplorerNode> nodeSelectionResult;
83- private AbstractSceneExplorerNode selectedSpatial ;
84- private AbstractSceneExplorerNode lastSelected ;
82+
83+ private AbstractSceneExplorerNode [] selectedSpatials ;
84+ private AbstractSceneExplorerNode [] lastSelected ;
8585 private final Map <String , MaterialChangeProvider > materialChangeProviders = new HashMap <>();
8686 private final Map <String , List <MaterialChangeListener >> materialChangeListeners = new HashMap <>();
87- private transient ExplorerManager explorerManager = new ExplorerManager ();
87+
88+ private final transient ExplorerManager explorerManager = new ExplorerManager ();
8889
8990 public SceneExplorerTopComponent () {
9091 initComponents ();
@@ -149,18 +150,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
149150 }// </editor-fold>//GEN-END:initComponents
150151
151152 private void jButton1ActionPerformed (java .awt .event .ActionEvent evt ) {//GEN-FIRST:event_jButton1ActionPerformed
152- if (selectedSpatial == null ) {
153+ if (selectedSpatials == null ) {
153154 return ;
154155 }
155- SwingUtilities .invokeLater (() -> {
156- Node rootNode = SceneExplorerTopComponent .findInstance ().getExplorerManager ().getRootContext ();
157- if (rootNode instanceof JmeNode jmeNode ) {
158- SceneApplication .getApplication ().enqueue (new RefreshJmeSpatial (jmeNode , selectedSpatial .getName ()));
159- } else {
160- selectedSpatial .refresh (false );
161- }
162- });
163-
156+ for (AbstractSceneExplorerNode node : selectedSpatials ) {
157+ node .refresh (false );
158+ }
164159 }//GEN-LAST:event_jButton1ActionPerformed
165160 // Variables declaration - do not modify//GEN-BEGIN:variables
166161 private javax .swing .JScrollPane explorerScrollPane ;
@@ -188,13 +183,13 @@ public static synchronized SceneExplorerTopComponent getDefault() {
188183 * @return
189184 */
190185 public static synchronized SceneExplorerTopComponent findInstance () {
191- TopComponent win = WindowManager .getDefault ().findTopComponent (PREFERRED_ID );
192- if (win == null ) {
186+ TopComponent window = WindowManager .getDefault ().findTopComponent (PREFERRED_ID );
187+ if (window == null ) {
193188 logger .warning (
194189 "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system." );
195190 return getDefault ();
196191 }
197- if (win instanceof SceneExplorerTopComponent sceneExplorerTopComponent ) {
192+ if (window instanceof SceneExplorerTopComponent sceneExplorerTopComponent ) {
198193 return sceneExplorerTopComponent ;
199194 }
200195 logger .warning (
@@ -227,27 +222,20 @@ public void componentClosed() {
227222 SceneApplication .getApplication ().removeSceneListener (this );
228223 // TODO add custom code on component closing
229224 }
230-
225+
231226 void writeProperties (java .util .Properties p ) {
232- // better to version settings since initial version as advocated at
233- // http://wiki.apidesign.org/wiki/PropertyFiles
227+ // Required. Do not remove.
234228 p .setProperty ("version" , "1.0" );
235- // TODO store your settings
236229 }
237-
230+
238231 Object readProperties (java .util .Properties p ) {
232+ // Required. Do not remove.
239233 if (instance == null ) {
240234 instance = this ;
241235 }
242- instance .readPropertiesImpl (p );
243236 return instance ;
244237 }
245238
246- private void readPropertiesImpl (java .util .Properties p ) {
247- // TODO read your settings according to their version
248-
249- }
250-
251239 @ Override
252240 protected String preferredID () {
253241 return PREFERRED_ID ;
@@ -263,18 +251,16 @@ public ExplorerManager getExplorerManager() {
263251 return explorerManager ;
264252 }
265253
266- public void setSelectedNode (AbstractSceneExplorerNode node ) {
267- selectedSpatial = node ;
268- if (node != null ) {
269- lastSelected = node ;
254+ public void setSelectedNode (AbstractSceneExplorerNode [] nodes ) {
255+ selectedSpatials = nodes ;
256+ if (nodes != null ) {
257+ lastSelected = nodes ;
270258 }
271259 try {
272- if (node != null ) {
273- explorerManager .setSelectedNodes (new Node []{node });
274- // setActivatedNodes(new Node[]{node});
260+ if (nodes != null ) {
261+ explorerManager .setSelectedNodes (nodes );
275262 } else {
276263 explorerManager .setSelectedNodes (new Node []{});
277- // setActivatedNodes(new Node[]{});
278264 }
279265 } catch (PropertyVetoException ex ) {
280266 Exceptions .printStackTrace (ex );
@@ -309,11 +295,11 @@ public void sceneClosed(SceneRequest request) {
309295 @ Override
310296 public void previewCreated (PreviewRequest request ) {
311297 }
312-
298+
313299 /**
314300 * @return the selectedSpatial
315301 */
316- public AbstractSceneExplorerNode getLastSelected () {
302+ public AbstractSceneExplorerNode [] getLastSelected () {
317303 return lastSelected ;
318304 }
319305
0 commit comments