mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-06 07:45:50 +02:00
[228353] Asynchronously initialize the remote edit project
This commit is contained in:
parent
7322cfb231
commit
bda7058954
1 changed files with 61 additions and 33 deletions
|
@ -15,12 +15,18 @@
|
|||
* Martin Oberhuber (Wind River) - [180519][api] declaratively register adapter factories
|
||||
* David McKnight (IBM) - [205820] create the temp files project (if not there) when files.ui is loaded
|
||||
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
|
||||
* Martin Oberhuber (Wind River) - [228353] Asynchronously initialize the remote edit project
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.files.ui;
|
||||
|
||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.rse.files.ui.resources.SystemUniversalTempFileListener;
|
||||
|
@ -28,7 +34,6 @@ import org.eclipse.rse.internal.files.ui.propertypages.SystemCachePreferencePage
|
|||
import org.eclipse.rse.internal.files.ui.propertypages.UniversalPreferencePage;
|
||||
import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemBasePlugin;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
|
@ -54,13 +59,12 @@ public class Activator extends AbstractUIPlugin
|
|||
plugin = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called upon plug-in activation
|
||||
*/
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
|
||||
private class InitRemoteEditJob extends Job {
|
||||
public InitRemoteEditJob() {
|
||||
super("InitRemoteEditJob"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
// create the temp files project if it doesn't exist
|
||||
// fix for bug 205820
|
||||
SystemRemoteEditManager.getInstance().getRemoteEditProject();
|
||||
|
@ -73,15 +77,36 @@ public class Activator extends AbstractUIPlugin
|
|||
_tempFileListener = SystemUniversalTempFileListener.getListener();
|
||||
// add listener for temp files
|
||||
int eventMask = IResourceChangeEvent.POST_CHANGE;
|
||||
IWorkspace ws = SystemBasePlugin.getWorkspace();
|
||||
IWorkspace ws = ResourcesPlugin.getWorkspace();
|
||||
ws.addResourceChangeListener(_tempFileListener, eventMask);
|
||||
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called upon plug-in activation
|
||||
*/
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
|
||||
// DKM - workaround for issue in 175295
|
||||
// I had tried SystemFilePreferenceInitializer but it was not being started by the platform because
|
||||
// the preference store is rse.ui. In order to fix that, we'd have to migrate the
|
||||
// preferences for files to the files.ui preference store.
|
||||
// Instead calling this directly at startup.
|
||||
initializeDefaultRSEPreferences();
|
||||
|
||||
//Bug 228353: Initialize remote edit project in a Job
|
||||
//The Job must run AFTER initializeDefaultRSEPreferences(), because that one
|
||||
//needs some classes loaded, and the class loader could fall into a deadlock
|
||||
//when the deferred Job also wants to load some classes but cannot continue
|
||||
//because the start() method is not yet finished
|
||||
InitRemoteEditJob job = new InitRemoteEditJob();
|
||||
job.setRule(ResourcesPlugin.getWorkspace().getRoot());
|
||||
job.schedule();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,6 +114,8 @@ public class Activator extends AbstractUIPlugin
|
|||
*/
|
||||
public void initializeDefaultRSEPreferences()
|
||||
{
|
||||
//FIXME This should really be migrated into a Preferences Initializer Extension
|
||||
//in order to avoid unnecessary plugin activation
|
||||
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
SystemCachePreferencePage.initDefaults(store);
|
||||
UniversalPreferencePage.initDefaults(store);
|
||||
|
@ -100,10 +127,11 @@ public class Activator extends AbstractUIPlugin
|
|||
public void stop(BundleContext context) throws Exception
|
||||
{
|
||||
super.stop(context);
|
||||
|
||||
IWorkspace ws = SystemBasePlugin.getWorkspace();
|
||||
if (_tempFileListener != null) {
|
||||
IWorkspace ws = ResourcesPlugin.getWorkspace();
|
||||
ws.removeResourceChangeListener(_tempFileListener);
|
||||
_tempFileListener = null;
|
||||
}
|
||||
plugin = null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue