platform/samples/window-system-groups/src/org/netbeans/modules/examplemodule03/ShowGroupAction.java
author Tomas Mysik <tmysik@netbeans.org>
Mon, 12 Jun 2017 09:13:11 +0200
changeset 6391 640ddcff4333
parent 1779 5200163245c9
permissions -rw-r--r--
Return blacklisted methods back

No blacklisted methods right now but keep the code for possible future usage.
jglick@1688
     1
/*
mzlamal@2561
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
jglick@1688
     3
 *
mzlamal@2561
     4
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
jglick@1688
     5
 *
mzlamal@2561
     6
 * The contents of this file are subject to the terms of either the GNU
mzlamal@2561
     7
 * General Public License Version 2 only ("GPL") or the Common
mzlamal@2561
     8
 * Development and Distribution License("CDDL") (collectively, the
mzlamal@2561
     9
 * "License"). You may not use this file except in compliance with the
mzlamal@2561
    10
 * License. You can obtain a copy of the License at
mzlamal@2561
    11
 * http://www.netbeans.org/cddl-gplv2.html
mzlamal@2561
    12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
mzlamal@2561
    13
 * specific language governing permissions and limitations under the
mzlamal@2561
    14
 * License.  When distributing the software, include this License Header
mzlamal@2561
    15
 * Notice in each file and include the License file at
mzlamal@2561
    16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
mzlamal@2561
    17
 * particular file as subject to the "Classpath" exception as provided
mzlamal@2561
    18
 * by Sun in the GPL Version 2 section of the License file that
mzlamal@2561
    19
 * accompanied this code. If applicable, add the following below the
mzlamal@2561
    20
 * License Header, with the fields enclosed by brackets [] replaced by
mzlamal@2561
    21
 * your own identifying information:
jtulach@1779
    22
 * "Portions Copyrighted [year] [name of copyright owner]"
jtulach@1779
    23
 *
mzlamal@2561
    24
 * Contributor(s):
mzlamal@2561
    25
 *
jtulach@1779
    26
 * The Original Software is NetBeans. The Initial Developer of the Original
jtulach@1779
    27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
jglick@1688
    28
 * Microsystems, Inc. All Rights Reserved.
mzlamal@2561
    29
 *
mzlamal@2561
    30
 * If you wish your version of this file to be governed by only the CDDL
mzlamal@2561
    31
 * or only the GPL Version 2, indicate your decision by adding
mzlamal@2561
    32
 * "[Contributor] elects to include this software in this distribution
mzlamal@2561
    33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
mzlamal@2561
    34
 * single choice of license, a recipient has the option to distribute
mzlamal@2561
    35
 * your version of this file under either the CDDL, the GPL Version 2 or
mzlamal@2561
    36
 * to extend the choice of license to its licensees as provided above.
mzlamal@2561
    37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
mzlamal@2561
    38
 * Version 2 license, then the option applies only if the new code is
mzlamal@2561
    39
 * made subject to such option by the copyright holder.
jglick@1688
    40
 */
jglick@1688
    41
jglick@1688
    42
package org.netbeans.modules.examplemodule03;
jglick@1688
    43
jglick@1688
    44
import org.openide.util.HelpCtx;
jglick@1688
    45
import org.openide.util.NbBundle;
jglick@1688
    46
import org.openide.util.actions.CallableSystemAction;
jglick@1688
    47
import org.openide.windows.TopComponentGroup;
jglick@1688
    48
import org.openide.windows.WindowManager;
jglick@1688
    49
jglick@1688
    50
/**
jglick@1688
    51
 * Action that can always be invoked and work procedurally.
jglick@1688
    52
 *
jglick@1688
    53
 * @author  Marek Slama
jglick@1688
    54
 */
jglick@1688
    55
public class ShowGroupAction extends CallableSystemAction {
jtulach@1779
    56
jtulach@1779
    57
    public void performAction() {
jglick@1688
    58
        TopComponentGroup group = WindowManager.getDefault().findTopComponentGroup("testgroup");
jglick@1688
    59
        if (group == null) {
jglick@1688
    60
            return;
jglick@1688
    61
        }
jglick@1688
    62
        group.open();
jglick@1688
    63
    }
jglick@1688
    64
    
jglick@1688
    65
    public String getName() {
jglick@1688
    66
        return NbBundle.getMessage(ShowGroupAction.class, "LBL_ActionShow");
jglick@1688
    67
    }
jglick@1688
    68
    
jglick@1688
    69
    protected String iconResource() {
jglick@1688
    70
        return "org/netbeans/modules/examplemodule03/resources/editorMode.gif";
jglick@1688
    71
    }
jglick@1688
    72
    
jglick@1688
    73
    public HelpCtx getHelpCtx() {
jglick@1688
    74
        return HelpCtx.DEFAULT_HELP;
jglick@1688
    75
        // If you will provide context help then use:
jglick@1688
    76
        // return new HelpCtx (MyAction.class);
jglick@1688
    77
    }
jglick@1688
    78
    
jglick@1688
    79
    protected boolean asynchronous() {
jglick@1688
    80
        return false;
jglick@1688
    81
    }
jglick@1688
    82
    
jglick@1688
    83
}