content: package com.japisoft.editix.ui.panels.project.actions;
  
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  
  import javax.swing.AbstractAction;
  
  import com.japisoft.editix.ui.EditixFactory;
  import com.japisoft.editix.ui.panels.Panel;
  import com.japisoft.editix.ui.panels.PanelManager;
  import com.japisoft.editix.ui.panels.project.ProjectPanel;
  import com.japisoft.framework.ApplicationModel;
  
  /**
  This program is available under two licenses : 
  
  1. For non commercial usage : 
  
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU 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 General Public License for more details.
  
  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
  2. For commercial usage :
  
  You need to get a commercial license for source usage at : 
  
  http://www.editix.com/buy.html
  
  Copyright (c) 2018 Alexandre Brillant - JAPISOFT SARL - http://www.japisoft.com
  
  @author Alexandre Brillant - abrillant@japisoft.com
  @author JAPISOFT SARL - http://www.japisoft.com
  
  */
  abstract class CommonAction extends AbstractAction {
  	static final String OPEN_CMD = "open";
  	static final String REN_CMD = "ren";
  	static final String LOCK_CMD = "lock";
  	static final String DEL_CMD = "del";
  	static final String ADDD_CMD = "addd";
  	static final String ADDF_CMD = "addf";
  	static final String ADDF2_CMD = "addf2";	
  	static final String CHECK_CMD = "check";
  	static final String ADDFS_CMD = "addfs";
  	
  	public void actionPerformed( ActionEvent e ) {
  		Panel p = PanelManager.getPanelByAction( 
  				"projectManager" );
  		if ( p == null ) {
  			ApplicationModel.debug(
  					"Wrong panel action : " + 
  						ProjectPanel.class.getName() + 
  							"???" );
  		} else {
  			if ( p.isShown() || !mustBeInVisiblePanel() ) {
  				Object view = p.getView();
  				if ( view instanceof ActionListener ) {
  					( ( ActionListener )view ).actionPerformed(
  							new ActionEvent(
  									e.getSource(),
  									e.getID(),
  									getActionCommand() ) 
  					);
  				}
  			} else {
  				EditixFactory.buildAndShowWarningDialog( "Can't execute this action, please open or reopen the project panel" );
  			}
  		}
  	}
  
  	abstract String getActionCommand();
  
  	public boolean mustBeInVisiblePanel() {
  		return true;
  	}
  	
  }
  