You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2012/01/27 02:29:58 UTC
svn commit: r1236486 [10/43] - in
/incubator/ooo/devtools/netbeansintegration: ./ build/
build/public-package-jars/ javahelp/ javahelp/org/ javahelp/org/openoffice/
javahelp/org/openoffice/extensions/
javahelp/org/openoffice/extensions/docs/ javahelp/o...
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/Bundle_pt_BR.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/Bundle_pt_BR.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/Bundle_pt_BR.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/Bundle_pt_BR.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,7 @@
+LBL_Oxt_loader_name=Oxt Files
+
+Services/MIMEResolver/OxtResolver.xml=Oxt Files
+#Templates/Other/OxtTemplate.oxt=Empty Oxt file
+
+# Actions
+LBL_OpenAction=Open
\ No newline at end of file
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/Bundle_zh_CN.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/Bundle_zh_CN.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/Bundle_zh_CN.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/Bundle_zh_CN.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,7 @@
+LBL_Oxt_loader_name=Oxt \u6587\u4ef6
+
+Services/MIMEResolver/OxtResolver.xml=Oxt \u6587\u4ef6
+#Templates/Other/OxtTemplate.oxt=Empty Oxt file
+
+# Actions
+LBL_OpenAction=\u6253\u5f00
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataLoader.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataLoader.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataLoader.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataLoader.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: OxtDataLoader.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: jsc $ $Date: 2008/02/11 10:33:43 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.filetypes.oxt;
+
+import java.io.IOException;
+import org.openide.filesystems.FileObject;
+import org.openide.loaders.DataObjectExistsException;
+import org.openide.loaders.MultiDataObject;
+import org.openide.loaders.UniFileLoader;
+import org.openide.util.NbBundle;
+
+public class OxtDataLoader extends UniFileLoader {
+
+ public static final String REQUIRED_MIME = "application/x-oxt";
+
+ private static final long serialVersionUID = 1L;
+
+ public OxtDataLoader() {
+ super("org.openoffice.extensions.filetypes.oxt.OxtDataObject");
+ }
+
+ protected String defaultDisplayName() {
+ return NbBundle.getMessage(OxtDataLoader.class, "LBL_Oxt_loader_name");
+ }
+
+ protected void initialize() {
+ super.initialize();
+ getExtensions().addMimeType(REQUIRED_MIME);
+ }
+
+ protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
+ return new OxtDataObject(primaryFile, this);
+ }
+
+ protected String actionsContext() {
+ return "Loaders/" + REQUIRED_MIME + "/Actions";
+ }
+
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataLoaderBeanInfo.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataLoaderBeanInfo.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataLoaderBeanInfo.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataLoaderBeanInfo.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: OxtDataLoaderBeanInfo.java,v $
+ *
+ * $Revision: 1.3 $
+ *
+ * last change: $Author: sg $ $Date: 2009/07/06 14:51:27 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.filetypes.oxt;
+
+import java.awt.Image;
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.SimpleBeanInfo;
+import org.openide.loaders.UniFileLoader;
+import org.openide.util.ImageUtilities;
+
+public class OxtDataLoaderBeanInfo extends SimpleBeanInfo {
+
+ public BeanInfo[] getAdditionalBeanInfo() {
+ try {
+ return new BeanInfo[] {Introspector.getBeanInfo(UniFileLoader.class)};
+ } catch (IntrospectionException e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public Image getIcon(int type) {
+ if (type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) {
+ return ImageUtilities.loadImage("org/openoffice/extensions/projecttemplates/calcaddin/calcaddin.gif");
+ } else {
+ return null;
+ }
+
+ }
+
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataNode.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataNode.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataNode.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataNode.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: OxtDataNode.java,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: jsc $ $Date: 2008/02/11 10:34:11 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.filetypes.oxt;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Vector;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.loaders.DataNode;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.lookup.Lookups;
+
+public class OxtDataNode extends DataNode {
+
+ private static final String IMAGE_ICON_BASE =
+ "org/openoffice/extensions/projecttemplates/calcaddin/calcaddin.gif";
+
+ public OxtDataNode(OxtDataObject obj) {
+ super(obj, new OxtFirstChildren(), Lookups.singleton(obj));
+ setIconBaseWithExtension(IMAGE_ICON_BASE);
+ }
+
+// /** Creates a property sheet. */
+// protected Sheet createSheet() {
+// Sheet s = super.createSheet();
+// Sheet.Set ss = s.get(Sheet.PROPERTIES);
+// if (ss == null) {
+// ss = Sheet.createPropertiesSet();
+// s.put(ss);
+// }
+// // TODO add some relevant properties: ss.put(...)
+// return s;
+// }
+
+ private static class OxtFirstChildren extends Children.Keys<OxtFileEntryDataNode> {
+ /** Creates a new instance of OxtFileEntryChildren */
+ public OxtFirstChildren() {
+ }
+
+ //protected Node[] createNodes(Object object) {
+ protected Node[] createNodes(OxtFileEntryDataNode object) {
+ return new Node[]{(Node)object};
+ }
+
+ @Override
+ protected void addNotify() {
+ Node node = getNode();
+ OxtDataNode dataNode = (OxtDataNode)node;
+ OxtDataObject obj = (OxtDataObject)node.getLookup().lookup(OxtDataObject.class);
+
+ FileObject file = obj.getPrimaryFile();
+ Vector<OxtFileEntryDataNode> vNodes = new Vector<OxtFileEntryDataNode>();
+
+ try {
+ ZipFile zipFile = new ZipFile(FileUtil.toFile(file));
+ Enumeration<? extends ZipEntry>entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry elem = entries.nextElement();
+ if (elem.isDirectory() || elem.getName().indexOf(File.separatorChar) == -1) {
+ vNodes.add(new OxtFileEntryDataNode(elem, new OxtFileEntryChildren()));
+ }
+ else {
+ OxtSubDirectoryStorage.getStorage().addEntry(elem);
+ }
+
+ }
+ } catch (ZipException ex) {
+ ex.printStackTrace();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ setKeys(vNodes);
+ }
+
+ @Override
+ protected void removeNotify() {
+ setKeys(new OxtFileEntryDataNode[] {});
+ }
+ }
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataObject.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataObject.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataObject.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtDataObject.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: OxtDataObject.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: jsc $ $Date: 2008/02/11 10:36:26 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.filetypes.oxt;
+
+import java.io.IOException;
+import org.openide.filesystems.FileObject;
+import org.openide.loaders.DataObjectExistsException;
+import org.openide.loaders.MultiDataObject;
+import org.openide.nodes.CookieSet;
+import org.openide.nodes.Node;
+import org.openide.text.DataEditorSupport;
+
+public class OxtDataObject extends MultiDataObject {
+
+ public OxtDataObject(FileObject pf, OxtDataLoader loader) throws DataObjectExistsException, IOException {
+ super(pf, loader);
+ CookieSet cookies = getCookieSet();
+ cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), cookies));
+ }
+
+ protected Node createNodeDelegate() {
+ return new OxtDataNode(this);
+ }
+
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtFileEntryChildren.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtFileEntryChildren.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtFileEntryChildren.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtFileEntryChildren.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: OxtFileEntryChildren.java,v $
+ *
+ * $Revision: 1.4 $
+ *
+ * last change: $Author: jsc $ $Date: 2008/02/11 10:42:04 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.filetypes.oxt;
+import java.util.zip.ZipEntry;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+
+/**
+ *
+ * @author sg128468
+ */
+public class OxtFileEntryChildren extends Children.Keys<ZipEntry> {
+
+ public OxtFileEntryChildren() {}
+
+ protected Node[] createNodes(ZipEntry zipEntry) {
+ return new Node[]{new OxtFileEntryDataNode(zipEntry, Children.LEAF)};
+ }
+
+ @Override
+ protected void addNotify() {
+ Node node = getNode();
+ ZipEntry entry = (ZipEntry)node.getLookup().lookup(ZipEntry.class);
+ if (entry.isDirectory()) {
+ ZipEntry[] zips = OxtSubDirectoryStorage.getStorage().getEntriesForDirectory(entry.getName());
+ setKeys(zips);
+ }
+ }
+
+ @Override
+ protected void removeNotify() {
+ setKeys(new ZipEntry[]{});
+ }
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtFileEntryDataNode.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtFileEntryDataNode.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtFileEntryDataNode.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtFileEntryDataNode.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: OxtFileEntryDataNode.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: sg $ $Date: 2009/07/06 14:51:27 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.filetypes.oxt;
+
+import java.awt.Image;
+import java.util.zip.ZipEntry;
+import javax.swing.Action;
+import org.openide.nodes.AbstractNode;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.ImageUtilities;
+import org.openide.util.lookup.Lookups;
+import org.openoffice.extensions.util.typebrowser.logic.TypeNode;
+
+class OxtFileEntryDataNode extends AbstractNode {
+
+ private static final int DIRECTORY = 1;
+
+ int m_Type;
+ String m_Name;
+
+ public OxtFileEntryDataNode(ZipEntry obj, Children children) {
+ super(children, Lookups.singleton(obj));
+ m_Name = obj.getName();
+ determineType();
+ }
+
+ public String getDisplayName() {
+// ZipEntry zip = (ZipEntry)this.getLookup().lookup(ZipEntry.class);
+ return m_Name;
+ }
+
+ public Image getIcon(int i) {
+ if (m_Type == DIRECTORY) {
+ return ImageUtilities.loadImage(TypeNode.FOLDER_ICON);
+ }
+ return super.getIcon(i);
+ }
+
+ public Image getOpenedIcon(int i) {
+ if (m_Type == DIRECTORY) {
+ return ImageUtilities.loadImage(TypeNode.OPEN_FOLDER_ICON);
+ }
+ return super.getIcon(i);
+ }
+
+ private void determineType() {
+ if (m_Name.endsWith("/")) {
+ m_Type = DIRECTORY;
+ m_Name = m_Name.substring(0, m_Name.length() - 1);
+ }
+ int index = 0;
+ if ((index = m_Name.indexOf('/')) != -1) { // subentry
+ m_Name = m_Name.substring(index + 1);
+ }
+ }
+
+ public Action[] getActions(boolean context) {
+// if (context) {
+//
+// }
+ ZipEntry zip = (ZipEntry)this.getLookup().lookup(ZipEntry.class);
+ Node parentNode = this;
+ while (parentNode.getParentNode() != null) {
+ parentNode = parentNode.getParentNode();
+ }
+
+ return OxtNodeActions.getDefaultAction((OxtDataNode)parentNode, zip);
+ }
+
+}
\ No newline at end of file
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtNodeActions.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtNodeActions.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtNodeActions.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtNodeActions.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: OxtNodeActions.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: sg $ $Date: 2007/08/28 08:24:34 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.filetypes.oxt;
+
+import java.awt.event.ActionEvent;
+import java.util.zip.ZipEntry;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author sg128468
+ */
+public class OxtNodeActions {
+
+ public static Action[] getDefaultAction(OxtDataNode parentNode, ZipEntry zip) {
+ return new Action[]{new OxtNodeActions.OpenAction(parentNode, zip)};
+ }
+
+ public static Action[] getContextAction(OxtDataNode parentNode, ZipEntry zip) {
+ return new Action[]{new OxtNodeActions.OpenAction(parentNode, zip)};
+ }
+
+ private static class OpenAction extends AbstractAction {
+ ZipEntry zip;
+ OxtDataNode parentNode;
+
+ public OpenAction(OxtDataNode parentNode, ZipEntry zip) {
+ this.zip = zip;
+ this.parentNode = parentNode;
+ putValue(NAME, NbBundle.getMessage(OxtNodeActions.class, "LBL_OpenAction"));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ OxtDataLoader loader = new OxtDataLoader();
+ }
+ }
+
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtResolver.xml
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtResolver.xml?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtResolver.xml (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtResolver.xml Fri Jan 27 01:29:33 2012
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE MIME-resolver PUBLIC "-//NetBeans//DTD MIME Resolver 1.0//EN" "http://www.netbeans.org/dtds/mime-resolver-1_0.dtd">
+<MIME-resolver>
+ <file>
+ <ext name="oxt"/>
+ <ext name="OXT"/>
+ <resolver mime="application/x-oxt"/>
+
+ </file>
+</MIME-resolver>
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtSubDirectoryStorage.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtSubDirectoryStorage.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtSubDirectoryStorage.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtSubDirectoryStorage.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: OxtSubDirectoryStorage.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: sg $ $Date: 2007/08/28 08:24:34 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.filetypes.oxt;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.zip.ZipEntry;
+
+/**
+ *
+ * @author sg128468
+ */
+public class OxtSubDirectoryStorage {
+
+ Hashtable<String,ZipEntry[]> m_storage;
+
+ private static OxtSubDirectoryStorage m_subDirStorage;
+
+ public static OxtSubDirectoryStorage getStorage() {
+ if (m_subDirStorage == null)
+ m_subDirStorage = new OxtSubDirectoryStorage();
+ return m_subDirStorage;
+ }
+
+ /** Creates a new instance of OxtSubDirectoryStorage */
+ private OxtSubDirectoryStorage() {
+ m_storage = new Hashtable<String,ZipEntry[]>();
+ }
+
+ public void addEntryForDirectory(String directory, ZipEntry entry) {
+ ZipEntry[] zips = m_storage.get(directory);
+ if (zips != null) {
+ ZipEntry[] newZips = new ZipEntry[zips.length + 1];
+ for (int i = 0; i < zips.length; i++) {
+ newZips[i] = zips[i];
+ }
+ newZips[zips.length] = entry;
+ m_storage.put(directory, newZips);
+ }
+ else {
+ m_storage.put(directory, new ZipEntry[]{entry});
+ }
+ }
+
+ public void addEntry(ZipEntry entry) {
+ String directory = entry.getName();
+ directory = directory.substring(0, directory.lastIndexOf(File.separatorChar) + 1);
+ addEntryForDirectory(directory, entry);
+ }
+
+ public ZipEntry[] getEntriesForDirectory(String directory) {
+ return m_storage.get(directory);
+ }
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtTemplate.oxt
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtTemplate.oxt?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtTemplate.oxt (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/OxtTemplate.oxt Fri Jan 27 01:29:33 2012
@@ -0,0 +1 @@
+sample content
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/Bundle.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/Bundle.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/Bundle.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/Bundle.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,6 @@
+# NOI18N
+CTL_OxtWindowAction=Open OxtWindow Window
+# NOI18N
+CTL_OxtWindowTopComponent=OxtWindow Window
+# NOI18N
+HINT_OxtWindowTopComponent=This is a OxtWindow window
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/Bundle_pt_BR.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/Bundle_pt_BR.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/Bundle_pt_BR.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/Bundle_pt_BR.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,6 @@
+# NOI18N
+CTL_OxtWindowAction=Open OxtWindow Window
+# NOI18N
+CTL_OxtWindowTopComponent=OxtWindow Window
+# NOI18N
+HINT_OxtWindowTopComponent=This is a OxtWindow window
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowAction.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowAction.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowAction.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowAction.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,26 @@
+package org.openoffice.extensions.filetypes.oxt.window;
+
+import java.awt.event.ActionEvent;
+import javax.swing.AbstractAction;
+import javax.swing.ImageIcon;
+import org.openide.util.NbBundle;
+import org.openide.util.Utilities;
+import org.openide.windows.TopComponent;
+
+/**
+ * Action which shows OxtWindow component.
+ */
+public class OxtWindowAction extends AbstractAction {
+
+ public OxtWindowAction() {
+ super(NbBundle.getMessage(OxtWindowAction.class, "CTL_OxtWindowAction"));
+// putValue(SMALL_ICON, new ImageIcon(Utilities.loadImage(OxtWindowTopComponent.ICON_PATH, true)));
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ TopComponent win = OxtWindowTopComponent.findInstance();
+ win.open();
+ win.requestActive();
+ }
+
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponent.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponent.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponent.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponent.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="400" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="300" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+</Form>
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponent.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponent.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponent.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponent.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,113 @@
+package org.openoffice.extensions.filetypes.oxt.window;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.Serializable;
+import org.openide.ErrorManager;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.Utilities;
+import org.openide.windows.TopComponent;
+import org.openide.windows.WindowManager;
+
+/**
+ * Top component which displays something.
+ */
+final class OxtWindowTopComponent extends TopComponent {
+
+ private static OxtWindowTopComponent instance;
+ /** path to the icon used by the component and its open action */
+// static final String ICON_PATH = "SET/PATH/TO/ICON/HERE";
+
+ private static final String PREFERRED_ID = "OxtWindowTopComponent";
+
+ private OxtWindowTopComponent() {
+ initComponents();
+ setName(NbBundle.getMessage(OxtWindowTopComponent.class, "CTL_OxtWindowTopComponent"));
+ setToolTipText(NbBundle.getMessage(OxtWindowTopComponent.class, "HINT_OxtWindowTopComponent"));
+// setIcon(Utilities.loadImage(ICON_PATH, true));
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(0, 400, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(0, 300, Short.MAX_VALUE)
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ // End of variables declaration//GEN-END:variables
+
+ /**
+ * Gets default instance. Do not use directly: reserved for *.settings files only,
+ * i.e. deserialization routines; otherwise you could get a non-deserialized instance.
+ * To obtain the singleton instance, use {@link findInstance}.
+ */
+ public static synchronized OxtWindowTopComponent getDefault() {
+ if (instance == null) {
+ instance = new OxtWindowTopComponent();
+ }
+ return instance;
+ }
+
+ /**
+ * Obtain the OxtWindowTopComponent instance. Never call {@link #getDefault} directly!
+ */
+ public static synchronized OxtWindowTopComponent findInstance() {
+ TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
+ if (win == null) {
+ ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find OxtWindow component. It will not be located properly in the window system.");
+ return getDefault();
+ }
+ if (win instanceof OxtWindowTopComponent) {
+ return (OxtWindowTopComponent)win;
+ }
+ ErrorManager.getDefault().log(ErrorManager.WARNING, "There seem to be multiple components with the '" + PREFERRED_ID + "' ID. That is a potential source of errors and unexpected behavior.");
+ return getDefault();
+ }
+
+ public int getPersistenceType() {
+ return TopComponent.PERSISTENCE_ALWAYS;
+ }
+
+ public void componentOpened() {
+ // TODO add custom code on component opening
+ }
+
+ public void componentClosed() {
+ // TODO add custom code on component closing
+ }
+
+ /** replaces this in object stream */
+ public Object writeReplace() {
+ return new ResolvableHelper();
+ }
+
+ protected String preferredID() {
+ return PREFERRED_ID;
+ }
+
+ final static class ResolvableHelper implements Serializable {
+ private static final long serialVersionUID = 1L;
+ public Object readResolve() {
+ return OxtWindowTopComponent.getDefault();
+ }
+ }
+
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponentSettings.xml
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponentSettings.xml?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponentSettings.xml (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponentSettings.xml Fri Jan 27 01:29:33 2012
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
+<settings version="1.0">
+ <module name="org.openoffice.extensions" spec="1.1"/>
+ <instanceof class="org.openide.windows.TopComponent"/>
+ <instanceof class="org.openoffice.extensions.filetypes.oxt.window.OxtWindowTopComponent"/>
+ <instance class="org.openoffice.extensions.filetypes.oxt.window.OxtWindowTopComponent" method="getDefault"/>
+</settings>
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponentWstcref.xml
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponentWstcref.xml?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponentWstcref.xml (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/oxt/window/OxtWindowTopComponentWstcref.xml Fri Jan 27 01:29:33 2012
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE tc-ref PUBLIC "-//NetBeans//DTD Top Component in Mode Properties 2.0//EN" "http://www.netbeans.org/dtds/tc-ref2_0.dtd">
+<tc-ref version="2.0" >
+ <module name="org.openoffice.extensions" spec="1.1"/>
+ <tc-id id="OxtWindowTopComponent"/>
+ <state opened="false"/>
+</tc-ref>
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/Bundle.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/Bundle.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/Bundle.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/Bundle.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,13 @@
+RegistryVisualPanel1.Titlexcu=Xcu file
+RegistryVisualPanel1.Titlexcs=Xcs file
+RegistryVisualPanel1.jBrowseButton.text=&Browse...
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+RegistryVisualPanel1.jFileNameLabel.text=File &Name:
+RegistryVisualPanel1.jProjectLabel.text=Project:
+RegistryVisualPanel1.jFolderLabel.text=&Folder:
+RegistryVisualPanel1.jCreatedFileLabel.text=Created File:
+FileChooserTitlexcu=Select xcu Directory
+FileChooserTitlexcs=Select xcs Directory
+DefaultFileNamexcu=NewXcuFile
+DefaultFileNamexcs=NewXcsFile
\ No newline at end of file
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/RegistryVisualPanel1.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/RegistryVisualPanel1.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/RegistryVisualPanel1.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/RegistryVisualPanel1.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" max="-2" attributes="0">
+ <Component id="jFileNameLabel" alignment="0" pref="89" max="32767" attributes="1"/>
+ <Component id="jProjectLabel" alignment="0" max="32767" attributes="1"/>
+ <Component id="jFolderLabel" alignment="0" max="32767" attributes="1"/>
+ <Component id="jCreatedFileLabel" alignment="0" max="32767" attributes="1"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jCreatedFileTextField" pref="273" max="32767" attributes="0"/>
+ <Component id="jProjectTextField" pref="273" max="32767" attributes="0"/>
+ <Component id="jFileNameTextField" pref="273" max="32767" attributes="0"/>
+ <Component id="jFolderTextField" alignment="0" pref="273" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
+ <Component id="jBrowseButton" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Component id="jSeparator1" alignment="0" pref="473" max="32767" attributes="0"/>
+ <Component id="jErrorLabel" alignment="0" pref="473" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jFileNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jFileNameTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jProjectLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jProjectTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jFolderLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jBrowseButton" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jFolderTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jCreatedFileLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jCreatedFileTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jSeparator1" min="-2" pref="10" max="-2" attributes="0"/>
+ <EmptySpace pref="150" max="32767" attributes="0"/>
+ <Component id="jErrorLabel" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="jFileNameLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="jFileNameTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/filetypes/registry_ui/Bundle.properties" key="RegistryVisualPanel1.jFileNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jProjectLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="jProjectTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/filetypes/registry_ui/Bundle.properties" key="RegistryVisualPanel1.jProjectLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jFolderLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="jFolderTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/filetypes/registry_ui/Bundle.properties" key="RegistryVisualPanel1.jFolderLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jCreatedFileLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="jCreatedFileTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/filetypes/registry_ui/Bundle.properties" key="RegistryVisualPanel1.jCreatedFileLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JSeparator" name="jSeparator1">
+ </Component>
+ <Component class="javax.swing.JLabel" name="jErrorLabel">
+ <Properties>
+ <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
+ <Font name="Dialog" size="12" style="0"/>
+ </Property>
+ <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+ <Color blue="0" green="0" red="ff" type="rgb"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JButton" name="jBrowseButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/filetypes/registry_ui/Bundle.properties" key="RegistryVisualPanel1.jBrowseButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="actionCommand" type="java.lang.String" value="BROWSE" noResource="true"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBrowseButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JTextField" name="jFileNameTextField">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="jTextField1" noResource="true"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="jFolderTextField">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="jTextField2" noResource="true"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="jProjectTextField">
+ <Properties>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="text" type="java.lang.String" value="jTextField3" noResource="true"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="jCreatedFileTextField">
+ <Properties>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="text" type="java.lang.String" value="jTextField4" noResource="true"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/RegistryVisualPanel1.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/RegistryVisualPanel1.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/RegistryVisualPanel1.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/RegistryVisualPanel1.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: RegistryVisualPanel1.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: sg $ $Date: 2009/10/26 08:01:12 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+package org.openoffice.extensions.filetypes.registry_ui;
+
+import java.io.File;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.filechooser.FileSystemView;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectUtils;
+import org.netbeans.spi.project.ui.templates.support.Templates;
+import org.openide.WizardDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.util.ProjectTypeHelper;
+
+public final class RegistryVisualPanel1 extends JPanel implements DocumentListener {
+
+ // name for reading file chooser title from Bundle.properties
+ private String m_fileType;
+ private String m_FileFolder;
+ private Project m_proj;
+
+ /** Creates new form RegistryVisualPanel1 */
+ public RegistryVisualPanel1(String fileType) {
+ m_fileType = fileType;
+ initComponents();
+ jFileNameTextField.getDocument().addDocumentListener(this);
+ jFolderTextField.getDocument().addDocumentListener(this);
+ String defaultFileNamePropName = "DefaultFileName".concat(fileType); // NOI18N
+ jFileNameTextField.setText(NbBundle.getMessage(RegistryVisualPanel1.class, defaultFileNamePropName));
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(RegistryVisualPanel1.class, "RegistryVisualPanel1.Title".concat(m_fileType)); // NOI18N
+ }
+
+ public void insertUpdate(DocumentEvent e) {
+ updateTexts(e);
+ }
+
+ public void removeUpdate(DocumentEvent e) {
+ updateTexts(e);
+ }
+
+ public void changedUpdate(DocumentEvent e) {
+ updateTexts(e);
+ }
+
+ private void updateTexts(DocumentEvent e) {
+ String dirName = jFolderTextField.getText();
+ String fileName = jFileNameTextField.getText().concat(".").concat(m_fileType);
+ File f = new File(dirName);
+ if (f.exists() && f.canWrite()) { // absolute file already
+ m_FileFolder = f.getAbsolutePath();
+ jCreatedFileTextField.setText(dirName.concat(File.separator).concat(fileName));
+ }
+ else {
+ dirName = dirName.replaceAll("/", File.separator); // produce a system file
+ if (m_proj != null) {
+ FileObject projDir = m_proj.getProjectDirectory();
+ String projDirName = FileUtil.toFile(projDir).getAbsolutePath();
+ m_FileFolder = projDirName.concat(File.separator).concat(dirName);
+ jCreatedFileTextField.setText(m_FileFolder.concat(File.separator).concat(fileName));
+ }
+ else {
+ m_FileFolder = "";
+ jCreatedFileTextField.setText(fileName);
+ }
+ }
+
+ }
+
+ protected void read(WizardDescriptor desc) {
+ // project name
+ Project p = Templates.getProject(desc);
+ if (p != null) {
+ m_proj = p;
+ String displayName = ProjectUtils.getInformation(p).getDisplayName();
+ jProjectTextField.setText(displayName);
+ String registryDir = (String)ProjectTypeHelper.getObjectFromUnoProperties(m_proj, "registry.dir"); // NOI18N
+ if (registryDir == null) registryDir = "registry";
+ if (m_fileType.equals(RegistryWizardPanel1.XCS_FILE_TYPE)) {
+ jFolderTextField.setText(registryDir.concat("/schema")); // NOI18N
+ }
+ else {
+ jFolderTextField.setText(registryDir.concat("/data")); // NOI18N
+ }
+ }
+ }
+
+ protected void store(WizardDescriptor desc) {
+ String fileName = jFileNameTextField.getText().concat(".").concat(m_fileType);
+ desc.putProperty("FileName", fileName);
+ desc.putProperty("Folder", m_FileFolder);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jFileNameLabel = new javax.swing.JLabel();
+ jProjectLabel = new javax.swing.JLabel();
+ jFolderLabel = new javax.swing.JLabel();
+ jCreatedFileLabel = new javax.swing.JLabel();
+ jSeparator1 = new javax.swing.JSeparator();
+ jErrorLabel = new javax.swing.JLabel();
+ jBrowseButton = new javax.swing.JButton();
+ jFileNameTextField = new javax.swing.JTextField();
+ jFolderTextField = new javax.swing.JTextField();
+ jProjectTextField = new javax.swing.JTextField();
+ jCreatedFileTextField = new javax.swing.JTextField();
+
+ jFileNameLabel.setLabelFor(jFileNameTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(jFileNameLabel, org.openide.util.NbBundle.getMessage(RegistryVisualPanel1.class, "RegistryVisualPanel1.jFileNameLabel.text")); // NOI18N
+
+ jProjectLabel.setLabelFor(jProjectTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(jProjectLabel, org.openide.util.NbBundle.getMessage(RegistryVisualPanel1.class, "RegistryVisualPanel1.jProjectLabel.text")); // NOI18N
+
+ jFolderLabel.setLabelFor(jFolderTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(jFolderLabel, org.openide.util.NbBundle.getMessage(RegistryVisualPanel1.class, "RegistryVisualPanel1.jFolderLabel.text")); // NOI18N
+
+ jCreatedFileLabel.setLabelFor(jCreatedFileTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(jCreatedFileLabel, org.openide.util.NbBundle.getMessage(RegistryVisualPanel1.class, "RegistryVisualPanel1.jCreatedFileLabel.text")); // NOI18N
+
+ jErrorLabel.setFont(new java.awt.Font("Dialog", 0, 12));
+ jErrorLabel.setForeground(new java.awt.Color(255, 0, 0));
+
+ org.openide.awt.Mnemonics.setLocalizedText(jBrowseButton, org.openide.util.NbBundle.getMessage(RegistryVisualPanel1.class, "RegistryVisualPanel1.jBrowseButton.text")); // NOI18N
+ jBrowseButton.setActionCommand("BROWSE"); // NOI18N
+ jBrowseButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jBrowseButtonActionPerformed(evt);
+ }
+ });
+
+ jFileNameTextField.setText("jTextField1"); // NOI18N
+
+ jFolderTextField.setText("jTextField2"); // NOI18N
+
+ jProjectTextField.setEditable(false);
+ jProjectTextField.setText("jTextField3"); // NOI18N
+
+ jCreatedFileTextField.setEditable(false);
+ jCreatedFileTextField.setText("jTextField4"); // NOI18N
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
+ .add(jFileNameLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE)
+ .add(jProjectLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(jFolderLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(jCreatedFileLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jCreatedFileTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE)
+ .add(jProjectTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE)
+ .add(jFileNameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE)
+ .add(jFolderTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
+ .add(jBrowseButton))
+ .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 473, Short.MAX_VALUE)
+ .add(jErrorLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 473, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jFileNameLabel)
+ .add(jFileNameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .add(18, 18, 18)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jProjectLabel)
+ .add(jProjectTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jFolderLabel)
+ .add(jBrowseButton)
+ .add(jFolderTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jCreatedFileLabel)
+ .add(jCreatedFileTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 150, Short.MAX_VALUE)
+ .add(jErrorLabel))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+private void jBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBrowseButtonActionPerformed
+
+ String command = evt.getActionCommand();
+ if ("BROWSE".equals(command)) { // NOI18N
+ File startFile = null;
+ if (m_proj != null) {
+ startFile = FileUtil.toFile(m_proj.getProjectDirectory());
+ }
+ JFileChooser chooser = new JFileChooser(FileSystemView.getFileSystemView());
+ FileUtil.preventFileChooserSymlinkTraversal(chooser, startFile);
+ chooser.setDialogTitle(NbBundle.getMessage(RegistryWizardPanel1.class, "FileChooserTitle".concat(m_fileType)));
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
+ File projectDir = chooser.getSelectedFile();
+ String dirName = FileUtil.normalizeFile(projectDir).getAbsolutePath();
+ jFolderTextField.setText(dirName);
+ }
+ }
+
+}//GEN-LAST:event_jBrowseButtonActionPerformed
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton jBrowseButton;
+ private javax.swing.JLabel jCreatedFileLabel;
+ private javax.swing.JTextField jCreatedFileTextField;
+ private javax.swing.JLabel jErrorLabel;
+ private javax.swing.JLabel jFileNameLabel;
+ private javax.swing.JTextField jFileNameTextField;
+ private javax.swing.JLabel jFolderLabel;
+ private javax.swing.JTextField jFolderTextField;
+ private javax.swing.JLabel jProjectLabel;
+ private javax.swing.JTextField jProjectTextField;
+ private javax.swing.JSeparator jSeparator1;
+ // End of variables declaration//GEN-END:variables
+}
+
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/RegistryWizardPanel1.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/RegistryWizardPanel1.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/RegistryWizardPanel1.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/RegistryWizardPanel1.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: RegistryWizardPanel1.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: sg $ $Date: 2008/10/07 08:55:26 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+package org.openoffice.extensions.filetypes.registry_ui;
+
+import java.awt.Component;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import javax.swing.event.ChangeListener;
+import org.openide.WizardDescriptor;
+import org.openide.filesystems.FileLock;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.HelpCtx;
+import org.openoffice.extensions.util.LogWriter;
+
+public class RegistryWizardPanel1 implements WizardDescriptor.Panel {
+
+ public static final String XCU_FILE_TYPE = "xcu";
+ public static final String XCS_FILE_TYPE = "xcs";
+
+ private String m_fileType;
+
+ public RegistryWizardPanel1(String fileType) {
+ this.m_fileType = fileType;
+ }
+
+ /**
+ * The visual component that displays this panel. If you need to access the
+ * component from this class, just use getComponent().
+ */
+ private RegistryVisualPanel1 component;
+ // Get the visual component for the panel. In this template, the component
+ // is kept separate. This can be more efficient: if the wizard is created
+ // but never displayed, or not all panels are displayed, it is better to
+ // create only those which really need to be visible.
+ public Component getComponent() {
+ if (component == null) {
+ component = new RegistryVisualPanel1(m_fileType);
+ }
+ return component;
+ }
+
+ public HelpCtx getHelp() {
+ // Show no Help button for this panel:
+ return HelpCtx.DEFAULT_HELP;
+ // If you have context help:
+ // return new HelpCtx(SampleWizardPanel1.class);
+ }
+
+ public boolean isValid() {
+ // If it is always OK to press Next or Finish, then:
+ return true;
+ // If it depends on some condition (form filled out...), then:
+ // return someCondition();
+ // and when this condition changes (last form field filled in...) then:
+ // fireChangeEvent();
+ // and uncomment the complicated stuff below.
+ }
+
+ public final void addChangeListener(ChangeListener l) {
+ }
+
+ public final void removeChangeListener(ChangeListener l) {
+ }
+ /*
+ private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1); // or can use ChangeSupport in NB 6.0
+ public final void addChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.add(l);
+ }
+ }
+ public final void removeChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.remove(l);
+ }
+ }
+ protected final void fireChangeEvent() {
+ Iterator<ChangeListener> it;
+ synchronized (listeners) {
+ it = new HashSet<ChangeListener>(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ it.next().stateChanged(ev);
+ }
+ }
+ */
+
+ // You can use a settings object to keep track of state. Normally the
+ // settings object will be the WizardDescriptor, so you can use
+ // WizardDescriptor.getProperty & putProperty to store information entered
+ // by the user.
+ public void readSettings(Object settings) {
+ component.read((WizardDescriptor)settings);
+ }
+
+ public void storeSettings(Object settings) {
+ component.store((WizardDescriptor)settings);
+ }
+
+ public static boolean unZipFile(FileObject target, FileObject source) throws IOException {
+ if (target == null || source == null) return false;
+ InputStream in = source.getInputStream();
+ try {
+ FileLock lock = target.lock();
+ try {
+ OutputStream out = target.getOutputStream(lock);
+ try {
+ FileUtil.copy(in, out);
+ }
+ catch (IOException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ } finally {
+ out.close();
+ }
+ } finally {
+ lock.releaseLock();
+ }
+ }
+ catch (IOException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ }
+ finally {
+ if (in != null) {
+ in.close();
+ }
+ }
+ return true;
+ }
+
+}
+
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/XcsWizardIterator.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/XcsWizardIterator.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/XcsWizardIterator.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/XcsWizardIterator.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XcsWizardIterator.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: sg $ $Date: 2008/10/07 08:55:26 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+package org.openoffice.extensions.filetypes.registry_ui;
+
+import java.awt.Component;
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import javax.swing.JComponent;
+import javax.swing.event.ChangeListener;
+import org.netbeans.spi.project.ui.templates.support.Templates;
+import org.openide.WizardDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+public final class XcsWizardIterator implements WizardDescriptor.InstantiatingIterator {
+
+ private int index;
+ private WizardDescriptor wizard;
+ private WizardDescriptor.Panel[] panels;
+
+ /**
+ * Initialize panels representing individual wizard's steps and sets
+ * various properties for them influencing wizard appearance.
+ */
+ private WizardDescriptor.Panel[] getPanels() {
+ if (panels == null) {
+ panels = new WizardDescriptor.Panel[]{
+ new RegistryWizardPanel1(RegistryWizardPanel1.XCS_FILE_TYPE)
+ };
+ String[] steps = createSteps();
+ for (int i = 0; i < panels.length; i++) {
+ Component c = panels[i].getComponent();
+ if (steps[i] == null) {
+ // Default step name to component name of panel. Mainly
+ // useful for getting the name of the target chooser to
+ // appear in the list of steps.
+ steps[i] = c.getName();
+ }
+ if (c instanceof JComponent) { // assume Swing components
+ JComponent jc = (JComponent) c;
+ // Sets step number of a component
+ jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
+ // Sets steps names for a panel
+ jc.putClientProperty("WizardPanel_contentData", steps);
+ // Turn on subtitle creation on each step
+ jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
+ // Show steps on the left side with the image on the background
+ jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
+ // Turn on numbering of all steps
+ jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
+ }
+ }
+ }
+ return panels;
+ }
+
+ public Set instantiate() throws IOException {
+ Set<FileObject> resultSet = new LinkedHashSet<FileObject>();
+ String fileName = (String)wizard.getProperty("FileName"); // NOI18N
+ String folder = (String)wizard.getProperty("Folder"); // NOI18N
+ if (folder.length() > 0) {
+ File parent = new File(folder);
+ if (!parent.exists()) {
+ parent.mkdirs();
+ }
+ FileObject parentObject = FileUtil.toFileObject(parent);
+ if (parentObject != null) {
+ FileObject file = parentObject.createData(fileName);
+ FileObject template = Templates.getTemplate(wizard);
+ if (RegistryWizardPanel1.unZipFile(file, template)) {
+ resultSet.add(file);
+ }
+ return resultSet; //Collections.EMPTY_SET;
+ }
+ }
+ return Collections.EMPTY_SET;
+ }
+
+ public void initialize(WizardDescriptor wizard) {
+ this.wizard = wizard;
+ }
+
+ public void uninitialize(WizardDescriptor wizard) {
+ panels = null;
+ }
+
+ public WizardDescriptor.Panel current() {
+ return getPanels()[index];
+ }
+
+ public String name() {
+ return index + 1 + ". from " + getPanels().length;
+ }
+
+ public boolean hasNext() {
+ return index < getPanels().length - 1;
+ }
+
+ public boolean hasPrevious() {
+ return index > 0;
+ }
+
+ public void nextPanel() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ index++;
+ }
+
+ public void previousPanel() {
+ if (!hasPrevious()) {
+ throw new NoSuchElementException();
+ }
+ index--;
+ }
+
+ // If nothing unusual changes in the middle of the wizard, simply:
+ public void addChangeListener(ChangeListener l) {
+ }
+
+ public void removeChangeListener(ChangeListener l) {
+ }
+
+ // If something changes dynamically (besides moving between panels), e.g.
+ // the number of panels changes in response to user input, then uncomment
+ // the following and call when needed: fireChangeEvent();
+ /*
+ private Set<ChangeListener> listeners = new HashSet<ChangeListener>(1); // or can use ChangeSupport in NB 6.0
+ public final void addChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.add(l);
+ }
+ }
+ public final void removeChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.remove(l);
+ }
+ }
+ protected final void fireChangeEvent() {
+ Iterator<ChangeListener> it;
+ synchronized (listeners) {
+ it = new HashSet<ChangeListener>(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ it.next().stateChanged(ev);
+ }
+ }
+ */ // You could safely ignore this method. Is is here to keep steps which were
+ // there before this wizard was instantiated. It should be better handled
+ // by NetBeans Wizard API itself rather than needed to be implemented by a
+ // client code.
+ private String[] createSteps() {
+ String[] beforeSteps = null;
+ Object prop = wizard.getProperty("WizardPanel_contentData");
+ if (prop != null && prop instanceof String[]) {
+ beforeSteps = (String[]) prop;
+ }
+
+ if (beforeSteps == null) {
+ beforeSteps = new String[0];
+ }
+
+ String[] res = new String[(beforeSteps.length - 1) + panels.length];
+ for (int i = 0; i < res.length; i++) {
+ if (i < (beforeSteps.length - 1)) {
+ res[i] = beforeSteps[i];
+ } else {
+ res[i] = panels[i - beforeSteps.length + 1].getComponent().getName();
+ }
+ }
+ return res;
+ }
+}