mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-19 06:05:56 +02:00
[196838] amended code to use state file rather than preference and to honor SystemPreferencesManager.getShowLocalConnection()
This commit is contained in:
parent
dd720e158a
commit
354a638142
1 changed files with 11 additions and 5 deletions
|
@ -32,15 +32,16 @@
|
||||||
|
|
||||||
package org.eclipse.rse.ui;
|
package org.eclipse.rse.ui;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.IAdapterManager;
|
import org.eclipse.core.runtime.IAdapterManager;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
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.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Preferences;
|
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.rse.core.IRSESystemType;
|
import org.eclipse.rse.core.IRSESystemType;
|
||||||
|
@ -110,9 +111,11 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
||||||
SystemResourceManager.startResourceEventListening(listener);
|
SystemResourceManager.startResourceEventListening(listener);
|
||||||
|
|
||||||
// determining whether to create an initial local connection
|
// determining whether to create an initial local connection
|
||||||
Preferences prefs = RSEUIPlugin.getDefault().getPluginPreferences();
|
IPath statePath = RSECorePlugin.getDefault().getStateLocation();
|
||||||
String key = "localConnectionCreated.mark"; //$NON-NLS-1$
|
IPath markPath = statePath.append("localHostCreated.mark"); //$NON-NLS-1$
|
||||||
if (!prefs.getBoolean(key)) {
|
File markFile = new File(markPath.toOSString());
|
||||||
|
if (!markFile.exists() && SystemPreferencesManager.getShowLocalConnection())
|
||||||
|
{
|
||||||
// create the connection only if the local system type is enabled
|
// create the connection only if the local system type is enabled
|
||||||
IRSESystemType systemType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LOCAL_ID);
|
IRSESystemType systemType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LOCAL_ID);
|
||||||
if (systemType != null) {
|
if (systemType != null) {
|
||||||
|
@ -122,7 +125,10 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
||||||
ISystemProfile profile = profileManager.getDefaultPrivateSystemProfile();
|
ISystemProfile profile = profileManager.getDefaultPrivateSystemProfile();
|
||||||
String userName = System.getProperty("user.name"); //$NON-NLS-1$
|
String userName = System.getProperty("user.name"); //$NON-NLS-1$
|
||||||
registry.createLocalHost(profile, SystemResources.TERM_LOCAL, userName);
|
registry.createLocalHost(profile, SystemResources.TERM_LOCAL, userName);
|
||||||
prefs.setValue(key, true);
|
try {
|
||||||
|
markFile.createNewFile();
|
||||||
|
}
|
||||||
|
catch(Exception e){}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue