mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-16 05:25:21 +02:00
[241722] New -> File doesn't select the newly created file
This commit is contained in:
parent
3289b08784
commit
f411f0dae6
1 changed files with 73 additions and 4 deletions
|
@ -65,6 +65,7 @@
|
||||||
|
|
||||||
package org.eclipse.rse.internal.ui.view;
|
package org.eclipse.rse.internal.ui.view;
|
||||||
|
|
||||||
|
import java.io.FileReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -208,6 +209,7 @@ import org.eclipse.ui.IWorkbenchWindow;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.actions.ActionFactory;
|
import org.eclipse.ui.actions.ActionFactory;
|
||||||
import org.eclipse.ui.dialogs.PropertyDialogAction;
|
import org.eclipse.ui.dialogs.PropertyDialogAction;
|
||||||
|
import org.eclipse.ui.internal.progress.ProgressMessages;
|
||||||
import org.eclipse.ui.part.EditorInputTransfer;
|
import org.eclipse.ui.part.EditorInputTransfer;
|
||||||
import org.eclipse.ui.part.PluginTransfer;
|
import org.eclipse.ui.part.PluginTransfer;
|
||||||
import org.eclipse.ui.part.ResourceTransfer;
|
import org.eclipse.ui.part.ResourceTransfer;
|
||||||
|
@ -2425,6 +2427,29 @@ public class SystemView extends SafeTreeViewer
|
||||||
// ISYSTEMREMOTEChangeListener METHOD
|
// ISYSTEMREMOTEChangeListener METHOD
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
private class CheckPending implements Runnable
|
||||||
|
{
|
||||||
|
private boolean _notReady = true;
|
||||||
|
private TreeItem _item;
|
||||||
|
|
||||||
|
public CheckPending(TreeItem item)
|
||||||
|
{
|
||||||
|
_item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
Item[] items = _item.getItems();
|
||||||
|
_notReady = (items.length <= 0 || items[0].getText().equals(ProgressMessages.PendingUpdateAdapter_PendingLabel));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNotReady()
|
||||||
|
{
|
||||||
|
return _notReady;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the method in your class that will be called when a remote resource
|
* This is the method in your class that will be called when a remote resource
|
||||||
* changes. You will be called after the resource is changed.
|
* changes. You will be called after the resource is changed.
|
||||||
|
@ -2522,10 +2547,54 @@ public class SystemView extends SafeTreeViewer
|
||||||
createChildren(selectedItem);
|
createChildren(selectedItem);
|
||||||
selectedItem.setExpanded(true);
|
selectedItem.setExpanded(true);
|
||||||
}
|
}
|
||||||
if (remoteResourceNames != null)
|
if (adapter.supportsDeferredQueries(ss))
|
||||||
selectRemoteObjects(remoteResourceNames, ss, selectedItem);
|
{
|
||||||
else
|
final List names = remoteResourceNames;
|
||||||
selectRemoteObjects(remoteResourceName, ss, selectedItem);
|
final String name = remoteResourceName;
|
||||||
|
final ISubSystem subsys = ss;
|
||||||
|
final TreeItem item = selectedItem;
|
||||||
|
|
||||||
|
// do the selection after the query triggered via refreshRemoteObject() completes
|
||||||
|
Job job = new Job("select resource") //$NON-NLS-1$
|
||||||
|
{
|
||||||
|
public IStatus run(IProgressMonitor monitor) {
|
||||||
|
|
||||||
|
boolean notReady = true;
|
||||||
|
while (notReady)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Thread.sleep(100);
|
||||||
|
}
|
||||||
|
catch (InterruptedException e){}
|
||||||
|
|
||||||
|
CheckPending checkRunnable = new CheckPending(item);
|
||||||
|
Display.getDefault().syncExec(checkRunnable);
|
||||||
|
notReady = checkRunnable.isNotReady();
|
||||||
|
}
|
||||||
|
|
||||||
|
Display.getDefault().asyncExec(new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
if (names != null)
|
||||||
|
selectRemoteObjects(names, subsys, item);
|
||||||
|
else
|
||||||
|
selectRemoteObjects(name, subsys, item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
job.setSystem(true);
|
||||||
|
job.schedule();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (remoteResourceNames != null)
|
||||||
|
selectRemoteObjects(remoteResourceNames, ss, selectedItem);
|
||||||
|
else
|
||||||
|
selectRemoteObjects(remoteResourceName, ss, selectedItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//else
|
//else
|
||||||
//System.out.println("Hmm, nothing selected");
|
//System.out.println("Hmm, nothing selected");
|
||||||
|
|
Loading…
Add table
Reference in a new issue