Search in sources :

Example 1 with GMGenBeingClosedMessage

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

the class GMGenSystem method handleMessage.

/**
     * Message handler for the GMBus.
     * 
     * @param message
     *            The message passed in from the bus
     */
@Override
public void handleMessage(PCGenMessage message) {
    // A plugin is asking for the creation of a new tab
    if (message instanceof RequestAddTabToGMGenMessage) {
        RequestAddTabToGMGenMessage tmessage = (RequestAddTabToGMGenMessage) message;
        Logging.debugPrint("Creating Tab " + GMGenSystemView.getTabPane().getTabCount());
        theView.insertPane(tmessage.getName(), tmessage.getPane(), GMGenSystemView.getTabPane().getTabCount());
    } else if (message instanceof RequestAddPreferencesPanelMessage) {
        RequestAddPreferencesPanelMessage pmessage = (RequestAddPreferencesPanelMessage) message;
        Logging.debugPrint("Creating Preferences Panel");
        rootNode.addPanel(pmessage.getName(), pmessage.getPrefsPanel());
    } else // A plugin is asking for the creation of a new option in the tool menu
    if (message instanceof AddMenuItemToGMGenToolsMenuMessage) {
        AddMenuItemToGMGenToolsMenuMessage mmessage = (AddMenuItemToGMGenToolsMenuMessage) message;
        toolsMenu.add(mmessage.getMenuItem());
    } else if (message instanceof GMGenBeingClosedMessage) {
        setCloseSettings();
        // Karianna 07/03/2008 - Added a call to exitForm passing in no
        // window event
        // TODO This sequence of calls simply hides GMGen as opposed to
        // unloading it
        exitForm(null);
    }
}
Also used : RequestAddTabToGMGenMessage(gmgen.pluginmgr.messages.RequestAddTabToGMGenMessage) AddMenuItemToGMGenToolsMenuMessage(gmgen.pluginmgr.messages.AddMenuItemToGMGenToolsMenuMessage) RequestAddPreferencesPanelMessage(gmgen.pluginmgr.messages.RequestAddPreferencesPanelMessage) GMGenBeingClosedMessage(gmgen.pluginmgr.messages.GMGenBeingClosedMessage)

Example 2 with GMGenBeingClosedMessage

use of gmgen.pluginmgr.messages.GMGenBeingClosedMessage 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

GMGenBeingClosedMessage (gmgen.pluginmgr.messages.GMGenBeingClosedMessage)2 AddMenuItemToGMGenToolsMenuMessage (gmgen.pluginmgr.messages.AddMenuItemToGMGenToolsMenuMessage)1 FileMenuOpenMessage (gmgen.pluginmgr.messages.FileMenuOpenMessage)1 RequestAddPreferencesPanelMessage (gmgen.pluginmgr.messages.RequestAddPreferencesPanelMessage)1 RequestAddTabToGMGenMessage (gmgen.pluginmgr.messages.RequestAddTabToGMGenMessage)1 FocusOrStateChangeOccurredMessage (pcgen.pluginmgr.messages.FocusOrStateChangeOccurredMessage)1 PlayerCharacterWasClosedMessage (pcgen.pluginmgr.messages.PlayerCharacterWasClosedMessage)1 PlayerCharacterWasLoadedMessage (pcgen.pluginmgr.messages.PlayerCharacterWasLoadedMessage)1