1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-08 17:45:24 +02:00

avoid use of RSEUIPlugin api to get workbench (since it's got flawed code for detecting headless)

This commit is contained in:
David McKnight 2006-04-25 20:24:33 +00:00
parent 74075ca282
commit e3a06a5439
7 changed files with 50 additions and 21 deletions

View file

@ -50,6 +50,7 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception { public void start(BundleContext context) throws Exception {
super.start(context); super.start(context);
RSECorePlugin.getDefault(); RSECorePlugin.getDefault();
RSEUIPlugin.getDefault();
} }
/** /**

View file

@ -141,20 +141,10 @@ public class RSEFileStoreRemoteFileWrapper extends FileStore implements IFileSto
{ {
IFile file = null; IFile file = null;
if (_remoteFile.isFile() && _subSystem.isConnected()) if (_remoteFile.isFile() && _subSystem.isConnected())
{
/*
SystemEditableRemoteFile editable = new SystemEditableRemoteFile(_remoteFile);
try
{
editable.download(monitor);
}
catch (Exception e)
{ {
}
file = editable.getLocalResource(); if (_remoteFile.getName().equals(".project") && _remoteFile.getLength() == 0)
*/
if (_remoteFile.getName().equals(".project"))
{ {
try try
@ -344,4 +334,16 @@ public class RSEFileStoreRemoteFileWrapper extends FileStore implements IFileSto
} }
return null; return null;
} }
public void delete(int options, IProgressMonitor monitor) throws CoreException
{
try
{
_subSystem.delete(_remoteFile, monitor);
}
catch (Exception e)
{
e.printStackTrace();
}
}
} }

View file

@ -66,6 +66,7 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException; import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.WorkspaceModifyOperation; import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.ide.IDE; import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.part.FileEditorInput;
@ -214,7 +215,11 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP
protected IEditorRegistry getEditorRegistry() protected IEditorRegistry getEditorRegistry()
{ {
return RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry(); if (PlatformUI.isWorkbenchRunning())
{
return PlatformUI.getWorkbench().getEditorRegistry();
}
return null;
} }
protected IEditorDescriptor getDefaultTextEditor() protected IEditorDescriptor getDefaultTextEditor()

View file

@ -20,6 +20,7 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.core.internal.resources.Resource;
import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -103,7 +104,7 @@ public class UniversalFileTransferUtility
IFile tempFile = (IFile) tempResource; IFile tempFile = (IFile) tempResource;
// before we make the transfer to the temp file check whether a temp file already exists // before we make the transfer to the temp file check whether a temp file already exists
if (tempFile.exists()) if (tempFile.exists() && ((Resource)tempFile).getPropertyManager() != null)
{ {
SystemIFileProperties properties = new SystemIFileProperties(tempFile); SystemIFileProperties properties = new SystemIFileProperties(tempFile);
@ -329,9 +330,16 @@ public class UniversalFileTransferUtility
} }
} }
if (tempResource instanceof IFile) if (tempResource instanceof IFile)
{
try
{ {
setIFileProperties((IFile)tempResource, rmtFile, srcFS); setIFileProperties((IFile)tempResource, rmtFile, srcFS);
} }
catch (Exception e)
{
e.printStackTrace();
}
}
/* /*
else else
{ {
@ -398,10 +406,17 @@ public class UniversalFileTransferUtility
} }
tempFile = (IFile) getTempFileFor(srcFileOrFolder); tempFile = (IFile) getTempFileFor(srcFileOrFolder);
if (tempFile.exists()) if (tempFile.exists() && ((Resource)tempFile).getPropertyManager() != null)
{
try
{ {
setIFileProperties(tempFile, srcFileOrFolder, srcFS); setIFileProperties(tempFile, srcFileOrFolder, srcFS);
} }
catch (Exception e)
{
e.printStackTrace();
}
}
return tempFile; return tempFile;
} }

View file

@ -213,7 +213,7 @@ public class SystemViewRemoteFileAdapter
{ {
if (registry == null) if (registry == null)
{ {
IWorkbench workbench = RSEUIPlugin.getDefault().getWorkbench(); IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench != null) if (workbench != null)
registry = workbench.getEditorRegistry(); registry = workbench.getEditorRegistry();
} }

View file

@ -657,12 +657,15 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
// now wait till we have all the bytes local // now wait till we have all the bytes local
long localBytes = localFile.length(); long localBytes = localFile.length();
while (localBytes < fileLength && (monitor == null || !monitor.isCanceled())) long lastLocalBytes = 0;
while (localBytes < fileLength && (monitor == null || !monitor.isCanceled()) && lastLocalBytes != localBytes)
{ {
try try
{ {
lastLocalBytes= localBytes;
Thread.sleep(100); Thread.sleep(100);
localBytes = localFile.length(); localBytes = localFile.length();
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -95,10 +95,12 @@ import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPartListener; import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IPersistableElement; import org.eclipse.ui.IPersistableElement;
import org.eclipse.ui.IViewSite; import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException; import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.part.CellEditorActionHandler; import org.eclipse.ui.part.CellEditorActionHandler;
import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.part.FileEditorInput;
@ -503,7 +505,8 @@ public class SystemViewPart
public void setFocus() public void setFocus()
{ {
//System.out.println("INSIDE SETFOCUS FOR SYSTEMVIEWPART. SYSTEMVIEW NULL? " + (systemView==null)); //System.out.println("INSIDE SETFOCUS FOR SYSTEMVIEWPART. SYSTEMVIEW NULL? " + (systemView==null));
RSEUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell().setFocus(); IWorkbench wb = PlatformUI.getWorkbench();
wb.getActiveWorkbenchWindow().getShell().setFocus();
systemView.getControl().setFocus(); systemView.getControl().setFocus();
/* the following was an attempt to fix problem with scrollbar needing two clicks to activate. didn't help. /* the following was an attempt to fix problem with scrollbar needing two clicks to activate. didn't help.
if (!SystemPreferencesGlobal.getGlobalSystemPreferences().getRememberState()) if (!SystemPreferencesGlobal.getGlobalSystemPreferences().getRememberState())