Skip to content

Commit 5306d26

Browse files
authored
Merge branch 'eclipse-platform:master' into close_all_editors_e4_contribs
2 parents c5bff4f + 83bf670 commit 5306d26

File tree

59 files changed

+780
-144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+780
-144
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ For more information, refer to the [Eclipse Platform project page](https://proje
1616

1717
Contributions are most welcome. There are many ways to contribute, from entering high quality bug reports, to contributing code or documentation changes.
1818

19-
For a complete guide, see the https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md.
19+
For a complete guide, see the [CONTRIBUTING](https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md) page.
20+
21+
[![Create Eclipse Development Environment for Eclipse Platform UI](https://download.eclipse.org/oomph/www/setups/svg/Eclipse_Platform_UI.svg)](
22+
https://www.eclipse.org/setups/installer/?url=https://raw.githubusercontent.com/eclipse-platform/eclipse.platform.ui/master/releng/org.eclipse.ui.releng/platformUIConfiguration.setup&show=true
23+
"Click to open Eclipse-Installer Auto Launch or drag into your running installer")
2024

2125

2226
## Test Dependencies
@@ -27,10 +31,10 @@ Please install them by installing "Eclipse Test Framework" from the [current rel
2731

2832
## How to Build on the Command Line
2933

30-
You need Maven 3.8.x installed. After this you can run the build via the following command:
34+
You need Maven 3.9.x installed. After this you can run the build via the following command:
3135

3236
```
33-
mvn clean verify -Pbuild-individual-bundles
37+
mvn clean verify
3438
```
3539

3640

bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ContributedPartRenderer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@ public boolean setFocus() {
103103
Object object = part.getObject();
104104
if (object != null && isEnabled()) {
105105
IPresentationEngine pe = part.getContext().get(IPresentationEngine.class);
106-
pe.focusGui(part);
107-
return true;
106+
if (pe != null) {
107+
pe.focusGui(part);
108+
return true;
109+
}
108110
}
109111
return super.setFocus();
110112
} finally {

bundles/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ public boolean collapseAll(int offset, int length) {
147147
*/
148148
protected boolean expandAll(int offset, int length, boolean fireModelChanged) {
149149

150+
if (offset < 0 || length < 0) {
151+
return false;
152+
}
153+
150154
boolean expanding= false;
151155

152156
Iterator<Annotation> iterator= getAnnotationIterator(offset, length, true, true);

bundles/org.eclipse.jface/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.jface;singleton:=true
5-
Bundle-Version: 3.35.0.qualifier
5+
Bundle-Version: 3.35.100.qualifier
66
Bundle-Vendor: %providerName
77
Bundle-Localization: plugin
88
Export-Package: org.eclipse.jface,

bundles/org.eclipse.jface/src/org/eclipse/jface/window/Window.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,8 @@ public int getReturnCode() {
655655
/**
656656
* Returns this window's shell.
657657
*
658-
* @return this window's shell, or <code>null</code> if this window's
659-
* shell has not been created yet
658+
* @return this window's shell, or <code>null</code> if this window's shell has
659+
* not been created yet or if this window has been closed
660660
*/
661661
@Override
662662
public Shell getShell() {
Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2023 Red Hat Inc and others.
2+
* Copyright (c) 2023, 2024 Red Hat Inc and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,57 +16,38 @@
1616
import java.text.MessageFormat;
1717
import java.util.Arrays;
1818
import java.util.Collections;
19-
import java.util.List;
20-
import java.util.Map;
19+
import java.util.Comparator;
20+
import java.util.Optional;
2121

2222
import org.osgi.framework.BundleContext;
2323
import org.osgi.framework.InvalidSyntaxException;
2424
import org.osgi.framework.ServiceReference;
2525
import org.osgi.util.tracker.ServiceTracker;
2626

27-
import org.eclipse.core.resources.IFile;
28-
29-
import org.eclipse.jface.text.IDocument;
30-
3127
import org.eclipse.search.internal.core.text.DirtyFileProvider;
3228

33-
public class DirtyFileSearchParticipantServiceTracker
34-
extends ServiceTracker<DirtyFileProvider, DirtyFileProvider> {
29+
public class DirtyFileSearchParticipantServiceTracker extends ServiceTracker<DirtyFileProvider, DirtyFileProvider> {
3530

3631
private static final String PROPERTY_WEIGHT = "weight"; //$NON-NLS-1$
37-
public DirtyFileSearchParticipantServiceTracker(BundleContext context)
38-
throws InvalidSyntaxException {
32+
33+
public DirtyFileSearchParticipantServiceTracker(BundleContext context) throws InvalidSyntaxException {
3934
super(context, context.createFilter(MessageFormat.format("(&(objectClass={0}))", //$NON-NLS-1$
4035
DirtyFileProvider.class.getCanonicalName())), null);
4136
}
4237

38+
private final static Comparator<ServiceReference<DirtyFileProvider>> BY_WEIGHT = Comparator.comparing(
39+
o -> o.getProperty(PROPERTY_WEIGHT), //
40+
Comparator.nullsFirst(Comparator.comparing(Integer.class::isInstance) // false<true
41+
.thenComparing(Integer.class::cast)));
42+
4343
public DirtyFileProvider checkedGetService() {
4444
ServiceReference<DirtyFileProvider>[] allRefs = getServiceReferences();
4545
if (allRefs != null && allRefs.length > 0) {
46-
List<ServiceReference<DirtyFileProvider>> l = Arrays.asList(allRefs);
47-
Collections.sort(l, (o1, o2) -> {
48-
Object o1Weight = o1.getProperty(PROPERTY_WEIGHT);
49-
Object o2Weight = o2.getProperty(PROPERTY_WEIGHT);
50-
int o1Val = o1Weight == null ? 0
51-
: o1Weight instanceof Integer ? ((Integer) o1Weight).intValue() : 0;
52-
int o2Val = o2Weight == null ? 0
53-
: o2Weight instanceof Integer ? ((Integer) o2Weight).intValue() : 0;
54-
return o2Val - o1Val;
55-
});
56-
if (l.size() > 0) {
57-
return getService(l.get(0));
46+
Optional<ServiceReference<DirtyFileProvider>> reference = Arrays.stream(allRefs).max(BY_WEIGHT);
47+
if (reference.isPresent()) {
48+
return getService(reference.get());
5849
}
5950
}
60-
return new DirtyFileProvider() {
61-
@SuppressWarnings("unchecked")
62-
@Override
63-
public Map<IFile, IDocument> dirtyFiles() {
64-
return Collections.EMPTY_MAP;
65-
}
66-
};
67-
}
68-
69-
public void dispose() {
70-
close();
51+
return Collections::emptyMap;
7152
}
7253
}

bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchAdvisor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public void initialize(IWorkbenchConfigurer configurer) {
226226
jfaceComparatorIsSet = true;
227227
}
228228

229-
if (!Platform.inDevelopmentMode()) {
229+
if (!Platform.inDevelopmentMode() && !JUnitTestUtil.isJunitTestRunning()) {
230230
new AutoRegisterSchemeHandlersJob().schedule();
231231
}
232232
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 SAP SE.
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 2.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*
11+
* Contributors:
12+
* Matthias Becker / Sebastian Ratz - initial API and implementation
13+
*******************************************************************************/
14+
package org.eclipse.ui.internal.ide.application;
15+
16+
import java.util.Set;
17+
import java.util.concurrent.atomic.AtomicBoolean;
18+
19+
import org.eclipse.core.runtime.Platform;
20+
import org.eclipse.core.runtime.ServiceCaller;
21+
import org.eclipse.osgi.service.environment.EnvironmentInfo;
22+
23+
public class JUnitTestUtil {
24+
private static Boolean cachedIsJunitTestRunning = null;
25+
26+
public static boolean isJunitTestRunning() {
27+
if (cachedIsJunitTestRunning == null) {
28+
try {
29+
if (Platform.isRunning()) {
30+
AtomicBoolean result = new AtomicBoolean();
31+
cachedIsJunitTestRunning = ServiceCaller.callOnce(JUnitTestUtil.class, EnvironmentInfo.class, envInfo -> {
32+
String application = envInfo.getProperty("eclipse.application"); //$NON-NLS-1$
33+
result.set(application != null && Set.of( //
34+
// see org.eclipse.pde.internal.launching.IPDEConstants
35+
"org.eclipse.pde.junit.runtime.nonuithreadtestapplication", // //$NON-NLS-1$
36+
"org.eclipse.pde.junit.runtime.uitestapplication", // //$NON-NLS-1$
37+
"org.eclipse.pde.junit.runtime.coretestapplication", // //$NON-NLS-1$
38+
// bundle "org.eclipse.test" (Platform tests)
39+
"org.eclipse.test.uitestapplication", //$NON-NLS-1$
40+
"org.eclipse.test.coretestapplication", // //$NON-NLS-1$
41+
// see org.eclipse.tycho.surefire.AbstractTestMojo
42+
"org.eclipse.tycho.surefire.osgibooter.uitest", //$NON-NLS-1$
43+
"org.eclipse.tycho.surefire.osgibooter.headlesstest") // //$NON-NLS-1$
44+
.contains(application));
45+
});
46+
cachedIsJunitTestRunning = result.get();
47+
} else {
48+
cachedIsJunitTestRunning = true; // probably
49+
}
50+
} catch (Throwable t) {
51+
// log
52+
cachedIsJunitTestRunning = false;
53+
}
54+
}
55+
56+
return cachedIsJunitTestRunning;
57+
}
58+
59+
}

bundles/org.eclipse.ui.ide/schema/markerSupport.exsd

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,26 @@ ON_ANY_IN_SAME_CONTAINER: on any item with the same top level container as the s
192192
</appinfo>
193193
</annotation>
194194
</attribute>
195+
<attribute name="application">
196+
<annotation>
197+
<documentation>
198+
The application attribute describes how the reference should be applied.
199+
i.e. Does it refer to type only, type and subtypes or subtypes only.
200+
It is optionally included.
201+
If it is not specified it defaults to typeAndSubTypes.
202+
</documentation>
203+
</annotation>
204+
<simpleType>
205+
<restriction base="string">
206+
<enumeration value="subTypesOnly">
207+
</enumeration>
208+
<enumeration value="typeOnly">
209+
</enumeration>
210+
<enumeration value="typeAndSubTypes">
211+
</enumeration>
212+
</restriction>
213+
</simpleType>
214+
</attribute>
195215
</complexType>
196216
</element>
197217

bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerSupportInternalUtilities.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* Contributors:
1212
* IBM Corporation - initial API and implementation
1313
* Lars Vogel <[email protected]> - Bug 430694
14+
* Enda O'Brien, Pilz Ireland - PR #144
1415
******************************************************************************/
1516

1617
package org.eclipse.ui.internal.views.markers;
@@ -71,6 +72,26 @@ public class MarkerSupportInternalUtilities {
7172
*/
7273
public static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$
7374

75+
/**
76+
* The application attribute from a configuration element.
77+
*/
78+
public static final String APPLICATION = "application"; //$NON-NLS-1$
79+
80+
/**
81+
* The sub type only attribute value from the application attribute.
82+
*/
83+
public static final String SUB_TYPES_ONLY = "subTypesOnly"; //$NON-NLS-1$
84+
85+
/**
86+
* The type only attribute value from the application attribute.
87+
*/
88+
public static final String TYPE_ONLY = "typeOnly"; //$NON-NLS-1$
89+
90+
/**
91+
* The type and subtype attribute value from the application attribute.
92+
*/
93+
public static final String TYPE_AND_SUBTYPE = "typeAndSubTypes"; //$NON-NLS-1$
94+
7495
/**
7596
* The name attribute name from a configuration element.
7697
*/

0 commit comments

Comments
 (0)