All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.firebirdsql.squirrel.act.DeactivateIndexAction Maven / Gradle / Ivy

package org.firebirdsql.squirrel.act;
import java.awt.event.ActionEvent;

import net.sourceforge.squirrel_sql.client.IApplication;
import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
import net.sourceforge.squirrel_sql.client.plugin.IPlugin;
import net.sourceforge.squirrel_sql.client.session.ISession;
import net.sourceforge.squirrel_sql.client.session.action.ISessionAction;
import net.sourceforge.squirrel_sql.fw.util.IResources;
/**
 * This Action will run a "EXPLAIN TABLE" over the
 * currently selected tables.
 *
 * @author Colin Bell
 */
public class DeactivateIndexAction extends SquirrelAction implements ISessionAction 
{
	/** Current session. */
	private ISession _session;

	/** Current plugin. */
	private final IPlugin _plugin;

	/**
	 * Ctor.
	 *
	 * @param	app			Application API.
	 * @param	rsrc		Plugins resources.
	 * @param	plugin		This plugin.
	 *
	 * @throws	IllegalArgumentException
	 * 			Thrown if anull IApplication,
	 * 			Resources or IPlugin passed.
	 */
	public DeactivateIndexAction(IApplication app, IResources rsrc,
							IPlugin plugin)
	{
		super(app, rsrc);
		if (app == null)
		{
			throw new IllegalArgumentException("IApplication == null");
		}
		if (rsrc == null)
		{
			throw new IllegalArgumentException("Resources == null");
		}
		if (plugin == null)
		{
			throw new IllegalArgumentException("IPlugin == null");
		}

		_plugin = plugin;
	}

	public void actionPerformed(ActionEvent evt)
	{
		if (_session != null)
		{
			try
			{
				new AlterIndexCommand(_session, _plugin, false).execute();
			}
			catch (Throwable th)
			{
				_session.showErrorMessage(th);
			}
		}
	}

	/**
	 * Set the current session.
	 * 
	 * @param	session		The current session.
	 */
	public void setSession(ISession session)
	{
		_session = session;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy