Summary: | Deleted "Local" host re-appears after restart | ||
---|---|---|---|
Product: | [Tools] Target Management | Reporter: | Martin Oberhuber <mober.at+eclipse> |
Component: | RSE | Assignee: | David McKnight <dmcknigh> |
Status: | RESOLVED FIXED | QA Contact: | Martin Oberhuber <mober.at+eclipse> |
Severity: | minor | ||
Priority: | P3 | CC: | kjdoyle, wb-rel |
Version: | 2.0 | ||
Target Milestone: | 2.0.1 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: | |||
Bug Depends on: | |||
Bug Blocks: | 193323 |
Description
Martin Oberhuber
2007-07-17 12:39:01 EDT
This is similar to bug #193323. It doesn't matter if you delete or rename Local, a "Local" connection is always created. In the RSE startup code we have this: // new support to allow products to not pre-create a local connection // if (SystemResourceManager.isFirstTime() && SystemPreferencesManager.getShowLocalConnection()) { if (SystemPreferencesManager.getShowLocalConnection()) { // create the connection only if the local system type is enabled IRSESystemType systemType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LOCAL_ID); if (systemType != null) { RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(systemType.getAdapter(RSESystemTypeAdapter.class)); if (adapter != null && adapter.isEnabled(systemType)) { ISystemProfileManager profileManager = SystemProfileManager.getDefault(); ISystemProfile profile = profileManager.getDefaultPrivateSystemProfile(); String userName = System.getProperty("user.name"); //$NON-NLS-1$ registry.createLocalHost(profile, SystemResources.TERM_LOCAL, userName); } } } The commented out line should fix this problem, although we don't have SystemResourceManager.isFirstTime() anymore. I think that SystemResourceManager.isFirstTime() is not quite sufficient. Because it could be that at the first time RSE is run, the Local Feature is not yet installed so Local node would not be created at that time. If somebody installs the Local feature through update manager at a later time, now the node should be created. Ideally, all the auto-creation stuff for the Local connection should be inside the local subsystem plugin; but this seems too much of a change for 2.0.1. What we can do is this: Prefrences prefs = RSEUIPlugin.getDefault().getPluginPreferences(); String key = "localConnectionCreated.mark"; //$NON-NLS-1$ if (!prefs.getBoolean(key)) { if (otherChecksOK) { doCreateLocal(); prefs.setBoolean(key, true); } } I've applied Martin's suggestion - i.e. using the preference. Dave -- One problem with using a preference to mark the initial creation of Local is that preferences can be exported to another workspace. I thought of this after my conversation with you. We should probably have an internal class - say RSEWorkspaceState - with a static method that contains this property and allocate the property as a file in the state location of the core plugin. Dave, why do you think a separate class is needed for this? You can do e.g. IPath statePath = RSECorePlugin.getDefault().getStateLocation(); IPath markPath = statePath.append("localHostCreated.mark"); File markFile = new File(marPath.toOSString()); if (!markFile.exists()) { //check prerequisites and doIt try { markFile.createNewFile(); } catch(Exception e); } BTW, I'd appreciate if you also removed the commented-out old code, I really see no reason for keeping this in there. Martin -- Yes, you can do this. I was concerned about tracking who is creating stuff in the state location. I thought a class would be the best way to centralize this, but its probably better and easier to just look for references to getStateLocation(). -- Dave (In reply to comment #6) > > BTW, I'd appreciate if you also removed the commented-out old code, I really > see no reason for keeping this in there. > I've removed the commented out code. The current fix introduced an API regression since it no longer checks for SystemPreferencesManager.getShowLocalConnection() This means that products can no longer switch off the auto-creation of Local by setting "rse.showLocalConnection=false" in plugin_customization.ini. Also the fix should not use the Preferences as outlined in comment #6. Reopening. I've amended the code to honor SystemPreferencesManager.getShowLocalConnection() and I've changed the check to use a state file rather than a preference as suggested. |