mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
Bug 153446 - wrapped the persistence provider save operation inside a WorkspaceJob instead of a regular Job. This should delay any build requests and other resource change listeners triggered as a result of writing profiles that happens during delete.
Also fixed problems with broken filter pool references that occurred during duplication of profiles while testing.
This commit is contained in:
parent
2a5311d432
commit
f8b631b8d4
6 changed files with 38 additions and 38 deletions
|
@ -121,8 +121,6 @@ public class PropertyFileProvider implements IRSEPersistenceProvider {
|
||||||
*/
|
*/
|
||||||
public boolean saveRSEDOM(RSEDOM dom, IProgressMonitor monitor) {
|
public boolean saveRSEDOM(RSEDOM dom, IProgressMonitor monitor) {
|
||||||
IFolder providerFolder = getProviderFolder();
|
IFolder providerFolder = getProviderFolder();
|
||||||
// String profileName = dom.getName();
|
|
||||||
// System.out.println("saving profile " + profileName + " to " + providerFolder.getFullPath().toString() + "...");
|
|
||||||
try {
|
try {
|
||||||
int n = countNodes(dom);
|
int n = countNodes(dom);
|
||||||
if (monitor != null) monitor.beginTask("Saving DOM", n);
|
if (monitor != null) monitor.beginTask("Saving DOM", n);
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
|
|
||||||
package org.eclipse.rse.internal.persistence;
|
package org.eclipse.rse.internal.persistence;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.WorkspaceJob;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
|
||||||
import org.eclipse.rse.persistence.IRSEPersistenceProvider;
|
import org.eclipse.rse.persistence.IRSEPersistenceProvider;
|
||||||
import org.eclipse.rse.persistence.dom.RSEDOM;
|
import org.eclipse.rse.persistence.dom.RSEDOM;
|
||||||
|
|
||||||
public class SaveRSEDOMJob extends Job {
|
public class SaveRSEDOMJob extends WorkspaceJob {
|
||||||
|
|
||||||
private RSEDOM _dom;
|
private RSEDOM _dom;
|
||||||
private IRSEPersistenceProvider _provider;
|
private IRSEPersistenceProvider _provider;
|
||||||
|
@ -34,7 +34,7 @@ public class SaveRSEDOMJob extends Job {
|
||||||
_provider = provider;
|
_provider = provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
public IStatus runInWorkspace(IProgressMonitor monitor) {
|
||||||
IStatus result = Status.OK_STATUS;
|
IStatus result = Status.OK_STATUS;
|
||||||
synchronized (_dom) { // synchronize on the DOM to prevent its update while writing
|
synchronized (_dom) { // synchronize on the DOM to prevent its update while writing
|
||||||
if (_dom.needsSave()) {
|
if (_dom.needsSave()) {
|
||||||
|
|
|
@ -404,7 +404,8 @@ public class RSEDOMExporter implements IRSEDOMExporter {
|
||||||
|
|
||||||
if (clean || node.isDirty()) {
|
if (clean || node.isDirty()) {
|
||||||
ISystemFilterPool filterPool = filterPoolReference.getReferencedFilterPool();
|
ISystemFilterPool filterPool = filterPoolReference.getReferencedFilterPool();
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_REF_ID, filterPool.getId());
|
String refId = (filterPool != null) ? filterPool.getId() : "unknown";
|
||||||
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_REF_ID, refId);
|
||||||
}
|
}
|
||||||
|
|
||||||
createPropertySetNodes(node, filterPoolReference, clean);
|
createPropertySetNodes(node, filterPoolReference, clean);
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.filters;
|
package org.eclipse.rse.internal.filters;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.rse.core.filters.ISystemFilter;
|
import org.eclipse.rse.core.filters.ISystemFilter;
|
||||||
import org.eclipse.rse.core.filters.ISystemFilterContainer;
|
import org.eclipse.rse.core.filters.ISystemFilterContainer;
|
||||||
|
@ -107,11 +109,12 @@ public class SystemFilterContainerReferenceCommonMethods
|
||||||
// return a complete list. However, to save memory we try to only
|
// return a complete list. However, to save memory we try to only
|
||||||
// re-gen the list if something has changed.
|
// re-gen the list if something has changed.
|
||||||
ISystemFilterContainer parent = parentRef.getReferencedSystemFilterContainer();
|
ISystemFilterContainer parent = parentRef.getReferencedSystemFilterContainer();
|
||||||
java.util.List mofList = null;
|
List mofList = null;
|
||||||
if (parent instanceof ISystemFilterPool)
|
if (parent instanceof ISystemFilterPool)
|
||||||
mofList = ((ISystemFilterPool)parent).getFilters();
|
mofList = ((ISystemFilterPool)parent).getFilters();
|
||||||
else
|
else if (parent instanceof ISystemFilter) {
|
||||||
mofList = ((ISystemFilter)parent).getNestedFilters();
|
mofList = ((ISystemFilter)parent).getNestedFilters();
|
||||||
|
}
|
||||||
boolean needToReGen = compareFilters(mofList);
|
boolean needToReGen = compareFilters(mofList);
|
||||||
//System.out.println("In getSFRefs for " + getName() + ": regen? " + needToReGen);
|
//System.out.println("In getSFRefs for " + getName() + ": regen? " + needToReGen);
|
||||||
|
|
||||||
|
@ -122,6 +125,9 @@ public class SystemFilterContainerReferenceCommonMethods
|
||||||
// second, build new references...
|
// second, build new references...
|
||||||
referencedFilters = generateFilterReferences(subSystem, mofList);
|
referencedFilters = generateFilterReferences(subSystem, mofList);
|
||||||
}
|
}
|
||||||
|
if (referencedFilters == null) {
|
||||||
|
referencedFilters = new ISystemFilterReference[0];
|
||||||
|
}
|
||||||
return referencedFilters;
|
return referencedFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1617,12 +1617,6 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
|
|
||||||
public void performOperation(IProgressMonitor mon) throws InterruptedException, Exception
|
public void performOperation(IProgressMonitor mon) throws InterruptedException, Exception
|
||||||
{
|
{
|
||||||
String msg = null;
|
|
||||||
int totalWorkUnits = IProgressMonitor.UNKNOWN;
|
|
||||||
|
|
||||||
msg = SubSystemConfiguration.getDisconnectingMessage(getHostName(), getConnectorService().getPort());
|
|
||||||
|
|
||||||
if (!implicitConnect(false, mon, msg, totalWorkUnits)) throw new Exception(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText());
|
|
||||||
internalDisconnect(mon);
|
internalDisconnect(mon);
|
||||||
_disconnecting = false;
|
_disconnecting = false;
|
||||||
_connectionError = false;
|
_connectionError = false;
|
||||||
|
|
|
@ -1293,28 +1293,30 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
|
||||||
{
|
{
|
||||||
ISystemFilterPoolReference poolRef = oldReferences[idx];
|
ISystemFilterPoolReference poolRef = oldReferences[idx];
|
||||||
ISystemFilterPool pool = poolRef.getReferencedFilterPool();
|
ISystemFilterPool pool = poolRef.getReferencedFilterPool();
|
||||||
// if just copying a connnection, then copy references to pools as-is
|
if (pool != null) {
|
||||||
if (!copyProfileOperation)
|
// if just copying a connnection, then copy references to pools as-is
|
||||||
{
|
if (!copyProfileOperation)
|
||||||
newRefMgr.addReferenceToSystemFilterPool(pool);
|
|
||||||
}
|
|
||||||
// if copying a profile, update references to pools in old profile to become references to pools in new profile...
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ISystemFilterPoolManager poolMgr = pool.getSystemFilterPoolManager();
|
|
||||||
String poolProfileName = getSystemProfileName(poolMgr);
|
|
||||||
if (poolProfileName.equals(oldSubSystemProfileName))
|
|
||||||
{
|
{
|
||||||
//RSEUIPlugin.logDebugMessage(this.getClass().getName(),"found reference to copied filter pool " + pool.getName() + ", so changing to reference to new copy");
|
newRefMgr.addReferenceToSystemFilterPool(pool);
|
||||||
ISystemFilterPoolManager newPoolMgr = getFilterPoolManager(newConnection.getSystemProfile());
|
|
||||||
ISystemFilterPool newPool = newPoolMgr.getSystemFilterPool(pool.getName());
|
|
||||||
//RSEUIPlugin.logDebugMessage(this.getClass().getName(),"...new pool = " + newPoolMgr.getName()+"."+newPool.getName());
|
|
||||||
newRefMgr.addReferenceToSystemFilterPool(newPool);
|
|
||||||
}
|
}
|
||||||
|
// if copying a profile, update references to pools in old profile to become references to pools in new profile...
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//RSEUIPlugin.logDebugMessage(this.getClass().getName(),"found reference to filter pool from another profile " + poolProfileName+"."+pool.getName() + ", so not changing to reference to new copy");
|
ISystemFilterPoolManager poolMgr = pool.getSystemFilterPoolManager();
|
||||||
newRefMgr.addReferenceToSystemFilterPool(pool);
|
String poolProfileName = getSystemProfileName(poolMgr);
|
||||||
|
if (poolProfileName.equals(oldSubSystemProfileName))
|
||||||
|
{
|
||||||
|
//RSEUIPlugin.logDebugMessage(this.getClass().getName(),"found reference to copied filter pool " + pool.getName() + ", so changing to reference to new copy");
|
||||||
|
ISystemFilterPoolManager newPoolMgr = getFilterPoolManager(newConnection.getSystemProfile());
|
||||||
|
ISystemFilterPool newPool = newPoolMgr.getSystemFilterPool(pool.getName());
|
||||||
|
//RSEUIPlugin.logDebugMessage(this.getClass().getName(),"...new pool = " + newPoolMgr.getName()+"."+newPool.getName());
|
||||||
|
newRefMgr.addReferenceToSystemFilterPool(newPool);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//RSEUIPlugin.logDebugMessage(this.getClass().getName(),"found reference to filter pool from another profile " + poolProfileName+"."+pool.getName() + ", so not changing to reference to new copy");
|
||||||
|
newRefMgr.addReferenceToSystemFilterPool(pool);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2215,12 +2217,11 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
|
||||||
boolean nested = !(parent instanceof ISystemFilterPool);
|
boolean nested = !(parent instanceof ISystemFilterPool);
|
||||||
ISystemFilter nestedParentFilter = nested ? (ISystemFilter) parent : null;
|
ISystemFilter nestedParentFilter = nested ? (ISystemFilter) parent : null;
|
||||||
for (int idx = 0; idx < subsystems.length; idx++)
|
for (int idx = 0; idx < subsystems.length; idx++)
|
||||||
{
|
{
|
||||||
Object parentObj = null;
|
Object parentObj = null;
|
||||||
// CASE 1: FILTER IS NOT NESTED, SO SIMPLY GET ITS FILTER POOL REFERENCE AND USE AS A PARENT...
|
// CASE 1: FILTER IS NOT NESTED, SO SIMPLY GET ITS FILTER POOL REFERENCE AND USE AS A PARENT...
|
||||||
if (!nested)
|
if (!nested)
|
||||||
{
|
{
|
||||||
|
|
||||||
// SPECIAL CASE 1A: it makes a difference if we are showing filter pools or not...
|
// SPECIAL CASE 1A: it makes a difference if we are showing filter pools or not...
|
||||||
if (showFilterPools())
|
if (showFilterPools())
|
||||||
{
|
{
|
||||||
|
@ -2229,7 +2230,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parentObj = subsystems[idx];
|
parentObj = subsystems[idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CASE 2: FILTER IS NESTED, THIS IS MORE DIFFICULT, AS EVERY FILTER CONTAINS A RANDOMLY
|
// CASE 2: FILTER IS NESTED, THIS IS MORE DIFFICULT, AS EVERY FILTER CONTAINS A RANDOMLY
|
||||||
// GENERATED REFERENCE THAT ONLY THE GUI KNOWS ABOUT.
|
// GENERATED REFERENCE THAT ONLY THE GUI KNOWS ABOUT.
|
||||||
|
@ -2240,17 +2241,17 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
|
||||||
}
|
}
|
||||||
event = cloneEvent(event, parentObj);
|
event = cloneEvent(event, parentObj);
|
||||||
event.setParent(parentObj);
|
event.setParent(parentObj);
|
||||||
fireSubSystemEvent(event, subsystems[idx]);
|
fireSubSystemEvent(event, subsystems[idx]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected SystemResourceChangeEvent cloneEvent(SystemResourceChangeEvent event, Object parent)
|
protected SystemResourceChangeEvent cloneEvent(SystemResourceChangeEvent event, Object parent)
|
||||||
{
|
{
|
||||||
SystemResourceChangeEvent result = new SystemResourceChangeEvent(event.getSource(), event.getType(), parent);
|
SystemResourceChangeEvent result = new SystemResourceChangeEvent(event.getSource(), event.getType(), parent);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fire an event of a given id to subsystems that hold a reference to the given filter string
|
* Fire an event of a given id to subsystems that hold a reference to the given filter string
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue