1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-14 12:35:22 +02:00

[191130][api][breaking] stop exception from printing out on clean workspace startup

This commit is contained in:
David Dykstal 2007-06-11 15:52:57 +00:00
parent b0ee4f3276
commit 20a15b6202
8 changed files with 67 additions and 44 deletions

View file

@ -120,6 +120,12 @@ More information can be found in the associated bugzilla items.
<ul> <ul>
<li>TM @buildId@ Breaking API Changes <li>TM @buildId@ Breaking API Changes
<ul> <ul>
<li><b>SystemResourceManager</b> - removed two methods getRemoteSystemsProject() and getProfileFolder(String).
getRemoteSystemsProject() was a convenience method that was equivalent to getRemoteSystemsProject(true) and it forced the
creation of RemoteSystemConnections project in the workspace. This was undesirable given the current persistence provider
defaults.
getProfileFolder(String) returned a IFolder for a profile under the old persistence provider scheme. The method was obsolete and
should not be being used at all.</li>
</ul></li> </ul></li>
<li>TM 2.0RC2 Breaking API Changes <li>TM 2.0RC2 Breaking API Changes
<ul> <ul>

View file

@ -19,6 +19,8 @@
* made ensureRemoteSystemsProject private instead of protected * made ensureRemoteSystemsProject private instead of protected
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands * David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin * API to the user actions plugin
* David Dykstal (IBM) - [191130] remove getRemoteSystemsProject() and getProfileFolder()
* as part of the work to removed the exception printed at startup.
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core; package org.eclipse.rse.core;
@ -148,22 +150,24 @@ public class SystemResourceManager implements SystemResourceConstants
_listener.removeResourceChangeListener(l); _listener.removeResourceChangeListener(l);
} }
/** // /**
* Get the default remote systems project. // * Get the default remote systems project.
* If found but closed, this will open the project. // * If found but closed, this will open the project.
* @return IProject handle of the project. Use exists() to test existence. // * @return IProject handle of the project. Use exists() to test existence.
*/ // * @deprecated use {@link #getRemoteSystemsProject(boolean)} instead.
public static IProject getRemoteSystemsProject() // */
{ // public static IProject getRemoteSystemsProject()
return getRemoteSystemsProject(true); // {
} // return getRemoteSystemsProject(true);
// }
/** /**
* Get the default remote systems project. * Get the default remote systems project.
* If found but closed, this will open the project. * If found but closed, this will open the project.
* @param force if true force the creation of the project if not found. * @param force if true force the creation of the project if not found.
* In any case, returns handle to the project. * In any case, returns handle to the project.
* @return IProject handle of the project. Use exists() to test existence. * @return IProject handle of the project. Clients should use
* exists() or isAccessible() to test existence.
*/ */
public static IProject getRemoteSystemsProject(boolean force) { public static IProject getRemoteSystemsProject(boolean force) {
if (remoteSystemsProject == null) { if (remoteSystemsProject == null) {
@ -273,10 +277,10 @@ public class SystemResourceManager implements SystemResourceConstants
/** /**
* Get profiles folder for a given profile name * Get profiles folder for a given profile name
*/ */
public static IFolder getProfileFolder(String profileName) // public static IFolder getProfileFolder(String profileName)
{ // {
return getResourceHelpers().getOrCreateFolder(getRemoteSystemsProject(),profileName); // return getResourceHelpers().getOrCreateFolder(getRemoteSystemsProject(),profileName);
} // }
// ------------------- // -------------------

View file

@ -10,6 +10,7 @@
* David Dykstal (IBM) - [189858] delayed the creation of the remote systems project by * David Dykstal (IBM) - [189858] delayed the creation of the remote systems project by
* using handle-only operations. The project is created only * using handle-only operations. The project is created only
* if required to exist for writing. * if required to exist for writing.
* David Dykstal (IBM) - [191130] use explicit getRemoteSystemsProject(boolean) method
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.persistence; package org.eclipse.rse.internal.persistence;
@ -136,7 +137,7 @@ class PFWorkspaceLocation implements PFPersistenceLocation {
private void ensure(IContainer resource) { private void ensure(IContainer resource) {
if (!resource.isAccessible()) { if (!resource.isAccessible()) {
if (resource.getType() == IResource.PROJECT) { if (resource.getType() == IResource.PROJECT) {
SystemResourceManager.getRemoteSystemsProject(); SystemResourceManager.getRemoteSystemsProject(true);
} else { } else {
IFolder folder = (IFolder) resource; IFolder folder = (IFolder) resource;
ensure(folder.getParent()); ensure(folder.getParent());

View file

@ -12,6 +12,7 @@
* *
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* David Dykstal (IBM) - [191130] use explicit getRemoteSystemsProject(boolean) method
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.persistence; package org.eclipse.rse.internal.persistence;
@ -57,7 +58,8 @@ public class SerializingProvider implements IRSEPersistenceProvider {
*/ */
List names = new Vector(10); List names = new Vector(10);
try { try {
IProject project = SystemResourceManager.getRemoteSystemsProject(); IProject project = SystemResourceManager.getRemoteSystemsProject(false);
if (project.isAccessible()) {
IResource[] candidates = project.members(); IResource[] candidates = project.members();
for (int i = 0; i < candidates.length; i++) { for (int i = 0; i < candidates.length; i++) {
IResource candidate = candidates[i]; IResource candidate = candidates[i];
@ -77,6 +79,7 @@ public class SerializingProvider implements IRSEPersistenceProvider {
} }
} }
} }
}
} catch (CoreException e) { } catch (CoreException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
@ -114,7 +117,7 @@ public class SerializingProvider implements IRSEPersistenceProvider {
} }
private IFile getProfileFile(String domName, IProgressMonitor monitor) { private IFile getProfileFile(String domName, IProgressMonitor monitor) {
IProject project = SystemResourceManager.getRemoteSystemsProject(); IProject project = SystemResourceManager.getRemoteSystemsProject(true);
// before loading, make sure the project is in synch // before loading, make sure the project is in synch
try { try {

View file

@ -14,6 +14,7 @@
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
* David Dykstal (IBM) - [191130] log exception instead of printing, do not log if project is not available
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui; package org.eclipse.rse.internal.ui;
@ -25,6 +26,7 @@ import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.rse.core.ISystemResourceListener; import org.eclipse.rse.core.ISystemResourceListener;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.SystemResourceManager; import org.eclipse.rse.core.SystemResourceManager;
@ -361,14 +363,16 @@ public class SystemResourceListener implements ISystemResourceListener, Runnable
{ {
if (!resource.getName().equals(remoteSystemsProject.getName())) if (!resource.getName().equals(remoteSystemsProject.getName()))
return true; return true;
// [191130] the event can be ignored if the project cannot be accessed
if (!resource.isAccessible()) return true;
try try
{ {
if (!(((IProject) resource).hasNature(RemoteSystemsProject.ID))) if (!(((IProject) resource).hasNature(RemoteSystemsProject.ID)))
return true; return true;
} }
catch (Exception exc) catch (CoreException exc)
{ {
System.out.println("Exception trying to test the natures of the project that fired a resource change event"); //$NON-NLS-1$ RSECorePlugin.getDefault().getLogger().logError("Exception trying to test the natures of the project that fired a resource change event", exc); //$NON-NLS-1$
} }
} }
} }
@ -733,7 +737,7 @@ public class SystemResourceListener implements ISystemResourceListener, Runnable
{ {
SystemResourceListener us = null; SystemResourceListener us = null;
if (inst == null) if (inst == null)
us = getListener(SystemResourceManager.getRemoteSystemsProject()); us = getListener(SystemResourceManager.getRemoteSystemsProject(false));
else else
us = inst; us = inst;
@ -747,7 +751,7 @@ public class SystemResourceListener implements ISystemResourceListener, Runnable
{ {
SystemResourceListener us = null; SystemResourceListener us = null;
if (inst == null) if (inst == null)
us = getListener(SystemResourceManager.getRemoteSystemsProject()); us = getListener(SystemResourceManager.getRemoteSystemsProject(false));
else else
us = inst; us = inst;

View file

@ -17,6 +17,7 @@
* Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David Dykstal (IBM) - [191130] use new getRemoteSystemsProject(boolean) call
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view.team; package org.eclipse.rse.internal.ui.view.team;
@ -210,7 +211,7 @@ public class SystemTeamViewProfileAdapter
*/ */
public Object getParent(Object element) public Object getParent(Object element)
{ {
return SystemResourceManager.getRemoteSystemsProject(); return SystemResourceManager.getRemoteSystemsProject(false);
} }
/** /**

View file

@ -13,9 +13,11 @@
* *
* Contributors: * Contributors:
* Michael Berger (IBM) - 146339 Added refresh action graphic. * Michael Berger (IBM) - 146339 Added refresh action graphic.
* David Dykstal (IBM) - [191130] use new getRemoteSystemsProject(boolean) method
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.ui.view.team; package org.eclipse.rse.internal.ui.view.team;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.SystemResourceManager; import org.eclipse.rse.core.SystemResourceManager;
@ -67,11 +69,12 @@ public class SystemTeamViewRefreshAllAction extends SystemBaseAction
public void run() public void run()
{ {
try { try {
SystemResourceManager.getRemoteSystemsProject().refreshLocal(IResource.DEPTH_INFINITE, null); IProject connectionsProject = SystemResourceManager.getRemoteSystemsProject(false);
if (connectionsProject.isAccessible()) {
connectionsProject.refreshLocal(IResource.DEPTH_INFINITE, null);
}
} catch (Exception exc) {} } catch (Exception exc) {}
SystemTeamView teamViewer = (SystemTeamView)teamView.getTreeViewer(); SystemTeamView teamViewer = (SystemTeamView)teamView.getTreeViewer();
teamViewer.refresh(); teamViewer.refresh();
//System.out.println("Running refresh all");
} }
} }

View file

@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * David Dykstal (IBM) - [191130] fix unnecessary creation of the remote systems project
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.ui.view.team; package org.eclipse.rse.internal.ui.view.team;
@ -54,7 +54,8 @@ public class SystemTeamViewResourceAdapterFactory implements IAdapterFactory
if (adaptableObject instanceof ISystemRegistry) if (adaptableObject instanceof ISystemRegistry)
{ {
//SystemRegistry sr = (SystemRegistry)adaptableObject; //SystemRegistry sr = (SystemRegistry)adaptableObject;
adapter = SystemResourceManager.getRemoteSystemsProject(); // [191130] do not force the creation of the project, just return its handle
adapter = SystemResourceManager.getRemoteSystemsProject(false);
} }
/* deferred /* deferred
else if (adaptableObject instanceof SystemProfile) else if (adaptableObject instanceof SystemProfile)