@@ -79,12 +79,13 @@ public final class SceneExplorerTopComponent extends TopComponent implements Exp
79
79
private static final Logger logger = Logger .getLogger (SceneExplorerTopComponent .class .getName ());
80
80
private static SceneExplorerTopComponent instance ;
81
81
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 ;
85
85
private final Map <String , MaterialChangeProvider > materialChangeProviders = new HashMap <>();
86
86
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 ();
88
89
89
90
public SceneExplorerTopComponent () {
90
91
initComponents ();
@@ -149,18 +150,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
149
150
}// </editor-fold>//GEN-END:initComponents
150
151
151
152
private void jButton1ActionPerformed (java .awt .event .ActionEvent evt ) {//GEN-FIRST:event_jButton1ActionPerformed
152
- if (selectedSpatial == null ) {
153
+ if (selectedSpatials == null ) {
153
154
return ;
154
155
}
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
+ }
164
159
}//GEN-LAST:event_jButton1ActionPerformed
165
160
// Variables declaration - do not modify//GEN-BEGIN:variables
166
161
private javax .swing .JScrollPane explorerScrollPane ;
@@ -188,13 +183,13 @@ public static synchronized SceneExplorerTopComponent getDefault() {
188
183
* @return
189
184
*/
190
185
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 ) {
193
188
logger .warning (
194
189
"Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system." );
195
190
return getDefault ();
196
191
}
197
- if (win instanceof SceneExplorerTopComponent sceneExplorerTopComponent ) {
192
+ if (window instanceof SceneExplorerTopComponent sceneExplorerTopComponent ) {
198
193
return sceneExplorerTopComponent ;
199
194
}
200
195
logger .warning (
@@ -227,27 +222,20 @@ public void componentClosed() {
227
222
SceneApplication .getApplication ().removeSceneListener (this );
228
223
// TODO add custom code on component closing
229
224
}
230
-
225
+
231
226
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.
234
228
p .setProperty ("version" , "1.0" );
235
- // TODO store your settings
236
229
}
237
-
230
+
238
231
Object readProperties (java .util .Properties p ) {
232
+ // Required. Do not remove.
239
233
if (instance == null ) {
240
234
instance = this ;
241
235
}
242
- instance .readPropertiesImpl (p );
243
236
return instance ;
244
237
}
245
238
246
- private void readPropertiesImpl (java .util .Properties p ) {
247
- // TODO read your settings according to their version
248
-
249
- }
250
-
251
239
@ Override
252
240
protected String preferredID () {
253
241
return PREFERRED_ID ;
@@ -263,18 +251,16 @@ public ExplorerManager getExplorerManager() {
263
251
return explorerManager ;
264
252
}
265
253
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 ;
270
258
}
271
259
try {
272
- if (node != null ) {
273
- explorerManager .setSelectedNodes (new Node []{node });
274
- // setActivatedNodes(new Node[]{node});
260
+ if (nodes != null ) {
261
+ explorerManager .setSelectedNodes (nodes );
275
262
} else {
276
263
explorerManager .setSelectedNodes (new Node []{});
277
- // setActivatedNodes(new Node[]{});
278
264
}
279
265
} catch (PropertyVetoException ex ) {
280
266
Exceptions .printStackTrace (ex );
@@ -309,11 +295,11 @@ public void sceneClosed(SceneRequest request) {
309
295
@ Override
310
296
public void previewCreated (PreviewRequest request ) {
311
297
}
312
-
298
+
313
299
/**
314
300
* @return the selectedSpatial
315
301
*/
316
- public AbstractSceneExplorerNode getLastSelected () {
302
+ public AbstractSceneExplorerNode [] getLastSelected () {
317
303
return lastSelected ;
318
304
}
319
305
0 commit comments