====== UltraEdit ======
Here are notes on configuring UltraEdit...
===== Code on Linux Boxes =====
Have code on a Linux box that you want to share via SAMBA with a Windows box?
On the Perforce client, Delete Host and use ALtRoot as per [[http://www.perforce.com/perforce/doc.current/manuals/p4guide/chapter.configuration.html|the Perforce documentation]]. There's a special rule that you have to specify Root for the Windows path, and then an AltRoot for your Linux path.
- Delete Host
- Use Root for the Windows path, and AltRoots for the Linux path.
Then, an additional trick to translate filepaths can be done on the Linux side like so:
# Used by the "convert_paths" command
export SAMBA_ROOT=$HOME/sandbox
#!/usr/bin/python
import os
import sys
from subprocess import check_output
samba_root = os.environ['SAMBA_ROOT']
win_drive = 'Z'
def win2nix(s):
global win_drive
if len(s) > 3 and s[1] == ':' and s[2] == '\\':
win_drive = s[0]
return "%s/%s" % (samba_root, s[3:].replace('\\', '/'))
return s
def nix2win(s):
for line in s.splitlines():
if line.startswith(samba_root):
print "%s:%s" % (win_drive, line.replace('/', '\\'))
else:
print line
if __name__ == '__main__':
params = [win2nix(i) for i in sys.argv[1:]]
# Note: commands like "cd" would require "shell=true"
r = check_output(params)
nix2win(r)
===== Advanced User Tools =====
Use PuTTY plink to be able to send commands via ssh to a Linux workstation. Then...
plink.exe username@10.1.1.200 findsymbol '%p' "%sel%"
plink.exe username@10.1.1.200 convert_paths p4 edit '%f'
Or, suppose you've configured a Perforce client to work on a Linux system, and for Windows to access it via a SAMBA share. Use the Root/AltRoots/no Home trick. Then, you can have UltraEdit do a Perforce diff like so:
"C:\Program Files\Perforce\p4v.exe" -cmd 'prevdiff %f'
===== Scripts =====
Assume you have a User Tool named "find-symbol" (as above) that outputs a list of files and line numbers like:
Z:\sourcecode\main.cpp(204): msgType, enum name of class:MainClass file:
If there's only one line of results in the list, you could have a script that automatically goes to the symbol of that only result.
UltraEdit.runTool("find symbol");
// Get the output from the outputWindow via a "side" clipboard.
var prev_clipboard_index = UltraEdit.clipboardIdx;
var temp_clipboard_index = prev_clipboard_index + 1;
if (temp_clipboard_index > 9) {
temp_clipboard_index = 1;
}
UltraEdit.selectClipboard(temp_clipboard_index);
UltraEdit.outputWindow.copy();
var temp_lines = UltraEdit.clipboardContent.split("\n");
UltraEdit.selectClipboard(prev_clipboard_index);
var arrayLength = temp_lines.length;
if (arrayLength == 1 || (arrayLength == 2 && temp_lines[1].length == 0)) {
// fields = temp_lines[0].split("): ");
var file_and_line = temp_lines[0].substring(0, temp_lines[0].lastIndexOf(")"));
var delimiter =file_and_line.lastIndexOf("(");
if (delimiter != -1) {
var file_to_open = file_and_line.substring(0, delimiter);
var lowercase_file_to_open = file_to_open.toLowerCase();
var line_number = parseInt(file_and_line.substring(delimiter+1));
// UltraEdit.outputWindow.write("DCB: Going to process file_to_open " + file_to_open + " at line " + line_number);
if (file_to_open.length > 0) {
for (var doc_index = 0; doc_index < UltraEdit.document.length; doc_index++) {
open_filename = UltraEdit.document[doc_index].path.toLowerCase();
if (open_filename == lowercase_file_to_open) {
UltraEdit.document[doc_index].setActive();
break;
}
}
if (doc_index >= UltraEdit.document.length) {
UltraEdit.outputWindow.write("DCB: used open().");
UltraEdit.open(file_to_open);
}
UltraEdit.activeDocument.gotoLine(line_number,0);
UltraEdit.activeDocument.selectLine(); // does this take a parameter?
}
}
}