diff options
author | Andrew Niefer | 2007-03-13 21:57:16 +0000 |
---|---|---|
committer | Andrew Niefer | 2007-03-13 21:57:16 +0000 |
commit | 3cf8518912fb064f582a5fa3b7ef020b2155e1b6 (patch) | |
tree | 44287c0f9863f02088a18051335d97a089a631a3 /bundles/org.eclipse.equinox.executable | |
parent | 3c156e8434744738d7dc6ca7941378119d19f1a8 (diff) | |
download | rt.equinox.framework-3cf8518912fb064f582a5fa3b7ef020b2155e1b6.tar.gz rt.equinox.framework-3cf8518912fb064f582a5fa3b7ef020b2155e1b6.tar.xz rt.equinox.framework-3cf8518912fb064f582a5fa3b7ef020b2155e1b6.zip |
bug 172367 - WPF port
Diffstat (limited to 'bundles/org.eclipse.equinox.executable')
18 files changed, 1005 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.executable/.cproject b/bundles/org.eclipse.equinox.executable/.cproject new file mode 100644 index 000000000..d561d8d59 --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/.cproject @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?fileVersion 4.0.0?> + +<cproject> +<storageModule moduleId="org.eclipse.cdt.core.settings"> +<cconfiguration id="converted.config.1797282818"> +<storageModule moduleId="scannerConfiguration"> +<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> +<buildOutputProvider> +<openAction enabled="false" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="makefileGenerator"> +<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> +<parser enabled="false"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="false" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="false"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="false" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="false"/> +</scannerInfoProvider> +</profile> +</storageModule> +<storageModule moduleId="org.eclipse.cdt.core.pathentry"> +<pathentry kind="src" path=""/> +<pathentry kind="out" path=""/> +<pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/> +</storageModule> +<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"> +<buildTargets> +<target name="all" path="library/carbon" targetID="org.eclipse.cdt.make.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f make_macosx.mak</buildArguments> +<buildTarget>all</buildTarget> +<stopOnError>false</stopOnError> +<useDefaultCommand>false</useDefaultCommand> +</target> +<target name="clean" path="library/carbon" targetID="org.eclipse.cdt.make.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f make_macosx.mak</buildArguments> +<buildTarget>clean</buildTarget> +<stopOnError>false</stopOnError> +<useDefaultCommand>false</useDefaultCommand> +</target> +<target name="linux-all" path="library/motif" targetID="org.eclipse.cdt.make.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f make_linux.mak</buildArguments> +<buildTarget>all</buildTarget> +<stopOnError>false</stopOnError> +<useDefaultCommand>false</useDefaultCommand> +</target> +<target name="clean" path="library/motif" targetID="org.eclipse.cdt.make.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f make_linux.mak</buildArguments> +<buildTarget>clean</buildTarget> +<stopOnError>false</stopOnError> +<useDefaultCommand>false</useDefaultCommand> +</target> +<target name="all-mingw" path="library/win32" targetID="org.eclipse.cdt.make.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f make_mingw.mak</buildArguments> +<buildTarget>all</buildTarget> +<stopOnError>false</stopOnError> +<useDefaultCommand>false</useDefaultCommand> +</target> +<target name="clean" path="library/win32" targetID="org.eclipse.cdt.make.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f make_mingw.mak</buildArguments> +<buildTarget>clean</buildTarget> +<stopOnError>false</stopOnError> +<useDefaultCommand>false</useDefaultCommand> +</target> +<target name="linux-all" path="library/gtk" targetID="org.eclipse.cdt.make.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f make_linux.mak</buildArguments> +<buildTarget>all</buildTarget> +<stopOnError>false</stopOnError> +<useDefaultCommand>false</useDefaultCommand> +</target> +<target name="clean" path="library/gtk" targetID="org.eclipse.cdt.make.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f make_linux.mak</buildArguments> +<buildTarget>clean</buildTarget> +<stopOnError>false</stopOnError> +<useDefaultCommand>false</useDefaultCommand> +</target> +</buildTargets> +</storageModule> +<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="converted.config.1797282818" moduleId="org.eclipse.cdt.core.settings" name="convertedConfig"> +<externalSettings/> +<extensions> +<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> +<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> +<extension id="org.eclipse.cdt.core.MachO" point="org.eclipse.cdt.core.BinaryParser"> +<attribute key="c++filt" value="c++filt"/> +</extension> +</extensions> +</storageModule> +</cconfiguration> +</storageModule> +</cproject> diff --git a/bundles/org.eclipse.equinox.executable/feature.xml b/bundles/org.eclipse.equinox.executable/feature.xml index 726bc0af8..3f8271dfd 100644 --- a/bundles/org.eclipse.equinox.executable/feature.xml +++ b/bundles/org.eclipse.equinox.executable/feature.xml @@ -105,5 +105,16 @@ version="0.0.0" fragment="true" unpack="true"/> + + <plugin + id="org.eclipse.equinox.launcher.wpf.win32.x86" + os="win32" + ws="wpf" + arch="x86" + download-size="0" + install-size="0" + version="0.0.0" + fragment="true" + unpack="true"/> </feature> diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c index 698ec64ee..9b2a4a055 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c @@ -47,7 +47,7 @@ static JNIEnv *env = 0; * able to call out to either, so we will set hooks depending on which version of * registerNatives gets called. */ -#ifndef UNICODE +#if (!defined(UNICODE) || defined(VISTA)) void (* exitDataHook)(JNIEnv *env, jstring id, jstring s); void (* dispatchHook)(); long (* splashHandleHook)(); @@ -61,13 +61,13 @@ extern void (* showSplashHook)(JNIEnv *env, jstring s); extern void (* takeDownHook)(); #endif -#ifndef UNICODE +#if (!defined(UNICODE) || defined(VISTA)) /* JNI Callback methods */ JNIEXPORT void JNICALL set_exit_data(JNIEnv * env, jobject obj, jstring id, jstring s){ if(exitDataHook != NULL) exitDataHook(env, id, s); else /* hook was not set, just call the ANSI version */ -#ifdef WIN32 +#if (defined(_WIN32) || defined(VISTA)) setExitDataW(env, id, s); #else setExitData(env, id, s); diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.h b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.h index 29e07c9a0..25f5131e6 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.h +++ b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.h @@ -87,5 +87,5 @@ JNIEXPORT void JNICALL takedown_splash(JNIEnv *, jobject); */ extern int startJavaVM( _TCHAR* libPath, _TCHAR* vmArgs[], _TCHAR* progArgs[] ); -extern void cleanupVM(); +extern void cleanupVM( int ); #endif diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseMain.c b/bundles/org.eclipse.equinox.executable/library/eclipseMain.c index 4a4edb9ad..140214338 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseMain.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipseMain.c @@ -56,11 +56,12 @@ static _TCHAR* checkForIni(int argc, _TCHAR* argv[]); static int initialArgc; static _TCHAR** initialArgv; -#ifdef _WIN32 +#if (defined(_WIN32) || defined(VISTA)) #ifdef UNICODE extern int main(int, char**); int mainW(int, wchar_t**); int wmain( int argc, wchar_t** argv ) { +#ifndef VISTA OSVERSIONINFOW info; info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); /* @@ -86,6 +87,7 @@ int wmain( int argc, wchar_t** argv ) { free(newArgv); return result; } +#endif return mainW(argc, argv); } #define main mainW diff --git a/bundles/org.eclipse.equinox.executable/library/wpf/.cvsignore b/bundles/org.eclipse.equinox.executable/library/wpf/.cvsignore new file mode 100644 index 000000000..01325b312 --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/library/wpf/.cvsignore @@ -0,0 +1,8 @@ +*.obj +eclipse.exe +eclipse.res +*.pdb +*.exp +*.lib +eclipse_*.dll +com_*.dll diff --git a/bundles/org.eclipse.equinox.executable/library/wpf/build.bat b/bundles/org.eclipse.equinox.executable/library/wpf/build.bat new file mode 100644 index 000000000..3f2ff663e --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/library/wpf/build.bat @@ -0,0 +1,124 @@ +@rem ******************************************************************************* +@rem Copyright (c) 2000, 2005 IBM Corporation and others. +@rem All rights reserved. This program and the accompanying materials +@rem are made available under the terms of the Eclipse Public License v1.0 +@rem which accompanies this distribution, and is available at +@rem http://www.eclipse.org/legal/epl-v10.html +@rem +@rem Contributors: +@rem IBM Corporation - initial API and implementation +@rem Kevin Cornell (Rational Software Corporation) +@rem ********************************************************************** +@rem +@rem Usage: sh build.sh [<optional switches>] [clean] +@rem +@rem where the optional switches are: +@rem -output <PROGRAM_OUTPUT> - executable filename ("eclipse") +@rem -library <PROGRAM_LIBRARY>- dll filename (eclipse.dll) +@rem -os <DEFAULT_OS> - default Eclipse "-os" value (qnx) +@rem -arch <DEFAULT_OS_ARCH> - default Eclipse "-arch" value (x86) +@rem -ws <DEFAULT_WS> - default Eclipse "-ws" value (photon) +@rem -java <JAVA_HOME> - location of a Java SDK for JNI headers +@rem +@rem +@rem This script can also be invoked with the "clean" argument. +@rem +@rem NOTE: The C compiler needs to be setup. This script has been +@rem tested against Microsoft Visual C and C++ Compiler 6.0. +@rem +@rem Uncomment the lines below and edit MSVC_HOME to point to the +@rem correct root directory of the compiler installation, if you +@rem want this to be done by this script. +@rem +@rem ****** +@echo off + +IF NOT "%JAVA_HOME%"=="" GOTO MSVC +rem ***** +rem Javah +rem ***** +set JAVA_HOME="C:\Program Files\IBM\Java50" + +:MSVC + +call "J:\dev\PRODUCTS\PLATSDK\March2007VistaRTM\Bin\setenv.cmd" /vista +:MAKE + +rem -------------------------- +rem Define default values for environment variables used in the makefiles. +rem -------------------------- +set programOutput=eclipse.exe +set programLibrary=eclipse.dll +set defaultOS=win32 +set defaultOSArch=x86 +set defaultWS=wpf +set makefile=make_wpf.mak +set OS=Windows + +rem -------------------------- +rem Parse the command line arguments and override the default values. +rem -------------------------- +set extraArgs= +:WHILE +if "%1" == "" goto WHILE_END + if "%2" == "" goto LAST_ARG + + if "%1" == "-os" ( + set defaultOS=%2 + shift + goto NEXT ) + if "%1" == "-arch" ( + set defaultOSArch=%2 + shift + goto NEXT ) + if "%1" == "-ws" ( + set defaultWS=%2 + shift + goto NEXT ) + if "%1" == "-output" ( + set programOutput=%2 + shift + goto NEXT ) + if "%1" == "-library" ( + set programLibrary=%2 + shift + goto NEXT ) + if "%1" == "-java" ( + set javaHome=%2 + shift + goto NEXT ) +:LAST_ARG + set extraArgs=%extraArgs% %1 + +:NEXT + shift + goto WHILE +:WHILE_END + +rem -------------------------- +rem Set up environment variables needed by the makefile. +rem -------------------------- +set PROGRAM_OUTPUT=%programOutput% +set PROGRAM_LIBRARY=%programLibrary% +set DEFAULT_OS=%defaultOS% +set DEFAULT_OS_ARCH=%defaultOSArch% +set DEFAULT_WS=%defaultWS% +set OUTPUT_DIR=..\..\bin\%defaultWS%\%defaultOS%\%defaultOSArch% +set JAVA_HOME=%javaHome% + +rem -------------------------- +rem Run nmake to build the executable. +rem -------------------------- +if "%extraArgs%" == "" goto MAKE_ALL + +nmake -f %makefile% %extraArgs% +goto DONE + +:MAKE_ALL +echo Building %OS% launcher. Defaults: -os %DEFAULT_OS% -arch %DEFAULT_OS_ARCH% -ws %DEFAULT_WS% +nmake -f %makefile% clean +nmake -f %makefile% %1 %2 %3 %4 +goto DONE + + +:DONE diff --git a/bundles/org.eclipse.equinox.executable/library/wpf/build.xml b/bundles/org.eclipse.equinox.executable/library/wpf/build.xml new file mode 100644 index 000000000..f4b96fe70 --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/library/wpf/build.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project default="build_eclipse" basedir="."> + +<target name="build_eclipse"> + <exec dir="." executable="${basedir}\build.bat"> + <arg line="install"/> + </exec> + <eclipse.refreshLocal resource="org.eclipse.equinox.executable" depth="infinite" /> +</target> + +<target name="clean"> + <tstamp/> + <exec dir="." executable="${basedir}\build.bat"> + <arg line="clean"/> + </exec> +</target> + +</project>
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.executable/library/wpf/com.c b/bundles/org.eclipse.equinox.executable/library/wpf/com.c new file mode 100644 index 000000000..35ce38514 --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/library/wpf/com.c @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 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 + *******************************************************************************/ + +#include <jni.h> +#include <ole2.h> + +#define COM_NATIVE(func) Java_org_eclipse_equinox_launcher_JNIBridge_##func + +JNIEXPORT jint JNICALL COM_NATIVE(OleInitialize) + (JNIEnv *env, jclass that, jint arg0) +{ + return (jint)OleInitialize((LPVOID)arg0); +} + +JNIEXPORT void JNICALL COM_NATIVE(OleUninitialize) + (JNIEnv *env, jclass that) +{ + OleUninitialize(); +} + diff --git a/bundles/org.eclipse.equinox.executable/library/wpf/eclipse.exe.manifest b/bundles/org.eclipse.equinox.executable/library/wpf/eclipse.exe.manifest new file mode 100644 index 000000000..807ca7db7 --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/library/wpf/eclipse.exe.manifest @@ -0,0 +1,8 @@ +<?xml version='1.0' encoding='UTF-8' standalone='yes'?> +<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> + <dependency> + <dependentAssembly> + <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> + </dependentAssembly> + </dependency> +</assembly> diff --git a/bundles/org.eclipse.equinox.executable/library/wpf/eclipse.ico b/bundles/org.eclipse.equinox.executable/library/wpf/eclipse.ico Binary files differnew file mode 100644 index 000000000..5b2f132dd --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/library/wpf/eclipse.ico diff --git a/bundles/org.eclipse.equinox.executable/library/wpf/eclipse.rc b/bundles/org.eclipse.equinox.executable/library/wpf/eclipse.rc new file mode 100644 index 000000000..fb54e4e4a --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/library/wpf/eclipse.rc @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2000, 2005 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 + *******************************************************************************/ + +#define ECLIPSE_ICON 401 + +#include "windows.h" +#include "winver.h" + + +ECLIPSE_ICON ICON DISCARDABLE "eclipse.ico" + +//CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "eclipse.exe.manifest" + diff --git a/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpf.cpp b/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpf.cpp new file mode 100644 index 000000000..3acacb4c6 --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpf.cpp @@ -0,0 +1,440 @@ +/******************************************************************************* + * Copyright (c) 2000, 2005 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 + * Kevin Cornell (Rational Software Corporation) + *******************************************************************************/ + +extern "C" { + +#include "eclipseOS.h" +#include "eclipseUtil.h" +#include "eclipseCommon.h" + +#include <process.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <sys/stat.h> + +using namespace System; +using namespace System::IO; +using namespace System::Windows; +using namespace System::Windows::Input; +using namespace System::Windows::Media; +using namespace System::Windows::Media::Imaging; +using namespace System::Windows::Controls; +using namespace System::Windows::Threading; +using namespace System::Runtime::InteropServices; +using namespace System::ComponentModel; + + +/* Global Variables */ +_TCHAR* defaultVM = _T("javaw.exe"); +_TCHAR* vmLibrary = _T("jvm.dll"); +_TCHAR* shippedVMDir = _T("jre\\bin\\"); + +/* Define the window system arguments for the Java VM. */ +static _TCHAR* argVM[] = { NULL }; + +/* Define local variables for running the JVM and detecting its exit. */ +static int jvmProcess = 0; +static int jvmExitCode = 0; +static int jvmExitTimeout = 100; +static int jvmExitTimerId = 99; + +static void CALLBACK detectJvmExit (); +static _TCHAR* checkVMRegistryKey(HKEY jrekey, _TCHAR* subKeyName); + +/* define default locations in which to find the jvm shared library + * these are paths relative to the java exe, the shared library is + * for example jvmLocations[0] + dirSeparator + vmLibrary */ +#define MAX_LOCATION_LENGTH 25 /* none of the jvmLocations strings should be longer than this */ +static const _TCHAR* jvmLocations [] = { _T("j9vm"), _T("..\\jre\\bin\\j9vm"), + _T("client"), _T("..\\jre\\bin\\client"), + _T("server"), _T("..\\jre\\bin\\server"), + _T("classic"), _T("..\\jre\\bin\\classic"), + _T("jrockit"), _T("..\\jre\\bin\\jrockit"), + NULL }; + +delegate void NoArgsHandler (); + +public ref class Globals { +public: + static Window^ window = nullptr; + static DispatcherFrame^ frame = nullptr; + + static void HandleDispatcherInactive (Object^ o, EventArgs^ e) { + if (frame != nullptr) frame->Continue = false; + } + static void HandleClosing (Object^ o, CancelEventArgs^ e) { + window = nullptr; + } + static void HandleTimer (Object^ o, EventArgs^ e) { + detectJvmExit(); + if (jvmProcess == 0) { + if (frame != nullptr) { + frame->Continue = false; + } + } + } + static void CloseWindow () { + if (window != nullptr) { + window->Close(); + window = nullptr; + } + } +}; + + +/* Show the Splash Window + * + * Open the bitmap, insert into the splash window and display it. + * + */ +int showSplash( const _TCHAR* featureImage ) +{ + static int splashing = 0; + + if(splashing) { + /*splash screen is already showing, do nothing */ + return 0; + } + if (featureImage == NULL) + return -1; + + /* if Java was started first and is calling back to show the splash, we might not + * have initialized the window system yet + */ + initWindowSystem(0, NULL, 1); + + /* Load the bitmap for the feature. */ + BitmapSource^ image = nullptr; + if (featureImage != NULL) { + String^ string = gcnew String (featureImage); + if (File::Exists (string)) { + Uri^ uri = gcnew Uri (string); + image = gcnew BitmapImage (uri); + } + } + + /* If the bitmap could not be found, return an error. */ + if (image == nullptr) + return ERROR_FILE_NOT_FOUND; + + /* Create a window that has no decorations. */ + Window^ window = Globals::window = gcnew Window(); + window->Closing += gcnew CancelEventHandler(&Globals::HandleClosing); + window->WindowStyle = WindowStyle::None; + window->ShowInTaskbar = false; + window->ResizeMode = ResizeMode::NoResize; + window->WindowStartupLocation = WindowStartupLocation::CenterScreen; + KeyboardNavigation::SetTabNavigation (window, KeyboardNavigationMode::None); + + Grid^ grid = gcnew Grid(); + GridLength length (1, GridUnitType::Auto); + ColumnDefinition^ column = gcnew ColumnDefinition(); + grid->ColumnDefinitions->Add (column); + column = gcnew ColumnDefinition(); + column->Width = length; + grid->ColumnDefinitions->Add (column); + RowDefinition^ row = gcnew RowDefinition (); + row->Height = length; + grid->RowDefinitions->Add (row); + row = gcnew RowDefinition (); + grid->RowDefinitions->Add (row); + row = gcnew RowDefinition (); + row->Height = length; + grid->RowDefinitions->Add (row); + window->Content = grid; + + Canvas^ canvas = gcnew Canvas (); + canvas->FocusVisualStyle = nullptr; + canvas->Focusable = true; + Grid::SetRow (canvas, 1); + Grid::SetColumn (canvas, 0); + grid->Children->Add (canvas); + + ImageBrush^ brush = gcnew ImageBrush(image); + canvas->Background = brush; + + window->Width = image->Width; + window->Height = image->Height; + window->Show(); + + splashing = 1; + + /* Process messages */ + dispatchMessages(); + return 0; +} + +void dispatchMessages() { + DispatcherFrame^ frame = gcnew DispatcherFrame(); + Globals::frame = frame; + EventHandler^ handler = gcnew EventHandler (&Globals::HandleDispatcherInactive); + Dispatcher^ dispatcher = Dispatcher::CurrentDispatcher; + DispatcherHooks^ hooks = dispatcher->Hooks; + hooks->DispatcherInactive += handler; + Dispatcher::PushFrame (frame); + hooks->DispatcherInactive -= handler; + Globals::frame = nullptr; +} + +long getSplashHandle() { + Window^ window = Globals::window; + return (long)(int)GCHandle::ToIntPtr(GCHandle::Alloc(window)); +} + +void takeDownSplash() { + if (false) { + NoArgsHandler^ handler = gcnew NoArgsHandler(&Globals::CloseWindow); + Dispatcher::CurrentDispatcher->BeginInvoke(DispatcherPriority::Send, handler); + } else { + Window^ window = Globals::window; + if(window != nullptr) { + window->Close (); + window = nullptr; + dispatchMessages(); + } + } +} + +/* Get the window system specific VM args */ +_TCHAR** getArgVM( _TCHAR *vm ) +{ + return argVM; +} + +/* Local functions */ + +/* + * Find the VM shared library starting from the java executable + */ +_TCHAR* findVMLibrary( _TCHAR* command ) { + int i, j; + int pathLength; + struct _stat stats; + _TCHAR * path; /* path to resulting jvm shared library */ + _TCHAR * location; /* points to begining of jvmLocations section of path */ + + /* for looking in the registry */ + HKEY jreKey = NULL; + DWORD length = MAX_PATH; + _TCHAR keyName[MAX_PATH]; + _TCHAR * jreKeyName; + + if (command != NULL) { + location = _tcsrchr( command, dirSeparator ) + 1; + + /*check first to see if command already points to the library */ + if (isVMLibrary(command)) { + return command; + } + + pathLength = location - command; + path = (_TCHAR *)malloc((pathLength + MAX_LOCATION_LENGTH + 1 + _tcslen(vmLibrary) + 1) * sizeof(_TCHAR)); + _tcsncpy(path, command, pathLength); + location = &path[pathLength]; + + /* + * We are trying base/jvmLocations[*]/vmLibrary + * where base is the directory containing the given java command, normally jre/bin + */ + i = -1; + while(jvmLocations[++i] != NULL) { + _stprintf(location, _T_ECLIPSE("%s%c%s"), jvmLocations[i], dirSeparator, vmLibrary); + if (_tstat( path, &stats ) == 0 && (stats.st_mode & S_IFREG) != 0) + { /* found it */ + return path; + } + } + } + + /* Not found yet, try the registry, we will use the first vm >= 1.4 */ + jreKeyName = _T("Software\\JavaSoft\\Java Runtime Environment"); + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, jreKeyName, 0, KEY_READ, &jreKey) == ERROR_SUCCESS) { + if(RegQueryValueEx(jreKey, _T_ECLIPSE("CurrentVersion"), NULL, NULL, (LPBYTE)&keyName, &length) == ERROR_SUCCESS) { + path = checkVMRegistryKey(jreKey, keyName); + if (path != NULL) { + RegCloseKey(jreKey); + return path; + } + } + j = 0; + length = MAX_PATH; + while (RegEnumKeyEx(jreKey, j++, keyName, &length, 0, 0, 0, 0) == ERROR_SUCCESS) { + /*look for a 1.4 or 1.5 vm*/ + if( _tcsncmp(_T("1.4"), keyName, 3) <= 0 ) { + path = checkVMRegistryKey(jreKey, keyName); + if (path != NULL) { + RegCloseKey(jreKey); + return path; + } + } + } + RegCloseKey(jreKey); + } + return NULL; +} + +/* + * Read the subKeyName subKey of jreKey and look to see if it has a Value + * "RuntimeLib" which points to a jvm library we can use + * + * Does not close jreKey + */ +static _TCHAR* checkVMRegistryKey(HKEY jreKey, _TCHAR* subKeyName) { + _TCHAR value[MAX_PATH]; + HKEY subKey = NULL; + DWORD length = MAX_PATH; + _TCHAR *result = NULL; + struct _stat stats; + + if(RegOpenKeyEx(jreKey, subKeyName, 0, KEY_READ, &subKey) == ERROR_SUCCESS) { + /*The RuntimeLib value should point to the library we want*/ + if(RegQueryValueEx(subKey, _T("RuntimeLib"), NULL, NULL, (LPBYTE)&value, &length) == ERROR_SUCCESS) { + if (_tstat( value, &stats ) == 0 && (stats.st_mode & S_IFREG) != 0) + { /*library exists*/ + result = _tcsdup(value); + } + } + RegCloseKey(subKey); + } + return result; +} + +static _TCHAR* buildCommandLine( _TCHAR* program, _TCHAR* args[] ) +{ + int index, length = 0; + _TCHAR *commandLine, *ch, *space; + + /* + * Build the command line. Any argument with spaces must be in + * double quotes in the command line. + */ + if(program != NULL) + length = _tcslen(program) + 1; + for (index = 0; args[index] != NULL; index++) + { + /* String length plus space character */ + length += _tcslen( args[ index ] ) + 1; + /* Quotes */ + if (_tcschr( args[ index ], _T(' ') ) != NULL) length += 2; + } + + commandLine = ch = (_TCHAR *)malloc ( (length + 1) * sizeof(_TCHAR) ); + if (program != NULL) { + _tcscpy(ch, program); + ch += _tcslen(program); + *ch++ = _T(' '); + } + for (index = 0; args[index] != NULL; index++) + { + space = _tcschr( args[ index ], _T(' ')); + if (space != NULL) *ch++ = _T('\"'); + _tcscpy( ch, args[index] ); + ch += _tcslen( args[index] ); + if (space != NULL) *ch++ = _T('\"'); + *ch++ = _T(' '); + } + *ch = _T('\0'); + return commandLine; +} +void restartLauncher( _TCHAR* program, _TCHAR* args[] ) +{ + _TCHAR* commandLine = buildCommandLine(program, args); + + { + STARTUPINFO si; + PROCESS_INFORMATION pi; + GetStartupInfo(&si); + if (CreateProcess(NULL, commandLine, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) { + CloseHandle( pi.hThread ); + } + } + free(commandLine); +} + +int launchJavaVM( _TCHAR* args[] ) +{ + MSG msg; + _TCHAR* commandLine; + jvmProcess = -1; + commandLine = buildCommandLine(NULL, args); + /* + * Start the Java virtual machine. Use CreateProcess() instead of spawnv() + * otherwise the arguments cannot be freed since spawnv() segments fault. + */ + { + STARTUPINFO si; + PROCESS_INFORMATION pi; + GetStartupInfo(&si); + if (CreateProcess(NULL, commandLine, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) { + CloseHandle( pi.hThread ); + jvmProcess = (int)pi.hProcess; + } + } + + free( commandLine ); + + /* If the child process (JVM) would not start */ + if (jvmProcess == -1) + { + /* Return the error number. */ + jvmExitCode = errno; + jvmProcess = 0; + } + + /* else */ + else + { + + /* Set a timer to detect JVM process termination. */ + DispatcherTimer^ timer = gcnew DispatcherTimer(); + timer->Interval = TimeSpan::FromMilliseconds (jvmExitTimeout); + timer->Tick += gcnew EventHandler(&Globals::HandleTimer); + + /* Process messages until the JVM terminates. + This launcher process must continue to process events until the JVM exits + or else Windows 2K will hang if the desktop properties (e.g., background) are + changed by the user. Windows does a SendMessage() to every top level window + process, which blocks the caller until the process responds. */ + + DispatcherFrame^ frame = gcnew DispatcherFrame(); + Globals::frame = frame; + timer->Start(); + Dispatcher::PushFrame(frame); + Globals::frame = nullptr; + timer->Stop(); + + } + + /* Return the exit code from the JVM. */ + return jvmExitCode; +} + +/* Detect JVM Process Termination */ +static void CALLBACK detectJvmExit () +{ + DWORD exitCode; + /* If the JVM process has terminated */ + if (!GetExitCodeProcess( (HANDLE)jvmProcess, &exitCode ) || + exitCode != STILL_ACTIVE) + { + /* Save the JVM exit code. This should cause the loop in startJavaVM() to exit. */ + jvmExitCode = exitCode; + jvmProcess = 0; + } +} + +void processVMArgs(_TCHAR **vmargs[] ) { +// /* nothing yet */ +} + +} // extern "C" diff --git a/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpfCommon.cpp b/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpfCommon.cpp new file mode 100644 index 000000000..0d86bad1f --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpfCommon.cpp @@ -0,0 +1,90 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ + + +extern "C" { + +#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 ); +void displayMessage( _TCHAR* title, _TCHAR* message ); + +static int initialized = 0; + + +/* Load the specified shared library + */ +void * loadLibrary( _TCHAR * library ){ + return (void *)LoadLibrary(library); +} + +/* Unload the shared library + */ +void unloadLibrary( void * handle ){ + FreeLibrary((HMODULE)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((HMODULE)handle, str); + free(str); + return result; +} + +_TCHAR* resolveSymlinks( _TCHAR* path ) { + /* no symlinks on windows */ + return path; +} + +} //end extern C + +/* Display a Message */ +void displayMessage( _TCHAR* title, _TCHAR* message ) +{ + if(!initialized) + initWindowSystem(0, NULL, 0); + + System::String^ titleStr = gcnew System::String (title); + System::String^ messageStr = gcnew System::String (message); + System::Windows::MessageBox::Show (messageStr, titleStr, System::Windows::MessageBoxButton::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; + initialized = 1; +} diff --git a/bundles/org.eclipse.equinox.executable/library/wpf/eclipse_1008.dll.manifest b/bundles/org.eclipse.equinox.executable/library/wpf/eclipse_1008.dll.manifest new file mode 100644 index 000000000..807ca7db7 --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/library/wpf/eclipse_1008.dll.manifest @@ -0,0 +1,8 @@ +<?xml version='1.0' encoding='UTF-8' standalone='yes'?> +<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> + <dependency> + <dependentAssembly> + <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> + </dependentAssembly> + </dependency> +</assembly> diff --git a/bundles/org.eclipse.equinox.executable/library/wpf/make_wpf.mak b/bundles/org.eclipse.equinox.executable/library/wpf/make_wpf.mak new file mode 100644 index 000000000..12073958a --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/library/wpf/make_wpf.mak @@ -0,0 +1,102 @@ +#****************************************************************************** +# Copyright (c) 2000, 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 +# Kevin Cornell (Rational Software Corporation) +#******************************************************************************* + +# Makefile for creating the eclipse launcher program. + +# This makefile expects the following environment variables set: +# +# PROGRAM_OUTPUT - the filename of the output executable +# PROGRAM_LIBRARY - the filename of the output dll library +# DEFAULT_OS - the default value of the "-os" switch +# DEFAULT_OS_ARCH - the default value of the "-arch" switch +# DEFAULT_WS - the default value of the "-ws" switch +# JAVA_HOME - the location of the Java for JNI includes +NODEBUG=1 +!include <..\make_version.mak> + +PROGRAM_LIBRARY = eclipse_$(LIB_VERSION).dll + +# Define the object modules to be compiled and flags. +MAIN_OBJS = eclipseMain.obj +COMMON_OBJS = eclipseConfig.obj eclipseCommon.obj eclipseWpfCommon.obj +DLL_OBJS = eclipse.obj eclipseWpf.obj eclipseUtil.obj eclipseJNI.obj eclipseShm.obj + +LIBS = kernel32.lib msvcrt.lib mscoree.lib +DLL_LIBS = kernel32.lib Advapi32.lib msvcrt.lib +LFLAGS = -CLRTHREADATTRIBUTE:STA /NODEFAULTLIB:LIBCMT /INCREMENTAL:NO /RELEASE /NOLOGO -subsystem:windows,4.0 -entry:wmainCRTStartup +DLL_LFLAGS = -CLRTHREADATTRIBUTE:STA /NODEFAULTLIB:LIBCMT /INCREMENTAL:NO /PDB:NONE -dll /BASE:0x10000000 /DLL +RES = eclipse.res +EXEC = eclipse.exe +DLL = $(PROGRAM_LIBRARY) +DEBUG = #$(cdebug) + +CFLAGS = -c -DUNICODE -DVISTA -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NON_CONFORMING_SWPRINTFS -I.. -DDEFAULT_OS="\"$(DEFAULT_OS)\"" \ + -DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \ + -DDEFAULT_WS="\"$(DEFAULT_WS)\"" \ + -I$(JAVA_HOME)\include -I$(JAVA_HOME)\include\win32 \ + $(cflags) + +WPF_HOME = C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0 +DOTNET_HOME = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 +CPPFLAGS = -clr /FU"$(WPF_HOME)\PresentationCore.dll" /FU"$(WPF_HOME)\PresentationFramework.dll" /FU$(DOTNET_HOME)\System.Data.dll /FU$(DOTNET_HOME)\System.dll /FU$(DOTNET_HOME)\System.Xml.dll /FU"$(WPF_HOME)\UIAutomationProvider.dll" /FU"$(WPF_HOME)\UIAutomationTypes.dll" /FU"$(WPF_HOME)\WindowsBase.dll" + + +all: $(EXEC) $(DLL) com + +eclipseMain.obj: ../eclipseUnicode.h ../eclipseCommon.h ../eclipseMain.c + $(CC) $(DEBUG) $(CFLAGS) $(cvarsdll) /Fo$*.obj ../eclipseMain.c + +eclipseCommon.obj: ../eclipseCommon.h ../eclipseUnicode.h ../eclipseCommon.c + $(CC) $(DEBUG) $(CFLAGS) $(cvarsdll) /Fo$*.obj ../eclipseCommon.c + +eclipse.obj: ../eclipseOS.h ../eclipseUnicode.h ../eclipse.c + $(CC) $(DEBUG) $(CFLAGS) $(cvarsdll) /Fo$*.obj ../eclipse.c + +eclipseUtil.obj: ../eclipseUtil.h ../eclipseUnicode.h ../eclipseUtil.c + $(CC) $(DEBUG) $(CFLAGS) $(cvarsdll) /Fo$*.obj ../eclipseUtil.c + +eclipseConfig.obj: ../eclipseConfig.h ../eclipseUnicode.h ../eclipseConfig.c + $(CC) $(DEBUG) $(CFLAGS) $(cvarsdll) /Fo$*.obj ../eclipseConfig.c + +eclipseWpf.obj: ../eclipseOS.h ../eclipseUnicode.h eclipseWpf.cpp + $(CC) $(DEBUG) $(CFLAGS) $(CPPFLAGS) $(cvarsdll) /Fo$*.obj eclipseWpf.cpp + +eclipseWpfCommon.obj: ../eclipseCommon.h eclipseWpfCommon.cpp + $(CC) $(DEBUG) $(CFLAGS) $(CPPFLAGS) $(cvarsdll) /Fo$*.obj eclipseWpfCommon.cpp + +eclipseJNI.obj: ../eclipseCommon.h ../eclipseOS.h ../eclipseJNI.c + $(CC) $(DEBUG) $(CFLAGS) $(cvarsdll) /Fo$*.obj ../eclipseJNI.c + +eclipseShm.obj: ../eclipseShm.h ../eclipseUnicode.h ../eclipseShm.c + $(CC) $(DEBUG) $(CFLAGS) $(cvarsdll) /Fo$*.obj ../eclipseShm.c + +$(EXEC): $(MAIN_OBJS) $(COMMON_OBJS) + rc.exe -r -fo $(RES) eclipse.rc + link $(LFLAGS) -out:$(PROGRAM_OUTPUT) $(MAIN_OBJS) $(COMMON_OBJS) $(RES) $(LIBS) + mt.exe -manifest $(PROGRAM_OUTPUT).manifest -outputresource:$(PROGRAM_OUTPUT);2 + +$(DLL): $(DLL_OBJS) $(COMMON_OBJS) + link $(DLL_LFLAGS) -out:$(PROGRAM_LIBRARY) $(DLL_OBJS) $(COMMON_OBJS) $(DLL_LIBS) + mt.exe -manifest $(PROGRAM_LIBRARY).manifest -outputresource:$(PROGRAM_LIBRARY);2 + +com.obj: com.c + $(CC) $(DEBUG) $(CFLAGS) $(cvarsdll) /Fo$*.obj com.c + +com: com.obj + link /DLL -out:com_$(LIB_VERSION).dll com.obj ole32.lib + +install: all + copy $(EXEC) $(OUTPUT_DIR) + del -f $(EXEC) $(MAIN_OBJS) $(DLL_OBJS) $(COMMON_OBJS) $(RES) + +clean: + del $(EXEC) $(DLL) $(MAIN_OBJS) $(DLL_OBJS) $(COMMON_OBJS) $(RES) *.manifest *.exp *.lib *.dll diff --git a/bundles/org.eclipse.equinox.executable/target.build.properties b/bundles/org.eclipse.equinox.executable/target.build.properties index a1098dbd1..8c324beda 100644 --- a/bundles/org.eclipse.equinox.executable/target.build.properties +++ b/bundles/org.eclipse.equinox.executable/target.build.properties @@ -16,6 +16,8 @@ root.permissions.755=${launcherName} root.win32.win32.x86=bin/win32/win32/x86 +root.win32.wpf.x86=bin/wpf/win32/x86 + root.linux.gtk.x86=bin/gtk/linux/x86,gtk_root root.linux.gtk.x86.permissions.755=libcairo-swt.so diff --git a/bundles/org.eclipse.equinox.executable/target.build.xml b/bundles/org.eclipse.equinox.executable/target.build.xml index 2ca331551..4c6073eb8 100644 --- a/bundles/org.eclipse.equinox.executable/target.build.xml +++ b/bundles/org.eclipse.equinox.executable/target.build.xml @@ -42,6 +42,15 @@ </copy> <chmod perm="755" dir="${feature.base}/win32.win32.x86/${collectingFolder}" includes="${launcherName}" /> </target> + + <target name="rootFileswin32_wpf_x86"> + <mkdir dir="${feature.base}/win32.wpf.x86/${collectingFolder}"/> + <copy todir="${feature.base}/win32.wpf.x86/${collectingFolder}" failonerror="true" overwrite="true"> + <fileset dir="${basedir}/bin/wpf/win32/x86" includes="**" /> + </copy> + <chmod perm="755" dir="${feature.base}/win32.wpf.x86/${collectingFolder}" includes="${launcherName}" /> + </target> + <target name="rootFilesmacosx_carbon_ppc"> <mkdir dir="${feature.base}/macosx.carbon.ppc/${collectingFolder}"/> <copy todir="${feature.base}/macosx.carbon.ppc/${collectingFolder}" failonerror="true" overwrite="true"> @@ -150,6 +159,7 @@ </target> <target name="rootFilesgroup_group_group"> <antcall target="rootFileswin32_win32_x86"/> + <antcall target="rootFileswin32_wpf_x86"/> <antcall target="rootFilesmacosx_carbon_ppc"/> <antcall target="rootFilesmacosx_carbon_x86"/> <antcall target="rootFileslinux_gtk_x86"/> |