Return-Path: X-Original-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 26F919E84 for ; Fri, 27 Jan 2012 01:32:03 +0000 (UTC) Received: (qmail 44464 invoked by uid 500); 27 Jan 2012 01:32:03 -0000 Delivered-To: apmail-incubator-ooo-commits-archive@incubator.apache.org Received: (qmail 44415 invoked by uid 500); 27 Jan 2012 01:32:03 -0000 Mailing-List: contact ooo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ooo-dev@incubator.apache.org Delivered-To: mailing list ooo-commits@incubator.apache.org Received: (qmail 44408 invoked by uid 99); 27 Jan 2012 01:32:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jan 2012 01:32:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jan 2012 01:31:45 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id A79892388C63; Fri, 27 Jan 2012 01:30:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1236486 [31/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... Date: Fri, 27 Jan 2012 01:29:58 -0000 To: ooo-commits@incubator.apache.org From: arist@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120127013025.A79892388C63@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardPanel.java URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardPanel.java?rev=1236486&view=auto ============================================================================== --- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardPanel.java (added) +++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardPanel.java Fri Jan 27 01:29:33 2012 @@ -0,0 +1,120 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: UNOClientAppWizardPanel.java,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: sg $ $Date: 2007/05/03 09:55:48 $ + * + * 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.projecttemplates.unoclientapplication; + +import java.awt.Component; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.openide.WizardValidationException; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle; + +/** + * Panel just asking for basic info. + */ +public class UNOClientAppWizardPanel implements WizardDescriptor.Panel, + WizardDescriptor.ValidatingPanel, WizardDescriptor.FinishablePanel { + + private WizardDescriptor wizardDescriptor; + private UNOClientAppPanelVisual component; + + /** Creates a new instance of templateWizardPanel */ + public UNOClientAppWizardPanel() { + } + + public Component getComponent() { + if (component == null) { + component = new UNOClientAppPanelVisual(this); + component.setName(NbBundle.getMessage(UNOClientAppWizardPanel.class, "LBL_CreateProjectStep")); + } + return component; + } + + public HelpCtx getHelp() { + return new HelpCtx("org.openoffice.extensions.working.with.clients"); // NOI18N + } + + public boolean isValid() { + getComponent(); + return component.valid(wizardDescriptor); + } + + private final Set listeners = new HashSet(1); + 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 it; + synchronized (listeners) { + it = new HashSet(listeners).iterator(); + } + ChangeEvent ev = new ChangeEvent(this); + while (it.hasNext()) { + ((ChangeListener) it.next()).stateChanged(ev); + } + } + + public void readSettings(Object settings) { + wizardDescriptor = (WizardDescriptor) settings; + component.read(wizardDescriptor); + } + + public void storeSettings(Object settings) { + WizardDescriptor d = (WizardDescriptor) settings; + component.store(d); + } + + public boolean isFinishPanel() { + return true; + } + + public void validate() throws WizardValidationException { + getComponent(); + component.validate(wizardDescriptor); + } + +} Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/unoclientapplication/unoclient.gif URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/unoclientapplication/unoclient.gif?rev=1236486&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/unoclientapplication/unoclient.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/AdvancedReplace.java URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/AdvancedReplace.java?rev=1236486&view=auto ============================================================================== --- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/AdvancedReplace.java (added) +++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/AdvancedReplace.java Fri Jan 27 01:29:33 2012 @@ -0,0 +1,1153 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AdvancedReplace.java,v $ + * + * $Revision: 1.15 $ + * + * last change: $Author: sg $ $Date: 2008/10/09 14:58: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.util; + +import java.awt.Image; +import java.io.File; +import java.io.IOException; +import java.util.Enumeration; +import java.util.StringTokenizer; +import java.util.Vector; +import org.openide.WizardDescriptor; +import org.openide.filesystems.FileObject; +import org.openide.filesystems.FileUtil; +import org.openoffice.extensions.projecttemplates.addon.datamodel.AddOn; +import org.openoffice.extensions.projecttemplates.addon.datamodel.Command; +import org.openoffice.extensions.projecttemplates.addon.datamodel.SeparatorElement; +import org.openoffice.extensions.projecttemplates.addon.datamodel.SubMenuElement; +import org.openoffice.extensions.projecttemplates.calcaddin.datamodel.AddIn; +import org.openoffice.extensions.util.datamodel.Function; +import org.openoffice.extensions.util.datamodel.FunctionException; +import org.openoffice.extensions.util.datamodel.IdlEnum; +import org.openoffice.extensions.util.datamodel.IdlEnumeration; +import org.openoffice.extensions.util.datamodel.Interface; +import org.openoffice.extensions.util.datamodel.NbNodeObject; +import org.openoffice.extensions.util.datamodel.Parameter; +import org.openoffice.extensions.util.datamodel.PolyStruct; +import org.openoffice.extensions.util.datamodel.PropertyContainer; +import org.openoffice.extensions.util.datamodel.Service; +import org.openoffice.extensions.util.datamodel.Struct; +import org.openoffice.extensions.util.datamodel.TemplateType; +import org.openoffice.extensions.util.datamodel.localization.LanguageDefinition; +import org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty; +import org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty; +import org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty; +import org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgProperty; +import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgLanguageIDException; +import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgPropertyException; + +/** + * + */ +public class AdvancedReplace { + + private static final String cr = System.getProperty("line.separator"); // NOI18N + + private static final int SIMPLE_REPLACE = 0; + private static final int XCU_REPLACE = 1; + private static final int INTERFACE_REPLACE = 2; + private static final int SERVICE_REPLACE = 3; + private static final int ADDIN_REPLACE = 4; + private static final int ENUMERATION_REPLACE = 5; + private static final int STRUCT_REPLACE = 6; + private static final int EXCEPTION_REPLACE = 7; + private static final int POLY_STRUCT_REPLACE = 8; + private static final int ADDON_REPLACE = 9; + private static final String EMPTY_VALUE = ""; // NOI18N + + private int replaceType; + + private int functionCount = 0; + private int parameterCount = 0; + private String[] function_template_xcu; + private String[] parameter_template_xcu; + + private int menuOrderNumber; + private int toolbarOrderNumber; + + private WizardDescriptor wiz; + + private Interface ifc; + private Service srv; + private AddIn addin; + private IdlEnumeration enm; + private Struct str; + private FunctionException ex; + private PolyStruct pstr; + + + /** Creates a new instance of AdvancedReplace */ + public AdvancedReplace( + WizardDescriptor wiz, + String[] function_template_xcu, + String[] parameter_template_xcu) { + this.function_template_xcu = function_template_xcu; + this.parameter_template_xcu = parameter_template_xcu; + if (function_template_xcu == null && parameter_template_xcu == null) + replaceType = SIMPLE_REPLACE; + else + replaceType = XCU_REPLACE; + this.wiz = wiz; + } + + /** Creates a new instance of AdvancedReplace */ + public AdvancedReplace(WizardDescriptor wiz, AddOn addon) { + replaceType = ADDON_REPLACE; + this.wiz = wiz; + } + + /** Creates a new instance of AdvancedReplace */ + public AdvancedReplace(WizardDescriptor wiz, SubMenuElement topElement) { + replaceType = ADDON_REPLACE; + this.wiz = wiz; + } + + public AdvancedReplace(WizardDescriptor wiz, Interface ifc) { + this.wiz = wiz; + this.ifc = ifc; + replaceType = INTERFACE_REPLACE; + } + + public AdvancedReplace(WizardDescriptor wiz, Service srv) { + this.wiz = wiz; + this.srv = srv; + replaceType = SERVICE_REPLACE; + } + + public AdvancedReplace(WizardDescriptor wiz, IdlEnumeration enm) { + this.wiz = wiz; + this.enm = enm; + replaceType = ENUMERATION_REPLACE; + } + + public AdvancedReplace(WizardDescriptor wiz, FunctionException ex) { + this.wiz = wiz; + this.ex = ex; + replaceType = EXCEPTION_REPLACE; + } + + public AdvancedReplace(WizardDescriptor wiz, Struct str) { + this.wiz = wiz; + this.str = str; + replaceType = STRUCT_REPLACE; + } + + public AdvancedReplace(WizardDescriptor wiz, PolyStruct pstr) { + this.wiz = wiz; + this.pstr = pstr; + replaceType = POLY_STRUCT_REPLACE; + } + + public AdvancedReplace(WizardDescriptor wiz, AddIn addin) { + this.wiz = wiz; + this.addin = addin; + replaceType = ADDIN_REPLACE; + } + + /** Creates a new instance of AdvancedReplace */ + public AdvancedReplace( + WizardDescriptor wiz) { + this(wiz, null, null); + } + + public String[] replaceVariables(String sourceString) + throws IOException, UnknownOpenOfficeOrgLanguageIDException, UnknownOpenOfficeOrgPropertyException { + if (sourceString == null || sourceString.length() == 0) { + return new String[0]; + } + switch(replaceType) { + case INTERFACE_REPLACE: + return doInterfaceReplace(sourceString); + case SERVICE_REPLACE: + return doServiceReplace(sourceString); + case ADDIN_REPLACE: + return doAddInReplace(sourceString); + case ENUMERATION_REPLACE: + return doEnumerationReplace(sourceString); + case STRUCT_REPLACE: + return doStructReplace(sourceString); + case POLY_STRUCT_REPLACE: + return doPolyStructReplace(sourceString); + case EXCEPTION_REPLACE: + return doExceptionReplace(sourceString); + case ADDON_REPLACE: + return doAddOnReplace(sourceString); + default: + return doSimpleReplace(sourceString); + } + } + + private String[] doSimpleReplace(String sourceString) + throws IOException, UnknownOpenOfficeOrgLanguageIDException { + String output = sourceString.replaceAll("\\$\\!ProjectName\\!", + (String)wiz.getProperty("name")); // NOI18N + output = output.replaceAll("\\$\\!PackageName\\!", + (String)wiz.getProperty("UnoPackage")); // NOI18N + output = output.replaceAll("\\$\\!CR\\!", cr); // NOI18N + output = output.replaceAll("\\$\\!PackageNameUnderscore\\!", + (String)wiz.getProperty("packageNameUnderscore")); // NOI18N + output = output.replaceAll("\\$\\!PackageNameModule\\!", + (String)wiz.getProperty("packageNameModule")); // NOI18N + output = output.replaceAll("\\$\\!TimeStamp\\!", + (String)wiz.getProperty("TimeStamp")); // NOI18N + output = output.replaceAll("\\$\\!CloseModule\\!", + (String)wiz.getProperty("closeModule")); // NOI18N + output = output.replaceAll("\\$\\!MainClass\\!", + (String)wiz.getProperty("mainClassName")); // NOI18N + output = output.replaceAll("\\$\\!MainClassSmall\\!", + (String)wiz.getProperty("mainClassNameSmall")); // NOI18N + output = output.replaceAll("\\$\\!AddonContext\\!", + (String)wiz.getProperty("Context")); // NOI18N + output = output.replaceAll("\\$\\!Protocol\\!", + (String)wiz.getProperty("Protocol")); // NOI18N + output = output.replaceAll("\\$\\!StructName\\!", + (String)wiz.getProperty("StructName")); // NOI18N + output = output.replaceAll("\\$\\!PolyStructName\\!", + (String)wiz.getProperty("PolyStructName")); // NOI18N + output = output.replaceAll("\\$\\!PolyStructNameTemplate\\!", + (String)wiz.getProperty("PolyStructNameTemplate")); // NOI18N + output = output.replaceAll("\\$\\!ExceptionName\\!", + (String)wiz.getProperty("ExceptionName")); // NOI18N + output = output.replaceAll("\\$\\!ParentExceptionName\\!", + (String)wiz.getProperty("ParentExceptionName")); // NOI18N + output = output.replaceAll("\\$\\!Service\\!", + (String)wiz.getProperty("Service")); // NOI18N + output = output.replaceAll("\\$\\!XMultiInheritanceInterface\\!", + (String)wiz.getProperty("XMultiInheritanceInterface")); // NOI18N + output = output.replaceAll("\\$\\!EnumName\\!", + (String)wiz.getProperty("EnumName")); // NOI18N + if (output.indexOf("$!Os!") != -1) { + output = output.replaceAll("\\$\\!Os\\!", // NOI18N + "os.dir=".concat((String)wiz.getProperty("PlatformBinDir"))); // NOI18N + } + if (output.indexOf("$!Sdk!") != -1) { // NOI18N + output = output.replaceAll("\\$\\!Sdk\\!", + "sdk=".concat(((String)wiz.getProperty("SdkPath")).replaceAll("\\\\", "\\\\\\\\\\\\\\\\"))); // NOI18N + } + if (output.indexOf("$!Soffice!") != -1) { + output = output.replaceAll("\\$\\!Soffice\\!", + "soffice.program=".concat(((String)wiz.getProperty("OfficePath")).replaceAll("\\\\", "\\\\\\\\\\\\\\\\"))); // NOI18N + } + if (output.indexOf("$!ProjectDir!") != -1) { + output = output.replaceAll("\\$\\!ProjectDir\\!", + "project.dir=".concat(((String)wiz.getProperty("ProjectDir")).replaceAll("\\\\", "\\\\\\\\\\\\\\\\"))); // NOI18N + } + + // special stuff with more interaction + if (output.indexOf("$!Import!") != -1) { // NOI18N + Vector importContainer = new Vector(); + importContainer.add("\n#include "); // NOI18N + int funcCount = 0; + if (wiz.getProperty("XInterface") == null) { // NOI18N + funcCount = ((Integer)wiz.getProperty("functionCount")).intValue(); // NOI18N + } + else { + String ifc = (String)wiz.getProperty("XInterface"); // NOI18N + funcCount = ((Integer)wiz.getProperty( + ifc.concat("functionCount"))).intValue(); // NOI18N + } + for (int i=0; i"); // NOI18N + } + boolean[] imported = new boolean[2]; + int param = 2; + while (param"); // NOI18N + imported[0] = true; + } + if (function[param].equals("XPropertySet") && !imported[1]) { // NOI18N + importContainer.add("\n#include "); // NOI18N + imported[1] = true; + } + param += 2; + } + } + importContainer.add(getExceptionImports( + (NbNodeObject)wiz.getProperty("ServiceObject"))); // NOI18N + + if (output.length() > 0) { + importContainer.add("\n"); // NOI18N + } + return importContainer.toArray(new String[importContainer.size()]); + } + else if (output.indexOf("$!Methods!") != -1) { // NOI18N + LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, "######### OOOOOPSS ###########"); // NOI18N + } + else if (output.indexOf("$!xcuFunctions!") != -1) { // NOI18N + int funcCount = ((Integer)wiz.getProperty("functionCount")).intValue(); // NOI18N + if (functionCount < funcCount) { + boolean lastFunction = functionCount == funcCount - 1; + parameterCount = 3; + functionCount++; + if (lastFunction) return function_template_xcu; + String[] retString = new String[function_template_xcu.length + 1]; + for (int i=0; i returnVal = new Vector(); + for (int i=0; i"); // NOI18N + returnVal.add(emptyValue); + } + } + } + return returnVal.toArray(new String[returnVal.size()]); + } + + private String[] doInterfaceReplace(String output) + throws IOException, UnknownOpenOfficeOrgLanguageIDException, UnknownOpenOfficeOrgPropertyException { + if(output.indexOf("$!Import!") != -1) { // NOI18N + String[] usedTypes = getAllUsedTypes(ifc); // used types must be imported + Interface[] addIfcs = ifc.getAllAggregatedInterfaces(); + VectorimportLines = new Vector(); + // first imported interfaces + for (int i=0; i will be removed aome time later + importLines.add("\n#include "); // NOI18N + // rest are included interfaces + for(int i=0; i"); // NOI18N + importLines.add(oneOutputLine.toString()); + } + String[] lines = importLines.toArray(new String[importLines.size()]); + lines[lines.length - 1] = lines[lines.length - 1].concat("\n"); // NOI18N + return lines; + } + else if(output.indexOf("$!Import2!") != -1) { // NOI18N + String whitespace = output.substring(0, output.indexOf("$!Import2!")); // NOI18N + Interface[] addIfcs = ifc.getAllAggregatedInterfaces(); + String[] lines = new String[addIfcs.length]; + for(int i=0; i lines = new Vector(); + String whitespace = output.substring(0, output.indexOf("$!Enums!")); // NOI18N + String[] enumNames = this.enm.getAllSetObjectNames(); + for (int i=0; i lines = new Vector(); + String whitespace = output.substring(0, output.indexOf("$!Structs!")); // NOI18N + String[] structNames = this.str.getAllSetObjectNames(); + for (int i=0; i"); // NOI18N + } + wiz.putProperty("PolyStructNameTemplate", templateStructName.toString()); // NOI18N + } + else if (output.indexOf("$!Import!") != -1) { // NOI18N + String[] propNames = pstr.getAllSetObjectNames(); + VectorimportLines = new Vector(); + for (int i=0; i"); // NOI18N + oneOutputLine.append("\n#endif"); // NOI18N + outputLines[i] = oneOutputLine.toString(); + } + return outputLines; + } + else if (output.indexOf("$!Templates!") != -1) { // NOI18N + String whitespace = output.substring(0, output.indexOf("$!Templates!")); // NOI18N + String[] typeNames = pstr.getTemplateTypeNames(); + StringBuffer outputLines = new StringBuffer("\n"); // NOI18N + for (int i=0; i")); // NOI18N + String endif = "\n#endif\n"; // NOI18N + return new String[]{ifndef, imp, endif}; + } + return doSimpleReplace(output); + } + + private String[] doServiceReplace(String output) + throws IOException, UnknownOpenOfficeOrgPropertyException, UnknownOpenOfficeOrgLanguageIDException { + if (output.indexOf("$!Import!") != -1) { // NOI18N + String[] types = (String[])wiz.getProperty("Import"); // NOI18N + return getImportFromTypes(types); + } + else if(output.indexOf("$!Service!") != -1) { // NOI18N + wiz.putProperty("Service", srv.getSimpleProperty(srv.PROPERTY_CONTAINER_NAME)); // NOI18N + } + return doSimpleReplace(output); + } + + private String[] doAddOnReplace(String output) + throws IOException, UnknownOpenOfficeOrgLanguageIDException { + // first iteration step: either menu bar or tool bar may be missing (but not both!) + Vector retValue = null; + if (output.indexOf("$!OfficeMenuBar!") != -1) { // NOI18N + Boolean menu = (Boolean)wiz.getProperty("GotMenu"); // NOI18N + if (menu.booleanValue()) { + retValue = new Vector(); + String[] lines = (String[])wiz.getProperty("OfficeMenuBar"); // NOI18N + for (int i = 0; i < lines.length; i++) { + String[] ret = doAddOnReplaceInternal(lines[i]); + for (int j = 0; j < ret.length; j++) { + retValue.add(ret[j]); + } + } + } + else { + return new String[]{""}; // NOI18N + } + } + if (output.indexOf("$!OfficeToolBar!") != -1) { // NOI18N + Boolean toolbar = (Boolean)wiz.getProperty("GotToolbar"); // NOI18N + if (toolbar.booleanValue()) { + retValue = new Vector(); + String[] lines = (String[])wiz.getProperty("OfficeToolBar"); // NOI18N + for (int i = 0; i < lines.length; i++) { + String[] ret = doAddOnReplaceInternal(lines[i]); + for (int j = 0; j < ret.length; j++) { + retValue.add(ret[j]); + } + } + } + else { + return new String[]{""}; // NOI18N + } + } + if (retValue != null) { + return retValue.toArray(new String[retValue.size()]); + } + else { + return doAddOnReplaceInternal(output); + } + } + + private String[] doAddOnReplaceInternal(String output) + throws IOException, UnknownOpenOfficeOrgLanguageIDException { + if (output.indexOf("$!MenuTitle!") != -1) { // NOI18N + AddOn addOn = (AddOn)wiz.getProperty("AddOnMenu"); // NOI18N + LocalizedOpenOfficeOrgProperty nameProp = (LocalizedOpenOfficeOrgProperty) + addOn.getProperty(addOn.PROPERTY_DisplayName); + Integer[] indexes = nameProp.getUsedLanguageIndexes(); + String[] returnValues = new String[indexes.length]; + for (int j=0; j").concat( + localizedName).concat(""); // NOI18N + } + return returnValues; + } + else if (output.indexOf("$!ToolbarTitle!") != -1) { // NOI18N + AddOn addOn = (AddOn)wiz.getProperty("AddOnToolbar"); // NOI18N + LocalizedOpenOfficeOrgProperty nameProp = (LocalizedOpenOfficeOrgProperty) + addOn.getProperty(addOn.PROPERTY_DisplayName); + Integer[] indexes = nameProp.getUsedLanguageIndexes(); + String[] returnValues = new String[indexes.length]; + for (int j=0; j").concat( + localizedName).concat(""); // NOI18N + } + return returnValues; + } + else if (output.indexOf("$!ProtocolHandlerFunctionTemplate!") != -1) { // NOI18N + String protocol = " ".concat((String)wiz.getProperty( + "Protocol")).concat(":*"); // NOI18N + return new String[]{protocol}; + } + else if (output.indexOf("$!Images!") != -1) { // NOI18N + return getAddOnImages(); + } + else if (output.indexOf("$!AddonMenuFunctionTemplate!") != -1) { // NOI18N + // Addon.xcu special replace + return createAddonMenuXcu(); + } + else if (output.indexOf("$!AddonToolbarFunctionTemplate!") != -1) { // NOI18N + // Addon.xcu special replace + return createAddonToolbarXcu(); + } + return doSimpleReplace(output); + } + + private String[] createAddonMenuXcu() { + AddOn topElementMenu = (AddOn)wiz.getProperty("AddOnMenu"); // NOI18N + Vectorv = new Vector(); + createAddonMenuEntries(" ", (String)wiz.getProperty("Protocol"), topElementMenu, v); // NOI18N + return v.toArray(new String[v.size()]); + } + + private String[] createAddonToolbarXcu() { + AddOn topElementToolbar = (AddOn)wiz.getProperty("AddOnToolbar"); // NOI18N + AddOn subMeun = (AddOn)topElementToolbar.getAllMenus()[0]; + Vectorv = new Vector(); + createAddonToolbarEntries(" ", (String)wiz.getProperty("Protocol"), topElementToolbar, v); // NOI18N + return v.toArray(new String[v.size()]); + } + + private void createAddonMenuEntries(String whitespace, String namePrefix, AddOn subElement, Vector subMenu) { + subMenu.add(whitespace.concat("")); // NOI18N + String[] subObjectNamesInOrder = subElement.getAllSetObjectNames(); + for (int i=0; i")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" _self")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + PropertyContainer pCont = (PropertyContainer)object; + LocalizedOpenOfficeOrgProperty nameProp = (LocalizedOpenOfficeOrgProperty)pCont.getProperty(pCont.PROPERTY_DisplayName); + Integer[] indexes = nameProp.getUsedLanguageIndexes(); + for (int j=0; j").concat( + languageName).concat("")); // NOI18N + } + subMenu.add(whitespace.concat(" ")); // NOI18N + createAddonMenuEntries(whitespace.concat(" "), namePrefix, (SubMenuElement)object, subMenu); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + break; + case NbNodeObject.UI_SEPARATOR_TYPE: + handleSeparator(whitespace.concat(" "), namePrefix, (SeparatorElement)object, subMenu, true); // NOI18N + break; + case NbNodeObject.FUNCTION_TYPE: + handleCommandType(whitespace.concat(" "), namePrefix, (Command)object, subMenu, true); // NOI18N + break; + default: + // this is real bad + LogWriter.getLogWriter().log(LogWriter.LEVEL_CRITICAL, "Illegal NbNodeObject"); // NOI18N + } + } + subMenu.add(whitespace.concat("")); // NOI18N + } + + private void createAddonToolbarEntries(String whitespace, String namePrefix, AddOn subElement, Vector subMenu) { + String[] subObjectNamesInOrder = subElement.getAllSetObjectNames(); + for (int i=0; i subMenu, boolean menu) { + String menuName = "m" + (menu?++menuOrderNumber:++toolbarOrderNumber); // NOI18N + subMenu.add(whitespace.concat("")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" private:separator")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat("")); // NOI18N + } + + private void handleCommandType(String whitespace, String namePrefix, Command object, Vector subMenu, boolean menu) { + try { + String menuName = "m" + (menu?++menuOrderNumber:++toolbarOrderNumber); // NOI18N + PropertyContainer propCont = (PropertyContainer) object; + String name = propCont.getSimpleProperty(PropertyContainer.PROPERTY_CONTAINER_NAME); + Vector v = new Vector(); + for (int i=0; i")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ").concat(namePrefix).concat(":").concat(name).concat("")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" _self")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ").concat(context)); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat(" ")); // NOI18N + Integer[] indexes = nameProp.getUsedLanguageIndexes(); + for (int j=0; j").concat( // NOI18N + languageName).concat("")); // NOI18N + } + subMenu.add(whitespace.concat(" ")); // NOI18N + subMenu.add(whitespace.concat("")); // NOI18N + } catch (UnknownOpenOfficeOrgPropertyException ex) { + ex.printStackTrace(); + } + } + + private String[] getAddOnImages() { + AddOn topElement = (AddOn)wiz.getProperty("AddOn"); // NOI18N + String protocol = (String)wiz.getProperty("Protocol"); // NOI18N + String[][] commandAndImages = collectCommandsAndImages(topElement); + Vector retValue = new Vector(); + retValue.add(" "); // NOI18N + for (int i=0; i")); // NOI18N + retValue.add(" "); // NOI18N + retValue.add(" ".concat(protocol).concat(":").concat(commandAndImages[i][0]).concat("")); // NOI18N + retValue.add(" "); // NOI18N + retValue.add(" "); // NOI18N + retValue.add(" "); // NOI18N + retValue.add(" ".concat(commandAndImages[i][1])); // NOI18N + retValue.add(" "); // NOI18N + retValue.add(" "); // NOI18N + retValue.add(" ".concat(commandAndImages[i][2])); // NOI18N + retValue.add(" "); // NOI18N + retValue.add(" "); // NOI18N + retValue.add(" ".concat(commandAndImages[i][3])); // NOI18N + retValue.add(" "); // NOI18N + retValue.add(" "); // NOI18N + retValue.add(" ".concat(commandAndImages[i][4])); // NOI18N + retValue.add(" "); // NOI18N + retValue.add(" "); // NOI18N + retValue.add(" "); // NOI18N + } + retValue.add(" "); // NOI18N + return retValue.toArray(new String[retValue.size()]); + } + + private String[][] collectCommandsAndImages(AddOn topElement) { + NbNodeObject[] commands = topElement.getAllCommands(); + String[][]commandsAndImages = new String[commands.length][5]; + for (int i=0; i")) { // NOI18N + result = result.substring(0, result.length() - 1); + } + } + return result.trim(); + } + + private String[] doAddInReplace(String output) + throws IOException, UnknownOpenOfficeOrgLanguageIDException { + if (output.indexOf("$!Methods!") != -1) { // NOI18N + String whitespace = output.substring(0, output.indexOf("$!Methods!")); // NOI18N + String[] funcNames = this.addin.getAllSetObjectNames(); + String[] returnVal = new String[funcNames.length]; + for (int i=0; i > + * @param paramType the type + * @return a type with correct arrays: returns the same type if no arrays are found + */ + private String getArrays(String paramType) { + int index = 0; + while((index = paramType.lastIndexOf("[]")) != -1) { // NOI18N + paramType = paramType.substring(0, index).concat(paramType.substring(index + 2)); + paramType = "sequence< ".concat(paramType).concat(" >"); // NOI18N + } + return paramType; + } + + private String[] getAllUsedTypes(Interface ifc) + throws UnknownOpenOfficeOrgPropertyException, UnknownOpenOfficeOrgLanguageIDException{ + Vector usedTypes = new Vector(); + String[] funcNames = this.ifc.getAllSetObjectNames(); + for (int i=0; i\n") + .concat("#endif\n"); // NOI18N + } + return types; + } + + private String getExceptionImports(NbNodeObject object) + throws UnknownOpenOfficeOrgLanguageIDException { + Vector result = new Vector(); + if (object == null) + return ""; // NOI18N + if (object instanceof AddIn) { + String[] funcNames = ((AddIn)object).getAllSetObjectNames(); + for (int i=0; i en = result.elements(); en.hasMoreElements(); retValue.append(en.nextElement())){ + // empty by design + } + return retValue.toString(); + } + + private String[] getExceptionsFromFunction(Function function) + throws UnknownOpenOfficeOrgLanguageIDException { + VectorfunctionExceptions = new Vector(); + StringTokenizer t = null; + String exceptions = function.getProperty(function.PROPERTY_Exceptions).getValueForLanguage(-1); + t = new StringTokenizer(exceptions, " ,"); // NOI18N + + while(t.hasMoreTokens()) { + String oneException = t.nextToken(); + String ifndef = "\n#ifndef __".concat(oneException.replace('.', '_')).concat("_idl__"); // NOI18N + String imp = "\n#import <".concat(oneException.replace(".", "/").concat(".idl>")); // NOI18N + String endif = "\n#endif\n"; // NOI18N + functionExceptions.add(ifndef.concat(imp).concat(endif)); + } + return functionExceptions.toArray(new String[functionExceptions.size()]); + } + + private String[] getTemplateImportsFromType(String type) { + VectoradditionalImports = new Vector(); + type = type.trim(); + int index = 0; + while ((index = type.indexOf('<')) != -1) { + String oneStruct = type.substring(0, index); + checkForComplexTemplates(oneStruct, additionalImports); + int lastIndex = type.lastIndexOf('>'); + type = type.substring(index + 1, lastIndex); + } + checkForComplexTemplates(type, additionalImports); + return additionalImports.toArray(new String[additionalImports.size()]); + } + + + private void checkForComplexTemplates(String candidate, Vector additionalImports) { + if (candidate.trim().indexOf(',') != -1) { + StringTokenizer t = new StringTokenizer(candidate, ","); // NOI18N + while(t.hasMoreTokens()) { + candidate = t.nextToken(); + if (candidate.trim().indexOf('.') != -1) + additionalImports.add(candidate.trim()); + } + } + else { + if (candidate.trim().indexOf('.') != -1) + additionalImports.add(candidate.trim()); + } + } + + /** + * function is only used for AddOns. When using with other wizards, check + * correct %origin%/../../../../../images/ directory + * @param prop the icon property to create xcu entries from + * @return entry complete as string or empty entry for missing icons + */ + private String getIconEntry(OpenOfficeOrgProperty prop) { + String retValue = EMPTY_VALUE; + try { + OpenOfficeOrgIconProperty iconProp = (OpenOfficeOrgIconProperty)prop; + String imgPath = iconProp.getValueForLanguage(-1); + if (imgPath != null && imgPath.length() != 0) { + File imgFile = new File(imgPath); + FileObject sourceImage = FileUtil.toFileObject(imgFile); + String name = imgFile.getName(); + // prepare for images + File projDir = (File) wiz.getProperty("projdir"); // NOI18N + FileObject imageFolder = FileUtil.createFolder( + FileUtil.toFileObject(projDir), "images"); // NOI18N + // copy images + int index = name.indexOf('.'); + if (index < 0) index = name.length(); + FileUtil.copyFile(sourceImage, imageFolder, name.substring(0, index)); + retValue = "%origin%/../../../../../images/".concat(name).concat(""); // NOI18N + } + } catch (IOException ex) { + LogWriter.getLogWriter().printStackTrace(ex); + } + catch (NullPointerException ex) { + LogWriter.getLogWriter().printStackTrace(ex); + } + catch (IllegalArgumentException ex) { + LogWriter.getLogWriter().printStackTrace(ex); + } catch (UnknownOpenOfficeOrgLanguageIDException ex) { + LogWriter.getLogWriter().printStackTrace(ex); + } + return retValue; + } +} Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle.properties URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle.properties?rev=1236486&view=auto ============================================================================== --- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle.properties (added) +++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle.properties Fri Jan 27 01:29:33 2012 @@ -0,0 +1,10 @@ +# Log Levels +LOG_Level_info=Info +LOG_Level_warning=Warning +LOG_Level_critical=Critical +LOG_Level_exception=Exception + +ERROR_WrongSDK=The OpenOffice.org SDK that is used is too old. Please update to the newest version. +ERROR_CommandExecute=While executing an SDK Command, the following error happened: +ERROR_SDKEnvironment=An environment for executing the SDK Commands cannot be created. +ERROR_Platform=The current Operating System seems to be unsupported. \ No newline at end of file Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle_ja.properties URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle_ja.properties?rev=1236486&view=auto ============================================================================== --- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle_ja.properties (added) +++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle_ja.properties Fri Jan 27 01:29:33 2012 @@ -0,0 +1,21 @@ +# Log Levels +# LOG_Level_info=Info +LOG_Level_info=\u60c5\u5831 +# LOG_Level_warning=Warning +LOG_Level_warning=\u8b66\u544a +# LOG_Level_critical=Critical +LOG_Level_critical=\u30af\u30ea\u30c6\u30a3\u30ab\u30eb +# LOG_Level_exception=Exception +LOG_Level_exception=\u4f8b\u5916 + +# ERROR_WrongSDK=The OpenOffice.org SDK that is used is too old. Please update to the newest version. +ERROR_WrongSDK=\u4f7f\u7528\u3057\u3066\u3044\u308b OpenOffice.org SDK \u304c\u53e4\u3059\u304e\u307e\u3059\u3002\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +# ERROR_CommandExecute=While executing an SDK Command, the following error happened: +ERROR_CommandExecute=SDK \u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\u6642\u306b\u3001\u6b21\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: +# ERROR_SDKEnvironment=An environment for executing the SDK Commands cannot be created. +ERROR_SDKEnvironment=SDK \u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u74b0\u5883\u304c\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 +# ERROR_Platform=The current Operating System seems to be unsupported. +ERROR_Platform=\u73fe\u5728\u306e\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 + + + Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle_pt_BR.properties URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle_pt_BR.properties?rev=1236486&view=auto ============================================================================== --- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle_pt_BR.properties (added) +++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle_pt_BR.properties Fri Jan 27 01:29:33 2012 @@ -0,0 +1,10 @@ +# Log Levels +LOG_Level_info=Info +LOG_Level_warning=Warning +LOG_Level_critical=Critical +LOG_Level_exception=Exception + +ERROR_WrongSDK=The OpenOffice.org SDK that is used is too old. Please update to the newest version. +ERROR_CommandExecute=While executing an SDK Command, the following error happened: +ERROR_SDKEnvironment=An environment for executing the SDK Commands cannot be created. +ERROR_Platform=The current Operating System seems to be unsupported. \ No newline at end of file Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle_zh_CN.properties URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle_zh_CN.properties?rev=1236486&view=auto ============================================================================== --- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle_zh_CN.properties (added) +++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/util/Bundle_zh_CN.properties Fri Jan 27 01:29:33 2012 @@ -0,0 +1,10 @@ +# Log Levels +LOG_Level_info=\u4fe1\u606f +LOG_Level_warning=\u8b66\u544a +LOG_Level_critical=\u4e25\u91cd\u8b66\u544a +LOG_Level_exception=\u5f02\u5e38 + +ERROR_WrongSDK=\u4f7f\u7528\u7684 OpenOffice.org SDK \u7248\u672c\u592a\u65e7\u3002\u8bf7\u66f4\u65b0\u4e3a\u6700\u65b0\u7248\u672c\u3002 +ERROR_CommandExecute=\u5728\u6267\u884c SDK \u547d\u4ee4\u65f6\uff0c\u51fa\u73b0\u4ee5\u4e0b\u9519\u8bef\uff1a +ERROR_SDKEnvironment=\u65e0\u6cd5\u521b\u5efa\u4e00\u4e2a\u6267\u884c SDK \u547d\u4ee4\u7684\u73af\u5883\u3002 +ERROR_Platform=\u4f3c\u4e4e\u4e0d\u652f\u6301\u5f53\u524d\u7684\u64cd\u4f5c\u7cfb\u7edf\u3002