Return-Path: X-Original-To: apmail-pivot-user-archive@www.apache.org Delivered-To: apmail-pivot-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A053B1DA2 for ; Tue, 26 Apr 2011 15:25:43 +0000 (UTC) Received: (qmail 1278 invoked by uid 500); 26 Apr 2011 15:25:43 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 1258 invoked by uid 500); 26 Apr 2011 15:25:43 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 1250 invoked by uid 99); 26 Apr 2011 15:25:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Apr 2011 15:25:43 +0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=FREEMAIL_FROM,RFC_ABUSE_POST,SPF_NEUTRAL,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: 216.139.236.26 is neither permitted nor denied by domain of rborrelli@gmail.com) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Apr 2011 15:25:38 +0000 Received: from ben.nabble.com ([192.168.236.152]) by sam.nabble.com with esmtp (Exim 4.69) (envelope-from ) id 1QEk8b-0005gk-M6 for user@pivot.apache.org; Tue, 26 Apr 2011 08:25:17 -0700 Date: Tue, 26 Apr 2011 08:25:17 -0700 (PDT) From: lello To: user@pivot.apache.org Message-ID: <1303831517679-2865996.post@n3.nabble.com> In-Reply-To: <49531E1E-B612-4146-98EC-5F003C439721@verizon.net> References: <1303826545138-2865710.post@n3.nabble.com> <1303831032760-2865959.post@n3.nabble.com> <49531E1E-B612-4146-98EC-5F003C439721@verizon.net> Subject: Re: Disable Menu.Item MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sure, the code should be something like this: private MenuHandler treeMenuHandler = new MenuHandler.Adapter() { @Override public boolean configureContextMenu(Component cmpnt, Menu menu, int x, int y) { TreeView tv = (TreeView) cmpnt; final Tree.Path groupNodePath = tv.getNodeAt(y); final int treeIndex = tv.getRowIndex(groupNodePath); // Create the context menu Menu.Section menuSection1 = new Menu.Section(); Menu.Section menuSection2 = new Menu.Section(); Menu.Item newCollectionMenuItem = new Menu.Item("New collection"); Menu.Item renameCollectionMenuItem = new Menu.Item("Rename collection"); Menu.Item removeCollectionMenuItem = new Menu.Item("Remove collection"); if (treeIndex == 0) { menuSection1.add(newCollectionMenuItem); renameCollectionMenuItem.setEnabled(false); removeCollectionMenuItem.setEnabled(false); menuSection2.add(renameCollectionMenuItem); menuSection2.add(removeCollectionMenuItem); } menu.getSections().add(menuSection1); menu.getSections().add(menuSection2); return false; } }; -- View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Disable-Menu-Item-tp2865710p2865996.html Sent from the Apache Pivot - Users mailing list archive at Nabble.com.