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  import org.openoffice.netbeans.modules.office.utils.FrameworkJarChecker;
32  
33  public class ConfigureParcelAction extends CookieAction {
34  
getName()35      public java.lang.String getName() {
36          return "Configure";
37      }
38  
cookieClasses()39      protected java.lang.Class[] cookieClasses() {
40          return new Class[] {ParcelFolderCookie.class};
41      }
42  
mode()43      protected int mode() {
44          return CookieAction.MODE_EXACTLY_ONE;
45      }
46  
getHelpCtx()47      public HelpCtx getHelpCtx() {
48          return HelpCtx.DEFAULT_HELP;
49      }
50  
performAction(final Node[] activatedNodes)51      protected void performAction(final Node[] activatedNodes)
52      {
53          FrameworkJarChecker.mountDependencies();
54  
55          RequestProcessor.getDefault().post(new Runnable() {
56              public void run() {
57                  for (int i = 0; i < activatedNodes.length; i++) {
58                      ParcelFolderCookie pfc = (ParcelFolderCookie)
59                          activatedNodes[i].getCookie(ParcelFolderCookie.class);
60                      if (pfc != null)
61                          pfc.configure();
62                  }
63              }
64          });
65      }
66  }
67