mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-09 01:55:24 +02:00
no need for opening workspace file code since this is no longer exposed for remote errors.
This commit is contained in:
parent
9e05e8e91b
commit
3fe6a93c53
1 changed files with 103 additions and 123 deletions
|
@ -19,25 +19,18 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IMarker;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
|
|
||||||
import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
|
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.action.MenuManager;
|
import org.eclipse.jface.action.MenuManager;
|
||||||
import org.eclipse.jface.action.Separator;
|
import org.eclipse.jface.action.Separator;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.rse.core.SystemBasePlugin;
|
|
||||||
import org.eclipse.rse.core.subsystems.IRemoteLineReference;
|
import org.eclipse.rse.core.subsystems.IRemoteLineReference;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter;
|
import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter;
|
||||||
import org.eclipse.rse.files.ui.actions.SystemRemoteFileLineOpenWithMenu;
|
import org.eclipse.rse.files.ui.actions.SystemRemoteFileLineOpenWithMenu;
|
||||||
import org.eclipse.rse.files.ui.resources.RemoteSourceLookupDirector;
|
|
||||||
import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
|
import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
|
||||||
import org.eclipse.rse.files.ui.resources.SystemIFileProperties;
|
import org.eclipse.rse.files.ui.resources.SystemIFileProperties;
|
||||||
import org.eclipse.rse.shells.ui.ShellResources;
|
import org.eclipse.rse.shells.ui.ShellResources;
|
||||||
|
@ -50,7 +43,6 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
||||||
import org.eclipse.rse.subsystems.shells.core.model.ISystemOutputRemoteTypes;
|
import org.eclipse.rse.subsystems.shells.core.model.ISystemOutputRemoteTypes;
|
||||||
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystemConfiguration;
|
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystemConfiguration;
|
||||||
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCommandShell;
|
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCommandShell;
|
||||||
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteError;
|
|
||||||
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteOutput;
|
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteOutput;
|
||||||
import org.eclipse.rse.ui.ISystemContextMenuConstants;
|
import org.eclipse.rse.ui.ISystemContextMenuConstants;
|
||||||
import org.eclipse.rse.ui.ISystemIconConstants;
|
import org.eclipse.rse.ui.ISystemIconConstants;
|
||||||
|
@ -78,8 +70,6 @@ import org.eclipse.ui.ISharedImages;
|
||||||
import org.eclipse.ui.IWorkbench;
|
import org.eclipse.ui.IWorkbench;
|
||||||
import org.eclipse.ui.IWorkbenchPage;
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.ide.IDE;
|
|
||||||
import org.eclipse.ui.part.FileEditorInput;
|
|
||||||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||||
|
|
||||||
|
|
||||||
|
@ -290,17 +280,8 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter, ISystemOutpu
|
||||||
StringBuffer untabbedBuf = new StringBuffer();
|
StringBuffer untabbedBuf = new StringBuffer();
|
||||||
for (int i = 0; i < tabbedString.length();i++)
|
for (int i = 0; i < tabbedString.length();i++)
|
||||||
{
|
{
|
||||||
char p = '\0';
|
|
||||||
char c = tabbedString.charAt(i);
|
char c = tabbedString.charAt(i);
|
||||||
char n = '\0';
|
|
||||||
if (i+1 <tabbedString.length())
|
|
||||||
{
|
|
||||||
n = tabbedString.charAt(i + 1);
|
|
||||||
}
|
|
||||||
if (i - 1 > -1)
|
|
||||||
{
|
|
||||||
p = tabbedString.charAt(i - 1);
|
|
||||||
}
|
|
||||||
if (c == '\t')
|
if (c == '\t')
|
||||||
{
|
{
|
||||||
untabbedBuf.append(' ');
|
untabbedBuf.append(' ');
|
||||||
|
@ -443,103 +424,105 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter, ISystemOutpu
|
||||||
* @param output
|
* @param output
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected boolean openWorkspaceFile(IRemoteFile remoteFile, IRemoteOutput output)
|
// DKM - this is should no longer used. Used to be for opening corresponding workspace IFile from remote error
|
||||||
{
|
// but remote error as is will not be the project integration point for this.
|
||||||
IRemoteCommandShell cmd = (IRemoteCommandShell)(output.getParent());
|
// protected boolean openWorkspaceFile(IRemoteFile remoteFile, IRemoteOutput output)
|
||||||
IProject associatedProject = cmd.getAssociatedProject();
|
// {
|
||||||
if (associatedProject != null)
|
// IRemoteCommandShell cmd = (IRemoteCommandShell)(output.getParent());
|
||||||
{
|
// IProject associatedProject = cmd.getAssociatedProject();
|
||||||
ProjectSourceContainer container = new ProjectSourceContainer(associatedProject, false);
|
// if (associatedProject != null)
|
||||||
ISourceLookupDirector director = new RemoteSourceLookupDirector();
|
// {
|
||||||
container.init(director);
|
// ProjectSourceContainer container = new ProjectSourceContainer(associatedProject, false);
|
||||||
try
|
// ISourceLookupDirector director = new RemoteSourceLookupDirector();
|
||||||
{
|
// container.init(director);
|
||||||
Object[] matches = container.findSourceElements(remoteFile.getName());
|
// try
|
||||||
for (int i = 0; i < matches.length; i++)
|
// {
|
||||||
{
|
// Object[] matches = container.findSourceElements(remoteFile.getName());
|
||||||
//System.out.println("match="+matches[i]);
|
// for (int i = 0; i < matches.length; i++)
|
||||||
}
|
// {
|
||||||
|
// //System.out.println("match="+matches[i]);
|
||||||
if (matches.length == 1)
|
// }
|
||||||
{
|
//
|
||||||
IFile localMatch = (IFile)matches[0];
|
// if (matches.length == 1)
|
||||||
|
// {
|
||||||
|
// IFile localMatch = (IFile)matches[0];
|
||||||
|
//
|
||||||
IWorkbenchPage activePage = SystemBasePlugin.getActiveWorkbenchWindow().getActivePage();
|
//
|
||||||
|
//
|
||||||
FileEditorInput finput = new FileEditorInput(localMatch);
|
// IWorkbenchPage activePage = SystemBasePlugin.getActiveWorkbenchWindow().getActivePage();
|
||||||
|
//
|
||||||
|
// FileEditorInput finput = new FileEditorInput(localMatch);
|
||||||
IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(remoteFile.getName());
|
//
|
||||||
if (desc == null)
|
//
|
||||||
{
|
// IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(remoteFile.getName());
|
||||||
desc = getDefaultTextEditor();
|
// if (desc == null)
|
||||||
}
|
// {
|
||||||
String editorid = desc.getId();
|
// desc = getDefaultTextEditor();
|
||||||
IEditorPart editor = activePage.openEditor(finput, editorid);
|
// }
|
||||||
|
// String editorid = desc.getId();
|
||||||
int line = output.getLine();
|
// IEditorPart editor = activePage.openEditor(finput, editorid);
|
||||||
int charStart = output.getCharStart();
|
//
|
||||||
int charEnd = output.getCharEnd();
|
// int line = output.getLine();
|
||||||
|
// int charStart = output.getCharStart();
|
||||||
try
|
// int charEnd = output.getCharEnd();
|
||||||
{
|
//
|
||||||
IMarker marker = null;
|
// try
|
||||||
|
// {
|
||||||
// DKM - should we? this will populate the Problems view..but resources are actually remote
|
// IMarker marker = null;
|
||||||
if (output instanceof IRemoteError)
|
//
|
||||||
{
|
// // DKM - should we? this will populate the Problems view..but resources are actually remote
|
||||||
IRemoteError error = (IRemoteError)output;
|
// if (output instanceof IRemoteError)
|
||||||
String type = error.getType();
|
// {
|
||||||
|
// IRemoteError error = (IRemoteError)output;
|
||||||
marker = localMatch.createMarker(IMarker.TEXT);
|
// String type = error.getType();
|
||||||
|
//
|
||||||
if (type.equals("error"))
|
// marker = localMatch.createMarker(IMarker.TEXT);
|
||||||
{
|
//
|
||||||
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
|
// if (type.equals("error"))
|
||||||
}
|
// {
|
||||||
else if (type.equals("warning"))
|
// marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
|
||||||
{
|
// }
|
||||||
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
|
// else if (type.equals("warning"))
|
||||||
}
|
// {
|
||||||
else if (type.equals("informational"))
|
// marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
|
||||||
{
|
// }
|
||||||
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
|
// else if (type.equals("informational"))
|
||||||
}
|
// {
|
||||||
|
// marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
|
||||||
marker.setAttribute(IMarker.MESSAGE, output.getText());
|
// }
|
||||||
marker.setAttribute(IMarker.LINE_NUMBER, line);
|
//
|
||||||
marker.setAttribute(IMarker.CHAR_START, charStart);
|
// marker.setAttribute(IMarker.MESSAGE, output.getText());
|
||||||
marker.setAttribute(IMarker.CHAR_END, charEnd);
|
// marker.setAttribute(IMarker.LINE_NUMBER, line);
|
||||||
|
// marker.setAttribute(IMarker.CHAR_START, charStart);
|
||||||
}
|
// marker.setAttribute(IMarker.CHAR_END, charEnd);
|
||||||
else
|
//
|
||||||
{
|
// }
|
||||||
marker = localMatch.createMarker(IMarker.TEXT);
|
// else
|
||||||
marker.setAttribute(IMarker.LINE_NUMBER, line);
|
// {
|
||||||
marker.setAttribute(IMarker.CHAR_START, charStart);
|
// marker = localMatch.createMarker(IMarker.TEXT);
|
||||||
marker.setAttribute(IMarker.CHAR_END, charEnd);
|
// marker.setAttribute(IMarker.LINE_NUMBER, line);
|
||||||
}
|
// marker.setAttribute(IMarker.CHAR_START, charStart);
|
||||||
IDE.gotoMarker(editor, marker);
|
// marker.setAttribute(IMarker.CHAR_END, charEnd);
|
||||||
|
// }
|
||||||
|
// IDE.gotoMarker(editor, marker);
|
||||||
}
|
//
|
||||||
catch (CoreException e)
|
//
|
||||||
{
|
// }
|
||||||
e.printStackTrace();
|
// catch (CoreException e)
|
||||||
}
|
// {
|
||||||
return true;
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
}
|
// return true;
|
||||||
catch(Exception e)
|
// }
|
||||||
{
|
// }
|
||||||
e.printStackTrace();
|
// catch(Exception e)
|
||||||
}
|
// {
|
||||||
}
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
return false;
|
// }
|
||||||
}
|
//
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the appropriate editor for a remote output object
|
* Opens the appropriate editor for a remote output object
|
||||||
|
@ -554,7 +537,8 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter, ISystemOutpu
|
||||||
IRemoteFile file = outputToFile(output);
|
IRemoteFile file = outputToFile(output);
|
||||||
if (file != null && file.isFile())
|
if (file != null && file.isFile())
|
||||||
{
|
{
|
||||||
if (!openWorkspaceFile(file, output))
|
// no longer doing opening of workspace files here
|
||||||
|
//if (!openWorkspaceFile(file, output))
|
||||||
{
|
{
|
||||||
ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) file).getAdapter(ISystemViewElementAdapter.class);
|
ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) file).getAdapter(ISystemViewElementAdapter.class);
|
||||||
result = adapter.handleDoubleClick(file);
|
result = adapter.handleDoubleClick(file);
|
||||||
|
@ -619,7 +603,6 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter, ISystemOutpu
|
||||||
{
|
{
|
||||||
IWorkbench desktop = PlatformUI.getWorkbench();
|
IWorkbench desktop = PlatformUI.getWorkbench();
|
||||||
IWorkbenchPage persp = desktop.getActiveWorkbenchWindow().getActivePage();
|
IWorkbenchPage persp = desktop.getActiveWorkbenchWindow().getActivePage();
|
||||||
IEditorPart editor = null;
|
|
||||||
String fileName = _file.getAbsolutePath();
|
String fileName = _file.getAbsolutePath();
|
||||||
IEditorReference[] editors = persp.getEditorReferences();
|
IEditorReference[] editors = persp.getEditorReferences();
|
||||||
for (int i = 0; i < editors.length; i++)
|
for (int i = 0; i < editors.length; i++)
|
||||||
|
@ -1211,10 +1194,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter, ISystemOutpu
|
||||||
if (context instanceof IRemoteFile)
|
if (context instanceof IRemoteFile)
|
||||||
{
|
{
|
||||||
IRemoteFile cwd = (IRemoteFile)context;
|
IRemoteFile cwd = (IRemoteFile)context;
|
||||||
if (cwd != null)
|
return cwd.getAbsolutePath();
|
||||||
{
|
|
||||||
return cwd.getAbsolutePath();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue