diff --git a/resources/bundles/org.eclipse.core.resources.win32.x86_64/.project b/resources/bundles/org.eclipse.core.resources.win32.x86_64/.project deleted file mode 100644 index fe2c03b97cf..00000000000 --- a/resources/bundles/org.eclipse.core.resources.win32.x86_64/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.eclipse.core.resources.win32.x86_64 - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/resources/bundles/org.eclipse.core.resources.win32.x86_64/.settings/org.eclipse.core.resources.prefs b/resources/bundles/org.eclipse.core.resources.win32.x86_64/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0203a..00000000000 --- a/resources/bundles/org.eclipse.core.resources.win32.x86_64/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/resources/bundles/org.eclipse.core.resources.win32.x86_64/.settings/org.eclipse.core.runtime.prefs b/resources/bundles/org.eclipse.core.resources.win32.x86_64/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 5a0ad22d2a7..00000000000 --- a/resources/bundles/org.eclipse.core.resources.win32.x86_64/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -line.separator=\n diff --git a/resources/bundles/org.eclipse.core.resources.win32.x86_64/BUILD_INFO.txt b/resources/bundles/org.eclipse.core.resources.win32.x86_64/BUILD_INFO.txt deleted file mode 100644 index e6fbb82b543..00000000000 --- a/resources/bundles/org.eclipse.core.resources.win32.x86_64/BUILD_INFO.txt +++ /dev/null @@ -1,10 +0,0 @@ -Native Build Info: ------------------- - -platform: win32.x86_64 -built by: Szymon.Brandys@pl.ibm.com -build date: 29-Nov-2012 -OS Name: Microsoft Windows 7 -Compiler version: Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64 -Linker version: Microsoft (R) Incremental Linker Version 9.00.30729.01 -Java version: Standard Edition (ibm-java2-sdk-50-win-i386) diff --git a/resources/bundles/org.eclipse.core.resources.win32.x86_64/META-INF/MANIFEST.MF b/resources/bundles/org.eclipse.core.resources.win32.x86_64/META-INF/MANIFEST.MF deleted file mode 100644 index ef7d092f770..00000000000 --- a/resources/bundles/org.eclipse.core.resources.win32.x86_64/META-INF/MANIFEST.MF +++ /dev/null @@ -1,9 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %win32FragmentName -Bundle-SymbolicName: org.eclipse.core.resources.win32.x86_64;singleton:=true -Bundle-Version: 3.5.500.qualifier -Bundle-Vendor: %providerName -Fragment-Host: org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)" -Bundle-Localization: fragment -Eclipse-PlatformFilter: (& (osgi.os=win32) (osgi.arch=x86_64)) diff --git a/resources/bundles/org.eclipse.core.resources.win32.x86_64/about.html b/resources/bundles/org.eclipse.core.resources.win32.x86_64/about.html deleted file mode 100644 index 164f781a8fd..00000000000 --- a/resources/bundles/org.eclipse.core.resources.win32.x86_64/about.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - -About - - -

About This Content

- -

November 30, 2017

-

License

- -

- The Eclipse Foundation makes available all content in this plug-in - ("Content"). Unless otherwise indicated below, the Content - is provided to you under the terms and conditions of the Eclipse - Public License Version 2.0 ("EPL"). A copy of the EPL is - available at http://www.eclipse.org/legal/epl-2.0. - For purposes of the EPL, "Program" will mean the Content. -

- -

- If you did not receive this Content directly from the Eclipse - Foundation, the Content is being redistributed by another party - ("Redistributor") and different terms and conditions may - apply to your use of any object code in the Content. Check the - Redistributor's license that was provided with the Content. If no such - license exists, contact the Redistributor. Unless otherwise indicated - below, the terms and conditions of the EPL still apply to any source - code in the Content and such source code may be obtained at http://www.eclipse.org. -

- - - \ No newline at end of file diff --git a/resources/bundles/org.eclipse.core.resources.win32.x86_64/build.properties b/resources/bundles/org.eclipse.core.resources.win32.x86_64/build.properties deleted file mode 100644 index b15e6253c5e..00000000000 --- a/resources/bundles/org.eclipse.core.resources.win32.x86_64/build.properties +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -# Copyright (c) 2012, 2018 IBM Corporation and others. -# -# This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 2.0 -# which accompanies this distribution, and is available at -# https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -bin.includes = fragment.xml,\ - os/,\ - .,\ - META-INF/,\ - about.html,\ - fragment.properties -generateSourceBundle=false - diff --git a/resources/bundles/org.eclipse.core.resources.win32.x86_64/fragment.properties b/resources/bundles/org.eclipse.core.resources.win32.x86_64/fragment.properties deleted file mode 100644 index adf91a4725a..00000000000 --- a/resources/bundles/org.eclipse.core.resources.win32.x86_64/fragment.properties +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -# Copyright (c) 2018 IBM Corporation and others. -# -# This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 2.0 -# which accompanies this distribution, and is available at -# https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -providerName = Eclipse.org -win32FragmentName = Core Resource Management Win32 Fragment -win32MonitorFactoryName = Windows Auto-refresh monitor diff --git a/resources/bundles/org.eclipse.core.resources.win32.x86_64/fragment.xml b/resources/bundles/org.eclipse.core.resources.win32.x86_64/fragment.xml deleted file mode 100644 index b823b6b7e1e..00000000000 --- a/resources/bundles/org.eclipse.core.resources.win32.x86_64/fragment.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/resources/bundles/org.eclipse.core.resources.win32.x86_64/os/win32/x86_64/win32refresh.dll b/resources/bundles/org.eclipse.core.resources.win32.x86_64/os/win32/x86_64/win32refresh.dll deleted file mode 100644 index f93969d80b1..00000000000 Binary files a/resources/bundles/org.eclipse.core.resources.win32.x86_64/os/win32/x86_64/win32refresh.dll and /dev/null differ diff --git a/resources/bundles/org.eclipse.core.resources.win32.x86_64/pom.xml b/resources/bundles/org.eclipse.core.resources.win32.x86_64/pom.xml deleted file mode 100644 index 856c262acf6..00000000000 --- a/resources/bundles/org.eclipse.core.resources.win32.x86_64/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - 4.0.0 - - eclipse.platform.resources - org.eclipse.platform - 4.33.0-SNAPSHOT - ../../ - - org.eclipse.core.resources.win32.x86_64 - 3.5.500-SNAPSHOT - eclipse-plugin - - diff --git a/resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF b/resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF index 7bb930abfb4..ea812f15671 100644 --- a/resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF +++ b/resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF @@ -28,7 +28,8 @@ Export-Package: org.eclipse.core.internal.dtree;x-internal:=true, Require-Bundle: org.eclipse.ant.core;bundle-version="[3.1.0,4.0.0)";resolution:=optional, org.eclipse.core.expressions;bundle-version="[3.9.0,4.0.0)", org.eclipse.core.filesystem;bundle-version="[1.10.0,2.0.0)", - org.eclipse.core.runtime;bundle-version="[3.31.0,4.0.0)" + org.eclipse.core.runtime;bundle-version="[3.31.0,4.0.0)", + com.sun.jna;bundle-version="[5.14.0,6.0.0)" Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/ResourceChangeListenerRegistrar.xml, OSGI-INF/org.eclipse.core.internal.resources.CheckMissingNaturesListener.xml diff --git a/resources/bundles/org.eclipse.core.resources/build.properties b/resources/bundles/org.eclipse.core.resources/build.properties index a37441247a9..4b9091f7478 100644 --- a/resources/bundles/org.eclipse.core.resources/build.properties +++ b/resources/bundles/org.eclipse.core.resources/build.properties @@ -16,8 +16,7 @@ output.. = bin/ source.ant_tasks/resources-ant.jar = src_ant/ output.ant_tasks/resources-ant.jar = bin_ant/ src.includes = about.html,\ - schema/,\ - natives/ + schema/ bin.includes = plugin.xml,\ plugin.properties,\ .options,\ diff --git a/resources/bundles/org.eclipse.core.resources/natives/make.bat b/resources/bundles/org.eclipse.core.resources/natives/make.bat deleted file mode 100644 index be540736625..00000000000 --- a/resources/bundles/org.eclipse.core.resources/natives/make.bat +++ /dev/null @@ -1,30 +0,0 @@ -@rem *************************************************************************** -@rem Copyright (c) 2007, 2014 IBM Corporation and others. -@rem -@rem This program and the accompanying materials -@rem are made available under the terms of the Eclipse Public License 2.0 -@rem which accompanies this distribution, and is available at -@rem https://www.eclipse.org/legal/epl-2.0/ -@rem -@rem SPDX-License-Identifier: EPL-2.0 -@rem -@rem Contributors: -@rem IBM Corporation - initial API and implementation -@rem *************************************************************************** -@echo off -REM build JNI header file -cd %~dp0\..\src - -"%JAVA_HOME%\bin\javac" -h . org\eclipse\core\internal\resources\refresh\win32\Win32Natives.java -del org\eclipse\core\internal\resources\refresh\win32\Win32Natives.class -move org_eclipse_core_internal_resources_refresh_win32_Win32Natives.h ..\natives\ref.h - -REM compile and link -if "%MSVC_HOME%"=="" set MSVC_HOME=C:\Program Files\Microsoft Visual Studio\2022\Community -cd ..\natives - -set dll_name=win32refresh.dll - -call "%MSVC_HOME%\VC\Auxiliary\Build\vcvarsall.bat" amd64 -"cl.exe" -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32 -LD ref.c -Fe%dll_name% -move %dll_name% ..\..\org.eclipse.core.resources.win32.x86_64\os\win32\x86_64\%dll_name% \ No newline at end of file diff --git a/resources/bundles/org.eclipse.core.resources/natives/readme.txt b/resources/bundles/org.eclipse.core.resources/natives/readme.txt deleted file mode 100644 index e27ecd6c006..00000000000 --- a/resources/bundles/org.eclipse.core.resources/natives/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -This folder contains native code for supporting auto-refresh callbacks on Windows. -This source is in the base plugin because there are multiple Windows fragments that -share the same source. \ No newline at end of file diff --git a/resources/bundles/org.eclipse.core.resources/natives/ref.c b/resources/bundles/org.eclipse.core.resources/natives/ref.c deleted file mode 100644 index 7d005258f3a..00000000000 --- a/resources/bundles/org.eclipse.core.resources/natives/ref.c +++ /dev/null @@ -1,226 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2016 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - * Mikael Barbero (Eclipse Foundation) - 286681 handle WAIT_ABANDONED_0 return value - *******************************************************************************/ -#include -#include "ref.h" - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FindFirstChangeNotificationW - * Signature: (Ljava/lang/String;ZI)J - */ -JNIEXPORT jlong JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FindFirstChangeNotificationW -(JNIEnv * env, jclass this, jstring lpPathName, jboolean bWatchSubtree, jint dwNotifyFilter) { - jlong result; - jsize numberOfChars; - jchar *path; - const jchar *temp; - - // create a new byte array to hold the prefixed and null terminated path - numberOfChars= (*env)->GetStringLength(env, lpPathName); - path= malloc((numberOfChars + 5) * sizeof(jchar)); - //path= malloc((numberOfChars + 4) * sizeof(jchar)); - - // get the path characters from the vm, copy them, and release them - temp= (*env)->GetStringChars(env, lpPathName, JNI_FALSE); - memcpy(path + 4, temp, numberOfChars * sizeof(jchar)); - (*env)->ReleaseStringChars(env, lpPathName, temp); - - // prefix the path to enable long filenames, and null terminate it - path[0] = L'\\'; - path[1] = L'\\'; - path[2] = L'?'; - path[3] = L'\\'; - path[(numberOfChars + 4)] = L'\0'; - - // make the request and free the memory - //printf("%S\n", path); - result = (jlong) FindFirstChangeNotificationW(path, bWatchSubtree, dwNotifyFilter); - free(path); - - return result; -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FindCloseChangeNotification - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FindCloseChangeNotification -(JNIEnv *env, jclass this, jlong hChangeHandle){ - return (jboolean) FindCloseChangeNotification((HANDLE) hChangeHandle); -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FindNextChangeNotification - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FindNextChangeNotification -(JNIEnv *env, jclass this, jlong hChangeHandle){ - return (jboolean) FindNextChangeNotification((HANDLE) hChangeHandle); -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: WaitForMultipleObjects - * Signature: (I[JZI)I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_WaitForMultipleObjects -(JNIEnv *env, jclass this, jint nCount, jlongArray lpHandles, jboolean bWaitAll, jint dwMilliseconds) { - int i; - jint result; - HANDLE handles[MAXIMUM_WAIT_OBJECTS]; - jlong *handlePointers = (*env)->GetLongArrayElements(env, lpHandles, 0); - - for (i = 0; i < nCount; i++) { - handles[i] = (HANDLE) handlePointers[i]; - } - - result = WaitForMultipleObjects(nCount, handles, bWaitAll, dwMilliseconds); - (*env)->ReleaseLongArrayElements(env, lpHandles, handlePointers, 0); - - return result; -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: GetLastError - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_GetLastError -(JNIEnv *env, jclass this){ - return GetLastError(); -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FILE_NOTIFY_CHANGE_LAST_WRITE - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1LAST_1WRITE -(JNIEnv *env, jclass this) { - return FILE_NOTIFY_CHANGE_LAST_WRITE; -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FILE_NOTIFY_CHANGE_DIR_NAME - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1DIR_1NAME -(JNIEnv *env, jclass this) { - return FILE_NOTIFY_CHANGE_DIR_NAME; -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FILE_NOTIFY_CHANGE_SIZE - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1SIZE -(JNIEnv *env, jclass this) { - return FILE_NOTIFY_CHANGE_SIZE; -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FILE_NOTIFY_CHANGE_FILE_NAME - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1FILE_1NAME -(JNIEnv *env, jclass this) { - return FILE_NOTIFY_CHANGE_FILE_NAME; -} - - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: MAXIMUM_WAIT_OBJECTS - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_MAXIMUM_1WAIT_1OBJECTS -(JNIEnv *env, jclass this) { - return MAXIMUM_WAIT_OBJECTS; -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: WAIT_OBJECT_0 - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_WAIT_1OBJECT_10 -(JNIEnv *env, jclass this) { - return WAIT_OBJECT_0; -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: WAIT_ABANDONED_0 - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_WAIT_1ABANDONED_10 -(JNIEnv *env, jclass this) { - return WAIT_ABANDONED_0; -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: WAIT_FAILED - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_WAIT_1FAILED -(JNIEnv *env, jclass this) { - return WAIT_FAILED; -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: WAIT_TIMEOUT - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_WAIT_1TIMEOUT -(JNIEnv *env, jclass this) { - return WAIT_TIMEOUT; -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: ERROR_INVALID_HANDLE - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_ERROR_1INVALID_1HANDLE -(JNIEnv *env, jclass this) { - return ERROR_INVALID_HANDLE; -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: ERROR_SUCCESS - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_ERROR_1SUCCESS -(JNIEnv *env, jclass this) { - return ERROR_SUCCESS; -} - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: INVALID_HANDLE_VALUE - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_INVALID_1HANDLE_1VALUE -(JNIEnv * env, jclass this) { - return (jlong)INVALID_HANDLE_VALUE; -} diff --git a/resources/bundles/org.eclipse.core.resources/natives/ref.h b/resources/bundles/org.eclipse.core.resources/natives/ref.h deleted file mode 100644 index b8afc0e056d..00000000000 --- a/resources/bundles/org.eclipse.core.resources/natives/ref.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2004, 2024 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class org_eclipse_core_internal_resources_refresh_win32_Win32Natives */ - -#ifndef _Included_org_eclipse_core_internal_resources_refresh_win32_Win32Natives -#define _Included_org_eclipse_core_internal_resources_refresh_win32_Win32Natives -#ifdef __cplusplus -extern "C" { -#endif -#undef org_eclipse_core_internal_resources_refresh_win32_Win32Natives_ERROR_ACCESS_DENIED -#define org_eclipse_core_internal_resources_refresh_win32_Win32Natives_ERROR_ACCESS_DENIED 5L -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FindFirstChangeNotificationW - * Signature: (Ljava/lang/String;ZI)J - */ -JNIEXPORT jlong JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FindFirstChangeNotificationW - (JNIEnv *, jclass, jstring, jboolean, jint); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FindCloseChangeNotification - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FindCloseChangeNotification - (JNIEnv *, jclass, jlong); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FindNextChangeNotification - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FindNextChangeNotification - (JNIEnv *, jclass, jlong); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: WaitForMultipleObjects - * Signature: (I[JZI)I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_WaitForMultipleObjects - (JNIEnv *, jclass, jint, jlongArray, jboolean, jint); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: GetLastError - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_GetLastError - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FILE_NOTIFY_CHANGE_LAST_WRITE - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1LAST_1WRITE - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FILE_NOTIFY_CHANGE_DIR_NAME - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1DIR_1NAME - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FILE_NOTIFY_CHANGE_SIZE - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1SIZE - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: FILE_NOTIFY_CHANGE_FILE_NAME - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1FILE_1NAME - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: MAXIMUM_WAIT_OBJECTS - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_MAXIMUM_1WAIT_1OBJECTS - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: WAIT_OBJECT_0 - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_WAIT_1OBJECT_10 - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: WAIT_ABANDONED_0 - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_WAIT_1ABANDONED_10 - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: WAIT_FAILED - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_WAIT_1FAILED - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: WAIT_TIMEOUT - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_WAIT_1TIMEOUT - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: ERROR_INVALID_HANDLE - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_ERROR_1INVALID_1HANDLE - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: ERROR_SUCCESS - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_ERROR_1SUCCESS - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives - * Method: INVALID_HANDLE_VALUE - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_INVALID_1HANDLE_1VALUE - (JNIEnv *, jclass); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/MonitorManager.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/MonitorManager.java index d5accd516cd..007976427da 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/MonitorManager.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/MonitorManager.java @@ -15,16 +15,43 @@ *******************************************************************************/ package org.eclipse.core.internal.refresh; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.eclipse.core.internal.events.ILifecycleListener; import org.eclipse.core.internal.events.LifecycleEvent; import org.eclipse.core.internal.resources.Workspace; +import org.eclipse.core.internal.resources.refresh.win32.Win32RefreshProvider; import org.eclipse.core.internal.utils.Messages; import org.eclipse.core.internal.utils.Policy; -import org.eclipse.core.resources.*; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IPathVariableChangeEvent; +import org.eclipse.core.resources.IPathVariableChangeListener; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceDeltaVisitor; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.refresh.IRefreshMonitor; import org.eclipse.core.resources.refresh.RefreshProvider; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.ICoreRunnable; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; /** * Manages monitors by creating new monitors when projects are added and @@ -78,6 +105,9 @@ private RefreshProvider[] getRefreshProviders() { IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PT_REFRESH_PROVIDERS); IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); List providerList = new ArrayList<>(infos.length); + if (Platform.OS.isWindows()) { + providerList.add(new Win32RefreshProvider()); + } for (IConfigurationElement configurationElement : infos) { RefreshProvider provider = null; try { diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/refresh/win32/Win32Natives.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/refresh/win32/Win32Natives.java index 46bc0973fd4..26c40e89e15 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/refresh/win32/Win32Natives.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/refresh/win32/Win32Natives.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2016 IBM Corporation and others. + * Copyright (c) 2002, 2024 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -11,101 +11,131 @@ * Contributors: * IBM - Initial API and implementation * Mikael Barbero (Eclipse Foundation) - 286681 handle WAIT_ABANDONED_0 return value + * Hannes Wellmann - Migrate Win32Natives to use JNA instead of JNI to avoid native binaries and platform-specific fragments *******************************************************************************/ + package org.eclipse.core.internal.resources.refresh.win32; +import com.sun.jna.Native; +import com.sun.jna.NativeLibrary; +import com.sun.jna.WString; + /** * Hooks for native methods involved with win32 auto-refresh callbacks. */ public class Win32Natives { + + /** Access is denied. */ + public static final int ERROR_ACCESS_DENIED = 5; + + // All constants and native methods are defined with the exact same name + // in the native windows.h or a referenced header file. + /* general purpose */ /** * A general use constant expressing the value of an * invalid handle. */ - public static final long INVALID_HANDLE_VALUE; + public static final long INVALID_HANDLE_VALUE = -1; // handleapi.h /** * An error constant which indicates that the previous function * succeeded. */ - public static final int ERROR_SUCCESS; + public static final int ERROR_SUCCESS = 0; // winerror.h /** * An error constant which indicates that a handle is or has become * invalid. */ - public static final int ERROR_INVALID_HANDLE; - - /** Access is denied. */ - public static final int ERROR_ACCESS_DENIED = 5; + public static final int ERROR_INVALID_HANDLE = 6; // winerror.h /** * A constant which indicates the maximum number of objects * that can be passed into WaitForMultipleObjects. */ - public static final int MAXIMUM_WAIT_OBJECTS; + public static final int MAXIMUM_WAIT_OBJECTS = 64; // winnt.h /* wait return values */ /** * A constant used returned WaitForMultipleObjects when the function times out. */ - public static final int WAIT_TIMEOUT; + public static final int WAIT_TIMEOUT = 258; // winerror.h /** * A constant used by WaitForMultipleObjects to indicate the object which was * signaled. */ - public static final int WAIT_OBJECT_0; + public static final int WAIT_OBJECT_0 = 0; // winbase.h /** * A constant which indicates that some objects which * were waiting to be signaled are an abandoned mutex * objects. */ - public static final int WAIT_ABANDONED_0; + public static final int WAIT_ABANDONED_0 = 128; // winbase.h /** * A constant returned by WaitForMultipleObjects which indicates * that the wait failed. */ - public static final int WAIT_FAILED; + public static final int WAIT_FAILED = -1; // winbase.h /* wait notification filter masks */ /** * Change filter for monitoring file rename, creation or deletion. */ - public static final int FILE_NOTIFY_CHANGE_FILE_NAME; + public static final int FILE_NOTIFY_CHANGE_FILE_NAME = 1; // winnt.h /** * Change filter for monitoring directory creation or deletion. */ - public static final int FILE_NOTIFY_CHANGE_DIR_NAME; + public static final int FILE_NOTIFY_CHANGE_DIR_NAME = 2; // winnt.h /** * Change filter for monitoring file size changes. */ - public static final int FILE_NOTIFY_CHANGE_SIZE; + public static final int FILE_NOTIFY_CHANGE_SIZE = 8; // winnt.h /** * Change filter for monitoring the file write timestamp */ - public static final int FILE_NOTIFY_CHANGE_LAST_WRITE; + public static final int FILE_NOTIFY_CHANGE_LAST_WRITE = 16; // winnt.h - /* - * Make requests to set the constants. - */ - static { - System.loadLibrary("win32refresh"); //$NON-NLS-1$ - INVALID_HANDLE_VALUE = INVALID_HANDLE_VALUE(); - ERROR_SUCCESS = ERROR_SUCCESS(); - ERROR_INVALID_HANDLE = ERROR_INVALID_HANDLE(); + private static class WindowsH { + static { + Native.register(NativeLibrary + .getInstance("Kernel32" /* , W32APIOptions.DEFAULT_OPTIONS < type-conversion unnecessary> */)); //$NON-NLS-1$ + } + + // Direct-mappings are faster than interface-mappings + // and avoiding type-conversions is faster again. + // https://github.com/java-native-access/jna/blob/master/www/FunctionalDescription.md#direct-mapping + + // WinNT's type 'HANDLE is expressed as long + // (in winnt.h it is defined as 'typedef HANDLE *PHANDLE;') + + // Methods from fileapi.h header + + static native long FindFirstChangeNotificationW(WString lpPathName, int bWatchSubtree, int dwNotifyFilter); + + static native int FindCloseChangeNotification(long hChangeHandle); + + static native int FindNextChangeNotification(long hChangeHandle); + + // Methods from synchapi.h + + static native int WaitForMultipleObjects(int nCount, long[] lpHandles, int bWaitAll, int dwMilliseconds); - MAXIMUM_WAIT_OBJECTS = MAXIMUM_WAIT_OBJECTS(); + // direct type conversion methods - WAIT_TIMEOUT = WAIT_TIMEOUT(); - WAIT_OBJECT_0 = WAIT_OBJECT_0(); - WAIT_ABANDONED_0 = WAIT_ABANDONED_0(); - WAIT_FAILED = WAIT_FAILED(); + static WString fromString(String value) { + return new WString(value); + } - FILE_NOTIFY_CHANGE_FILE_NAME = FILE_NOTIFY_CHANGE_FILE_NAME(); - FILE_NOTIFY_CHANGE_DIR_NAME = FILE_NOTIFY_CHANGE_DIR_NAME(); - FILE_NOTIFY_CHANGE_SIZE = FILE_NOTIFY_CHANGE_SIZE(); - FILE_NOTIFY_CHANGE_LAST_WRITE = FILE_NOTIFY_CHANGE_LAST_WRITE(); + static int fromBoolean(boolean value) { + return value ? 1 : 0; + } + + static boolean toBoolean(int value) { + return value != 0; + } } + private static final String LONG_PATH_PREFIX = "\\\\?\\"; //$NON-NLS-1$ + /** * Creates a change notification object for the given path. The notification * object allows the client to monitor changes to the directory and the @@ -127,29 +157,11 @@ public class Win32Natives { * ERROR_INVALID_HANDLE if the attempt fails. */ public static long FindFirstChangeNotification(String lpPathName, boolean bWatchSubtree, int dwNotifyFilter) { - return FindFirstChangeNotificationW(lpPathName, bWatchSubtree, dwNotifyFilter); + WString wPathName = WindowsH + .fromString(!lpPathName.startsWith(LONG_PATH_PREFIX) ? LONG_PATH_PREFIX + lpPathName : lpPathName); + return WindowsH.FindFirstChangeNotificationW(wPathName, WindowsH.fromBoolean(bWatchSubtree), dwNotifyFilter); } - /** - * Creates a change notification object for the given path. This notification object - * allows the client to monitor changes to the directory and the subtree - * under the directory using FindNextChangeNotification or - * WaitForMultipleObjects. - * - * @param lpPathName The path to the directory to be monitored. Cannot be null, - * or longer than 2^15 - 1 characters. - * @param bWatchSubtree If true, specifies that the entire - * tree under the given path should be monitored. If false - * specifies that just the named path should be monitored. - * @param dwNotifyFilter Any combination of FILE_NOTIFY_CHANGE_FILE_NAME, - * FILE_NOTIFY_CHANGE_DIR_NAME, FILE_NOTIFY_CHANGE_ATTRIBUTES, - * FILE_NOTIFY_CHANGE_SIZE, FILE_NOTIFY_CHANGE_LAST_WRITE, or - * FILE_NOTIFY_CHANGE_SECURITY. - * @return long The handle to the find change notification object or - * ERROR_INVALID_HANDLE if the attempt fails. - */ - private static native long FindFirstChangeNotificationW(String lpPathName, boolean bWatchSubtree, int dwNotifyFilter); - /** * Stops and disposes of the change notification object that corresponds to the given * handle. The handle cannot be used in future calls to FindNextChangeNotification or @@ -159,7 +171,9 @@ public static long FindFirstChangeNotification(String lpPathName, boolean bWatch * @return boolean true if the method succeeds, false * otherwise. */ - public static native boolean FindCloseChangeNotification(long hChangeHandle); + public static boolean FindCloseChangeNotification(long hChangeHandle) { + return WindowsH.toBoolean(WindowsH.FindCloseChangeNotification(hChangeHandle)); + } /** * Requests that the next change detected be signaled. This method should only be @@ -169,7 +183,9 @@ public static long FindFirstChangeNotification(String lpPathName, boolean bWatch * @param hChangeHandle a handle which was created with FindFirstChangeNotification * @return boolean true if the method succeeds, false otherwise. */ - public static native boolean FindNextChangeNotification(long hChangeHandle); + public static boolean FindNextChangeNotification(long hChangeHandle) { + return WindowsH.toBoolean(WindowsH.FindNextChangeNotification(hChangeHandle)); + } /** * Returns when one of the following occurs. @@ -191,84 +207,16 @@ public static long FindFirstChangeNotification(String lpPathName, boolean bWatch * WAIT_OBJECT_0 + n when a signal for the handle at index n. WAIT_FAILED when this * function fails. */ - public static native int WaitForMultipleObjects(int nCount, long[] lpHandles, boolean bWaitAll, int dwMilliseconds); + public static int WaitForMultipleObjects(int nCount, long[] lpHandles, boolean bWaitAll, int dwMilliseconds) { + return WindowsH.WaitForMultipleObjects(nCount, lpHandles, WindowsH.fromBoolean(bWaitAll), dwMilliseconds); + } /** * Answers the last error set in the current thread. * @return int the last error */ - public static native int GetLastError(); - - /** - * Returns the constant FILE_NOTIFY_CHANGE_LAST_WRITE. - * @return int - */ - private static native int FILE_NOTIFY_CHANGE_LAST_WRITE(); - - /** - * Returns the constant FILE_NOTIFY_CHANGE_DIR_NAME. - * @return int - */ - private static native int FILE_NOTIFY_CHANGE_DIR_NAME(); - - /** - * Returns the constant FILE_NOTIFY_CHANGE_SIZE. - * @return int - */ - private static native int FILE_NOTIFY_CHANGE_SIZE(); - - /** - * Returns the constant FILE_NOTIFY_CHANGE_FILE_NAME. - * @return int - */ - private static native int FILE_NOTIFY_CHANGE_FILE_NAME(); - - /** - * Returns the constant MAXIMUM_WAIT_OBJECTS. - * @return int - */ - private static native int MAXIMUM_WAIT_OBJECTS(); - - /** - * Returns the constant WAIT_OBJECT_0. - * @return int - */ - private static native int WAIT_OBJECT_0(); - - /** - * Returns the constant WAIT_ABANDONED_0. - * @return int - */ - private static native int WAIT_ABANDONED_0(); - - /** - * Returns the constant WAIT_FAILED. - * @return int - */ - private static native int WAIT_FAILED(); - - /** - * Returns the constant WAIT_TIMEOUT. - * @return int - */ - private static native int WAIT_TIMEOUT(); - - /** - * Returns the constant ERROR_INVALID_HANDLE. - * @return int - */ - private static native int ERROR_INVALID_HANDLE(); - - /** - * Returns the constant ERROR_SUCCESS. - * @return int - */ - private static native int ERROR_SUCCESS(); - - /** - * Returns the constant INVALID_HANDLE_VALUE. - * @return long - */ - private static native long INVALID_HANDLE_VALUE(); + public static int GetLastError() { + return Native.getLastError(); + } }