mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 10:46:02 +02:00
can't assume workbench anymore
This commit is contained in:
parent
a6ecbb2739
commit
0b1a0edb5a
6 changed files with 65 additions and 9 deletions
|
@ -156,13 +156,19 @@ public class RSEFileStoreRemoteFileWrapper extends FileStore implements IFileSto
|
|||
*/
|
||||
if (_remoteFile.getName().equals(".project"))
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
// only temp file has contents
|
||||
file = (IFile)UniversalFileTransferUtility.getTempFileFor(_remoteFile);
|
||||
if (file == null || !file.exists())
|
||||
{
|
||||
file.create(null, true, monitor);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (file == null || !file.exists())
|
||||
|
|
|
@ -93,7 +93,13 @@ public class RSEFileSystem extends FileSystem
|
|||
IRemoteFileSubSystem ss = store.getRemoteFileSubSystem();
|
||||
if (!ss.isConnected())
|
||||
{
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
Shell shell = null;
|
||||
|
||||
if (PlatformUI.isWorkbenchRunning())
|
||||
{
|
||||
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ss.connect(shell);
|
||||
|
@ -121,8 +127,12 @@ public class RSEFileSystem extends FileSystem
|
|||
Shell shell = null;
|
||||
try
|
||||
{
|
||||
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
//shell = RSEUIPlugin.getActiveWorkbenchShell();
|
||||
//if (PlatformUI.isWorkbenchRunning())
|
||||
{
|
||||
//shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
|
||||
shell = RSEUIPlugin.getActiveWorkbenchShell();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -59,6 +59,7 @@ import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
|
|||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -138,8 +139,16 @@ public class UniversalFileTransferUtility
|
|||
|
||||
if (!tempFile.exists() && !tempFile.isSynchronized(IResource.DEPTH_ZERO))
|
||||
{
|
||||
//tempFile.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||
tempFile.refreshLocal(IResource.DEPTH_ZERO, null/*monitor*/);
|
||||
// eclipse doesn't like this if the resource appears to be from another project
|
||||
try
|
||||
{
|
||||
//tempFile.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||
tempFile.refreshLocal(IResource.DEPTH_ZERO, null/*monitor*/);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
if (tempFile.exists())
|
||||
{
|
||||
|
@ -377,7 +386,10 @@ public class UniversalFileTransferUtility
|
|||
// refresh temp file in project
|
||||
try
|
||||
{
|
||||
tempFile.refreshLocal(IResource.DEPTH_ONE, monitor);
|
||||
if (PlatformUI.isWorkbenchRunning())
|
||||
{
|
||||
tempFile.refreshLocal(IResource.DEPTH_ONE, monitor);
|
||||
}
|
||||
}
|
||||
catch (CoreException e)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.eclipse.jface.viewers.DecoratingLabelProvider;
|
|||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.ILabelDecorator;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
|
@ -121,8 +122,10 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swt.widgets.TreeItem;
|
||||
import org.eclipse.swt.widgets.Widget;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.dialogs.PropertyDialogAction;
|
||||
import org.eclipse.ui.part.EditorInputTransfer;
|
||||
import org.eclipse.ui.part.PluginTransfer;
|
||||
|
@ -358,7 +361,13 @@ public class SystemView extends TreeViewer implements ISystemTree,
|
|||
*/
|
||||
public void setLabelAndContentProvider(SystemViewLabelAndContentProvider lcProvider)
|
||||
{
|
||||
setLabelProvider(new DecoratingLabelProvider(lcProvider, RSEUIPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
|
||||
ILabelDecorator decorator = null;
|
||||
if (PlatformUI.isWorkbenchRunning())
|
||||
{
|
||||
IWorkbench wb = PlatformUI.getWorkbench();
|
||||
decorator = wb.getDecoratorManager().getLabelDecorator();
|
||||
}
|
||||
setLabelProvider(new DecoratingLabelProvider(lcProvider, decorator));
|
||||
setContentProvider(lcProvider);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.eclipse.jface.viewers.DecoratingLabelProvider;
|
|||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.ILabelDecorator;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
|
@ -121,8 +122,10 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swt.widgets.TreeItem;
|
||||
import org.eclipse.swt.widgets.Widget;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.dialogs.PropertyDialogAction;
|
||||
import org.eclipse.ui.part.EditorInputTransfer;
|
||||
import org.eclipse.ui.part.PluginTransfer;
|
||||
|
@ -358,7 +361,13 @@ public class SystemView extends TreeViewer implements ISystemTree,
|
|||
*/
|
||||
public void setLabelAndContentProvider(SystemViewLabelAndContentProvider lcProvider)
|
||||
{
|
||||
setLabelProvider(new DecoratingLabelProvider(lcProvider, RSEUIPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
|
||||
ILabelDecorator decorator = null;
|
||||
if (PlatformUI.isWorkbenchRunning())
|
||||
{
|
||||
IWorkbench wb = PlatformUI.getWorkbench();
|
||||
decorator = wb.getDecoratorManager().getLabelDecorator();
|
||||
}
|
||||
setLabelProvider(new DecoratingLabelProvider(lcProvider, decorator));
|
||||
setContentProvider(lcProvider);
|
||||
}
|
||||
|
||||
|
|
|
@ -1915,7 +1915,17 @@ public class SystemRegistry implements ISystemRegistry, ISystemModelChangeEvents
|
|||
{
|
||||
if (clipboard == null)
|
||||
{
|
||||
clipboard = new Clipboard(getShell().getDisplay());
|
||||
Display display = null;
|
||||
Shell shell = getShell();
|
||||
if (shell == null)
|
||||
{
|
||||
display = Display.getDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
display = shell.getDisplay();
|
||||
}
|
||||
clipboard = new Clipboard(display);
|
||||
}
|
||||
|
||||
return clipboard;
|
||||
|
|
Loading…
Add table
Reference in a new issue