001: /*
002: * GNetWatch
003: * Copyright 2006, 2007 Alexandre Fenyo
004: * gnetwatch@fenyo.net
005: *
006: * This file is part of GNetWatch.
007: *
008: * GNetWatch is free software; you can redistribute it and/or modify
009: * it under the terms of the GNU General Public License as published by
010: * the Free Software Foundation; either version 2 of the License, or
011: * (at your option) any later version.
012: *
013: * GNetWatch is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: * GNU General Public License for more details.
017: *
018: * You should have received a copy of the GNU General Public License
019: * along with GNetWatch; if not, write to the Free Software
020: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
021: */
022:
023: package net.fenyo.gnetwatch.activities;
024:
025: import java.util.LinkedList;
026: import java.util.List;
027:
028: import net.fenyo.gnetwatch.*;
029: import net.fenyo.gnetwatch.GUI.*;
030: import net.fenyo.gnetwatch.actions.Action;
031: import net.fenyo.gnetwatch.targets.*;
032:
033: import org.apache.commons.logging.Log;
034: import org.apache.commons.logging.LogFactory;
035: import org.eclipse.swt.layout.GridData;
036: import org.eclipse.swt.widgets.TreeItem;
037:
038: /**
039: * This class implements a queue used to run debugging actions in background.
040: * @author Alexandre Fenyo
041: * @version $Id: DebugQueue.java,v 1.12 2007/03/08 18:21:31 fenyo Exp $
042: */
043:
044: public class DebugQueue extends Queue implements Runnable {
045: private static Log log = LogFactory.getLog(DebugQueue.class);
046:
047: private GUI gui = null;
048: private static int cnt = 0;
049:
050: /**
051: * Constructor.
052: * @param name queue name.
053: * @param config configuration.
054: */
055: // main thread
056: public DebugQueue(final String name, final Config config) {
057: super (name, config);
058: setDescription("debug and test operations");
059: }
060:
061: /**
062: * Called after each cycle.
063: * @param none.
064: * @return void.
065: */
066: // Queue thread
067: protected void informCycle() {
068: }
069:
070: /**
071: * Sets the current GUI instance.
072: * @param gui current GUI instance.
073: * @return void.
074: */
075: // main thread
076: public void setGUI(final GUI gui) {
077: this .gui = gui;
078: }
079:
080: /**
081: * Returns the time to wait after each cycle.
082: * @param none.
083: * @return int time to wait.
084: */
085: // Queue thread
086: protected int getCycleDelay() {
087: return 1000;
088: }
089:
090: /**
091: * Returns the time to wait between empty cycles.
092: * @param none.
093: * @return time to wait.
094: */
095: // Queue thread
096: protected int getEmptyCycleDelay() {
097: return 1000;
098: }
099:
100: /**
101: * Returns the time to wait between two actions.
102: * @param none.
103: * @return time to wait.
104: */
105: // Queue thread
106: protected int getActionDelay() {
107: return 1000;
108: }
109: }
|