!!script
// onStartupPerforce.script
// adds menu and toolbar buttons for perforce
//
// (c) 2000 Software System Group, TU Harburg
// Holm Wegner, ho.wegner@tu-harburg.de
// Axel Wienberg, ax.wienberg@tu-harburg.de
function DoCommand()
{
OnNotify();
}
var addToMainToolbar = false;
function OnNotify()
{
if (isKeyDown("Control")) // Escape mechanism - useful in editing and debugging this script
{
return;
}
var output = getOutput();
var logEvents = getGlobal("LogEvents", false);
if (logEvents)
{
output.writeLine("Running onStartupPerforce");
}
addMenuForFileType(".java");
addMenuForFileType(".script");
var toolbar = null;
if (addToMainToolbar) {
toolbar = getToolBar("Main");
if (toolbar) {
var l = newToolBarButton("separator");
l.width = 20;
toolbar.appendButton(l);
}
}
if (!toolbar) {
// Main not found or !addToMainToolbar
toolbar = newToolBar("Perforce", "docked");
toolbar.show();
}
var b = newToolBarButton("icon");
b.scriptPath = "\\Perforce\\edit.script";
b.description = "Opens the current file for edit";
b.toolTipText = "p4 edit";
b.imagePath = File.getToolsPath()+"\\Perforce\\icons\\edit.bmp";
toolbar.appendButton(b);
var b = newToolBarButton("icon");
b.scriptPath = "\\Perforce\\add.script";
b.description = "Add the current file to perforce";
b.toolTipText = "p4 add";
b.imagePath = File.getToolsPath()+"\\Perforce\\icons\\add.bmp";
toolbar.appendButton(b);
var b = newToolBarButton("icon");
b.scriptPath = "\\Perforce\\revert.script";
b.description = "Revert to the last synced version";
b.toolTipText = "p4 revert";
b.imagePath = File.getToolsPath()+"\\Perforce\\icons\\revert.bmp";
toolbar.appendButton(b);
var b = newToolBarButton("icon");
b.scriptPath = "\\Perforce\\p4win.script";
b.description = "Run P4Win";
b.toolTipText = "P4Win";
b.imagePath = File.getToolsPath()+"\\Perforce\\icons\\p4win.bmp";
toolbar.appendButton(b);
var l = newToolBarButton("separator");
l.width = 10;
toolbar.appendButton(l);
var b = newToolBarButton("icon");
b.scriptPath = "\\Perforce\\filelog.script";
b.description = "Show revision history";
b.toolTipText = "p4 filelog";
b.imagePath = File.getToolsPath()+"\\Perforce\\icons\\filelog.bmp";
toolbar.appendButton(b);
var b = newToolBarButton("icon");
b.scriptPath = "\\Perforce\\diff.script";
b.description = "Diff versus depot file";
b.toolTipText = "p4 diff";
b.imagePath = File.getToolsPath()+"\\Perforce\\icons\\diff.bmp";
toolbar.appendButton(b);
var b = newToolBarButton("icon");
b.scriptPath = "\\Perforce\\opened.script";
b.description = "Show opened files";
b.toolTipText = "p4 opened";
b.imagePath = File.getToolsPath()+"\\Perforce\\icons\\opened.bmp";
toolbar.appendButton(b);
var b = newToolBarButton("icon");
b.scriptPath = "\\Perforce\\info.script";
b.description = "Show connection info";
b.toolTipText = "p4 info";
b.imagePath = File.getToolsPath()+"\\Perforce\\icons\\info.bmp";
toolbar.appendButton(b);
toolbar.restoreState();
}
function addMenuForFileType(filetype)
{
menu = newMenu("P&4", filetype, "&View");
if (menu) {
menu.appendItem("Edit", "\\Perforce\\edit.script", "Opens the current file for edit");
menu.appendItem("Add", "\\Perforce\\add.script", "Add the current file to Perforce control");
menu.appendItem("Revert", "\\Perforce\\revert.script", "Reverts the current file");
menu.appendItem("P4Win", "\\Perforce\\p4win.script", "Opens the P4 Win Frontend");
menu.appendSeparator();
menu.appendItem("Revision History", "\\Perforce\\filelog.script", "Show revision history");
menu.appendItem("Diff", "\\Perforce\\diff.script", "Diff against depot");
menu.appendItem("Opened", "\\Perforce\\opened.script", "Show opened files");
menu.appendItem("Info", "\\Perforce\\info.script", "Show connection info");
menu.drawMenuBar();
} else {
output.writeLine("onStartupPerforce: cannot create menu for file type "+filetype);
}
}
!!/Script
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #1 | 1014 | axel_wienberg |
copied perforte and sitepadp4 files from my homepage to the public depot. happy branching and improving :-) |