/**
 * file src/edu/emory/library/namedropper/plugins/PluginOptions.java
 *
 * Copyright 2012 Emory University Library
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package edu.emory.library.namedropper.plugins;

import javax.swing.AbstractAction;

import java.awt.event.KeyEvent;
import javax.swing.KeyStroke;
import java.awt.event.InputEvent;

import ro.sync.exml.workspace.api.PluginWorkspaceProvider;
import ro.sync.exml.workspace.api.PluginWorkspace;
import ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace;

public class PluginOptions {

    // option keys
    public static String DOCUMENT_TYPE = "NameDropper:DocumentType";
    public static String DEFAULT_ACTION = "NameDropper:DefaultAction";

    // static variables for option keys
    // methods for getting/setting options

    public static String getOption(String optionName) {
        PluginWorkspace ws = PluginWorkspaceProvider.getPluginWorkspace();
        return ws.getOptionsStorage().getOption(optionName, "");  // FIXME: use null instead?
    }

    public static void setOption(String optionName, String value) {
        PluginWorkspace ws = PluginWorkspaceProvider.getPluginWorkspace();
        ws.getOptionsStorage().setOption(optionName, value);
    }

    public static String getDocumentType() {
        return PluginOptions.getOption(PluginOptions.DOCUMENT_TYPE);
    }

    public static void setDocumentType(String value) {
        PluginOptions.setOption(PluginOptions.DOCUMENT_TYPE, value);
    }

    public static String getDefaultAction() {
        return PluginOptions.getOption(PluginOptions.DEFAULT_ACTION);
    }

    public static void setDefaultAction(String value) {
        PluginOptions.setOption(PluginOptions.DEFAULT_ACTION, value);
    }

}

@@ -1313,16 +1313,487 @@
 ptions%0A%0A
+    /**%0A     * Convenience method for accessing the current plugin workspace.%0A     * Wrapper around PluginWorkspaceProvider.getPluginWorkspace().%0A     */%0A    public static PluginWorkspace getWorkspace() %7B%0A        return PluginWorkspaceProvider.getPluginWorkspace();%0A    %7D%0A%0A%0A    /**%0A     * Convenience method to get a plugin option by name.%0A     * Currently defaults to empty string of option is not set.%0A     * @param optionName    name of the option to retrieve%0A     */%0A
     publ
@@ -1879,35 +1879,19 @@
 ugin
-WorkspaceProvider.getPlugin
+Options.get
 Work
@@ -1992,32 +1992,197 @@
 instead?%0A    %7D%0A%0A
+    /**%0A     * Convenience method to set a plugin option.%0A     * @param optionName  name of the option to be updated%0A     * @param value     value to be set%0A     */%0A
     public stati
@@ -2272,35 +2272,19 @@
 ugin
-WorkspaceProvider.getPlugin
+Options.get
 Work
@@ -2352,32 +2352,100 @@
  value);%0A    %7D%0A%0A
+    /**%0A     * Get the current user-selected document type.%0A     */%0A
     public stati
@@ -2541,32 +2541,99 @@
 T_TYPE);%0A    %7D%0A%0A
+    /*%0A     * Set the current user-selected document type.%0A     */%0A
     public stati
@@ -2739,32 +2739,86 @@
  value);%0A    %7D%0A%0A
+    /*%0A     * Get the current default action.%0A     */%0A
     public stati
@@ -2920,24 +2920,79 @@
 ON);%0A    %7D%0A%0A
+    /**%0A     * Set the current default action.%0A     */%0A
     public s

Add wrapper method for static access to plugin workspace; document plugin option methods