/*
*
* Perforce/JBuilder Opentool
* Copyright (C) 2002 Mark Ackerman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.dafreels.opentools.actions;
//JBuilder
import com.borland.primetime.*;
import com.borland.primetime.actions.*;
import com.borland.primetime.node.*;
import com.borland.jbuilder.*;
import com.borland.primetime.ide.*;
//Java
import javax.swing.*;
import java.awt.event.*;
import java.awt.Cursor;
//JBuilder OT
import com.dafreels.opentools.*;
import com.dafreels.opentools.properties.*;
//Perforce OT
import com.dafreels.vcs.command.*;
import com.dafreels.vcs.util.ExtensionRegistry;
import com.dafreels.vcs.util.ActionImages;
/**
* Title: Perforce Open Tool
* Description: Unlock file(s) in Perforce
* Copyright: Copyright (c) 2002
* Company:
* @author Mark Ackerman
* @version 1.0
*/
public class UnlockAction extends PerforceAction
{
public UnlockAction(boolean onFileTabMenu)
{
super("Unlock","Unlock file(s) at Depot",ActionImages.P4_UNLOCK,onFileTabMenu);
}
public void actionPerformed(Browser browser)
{
com.dafreels.vcs.command.Command cmd =
new com.dafreels.vcs.command.Command(com.dafreels.vcs.command.Command.UNLOCK);
Node[] nodes = getSelectedNodes(browser, cmd);
/*
String tempFileName = "";
if ( m_onFileTabMenu )
{
Node node = browser.getActiveNode();
if (node != null )
{
tempFileName = node.getLongDisplayName();
if(m_reg.validateFile(tempFileName))
{
cmd.addPath(tempFileName);
nodes = new Node[1];
nodes[0] = node;
}
else
{
return;
}
}
else
{
return;
}
}
else
{
//Get a list of the selected nodes
nodes = browser.getProjectView().getSelectedNodes(browser.getActiveProject());
//StringBuffer sb = new StringBuffer("unlock ");
//Send any files that have legal extensions to the command
for(int i = 0; i < nodes.length; i++)
{
tempFileName = ((FileNode)nodes[i]).getLongDisplayName();
if(m_reg.validateFile(tempFileName))
{
//sb.append(tempFileName+" ");
cmd.addPath(tempFileName);
}
}
}
*/
if ( cmd.getPathCount() == 0 )
{
return;
}
runCommand(browser, cmd);
/*
try
{
browser.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
//Run the command
CommandTool.runCommand(cmd, Main.m_props);
//CommandTool.runCommand(sb.toString(), Main.m_props);
//Output the p4 messages
MessageWriter.outputErrorMessages(MessageFormatter.getInstance());
if ( Main.m_props.showOutput())
{
MessageWriter.outputMessages(MessageFormatter.getInstance());
}
}
finally
{
browser.setCursor(Cursor.getDefaultCursor());
}
*/
//Refresh the nodes
if ( nodes != null )
{
Main.refreshNodes(nodes);
}
}
}