Adds an action to the global or local registry.

@param asGlobal If true, register as global action; if false, local action.
@param id Unique id.
@param label Action's label.
@param script Action's script.
@return The added action.
498397
public static IAction register(boolean asGlobal, String id, String label, String script) {
        return register(asGlobal, new Action(id, label, script));
    }
231168
public function addActionTriggerFeature($actionName, $eventLabel = ScriptLabel::MOUSECLICK)
    {
        $actionTrigger = new ActionTrigger($actionName, $this, $eventLabel);
        $this->addScriptFeature($actionTrigger);
        return $this;
    }
374874
public void registerGlobal(IGlobalScope scope) {
        log.trace("Registering global scope: {}", scope.getName(), scope);
        globals.put(scope.getName(), scope);
    }
1271153
private void _addActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__addActionPerformed
        JFileChooser fc = new JFileChooser();
        fc.setMultiSelectionEnabled(true);
        fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fc.setFileFilter(new FileFilter() {

            @Override
            public boolean accept(File f) {
                return f.isDirectory() || f.getName().endsWith(".R") || f.getName().endsWith(".Rdata");
            }

            @Override
            public String getDescription() {
                return "R object file";
            }
        });
        if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION && fc.getSelectedFiles() != null) {
            File[] files = fc.getSelectedFiles();
            for (File file : files) {
                if (file.getName().endsWith(".R")) {
                    if (R != null) {
                        R.source(file);
                    }
                } else if (file.getName().endsWith(".Rdata")) {
                    if (R != null) {
                        R.load(file);
                    }
                } else {
                    Log.Out.println("Not loading/sourcing " + file.getName());
                }
            }
        }
        update();
    }
1263086
public Axis addLabel(String label, double location) {
        if (labels == null) {
            labels = new HashMap<>();
        }

        labels.put(label, location);
        setSlice();
        initGridLines();
        initGridLabels();
        return this;
    }
721904
function triggerGlobal(settings, context, eventName, data) {
        if (settings.global)
            return triggerAndReturn(context || document, eventName, data);
    }
509521
public static void addAction(Set<Action> aas, Action action, boolean condition) {

        if (condition) {
            aas.add(action);
        }
    }
820907
private static IAction createAction(String action) {
        IAction actn = null;
        
        if (!StringUtils.isEmpty(action)) {
            if ((actn = ActionRegistry.getRegisteredAction(action)) == null) {
                actn = ActionUtil.createAction(null, action);
            }
        }
        
        return actn;
    }
957977
public ActionListBox addItem(final String label, final Runnable action) {
        return addItem(new Runnable() {
            @Override
            public void run() {
                action.run();
            }

            @Override
            public String toString() {
                return label;
            }
        });
    }
480653
public void addActionResult(ActionResult actionResult) {
        ActionResult existActionResult = getActionResult(actionResult.getActionId());
        if (existActionResult != null &&
                existActionResult.getResultValue() instanceof ResultValueMap &&
                actionResult.getResultValue() instanceof ResultValueMap) {
            ResultValueMap resultValueMap = (ResultValueMap)existActionResult.getResultValue();
            resultValueMap.putAll((ResultValueMap)actionResult.getResultValue());
        } else {
            add(actionResult);
        }
    }
1271818
def declare_label(self, id_, lineno):
        
        # TODO: consider to make labels private
        id1 = id_
        id_ = str(id_)

        if not self.check_is_undeclared(id_, lineno, 'label'):
            entry = self.get_entry(id_)
            syntax_error(lineno, "Label '%s' already used at %s:%i" %
                         (id_, entry.filename, entry.lineno))
            return entry

        entry = self.get_entry(id_)
        if entry is not None and entry.declared:
            if entry.is_line_number:
                syntax_error(lineno, "Duplicated line number '%s'. "
                                     "Previous was at %i" % (entry.name, entry.lineno))
            else:
                syntax_error(lineno, "Label '%s' already declared at line %i" %
                             (id_, entry.lineno))
            return None

        entry = (self.get_entry(id_, scope=self.current_scope) or
                 self.get_entry(id_, scope=self.global_scope) or
                 self.declare(id_, lineno, symbols.LABEL(id_, lineno)))
        if entry is None:
            return None

        if not isinstance(entry, symbols.LABEL):
            entry = symbols.VAR.to_label(entry)

        if id_[0] == '.':
            id_ = id_[1:]
            # HINT: ??? Mangled name. Just the label, 'cause it starts with '.'
            entry.mangled = '%s' % id_
        else:
            # HINT: Mangled name. Labels are __LABEL__
            entry.mangled = '__LABEL__%s' % entry.name

        entry.is_line_number = isinstance(id1, int)

        if global_.FUNCTION_LEVEL:
            entry.scope_owner = list(global_.FUNCTION_LEVEL)

        self.move_to_global_scope(id_)  # Labels are always global # TODO: not in the future
        entry.declared = True
        entry.type_ = self.basic_types[global_.PTR_TYPE]
        return entry
8436
function doaction(type, data) {
		if (gui.hosted) {
			gui.Action.ascendGlobal(document, type, data);
		}
	}
1025683
public void setActionLabel(CharSequence label){
        mEmptyActionText = label;
        mAction.setText(mEmptyActionText);
        mAction.setVisibility(TextUtils.isEmpty(mEmptyActionText) ? View.GONE : View.VISIBLE);
    }
1049616
public static Label buildLabel(final String label) {
        return addLabel(Label.newBuilder(), Locale.getDefault(), label).build();
    }
794062
@Override
	public Object action(final Context cx, final Scriptable scope,
			final Scriptable thisObj, final Object[] args, final int actionType) {
		try {
			return doAction(cx, scope, thisObj, args, actionType);
		} catch (final StackOverflowError e) {
			// TODO: We shouldn't have to catch this exception and fall back to
			// Rhino's regex support!
			// See HtmlUnitRegExpProxyTest.stackOverflow()
			return wrapped_.action(cx, scope, thisObj, args, actionType);
		}
	}
612065
def __add_actions(self):
        

        LOGGER.debug("> Adding '{0}' Component actions.".format(self.__class__.__name__))

        self.__script_editor.command_menu.addSeparator()
        self.__script_editor.command_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|addons.tcp_serverUi|&Command|Send Selection To Server",
            shortcut=Qt.ControlModifier + Qt.AltModifier + Qt.Key_Return,
            slot=self.__send_selection_to_server_action__triggered))
        self.__script_editor.command_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|addons.tcp_serverUi|&Command|&Send Current File To Server",
            shortcut=Qt.SHIFT + Qt.AltModifier + Qt.CTRL + Qt.Key_Return,
            slot=self.__send_file_to_server_action__triggered))
124075
private Object wrappedAction(final Context cx, final Scriptable scope,
			final Scriptable thisObj, final Object[] args, final int actionType) {

		// take care to set the context's RegExp proxy to the original one as
		// this is checked
		// (cf net.sourceforge.htmlunit.corejs.javascript.regexp.RegExpImp:334)
		try {
			ScriptRuntime.setRegExpProxy(cx, wrapped_);
			return wrapped_.action(cx, scope, thisObj, args, actionType);
		} finally {
			ScriptRuntime.setRegExpProxy(cx, this);
		}
	}