use of eu.esdihumboldt.util.groovy.sandbox.GroovyService in project hale by halestudio.
the class RestrictionToggleState method dispose.
@Override
public void dispose() {
GroovyService gs = HaleUI.getServiceProvider().getService(GroovyService.class);
gs.removeListener(groovyServiceListener);
}
use of eu.esdihumboldt.util.groovy.sandbox.GroovyService in project hale by halestudio.
the class ToggleRestrictionHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
GroovyService gs = HaleUI.getServiceProvider().getService(GroovyService.class);
boolean restrictionActive = gs.isRestrictionActive();
String warning;
if (restrictionActive) {
warning = "Are your sure, that you want to lift restrictions for all Groovy scripts of the current project?";
warning += "\n\nWARNING: The Groovy scripts can then do \"anything\", so be sure to trust your source!";
} else {
warning = "Are you sure, that you want to restrict all Groovy scripts again?\nScripts relying on additional rights will stop working and overall script performance may go down.";
}
boolean confirmation = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Groovy script restriction", warning);
if (confirmation) {
gs.setRestrictionActive(!gs.isRestrictionActive());
} else {
// make sure toggle button reverts
ICommandService cs = PlatformUI.getWorkbench().getService(ICommandService.class);
cs.refreshElements(event.getCommand().getId(), null);
}
return null;
}
Aggregations