Package org.geoforge.guillc.menu

Source Code of org.geoforge.guillc.menu.GfrMenPlgsSpotActAbs

/*
* Copyright (C) 2011-2014 GeoForge Project
*
*  This program is free software: you can redistribute it and/or modify
*  it under the terms of the GNU Lesser General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU Lesser General Public License for more details.
*
*  You should have received a copy of the GNU Lesser General Public License
*  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package org.geoforge.guillc.menu;

import java.util.HashSet;
import org.geoforge.guillc.menuitem.GfrMimActPlg;
import org.geoforge.io.awt.image.GfrFactoryIconAppGfr;
import org.geoforge.lang.util.GfrResBundleLang;
import org.geoforge.mgrplg.handler.IGfrHandlerPlugin;

/**
*
* @author robert
*/
abstract public class GfrMenPlgsSpotActAbs extends GfrMenPlgsAbs
{
   protected GfrMenPlgsSpotActAbs()
   {
      super(
              GfrResBundleLang.s_getInstance().getValue("sentence.pluginsHotspot"),
              GfrFactoryIconAppGfr.s_getPluginsSpot(GfrFactoryIconAppGfr.INT_SIZE_XXSMALL));
   }
  
   @Override
   protected void _remove(IGfrHandlerPlugin plg)
   {
      HashSet<GfrMimActPlg> hstMimToRemove = new HashSet<GfrMimActPlg>();
     
      for (int i=0; i<super.getMenuComponentCount(); i++)
      {
         GfrMimActPlg mimCur = (GfrMimActPlg) super.getMenuComponent(i);
        
         if (plg != mimCur.getPlugin())
            continue;
        
         hstMimToRemove.add(mimCur);
      }
     
      if (hstMimToRemove.isEmpty())
      {
         hstMimToRemove = null; // gc
         return;
      }
     
      for (GfrMimActPlg mimCur: hstMimToRemove)
      {
         super.remove(mimCur);
         mimCur.destroy();
      }
     
      if (super.getMenuComponentCount() < 1)
         super.setEnabled(false);
     
      hstMimToRemove.clear();
      hstMimToRemove = null; // gc
   }
}
TOP

Related Classes of org.geoforge.guillc.menu.GfrMenPlgsSpotActAbs

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.