Changeset 180 in tmcsimulator-scriptbuilder for trunk/src/event/editor/frame/Editor.java


Ignore:
Timestamp:
12/23/2019 08:57:26 AM (6 years ago)
Author:
sdanthin
Message:

PropertyPanels?.java added a function to get properties from a certain jPanel.
Editor.java used above function to auto-close the editor window when it has no more events contained.
AudioPanel?.java modified to NOT allow audioEvents in the Event Editor to be deleted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/event/editor/frame/Editor.java

    r173 r180  
    549549 
    550550        int index = eventTabsPane.getSelectedIndex(); 
    551  
     551        //checks if there is a component at the tab selected, if so, then remove the associated event from the data model, 
     552        //and if it is removed, then remove the associated editor window. 
    552553        if (index >= 0 && eventTabsPane.getTabComponentAt(index) != null) 
    553554        { 
    554555            JPanel removable = (JPanel) eventTabsPane 
    555556                    .getSelectedComponent(); 
    556             PropertyPanel update = this.model.properties.removeProperty(removable); 
    557  
    558             ((I_ScriptEventEditorPanel) update.getPanel()).removeAssociatedEvent(); 
    559  
     557            PropertyPanel removedProperty = this.model.properties.getProperty(removable); 
     558             
     559            if(((I_ScriptEventEditorPanel) removedProperty.getPanel()).removeAssociatedEvent()) 
     560            { 
     561                this.model.properties.removeProperty(removable); 
     562            } 
     563 
     564        } 
     565         
     566        //prevents an "empty editor" from appearing 
     567        if(eventTabsPane.getSelectedComponent() == null) 
     568        { 
     569            updateEventTime(); 
     570            this.closeWindow(); 
    560571        } 
    561572 
Note: See TracChangeset for help on using the changeset viewer.