2323import java .io .File ;
2424import java .io .IOException ;
2525import java .util .ArrayList ;
26- import java .util .Collections ;
26+ import java .util .Arrays ;
2727import java .util .LinkedHashMap ;
2828import java .util .LinkedList ;
2929import java .util .List ;
3030import java .util .Map ;
3131import java .util .Map .Entry ;
32+ import java .util .Set ;
33+ import java .util .TreeSet ;
3234import java .util .logging .Logger ;
3335import java .util .stream .Collectors ;
3436import javax .swing .event .DocumentEvent ;
4446import org .openide .loaders .DataObject ;
4547import org .openide .nodes .Node ;
4648import org .openide .util .HelpCtx ;
47- import org .openide .util .lookup .InstanceContent ;
4849import org .openide .windows .CloneableTopComponent ;
4950
5051/**
@@ -57,7 +58,6 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
5758
5859 private static MaterialEditorTopComponent instance ;
5960 private static final String PREFERRED_ID = "MaterialEditorTopComponent" ;
60- private final InstanceContent lookupContents = new InstanceContent ();
6161 private DataObject dataObject ;
6262 private EditableMaterialFile materialFile ;
6363 private String materialFileName ;
@@ -572,15 +572,8 @@ public void setMatDefList(final String[] matDefs, String selected) {
572572 materialFile = null ;
573573 jComboBox1 .removeAllItems ();
574574 jComboBox1 .addItem ("" );
575- List <String > matDefList = new ArrayList <>();
576- for (String s : matDefs ) {
577- if (!matDefList .contains (s )){
578- matDefList .add (s );
579- }
580- }
581- Collections .sort (matDefList );
582- String [] sortedMatDefs = matDefList .toArray (String []::new );
583- for (String string : sortedMatDefs ) {
575+ Set <String > matDefList = new TreeSet <>(Arrays .asList (matDefs ));
576+ for (String string : matDefList ) {
584577 jComboBox1 .addItem (string );
585578 }
586579 jComboBox1 .setSelectedItem (selected );
@@ -589,13 +582,13 @@ public void setMatDefList(final String[] matDefs, String selected) {
589582
590583 private void updateProperties () {
591584 for (Component component : optionsPanel .getComponents ()) {
592- if (component instanceof MaterialPropertyWidget ) {
593- (( MaterialPropertyWidget ) component ) .registerChangeListener (null );
585+ if (component instanceof MaterialPropertyWidget materialPropertyWidget ) {
586+ materialPropertyWidget .registerChangeListener (null );
594587 }
595588 }
596589 for (Component component : texturePanel .getComponents ()) {
597- if (component instanceof MaterialPropertyWidget ) {
598- (( MaterialPropertyWidget ) component ) .registerChangeListener (null );
590+ if (component instanceof MaterialPropertyWidget materialPropertyWidget ) {
591+ materialPropertyWidget .registerChangeListener (null );
599592 }
600593 }
601594 optionsPanel .removeAll ();
0 commit comments