mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 22:25:25 +02:00
avoid use of RSEUIPlugin api to get workbench (since it's got flawed code for detecting headless)
This commit is contained in:
parent
74075ca282
commit
e3a06a5439
7 changed files with 50 additions and 21 deletions
|
@ -50,6 +50,7 @@ public class Activator extends AbstractUIPlugin {
|
|||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
RSECorePlugin.getDefault();
|
||||
RSEUIPlugin.getDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -142,19 +142,9 @@ public class RSEFileStoreRemoteFileWrapper extends FileStore implements IFileSto
|
|||
IFile file = null;
|
||||
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"))
|
||||
|
||||
|
||||
if (_remoteFile.getName().equals(".project") && _remoteFile.getLength() == 0)
|
||||
{
|
||||
|
||||
try
|
||||
|
@ -344,4 +334,16 @@ public class RSEFileStoreRemoteFileWrapper extends FileStore implements IFileSto
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void delete(int options, IProgressMonitor monitor) throws CoreException
|
||||
{
|
||||
try
|
||||
{
|
||||
_subSystem.delete(_remoteFile, monitor);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -66,6 +66,7 @@ import org.eclipse.ui.IWorkbenchPage;
|
|||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.actions.WorkspaceModifyOperation;
|
||||
import org.eclipse.ui.ide.IDE;
|
||||
import org.eclipse.ui.part.FileEditorInput;
|
||||
|
@ -214,7 +215,11 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP
|
|||
|
||||
protected IEditorRegistry getEditorRegistry()
|
||||
{
|
||||
return RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry();
|
||||
if (PlatformUI.isWorkbenchRunning())
|
||||
{
|
||||
return PlatformUI.getWorkbench().getEditorRegistry();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected IEditorDescriptor getDefaultTextEditor()
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.io.File;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.internal.resources.Resource;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -103,7 +104,7 @@ public class UniversalFileTransferUtility
|
|||
IFile tempFile = (IFile) tempResource;
|
||||
|
||||
// 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);
|
||||
|
||||
|
@ -330,7 +331,14 @@ public class UniversalFileTransferUtility
|
|||
}
|
||||
if (tempResource instanceof IFile)
|
||||
{
|
||||
setIFileProperties((IFile)tempResource, rmtFile, srcFS);
|
||||
try
|
||||
{
|
||||
setIFileProperties((IFile)tempResource, rmtFile, srcFS);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/*
|
||||
else
|
||||
|
@ -398,9 +406,16 @@ public class UniversalFileTransferUtility
|
|||
}
|
||||
|
||||
tempFile = (IFile) getTempFileFor(srcFileOrFolder);
|
||||
if (tempFile.exists())
|
||||
if (tempFile.exists() && ((Resource)tempFile).getPropertyManager() != null)
|
||||
{
|
||||
setIFileProperties(tempFile, srcFileOrFolder, srcFS);
|
||||
try
|
||||
{
|
||||
setIFileProperties(tempFile, srcFileOrFolder, srcFS);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return tempFile;
|
||||
|
|
|
@ -213,7 +213,7 @@ public class SystemViewRemoteFileAdapter
|
|||
{
|
||||
if (registry == null)
|
||||
{
|
||||
IWorkbench workbench = RSEUIPlugin.getDefault().getWorkbench();
|
||||
IWorkbench workbench = PlatformUI.getWorkbench();
|
||||
if (workbench != null)
|
||||
registry = workbench.getEditorRegistry();
|
||||
}
|
||||
|
|
|
@ -657,12 +657,15 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
|
||||
// now wait till we have all the bytes local
|
||||
long localBytes = localFile.length();
|
||||
while (localBytes < fileLength && (monitor == null || !monitor.isCanceled()))
|
||||
long lastLocalBytes = 0;
|
||||
while (localBytes < fileLength && (monitor == null || !monitor.isCanceled()) && lastLocalBytes != localBytes)
|
||||
{
|
||||
try
|
||||
{
|
||||
lastLocalBytes= localBytes;
|
||||
Thread.sleep(100);
|
||||
localBytes = localFile.length();
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -95,10 +95,12 @@ import org.eclipse.ui.IMemento;
|
|||
import org.eclipse.ui.IPartListener;
|
||||
import org.eclipse.ui.IPersistableElement;
|
||||
import org.eclipse.ui.IViewSite;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.actions.ActionFactory;
|
||||
import org.eclipse.ui.part.CellEditorActionHandler;
|
||||
import org.eclipse.ui.part.FileEditorInput;
|
||||
|
@ -503,7 +505,8 @@ public class SystemViewPart
|
|||
public void setFocus()
|
||||
{
|
||||
//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();
|
||||
/* the following was an attempt to fix problem with scrollbar needing two clicks to activate. didn't help.
|
||||
if (!SystemPreferencesGlobal.getGlobalSystemPreferences().getRememberState())
|
||||
|
|
Loading…
Add table
Reference in a new issue