Skip to content
Snippets Groups Projects
Commit dbf77a94 authored by Sebastian Krings's avatar Sebastian Krings
Browse files

store if a model or a context was send to the animator inside an eclipse...

store if a model or a context was send to the animator inside an eclipse service called context_loaded. used to deactivate refinement checking, etc. for contexts.
parent 06017916
No related branches found
No related tags found
No related merge requests found
...@@ -757,27 +757,43 @@ ...@@ -757,27 +757,43 @@
</handler> </handler>
<handler <handler
commandId="de.prob.ui.refinement_check"> commandId="de.prob.ui.refinement_check">
<class
class="de.prob.ui.refinementcheck.RefinementCheckHandler">
</class>
<enabledWhen> <enabledWhen>
<and>
<with <with
variable="de.prob.core.model_loaded"> variable="de.prob.core.model_loaded">
<equals <equals
value="enabled"> value="enabled">
</equals> </equals>
</with> </with>
<with
variable="de.prob.core.context_loaded">
<equals
value="disabled">
</equals>
</with>
</and>
</enabledWhen> </enabledWhen>
<class
class="de.prob.ui.refinementcheck.RefinementCheckHandler">
</class>
</handler> </handler>
<handler <handler
commandId="de.prob.ui.assertion_check"> commandId="de.prob.ui.assertion_check">
<enabledWhen> <enabledWhen>
<and>
<with <with
variable="de.prob.core.model_loaded"> variable="de.prob.core.model_loaded">
<equals <equals
value="enabled"> value="enabled">
</equals> </equals>
</with> </with>
<with
variable="de.prob.core.context_loaded">
<equals
value="disabled">
</equals>
</with>
</and>
</enabledWhen> </enabledWhen>
<class <class
class="de.prob.ui.assertion.AssertionCheckHandler"> class="de.prob.ui.assertion.AssertionCheckHandler">
...@@ -1222,6 +1238,13 @@ ...@@ -1222,6 +1238,13 @@
name="de.prob.ui.ltl.counterexample_loaded" name="de.prob.ui.ltl.counterexample_loaded"
priorityLevel="workbench"> priorityLevel="workbench">
</variable> </variable>
</sourceProvider>
<sourceProvider
provider="de.prob.ui.services.ContextLoadedProvider">
<variable
name="de.prob.core.context_loaded"
priorityLevel="workbench">
</variable>
</sourceProvider> </sourceProvider>
</extension> </extension>
</plugin> </plugin>
...@@ -20,7 +20,9 @@ import org.eclipse.core.runtime.IPath; ...@@ -20,7 +20,9 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.services.ISourceProviderService;
import org.eventb.core.IContextRoot; import org.eventb.core.IContextRoot;
import org.eventb.core.IEventBRoot; import org.eventb.core.IEventBRoot;
import org.eventb.core.IMachineRoot; import org.eventb.core.IMachineRoot;
...@@ -33,6 +35,8 @@ import de.prob.core.command.LoadEventBModelCommand; ...@@ -33,6 +35,8 @@ import de.prob.core.command.LoadEventBModelCommand;
import de.prob.exceptions.ProBException; import de.prob.exceptions.ProBException;
import de.prob.logging.Logger; import de.prob.logging.Logger;
import de.prob.ui.PerspectiveFactory; import de.prob.ui.PerspectiveFactory;
import de.prob.ui.services.ContextLoadedProvider;
import de.prob.ui.services.ModelLoadedProvider;
public class StartAnimationHandler extends AbstractHandler implements IHandler { public class StartAnimationHandler extends AbstractHandler implements IHandler {
...@@ -145,6 +149,14 @@ public class StartAnimationHandler extends AbstractHandler implements IHandler { ...@@ -145,6 +149,14 @@ public class StartAnimationHandler extends AbstractHandler implements IHandler {
return root; return root;
} }
private void updateContextLoadedProvider(boolean isContext) {
ISourceProviderService service = (ISourceProviderService)
PlatformUI.getWorkbench().getService(ISourceProviderService.class);
ContextLoadedProvider sourceProvider = (ContextLoadedProvider) service
.getSourceProvider(ContextLoadedProvider.SERVICE);
sourceProvider.setEnabled(isContext);
}
private IFile extractResource(final IEventBRoot rootElement) { private IFile extractResource(final IEventBRoot rootElement) {
IFile resource = null; IFile resource = null;
if (rootElement == null) { if (rootElement == null) {
...@@ -152,9 +164,11 @@ public class StartAnimationHandler extends AbstractHandler implements IHandler { ...@@ -152,9 +164,11 @@ public class StartAnimationHandler extends AbstractHandler implements IHandler {
} else if (rootElement instanceof IMachineRoot) { } else if (rootElement instanceof IMachineRoot) {
resource = ((IMachineRoot) rootElement).getSCMachineRoot() resource = ((IMachineRoot) rootElement).getSCMachineRoot()
.getResource(); .getResource();
updateContextLoadedProvider(false);
} else if (rootElement instanceof IContextRoot) { } else if (rootElement instanceof IContextRoot) {
resource = ((IContextRoot) rootElement).getSCContextRoot() resource = ((IContextRoot) rootElement).getSCContextRoot()
.getResource(); .getResource();
updateContextLoadedProvider(true);
} }
return resource; return resource;
} }
......
package de.prob.ui.services;
public class ContextLoadedProvider extends AbstractBoolProvider {
public static final String SERVICE = "de.prob.core.context_loaded";
public ContextLoadedProvider() {
super(SERVICE);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment