1
1
/*
2
- * Copyright (c) 2014, 2021 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2014, 2024 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
28
28
import static javafx .scene .AccessibleAttribute .PARENT ;
29
29
import static javafx .scene .AccessibleAttribute .ROLE ;
30
30
import java .security .AccessControlContext ;
31
- import java .security .AccessController ;
32
- import java .security .PrivilegedAction ;
33
31
import com .sun .javafx .scene .NodeHelper ;
34
32
import com .sun .javafx .scene .SceneHelper ;
35
33
import com .sun .javafx .tk .quantum .QuantumToolkit ;
39
37
import javafx .scene .Node ;
40
38
import javafx .scene .Scene ;
41
39
40
+ import java .util .function .Supplier ;
41
+
42
42
public abstract class Accessible {
43
43
44
44
private EventHandler eventHandler ;
@@ -137,10 +137,10 @@ private final AccessControlContext getAccessControlContext() {
137
137
return acc ;
138
138
}
139
139
140
- private class GetAttribute implements PrivilegedAction <Object > {
140
+ private class GetAttribute implements Supplier <Object > {
141
141
AccessibleAttribute attribute ;
142
142
Object [] parameters ;
143
- @ Override public Object run () {
143
+ @ Override public Object get () {
144
144
Object result = eventHandler .getAttribute (attribute , parameters );
145
145
if (result != null ) {
146
146
Class <?> clazz = attribute .getReturnType ();
@@ -162,37 +162,27 @@ private class GetAttribute implements PrivilegedAction<Object> {
162
162
163
163
private GetAttribute getAttribute = new GetAttribute ();
164
164
165
- @ SuppressWarnings ("removal" )
166
165
public Object getAttribute (AccessibleAttribute attribute , Object ... parameters ) {
167
- AccessControlContext acc = getAccessControlContext ();
168
- if (acc == null ) return null ;
169
- return QuantumToolkit .runWithoutRenderLock (() -> {
170
- getAttribute .attribute = attribute ;
171
- getAttribute .parameters = parameters ;
172
- return AccessController .doPrivileged (getAttribute , acc );
173
- });
166
+ getAttribute .attribute = attribute ;
167
+ getAttribute .parameters = parameters ;
168
+ return QuantumToolkit .runWithoutRenderLock (getAttribute );
174
169
}
175
170
176
- private class ExecuteAction implements PrivilegedAction <Void > {
171
+ private class ExecuteAction implements Supplier <Void > {
177
172
AccessibleAction action ;
178
173
Object [] parameters ;
179
- @ Override public Void run () {
174
+ @ Override public Void get () {
180
175
eventHandler .executeAction (action , parameters );
181
176
return null ;
182
177
}
183
178
}
184
179
185
180
private ExecuteAction executeAction = new ExecuteAction ();
186
181
187
- @ SuppressWarnings ("removal" )
188
182
public void executeAction (AccessibleAction action , Object ... parameters ) {
189
- AccessControlContext acc = getAccessControlContext ();
190
- if (acc == null ) return ;
191
- QuantumToolkit .runWithoutRenderLock (() -> {
192
- executeAction .action = action ;
193
- executeAction .parameters = parameters ;
194
- return AccessController .doPrivileged (executeAction , acc );
195
- });
183
+ executeAction .action = action ;
184
+ executeAction .parameters = parameters ;
185
+ QuantumToolkit .runWithoutRenderLock (executeAction );
196
186
}
197
187
198
188
public abstract void sendNotification (AccessibleAttribute notification );
0 commit comments