1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-18 22:45:23 +02:00

[341573] NPE on Show in Remote Systems view from Remote System Details view

This commit is contained in:
David McKnight 2011-04-01 12:18:44 +00:00
parent 2981614a55
commit 5e79253a7c

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2009 IBM Corporation. All rights reserved.
* Copyright (c) 2010 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -11,6 +11,7 @@
* Contributors:
* David McKnight (IBM) - [160105] [usability] Universal action needed to locate a resource in the Remote Systems View
* David McKnight (IBM) - [218227][usability] Contribute a "Show in RSE" action to Resource Navigator and Project Explorer
* David McKnight (IBM) - [341573] NPE on Show in Remote Systems view from Remote System Details view
********************************************************************************/
package org.eclipse.rse.internal.ui.actions;
@ -38,6 +39,7 @@ import org.eclipse.rse.internal.ui.view.SystemView;
import org.eclipse.rse.internal.ui.view.SystemViewPart;
import org.eclipse.rse.services.clientserver.messages.CommonMessages;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.model.ISystemPromptableObject;
import org.eclipse.rse.ui.view.ContextObject;
import org.eclipse.rse.ui.view.ISystemTree;
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
@ -340,6 +342,7 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
ISystemViewElementAdapter adapter = getAdapter((IAdaptable)_selectedObject);
if (adapter != null){
ISubSystem subSystem = adapter.getSubSystem(_selectedObject);
if (subSystem != null){
if (subSystem.getSubSystemConfiguration().supportsFilters()){
// no match, so we will expand from filter
// query matching filter in a job (to avoid main thread)
@ -357,6 +360,9 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
}
}
}
}
public SystemViewPart activateSystemView(){
@ -381,8 +387,14 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
}
IStructuredSelection sel = (IStructuredSelection)selection;
if (sel.size() == 1){
_action.setEnabled(true);
_selectedObject = sel.getFirstElement();
if (_selectedObject instanceof ISystemPromptableObject){
_selectedObject = null; // promptables not supported here
_action.setEnabled(false);
}
else {
_action.setEnabled(true);
}
}
else {
_action.setEnabled(false);