Search in sources :

Example 1 with ScoreObjectEditor

use of blue.soundObject.editor.ScoreObjectEditor in project blue by kunstmusik.

the class ScoreObjectEditorTopComponent method editScoreObject.

public void editScoreObject(ScoreObject sObj) {
    if (currentSoundObject == sObj) {
        return;
    }
    currentSoundObject = sObj;
    cardLayout.show(editPanel, "none");
    if (sObj == null) {
        // JOptionPane.showMessageDialog(null, "yo");
        return;
    }
    ScoreObject sObjToEdit = sObj;
    BlueData data = BlueProjectManager.getInstance().getCurrentBlueData();
    if (sObj instanceof Instance) {
        sObjToEdit = ((Instance) sObj).getSoundObject();
        this.setEditingLibraryObject(SelectionEvent.SELECTION_LIBRARY);
    } else if (data.getSoundObjectLibrary().contains(sObjToEdit)) {
        this.setEditingLibraryObject(SelectionEvent.SELECTION_LIBRARY);
    } else {
        this.setEditingLibraryObject(null);
    }
    ScoreObjectEditor editor = editors.get(sObjToEdit.getClass());
    if (editor == null) {
        for (Class c : sObjEditorMap.keySet()) {
            if (c.isAssignableFrom(sObjToEdit.getClass())) {
                LazyPlugin<ScoreObjectEditor> plugin = sObjEditorMap.get(c);
                editor = plugin.getInstance();
                editors.put(sObjToEdit.getClass(), editor);
                editPanel.add(editor, editor.getClass().getName());
                break;
            }
        }
    }
    if (editor == null) {
        DialogDisplayer.getDefault().notify(new NotifyDescriptor("Could not find editor for SoundObject of type: " + sObjToEdit.getClass().getCanonicalName(), "Error", NotifyDescriptor.DEFAULT_OPTION, NotifyDescriptor.ERROR_MESSAGE, null, null));
        return;
    }
    editor.editScoreObject(sObjToEdit);
    cardLayout.show(editPanel, editor.getClass().getName());
// Logger.getLogger(ScoreObjectEditorTopComponent.class.getName()).fine("SoundObject Selected: " + className);;
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) BlueData(blue.BlueData) Instance(blue.soundObject.Instance) ScoreObject(blue.score.ScoreObject) ScoreObjectEditor(blue.soundObject.editor.ScoreObjectEditor)

Aggregations

BlueData (blue.BlueData)1 ScoreObject (blue.score.ScoreObject)1 Instance (blue.soundObject.Instance)1 ScoreObjectEditor (blue.soundObject.editor.ScoreObjectEditor)1 NotifyDescriptor (org.openide.NotifyDescriptor)1