diff options
author | Andrew Niefer | 2007-01-19 21:11:48 +0000 |
---|---|---|
committer | Andrew Niefer | 2007-01-19 21:11:48 +0000 |
commit | 1a0ef36ae9f69561b240c5191040b1411e9e2777 (patch) | |
tree | 813d2c4f6e9c615dae34118c41a8af651821e358 /bundles | |
parent | 435198d2fb3fea69d034957ce8595a7284d5301d (diff) | |
download | rt.equinox.framework-1a0ef36ae9f69561b240c5191040b1411e9e2777.tar.gz rt.equinox.framework-1a0ef36ae9f69561b240c5191040b1411e9e2777.tar.xz rt.equinox.framework-1a0ef36ae9f69561b240c5191040b1411e9e2777.zip |
changes for 168775
Diffstat (limited to 'bundles')
13 files changed, 400 insertions, 372 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonMain.c b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonMain.c index 98146cc51..57a91e037 100644 --- a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonMain.c +++ b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonMain.c @@ -1,230 +1,230 @@ -/*
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Andrew Niefer
- */
-
-#include "eclipseCommon.h"
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <ctype.h>
-#include <pwd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-
-#include <CoreServices/CoreServices.h>
-#include <Carbon/Carbon.h>
-#include <mach-o/dyld.h>
-
-
-#define APP_PACKAGE_PATTERN ".app/Contents/MacOS/"
-#define APP_PACKAGE "APP_PACKAGE"
-#define JAVAROOT "JAVAROOT"
-
-static void debug(const char *fmt, ...);
-static void dumpArgs(char *tag, int argc, char* argv[]);
-static char *append(char *buffer, const char *s);
-static char *appendc(char *buffer, char c);
-static char *expandShell(char *arg, const char *appPackage, const char *javaRoot);
-static char *my_strcasestr(const char *big, const char *little);
-
-static FILE *fgConsoleLog;
-static char *fgAppPackagePath;
-static int fgPid;
-
-extern int original_main(int argc, char* argv[]);
-int main( int argc, char* argv[] ) {
-
- SInt32 systemVersion= 0;
- if (Gestalt(gestaltSystemVersion, &systemVersion) == noErr) {
- systemVersion &= 0xffff;
- if (systemVersion < 0x1020) {
- displayMessage(officialName, "Eclipse requires Jaguar (Mac OS X >= 10.2)");
- return 0;
- }
- }
-
- fgConsoleLog= fopen("/dev/console", "w");
- fgPid= getpid();
-
- dumpArgs("start", argc, argv);
-
- /* find path to application bundle (ignoring case) */
- char *pos= my_strcasestr(argv[0], APP_PACKAGE_PATTERN);
- if (pos != NULL) {
- int l= pos-argv[0] + 4; // reserve space for ".app"
- fgAppPackagePath= malloc(l+1);
- strncpy(fgAppPackagePath, argv[0], l);
- fgAppPackagePath[l]= '\0'; // terminate result
- }
-
- /* Get the main bundle for the app */
- CFBundleRef mainBundle= CFBundleGetMainBundle();
- if (mainBundle != NULL) {
-
- /* Get an instance of the info plist.*/
- CFDictionaryRef bundleInfoDict= CFBundleGetInfoDictionary(mainBundle);
-
- /* If we succeeded, look for our property. */
- if (bundleInfoDict != NULL) {
- CFArrayRef ar= CFDictionaryGetValue(bundleInfoDict, CFSTR("Eclipse"));
- if (ar) {
- CFIndex size= CFArrayGetCount(ar);
- if (size > 0) {
- int i;
- char **old_argv= argv;
- argv= (char**) calloc(size+2, sizeof(char*));
- argc= 0;
- argv[argc++]= old_argv[0];
- for (i= 0; i < size; i++) {
- CFStringRef sr= (CFStringRef) CFArrayGetValueAtIndex (ar, i);
- CFIndex argStringSize= CFStringGetMaximumSizeForEncoding(CFStringGetLength(sr), kCFStringEncodingUTF8);
- char *s= malloc(argStringSize);
- if (CFStringGetCString(sr, s, argStringSize, kCFStringEncodingUTF8)) {
- argv[argc++]= expandShell(s, fgAppPackagePath, NULL);
- } else {
- fprintf(fgConsoleLog, "can't extract bytes\n");
- }
- //free(s);
- }
- }
- } else {
- fprintf(fgConsoleLog, "no Eclipse dict found\n");
- }
- } else {
- fprintf(fgConsoleLog, "no bundle dict found\n");
- }
- } else {
- fprintf(fgConsoleLog, "no bundle found\n");
- }
-
- int exitcode= original_main(argc, argv);
- debug("<<<< exit(%d)\n", exitcode);
- fclose(fgConsoleLog);
- return exitcode;
-}
-
-static void debug(const char *fmt, ...) {
-#if DEBUG
- va_list ap;
- va_start(ap, fmt);
- fprintf(fgConsoleLog, "%05d: ", fgPid);
- vfprintf(fgConsoleLog, fmt, ap);
- va_end(ap);
-#endif
-}
-
-static void dumpArgs(char *tag, int argc, char* argv[]) {
-#if DEBUG
- int i;
- if (argc < 0) {
- argc= 0;
- for (i= 0; argv[i] != NULL; i++)
- argc++;
- }
- debug(">>>> %s:", tag);
- for (i= 0; i < argc && argv[i] != NULL; i++)
- fprintf(fgConsoleLog, " <%s>", argv[i]);
- fprintf(fgConsoleLog, "\n");
-#endif
-}
-
-/*
- * Expand $APP_PACKAGE, $JAVA_HOME, and does tilde expansion.
-
- A word beginning with an unquoted tilde character (~) is
- subject to tilde expansion. All the characters up to a
- slash (/) or the end of the word are treated as a username
- and are replaced with the user's home directory. If the
- username is missing (as in ~/foobar), the tilde is
- replaced with the value of the HOME variable (the current
- user's home directory).
- */
-static char *expandShell(char *arg, const char *appPackage, const char *javaRoot) {
-
- if (index(arg, '~') == NULL && index(arg, '$') == NULL)
- return arg;
-
- char *buffer= strdup("");
- char c, lastChar= ' ';
- const char *cp= arg;
- while ((c = *cp++) != 0) {
- if (isspace(lastChar) && c == '~') {
- char name[100], *dir= NULL;
- int j= 0;
- for (; (c = *cp) != 0; cp++) {
- if (! isalnum(c))
- break;
- name[j++]= c;
- lastChar= c;
- }
- name[j]= '\0';
- if (j > 0) {
- struct passwd *pw= getpwnam(name);
- if (pw != NULL)
- dir= pw->pw_dir;
- } else {
- dir= getenv("HOME");
- }
- if (dir != NULL)
- buffer= append(buffer, dir);
-
- } else if (c == '$') {
- int l= strlen(APP_PACKAGE);
- if (appPackage != NULL && strncmp(cp, APP_PACKAGE, l) == 0) {
- cp+= l;
- buffer= append(buffer, appPackage);
- } else {
- int l= strlen(JAVAROOT);
- if (javaRoot != NULL && strncmp(cp, JAVAROOT, l) == 0) {
- cp+= l;
- buffer= append(buffer, javaRoot);
- } else {
- buffer= appendc(buffer, c);
- }
- }
- } else
- buffer= appendc(buffer, c);
- lastChar= c;
- }
- return buffer;
-}
-
-static char *my_strcasestr(const char *big, const char *little) {
- char *cp, *s, *t;
- for (cp= (char*) big; *cp; cp++) {
- for (s= cp, t= (char*) little; *s && *t; s++, t++)
- if (toupper(*s) != toupper(*t))
- break;
- if (*t == '\0')
- return cp;
- }
- return NULL;
-}
-
-static char *append(char *buffer, const char *s) {
- int bl= strlen(buffer);
- int sl= strlen(s);
- buffer= realloc(buffer, bl+sl+1);
- strcpy(&buffer[bl], s);
- return buffer;
-}
-
-static char *appendc(char *buffer, char c) {
- int bl= strlen(buffer);
- buffer= realloc(buffer, bl+2);
- buffer[bl++]= c;
- buffer[bl]= '\0';
- return buffer;
+/* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Andrew Niefer + */ + +#include "eclipseCommon.h" + +#include <sys/stat.h> +#include <sys/types.h> +#include <fcntl.h> +#include <ctype.h> +#include <pwd.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <sys/ioctl.h> +#include <unistd.h> + +#include <CoreServices/CoreServices.h> +#include <Carbon/Carbon.h> +#include <mach-o/dyld.h> + + +#define APP_PACKAGE_PATTERN ".app/Contents/MacOS/" +#define APP_PACKAGE "APP_PACKAGE" +#define JAVAROOT "JAVAROOT" + +static void debug(const char *fmt, ...); +static void dumpArgs(char *tag, int argc, char* argv[]); +static char *append(char *buffer, const char *s); +static char *appendc(char *buffer, char c); +static char *expandShell(char *arg, const char *appPackage, const char *javaRoot); +static char *my_strcasestr(const char *big, const char *little); + +static FILE *fgConsoleLog; +static char *fgAppPackagePath; +static int fgPid; + +extern int original_main(int argc, char* argv[]); +int main( int argc, char* argv[] ) { + + SInt32 systemVersion= 0; + if (Gestalt(gestaltSystemVersion, &systemVersion) == noErr) { + systemVersion &= 0xffff; + if (systemVersion < 0x1020) { + displayMessage(getOfficialName(), "Eclipse requires Jaguar (Mac OS X >= 10.2)"); + return 0; + } + } + + fgConsoleLog= fopen("/dev/console", "w"); + fgPid= getpid(); + + dumpArgs("start", argc, argv); + + /* find path to application bundle (ignoring case) */ + char *pos= my_strcasestr(argv[0], APP_PACKAGE_PATTERN); + if (pos != NULL) { + int l= pos-argv[0] + 4; // reserve space for ".app" + fgAppPackagePath= malloc(l+1); + strncpy(fgAppPackagePath, argv[0], l); + fgAppPackagePath[l]= '\0'; // terminate result + } + + /* Get the main bundle for the app */ + CFBundleRef mainBundle= CFBundleGetMainBundle(); + if (mainBundle != NULL) { + + /* Get an instance of the info plist.*/ + CFDictionaryRef bundleInfoDict= CFBundleGetInfoDictionary(mainBundle); + + /* If we succeeded, look for our property. */ + if (bundleInfoDict != NULL) { + CFArrayRef ar= CFDictionaryGetValue(bundleInfoDict, CFSTR("Eclipse")); + if (ar) { + CFIndex size= CFArrayGetCount(ar); + if (size > 0) { + int i; + char **old_argv= argv; + argv= (char**) calloc(size+2, sizeof(char*)); + argc= 0; + argv[argc++]= old_argv[0]; + for (i= 0; i < size; i++) { + CFStringRef sr= (CFStringRef) CFArrayGetValueAtIndex (ar, i); + CFIndex argStringSize= CFStringGetMaximumSizeForEncoding(CFStringGetLength(sr), kCFStringEncodingUTF8); + char *s= malloc(argStringSize); + if (CFStringGetCString(sr, s, argStringSize, kCFStringEncodingUTF8)) { + argv[argc++]= expandShell(s, fgAppPackagePath, NULL); + } else { + fprintf(fgConsoleLog, "can't extract bytes\n"); + } + //free(s); + } + } + } else { + fprintf(fgConsoleLog, "no Eclipse dict found\n"); + } + } else { + fprintf(fgConsoleLog, "no bundle dict found\n"); + } + } else { + fprintf(fgConsoleLog, "no bundle found\n"); + } + + int exitcode= original_main(argc, argv); + debug("<<<< exit(%d)\n", exitcode); + fclose(fgConsoleLog); + return exitcode; +} + +static void debug(const char *fmt, ...) { +#if DEBUG + va_list ap; + va_start(ap, fmt); + fprintf(fgConsoleLog, "%05d: ", fgPid); + vfprintf(fgConsoleLog, fmt, ap); + va_end(ap); +#endif +} + +static void dumpArgs(char *tag, int argc, char* argv[]) { +#if DEBUG + int i; + if (argc < 0) { + argc= 0; + for (i= 0; argv[i] != NULL; i++) + argc++; + } + debug(">>>> %s:", tag); + for (i= 0; i < argc && argv[i] != NULL; i++) + fprintf(fgConsoleLog, " <%s>", argv[i]); + fprintf(fgConsoleLog, "\n"); +#endif +} + +/* + * Expand $APP_PACKAGE, $JAVA_HOME, and does tilde expansion. + + A word beginning with an unquoted tilde character (~) is + subject to tilde expansion. All the characters up to a + slash (/) or the end of the word are treated as a username + and are replaced with the user's home directory. If the + username is missing (as in ~/foobar), the tilde is + replaced with the value of the HOME variable (the current + user's home directory). + */ +static char *expandShell(char *arg, const char *appPackage, const char *javaRoot) { + + if (index(arg, '~') == NULL && index(arg, '$') == NULL) + return arg; + + char *buffer= strdup(""); + char c, lastChar= ' '; + const char *cp= arg; + while ((c = *cp++) != 0) { + if (isspace(lastChar) && c == '~') { + char name[100], *dir= NULL; + int j= 0; + for (; (c = *cp) != 0; cp++) { + if (! isalnum(c)) + break; + name[j++]= c; + lastChar= c; + } + name[j]= '\0'; + if (j > 0) { + struct passwd *pw= getpwnam(name); + if (pw != NULL) + dir= pw->pw_dir; + } else { + dir= getenv("HOME"); + } + if (dir != NULL) + buffer= append(buffer, dir); + + } else if (c == '$') { + int l= strlen(APP_PACKAGE); + if (appPackage != NULL && strncmp(cp, APP_PACKAGE, l) == 0) { + cp+= l; + buffer= append(buffer, appPackage); + } else { + int l= strlen(JAVAROOT); + if (javaRoot != NULL && strncmp(cp, JAVAROOT, l) == 0) { + cp+= l; + buffer= append(buffer, javaRoot); + } else { + buffer= appendc(buffer, c); + } + } + } else + buffer= appendc(buffer, c); + lastChar= c; + } + return buffer; +} + +static char *my_strcasestr(const char *big, const char *little) { + char *cp, *s, *t; + for (cp= (char*) big; *cp; cp++) { + for (s= cp, t= (char*) little; *s && *t; s++, t++) + if (toupper(*s) != toupper(*t)) + break; + if (*t == '\0') + return cp; + } + return NULL; +} + +static char *append(char *buffer, const char *s) { + int bl= strlen(buffer); + int sl= strlen(s); + buffer= realloc(buffer, bl+sl+1); + strcpy(&buffer[bl], s); + return buffer; +} + +static char *appendc(char *buffer, char c) { + int bl= strlen(buffer); + buffer= realloc(buffer, bl+2); + buffer[bl++]= c; + buffer[bl]= '\0'; + return buffer; }
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.executable/library/eclipse.c b/bundles/org.eclipse.equinox.executable/library/eclipse.c index c034e7306..90b3d6e71 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipse.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipse.c @@ -213,6 +213,7 @@ static _TCHAR* javaVM = NULL; /* full pathname of the Java VM to run static _TCHAR* jniLib = NULL; /* full path of a java vm library for JNI invocation */ static _TCHAR* jarFile = NULL; /* full pathname of the startup jar file to run */ static _TCHAR* sharedID = NULL; /* ID for the shared memory */ +static _TCHAR* officialName = NULL; _TCHAR* exitData = NULL; /* exit data set from Java */ int initialArgc; @@ -349,8 +350,7 @@ JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[]) parseArgs( &argc, argv ); /* Initialize official program name */ - if (officialName != NULL) - officialName = name != NULL ? _tcsdup( name ) : getDefaultOfficialName(); + officialName = name != NULL ? _tcsdup( name ) : getDefaultOfficialName(); /* Initialize the window system. */ initWindowSystem( &argc, argv, !noSplash ); @@ -394,6 +394,10 @@ JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[]) /* Either verify the VM specified by the user or attempt to find the VM in the user's PATH. */ javaVM = findCommand( vmName ); +#ifdef DEFAULT_JAVA_EXEC + /* if the default is exe, only do jnilaunching if a library was specified */ + jniLaunching = isVMLibrary(javaVM); +#endif } if(jniLaunching) { @@ -556,6 +560,7 @@ JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[]) free( jarFile ); free( programDir ); free( program ); + free( officialName ); if ( vmCommand != NULL ) free( vmCommand ); if ( cp != JAR ) free( cp ); if ( cpValue != NULL) free( cpValue ); @@ -840,6 +845,10 @@ static _TCHAR* formatVmCommandMsg( _TCHAR* args[], _TCHAR* vmArgs[], _TCHAR* pr return message; } +_TCHAR* getOfficialName() { + return officialName; +} + /* * Determine the default official application name * @@ -1002,6 +1011,8 @@ static _TCHAR ** getRelaunchCommand( _TCHAR **vmCommand ) } relaunch[idx++] = vmCommand[i]; } + if(_tcsicmp(relaunch[idx - 1], VMARGS) == 0) + relaunch[idx - 1] = NULL; relaunch[idx] = NULL; return relaunch; } diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.c b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.c index 351cf2d56..01ed623f6 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.c @@ -26,7 +26,6 @@ #include <sys/stat.h> /* Global Variables */ -_TCHAR* officialName = NULL; _TCHAR* osArg = _T_ECLIPSE(DEFAULT_OS); _TCHAR* osArchArg = _T_ECLIPSE(DEFAULT_OS_ARCH); _TCHAR* wsArg = _T_ECLIPSE(DEFAULT_WS); /* the SWT supported GUI to be used */ diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h index fcfe90530..90b68cca3 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h +++ b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h @@ -22,7 +22,7 @@ #ifdef UNICODE #define pathSeparator pathSeparatorW #define dirSeparator dirSeparatorW -#define officialName officialNameW +#define getOfficialName getOfficialNameW #define parseArgs parseArgsW #define displayMessage displayMessageW #define getProgramDir getProgramDirW @@ -56,8 +56,6 @@ extern _TCHAR* wsArg; extern _TCHAR dirSeparator; /* '/' or '\\' */ extern _TCHAR pathSeparator; /* separator used in PATH variable */ -extern _TCHAR* officialName; /* Program official name */ - extern char *toNarrow(_TCHAR* src); @@ -72,6 +70,7 @@ extern _TCHAR* findFile( _TCHAR* path, _TCHAR* prefix); extern _TCHAR* getProgramDir(); +extern _TCHAR* getOfficialName(); extern _TCHAR* resolveSymlinks( _TCHAR* path ); diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseMain.c b/bundles/org.eclipse.equinox.executable/library/eclipseMain.c index 53c43d885..551167721 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseMain.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipseMain.c @@ -40,6 +40,7 @@ static _TCHAR* name = NULL; /* program name */ static _TCHAR** userVMarg = NULL; /* user specific args for the Java VM */ static _TCHAR* programDir = NULL; /* directory where program resides */ static _TCHAR* library = NULL; /* pathname of the eclipse shared library */ +static _TCHAR* officialName = NULL; static int createUserArgs(int configArgc, _TCHAR **configArgv, int *argc, _TCHAR ***argv); static void parseArgs( int* argc, _TCHAR* argv[] ); @@ -270,6 +271,10 @@ _TCHAR* getProgramDir(_TCHAR* program) return NULL; } +_TCHAR* getOfficialName() { + return officialName; +} + /* * Determine the default official application name * diff --git a/bundles/org.eclipse.equinox.executable/library/gtk/build.sh b/bundles/org.eclipse.equinox.executable/library/gtk/build.sh index 45846ed9c..163442843 100644 --- a/bundles/org.eclipse.equinox.executable/library/gtk/build.sh +++ b/bundles/org.eclipse.equinox.executable/library/gtk/build.sh @@ -29,6 +29,7 @@ programOutput="eclipse" defaultOS="" defaultOSArch="" defaultWS="gtk" +defaultJava=DEFAULT_JAVA_JNI javaHome="" makefile="" if [ "$OS" = "" ]; then @@ -49,6 +50,7 @@ case $OS in case $MODEL in "x86_64") defaultOSArch="x86_64" + defaultJava=DEFAULT_JAVA_EXEC OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch" ;; i?86) @@ -57,14 +59,17 @@ case $OS in ;; "ppc") defaultOSArch="ppc" + defaultJava=DEFAULT_JAVA_EXEC OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch" ;; "ppc64") defaultOSArch="ppc64" + defaultJava=DEFAULT_JAVA_EXEC OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch" ;; "ia64") defaultOSArch="ia64" + defaultJava=DEFAULT_JAVA_EXEC OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch" ;; *) @@ -128,8 +133,9 @@ DEFAULT_OS="$defaultOS" DEFAULT_OS_ARCH="$defaultOSArch" DEFAULT_WS="$defaultWS" JAVA_HOME=$javaHome +DEFAULT_JAVA=$defaultJava -export OUTPUT_DIR PROGRAM_OUTPUT DEFAULT_OS DEFAULT_OS_ARCH DEFAULT_WS JAVA_HOME +export OUTPUT_DIR PROGRAM_OUTPUT DEFAULT_OS DEFAULT_OS_ARCH DEFAULT_WS JAVA_HOME DEFAULT_JAVA # If the OS is supported (a makefile exists) if [ "$makefile" != "" ]; then diff --git a/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtkCommon.c b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtkCommon.c index ca83c8594..592153d16 100644 --- a/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtkCommon.c +++ b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtkCommon.c @@ -72,7 +72,7 @@ void initWindowSystem(int* pArgc, char* argv[], int showSplash) /* Initialize GTK. */ gtk_set_locale(); gtk_init_check(pArgc, &argv); - gdk_set_program_class(officialName); + gdk_set_program_class(getOfficialName()); gtkInitialized = TRUE; } diff --git a/bundles/org.eclipse.equinox.executable/library/gtk/make_linux.mak b/bundles/org.eclipse.equinox.executable/library/gtk/make_linux.mak index 7aefdba8a..40abf3e5d 100644 --- a/bundles/org.eclipse.equinox.executable/library/gtk/make_linux.mak +++ b/bundles/org.eclipse.equinox.executable/library/gtk/make_linux.mak @@ -29,6 +29,10 @@ endif PROGRAM_LIBRARY=$(PROGRAM_OUTPUT)_$(LIB_VERSION).so +ifeq ($(DEFAULT_JAVA),) + DEFAULT_JAVA=DEFAULT_JAVA_JNI +endif + # Define the object modules to be compiled and flags. CC=gcc MAIN_OBJS = eclipseMain.o @@ -46,6 +50,7 @@ CFLAGS = -O -s -Wall\ -DDEFAULT_OS="\"$(DEFAULT_OS)\"" \ -DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \ -DDEFAULT_WS="\"$(DEFAULT_WS)\"" \ + -D$(DEFAULT_JAVA) \ -I. \ -I.. \ -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux \ diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c index 83b694e92..53a4cc151 100644 --- a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c +++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c @@ -127,10 +127,10 @@ int showSplash( const char* featureImage ) /* Note that XtSetArg is a macro, and the 1st argument will be evaluated twice * so increment nArgs on its own */ XtSetArg(args[nArgs], XmNmwmDecorations, 0); nArgs++; - XtSetArg(args[nArgs], XmNtitle, officialName); nArgs++; + XtSetArg(args[nArgs], XmNtitle, getOfficialName()); nArgs++; XtSetArg(args[nArgs], XmNwidth, width); nArgs++; XtSetArg(args[nArgs], XmNheight, height); nArgs++; - shellHandle = XtAppCreateShell(officialName, "", applicationShellWidgetClass, xDisplay, args, nArgs); + shellHandle = XtAppCreateShell(getOfficialName(), "", applicationShellWidgetClass, xDisplay, args, nArgs); nArgs = 0; XtSetArg(args[nArgs++], XmNancestorSensitive, 1); @@ -214,10 +214,12 @@ long getSplashHandle() { void dispatchMessages() { XtInputMask mask; - /* Process any outstanding messages */ - while ((mask = XtAppPending(appContext)) != 0) { - XtAppProcessEvent(appContext, mask); - } + if (appContext != NULL) { + /* Process any outstanding messages */ + while ((mask = XtAppPending(appContext)) != 0) { + XtAppProcessEvent(appContext, mask); + } + } } void takeDownSplash() diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c index 3442ac985..791f9d0af 100644 --- a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c +++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c @@ -76,7 +76,7 @@ void displayMessage( char* title, char* message ) XtSetArg( arg[ nArgs ], XmNdialogType, XmDIALOG_MESSAGE ); nArgs++; XtSetArg( arg[ nArgs ], XmNtitle, title ); nArgs++; XtSetArg( arg[ nArgs ], XmNmessageString, msg ); nArgs++; - msgBox = XmCreateMessageDialog( topWindow, officialName, arg, nArgs ); + msgBox = XmCreateMessageDialog( topWindow, getOfficialName(), arg, nArgs ); XtUnmanageChild( XmMessageBoxGetChild( msgBox, XmDIALOG_CANCEL_BUTTON ) ); XtUnmanageChild( XmMessageBoxGetChild( msgBox, XmDIALOG_HELP_BUTTON ) ); XtManageChild( msgBox ); @@ -112,7 +112,7 @@ void initWindowSystem( int* pArgc, char* argv[], int showSplash ) /* Create the top level shell that will not be used other than to initialize the application. */ XtSetLanguageProc (NULL, NULL, NULL); - topWindow = XtAppInitialize( &appContext, officialName, NULL, 0, + topWindow = XtAppInitialize( &appContext, getOfficialName(), NULL, 0, pArgc, argv, NULL, NULL, 0 ); XtSetArg( arg[ 0 ], XmNmappedWhenManaged, False ); XtSetValues( topWindow, arg, 1 ); diff --git a/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak b/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak index deedc371b..0eb97fbe2 100644 --- a/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak +++ b/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak @@ -42,6 +42,7 @@ CFLAGS = -O -s \ -DDEFAULT_OS="\"$(DEFAULT_OS)\"" \ -DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \ -DDEFAULT_WS="\"$(DEFAULT_WS)\"" \ + -DDEFAULT_JAVA_EXEC \ -DAIX \ -I./ \ -I../ \ diff --git a/bundles/org.eclipse.equinox.executable/library/photon/eclipsePhoton.c b/bundles/org.eclipse.equinox.executable/library/photon/eclipsePhoton.c index 582864374..c14cb9bb9 100644 --- a/bundles/org.eclipse.equinox.executable/library/photon/eclipsePhoton.c +++ b/bundles/org.eclipse.equinox.executable/library/photon/eclipsePhoton.c @@ -86,7 +86,7 @@ void initWindowSystem( int* pArgc, char* argv[], int showSplash ) PtSetArg( &arg[ nArgs++ ], Pt_ARG_WINDOW_RENDER_FLAGS, 0, ~0 ); PtSetArg( &arg[ nArgs++ ], Pt_ARG_WINDOW_MANAGED_FLAGS, Ph_WM_TASKBAR | Ph_WM_CLOSE, ~0 ); PtSetArg( &arg[ nArgs++ ], Pt_ARG_WINDOW_STATE, Ph_WM_STATE_ISFRONT, ~0 ); - PtSetArg( &arg[ nArgs++ ], Pt_ARG_WINDOW_TITLE, officialName, ~0 ); + PtSetArg( &arg[ nArgs++ ], Pt_ARG_WINDOW_TITLE, getOfficialName(), ~0 ); topWindow = PtCreateWidget( PtWindow, Pt_NO_PARENT, nArgs, arg ); } diff --git a/bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c b/bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c index e7d9b5758..769401d6b 100644 --- a/bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c +++ b/bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c @@ -1,126 +1,126 @@ -/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Andrew Niefer
- *******************************************************************************/
-
-#include "eclipseCommon.h"
-#include "eclipseOS.h"
-
-#include <windows.h>
-#include <stdlib.h>
-#include <commctrl.h>
-
-#define ECLIPSE_ICON 401
-
-_TCHAR dirSeparator = _T('\\');
-_TCHAR pathSeparator = _T(';');
-
-void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash );
-/*static LRESULT WINAPI WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);*/
-
-/* Global Main Window*/
-#ifdef UNICODE
-extern HWND topWindow;
-#else
-HWND topWindow = 0;
-#endif
-
-/* Define local variables for the main window. */
-/*static WNDPROC oldProc;*/
-
-static int initialized = 0;
-
-/* Display a Message */
-void displayMessage( _TCHAR* title, _TCHAR* message )
-{
- if(!initialized)
- initWindowSystem(0, NULL, 0);
- MessageBox( topWindow, message, title, MB_OK );
-}
-
-/* Initialize Window System
- *
- * Create a pop window to display the bitmap image.
- *
- * Return the window handle as the data for the splash command.
- *
- */
-void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash )
-{
- if(initialized)
- return;
- /* Create a window that has no decorations. */
-
- InitCommonControls();
- topWindow = CreateWindowEx (0,
- _T("STATIC"),
- officialName,
- SS_BITMAP | WS_POPUP,
- CW_USEDEFAULT,
- 0,
- CW_USEDEFAULT,
- 0,
- NULL,
- NULL,
- GetModuleHandle (NULL),
- NULL);
- SetClassLong(topWindow, GCL_HICON, (LONG)LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(ECLIPSE_ICON)));
-/*
- oldProc = (WNDPROC) GetWindowLong (topWindow, GWL_WNDPROC);
- SetWindowLong (topWindow, GWL_WNDPROC, (LONG) WndProc);
-*/
- initialized = 1;
-}
-
-/* Window Procedure for the Spash window.
- *
- * A special WndProc is needed to return the proper vlaue for WM_NCHITTEST.
- * It must also detect the message from the splash window process.
- */
-/*static LRESULT WINAPI WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- switch (uMsg)
- {
- case WM_NCHITTEST: return HTCLIENT;
- case WM_CLOSE:
- PostQuitMessage( 0 );
- break;
- }
- return CallWindowProc (oldProc, hwnd, uMsg, wParam, lParam);
-}*/
-
-/* Load the specified shared library
- */
-void * loadLibrary( _TCHAR * library ){
- return LoadLibrary(library);
-}
-
-/* Unload the shared library
- */
-void unloadLibrary( void * handle ){
- FreeLibrary(handle);
-}
-
-/* Find the given symbol in the shared library
- */
-void * findSymbol( void * handle, _TCHAR * symbol ){
- char * str = NULL;
- void * result;
-
- str = toNarrow(symbol);
- result = GetProcAddress(handle, str);
- free(str);
- return result;
-}
-
-_TCHAR* resolveSymlinks( _TCHAR* path ) {
- /* no symlinks on windows */
- return path;
-}
+/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Andrew Niefer + *******************************************************************************/ + +#include "eclipseCommon.h" +#include "eclipseOS.h" + +#include <windows.h> +#include <stdlib.h> +#include <commctrl.h> + +#define ECLIPSE_ICON 401 + +_TCHAR dirSeparator = _T('\\'); +_TCHAR pathSeparator = _T(';'); + +void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash ); +/*static LRESULT WINAPI WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);*/ + +/* Global Main Window*/ +#ifdef UNICODE +extern HWND topWindow; +#else +HWND topWindow = 0; +#endif + +/* Define local variables for the main window. */ +/*static WNDPROC oldProc;*/ + +static int initialized = 0; + +/* Display a Message */ +void displayMessage( _TCHAR* title, _TCHAR* message ) +{ + if(!initialized) + initWindowSystem(0, NULL, 0); + MessageBox( topWindow, message, title, MB_OK ); +} + +/* Initialize Window System + * + * Create a pop window to display the bitmap image. + * + * Return the window handle as the data for the splash command. + * + */ +void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash ) +{ + if(initialized) + return; + /* Create a window that has no decorations. */ + + InitCommonControls(); + topWindow = CreateWindowEx (0, + _T("STATIC"), + getOfficialName(), + SS_BITMAP | WS_POPUP, + CW_USEDEFAULT, + 0, + CW_USEDEFAULT, + 0, + NULL, + NULL, + GetModuleHandle (NULL), + NULL); + SetClassLong(topWindow, GCL_HICON, (LONG)LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(ECLIPSE_ICON))); +/* + oldProc = (WNDPROC) GetWindowLong (topWindow, GWL_WNDPROC); + SetWindowLong (topWindow, GWL_WNDPROC, (LONG) WndProc); +*/ + initialized = 1; +} + +/* Window Procedure for the Spash window. + * + * A special WndProc is needed to return the proper vlaue for WM_NCHITTEST. + * It must also detect the message from the splash window process. + */ +/*static LRESULT WINAPI WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + case WM_NCHITTEST: return HTCLIENT; + case WM_CLOSE: + PostQuitMessage( 0 ); + break; + } + return CallWindowProc (oldProc, hwnd, uMsg, wParam, lParam); +}*/ + +/* Load the specified shared library + */ +void * loadLibrary( _TCHAR * library ){ + return LoadLibrary(library); +} + +/* Unload the shared library + */ +void unloadLibrary( void * handle ){ + FreeLibrary(handle); +} + +/* Find the given symbol in the shared library + */ +void * findSymbol( void * handle, _TCHAR * symbol ){ + char * str = NULL; + void * result; + + str = toNarrow(symbol); + result = GetProcAddress(handle, str); + free(str); + return result; +} + +_TCHAR* resolveSymlinks( _TCHAR* path ) { + /* no symlinks on windows */ + return path; +} |