/*
*
* Perforce/JBuilder Opentool
* Copyright (C) 2001 David Freels
*
* 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.primetime.vfs.*;
import com.borland.jbuilder.*;
import com.borland.jbuilder.node.*;
import com.borland.primetime.ide.*;
//Java
import javax.swing.*;
import java.awt.event.*;
import java.io.File;
//JBuilder OT
import com.dafreels.opentools.*;
import com.dafreels.opentools.properties.*;
//Perforce VCS
import com.dafreels.vcs.command.*;
import com.dafreels.vcs.util.ExtensionRegistry;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2001
* Company: DF Systems
* @author David Freels
* @version 1.0
*/
public class PreviewAction extends SyncAction
{
public PreviewAction(boolean onFileTabMenu)
{
super("Sync to head (Preview)","Sync files preview - what files would sync copy to client?",
null, onFileTabMenu);
}
/*
public void actionPerformed(Browser browser)
{
//Get a list of the selected nodes
Node[] nodes = browser.getProjectView().getSelectedNodes(browser.getActiveProject());
StringBuffer sb = new StringBuffer("sync -n ");
String tempFileName = "";
for(int i = 0; i < nodes.length; i++)
{
if(nodes[i].getDisplayName() != null && !nodes[i].getDisplayName().endsWith(".java"))
{
JBProject project = (JBProject)nodes[i].getProject();
Url[] sourcePaths = project.getPaths().getSourcePath();
String packagePath;
for (int u = 0; u < sourcePaths.length; u++ )
{
//Url defaultSourcePath = project.getPaths().getDefaultSourcePath();
packagePath = sourcePaths[u].getFileObject().getAbsolutePath()
+ File.separator + nodes[i].getDisplayName().replace('.', File.separatorChar);
File f = new File(packagePath);
if ( !f.exists() || !f.isDirectory() )
{
continue;
}
try
{
packagePath = f.getCanonicalPath();
} catch(java.io.IOException ioe)
{
}
sb.append(packagePath+"... ");
}
} else
{
tempFileName = ((FileNode)nodes[i]).getLongDisplayName();
if(m_reg.validateFile(tempFileName))
{
sb.append(tempFileName+" ");
}
}
}
//Run the command
CommandTool.runCommand(sb.toString(), Main.m_props);
//Output the p4 messages
MessageWriter.outputErrorMessages(MessageFormatter.getInstance());
MessageWriter.outputMessages(MessageFormatter.getInstance());
//Force JBuilder to check the file status
//Main.refreshNodes(nodes);
}
*/
/**
* output the error messages and stdout messages
* @return true if there are not error messages
*/
protected boolean outputMessages(boolean outputExtraLines)
{
boolean success = MessageFormatter.getInstance().getErrorMessageCount() == 0;
MessageWriter.outputErrorMessages(MessageFormatter.getInstance());
if ( MessageFormatter.getMessageCount() > 1)
{//Output the p4 messages
MessageWriter.outputMessages(MessageFormatter.getInstance());
}
return success;
}
protected String getCommand()
{
return com.dafreels.vcs.command.Command.SYNCPREVIEW;
}
}