Example usage for weka.gui WorkbenchApp getMainPerspective

List of usage examples for weka.gui WorkbenchApp getMainPerspective

Introduction

In this page you can find the example usage for weka.gui WorkbenchApp getMainPerspective.

Prototype

@Override
public Perspective getMainPerspective() 

Source Link

Document

Get the main perspective of this application.

Usage

From source file:adams.gui.menu.Workbench.java

License:Open Source License

/**
 * Launches the functionality of the menu item.
 */// w w  w.j a v  a 2s.  c  om
@Override
public void launch() {
    WorkbenchApp app = new WorkbenchApp();
    createChildFrame(app, GUIHelper.getDefaultLargeDialogDimension());
    if (app.getMainPerspective().acceptsInstances()) {
        if (m_Parameters.length > 0) {
            PlaceholderFile[] files = new PlaceholderFile[m_Parameters.length];
            for (int i = 0; i < m_Parameters.length; i++)
                files[i] = new PlaceholderFile(m_Parameters[i]);
            try {
                AbstractFileLoader loader = ConverterUtils.getLoaderForFile(files[0]);
                loader.setFile(files[0].getAbsoluteFile());
                app.getMainPerspective().setInstances(loader.getDataSet());
            } catch (Exception e) {
                GUIHelper.showErrorMessage(getOwner(),
                        "Failed to load: " + files[0] + "\n" + Utils.throwableToString(e));
            }
        }
    }
}