/* * * Perforce/Java Integration Layer * Copyright (C) 2001-2002 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.vcs.command; //Java import java.util.ArrayList; /** * * @author David Freels * @version 1.0 * @version 1.1 Mark Ackerman added support for error output */ public final class MessageFormatter { private static ArrayList m_messages = new ArrayList(10); private static ArrayList m_errorMessages = new ArrayList(10); private static MessageFormatter m_formatter = new MessageFormatter(); private static int m_position = 0; private static int m_errorPosition = 0; /** Creates new MessageFormatter */ private MessageFormatter() { } public static MessageFormatter getInstance() { return m_formatter; } public static void addMessage(String message) { m_messages.add(message); } public static void addErrorMessage(String message) { m_errorMessages.add(message); } public static void clearMessages() { m_messages.clear(); m_position = 0; m_errorMessages.clear(); m_errorPosition = 0; } public static String getNextMessage() { if(m_position >= m_messages.size()) return null; m_position++; return (String)m_messages.get(m_position - 1); } public static String getNextErrorMessage() { if(m_errorPosition >= m_errorMessages.size()) return null; m_errorPosition++; return (String)m_errorMessages.get(m_errorPosition - 1); } public static int getErrorMessageCount() { return m_errorMessages.size(); } public static int getMessageCount() { return m_messages.size(); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 4090 | David Freels |
Fixed bug where paths with spaces would not work. Also checked in new code or JBuilderX. |