Skip to content

Commit d06e971

Browse files
authored
Merge branch 'eclipse-platform:master' into group_close_editor_options_in_preference
2 parents c3d99f0 + 73b5314 commit d06e971

File tree

96 files changed

+1361
-658
lines changed

Some content is hidden

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

96 files changed

+1361
-658
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,5 @@ on:
1010
branches: [ master ]
1111

1212
jobs:
13-
check-freeze-period:
14-
if: github.event_name == 'pull_request'
15-
uses: eclipse-platform/eclipse.platform.releng.aggregator/.github/workflows/verifyFreezePeriod.yml@master
16-
check-merge-commits:
17-
if: github.event_name == 'pull_request'
18-
uses: eclipse-platform/eclipse.platform.releng.aggregator/.github/workflows/checkMergeCommits.yml@master
1913
build:
2014
uses: eclipse-platform/eclipse.platform.releng.aggregator/.github/workflows/mavenBuild.yml@master
21-

.github/workflows/pr-checks.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Fast running checks for pull-requests
2+
3+
name: Pull-Request Checks
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
7+
8+
on:
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
check-freeze-period:
14+
uses: eclipse-platform/eclipse.platform.releng.aggregator/.github/workflows/verifyFreezePeriod.yml@master
15+
check-merge-commits:
16+
uses: eclipse-platform/eclipse.platform.releng.aggregator/.github/workflows/checkMergeCommits.yml@master
17+
check-versions:
18+
uses: eclipse-platform/eclipse.platform.releng.aggregator/.github/workflows/checkVersions.yml@master
19+
with:
20+
botName: Eclipse Platform Bot
21+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Publish Version Check Results
2+
3+
on:
4+
workflow_run:
5+
workflows: [ 'Pull-Request Checks' ]
6+
types: [ completed ]
7+
8+
jobs:
9+
publish-version-check-results:
10+
uses: eclipse-platform/eclipse.platform.releng.aggregator/.github/workflows/publishVersionCheckResults.yml@master
11+
with:
12+
botGithubId: eclipse-platform-bot
13+
secrets:
14+
githubBotPAT: ${{ secrets.PLATFORM_BOT_PAT }}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<component id="org.eclipse.e4.emf.xpath" version="2">
3+
<resource path="src/org/eclipse/e4/emf/xpath/XPathContext.java" type="org.eclipse.e4.emf.xpath.XPathContext">
4+
<filter id="404000815">
5+
<message_arguments>
6+
<message_argument value="org.eclipse.e4.emf.xpath.XPathContext"/>
7+
<message_argument value="stream(String, Class&lt;T&gt;)"/>
8+
</message_arguments>
9+
</filter>
10+
</resource>
11+
</component>

bundles/org.eclipse.e4.emf.xpath/META-INF/MANIFEST.MF

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %Bundle-Name
44
Bundle-SymbolicName: org.eclipse.e4.emf.xpath
5-
Bundle-Version: 0.4.300.qualifier
5+
Bundle-Version: 0.5.0.qualifier
66
Bundle-RequiredExecutionEnvironment: JavaSE-17
7-
Require-Bundle: org.apache.commons.jxpath;bundle-version="1.2.0",
8-
org.eclipse.emf.ecore;bundle-version="2.35.0",
7+
Require-Bundle: org.eclipse.emf.ecore;bundle-version="2.35.0",
98
org.eclipse.core.runtime;bundle-version="3.29.0"
109
Export-Package: org.eclipse.e4.emf.internal.xpath;x-internal:=true,
1110
org.eclipse.e4.emf.internal.xpath.helper;x-friends:="org.eclipse.e4.emf.xpath.test,org.eclipse.e4.ui.model.workbench,org.eclipse.e4.ui.workbench",
1211
org.eclipse.e4.emf.xpath
12+
Import-Package: org.apache.commons.jxpath;version="[1.3.0,2.0.0)",
13+
org.apache.commons.jxpath.ri;version="[1.3.0,2.0.0)",
14+
org.apache.commons.jxpath.ri.compiler;version="[1.3.0,2.0.0)",
15+
org.apache.commons.jxpath.ri.model;version="[1.3.0,2.0.0)",
16+
org.apache.commons.jxpath.util;version="[1.3.0,2.0.0)"
1317
Bundle-Vendor: %Bundle-Vendor
1418
Automatic-Module-Name: org.eclipse.e4.emf.xpath

bundles/org.eclipse.e4.emf.xpath/src/org/eclipse/e4/emf/internal/xpath/JXPathContextFactoryImpl.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2010, 2015 BestSolution.at and others.
2+
* Copyright (c) 2010, 2024 BestSolution.at and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -20,18 +20,17 @@
2020
/**
2121
* Factory creating context using JXPath
2222
*
23-
* @param <Type>
24-
* the object the XPath is created for
23+
* @param <T> the object the XPath is created for
2524
*/
26-
public class JXPathContextFactoryImpl<Type> extends XPathContextFactory<Type> {
25+
public class JXPathContextFactoryImpl<T> extends XPathContextFactory<T> {
2726

2827
@Override
2928
public XPathContext newContext(XPathContext parentContext, Object contextBean) {
3029
return new JXPathContextImpl(parentContext, contextBean);
3130
}
3231

3332
@Override
34-
public XPathContext newContext(Type contextBean) {
33+
public XPathContext newContext(T contextBean) {
3534
return new JXPathContextImpl(contextBean);
3635
}
3736

bundles/org.eclipse.e4.emf.xpath/src/org/eclipse/e4/emf/internal/xpath/JXPathContextImpl.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.apache.commons.jxpath.JXPathContext;
2222
import org.apache.commons.jxpath.NodeSet;
2323
import org.apache.commons.jxpath.Pointer;
24+
import org.apache.commons.jxpath.util.TypeUtils;
2425
import org.eclipse.e4.emf.xpath.XPathContext;
2526
import org.eclipse.emf.ecore.EObject;
2627

@@ -84,12 +85,15 @@ public Object getValue(String xpath) {
8485
}
8586

8687
@Override
87-
public Object getValue(String xpath, Class<?> requiredType) {
88-
return context.getValue(xpath, requiredType);
88+
public <T> T getValue(String xpath, Class<T> requiredType) {
89+
Object value = context.getValue(xpath, requiredType);
90+
@SuppressWarnings("unchecked")
91+
T typedValue = (T) TypeUtils.convert(value, requiredType);
92+
return typedValue;
8993
}
9094

9195
@Override
92-
public <Type> Iterator<Type> iterate(String xpath) {
96+
public <T> Iterator<T> iterate(String xpath) {
9397
return context.iterate(xpath);
9498
}
9599

bundles/org.eclipse.e4.emf.xpath/src/org/eclipse/e4/emf/xpath/XPathContext.java

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2010, 2015 BestSolution.at and others.
2+
* Copyright (c) 2010, 2024 BestSolution.at and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,6 +14,12 @@
1414
package org.eclipse.e4.emf.xpath;
1515

1616
import java.util.Iterator;
17+
import java.util.Spliterator;
18+
import java.util.Spliterators;
19+
import java.util.stream.Stream;
20+
import java.util.stream.StreamSupport;
21+
22+
import org.apache.commons.jxpath.util.TypeUtils;
1723

1824
/**
1925
* Context in which the xpath is executed
@@ -42,19 +48,35 @@ public interface XPathContext {
4248
* required type
4349
* @return Object found
4450
*/
45-
Object getValue(String xpath, Class<?> requiredType);
51+
<T> T getValue(String xpath, Class<T> requiredType);
4652

4753
/**
4854
* Traverses the xpath and returns an Iterator of all results found for the
49-
* path. If the xpath matches no properties in the graph, the Iterator will
50-
* be empty, but not null.
55+
* path. If the xpath matches no properties in the graph, the Iterator will be
56+
* empty, but not null.
5157
*
52-
* @param <O>
53-
* the expected object type
58+
* @param <T> the expected object type
5459
*
55-
* @param xpath
56-
* to iterate
60+
* @param xpath to iterate
5761
* @return Iterator&lt;Object&gt;
5862
*/
59-
<O> Iterator<O> iterate(String xpath);
63+
<T> Iterator<T> iterate(String xpath);
64+
65+
/**
66+
* Traverses the xpath and returns an {@link Stream} of all results found for
67+
* the path. If the xpath matches no properties in the graph, the stream will be
68+
* empty.
69+
*
70+
* @param <T> the expected object type
71+
* @param xpath the xpath expression to iterate
72+
* @param type the type of elements in the returned stream
73+
* @return a stream of elements matching the specified xpath and of the given
74+
* type
75+
* @since 0.5
76+
*/
77+
default <T> Stream<T> stream(String xpath, Class<T> type) {
78+
Iterator<?> iterator = iterate(xpath);
79+
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, Spliterator.ORDERED), false)
80+
.filter(e -> TypeUtils.canConvert(e, type)).map(e -> TypeUtils.convert(e, type)).map(type::cast);
81+
}
6082
}
Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2010, 2015 BestSolution.at and others.
2+
* Copyright (c) 2010, 2024 BestSolution.at and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -18,39 +18,34 @@
1818
/**
1919
* Factory responsible to create an XPath-Context
2020
*
21-
* @param <Type>
22-
* the object type the XPath is created for
21+
* @param <T> the object type the XPath is created for
2322
*/
24-
public abstract class XPathContextFactory<Type extends Object> {
23+
public abstract class XPathContextFactory<T> {
2524

2625
/**
2726
* Creates a new XPathContext with the specified object as the root node.
2827
*
29-
* @param contextBean
30-
* Object
28+
* @param contextBean Object
3129
* @return XPathContext
3230
*/
33-
public abstract XPathContext newContext(Type contextBean);
31+
public abstract XPathContext newContext(T contextBean);
3432

3533
/**
36-
* Creates a new XPathContext with the specified bean as the root node and
37-
* the specified parent context. Variables defined in a parent context can
38-
* be referenced in XPaths passed to the child context.
34+
* Creates a new XPathContext with the specified bean as the root node and the
35+
* specified parent context. Variables defined in a parent context can be
36+
* referenced in XPaths passed to the child context.
3937
*
40-
* @param parentContext
41-
* parent context
42-
* @param contextBean
43-
* Object
38+
* @param parentContext parent context
39+
* @param contextBean Object
4440
* @return XPathContext
4541
*/
46-
public abstract XPathContext newContext(XPathContext parentContext, Type contextBean);
42+
public abstract XPathContext newContext(XPathContext parentContext, T contextBean);
4743

4844
/**
49-
* @param <Type>
50-
* the object type the xpath is created for
45+
* @param <T> the object type the xpath is created for
5146
* @return Create a new XPath-Factory
5247
*/
53-
public static <Type> XPathContextFactory<Type> newInstance() {
48+
public static <T> XPathContextFactory<T> newInstance() {
5449
return new JXPathContextFactoryImpl<>();
5550
}
5651
}

bundles/org.eclipse.e4.ui.model.workbench/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.e4.ui.model.workbench;singleton:=true
5-
Bundle-Version: 2.4.300.qualifier
5+
Bundle-Version: 2.4.400.qualifier
66
Bundle-Vendor: %providerName
77
Bundle-Localization: plugin
88
Bundle-RequiredExecutionEnvironment: JavaSE-17

0 commit comments

Comments
 (0)