Search in sources :

Example 6 with FileChooserListener

use of com.kotcrab.vis.ui.widget.file.FileChooserListener in project bladecoder-adventure-engine by bladecoder.

the class ProjectToolbar method loadProject.

private void loadProject() {
    fileChooser.setSelectionMode(SelectionMode.DIRECTORIES);
    getStage().addActor(fileChooser);
    fileChooser.setListener(new FileChooserListener() {

        @Override
        public void selected(Array<FileHandle> files) {
            final File f = files.get(0).file();
            try {
                EditorUtils.checkVersionAndLoadProject(f, getStage(), skin);
            } catch (Exception e) {
                EditorLogger.error("Error loading last project.", e);
                Ctx.project.closeProject();
            }
        }

        @Override
        public void canceled() {
        }
    });
}
Also used : FileChooserListener(com.kotcrab.vis.ui.widget.file.FileChooserListener) FileHandle(com.badlogic.gdx.files.FileHandle) File(java.io.File) IOException(java.io.IOException)

Aggregations

FileHandle (com.badlogic.gdx.files.FileHandle)6 FileChooserListener (com.kotcrab.vis.ui.widget.file.FileChooserListener)6 IOException (java.io.IOException)6 FileChooser (com.kotcrab.vis.ui.widget.file.FileChooser)5 File (java.io.File)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Array (com.badlogic.gdx.utils.Array)1 CustomList (com.bladecoder.engineeditor.ui.panels.CustomList)1 FileTypeFilter (com.kotcrab.vis.ui.widget.file.FileTypeFilter)1