Search in sources :

Example 1 with FileMenuOpenMessage

use of gmgen.pluginmgr.messages.FileMenuOpenMessage in project pcgen by PCGen.

the class PCGTrackerPlugin method handleMessage.

/**
	 * listens to messages from the GMGen system, and handles them as needed
	 * @param message the source of the event from the system
	 */
@Override
public void handleMessage(PCGenMessage message) {
    if (message instanceof FileMenuOpenMessage) {
        if (isActive()) {
            handleOpen();
        }
    } else if (message instanceof PlayerCharacterWasLoadedMessage) {
        PlayerCharacterWasLoadedMessage cmessage = (PlayerCharacterWasLoadedMessage) message;
        model.add(cmessage.getPc());
    } else if (message instanceof FocusOrStateChangeOccurredMessage) {
        if (isActive()) {
            charToolsItem.setEnabled(false);
            try {
                GMGenSystem.inst.openFileItem.setEnabled(true);
            } catch (Exception e) {
            // TODO Handle this?
            }
        } else {
            charToolsItem.setEnabled(true);
        }
    } else if (message instanceof GMGenBeingClosedMessage) {
        handleClose();
    } else /*else if (message instanceof SavePCGRequestMessage)
		 {
		 SavePCGRequestMessage smessage = (SavePCGRequestMessage) message;
		 savePC(smessage.getPC(), false);
		 }*/
    if (message instanceof PlayerCharacterWasClosedMessage) {
        PlayerCharacterWasClosedMessage cmessage = (PlayerCharacterWasClosedMessage) message;
        model.remove(cmessage.getPC());
    }
}
Also used : PlayerCharacterWasLoadedMessage(pcgen.pluginmgr.messages.PlayerCharacterWasLoadedMessage) FocusOrStateChangeOccurredMessage(pcgen.pluginmgr.messages.FocusOrStateChangeOccurredMessage) FileMenuOpenMessage(gmgen.pluginmgr.messages.FileMenuOpenMessage) PlayerCharacterWasClosedMessage(pcgen.pluginmgr.messages.PlayerCharacterWasClosedMessage) GMGenBeingClosedMessage(gmgen.pluginmgr.messages.GMGenBeingClosedMessage)

Aggregations

FileMenuOpenMessage (gmgen.pluginmgr.messages.FileMenuOpenMessage)1 GMGenBeingClosedMessage (gmgen.pluginmgr.messages.GMGenBeingClosedMessage)1 FocusOrStateChangeOccurredMessage (pcgen.pluginmgr.messages.FocusOrStateChangeOccurredMessage)1 PlayerCharacterWasClosedMessage (pcgen.pluginmgr.messages.PlayerCharacterWasClosedMessage)1 PlayerCharacterWasLoadedMessage (pcgen.pluginmgr.messages.PlayerCharacterWasLoadedMessage)1