mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +02:00
Fix copyright date
This commit is contained in:
parent
4687de711b
commit
c13aba8b0b
1 changed files with 68 additions and 68 deletions
|
@ -1,15 +1,15 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2008 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2009 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
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* David McKnight (IBM) - [160105] [usability] Universal action needed to locate a resource in the Remote Systems View
|
||||
* David McKnight (IBM) - [160105] [usability] Universal action needed to locate a resource in the Remote Systems View
|
||||
********************************************************************************/
|
||||
package org.eclipse.rse.internal.ui.actions;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
private ISystemTree _systemTree;
|
||||
private IAdaptable _targetRemoteObj;
|
||||
private ISystemFilterReference _filterReference;
|
||||
|
||||
|
||||
public ShowChildrenInTree(Object parentObject, Object[] children, ISystemFilterReference filterReference, ISystemTree systemTree, IAdaptable targetRemoteObj)
|
||||
{
|
||||
_parentObject = parentObject;
|
||||
|
@ -71,14 +71,14 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
_targetRemoteObj = targetRemoteObj;
|
||||
_filterReference = filterReference;
|
||||
}
|
||||
|
||||
|
||||
private String getAbsolutePath(IAdaptable adaptable){
|
||||
ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)adaptable.getAdapter(ISystemViewElementAdapter.class);
|
||||
return adapter.getAbsoluteName(adaptable);
|
||||
}
|
||||
|
||||
|
||||
public void run()
|
||||
{
|
||||
{
|
||||
if (_filterReference != null){
|
||||
// make sure the filter is expanded
|
||||
_systemTree.revealAndExpand(_filterReference.getSubSystem(), _filterReference.getReferencedFilter());
|
||||
|
@ -92,19 +92,19 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
item.setExpanded(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vector matches = new Vector();
|
||||
|
||||
|
||||
_systemTree.findAllRemoteItemReferences(_parentObject, _parentObject, matches);
|
||||
if (matches.size() > 0){
|
||||
TreeItem item = (TreeItem)matches.get(0);
|
||||
_systemTree.createTreeItems(item, _children);
|
||||
_systemTree.createTreeItems(item, _children);
|
||||
item.setExpanded(true);
|
||||
|
||||
|
||||
IAdaptable container = null;
|
||||
|
||||
|
||||
String targetPath = getAbsolutePath(_targetRemoteObj);
|
||||
|
||||
|
||||
// is one of these items our remote object
|
||||
for (int i = 0; i < item.getItemCount(); i++){
|
||||
TreeItem childItem = item.getItem(i);
|
||||
|
@ -112,7 +112,7 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
if (data instanceof IAdaptable){
|
||||
IAdaptable childObj = (IAdaptable)data;
|
||||
String childPath = getAbsolutePath(childObj);
|
||||
|
||||
|
||||
if (childPath.equals(targetPath)){
|
||||
// select our remote file
|
||||
_systemTree.getTree().setSelection(childItem);
|
||||
|
@ -121,11 +121,11 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
else if (targetPath.startsWith(childPath)){
|
||||
container = childObj; // using this to start a deeper search for the target remote file
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// remote file not found so now we have to expand further
|
||||
if (container != null){
|
||||
if (container != null){
|
||||
LinkFromContainerJob job = new LinkFromContainerJob(container, _filterReference, _targetRemoteObj, _systemTree);
|
||||
job.schedule();
|
||||
}
|
||||
|
@ -140,23 +140,23 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
private ISubSystem _subSystem;
|
||||
private IAdaptable _targetRemoteObj;
|
||||
private ISystemTree _systemTree;
|
||||
|
||||
|
||||
public LinkFromFilterJob(IAdaptable targetRemoteObject, ISystemTree systemTree) {
|
||||
super(NLS.bind(CommonMessages.MSG_RESOLVE_PROGRESS, ShowInSystemsViewDelegate.getAdapter(targetRemoteObject).getAbsoluteName(targetRemoteObject)));
|
||||
|
||||
|
||||
_targetRemoteObj = targetRemoteObject;
|
||||
_subSystem = getSubSystem(_targetRemoteObj);
|
||||
_systemTree = systemTree;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private ISubSystem getSubSystem(IAdaptable adaptable)
|
||||
{
|
||||
ISystemViewElementAdapter adapter = ShowInSystemsViewDelegate.getAdapter(adaptable);
|
||||
return adapter.getSubSystem(adaptable);
|
||||
}
|
||||
|
||||
|
||||
public IStatus run(IProgressMonitor monitor){
|
||||
try
|
||||
{
|
||||
|
@ -170,24 +170,24 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
|
||||
// get the context
|
||||
ContextObject contextObject = new ContextObject(ref, _subSystem, ref);
|
||||
|
||||
// get the children
|
||||
|
||||
// get the children
|
||||
Object[] children = ShowInSystemsViewDelegate.getAdapter((IAdaptable)ref).getChildren(contextObject, monitor);
|
||||
|
||||
|
||||
if (monitor.isCanceled()){
|
||||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
|
||||
|
||||
// put these items in the tree and look for remoteFile
|
||||
// if we can't find the remote file under this filter, the ShowChildrenInTree will recurse
|
||||
Display.getDefault().asyncExec(new ShowChildrenInTree(ref, children, ref, _systemTree, _targetRemoteObj));
|
||||
}
|
||||
catch (Exception e){
|
||||
catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ISystemFilterReference findMatchingFilterReference(IAdaptable targetObj, IProgressMonitor monitor)
|
||||
{
|
||||
String remoteObjectName = getAbsolutePath(targetObj);
|
||||
|
@ -201,30 +201,30 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
return ref;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// not finding it..use registry to try this
|
||||
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
|
||||
List matches = sr.findFilterReferencesFor(targetObj, _subSystem, false);
|
||||
if (matches != null && matches.size() > 0){
|
||||
return (ISystemFilterReference)matches.get(0);
|
||||
}
|
||||
|
||||
|
||||
// child may be deep in the tree and not directly under a filter
|
||||
ISystemViewElementAdapter adapter = ShowInSystemsViewDelegate.getAdapter(targetObj);
|
||||
Object parent = adapter.getParent(targetObj);
|
||||
ISystemFilterReference filterRef = findMatchingFilterReference((IAdaptable)parent, monitor);
|
||||
if (filterRef != null){
|
||||
if (filterRef != null){
|
||||
return filterRef;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private String getAbsolutePath(IAdaptable adaptable){
|
||||
ISystemViewElementAdapter adapter = ShowInSystemsViewDelegate.getAdapter(adaptable);
|
||||
return adapter.getAbsoluteName(adaptable);
|
||||
}
|
||||
|
||||
|
||||
private boolean doesFilterEncompass(ISystemFilter filter, String remoteObjectAbsoluteName)
|
||||
{
|
||||
boolean would = false;
|
||||
|
@ -236,33 +236,33 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
would = true;
|
||||
else if (strings[idx].equals("./*")) //$NON-NLS-1$
|
||||
{
|
||||
// my home filter - will encompass iff remoteObjectAbsoluteName is within the home dir
|
||||
// my home filter - will encompass iff remoteObjectAbsoluteName is within the home dir
|
||||
try
|
||||
{
|
||||
{
|
||||
IAdaptable homeObj = (IAdaptable)_subSystem.getObjectWithAbsoluteName(".", new NullProgressMonitor()); //$NON-NLS-1$
|
||||
if (homeObj != null){
|
||||
String homePath = getAbsolutePath(homeObj);
|
||||
would = remoteObjectAbsoluteName.startsWith(homePath);
|
||||
}
|
||||
}
|
||||
catch (Exception e){
|
||||
catch (Exception e){
|
||||
}
|
||||
}
|
||||
else
|
||||
would = doesFilterStringEncompass(strings[idx], remoteObjectAbsoluteName);
|
||||
would = doesFilterStringEncompass(strings[idx], remoteObjectAbsoluteName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return would;
|
||||
}
|
||||
|
||||
|
||||
private boolean doesFilterStringEncompass(String filterString, String remoteObjectAbsoluteName)
|
||||
{
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Job for doing a query on a container and then using Display.asyncExec() to reveal the results in the tree.
|
||||
*/
|
||||
|
@ -273,62 +273,62 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
private IAdaptable _targetRemoteObj;
|
||||
private ISystemTree _systemTree;
|
||||
private ISystemFilterReference _filterRef;
|
||||
|
||||
|
||||
public LinkFromContainerJob(IAdaptable remoteContainer, ISystemFilterReference filterRef, IAdaptable targetRemoteObj, ISystemTree systemTree) {
|
||||
|
||||
|
||||
super(NLS.bind(CommonMessages.MSG_RESOLVE_PROGRESS, ShowInSystemsViewDelegate.getAdapter(remoteContainer).getAbsoluteName(targetRemoteObj)));
|
||||
|
||||
|
||||
_remoteContainer = remoteContainer;
|
||||
_subSystem = getSubSystem(remoteContainer);
|
||||
_filterRef = filterRef; // used for context of query
|
||||
_targetRemoteObj = targetRemoteObj;
|
||||
_systemTree = systemTree;
|
||||
}
|
||||
|
||||
|
||||
private ISubSystem getSubSystem(IAdaptable adaptable)
|
||||
{
|
||||
ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)adaptable.getAdapter(ISystemViewElementAdapter.class);
|
||||
return adapter.getSubSystem(adaptable);
|
||||
}
|
||||
|
||||
|
||||
public IStatus run(IProgressMonitor monitor){
|
||||
try
|
||||
{
|
||||
{
|
||||
// get the adapter
|
||||
ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)_remoteContainer.getAdapter(ISystemViewElementAdapter.class);
|
||||
|
||||
|
||||
// get the context
|
||||
ContextObject contextObject = new ContextObject(_remoteContainer, _subSystem, _filterRef);
|
||||
|
||||
// get the children
|
||||
|
||||
// get the children
|
||||
Object[] children = adapter.getChildren(contextObject, monitor);
|
||||
|
||||
if (monitor.isCanceled()){
|
||||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
|
||||
|
||||
// put these items in the tree and look for remoteFile
|
||||
// if we can't find the remote file under this filter, the ShowChildrenInTree will recurse
|
||||
Display.getDefault().asyncExec(new ShowChildrenInTree(_remoteContainer, children, _filterRef, _systemTree, _targetRemoteObj));
|
||||
}
|
||||
catch (Exception e){
|
||||
catch (Exception e){
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
private IAction _action;
|
||||
private Object _remoteObject;
|
||||
private SystemViewPart _systemViewPart;
|
||||
|
||||
|
||||
public void init(IViewPart view) {
|
||||
|
||||
}
|
||||
|
||||
public void run(IAction action) {
|
||||
SystemViewPart viewPart = activateSystemView();
|
||||
SystemViewPart viewPart = activateSystemView();
|
||||
SystemView systemTree = viewPart.getSystemView();
|
||||
|
||||
|
||||
// now we've got to show the object in this view part
|
||||
TreeItem item = (TreeItem)systemTree.findFirstRemoteItemReference(_remoteObject, null);
|
||||
if (item != null){
|
||||
|
@ -339,7 +339,7 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)_remoteObject).getAdapter(ISystemViewElementAdapter.class);
|
||||
if (adapter != null){
|
||||
ISubSystem subSystem = adapter.getSubSystem(_remoteObject);
|
||||
if (subSystem.getSubSystemConfiguration().supportsFilters()){
|
||||
if (subSystem.getSubSystemConfiguration().supportsFilters()){
|
||||
// no match, so we will expand from filter
|
||||
// query matching filter in a job (to avoid main thread)
|
||||
LinkFromFilterJob job = new LinkFromFilterJob((IAdaptable)_remoteObject, systemTree);
|
||||
|
@ -348,13 +348,13 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
else {
|
||||
// no filters so need to directly check children
|
||||
Object[] children = subSystem.getChildren();
|
||||
|
||||
|
||||
// put these items in the tree and look for remote object
|
||||
// if we can't find the remote object under this, the ShowChildrenInTree will recurse
|
||||
Display.getDefault().asyncExec(new ShowChildrenInTree(subSystem, children, null, systemTree, (IAdaptable)_remoteObject));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -373,7 +373,7 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
|
||||
return _systemViewPart;
|
||||
}
|
||||
|
||||
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
if (_action == null) {
|
||||
_action= action;
|
||||
|
@ -381,13 +381,13 @@ public class ShowInSystemsViewDelegate implements IViewActionDelegate {
|
|||
IStructuredSelection sel = (IStructuredSelection)selection;
|
||||
if (sel.size() == 1){
|
||||
_action.setEnabled(true);
|
||||
_remoteObject = sel.getFirstElement();
|
||||
_remoteObject = sel.getFirstElement();
|
||||
}
|
||||
else {
|
||||
_action.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ISystemViewElementAdapter getAdapter(IAdaptable adaptable)
|
||||
{
|
||||
return (ISystemViewElementAdapter)adaptable.getAdapter(ISystemViewElementAdapter.class);
|
||||
|
|
Loading…
Add table
Reference in a new issue