@Override protected void setUp() throws Exception { super.setUp(); domain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(); refreshEditorsPrecommitListener = new RefreshEditorsPrecommitListener(domain); resourceSet = domain.getResourceSet(); sessionResourceURI = URI.createPlatformPluginURI(SiriusTestsPlugin.PLUGIN_ID + PATH + "vp1753.aird", true); semanticResourceURI = URI.createPlatformPluginURI(SiriusTestsPlugin.PLUGIN_ID + PATH + "vp1753.ecore", true); sessionResource = resourceSet.getResource(sessionResourceURI, true); final DRepresentation firstDRepresentation = getFirstElement(sessionResource, DRepresentation.class); refreshFilterStub = new RefreshFilterStub(firstDRepresentation); RefreshFilterManager.INSTANCE.addRefreshFilter(refreshFilterStub); oldRefreshAutoMode = Platform.getPreferencesService() .getBoolean( SiriusPlugin.ID, SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), false, null); InstanceScope.INSTANCE .getNode(SiriusPlugin.ID) .putBoolean(SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), true); }
@Override protected void tearDown() throws Exception { InstanceScope.INSTANCE .getNode(SiriusPlugin.ID) .putBoolean(SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), oldRefreshAutoMode); sessionResourceURI = null; semanticResourceURI = null; domain.dispose(); domain = null; resourceSet = null; sessionResource = null; refreshEditorsPrecommitListener = null; RefreshFilterManager.INSTANCE.removeRefreshFilter(refreshFilterStub); refreshFilterStub = null; super.tearDown(); }