1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-09 10:05:24 +02:00

Bug 160286 - NPE when deleting a profile in the team view.

The NPE is caused by bringing up the context menu on an empty selection under certain cirmcumstances. Fixing that revealed that profiles were being deleted in the model, but not on disk. Fixed that as well -- added methods to delete profiles by name and adjusted a method to include the ability to persist a deletion of a profile.
This commit is contained in:
David Dykstal 2006-10-26 02:29:28 +00:00
parent 0f60ad946b
commit 431f70ba8c
10 changed files with 206 additions and 72 deletions

View file

@ -29,6 +29,7 @@ import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.Vector; import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IContainer;
@ -39,7 +40,9 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; 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.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.rse.persistence.IRSEPersistenceProvider; import org.eclipse.rse.persistence.IRSEPersistenceProvider;
import org.eclipse.rse.persistence.dom.IRSEDOMConstants; import org.eclipse.rse.persistence.dom.IRSEDOMConstants;
import org.eclipse.rse.persistence.dom.RSEDOM; import org.eclipse.rse.persistence.dom.RSEDOM;
@ -99,7 +102,7 @@ public class PropertyFileProvider implements IRSEPersistenceProvider {
String candidateName = profileCandidate.getName(); String candidateName = profileCandidate.getName();
String[] parts = split(candidateName, 2); String[] parts = split(candidateName, 2);
if (parts[0].equals(AB_PROFILE)) { if (parts[0].equals(AB_PROFILE)) {
String name = parts[1]; String name = thaw(parts[1]);
names.add(name); names.add(name);
} }
} }
@ -132,6 +135,23 @@ public class PropertyFileProvider implements IRSEPersistenceProvider {
return true; return true;
} }
/* (non-Javadoc)
* @see org.eclipse.rse.persistence.IRSEPersistenceProvider#deleteProfile(java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
public IStatus deleteProfile(String profileName, IProgressMonitor monitor) {
IStatus result = Status.OK_STATUS;
IFolder profileFolder = getProfileFolder(profileName);
if (profileFolder.exists()) {
try {
profileFolder.delete(IResource.FORCE, monitor);
} catch (CoreException e) {
result = new Status(IStatus.ERROR, null, 0, "Unexpected Exception", e);
}
}
return result;
}
/** /**
* Saves a node from the DOM to the file system. * Saves a node from the DOM to the file system.
* @param node The node to save. * @param node The node to save.
@ -190,8 +210,6 @@ public class PropertyFileProvider implements IRSEPersistenceProvider {
} }
} }
private static final String VALID = "abcdefghijklmnopqrstuvwxyz0123456789-._";
private static final String UPPER = "ABCDEFGHIJKLMNOPQRTSUVWXYZ";
/** /**
* Returns the name of a folder that can be used to store a node of a particular * Returns the name of a folder that can be used to store a node of a particular
* type. Since this is a folder, its name must conform to the rules of the file * type. Since this is a folder, its name must conform to the rules of the file
@ -205,6 +223,24 @@ public class PropertyFileProvider implements IRSEPersistenceProvider {
String type = node.getType(); String type = node.getType();
type = (String) typeQualifiers.get(type); type = (String) typeQualifiers.get(type);
String name = node.getName(); String name = node.getName();
name = freeze(name);
String result = combine(type, name);
return result;
}
private static final String VALID = "abcdefghijklmnopqrstuvwxyz0123456789-._";
private static final String UPPER = "ABCDEFGHIJKLMNOPQRTSUVWXYZ";
/**
* Transforms an arbitrary name into one that can be used in any file system
* that supports long names. The transformation appends a number to the name
* that captures the case of the letters in the name. If a character falls
* outside the range of understood characters, it is converted to its hexadecimal unicode
* equivalent. Spaces are converted to underscores.
* @param name The name to be transformed
* @return The transformed name
* @see #thaw(String)
*/
private String freeze(String name) {
int p = name.indexOf(':'); int p = name.indexOf(':');
if (p >= 0) { if (p >= 0) {
name = name.substring(p + 1); name = name.substring(p + 1);
@ -230,7 +266,64 @@ public class PropertyFileProvider implements IRSEPersistenceProvider {
} }
} }
name = buf.toString() + "_" + Long.toString(suffix); name = buf.toString() + "_" + Long.toString(suffix);
String result = combine(type, name); return name;
}
/**
* Recovers an arbitrary name from its frozen counterpart.
* @param name The name to be transformed
* @return The transformed name
* @see #freeze(String)
*/
private String thaw(String name) {
String result = name;
Pattern suffixPattern = Pattern.compile("_(\\d+)$");
Matcher m = suffixPattern.matcher(name);
if (m.find()) {
String root = name.substring(0, m.start());
String suffix = m.group(1);
long caseCode = Long.parseLong(suffix);
root = thawUnicode(root);
root = thawCase(root, caseCode);
result = root;
}
return result;
}
private String thawUnicode(String name) {
Pattern unicodePattern = Pattern.compile("#(\\p{XDigit}+)#");
Matcher m = unicodePattern.matcher(name);
StringBuffer b = new StringBuffer();
int p0 = 0;
while (m.find()) {
int p1 = m.start();
String chunk0 = name.substring(p0, p1);
String digits = m.group(1);
int codePoint = Integer.valueOf(digits, 16).intValue();
char ch = (char) codePoint;
String chunk1 = Character.toString(ch);
b.append(chunk0);
b.append(chunk1);
p0 = m.end();
}
b.append(name.substring(p0));
String result = b.toString();
return result;
}
private String thawCase(String name, long caseCode) {
StringBuffer b = new StringBuffer();
char[] chars = name.toCharArray();
for (int i = chars.length - 1; i >= 0; i--) {
char ch = chars[i];
boolean shift = (caseCode & 1L) == 1;
if (shift) {
ch = (ch == '_') ? ' ' : Character.toUpperCase(ch);
}
b.append(ch);
caseCode = caseCode >> 1;
}
String result = b.reverse().toString();
return result; return result;
} }
@ -672,7 +765,7 @@ public class PropertyFileProvider implements IRSEPersistenceProvider {
* @return The folder that was created or found. * @return The folder that was created or found.
*/ */
private IFolder getProfileFolder(String profileName) { private IFolder getProfileFolder(String profileName) {
String profileFolderName = combine(AB_PROFILE, profileName); String profileFolderName = combine(AB_PROFILE, freeze(profileName));
IFolder providerFolder = getProviderFolder(); IFolder providerFolder = getProviderFolder();
IFolder profileFolder = getFolder(providerFolder, profileFolderName); IFolder profileFolder = getFolder(providerFolder, profileFolderName);
return profileFolder; return profileFolder;

View file

@ -25,7 +25,10 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
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.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilter;
@ -393,6 +396,20 @@ public class RSEPersistenceManager implements IRSEPersistenceManager {
return result; return result;
} }
/* (non-Javadoc)
* @see org.eclipse.rse.persistence.IRSEPersistenceManager#deleteProfile(java.lang.String)
*/
public void deleteProfile(final String profileName) {
Job job = new Job("delete profile") {
protected IStatus run(IProgressMonitor monitor) {
IRSEPersistenceProvider provider = getRSEPersistenceProvider();
IStatus result = provider.deleteProfile(profileName, monitor);
return result;
}
};
job.schedule();
}
public boolean isExporting() { public boolean isExporting() {
return _currentState == STATE_EXPORTING; return _currentState == STATE_EXPORTING;
} }

View file

@ -31,6 +31,8 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.rse.persistence.IRSEPersistenceProvider; import org.eclipse.rse.persistence.IRSEPersistenceProvider;
import org.eclipse.rse.persistence.dom.RSEDOM; import org.eclipse.rse.persistence.dom.RSEDOM;
@ -176,4 +178,17 @@ public class SerializingProvider implements IRSEPersistenceProvider
return true; return true;
} }
public IStatus deleteProfile(String profileName, IProgressMonitor monitor) {
IStatus result = Status.OK_STATUS;
IFile profileFile = getProfileFile(profileName, monitor);
if (profileFile.exists()) {
try {
profileFile.delete(IResource.FORCE | IResource.KEEP_HISTORY, monitor);
} catch (CoreException e) {
result = new Status(IStatus.ERROR, null, 0, "Unexpected Exception", e);
}
}
return result;
}
} }

View file

@ -16,6 +16,7 @@
package org.eclipse.rse.persistence; package org.eclipse.rse.persistence;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager; import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
@ -116,4 +117,10 @@ public interface IRSEPersistenceManager
public boolean isExporting(); public boolean isExporting();
public boolean isImporting(); public boolean isImporting();
/**
* Delete the persistent form of a profile.
* @param profileName The name of the profile to delete
*/
public void deleteProfile(String profileName);
} }

View file

@ -17,6 +17,7 @@
package org.eclipse.rse.persistence; package org.eclipse.rse.persistence;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.rse.persistence.dom.RSEDOM; import org.eclipse.rse.persistence.dom.RSEDOM;
@ -52,4 +53,11 @@ public interface IRSEPersistenceProvider
* @return The names of the profiles that have been saved by this persistence provider. * @return The names of the profiles that have been saved by this persistence provider.
*/ */
public String[] getSavedProfileNames(); public String[] getSavedProfileNames();
/**
* Removes a profile. Does nothing if the profile is not found.
* @param profileName the name of the profile to remove
* @param monitor the monitor for the operation
*/
public IStatus deleteProfile(String profileName, IProgressMonitor monitor);
} }

View file

@ -104,8 +104,10 @@ public interface ISystemProfileManager {
/** /**
* Delete the given profile * Delete the given profile
* @param profile the name of the profile to delete. * @param profile the name of the profile to delete.
* @param persist true if the deletion is meant to be persisted as well, false if the deletion is just in the
* model.
*/ */
public void deleteSystemProfile(ISystemProfile profile); public void deleteSystemProfile(ISystemProfile profile, boolean persist);
/** /**
* Clone the given profile * Clone the given profile

View file

@ -29,6 +29,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IAction;
@ -39,7 +40,6 @@ import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.Separator;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.ListenerList;
import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IOpenListener; import org.eclipse.jface.viewers.IOpenListener;
@ -118,7 +118,7 @@ public class SystemTeamViewPart
extends ViewPart extends ViewPart
implements ISetSelectionTarget, ISelectionProvider, ISystemModelChangeListener, implements ISetSelectionTarget, ISelectionProvider, ISystemModelChangeListener,
ISystemMessageLine, ISelectionChangedListener, ISystemMessageLine, ISelectionChangedListener,
ISystemDeleteTarget, ISystemRenameTarget, IMenuListener, IRSEViewPart ISystemDeleteTarget, ISystemRenameTarget, IRSEViewPart
{ {
private boolean menuListenerAdded; private boolean menuListenerAdded;
@ -132,9 +132,7 @@ public class SystemTeamViewPart
private SystemMessage sysErrorMessage; private SystemMessage sysErrorMessage;
// selectionChangedListeners // selectionChangedListeners
private ListenerList selectionChangedListeners = new ListenerList(6); private ListenerList selectionChangedListeners = new ListenerList(ListenerList.IDENTITY);
private boolean privateProfileStillExists = false;
// context menu actions for project... // context menu actions for project...
protected SystemTeamReloadAction reloadRSEAction; protected SystemTeamReloadAction reloadRSEAction;
@ -247,11 +245,21 @@ public class SystemTeamViewPart
menuMgr.setRemoveAllWhenShown(true); menuMgr.setRemoveAllWhenShown(true);
Menu menu = menuMgr.createContextMenu(treeViewer.getTree()); Menu menu = menuMgr.createContextMenu(treeViewer.getTree());
treeViewer.getTree().setMenu(menu); treeViewer.getTree().setMenu(menu);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
fillContextMenu(manager);
addMenuListener(manager);
}
});
getSite().registerContextMenu(menuMgr, treeViewer); getSite().registerContextMenu(menuMgr, treeViewer);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
scrubOtherContributions(manager);
}
});
// important to add our listener after registering, so we are called second! // important to add our listener after registering, so we are called second!
// This gives us the opportunity to scrub the contributions added by others, to screen out // This gives us the opportunity to scrub the contributions added by others, to screen out
// non-team additions. // non-team additions.
menuMgr.addMenuListener(this);
/* /*
menuMgr.addMenuListener(new IMenuListener() { menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) { public void menuAboutToShow(IMenuManager manager) {
@ -293,14 +301,7 @@ public class SystemTeamViewPart
fMemento= null; fMemento= null;
} }
/** private void addMenuListener(IMenuManager menu) {
* Called when the context menu is about to open.
* From IMenuListener interface
* Calls {@link #fillContextMenu(IMenuManager)}
*/
public void menuAboutToShow(IMenuManager menu)
{
fillContextMenu(menu);
if (!menuListenerAdded) if (!menuListenerAdded)
{ {
if (menu instanceof MenuManager) if (menu instanceof MenuManager)
@ -315,7 +316,6 @@ public class SystemTeamViewPart
} }
} }
} }
//System.out.println("Inside menuAboutToShow: menu null? "+( ((MenuManager)menu).getMenu()==null));
} }
// ------------------------------------------- // -------------------------------------------
@ -465,7 +465,6 @@ public class SystemTeamViewPart
if (!(selection instanceof StructuredSelection)) if (!(selection instanceof StructuredSelection))
return; return;
StructuredSelection ssel = (StructuredSelection)selection; StructuredSelection ssel = (StructuredSelection)selection;
java.util.List test = ssel.toList();
if (!ssel.isEmpty()) { if (!ssel.isEmpty()) {
// select and reveal the item // select and reveal the item
treeViewer.setSelection(ssel, true); treeViewer.setSelection(ssel, true);
@ -479,23 +478,18 @@ public class SystemTeamViewPart
{ {
SystemMenuManager ourMenu = new SystemMenuManager(menu); SystemMenuManager ourMenu = new SystemMenuManager(menu);
privateProfileStillExists = (SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile() != null);
// Populate with our stuff... // Populate with our stuff...
IStructuredSelection selection = getStructuredSelection(); IStructuredSelection selection = getStructuredSelection();
Object firstSelection = selection.getFirstElement(); Object firstSelection = selection.getFirstElement();
createStandardGroups(menu);
if (firstSelection instanceof IProject) if (firstSelection instanceof IProject)
{ {
// Scrub unrelated menu items // Scrub unrelated menu items
scrubOtherContributions(menu);
createStandardGroups(menu);
if (selection.size() == 1) if (selection.size() == 1)
fillProjectContextMenu(ourMenu, selection); fillProjectContextMenu(ourMenu, selection);
} }
else else
{ {
createStandardGroups(menu);
ISystemViewElementAdapter adapter = SystemAdapterHelpers.getAdapter(firstSelection, treeViewer); ISystemViewElementAdapter adapter = SystemAdapterHelpers.getAdapter(firstSelection, treeViewer);
if (adapter != null) if (adapter != null)
{ {
@ -513,7 +507,7 @@ public class SystemTeamViewPart
} }
} }
} }
// wail through all actions, updating shell and selection // whale through all actions, updating shell and selection
IContributionItem[] items = menu.getItems(); IContributionItem[] items = menu.getItems();
for (int idx=0; idx < items.length; idx++) for (int idx=0; idx < items.length; idx++)
{ {
@ -657,6 +651,7 @@ public class SystemTeamViewPart
*/ */
private SystemTeamReloadAction getReloadRSEAction(IStructuredSelection selection) private SystemTeamReloadAction getReloadRSEAction(IStructuredSelection selection)
{ {
boolean privateProfileStillExists = (SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile() != null);
if (reloadRSEAction == null) if (reloadRSEAction == null)
reloadRSEAction = new SystemTeamReloadAction(getShell()); reloadRSEAction = new SystemTeamReloadAction(getShell());
reloadRSEAction.setSelection(selection); reloadRSEAction.setSelection(selection);
@ -718,27 +713,21 @@ public class SystemTeamViewPart
/** /**
* Scrub the popup menu to remove everything but team-related stuff... * Scrub the popup menu to remove everything but team-related stuff...
*/ */
private void scrubOtherContributions(IMenuManager menuMgr) private void scrubOtherContributions(IMenuManager menuMgr) {
{ IStructuredSelection selection = getStructuredSelection();
Object firstSelection = selection.getFirstElement();
if (firstSelection instanceof IProject) {
boolean privateProfileStillExists = (SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile() != null);
IContributionItem items[] = menuMgr.getItems(); IContributionItem items[] = menuMgr.getItems();
if (items != null) {
if (items != null) for (int idx = 0; idx < items.length; idx++) {
{
//System.out.println("# existing menu items: "+items.length);
for (int idx=0; idx<items.length; idx++)
{
IContributionItem item = items[idx]; IContributionItem item = items[idx];
//System.out.println("menu item id: " + item.getId()); if (item.getId() != null) {
if (item.getId()!=null) if (!item.getId().equals("team.main") || privateProfileStillExists) menuMgr.remove(item);
{ }
if (!item.getId().equals("team.main") || privateProfileStillExists)
menuMgr.remove(item);
} }
} }
} }
//else
//System.out.println("existing menu items null");
} }
public void dispose() public void dispose()
@ -761,8 +750,8 @@ public class SystemTeamViewPart
*/ */
public void updateTitle() public void updateTitle()
{ {
Object input = getTreeViewer().getInput(); // Object input = getTreeViewer().getInput();
String viewName = getConfigurationElement().getAttribute("name"); // String viewName = getConfigurationElement().getAttribute("name");
setPartName(getTitle()); setPartName(getTitle());
setTitleToolTip(""); setTitleToolTip("");
} }

View file

@ -99,7 +99,7 @@ public class SystemProfileManager implements ISystemProfileManager {
// FIXME - used to use MOF // FIXME - used to use MOF
ISystemProfile existingProfile = getSystemProfile(name); ISystemProfile existingProfile = getSystemProfile(name);
if (existingProfile != null) { if (existingProfile != null) {
deleteSystemProfile(existingProfile); // replace the existing one with a new profile deleteSystemProfile(existingProfile, false); // replace the existing one with a new profile
} }
ISystemProfile newProfile = internalCreateSystemProfileAndFolder(name); ISystemProfile newProfile = internalCreateSystemProfileAndFolder(name);
@ -265,9 +265,9 @@ public class SystemProfileManager implements ISystemProfileManager {
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.model.ISystemProfileManager#deleteSystemProfile(org.eclipse.rse.core.model.ISystemProfile) * @see org.eclipse.rse.core.model.ISystemProfileManager#deleteSystemProfile(org.eclipse.rse.core.model.ISystemProfile, boolean)
*/ */
public void deleteSystemProfile(ISystemProfile profile) { public void deleteSystemProfile(ISystemProfile profile, boolean persist) {
String oldName = profile.getName(); String oldName = profile.getName();
boolean isActive = isSystemProfileActive(oldName); boolean isActive = isSystemProfileActive(oldName);
getProfiles().remove(profile); getProfiles().remove(profile);
@ -280,7 +280,9 @@ public class SystemProfileManager implements ISystemProfileManager {
*/ */
if (isActive) SystemPreferencesManager.getPreferencesManager().deleteActiveProfile(oldName); if (isActive) SystemPreferencesManager.getPreferencesManager().deleteActiveProfile(oldName);
invalidateCache(); invalidateCache();
// FIXME RSEUIPlugin.getThePersistenceManager().save(this); if (persist) {
RSEUIPlugin.getThePersistenceManager().deleteProfile(oldName);
}
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -1020,7 +1020,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
if (factory != null) if (factory != null)
factory.deletingSystemProfile(newProfile); factory.deletingSystemProfile(newProfile);
} }
getSystemProfileManager().deleteSystemProfile(newProfile); getSystemProfileManager().deleteSystemProfile(newProfile, true);
} }
catch (Exception exc) catch (Exception exc)
{ {
@ -1071,7 +1071,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
} }
} }
// last step... physically blow away the profile... // last step... physically blow away the profile...
getSystemProfileManager().deleteSystemProfile(profile); getSystemProfileManager().deleteSystemProfile(profile, true);
SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list
if ((connections != null) && (connections.length > 0)) // defect 42112 if ((connections != null) && (connections.length > 0)) // defect 42112
fireEvent(new org.eclipse.rse.model.SystemResourceChangeEvent(connections, ISystemResourceChangeEvents.EVENT_DELETE_MANY, this)); fireEvent(new org.eclipse.rse.model.SystemResourceChangeEvent(connections, ISystemResourceChangeEvents.EVENT_DELETE_MANY, this));

View file

@ -38,15 +38,16 @@ public class SystemAdapterHelpers
* object. Returns null if the adapter is not defined or the * object. Returns null if the adapter is not defined or the
* object is not adaptable. * object is not adaptable.
*/ */
public static ISystemViewElementAdapter getAdapter(Object o) public static ISystemViewElementAdapter getAdapter(Object o) {
{
ISystemViewElementAdapter adapter = null; ISystemViewElementAdapter adapter = null;
if (!(o instanceof IAdaptable)) if (o instanceof IAdaptable) {
adapter = (ISystemViewElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemViewElementAdapter.class); adapter = (ISystemViewElementAdapter) ((IAdaptable) o).getAdapter(ISystemViewElementAdapter.class);
else } if (o != null) {
adapter = (ISystemViewElementAdapter)((IAdaptable)o).getAdapter(ISystemViewElementAdapter.class); adapter = (ISystemViewElementAdapter) Platform.getAdapterManager().getAdapter(o, ISystemViewElementAdapter.class);
}
return adapter; return adapter;
} }
/** /**
* Overload to use when calling from a viewer. This not only finds and returns * Overload to use when calling from a viewer. This not only finds and returns
* the adapter, but also sets its viewer to the given viewer. Many actions rely * the adapter, but also sets its viewer to the given viewer. Many actions rely