// Path: DataHierarchy/src/de/loskutov/dh/DataHierarchyPlugin.java
// public class DataHierarchyPlugin extends AbstractUIPlugin {
// 
//     private static DataHierarchyPlugin plugin;
// 
//     private int viewCount;
// 
//     public static final Object JOB_FAMILY = DataHierarchyPlugin.class;
// 
//     public DataHierarchyPlugin() {
//         super();
//     }
// 
//     public static void logError(String message, Throwable e) {
//         if (message == null) {
//             message = e.getMessage();
//             if (message == null) {
//                 message = e.toString();
//             }
//         }
//         getDefault().getLog().log(new Status(IStatus.ERROR, getId(), IStatus.OK, message, e));
//     }
// 
//     public static void showError(String message, Throwable error) {
//         Shell shell = getShell();
//         if (message == null) {
//             message = Messages.error;
//         }
//         message = message + " " + error.getMessage();
// 
//         getDefault().getLog().log(new Status(IStatus.ERROR, getId(), IStatus.OK, message, error));
// 
//         MessageDialog.openError(shell, Messages.title, message);
//     }
// 
//     public static Shell getShell() {
//         return getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
//     }
// 
//     public static String getId() {
//         return getDefault().getBundle().getSymbolicName();
//     }
// 
//     @Override
//     public void start(BundleContext context) throws Exception {
//         super.start(context);
//         if(plugin == null) {
//             plugin = this;
//         }
//     }
// 
//     /**
//      * Returns the shared instance
//      *
//      * @return the shared instance
//      */
//     public static DataHierarchyPlugin getDefault() {
//         return plugin;
//     }
// 
//     /**
//      * Returns an image descriptor for the image file at the given plug-in
//      * relative path
//      *
//      * @param path
//      *            the path
//      * @return the image descriptor
//      */
//     public static ImageDescriptor getImageDescriptor(String path) {
//         return imageDescriptorFromPlugin(getId(), path);
//     }
// 
//     public static String nextViewId(){
//         DataHierarchyPlugin hierarchyPlugin = getDefault();
//         int next;
//         synchronized (hierarchyPlugin) {
//             hierarchyPlugin.viewCount ++;
//             next = hierarchyPlugin.viewCount;
//         }
//         return String.valueOf(next);
//     }
// }
// 
// Path: DataHierarchy/src/de/loskutov/dh/Messages.java
// public class Messages  extends NLS {
//     private static final String BUNDLE_NAME = "de.loskutov.dh.messages";//$NON-NLS-1$
// 
//     private Messages() {
//         // Do not instantiate
//     }
// 
//     static {
//         NLS.initializeMessages(BUNDLE_NAME, Messages.class);
//     }
// 
//     public static String get(String key){
//         Field field;
//         try {
//             field = Messages.class.getField(key);
//             return (String) field.get(null);
//         } catch (Exception e) {
//             DataHierarchyPlugin.logError("Missing resource for key: " + key, e);
//             return key;
//         }
//     }
// 
//     public static String title;
//     public static String error;
//     public static String pref_Add_filter;
//     public static String pref_Add_filterTip;
//     public static String pref_RemoveFilter;
//     public static String pref_RemoveFilterTip;
//     public static String pref_Enable_all;
//     public static String pref_Enable_allTip;
//     public static String pref_Disable_all;
//     public static String pref_Disable_allTip;
//     public static String pref_Invalid_file_filter;
//     public static String pref_Edit_filter;
//     public static String pref_Edit_filterTip;
// 
//     public static String action_showStaticsOnly_text;
//     public static String action_showStaticsOnly_toolTipText;
//     public static String action_showStaticsOnly_image;
// 
//     public static String action_showPrimitivesToo_text;
//     public static String action_showPrimitivesToo_toolTipText;
//     public static String action_showPrimitivesToo_image;
// 
//     public static String action_showArrays_text;
//     public static String action_showArrays_toolTipText;
//     public static String action_showArrays_image;
// 
//     public static String action_autoRemoveEmptyElements_text;
//     public static String action_autoRemoveEmptyElements_toolTipText;
//     public static String action_autoRemoveEmptyElements_image;
// 
// 
// }


import org.eclipse.jface.action.Action;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import de.loskutov.dh.DataHierarchyPlugin;
import de.loskutov.dh.Messages;
/*******************************************************************************
 * Copyright (c) 2009 - 2015 Andrey Loskutov.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributor:  Andrey Loskutov - initial API and implementation
 *******************************************************************************/

package de.loskutov.dh.views;




/**
 * Default action which could be used as template for "toggle" action.
 * Action image, text and tooltip will be initialized by default.
 * To use it, register IPropertyChangeListener and check for IAction.CHECKED
 * event name.
 */
public abstract class DefaultToggleAction extends Action {

    private static final String ACTION = "action";

    public DefaultToggleAction(String id) {
        super();
        setId(id);
        init();

// Path: DataHierarchy/src/de/loskutov/dh/DataHierarchyPlugin.java
// public class DataHierarchyPlugin extends AbstractUIPlugin {
// 
//     private static DataHierarchyPlugin plugin;
// 
//     private int viewCount;
// 
//     public static final Object JOB_FAMILY = DataHierarchyPlugin.class;
// 
//     public DataHierarchyPlugin() {
//         super();
//     }
// 
//     public static void logError(String message, Throwable e) {
//         if (message == null) {
//             message = e.getMessage();
//             if (message == null) {
//                 message = e.toString();
//             }
//         }
//         getDefault().getLog().log(new Status(IStatus.ERROR, getId(), IStatus.OK, message, e));
//     }
// 
//     public static void showError(String message, Throwable error) {
//         Shell shell = getShell();
//         if (message == null) {
//             message = Messages.error;
//         }
//         message = message + " " + error.getMessage();
// 
//         getDefault().getLog().log(new Status(IStatus.ERROR, getId(), IStatus.OK, message, error));
// 
//         MessageDialog.openError(shell, Messages.title, message);
//     }
// 
//     public static Shell getShell() {
//         return getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
//     }
// 
//     public static String getId() {
//         return getDefault().getBundle().getSymbolicName();
//     }
// 
//     @Override
//     public void start(BundleContext context) throws Exception {
//         super.start(context);
//         if(plugin == null) {
//             plugin = this;
//         }
//     }
// 
//     /**
//      * Returns the shared instance
//      *
//      * @return the shared instance
//      */
//     public static DataHierarchyPlugin getDefault() {
//         return plugin;
//     }
// 
//     /**
//      * Returns an image descriptor for the image file at the given plug-in
//      * relative path
//      *
//      * @param path
//      *            the path
//      * @return the image descriptor
//      */
//     public static ImageDescriptor getImageDescriptor(String path) {
//         return imageDescriptorFromPlugin(getId(), path);
//     }
// 
//     public static String nextViewId(){
//         DataHierarchyPlugin hierarchyPlugin = getDefault();
//         int next;
//         synchronized (hierarchyPlugin) {
//             hierarchyPlugin.viewCount ++;
//             next = hierarchyPlugin.viewCount;
//         }
//         return String.valueOf(next);
//     }
// }
// 
// Path: DataHierarchy/src/de/loskutov/dh/Messages.java
// public class Messages  extends NLS {
//     private static final String BUNDLE_NAME = "de.loskutov.dh.messages";//$NON-NLS-1$
// 
//     private Messages() {
//         // Do not instantiate
//     }
// 
//     static {
//         NLS.initializeMessages(BUNDLE_NAME, Messages.class);
//     }
// 
//     public static String get(String key){
//         Field field;
//         try {
//             field = Messages.class.getField(key);
//             return (String) field.get(null);
//         } catch (Exception e) {
//             DataHierarchyPlugin.logError("Missing resource for key: " + key, e);
//             return key;
//         }
//     }
// 
//     public static String title;
//     public static String error;
//     public static String pref_Add_filter;
//     public static String pref_Add_filterTip;
//     public static String pref_RemoveFilter;
//     public static String pref_RemoveFilterTip;
//     public static String pref_Enable_all;
//     public static String pref_Enable_allTip;
//     public static String pref_Disable_all;
//     public static String pref_Disable_allTip;
//     public static String pref_Invalid_file_filter;
//     public static String pref_Edit_filter;
//     public static String pref_Edit_filterTip;
// 
//     public static String action_showStaticsOnly_text;
//     public static String action_showStaticsOnly_toolTipText;
//     public static String action_showStaticsOnly_image;
// 
//     public static String action_showPrimitivesToo_text;
//     public static String action_showPrimitivesToo_toolTipText;
//     public static String action_showPrimitivesToo_image;
// 
//     public static String action_showArrays_text;
//     public static String action_showArrays_toolTipText;
//     public static String action_showArrays_image;
// 
//     public static String action_autoRemoveEmptyElements_text;
//     public static String action_autoRemoveEmptyElements_toolTipText;
//     public static String action_autoRemoveEmptyElements_image;
// 
// 
// }


// Path: DataHierarchy/src/de/loskutov/dh/views/DefaultToggleAction.java
import org.eclipse.jface.action.Action;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import de.loskutov.dh.DataHierarchyPlugin;
import de.loskutov.dh.Messages;

/*******************************************************************************
 * Copyright (c) 2009 - 2015 Andrey Loskutov.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributor:  Andrey Loskutov - initial API and implementation
 *******************************************************************************/

package de.loskutov.dh.views;




/**
 * Default action which could be used as template for "toggle" action.
 * Action image, text and tooltip will be initialized by default.
 * To use it, register IPropertyChangeListener and check for IAction.CHECKED
 * event name.
 */
public abstract class DefaultToggleAction extends Action {

    private static final String ACTION = "action";

    public DefaultToggleAction(String id) {
        super();
        setId(id);
        init();

        IPreferenceStore store = DataHierarchyPlugin.getDefault().getPreferenceStore();