1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package org.openoffice.netbeans.modules.office.actions;
25 
26 import org.openide.nodes.Node;
27 import org.openide.util.HelpCtx;
28 import org.openide.util.RequestProcessor;
29 import org.openide.util.actions.CookieAction;
30 
31 /**
32  *
33  * @author  adams
34  * @version 1.0
35  */
36 public class MountParcelAction extends CookieAction
37 {
MountParcelAction()38     public MountParcelAction()
39     {
40     }
41 
getName()42     public java.lang.String getName()
43     {
44         return "Mount Parcel"; //NOI18N
45     }
46 
getHelpCtx()47     public HelpCtx getHelpCtx()
48     {
49         return HelpCtx.DEFAULT_HELP;
50     }
51 
mode()52     protected int mode()
53     {
54         // enable duplication for as many qualifying nodes as are selected:
55         return CookieAction.MODE_ALL;
56     }
57 
cookieClasses()58     protected java.lang.Class[] cookieClasses()
59     {
60         return new Class[] {ParcelCookie.class};
61     }
62 
performAction(final Node[] activatedNodes)63     protected void performAction(final Node[] activatedNodes)
64     {
65         RequestProcessor.getDefault().post(new Runnable()
66         {
67             public void run()
68             {
69                 for (int i=0; i<activatedNodes.length; i++)
70                 {
71                     ParcelCookie mpc = (ParcelCookie)activatedNodes[i].getCookie(ParcelCookie.class);
72                     if (mpc != null)
73                     {
74                         mpc.mount();
75                     }
76                 }
77             }
78         });
79     }
80 }
81