1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ParcelDataNode.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package org
.openoffice
.netbeans
.modules
.office
.loader
;
34 import java
.awt
.datatransfer
.Transferable
;
35 import java
.util
.zip
.*;
37 import org
.openide
.loaders
.*;
38 import org
.openide
.nodes
.*;
39 import org
.openide
.filesystems
.FileObject
;
40 import org
.openide
.util
.NbBundle
;
41 import org
.openide
.util
.datatransfer
.*;
42 import org
.openide
.ErrorManager
;
43 import org
.openide
.windows
.OutputWriter
;
45 import org
.openoffice
.netbeans
.modules
.office
.actions
.ParcelCookie
;
47 /** A node to represent this object.
51 public class ParcelDataNode
extends DataNode
{
53 public ParcelDataNode(ParcelDataObject obj
) {
54 this(obj
, Children
.LEAF
);
57 public ParcelDataNode(ParcelDataObject obj
, Children ch
) {
59 setIconBase("/org/openoffice/netbeans/modules/office/resources/ParcelIcon");
62 protected ParcelDataObject
getParcelDataObject() {
63 return (ParcelDataObject
)getDataObject();
66 public static class ParcelPasteType
extends PasteType
{
67 ParcelDataNode sourceParcel
= null;
68 File targetDocument
= null;
69 boolean isCut
= false;
71 public ParcelPasteType(ParcelDataNode sourceParcel
,
72 File targetDocument
, boolean isCut
) {
73 this.sourceParcel
= sourceParcel
;
74 this.targetDocument
= targetDocument
;
78 public Transferable
paste() {
79 ParcelCookie parcelCookie
=
80 (ParcelCookie
)sourceParcel
.getCookie(ParcelCookie
.class);
81 parcelCookie
.deploy(targetDocument
);
84 FileObject fo
= sourceParcel
.getDataObject().getPrimaryFile();
88 catch (IOException ioe
) {}
89 return ExTransferable
.EMPTY
;
97 /* Example of adding Executor / Debugger / Arguments to node:
98 protected Sheet createSheet() {
99 Sheet sheet = super.createSheet();
100 Sheet.Set set = sheet.get(ExecSupport.PROP_EXECUTION);
102 set = new Sheet.Set();
103 set.setName(ExecSupport.PROP_EXECUTION);
104 set.setDisplayName(NbBundle.getMessage(ParcelDataNode.class, "LBL_DataNode_exec_sheet"));
105 set.setShortDescription(NbBundle.getMessage(ParcelDataNode.class, "HINT_DataNode_exec_sheet"));
107 ((ExecSupport)getCookie(ExecSupport.class)).addProperties(set);
109 ((CompilerSupport)getCookie(CompilerSupport.class)).addProperties(set);
115 // Don't use getDefaultAction(); just make that first in the data loader's getActions list