Package org.flexdock.perspective.actions

Source Code of org.flexdock.perspective.actions.OpenPerspectiveAction

/*
* Created on Jun 8, 2005
*/
package org.flexdock.perspective.actions;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;

import org.flexdock.perspective.Perspective;
import org.flexdock.perspective.PerspectiveManager;

/**
* @author Christopher Butler
*/
public class OpenPerspectiveAction extends AbstractAction {
    private String m_perspective;

    public OpenPerspectiveAction(String perspectiveId) {
        if (perspectiveId == null) throw new IllegalArgumentException("perspectiveId cannot be null");
        m_perspective = perspectiveId;

        Perspective perspective = getPerspective();
        if(perspective!=null)
            putValue(Action.NAME, perspective.getName());
    }

    public Perspective getPerspective() {
        return PerspectiveManager.getInstance().getPerspective(m_perspective);
    }

    public void actionPerformed(ActionEvent e) {
        if (m_perspective != null) {
            PerspectiveManager.getInstance().loadPerspective(m_perspective);
        }
    }
}
TOP

Related Classes of org.flexdock.perspective.actions.OpenPerspectiveAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.