# HG changeset patch # Parent de97dede8ae91563b33f879d7a2e88c0d9132e3a #189320: Select in Projects on editor tab context menu. Requires API for adding actions to this area rather than reflection hacks. Also rework UI of Select in... actions a bit: make top level action in editor pane, do not use submenu, show only ...Projects. diff --git a/core.ui/manifest.mf b/core.ui/manifest.mf --- a/core.ui/manifest.mf +++ b/core.ui/manifest.mf @@ -4,5 +4,5 @@ OpenIDE-Module-Layer: org/netbeans/core/ui/resources/layer.xml AutoUpdate-Show-In-Client: false AutoUpdate-Essential-Module: true -OpenIDE-Module-Specification-Version: 1.23 +OpenIDE-Module-Specification-Version: 1.24 diff --git a/core.ui/src/org/netbeans/core/ui/resources/layer.xml b/core.ui/src/org/netbeans/core/ui/resources/layer.xml --- a/core.ui/src/org/netbeans/core/ui/resources/layer.xml +++ b/core.ui/src/org/netbeans/core/ui/resources/layer.xml @@ -824,6 +824,15 @@ + + + + + + + + + diff --git a/diff/nbproject/project.properties b/diff/nbproject/project.properties --- a/diff/nbproject/project.properties +++ b/diff/nbproject/project.properties @@ -43,7 +43,7 @@ javac.compilerargs=-Xlint:unchecked javac.source=1.6 -spec.version.base=1.29.0 +spec.version.base=1.30.0 javadoc.apichanges=${basedir}/apichanges.xml javadoc.arch=${basedir}/arch.xml diff --git a/diff/nbproject/project.xml b/diff/nbproject/project.xml --- a/diff/nbproject/project.xml +++ b/diff/nbproject/project.xml @@ -238,7 +238,7 @@ - 6.16 + 6.32 diff --git a/diff/src/org/netbeans/modules/diff/mf-layer.xml b/diff/src/org/netbeans/modules/diff/mf-layer.xml --- a/diff/src/org/netbeans/modules/diff/mf-layer.xml +++ b/diff/src/org/netbeans/modules/diff/mf-layer.xml @@ -83,6 +83,12 @@ + + + + + + diff --git a/editor/nbproject/project.properties b/editor/nbproject/project.properties --- a/editor/nbproject/project.properties +++ b/editor/nbproject/project.properties @@ -42,7 +42,7 @@ javac.compilerargs=-Xlint:unchecked javac.source=1.6 -spec.version.base=1.51.0 +spec.version.base=1.52.0 is.autoload=true javadoc.arch=${basedir}/arch.xml diff --git a/editor/src/org/netbeans/modules/editor/Bundle.properties b/editor/src/org/netbeans/modules/editor/Bundle.properties --- a/editor/src/org/netbeans/modules/editor/Bundle.properties +++ b/editor/src/org/netbeans/modules/editor/Bundle.properties @@ -53,7 +53,6 @@ Templates/Services/IndentEngine/org-netbeans-modules-editor-html-LineWrapIndentEngine.settings=Line Wrapping Indentation Engine Menu/Source=&Source Menu/View/CodeFolds=&Code Folds -Editors/text/base/Popup/org-netbeans-modules-editor-NbSelectInPopupAction.instance=Select in MSG_NegativeValue=Negative value is not allowed MSG_OutOfRange=Value is out of range diff --git a/editor/src/org/netbeans/modules/editor/NbSelectInPopupAction.java b/editor/src/org/netbeans/modules/editor/NbSelectInPopupAction.java deleted file mode 100644 --- a/editor/src/org/netbeans/modules/editor/NbSelectInPopupAction.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle 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]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - * - * 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. - */ -package org.netbeans.modules.editor; - -import java.awt.event.ActionEvent; -import java.io.IOException; -import java.util.ArrayList; -import javax.swing.Action; -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; -import javax.swing.JSeparator; - -import org.openide.cookies.InstanceCookie; -import org.openide.filesystems.FileObject; -import org.openide.filesystems.FileUtil; -import org.openide.loaders.DataFolder; -import org.openide.loaders.DataObject; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; -import org.openide.util.actions.Presenter; -import org.openide.util.actions.SystemAction; - - -/** - * - * @author Dusan Balek - */ -public final class NbSelectInPopupAction extends SystemAction implements Presenter.Popup { - - private ArrayList actions = null; - - public String getName() { - return NbBundle.getMessage(NbSelectInPopupAction.class, "Editors/text/base/Popup/org-netbeans-modules-editor-NbSelectInPopupAction.instance"); // NOI18N - } - - public void actionPerformed(ActionEvent ev) { - // do nothing - should never be called - } - - public HelpCtx getHelpCtx() { - return HelpCtx.DEFAULT_HELP; - } - - public javax.swing.JMenuItem getPopupPresenter() { - return new SubMenu(getName()); - } - - public class SubMenu extends JMenu { - - public SubMenu(String s){ - super(s); - } - - /** Gets popup menu. Overrides superclass. Adds lazy menu items creation. */ - public JPopupMenu getPopupMenu() { - JPopupMenu pm = super.getPopupMenu(); - pm.removeAll(); - FileObject fo = FileUtil.getConfigFile("Actions/Window/SelectDocumentNode"); // NOI18N - DataFolder df = fo != null ? DataFolder.findFolder(fo) : null; - - if (df != null) { - DataObject actionObjects[] = df.getChildren(); - for (int i = 0; i < actionObjects.length; i++) { - InstanceCookie ic = (InstanceCookie) actionObjects[i].getCookie(InstanceCookie.class); - if (ic == null) continue; - Object instance; - try { - instance = ic.instanceCreate(); - } catch (IOException e) { - // ignore - e.printStackTrace(); - continue; - } catch (ClassNotFoundException e) { - // ignore - e.printStackTrace(); - continue; - } - if (instance instanceof JSeparator) { - pm.add((JSeparator) instance); - } else if (instance instanceof Presenter.Popup) { - pm.add(((Presenter.Popup)instance).getPopupPresenter()); - } else if (instance instanceof Presenter.Menu) { - JMenuItem temp = ((Presenter.Menu)instance).getMenuPresenter(); - temp.setIcon(null); - pm.add(temp); - } else if (instance instanceof Action) { - JMenuItem temp = new JMenuItem((Action)instance); - temp.setIcon(null); - pm.add(temp); - } - } - } - pm.pack(); - return pm; - } - } -} diff --git a/editor/src/org/netbeans/modules/editor/resources/layer.xml b/editor/src/org/netbeans/modules/editor/resources/layer.xml --- a/editor/src/org/netbeans/modules/editor/resources/layer.xml +++ b/editor/src/org/netbeans/modules/editor/resources/layer.xml @@ -249,7 +249,8 @@ - + + diff --git a/favorites/manifest.mf b/favorites/manifest.mf --- a/favorites/manifest.mf +++ b/favorites/manifest.mf @@ -1,7 +1,7 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.favorites/1 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/favorites/Bundle.properties -OpenIDE-Module-Specification-Version: 1.21 +OpenIDE-Module-Specification-Version: 1.22 OpenIDE-Module-Layer: org/netbeans/modules/favorites/resources/layer.xml AutoUpdate-Show-In-Client: false AutoUpdate-Essential-Module: true diff --git a/favorites/src/org/netbeans/modules/favorites/Actions.java b/favorites/src/org/netbeans/modules/favorites/Actions.java --- a/favorites/src/org/netbeans/modules/favorites/Actions.java +++ b/favorites/src/org/netbeans/modules/favorites/Actions.java @@ -58,7 +58,6 @@ import javax.swing.Action; import javax.swing.ImageIcon; import javax.swing.JFileChooser; -import javax.swing.JMenuItem; import javax.swing.SwingUtilities; import org.netbeans.modules.favorites.api.Favorites; import org.openide.DialogDisplayer; @@ -169,14 +168,6 @@ return NbBundle.getMessage(Select.class, "ACT_Select_Main_Menu"); // NOI18N } - /** Overriden to have different title in popup menu, works but ugly a bit */ - @Override - public JMenuItem getPopupPresenter() { - JMenuItem mi = super.getPopupPresenter(); - mi.setText(NbBundle.getMessage(Select.class, "ACT_Select")); // NOI18N - return mi; - } - @Override protected String iconResource() { return "org/netbeans/modules/favorites/resources/actionView.png"; // NOI18N diff --git a/favorites/src/org/netbeans/modules/favorites/Bundle.properties b/favorites/src/org/netbeans/modules/favorites/Bundle.properties --- a/favorites/src/org/netbeans/modules/favorites/Bundle.properties +++ b/favorites/src/org/netbeans/modules/favorites/Bundle.properties @@ -44,7 +44,6 @@ ACT_AddOnFavoritesNode=&Add to Favorites... ACT_Remove=&Remove from Favorites ACT_View=Favor&ites -ACT_Select=Favorites ACT_Select_Main_Menu=Select in F&avorites Favorites=Favorites diff --git a/openide.text/apichanges.xml b/openide.text/apichanges.xml --- a/openide.text/apichanges.xml +++ b/openide.text/apichanges.xml @@ -49,6 +49,21 @@ Text API + + + Ability to inject actions into editor tab context menus + + + + + +

+ Actions may now be placed in Editors/TabActions to add + them to the context menu of the tab of an editor window. +

+
+ +
Deprecating style constants in NbDocument diff --git a/openide.text/arch.xml b/openide.text/arch.xml --- a/openide.text/arch.xml +++ b/openide.text/arch.xml @@ -765,7 +765,9 @@ --> -No. + + Actions for the editor tab (window) context menu can be injected into Editors/TabActions. + - - - - - - - -
+
@@ -581,6 +573,12 @@ + + + + + +