/* * The contents of this file are subject to the terms of the Common Development * and Distribution License (the License). You may not use this file except in * compliance with the License. * * You can obtain a copy of the License at http://www.netbeans.org/cddl.html * or http://www.netbeans.org/cddl.txt. * * When distributing Covered Code, include this CDDL Header Notice in each file * and include the License file at http://www.netbeans.org/cddl.txt. * If applicable, add the following below the CDDL Header, with the fields * enclosed by brackets [] replaced by your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package org.netbeans.spi.project.ui.support; import org.openide.util.Lookup; /** * Ability to provide behavior for a single file actions (such as Run File) on * files for which it is not provided by the project. * Should be registered in default lookup and will be used by UI infrastructure. * @see ActionProvider * @author pbuzek */ public interface FileCommandActionProvider { /** * Get a list of all commands which this project supports. * @return a list of command names suitable for {@link #invokeAction} * @see #COMMAND_COMPILE_SINGLE * @see #COMMAND_RUN_SINGLE * @see #COMMAND_TEST_SINGLE * @see #COMMAND_DEBUG_SINGLE * @see #COMMAND_DEBUG_TEST_SINGLE */ String[] getSupportedActions(); /** * Run a project command. * Will be invoked in the event thread. * The context may be ignored by some commands, but some may need it in order * to get e.g. the selected source file to build by itself, etc. * @param command a predefined command name (must be among {@link #getSupportedActions}) * @param context any action context, e.g. for a node selection * (as in {@link ContextAwareAction}) * @throws IllegalArgumentException if the requested command is not supported */ void invokeAction(String command, Lookup context) throws IllegalArgumentException; /** * Tells whether the command can be invoked in given context and thus if * actions representing this command should be enabled or disabled. * The context may be ignored by some commands, but some may need it in order * to get e.g. the selected source file to build by itself, etc. * @param command a predefined command name (must be among {@link #getSupportedActions}) * @param context any action context, e.g. for a node selection * (as in {@link ContextAwareAction}) * @throws IllegalArgumentException if the requested command is not supported */ boolean isActionEnabled(String command, Lookup context) throws IllegalArgumentException; }