mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-08 09:35:23 +02:00
[cleanup] fix 'local variable/field is never read' compiler warnings
This commit is contained in:
parent
579aa49ba5
commit
700df9b49d
1 changed files with 79 additions and 80 deletions
|
@ -45,7 +45,6 @@ import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCommandShell;
|
||||||
import org.eclipse.rse.ui.ISystemIconConstants;
|
import org.eclipse.rse.ui.ISystemIconConstants;
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
|
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
|
||||||
import org.eclipse.rse.ui.view.SystemTableViewProvider;
|
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.ui.ISharedImages;
|
import org.eclipse.ui.ISharedImages;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
@ -107,7 +106,7 @@ public class CommandEntryContentAssistProcessor implements IContentAssistProcess
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommandEntryViewerConfiguration _configurator;
|
private CommandEntryViewerConfiguration _configurator;
|
||||||
private SystemTableViewProvider _provider;
|
//private SystemTableViewProvider _provider;
|
||||||
private HashMap _imageMap;
|
private HashMap _imageMap;
|
||||||
private IRemoteCommandShell _remoteCommand;
|
private IRemoteCommandShell _remoteCommand;
|
||||||
private char _fileSeparator;
|
private char _fileSeparator;
|
||||||
|
@ -126,7 +125,7 @@ public class CommandEntryContentAssistProcessor implements IContentAssistProcess
|
||||||
public CommandEntryContentAssistProcessor(CommandEntryViewerConfiguration configurator)
|
public CommandEntryContentAssistProcessor(CommandEntryViewerConfiguration configurator)
|
||||||
{
|
{
|
||||||
_configurator = configurator;
|
_configurator = configurator;
|
||||||
_provider = new SystemTableViewProvider();
|
//_provider = new SystemTableViewProvider();
|
||||||
_imageMap = new HashMap();
|
_imageMap = new HashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +235,7 @@ public class CommandEntryContentAssistProcessor implements IContentAssistProcess
|
||||||
*/
|
*/
|
||||||
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset)
|
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset)
|
||||||
{
|
{
|
||||||
String text = viewer.getDocument().get();
|
//String text = viewer.getDocument().get();
|
||||||
boolean atFirstToken = isAtFirstToken(viewer.getDocument());
|
boolean atFirstToken = isAtFirstToken(viewer.getDocument());
|
||||||
String firstToken = getFirstToken(viewer.getDocument());
|
String firstToken = getFirstToken(viewer.getDocument());
|
||||||
String currentText = getCurrentText(viewer, documentOffset);
|
String currentText = getCurrentText(viewer, documentOffset);
|
||||||
|
@ -302,11 +301,14 @@ public class CommandEntryContentAssistProcessor implements IContentAssistProcess
|
||||||
descriptor = adapter.getImageDescriptor(object);
|
descriptor = adapter.getImageDescriptor(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
image = (Image) _imageMap.get(descriptor);
|
if (descriptor!=null)
|
||||||
if (image == null)
|
|
||||||
{
|
{
|
||||||
image = descriptor.createImage();
|
image = (Image) _imageMap.get(descriptor);
|
||||||
_imageMap.put(descriptor, image);
|
if (image == null)
|
||||||
|
{
|
||||||
|
image = descriptor.createImage();
|
||||||
|
_imageMap.put(descriptor, image);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
@ -328,99 +330,96 @@ public class CommandEntryContentAssistProcessor implements IContentAssistProcess
|
||||||
Object context = _remoteCommand.getContext();
|
Object context = _remoteCommand.getContext();
|
||||||
if (context instanceof IRemoteFile)
|
if (context instanceof IRemoteFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
IRemoteFile workingDirectory = (IRemoteFile)context;
|
IRemoteFile workingDirectory = (IRemoteFile)context;
|
||||||
if (workingDirectory != null)
|
|
||||||
|
int separatorIndex = currentText.lastIndexOf(_fileSeparator);
|
||||||
|
int foreignseparatorIndex = currentText.lastIndexOf(_foreignFileSeparator);
|
||||||
|
if (foreignseparatorIndex > separatorIndex)
|
||||||
{
|
{
|
||||||
int separatorIndex = currentText.lastIndexOf(_fileSeparator);
|
separatorIndex = foreignseparatorIndex;
|
||||||
int foreignseparatorIndex = currentText.lastIndexOf(_foreignFileSeparator);
|
}
|
||||||
if (foreignseparatorIndex > separatorIndex)
|
|
||||||
|
if (separatorIndex > 0)
|
||||||
|
{
|
||||||
|
String previousText = currentText.substring(0, separatorIndex + 1).replace(_foreignFileSeparator, _fileSeparator);
|
||||||
|
String nextText = "";
|
||||||
|
if (separatorIndex < currentText.length())
|
||||||
{
|
{
|
||||||
separatorIndex = foreignseparatorIndex;
|
nextText = currentText.substring(separatorIndex + 1, currentText.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (separatorIndex > 0)
|
IRemoteFile contextDirectory = null;
|
||||||
|
String contextPath = null;
|
||||||
|
if (!_isWindows && currentText.charAt(0) == _fileSeparator)
|
||||||
{
|
{
|
||||||
String previousText = currentText.substring(0, separatorIndex + 1).replace(_foreignFileSeparator, _fileSeparator);
|
contextPath = previousText;
|
||||||
String nextText = "";
|
|
||||||
if (separatorIndex < currentText.length())
|
|
||||||
{
|
|
||||||
nextText = currentText.substring(separatorIndex + 1, currentText.length());
|
|
||||||
}
|
|
||||||
|
|
||||||
IRemoteFile contextDirectory = null;
|
|
||||||
String contextPath = null;
|
|
||||||
if (!_isWindows && currentText.charAt(0) == _fileSeparator)
|
|
||||||
{
|
|
||||||
contextPath = previousText;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
contextPath = workingDirectory.getAbsolutePath() + _fileSeparator + previousText;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_lastFolderContext != null && _lastFolderContext.getAbsolutePath().equals(contextPath))
|
|
||||||
{
|
|
||||||
contextDirectory = _lastFolderContext;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
contextDirectory = RemoteFileUtility.getFileSubSystem(_remoteCommand.getCommandSubSystem().getHost()).getRemoteFileObject(contextPath);
|
|
||||||
_lastFolderContext = contextDirectory;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getFileCompletions(contextDirectory, previousText, nextText, results, FILES_AND_FOLDERS);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (atFirstToken)
|
contextPath = workingDirectory.getAbsolutePath() + _fileSeparator + previousText;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_lastFolderContext != null && _lastFolderContext.getAbsolutePath().equals(contextPath))
|
||||||
|
{
|
||||||
|
contextDirectory = _lastFolderContext;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (!_isWindows && currentText.length() > 0 && currentText.charAt(0) == _fileSeparator)
|
contextDirectory = RemoteFileUtility.getFileSubSystem(_remoteCommand.getCommandSubSystem().getHost()).getRemoteFileObject(contextPath);
|
||||||
{
|
_lastFolderContext = contextDirectory;
|
||||||
getAbsoluteFileCompletions("", currentText, results, FILES_AND_FOLDERS);
|
}
|
||||||
}
|
catch (Exception e)
|
||||||
else
|
{
|
||||||
{
|
}
|
||||||
getFileCompletions(workingDirectory, "", currentText, results, FILES_ONLY);
|
}
|
||||||
getCommandCompletions(currentText, results);
|
getFileCompletions(contextDirectory, previousText, nextText, results, FILES_AND_FOLDERS);
|
||||||
}
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (atFirstToken)
|
||||||
|
{
|
||||||
|
if (!_isWindows && currentText.length() > 0 && currentText.charAt(0) == _fileSeparator)
|
||||||
|
{
|
||||||
|
getAbsoluteFileCompletions("", currentText, results, FILES_AND_FOLDERS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int flag = FILES_AND_FOLDERS;
|
getFileCompletions(workingDirectory, "", currentText, results, FILES_ONLY);
|
||||||
|
getCommandCompletions(currentText, results);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int flag = FILES_AND_FOLDERS;
|
||||||
|
|
||||||
if (firstToken.equals("cd"))
|
if (firstToken.equals("cd"))
|
||||||
|
{
|
||||||
|
flag = FOLDERS_ONLY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_isWindows)
|
||||||
{
|
{
|
||||||
flag = FOLDERS_ONLY;
|
if (firstToken.equals("set") || currentText.startsWith("%"))
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (_isWindows)
|
|
||||||
{
|
|
||||||
if (firstToken.equals("set") || currentText.startsWith("%"))
|
|
||||||
{
|
|
||||||
getEnvironmentCompletions(currentText, results);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (firstToken.equals("export") || currentText.startsWith("$"))
|
|
||||||
{
|
{
|
||||||
getEnvironmentCompletions(currentText, results);
|
getEnvironmentCompletions(currentText, results);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (firstToken.equals("export") || currentText.startsWith("$"))
|
||||||
getFileCompletions(workingDirectory, "", currentText, results, flag);
|
{
|
||||||
|
getEnvironmentCompletions(currentText, results);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFileCompletions(workingDirectory, "", currentText, results, flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getCommandCompletions(currentText, results);
|
getCommandCompletions(currentText, results);
|
||||||
|
|
Loading…
Add table
Reference in a new issue