mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
[191130][api][breaking] stop exception from printing out on clean workspace startup
This commit is contained in:
parent
b0ee4f3276
commit
20a15b6202
8 changed files with 67 additions and 44 deletions
|
@ -120,6 +120,12 @@ More information can be found in the associated bugzilla items.
|
|||
<ul>
|
||||
<li>TM @buildId@ Breaking API Changes
|
||||
<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>
|
||||
<li>TM 2.0RC2 Breaking API Changes
|
||||
<ul>
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
* made ensureRemoteSystemsProject private instead of protected
|
||||
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
|
||||
* 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;
|
||||
|
@ -148,22 +150,24 @@ public class SystemResourceManager implements SystemResourceConstants
|
|||
_listener.removeResourceChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default remote systems project.
|
||||
* If found but closed, this will open the project.
|
||||
* @return IProject handle of the project. Use exists() to test existence.
|
||||
*/
|
||||
public static IProject getRemoteSystemsProject()
|
||||
{
|
||||
return getRemoteSystemsProject(true);
|
||||
}
|
||||
// /**
|
||||
// * Get the default remote systems project.
|
||||
// * If found but closed, this will open the project.
|
||||
// * @return IProject handle of the project. Use exists() to test existence.
|
||||
// * @deprecated use {@link #getRemoteSystemsProject(boolean)} instead.
|
||||
// */
|
||||
// public static IProject getRemoteSystemsProject()
|
||||
// {
|
||||
// return getRemoteSystemsProject(true);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the default remote systems project.
|
||||
* If found but closed, this will open the project.
|
||||
* @param force if true force the creation of the project if not found.
|
||||
* 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) {
|
||||
if (remoteSystemsProject == null) {
|
||||
|
@ -273,10 +277,10 @@ public class SystemResourceManager implements SystemResourceConstants
|
|||
/**
|
||||
* Get profiles folder for a given profile name
|
||||
*/
|
||||
public static IFolder getProfileFolder(String profileName)
|
||||
{
|
||||
return getResourceHelpers().getOrCreateFolder(getRemoteSystemsProject(),profileName);
|
||||
}
|
||||
// public static IFolder getProfileFolder(String profileName)
|
||||
// {
|
||||
// return getResourceHelpers().getOrCreateFolder(getRemoteSystemsProject(),profileName);
|
||||
// }
|
||||
|
||||
|
||||
// -------------------
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* David Dykstal (IBM) - [189858] delayed the creation of the remote systems project by
|
||||
* using handle-only operations. The project is created only
|
||||
* if required to exist for writing.
|
||||
* David Dykstal (IBM) - [191130] use explicit getRemoteSystemsProject(boolean) method
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.persistence;
|
||||
|
@ -136,7 +137,7 @@ class PFWorkspaceLocation implements PFPersistenceLocation {
|
|||
private void ensure(IContainer resource) {
|
||||
if (!resource.isAccessible()) {
|
||||
if (resource.getType() == IResource.PROJECT) {
|
||||
SystemResourceManager.getRemoteSystemsProject();
|
||||
SystemResourceManager.getRemoteSystemsProject(true);
|
||||
} else {
|
||||
IFolder folder = (IFolder) resource;
|
||||
ensure(folder.getParent());
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
||||
* David Dykstal (IBM) - [191130] use explicit getRemoteSystemsProject(boolean) method
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.persistence;
|
||||
|
@ -57,21 +58,23 @@ public class SerializingProvider implements IRSEPersistenceProvider {
|
|||
*/
|
||||
List names = new Vector(10);
|
||||
try {
|
||||
IProject project = SystemResourceManager.getRemoteSystemsProject();
|
||||
IResource[] candidates = project.members();
|
||||
for (int i = 0; i < candidates.length; i++) {
|
||||
IResource candidate = candidates[i];
|
||||
if (candidate.getType() == IResource.FOLDER) {
|
||||
IFolder candidateFolder = (IFolder) candidate;
|
||||
IResource[] children = candidateFolder.members();
|
||||
if (children.length == 1) {
|
||||
IResource child = children[0];
|
||||
if (child.getType() == IResource.FILE) {
|
||||
String profileName = candidateFolder.getName();
|
||||
String domFileName = profileName + ".rsedom"; //$NON-NLS-1$
|
||||
String childName = child.getName();
|
||||
if (childName.equals(domFileName)) {
|
||||
names.add(profileName);
|
||||
IProject project = SystemResourceManager.getRemoteSystemsProject(false);
|
||||
if (project.isAccessible()) {
|
||||
IResource[] candidates = project.members();
|
||||
for (int i = 0; i < candidates.length; i++) {
|
||||
IResource candidate = candidates[i];
|
||||
if (candidate.getType() == IResource.FOLDER) {
|
||||
IFolder candidateFolder = (IFolder) candidate;
|
||||
IResource[] children = candidateFolder.members();
|
||||
if (children.length == 1) {
|
||||
IResource child = children[0];
|
||||
if (child.getType() == IResource.FILE) {
|
||||
String profileName = candidateFolder.getName();
|
||||
String domFileName = profileName + ".rsedom"; //$NON-NLS-1$
|
||||
String childName = child.getName();
|
||||
if (childName.equals(domFileName)) {
|
||||
names.add(profileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +117,7 @@ public class SerializingProvider implements IRSEPersistenceProvider {
|
|||
}
|
||||
|
||||
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
|
||||
try {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
|
||||
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
||||
* 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;
|
||||
|
@ -25,6 +26,7 @@ import org.eclipse.core.resources.IResourceChangeEvent;
|
|||
import org.eclipse.core.resources.IResourceChangeListener;
|
||||
import org.eclipse.core.resources.IResourceDelta;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.rse.core.ISystemResourceListener;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.SystemResourceManager;
|
||||
|
@ -361,16 +363,18 @@ public class SystemResourceListener implements ISystemResourceListener, Runnable
|
|||
{
|
||||
if (!resource.getName().equals(remoteSystemsProject.getName()))
|
||||
return true;
|
||||
// [191130] the event can be ignored if the project cannot be accessed
|
||||
if (!resource.isAccessible()) return true;
|
||||
try
|
||||
{
|
||||
if (!(((IProject) resource).hasNature(RemoteSystemsProject.ID)))
|
||||
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$
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -733,7 +737,7 @@ public class SystemResourceListener implements ISystemResourceListener, Runnable
|
|||
{
|
||||
SystemResourceListener us = null;
|
||||
if (inst == null)
|
||||
us = getListener(SystemResourceManager.getRemoteSystemsProject());
|
||||
us = getListener(SystemResourceManager.getRemoteSystemsProject(false));
|
||||
else
|
||||
us = inst;
|
||||
|
||||
|
@ -747,7 +751,7 @@ public class SystemResourceListener implements ISystemResourceListener, Runnable
|
|||
{
|
||||
SystemResourceListener us = null;
|
||||
if (inst == null)
|
||||
us = getListener(SystemResourceManager.getRemoteSystemsProject());
|
||||
us = getListener(SystemResourceManager.getRemoteSystemsProject(false));
|
||||
else
|
||||
us = inst;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
|
||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
||||
* 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;
|
||||
|
@ -210,7 +211,7 @@ public class SystemTeamViewProfileAdapter
|
|||
*/
|
||||
public Object getParent(Object element)
|
||||
{
|
||||
return SystemResourceManager.getRemoteSystemsProject();
|
||||
return SystemResourceManager.getRemoteSystemsProject(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,9 +13,11 @@
|
|||
*
|
||||
* Contributors:
|
||||
* 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;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.core.SystemResourceManager;
|
||||
|
@ -67,11 +69,12 @@ public class SystemTeamViewRefreshAllAction extends SystemBaseAction
|
|||
public void run()
|
||||
{
|
||||
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) {}
|
||||
|
||||
SystemTeamView teamViewer = (SystemTeamView)teamView.getTreeViewer();
|
||||
teamViewer.refresh();
|
||||
//System.out.println("Running refresh all");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* 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;
|
||||
|
@ -54,7 +54,8 @@ public class SystemTeamViewResourceAdapterFactory implements IAdapterFactory
|
|||
if (adaptableObject instanceof ISystemRegistry)
|
||||
{
|
||||
//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
|
||||
else if (adaptableObject instanceof SystemProfile)
|
||||
|
|
Loading…
Add table
Reference in a new issue