/*
*
* 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;
//Perforce VCS
import com.dafreels.vcs.command.MessageFormatter;
//JBuilder
import com.borland.primetime.*;
import com.borland.primetime.actions.*;
import com.borland.primetime.node.*;
import com.borland.jbuilder.*;
import com.borland.primetime.ide.*;
import com.borland.primetime.properties.*;
/**
*
* @author David Freels
* @version 1.0
* @version 1.1 added support for Error messages
*/
public final class MessageWriter
{
private static MessageWriter m_writer = new MessageWriter();
/** Creates new MessageWriter */
private MessageWriter()
{
}
public static void outputMessages(MessageFormatter formatter)
{
String message = "";
while( (message = formatter.getNextMessage()) != null)
{
Browser.getActiveBrowser().getMessageView().addMessage(Main.PERFORCEMESSAGES,
new Message(message));
}
}
/**
* output the contents of the error stream.
* @param formatter the formatter that holds the contents of the error stream
* @author Mark Ackerman
*/
public static void outputErrorMessages(MessageFormatter formatter)
{
String message = "";
Message errorMsg;
while( (message = formatter.getNextErrorMessage()) != null)
{
errorMsg = new Message(message);
errorMsg.setForeground(java.awt.Color.red);
Browser.getActiveBrowser().getMessageView().addMessage(Main.PERFORCEMESSAGES,
errorMsg);
}
}
}