mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 07:35:24 +02:00
[160405] Launch Shell menu should not be displayed for FTP-Only connections. Do not make the action visible for FTP connections by adding an attribute for IRemoteFile adapter to check for command subsystem existence of host.
This commit is contained in:
parent
4a61087b23
commit
17713e6a85
2 changed files with 34 additions and 1 deletions
|
@ -41,6 +41,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
|
|||
import org.eclipse.jface.viewers.AbstractTreeViewer;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
|
||||
import org.eclipse.rse.core.events.SystemResourceChangeEvent;
|
||||
|
@ -109,6 +110,7 @@ import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileEmpty;
|
|||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileRoot;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteSearchResultsContentsType;
|
||||
import org.eclipse.rse.subsystems.files.core.util.ValidatorFileUniqueName;
|
||||
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
|
||||
import org.eclipse.rse.ui.ISystemContextMenuConstants;
|
||||
import org.eclipse.rse.ui.ISystemIconConstants;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
|
@ -3016,6 +3018,8 @@ public class SystemViewRemoteFileAdapter
|
|||
* If the given value is <code>false</code>, then returns <code>true</code> if the target is not an archive file.</li>
|
||||
* <li>name="isVirtual". If the given value is <code>true</code>, then returns <code>true</code> if the target is a virtual file.
|
||||
* If the given value is <code>false</code>, then returns <code>true</code> if the target is not a virtual file.</li>
|
||||
* <li>name="isCommandSubSystemExists". If the given value is <code>true</code>, then returns <code>true</code> if the host contains a command subsystem.
|
||||
* If the given value is <code>false</code>, then returns <code>true</code> if the host does not contain a command subsystem.</li>
|
||||
* </ol>
|
||||
* <p>
|
||||
* @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
|
||||
|
@ -3183,6 +3187,32 @@ public class SystemViewRemoteFileAdapter
|
|||
return tgt.isLink() && value.equals("true") || //$NON-NLS-1$
|
||||
!tgt.isLink() && value.equals("false"); //$NON-NLS-1$
|
||||
}
|
||||
else if (inName.equals("iscommandsubsystemexists")) { //$NON-NLS-1$
|
||||
|
||||
boolean test = value.equals("true"); //$NON-NLS-1$
|
||||
|
||||
ISubSystem subsystem = getSubSystem(tgt);
|
||||
|
||||
if (subsystem != null) {
|
||||
IHost host = subsystem.getHost();
|
||||
ISystemRegistry registry = RSECorePlugin.getDefault().getSystemRegistry();
|
||||
|
||||
ISubSystem[] subsystems = registry.getSubSystems(host);
|
||||
|
||||
for (int i = 0; i < subsystems.length; i++) {
|
||||
ISubSystem temp = subsystems[i];
|
||||
|
||||
if (temp instanceof IRemoteCmdSubSystem) {
|
||||
return test;
|
||||
}
|
||||
}
|
||||
|
||||
return !test;
|
||||
}
|
||||
else {
|
||||
return !test;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.testAttribute(target, name, value);
|
||||
|
|
|
@ -149,7 +149,10 @@ Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
|
|||
objectClass="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"
|
||||
id="org.eclipse.rse.shells.ui.launch">
|
||||
<visibility>
|
||||
<objectState name="isdirectory" value="true"/>
|
||||
<and>
|
||||
<objectState name="isdirectory" value="true"/>
|
||||
<objectState name="isCommandSubSystemExists" value="true"/>
|
||||
</and>
|
||||
</visibility>
|
||||
<action
|
||||
label="%Launch_Shell"
|
||||
|
|
Loading…
Add table
Reference in a new issue