This repository was archived by the owner on Nov 4, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/org/eclipsescript/scriptobjects Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 11package org .eclipsescript .scriptobjects ;
22
3+ import java .util .HashMap ;
4+ import java .util .Map ;
5+
36import org .eclipse .core .resources .IContainer ;
47import org .eclipse .core .resources .IFile ;
58import org .eclipse .core .resources .WorkspaceJob ;
2225 */
2326public class Runtime {
2427
28+ private static final Map <String , Object > globals = new HashMap <String , Object >();
2529 private final IScriptRuntime scriptRuntime ;
2630
2731 public Runtime (IScriptRuntime scriptRuntime ) {
@@ -45,6 +49,10 @@ public void exit() {
4549 scriptRuntime .exitRunningScript ();
4650 }
4751
52+ public synchronized Object getGlobal (String key ) {
53+ return globals .get (key );
54+ }
55+
4856 public Shell getShell () {
4957 return EclipseUtils .getWindowShell ();
5058 }
@@ -72,6 +80,10 @@ public void include(Object... includes) throws Exception {
7280 }
7381 }
7482
83+ public synchronized void putGlobal (String key , Object value ) {
84+ globals .put (key , value );
85+ }
86+
7587 public void schedule (final Object objectToSchedule ) {
7688 final IJobRunnable runnable = scriptRuntime .adaptTo (objectToSchedule , IJobRunnable .class );
7789 if (runnable == null )
You can’t perform that action at this time.
0 commit comments