alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun
 * Microsystems, Inc. All Rights Reserved.
 */
package org.netbeans.modules.xml.tree;

import java.util.List;
import java.util.LinkedList;
import java.util.Arrays;

import org.openide.modules.ModuleInstall;
import org.openide.loaders.DataLoader;
import org.openide.util.actions.SystemAction;
import org.openide.actions.OpenAction;

import org.netbeans.modules.xml.core.XMLDataLoader;
import org.netbeans.modules.xml.core.DTDDataLoader;

/**
 * Module installation class for tree-edit module.
 *
 * @author Libor Kramolis
 */
public class TreeEditModuleInstall extends ModuleInstall {

    private static final long serialVersionUID = -8729065351030487573L;


//     /**
//      */
//     public void installed () {
//         restored();

//         installActions();
//     }


//     /**
//      */
//     public void uninstalled () {
//         uninstallActions();
//     }


    //
    // actions
    //
    
    /**
     */
    private void installActions (DataLoader loader, SystemAction[] actions) {
        List allActions;

        allActions = new LinkedList (Arrays.asList (actions));
        allActions.addAll (Arrays.asList (loader.getActions()));
        
        loader.setActions ( (SystemAction[]) allActions.toArray (new SystemAction[0]) );
    }

    /**
     */
    private void installActions () {
        SystemAction[] actions = new SystemAction[] {
            SystemAction.get (OpenAction.class),
        };
        installActions (DataLoader.getLoader (XMLDataLoader.class), actions);
        installActions (DataLoader.getLoader (DTDDataLoader.class), actions);
    }

    /**
     */
    private void uninstallActions (DataLoader loader, SystemAction[] actions) {
        List allActions;

        allActions = new LinkedList (Arrays.asList (loader.getActions()));
        allActions.removeAll (Arrays.asList (actions));

        loader.setActions ( (SystemAction[]) allActions.toArray (new SystemAction[0]) );
    }

    /**
     */
    private void uninstallActions () {
        SystemAction[] actions = new SystemAction[] {
            SystemAction.get (OpenAction.class),
        };
        uninstallActions (DataLoader.getLoader (XMLDataLoader.class), actions);
        uninstallActions (DataLoader.getLoader (DTDDataLoader.class), actions);
    }

}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.