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 java.util.Vector;
27 import java.util.Enumeration;
28 
29 import org.openide.nodes.Node;
30 import org.openide.util.HelpCtx;
31 import org.openide.util.RequestProcessor;
32 import org.openide.actions.BuildAllAction;
33 
34 import org.openide.compiler.Compiler;
35 import org.openide.compiler.CompilerJob;
36 import org.openide.compiler.CompilerTask;
37 
38 import org.openoffice.netbeans.modules.office.utils.FrameworkJarChecker;
39 
40 public class BuildParcelAction extends BuildAllAction {
getName()41     public String getName() {
42         return "Build";
43     }
44 
performAction(Node[] activatedNodes)45     protected void performAction(Node[] activatedNodes) {
46         FrameworkJarChecker.mountDependencies();
47 
48         for (int i = 0; i < activatedNodes.length; i++) {
49             Vector v = new Vector(1);
50             v.addElement(activatedNodes[i]);
51 
52             CompilerJob job = createJob(v.elements(), Compiler.DEPTH_INFINITE);
53             CompilerTask task = job.start();
54             task.waitFinished();
55 
56             if (task.isSuccessful()) {
57                 ParcelFolderCookie cookie = (ParcelFolderCookie)
58                     activatedNodes[i].getCookie(ParcelFolderCookie.class);
59 
60                 if (cookie != null)
61                     cookie.generate();
62             }
63         }
64     }
65 }
66