ToolsAction via layers
ToolsAction
via
+ layer, don't use the deprecated manifest style.
+ HeapView
preserves its settings between sessionsUI/ToolActions
folder to make them known
+ to ToolsAction.
+ Note: you do not need to touch this class to add a service action!
-* Just add the action to a module manifest in an Action
section.
-*
-*
The list of registered service actions is provided to this action from the implementation
-* by means of {@link ActionManager}.
+* Just register your action into By using this manifest section, your action will be available as
+Old and deprecated class UI/ToolActions
layer folder
+* (read more about layers)
+ * since version 6.15.
*
* @author Jaroslav Tulach
*/
@@ -90,34 +90,40 @@
/* @return name
*/
+ @Override
public String getName() {
return getActionName();
}
/* @return help for this action
*/
+ @Override
public HelpCtx getHelpCtx() {
return new HelpCtx(ToolsAction.class);
}
/* @return menu presenter for the action
*/
+ @Override
public JMenuItem getMenuPresenter() {
return new Inline(this);
}
/* @return menu presenter for the action
*/
+ @Override
public JMenuItem getPopupPresenter() {
return new Popup(this);
}
/* Does nothing.
*/
+ @Override
public void actionPerformed(java.awt.event.ActionEvent ev) {
assert false;
}
+ @Override
public Action createContextAwareInstance(Lookup actionContext) {
return new DelegateAction(this, actionContext);
}
@@ -128,6 +134,29 @@
return NbBundle.getMessage(ToolsAction.class, "CTL_Tools");
}
+ static ListLookup.Provider
. */
+ @Override
public Lookup getLookup() {
return lookup;
}
+ @Override
public void actionPerformed(java.awt.event.ActionEvent e) {
}
+ @Override
public void putValue(String key, Object o) {
}
+ @Override
public Object getValue(String key) {
return delegate.getValue(key);
}
+ @Override
public boolean isEnabled() {
// Irrelevant see G#isPopupEnabled(..).
return delegate.isEnabled();
}
+ @Override
public void setEnabled(boolean b) {
// Irrelevant see G#isPopupEnabled(..).
}
+ @Override
public void addPropertyChangeListener(PropertyChangeListener listener) {
support.addPropertyChangeListener(listener);
}
+ @Override
public void removePropertyChangeListener(PropertyChangeListener listener) {
support.removePropertyChangeListener(listener);
}
/** Implements Presenter.Menu
. */
+ @Override
public javax.swing.JMenuItem getMenuPresenter() {
return new Inline(this);
}
/** Implements Presenter.Popup
. */
+ @Override
public javax.swing.JMenuItem getPopupPresenter() {
return new ToolsAction.Popup(this);
}
diff -r 946c91cb4e6c openide.actions/test/unit/src/org/openide/actions/ToolsActionTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/openide.actions/test/unit/src/org/openide/actions/ToolsActionTest.java Mon Feb 22 15:17:50 2010 +0100
@@ -0,0 +1,80 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, 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-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2010 Sun Microsystems, Inc.
+ */
+
+package org.openide.actions;
+
+import javax.swing.Action;
+import java.util.List;
+import org.openide.filesystems.FileUtil;
+import org.openide.filesystems.FileObject;
+import org.netbeans.junit.NbTestCase;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author Jaroslav Tulach Action
-The class Action
installs a system action into NetBeans. Refer to the
-
-Actions API
-
-for details on how to create an action. The class must implement
-
-SystemAction
.
-
-Action
+installs a system action into NetBeans. Since NetBeans 6.9 prefer
+registration via layers (folder UI/ToolsAction) to make
+your action available as
a "tool", i.e. it will appear (when enabled) in a list of all
extension tools in any popup menu (etc.) using
diff -r 946c91cb4e6c php.project/manifest.mf
--- a/php.project/manifest.mf Sun Feb 21 17:41:27 2010 +0100
+++ b/php.project/manifest.mf Mon Feb 22 15:17:50 2010 +0100
@@ -4,6 +4,3 @@
OpenIDE-Module: org.netbeans.modules.php.project
OpenIDE-Module-Layer: org/netbeans/modules/php/project/resources/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/project/resources/Bundle.properties
-
-Name: org/netbeans/modules/php/project/ui/actions/tests/CreateTestsAction.class
-OpenIDE-Module-Class: Action
diff -r 946c91cb4e6c php.project/nbproject/project.xml
--- a/php.project/nbproject/project.xml Sun Feb 21 17:41:27 2010 +0100
+++ b/php.project/nbproject/project.xml Mon Feb 22 15:17:50 2010 +0100
@@ -243,7 +243,7 @@