ide code migration
diff --git a/src/main/cpp/ide/.dep.inc b/src/main/cpp/ide/.dep.inc
new file mode 100644
index 0000000..08c0aeb
--- /dev/null
+++ b/src/main/cpp/ide/.dep.inc
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/src/main/cpp/ide/Makefile b/src/main/cpp/ide/Makefile
new file mode 100644
index 0000000..ff8bc92
--- /dev/null
+++ b/src/main/cpp/ide/Makefile
@@ -0,0 +1,106 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Main targets can be executed directly, and they are:
+#
+# build build a specific configuration
+# clean remove built files from a configuration
+# clobber remove all built files
+# all build all configurations
+# help print help mesage
+#
+# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+# .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+# NOCDDL
+
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+
+# build
+build: .build-post-$(CONF)
+
+.build-pre: .build-pre-$(CONF)
+# Add your pre 'build' code here...
+
+.build-pre-netbeans.exe: netbeans.rc
+ windres -DMANIFEST_FILE="netbeans.exe.manifest" -onetbeans.res -Ocoff netbeans.rc
+
+.build-pre-netbeans64.exe: netbeans.rc
+ x86_64-w64-mingw32-windres.exe -DMANIFEST_FILE="netbeans64.exe.manifest" -onetbeans64.res -Ocoff netbeans.rc
+
+.build-post-netbeans.exe: .build-impl
+ cp netbeans.exe ../../../nbbuild/netbeans/bin/netbeans.exe
+
+.build-post-netbeans64.exe: .build-impl
+ cp netbeans64.exe ../../../nbbuild/netbeans/bin/netbeans64.exe
+
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
diff --git a/src/main/cpp/ide/Makefile.mingw b/src/main/cpp/ide/Makefile.mingw
new file mode 100644
index 0000000..791d71b
--- /dev/null
+++ b/src/main/cpp/ide/Makefile.mingw
@@ -0,0 +1,33 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+all: netbeans64.exe netbeans.exe
+
+clean:
+ rm -f *.res *.exe
+
+netbeans64.res: netbeans.rc netbeans64.exe.manifest
+ x86_64-w64-mingw32-windres -onetbeans64.res -Ocoff -DMANIFEST_FILE=netbeans64.exe.manifest netbeans.rc
+
+netbeans64.exe: netbeans.cpp nblauncher.cpp netbeans64.res ../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.cpp
+ x86_64-w64-mingw32-gcc -s -DNBEXEC_DLL='"/lib/nbexec64.dll"' -DARCHITECTURE=64 -Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-seh -mwindows netbeans.cpp nblauncher.cpp netbeans64.res ../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.cpp -I ../../../platform/o.n.bootstrap/launcher/windows/ -onetbeans64.exe -static -lstdc++ -static-libstdc++ -static-libgcc
+
+netbeans.res: netbeans.rc netbeans.exe.manifest
+ i686-w64-mingw32-windres -onetbeans.res -Ocoff -DMANIFEST_FILE=netbeans.exe.manifest netbeans.rc
+
+netbeans.exe: netbeans.cpp nblauncher.cpp netbeans.res ../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.cpp
+ i686-w64-mingw32-gcc -s -DNBEXEC_DLL='"/lib/nbexec.dll"' -DARCHITECTURE=32 -Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-seh -mwindows netbeans.cpp nblauncher.cpp netbeans.res ../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.cpp -I ../../../platform/o.n.bootstrap/launcher/windows/ -onetbeans.exe -static -lstdc++ -static-libstdc++ -static-libgcc
diff --git a/src/main/cpp/ide/cmdargs.h b/src/main/cpp/ide/cmdargs.h
new file mode 100644
index 0000000..acf56a4
--- /dev/null
+++ b/src/main/cpp/ide/cmdargs.h
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ /*
+ * Author: Tomas Holy
+ */
+
+#ifndef _CMDARGS_H
+#define _CMDARGS_H
+
+class CmdArgs {
+public:
+
+ CmdArgs(int _count) {
+ used = 0;
+ size = _count;
+ args = new char*[size];
+ memset(args, 0, size * sizeof (char*));
+ }
+
+ ~CmdArgs() {
+ if (args) {
+ for (int i = 0; i < size; i++) {
+ delete[] args[i];
+ }
+ delete[] args;
+ }
+ }
+
+ void add(const char *arg) {
+ if (used + 1 > size) {
+ int newSize = size + size / 2 + 1;
+ char **newArgs = new char*[newSize];
+ memcpy(newArgs, args, size * sizeof (char*));
+ memset(newArgs + size, 0, (newSize - size) * sizeof (char*));
+ delete[] args;
+ args = newArgs;
+ size = newSize;
+ }
+ args[used] = new char[strlen(arg) + 1];
+ strcpy(args[used++], arg);
+ }
+
+ void addCmdLine(const char *cmdLine) {
+ char arg[1024] = "";
+ bool inQuotes = false;
+ bool inText = false;
+ int i = 0;
+ int j = 0;
+ char c;
+ while (c = cmdLine[i]) {
+ if (inQuotes) {
+ if (c == '\"') {
+ inQuotes = false;
+ } else {
+ arg[j++] = c;
+ }
+ } else {
+ switch (c) {
+ case '\"':
+ inQuotes = true;
+ inText = true;
+ break;
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r':
+ if (inText) {
+ arg[j] = '\0';
+ add(arg);
+ j = 0;
+ }
+ inText = false;
+ break;
+ default:
+ inText = true;
+ arg[j++] = c;
+ break;
+ }
+ }
+ i++;
+ }
+ if (j > 0) {
+ arg[j] = '\0';
+ add(arg);
+ }
+ }
+
+ int getCount() {
+ return used;
+ }
+
+ char **getArgs() {
+ return args;
+ }
+
+private:
+ int used;
+ int size;
+ char **args;
+};
+
+#endif /* _CMDARGS_H */
+
diff --git a/src/main/cpp/ide/nblauncher.cpp b/src/main/cpp/ide/nblauncher.cpp
new file mode 100644
index 0000000..dda65af
--- /dev/null
+++ b/src/main/cpp/ide/nblauncher.cpp
@@ -0,0 +1,532 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ /*
+ * Author: Tomas Holy
+ */
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x05010100
+#endif
+
+#include <shlobj.h>
+#include "nblauncher.h"
+#include "../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.h"
+#include "../../../platform/o.n.bootstrap/launcher/windows/argnames.h"
+#include "../../../platform/o.n.bootstrap/launcher/windows/nbexecloader.h"
+
+using namespace std;
+
+const char *NbLauncher::NBEXEC_FILE_PATH = NBEXEC_DLL;
+const char *NbLauncher::OPT_NB_DEFAULT_USER_DIR = "netbeans_default_userdir=";
+const char *NbLauncher::OPT_NB_DEFAULT_CACHE_DIR = "netbeans_default_cachedir=";
+const char *NbLauncher::OPT_NB_DEFAULT_OPTIONS = "netbeans_default_options=";
+const char *NbLauncher::OPT_NB_EXTRA_CLUSTERS = "netbeans_extraclusters=";
+const char *NbLauncher::OPT_NB_JDK_HOME = "netbeans_jdkhome=";
+const char *NbLauncher::ENV_USER_PROFILE = "USERPROFILE";
+const char *NbLauncher::HOME_TOKEN = "${HOME}";
+const char *NbLauncher::DEFAULT_USERDIR_ROOT_TOKEN = "${DEFAULT_USERDIR_ROOT}";
+const char *NbLauncher::DEFAULT_CACHEDIR_ROOT_TOKEN = "${DEFAULT_CACHEDIR_ROOT}";
+const char *NbLauncher::NETBEANS_DIRECTORY = "\\NetBeans\\";
+const char *NbLauncher::NETBEANS_CACHES_DIRECTORY = "\\NetBeans\\Cache\\";
+
+const char *NbLauncher::CON_ATTACH_MSG =
+"\n\nThe launcher has determined that the parent process has a console and will reuse it for its own console output.\n"
+"Closing the console will result in termination of the running program.\n"
+"Use '--console suppress' to suppress console output.\n"
+"Use '--console new' to create a separate console window.\n";
+
+const char *NbLauncher::staticOptions[] = {
+ "-J-Dnetbeans.importclass=org.netbeans.upgrade.AutoUpgrade",
+ "--branding",
+ "nb"
+};
+
+NbLauncher::NbLauncher() {
+}
+
+NbLauncher::NbLauncher(const NbLauncher& orig) {
+}
+
+NbLauncher::~NbLauncher() {
+}
+
+int NbLauncher::start(char *cmdLine) {
+ CmdArgs args(50);
+ args.addCmdLine(cmdLine);
+ return start(args.getCount(), args.getArgs());
+}
+
+int NbLauncher::start(int argc, char *argv[]) {
+ SetErrorMode(SetErrorMode(0) | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
+
+ DWORD parentProcID = 0;
+ if (!checkLoggingArg(argc, argv, true) || !setupProcess(argc, argv, parentProcID, CON_ATTACH_MSG) || !initBaseNames() || !readClusterFile()) {
+ return -1;
+ }
+
+ parseConfigFile((baseDir + "\\etc\\" + getAppName() + ".conf").c_str());
+
+ if (!parseArgs(argc, argv)) {
+ return -1;
+ }
+ string oldUserDir = userDir;
+ parseConfigFile((userDir + "\\etc\\" + getAppName() + ".conf").c_str());
+ userDir = oldUserDir;
+
+ addExtraClusters();
+ string nbexecPath;
+ SetDllDirectory(baseDir.c_str());
+ if (dirExists(platformDir.c_str())) {
+ nbexecPath = platformDir;
+ } else {
+ nbexecPath = baseDir + '\\' + platformDir;
+ }
+ if (!dirExists(nbexecPath.c_str())) {
+ logErr(false, true, "Could not find platform cluster:\n%s", nbexecPath.c_str());
+ return false;
+ }
+
+ CmdArgs newArgs(argc + 20);
+ addSpecificOptions(newArgs);
+
+ if (!clusters.empty()) {
+ newArgs.add(ARG_NAME_CLUSTERS);
+ newArgs.add(clusters.c_str());
+ }
+ if (!userDir.empty()) {
+ newArgs.add(ARG_NAME_USER_DIR);
+ newArgs.add(userDir.c_str());
+ }
+ if (!defUserDirRoot.empty()) {
+ newArgs.add(ARG_DEFAULT_USER_DIR_ROOT);
+ newArgs.add(defUserDirRoot.c_str());
+ }
+ if (!cacheDir.empty() && !customUserDirFound) {
+ newArgs.add(ARG_NAME_CACHE_DIR);
+ newArgs.add(cacheDir.c_str());
+ }
+ if (!nbOptions.empty()) {
+ newArgs.addCmdLine(nbOptions.c_str());
+ }
+ for (int i = 0; i < argc; i++) {
+ newArgs.add(argv[i]);
+ }
+ if (!jdkHome.empty()) {
+ newArgs.add(ARG_NAME_JDKHOME);
+ newArgs.add(jdkHome.c_str());
+ }
+ if (parentProcID) {
+ newArgs.add(ARG_NAME_LA_PPID);
+ char tmp[16] = "";
+ newArgs.add(itoa(parentProcID, tmp, 10));
+ }
+ nbexecPath += NBEXEC_FILE_PATH;
+
+ const char *curDir = getCurrentDir();
+ if (curDir) {
+ char olddir[MAX_PATH];
+ DWORD rc = GetCurrentDirectory(MAX_PATH, olddir);
+ if (rc == 0) {
+ logErr(true, false, "Failed to get current directory");
+ } else {
+ string od = string(olddir);
+ od.insert(0, "-J-Dnetbeans.user.dir=");
+ newArgs.add(od.c_str());
+ }
+ logMsg("Changing current directory to: \"%s\"", curDir);
+ SetCurrentDirectory(curDir);
+ }
+
+ NBExecLoader loader;
+ return loader.start(nbexecPath.c_str(), newArgs.getCount(), newArgs.getArgs());
+}
+
+bool NbLauncher::initBaseNames() {
+ char path[MAX_PATH] = "";
+ getCurrentModulePath(path, MAX_PATH);
+ logMsg("Executable: %s", path);
+ char *bslash = strrchr(path, '\\');
+ if (!bslash) {
+ return false;
+ }
+ appName = bslash + 1;
+ appName.erase(appName.rfind('.'));
+
+ if (ARCHITECTURE == 64) {
+ appName = appName.erase(appName.length() - 2);
+ }
+
+ logMsg("Application name: %s", appName.c_str());
+
+ *bslash = '\0';
+ bslash = strrchr(path, '\\');
+ if (!bslash) {
+ return false;
+ }
+ *bslash = '\0';
+
+ baseDir = path;
+
+ //check baseDir for non-ASCII chars
+ for (size_t i = 0; i < baseDir.size(); ++i) {
+ if (!(baseDir[i]>=' ' && baseDir[i]<='~')) {
+ logErr(false, true, "Cannot be run from folder that contains non-ASCII characters in path.");
+ return false;
+ }
+ }
+
+ logMsg("Base dir: %s", baseDir.c_str());
+ return true;
+}
+
+void NbLauncher::addCluster(const char *cluster) {
+
+ class SetCurDir {
+ public:
+ SetCurDir(const char *dir) {
+ oldCurDir[0] = '\0';
+ DWORD rc = GetCurrentDirectory(MAX_PATH, oldCurDir);
+ if (rc == 0) {
+ logErr(true, false, "Failed to get current directory");
+ return;
+ }
+ if (rc > MAX_PATH) {
+ logMsg("Failed to get current directory, buffer is too small.");
+ return;
+ }
+ if (!SetCurrentDirectory(dir)) {
+ logErr(true, true, "Failed to set current directory to \"%s\"", dir);
+ oldCurDir[0] = '\0';
+ }
+ }
+
+ ~SetCurDir() {
+ if (oldCurDir[0]) {
+ if (!SetCurrentDirectory(oldCurDir)) {
+ logErr(true, true, "Failed to set current directory to \"%s\"", oldCurDir);
+ }
+ }
+ }
+ private:
+ char oldCurDir[MAX_PATH];
+ };
+
+ logMsg("addCluster: %s", cluster);
+ SetCurDir setCurDir(baseDir.c_str());
+ char clusterPath[MAX_PATH + 1] = {0};
+ strncpy(clusterPath, cluster, MAX_PATH);
+ if (!normalizePath(clusterPath, MAX_PATH)) {
+ logMsg("Invalid cluster path: %s", cluster);
+ return;
+ }
+ if (!clusters.empty()) {
+ clusters += ';';
+ }
+ logMsg("Adding cluster %s", clusterPath);
+ clusters += clusterPath;
+}
+
+void NbLauncher::addExtraClusters() {
+ logMsg("addExtraClusters()");
+ const char delim = ';';
+ string::size_type start = extraClusters.find_first_not_of(delim, 0);
+ string::size_type end = extraClusters.find_first_of(delim, start);
+ while (string::npos != end || string::npos != start) {
+ string cluster = extraClusters.substr(start, end - start);
+ addCluster(cluster.c_str());
+ start = extraClusters.find_first_not_of(delim, end);
+ end = extraClusters.find_first_of(delim, start);
+ }
+}
+
+bool NbLauncher::readClusterFile() {
+ clusters = "";
+ string clusterFile = baseDir + "\\etc\\" + getAppName() + ".clusters";
+ logMsg("readClusterFile() file: %s", clusterFile.c_str());
+
+ FILE* file = fopen(clusterFile.c_str(), "r");
+ if (!file) {
+ logErr(true, true, "Cannot open file \"%s\" for reading.", clusterFile.c_str());
+ return false;
+ }
+
+ char line[4096] = "";
+ while (fgets(line, sizeof(line), file)) {
+ char *str = skipWhitespaces(line);
+ if (*str == '#' || *str == '\0') {
+ continue;
+ }
+ char *pc = str;
+ while (*pc != '\0' && *pc != '\t' && *pc != '\n' && *pc != '\r') {
+ pc++;
+ }
+ *pc = '\0';
+
+ if (platformDir.empty()) {
+ char *slash = strrchr(str, '\\');
+ if (!slash) {
+ slash = strrchr(str, '/');
+ }
+ char *dir = slash ? slash + 1 : str;
+ if (strncmp(dir, "platform", strlen("platform")) == 0) {
+ platformDir = str;
+ } else {
+ addCluster(str);
+ }
+ } else {
+ addCluster(str);
+ }
+ }
+ bool ok = ferror(file) == 0;
+ if (!ok) {
+ logErr(true, true, "Error while reading file \"%s\".", clusterFile.c_str());
+ }
+ fclose(file);
+ return ok;
+}
+
+bool NbLauncher::parseArgs(int argc, char *argv[]) {
+#define CHECK_ARG \
+ if (i+1 == argc) {\
+ logErr(false, true, "Argument is missing for \"%s\" option.", argv[i]);\
+ return false;\
+ }
+
+ logMsg("parseArgs():");
+ for (int i = 0; i < argc; i++) {
+ logMsg("\t%s", argv[i]);
+ }
+ customUserDirFound = 0;
+ for (int i = 0; i < argc; i++) {
+ if (strcmp(ARG_NAME_USER_DIR, argv[i]) == 0) {
+ CHECK_ARG;
+ char tmp[MAX_PATH + 1] = {0};
+ strncpy(tmp, argv[++i], MAX_PATH);
+ if (!normalizePath(tmp, MAX_PATH)) {
+ logErr(false, true, "User directory path \"%s\" is not valid.", argv[i]);
+ return false;
+ }
+ customUserDirFound = 1;
+ userDir = tmp;
+ logMsg("User dir: %s", userDir.c_str());
+ }
+ if (strcmp(ARG_NAME_CACHE_DIR, argv[i]) == 0) {
+ CHECK_ARG;
+ char tmp[MAX_PATH + 1] = {0};
+ strncpy(tmp, argv[++i], MAX_PATH);
+ if (!normalizePath(tmp, MAX_PATH)) {
+ logErr(false, true, "Cache directory path \"%s\" is not valid.", argv[i]);
+ return false;
+ }
+ cacheDir = tmp;
+ logMsg("Cache dir: %s", cacheDir.c_str());
+ }
+ }
+ logMsg("parseArgs() finished");
+ return true;
+}
+
+bool NbLauncher::findUserDir(const char *str) {
+ logMsg("NbLauncher::findUserDir()");
+ if (strncmp(str, HOME_TOKEN, strlen(HOME_TOKEN)) == 0) {
+ if (userHome.empty()) {
+ char *userProfile = getenv(ENV_USER_PROFILE);
+ if (userProfile) {
+ userHome = userProfile;
+ } else {
+ TCHAR userHomeChar[MAX_PATH];
+ if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, userHomeChar))) {
+ return false;
+ }
+ userHome = userHomeChar;
+ userHome.erase(userHome.rfind('\\'));
+ }
+ logMsg("User home: %s", userHome.c_str());
+ }
+ userDir = userHome + (str + strlen(HOME_TOKEN));
+ } else if (strncmp(str, DEFAULT_USERDIR_ROOT_TOKEN, strlen(DEFAULT_USERDIR_ROOT_TOKEN)) == 0) {
+ std::string s = std::string("Replacing ") + DEFAULT_USERDIR_ROOT_TOKEN;
+ logMsg(s.c_str());
+ userDir = getDefaultUserDirRoot() + (str + strlen(DEFAULT_USERDIR_ROOT_TOKEN));
+ } else {
+ getDefaultUserDirRoot();
+ userDir = str;
+ }
+ return true;
+}
+
+bool NbLauncher::findCacheDir(const char *str) {
+ logMsg("NbLauncher::findCacheDir()");
+ if (strncmp(str, HOME_TOKEN, strlen(HOME_TOKEN)) == 0) {
+ if (userHome.empty()) {
+ char *userProfile = getenv(ENV_USER_PROFILE);
+ if (userProfile) {
+ userHome = userProfile;
+ } else {
+ TCHAR userHomeChar[MAX_PATH];
+ if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, userHomeChar))) {
+ return false;
+ }
+ userHome = userHomeChar;
+ userHome.erase(userHome.rfind('\\'));
+ }
+ logMsg("User home: %s", userHome.c_str());
+ }
+ cacheDir = userHome + (str + strlen(HOME_TOKEN));
+ } else if (strncmp(str, DEFAULT_CACHEDIR_ROOT_TOKEN, strlen(DEFAULT_CACHEDIR_ROOT_TOKEN)) == 0) {
+ std::string s = std::string("Replacing ") + DEFAULT_CACHEDIR_ROOT_TOKEN;
+ logMsg(s.c_str());
+ cacheDir = getDefaultCacheDirRoot() + (str + strlen(DEFAULT_CACHEDIR_ROOT_TOKEN));
+ } else {
+ getDefaultCacheDirRoot();
+ cacheDir = str;
+ }
+ return true;
+}
+
+string NbLauncher::getDefaultUserDirRoot() {
+ TCHAR defUserDirRootChar[MAX_PATH];
+ if (FAILED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, defUserDirRootChar))) {
+ return std::string();
+ }
+ defUserDirRoot = constructApplicationDir((string) defUserDirRootChar, false);
+ defUserDirRoot.erase(defUserDirRoot.rfind('\\'));
+ logMsg("Default Userdir Root: %s", defUserDirRoot.c_str());
+ return defUserDirRoot;
+}
+
+string NbLauncher::getDefaultCacheDirRoot() {
+ TCHAR defCacheDirRootChar[MAX_PATH];
+ if (FAILED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, defCacheDirRootChar))) {
+ return std::string();
+ }
+ defCacheDirRoot = constructApplicationDir((string) defCacheDirRootChar, true);
+ defCacheDirRoot.erase(defCacheDirRoot.rfind('\\'));
+ logMsg("Default Cachedir Root: %s", defCacheDirRoot.c_str());
+ return defCacheDirRoot;
+}
+
+bool NbLauncher::getOption(char *&str, const char *opt) {
+ if (strncmp(str, opt, strlen(opt)) == 0) {
+ str += strlen(opt);
+ char *end = trimWhitespaces(str);
+ if (*str == '"') {
+ str++;
+ }
+ if (end >= str && *end == '"') {
+ *end = '\0';
+ }
+ logMsg("Option found: %s%s", opt, str);
+ return true;
+ }
+ return false;
+}
+
+bool NbLauncher::parseConfigFile(const char* path) {
+ logMsg("parseConfigFile(%s)", path);
+ FILE *file = fopen(path, "r");
+ if (!file) {
+ logErr(true, false, "Cannot open file \"%s\" for reading.", path);
+ return false;
+ }
+
+ char line[4096] = "";
+ while (fgets(line, sizeof(line), file)) {
+ char *str = skipWhitespaces(line);
+ if (*str == '#') {
+ continue;
+ }
+ if (getOption(str, getDefUserDirOptName())) {
+ findUserDir(str);
+ logMsg("User dir: %s", userDir.c_str());
+ } else if (getOption(str, getDefCacheDirOptName())) {
+ findCacheDir(str);
+ logMsg("Cache dir: %s", cacheDir.c_str());
+ } else if (getOption(str, getDefOptionsOptName())) {
+ // replace \" by "
+ int len = strlen(str);
+ int k = 0;
+ for (int i = 0; i < len; i++) {
+ if (str[i] == '\\' && str[i+1] == '\"') {
+ continue;
+ }
+ str[k++] = str[i];
+ }
+ str[k] = '\0';
+ nbOptions = str;
+ logMsg("After replacement: %s", nbOptions.c_str());
+
+ } else if (getOption(str, getExtraClustersOptName())) {
+ extraClusters = str;
+ } else if (getOption(str, getJdkHomeOptName())) {
+ jdkHome = str;
+ }
+ }
+ bool ok = ferror(file) == 0;
+ if (!ok) {
+ logErr(true, false, "Error while reading file \"%s\".", path);
+ }
+ fclose(file);
+ return true;
+}
+
+typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
+
+const char * NbLauncher::getAppName() {
+ return "netbeans";
+}
+
+void NbLauncher::addSpecificOptions(CmdArgs &args) {
+ for (unsigned i = 0; i < sizeof (staticOptions) / sizeof (char*); i++) {
+ args.add(staticOptions[i]);
+ }
+}
+
+const char * NbLauncher::getDefUserDirOptName() {
+ return OPT_NB_DEFAULT_USER_DIR;
+}
+
+const char * NbLauncher::getDefCacheDirOptName() {
+ return OPT_NB_DEFAULT_CACHE_DIR;
+}
+
+
+const char * NbLauncher::getDefOptionsOptName() {
+ return OPT_NB_DEFAULT_OPTIONS;
+}
+
+const char * NbLauncher::getExtraClustersOptName() {
+ return OPT_NB_EXTRA_CLUSTERS;
+}
+
+const char * NbLauncher::getJdkHomeOptName() {
+ return OPT_NB_JDK_HOME;
+}
+
+const char * NbLauncher::getCurrentDir() {
+ return 0;
+}
+
+std::string NbLauncher::constructApplicationDir(const std::string& dir, bool cache) {
+ if (cache) {
+ return dir + NETBEANS_CACHES_DIRECTORY;
+ } else {
+ return dir + NETBEANS_DIRECTORY;
+ }
+}
diff --git a/src/main/cpp/ide/nblauncher.h b/src/main/cpp/ide/nblauncher.h
new file mode 100644
index 0000000..469a21f
--- /dev/null
+++ b/src/main/cpp/ide/nblauncher.h
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ /*
+ * Author: Tomas Holy
+ */
+
+#ifndef _NBLAUNCHER_H
+#define _NBLAUNCHER_H
+
+#include <string>
+#include <windows.h>
+#include <cstddef>
+#include "cmdargs.h"
+
+class NbLauncher {
+protected:
+ static const char *NBEXEC_FILE_PATH;
+ static const char *OPT_NB_DEFAULT_USER_DIR;
+ static const char *OPT_NB_DEFAULT_CACHE_DIR;
+ static const char *OPT_NB_DEFAULT_OPTIONS;
+ static const char *OPT_NB_EXTRA_CLUSTERS;
+ static const char *OPT_NB_JDK_HOME;
+ static const char *REG_SHELL_FOLDERS_KEY;
+ static const char *HOME_TOKEN;
+ static const char *DEFAULT_USERDIR_ROOT_TOKEN;
+ static const char *DEFAULT_CACHEDIR_ROOT_TOKEN;
+ static const char *CON_ATTACH_MSG;
+ static const char *NETBEANS_DIRECTORY;
+ static const char *NETBEANS_CACHES_DIRECTORY;
+
+private:
+ static const char *ENV_USER_PROFILE;
+ static const char *REG_DESKTOP_NAME;
+ static const char *REG_DEFAULT_USERDIR_ROOT;
+ static const char *REG_DEFAULT_CACHEDIR_ROOT;
+ static const char* staticOptions[];
+
+ typedef int (*StartPlatform)(int argc, char *argv[]);
+
+public:
+ NbLauncher();
+ virtual ~NbLauncher();
+
+ int start(int argc, char *argv[]);
+ int start(char *cmdLine);
+
+protected:
+ virtual bool initBaseNames();
+ virtual void addSpecificOptions(CmdArgs &args);
+ virtual bool findUserDir(const char *str);
+ virtual bool findCacheDir(const char *str);
+ virtual const char * getAppName();
+ virtual const char * getDefUserDirOptName();
+ virtual const char * getDefCacheDirOptName();
+ virtual const char * getDefOptionsOptName();
+ virtual const char * getExtraClustersOptName();
+ virtual const char * getJdkHomeOptName();
+ virtual const char * getCurrentDir();
+ virtual std::string constructApplicationDir(const std::string& dir, bool cache);
+
+private:
+ NbLauncher(const NbLauncher& orig);
+ bool readClusterFile();
+ bool parseArgs(int argc, char *argv[]);
+ bool parseConfigFile(const char* path);
+ bool getOption(char *&str, const char *opt);
+ void addCluster(const char *cl);
+ void addExtraClusters();
+ std::string getDefaultUserDirRoot();
+ std::string getDefaultCacheDirRoot();
+
+protected:
+ std::string baseDir;
+ std::string appName;
+ std::string platformDir;
+ std::string userHome;
+ std::string userDir;
+ std::string cacheDir;
+ std::string defUserDirRoot;
+ std::string defCacheDirRoot;
+ std::string clusters;
+ std::string extraClusters;
+ std::string nbOptions;
+ std::string jdkHome;
+
+private:
+ bool customUserDirFound;
+};
+
+#endif /* _NBLAUNCHER_H */
+
diff --git a/src/main/cpp/ide/nbproject/configurations.xml b/src/main/cpp/ide/nbproject/configurations.xml
new file mode 100644
index 0000000..9e0bf6a
--- /dev/null
+++ b/src/main/cpp/ide/nbproject/configurations.xml
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<configurationDescriptor version="100">
+ <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
+ <logicalFolder name="HeaderFiles"
+ displayName="Header Files"
+ projectFiles="true">
+ <itemPath>cmdargs.h</itemPath>
+ <itemPath>nblauncher.h</itemPath>
+ <itemPath>../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.h</itemPath>
+ <itemPath>version.h</itemPath>
+ </logicalFolder>
+ <logicalFolder name="ResourceFiles"
+ displayName="Resource Files"
+ projectFiles="true">
+ <itemPath>netbeans.exe.manifest</itemPath>
+ <itemPath>netbeans.rc</itemPath>
+ <itemPath>netbeans64.exe.manifest</itemPath>
+ <itemPath>version.rc</itemPath>
+ </logicalFolder>
+ <logicalFolder name="SourceFiles"
+ displayName="Source Files"
+ projectFiles="true">
+ <itemPath>nblauncher.cpp</itemPath>
+ <itemPath>netbeans.cpp</itemPath>
+ <itemPath>../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.cpp</itemPath>
+ </logicalFolder>
+ <logicalFolder name="ExternalFiles"
+ displayName="Important Files"
+ projectFiles="false">
+ <itemPath>Makefile</itemPath>
+ </logicalFolder>
+ </logicalFolder>
+ <projectmakefile>Makefile</projectmakefile>
+ <confs>
+ <conf name="netbeans.exe" type="1">
+ <toolsSet>
+ <compilerSet>Cygwin|Cygwin</compilerSet>
+ <dependencyChecking>true</dependencyChecking>
+ <rebuildPropChanged>false</rebuildPropChanged>
+ </toolsSet>
+ <compileType>
+ <ccTool>
+ <developmentMode>5</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <architecture>1</architecture>
+ <commandLine>-mno-cygwin</commandLine>
+ <preprocessorList>
+ <Elem>ARCHITECTURE=32</Elem>
+ <Elem>NBEXEC_DLL="/lib/nbexec.dll"</Elem>
+ </preprocessorList>
+ </ccTool>
+ <linkerTool>
+ <output>netbeans.exe</output>
+ <linkerLibItems>
+ <linkerOptionItem>netbeans.res</linkerOptionItem>
+ </linkerLibItems>
+ <commandLine>-mwindows -Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-seh</commandLine>
+ </linkerTool>
+ </compileType>
+ <item path="../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.cpp"
+ ex="false"
+ tool="1"
+ flavor2="0">
+ </item>
+ <item path="../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.h"
+ ex="false"
+ tool="3"
+ flavor2="0">
+ </item>
+ <item path="cmdargs.h" ex="false" tool="3" flavor2="0">
+ </item>
+ <item path="nblauncher.cpp" ex="false" tool="1" flavor2="0">
+ </item>
+ <item path="nblauncher.h" ex="false" tool="3" flavor2="0">
+ </item>
+ <item path="netbeans.cpp" ex="false" tool="1" flavor2="0">
+ </item>
+ <item path="netbeans.exe.manifest" ex="false" tool="3" flavor2="0">
+ </item>
+ <item path="netbeans.rc" ex="false" tool="3" flavor2="0">
+ </item>
+ <item path="netbeans64.exe.manifest" ex="false" tool="3" flavor2="0">
+ </item>
+ <item path="version.h" ex="false" tool="3" flavor2="0">
+ </item>
+ <item path="version.rc" ex="false" tool="3" flavor2="0">
+ </item>
+ </conf>
+ <conf name="netbeans64.exe" type="1">
+ <toolsSet>
+ <compilerSet>Cygwin64|Cygwin</compilerSet>
+ <dependencyChecking>true</dependencyChecking>
+ <rebuildPropChanged>false</rebuildPropChanged>
+ </toolsSet>
+ <compileType>
+ <ccTool>
+ <developmentMode>5</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <architecture>2</architecture>
+ <commandLine>-mno-cygwin -static-libgcc -static-libstdc++</commandLine>
+ <preprocessorList>
+ <Elem>ARCHITECTURE=64</Elem>
+ <Elem>NBEXEC_DLL="/lib/nbexec64.dll"</Elem>
+ </preprocessorList>
+ </ccTool>
+ <linkerTool>
+ <output>netbeans64.exe</output>
+ <linkerLibItems>
+ <linkerOptionItem>netbeans64.res</linkerOptionItem>
+ </linkerLibItems>
+ <commandLine>-mwindows -Wl,--nxcompat -Wl,--dynamicbase</commandLine>
+ </linkerTool>
+ </compileType>
+ <item path="../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.cpp"
+ ex="false"
+ tool="1"
+ flavor2="0">
+ </item>
+ <item path="../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.h"
+ ex="false"
+ tool="3"
+ flavor2="0">
+ </item>
+ <item path="cmdargs.h" ex="false" tool="3" flavor2="0">
+ </item>
+ <item path="nblauncher.cpp" ex="false" tool="1" flavor2="0">
+ </item>
+ <item path="nblauncher.h" ex="false" tool="3" flavor2="0">
+ </item>
+ <item path="netbeans.cpp" ex="false" tool="1" flavor2="0">
+ </item>
+ <item path="netbeans.exe.manifest" ex="false" tool="3" flavor2="0">
+ </item>
+ <item path="netbeans.rc" ex="false" tool="3" flavor2="0">
+ </item>
+ <item path="netbeans64.exe.manifest" ex="false" tool="3" flavor2="0">
+ </item>
+ <item path="version.h" ex="false" tool="3" flavor2="0">
+ </item>
+ <item path="version.rc" ex="false" tool="3" flavor2="0">
+ </item>
+ </conf>
+ </confs>
+</configurationDescriptor>
diff --git a/src/main/cpp/ide/nbproject/project.properties b/src/main/cpp/ide/nbproject/project.properties
new file mode 100644
index 0000000..2456923
--- /dev/null
+++ b/src/main/cpp/ide/nbproject/project.properties
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
diff --git a/src/main/cpp/ide/nbproject/project.xml b/src/main/cpp/ide/nbproject/project.xml
new file mode 100644
index 0000000..2a78a99
--- /dev/null
+++ b/src/main/cpp/ide/nbproject/project.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.cnd.makeproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/make-project/1">
+ <name>NB Launcher Win</name>
+ <make-project-type>0</make-project-type>
+ <c-extensions/>
+ <cpp-extensions>cpp</cpp-extensions>
+ <header-extensions>h</header-extensions>
+ <sourceEncoding>UTF-8</sourceEncoding>
+ <make-dep-projects/>
+ <sourceRootList/>
+ <confList>
+ <confElem>
+ <name>netbeans.exe</name>
+ <type>1</type>
+ </confElem>
+ <confElem>
+ <name>netbeans64.exe</name>
+ <type>1</type>
+ </confElem>
+ </confList>
+ <formatting>
+ <project-formatting-style>false</project-formatting-style>
+ </formatting>
+ </data>
+ </configuration>
+</project>
diff --git a/src/main/cpp/ide/netbeans.cpp b/src/main/cpp/ide/netbeans.cpp
new file mode 100644
index 0000000..c14972f
--- /dev/null
+++ b/src/main/cpp/ide/netbeans.cpp
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ /*
+ * Author: Tomas Holy
+ */
+
+
+#include "nblauncher.h"
+
+int main(int argc, char *argv[]) {
+ NbLauncher launcher;
+ return launcher.start(argc - 1, argv + 1);
+}
diff --git a/src/main/cpp/ide/netbeans.exe.manifest b/src/main/cpp/ide/netbeans.exe.manifest
new file mode 100644
index 0000000..71b1164
--- /dev/null
+++ b/src/main/cpp/ide/netbeans.exe.manifest
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity version="9.0.0.0"
+ processorArchitecture="x86"
+ name="netbeans.exe"
+ type="win32"/>
+
+<description>NetBeans IDE process</description>
+<dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="*"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+</dependency>
+<!-- Identify the application security requirements. -->
+<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel
+ level="asInvoker"
+ uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+</trustInfo>
+<!-- NETBEANS-1227: Indicate the same HiDPI capabilities as javaw.exe from JDK 11. -->
+<!-- Note that even 32-bit Java 10.0.2 indicates HiDPI-awareness, so it should
+ be fine to include it here as well. -->
+<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
+ <asmv3:windowsSettings xmlns:dpi1="http://schemas.microsoft.com/SMI/2005/WindowsSettings" xmlns:dpi2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
+ <dpi1:dpiAware>true/PM</dpi1:dpiAware>
+ <dpi2:dpiAwareness>PerMonitorV2, PerMonitor, system</dpi2:dpiAwareness>
+ </asmv3:windowsSettings>
+</asmv3:application>
+<!-- List of explicitly supported Windows versions. This is the list from
+ javaw.exe on JDK 8.0.172, which is the same as that of JDK 11ea. -->
+<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ </application>
+</compatibility>
+</assembly>
diff --git a/src/main/cpp/ide/netbeans.ico b/src/main/cpp/ide/netbeans.ico
new file mode 100644
index 0000000..ec123c0
--- /dev/null
+++ b/src/main/cpp/ide/netbeans.ico
Binary files differ
diff --git a/src/main/cpp/ide/netbeans.rc b/src/main/cpp/ide/netbeans.rc
new file mode 100644
index 0000000..348a320
--- /dev/null
+++ b/src/main/cpp/ide/netbeans.rc
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <winuser.h>
+
+#include "version.rc"
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+
+100 ICON "netbeans.ico"
+
+// Value MANIFEST_FILE id taken from windres parameter -DMANIFEST_FILE
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST MANIFEST_FILE
+
diff --git a/src/main/cpp/ide/netbeans64.exe.manifest b/src/main/cpp/ide/netbeans64.exe.manifest
new file mode 100644
index 0000000..3f7dc6e
--- /dev/null
+++ b/src/main/cpp/ide/netbeans64.exe.manifest
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<!-- Use processorArchitecture="x86", which is the value used by the 64-bit
+ javaw.exe on Java 10.0.2 and Java 11ea. -->
+<assemblyIdentity version="9.0.0.0"
+ processorArchitecture="x86"
+ name="netbeans64.exe"
+ type="win32"/>
+
+<description>NetBeans IDE process</description>
+<dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="*"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+</dependency>
+<!-- Identify the application security requirements. -->
+<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel
+ level="asInvoker"
+ uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+</trustInfo>
+<!-- NETBEANS-1227: Indicate the same HiDPI capabilities as javaw.exe from JDK 11. -->
+<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
+ <asmv3:windowsSettings xmlns:dpi1="http://schemas.microsoft.com/SMI/2005/WindowsSettings" xmlns:dpi2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
+ <dpi1:dpiAware>true/PM</dpi1:dpiAware>
+ <dpi2:dpiAwareness>PerMonitorV2, PerMonitor, system</dpi2:dpiAwareness>
+ </asmv3:windowsSettings>
+</asmv3:application>
+<!-- List of explicitly supported Windows versions. This is the list from
+ javaw.exe on JDK 8.0.172, which is the same as that of JDK 11ea. -->
+<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ </application>
+</compatibility>
+</assembly>
diff --git a/src/main/cpp/ide/version.h b/src/main/cpp/ide/version.h
new file mode 100644
index 0000000..3d8adef
--- /dev/null
+++ b/src/main/cpp/ide/version.h
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#define COMPANY ""
+#define COMPONENT "NetBeans IDE"
+#define VER "9.0.0.0"
+#define FVER 9,0,0,0
+#define BUILD_ID "03062018"
+#define INTERNAL_NAME "netbeans"
+#define COPYRIGHT "Based on Apache NetBeans from the Apache Software Foundation and is licensed under Apache License Version 2.0"
+#define NAME "NetBeans IDE 9.0"
+
diff --git a/src/main/cpp/ide/version.rc b/src/main/cpp/ide/version.rc
new file mode 100644
index 0000000..0bb79bf
--- /dev/null
+++ b/src/main/cpp/ide/version.rc
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <winuser.h>
+#include <winver.h>
+#include "version.h"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION FVER
+ PRODUCTVERSION FVER
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ // FILEOS 0x4 is Win32, 0x40004 is Win32 NT only
+ FILEOS 0x4L
+ // FILETYPE should be 0x1 for .exe and 0x2 for .dll
+ FILETYPE 0x1
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "CompanyName", COMPANY "\0"
+ VALUE "FileDescription", COMPONENT "\0"
+ VALUE "FileVersion", VER "\0"
+ VALUE "Full Version", BUILD_ID "\0"
+ VALUE "InternalName", INTERNAL_NAME "\0"
+ VALUE "LegalCopyright", COPYRIGHT "\0"
+ VALUE "ProductName", NAME "\0"
+ VALUE "ProductVersion", VER "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END