Lines 13-18
Link Here
|
13 |
* Contributors: |
13 |
* Contributors: |
14 |
* Dave McKnight (IBM) - [177155] Move from rse.ui/systems/org.eclipse.rse.core |
14 |
* Dave McKnight (IBM) - [177155] Move from rse.ui/systems/org.eclipse.rse.core |
15 |
* Martin Oberhuber (Wind River) - Re-add missing methods for user actions |
15 |
* Martin Oberhuber (Wind River) - Re-add missing methods for user actions |
|
|
16 |
* David Dykstal (IBM) - [189858] delayed the creation of the remote systems project |
17 |
* removed unneeded first time logic and flags |
18 |
* renamed createRemoteSystemsProjectInternal to ensureRemoteSystemsProject |
19 |
* made ensureRemoteSystemsProject private instead of protected |
16 |
********************************************************************************/ |
20 |
********************************************************************************/ |
17 |
|
21 |
|
18 |
package org.eclipse.rse.core; |
22 |
package org.eclipse.rse.core; |
Lines 59-66
Link Here
|
59 |
|
63 |
|
60 |
private static IProject remoteSystemsProject = null; |
64 |
private static IProject remoteSystemsProject = null; |
61 |
private static IProject remoteSystemsTempFilesProject = null; |
65 |
private static IProject remoteSystemsTempFilesProject = null; |
62 |
private static boolean initDone = false; |
|
|
63 |
private static boolean firstTime = false; |
64 |
private static SystemResourceHelpers helpers = null; |
66 |
private static SystemResourceHelpers helpers = null; |
65 |
|
67 |
|
66 |
private static ISystemResourceListener _listener = null; |
68 |
private static ISystemResourceListener _listener = null; |
Lines 146-166
Link Here
|
146 |
} |
148 |
} |
147 |
|
149 |
|
148 |
/** |
150 |
/** |
149 |
* Get the default remote systems project. |
151 |
* Get the default remote systems project. |
150 |
* @return IProject handle of the project. Use exists() to test existence. |
152 |
* If found but closed, this will open the project. |
151 |
*/ |
153 |
* @return IProject handle of the project. Use exists() to test existence. |
152 |
public static IProject getRemoteSystemsProject() |
154 |
*/ |
153 |
{ |
155 |
public static IProject getRemoteSystemsProject() |
154 |
if (remoteSystemsProject == null) |
156 |
{ |
155 |
{ |
157 |
return getRemoteSystemsProject(true); |
156 |
remoteSystemsProject = ResourcesPlugin.getWorkspace().getRoot().getProject(RESOURCE_PROJECT_NAME); |
158 |
} |
157 |
if (!initDone || !remoteSystemsProject.isAccessible()) |
|
|
158 |
remoteSystemsProject = createRemoteSystemsProjectInternal(remoteSystemsProject); |
159 |
} |
160 |
return remoteSystemsProject; |
161 |
} |
162 |
|
159 |
|
163 |
/** |
160 |
/** |
|
|
161 |
* Get the default remote systems project. |
162 |
* If found but closed, this will open the project. |
163 |
* @param force if true force the creation of the project if not found. |
164 |
* In any case, returns handle to the project. |
165 |
* @return IProject handle of the project. Use exists() to test existence. |
166 |
*/ |
167 |
public static IProject getRemoteSystemsProject(boolean force) { |
168 |
if (remoteSystemsProject == null) { |
169 |
remoteSystemsProject = ResourcesPlugin.getWorkspace().getRoot().getProject(RESOURCE_PROJECT_NAME); |
170 |
} |
171 |
if ((!remoteSystemsProject.exists() && force) || (remoteSystemsProject.exists() && !remoteSystemsProject.isOpen())) { |
172 |
ensureRemoteSystemsProject(remoteSystemsProject); |
173 |
} |
174 |
return remoteSystemsProject; |
175 |
} |
176 |
|
177 |
/** |
164 |
* Get the default remote systems temp files project. |
178 |
* Get the default remote systems temp files project. |
165 |
* @return IProject handle of the project. Use exists() to test existence. |
179 |
* @return IProject handle of the project. Use exists() to test existence. |
166 |
*/ |
180 |
*/ |
Lines 177-183
Link Here
|
177 |
* @param proj the handle for the remote systems project |
191 |
* @param proj the handle for the remote systems project |
178 |
* @return the IProject handle of the project (the argument) |
192 |
* @return the IProject handle of the project (the argument) |
179 |
*/ |
193 |
*/ |
180 |
protected static IProject createRemoteSystemsProjectInternal(IProject proj) |
194 |
private static IProject ensureRemoteSystemsProject(IProject proj) |
181 |
{ |
195 |
{ |
182 |
// Check first for the project to be closed. If yes, try to open it and if this fails, |
196 |
// Check first for the project to be closed. If yes, try to open it and if this fails, |
183 |
// try to delete if first before failing here. The case is that the user removed the |
197 |
// try to delete if first before failing here. The case is that the user removed the |
Lines 189-195
Link Here
|
189 |
} catch (Exception e) { |
203 |
} catch (Exception e) { |
190 |
try { |
204 |
try { |
191 |
proj.delete(false, true, null); |
205 |
proj.delete(false, true, null); |
192 |
|
|
|
193 |
RSECorePlugin.getDefault().getLogger().logWarning("Removed stale remote systems project reference. Re-creating remote system project to recover."); //$NON-NLS-1$ |
206 |
RSECorePlugin.getDefault().getLogger().logWarning("Removed stale remote systems project reference. Re-creating remote system project to recover."); //$NON-NLS-1$ |
194 |
} catch (CoreException exc) { |
207 |
} catch (CoreException exc) { |
195 |
// If the delete fails, the original opening error will be passed to the error log. |
208 |
// If the delete fails, the original opening error will be passed to the error log. |
Lines 205-235
Link Here
|
205 |
String newNatures[] = { RemoteSystemsProject.ID }; |
218 |
String newNatures[] = { RemoteSystemsProject.ID }; |
206 |
description.setNatureIds(newNatures); |
219 |
description.setNatureIds(newNatures); |
207 |
proj.setDescription(description, null); |
220 |
proj.setDescription(description, null); |
208 |
firstTime = true; |
|
|
209 |
} catch (Exception e) { |
221 |
} catch (Exception e) { |
210 |
RSECorePlugin.getDefault().getLogger().logError("error creating remote systems project", e); //$NON-NLS-1$ |
222 |
RSECorePlugin.getDefault().getLogger().logError("error creating remote systems project", e); //$NON-NLS-1$ |
211 |
} |
223 |
} |
212 |
} |
224 |
} |
213 |
try { |
|
|
214 |
// create types folder... |
215 |
// getResourceHelpers().getOrCreateFolder(proj, RESOURCE_TYPE_FILTERS_FOLDER_NAME); |
216 |
} catch (Exception e) { |
217 |
RSECorePlugin.getDefault().getLogger().logError("error opening/creating types folder", e); //$NON-NLS-1$ |
218 |
} |
219 |
initDone = true; |
220 |
return proj; |
225 |
return proj; |
221 |
} |
226 |
} |
222 |
/** |
227 |
|
223 |
* Return true if we just created the remote systems project for the first time. |
|
|
224 |
* This call has the side effect of resetting the flag to false so it doesn't return |
225 |
* true more than once, ever. |
226 |
*/ |
227 |
public static boolean isFirstTime() |
228 |
{ |
229 |
boolean firsttime = firstTime; |
230 |
firstTime = false; |
231 |
return firsttime; |
232 |
} |
233 |
// -------------------------------------------- |
228 |
// -------------------------------------------- |
234 |
// GET ALL EXISTING PROFILE NAMES OR FOLDERS... |
229 |
// GET ALL EXISTING PROFILE NAMES OR FOLDERS... |
235 |
// -------------------------------------------- |
230 |
// -------------------------------------------- |
Lines 385-391
Link Here
|
385 |
String folderName = getFolderName(ssFactory); |
380 |
String folderName = getFolderName(ssFactory); |
386 |
return getResourceHelpers().getOrCreateFolder(parentFolder, folderName); // Do create it. |
381 |
return getResourceHelpers().getOrCreateFolder(parentFolder, folderName); // Do create it. |
387 |
} |
382 |
} |
388 |
|
383 |
|
389 |
/** |
384 |
/** |
390 |
* Get compile commands root folder given a system profile name and subsystem factory Id. |
385 |
* Get compile commands root folder given a system profile name and subsystem factory Id. |
391 |
* This is a special-needs method provided for the Import action processing, |
386 |
* This is a special-needs method provided for the Import action processing, |
Lines 396-402
Link Here
|
396 |
IFolder parentFolder = getCompileCommandsFolder(profileName); |
391 |
IFolder parentFolder = getCompileCommandsFolder(profileName); |
397 |
return getResourceHelpers().getOrCreateFolder(parentFolder, factoryId); // Do create it. |
392 |
return getResourceHelpers().getOrCreateFolder(parentFolder, factoryId); // Do create it. |
398 |
} |
393 |
} |
399 |
|
|
|
400 |
|
394 |
|
401 |
// ------------------- |
395 |
// ------------------- |
402 |
// FOLDER ACTIONS... |
396 |
// FOLDER ACTIONS... |