001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package org.netbeans.modules.refactoring.api;
042:
043: import java.util.EventObject;
044:
045: /** Progress event object.
046: *
047: * @author Martin Matula
048: */
049: public final class ProgressEvent extends EventObject {
050: /** Start event id */
051: public static final int START = 1;
052: /** Step event id */
053: public static final int STEP = 2;
054: /** Stop event id */
055: public static final int STOP = 4;
056:
057: // event id
058: private final int eventId;
059: // type of opreation that is being processed (source-specific number)
060: private final int operationType;
061: // number of steps of the operation being processed
062: private final int count;
063:
064: /** Creates ProgressEvent instance.
065: * @param source Source of the event.
066: * @param eventId ID of the event.
067: */
068: public ProgressEvent(Object source, int eventId) {
069: this (source, eventId, 0, 0);
070: }
071:
072: /** Creates ProgressEvent instance.
073: * @param source Source of the event.
074: * @param eventId ID of the event.
075: * @param operationType Source-specific number identifying source operation that
076: * is being processed.
077: * @param count Number of steps that the processed opration consists of.
078: */
079: public ProgressEvent(Object source, int eventId, int operationType,
080: int count) {
081: super (source);
082: this .eventId = eventId;
083: this .operationType = operationType;
084: this .count = count;
085: }
086:
087: /** Returns ID of the event.
088: * @return ID of the event.
089: */
090: public int getEventId() {
091: return eventId;
092: }
093:
094: /** Returns operation type.
095: * @return Source-specific number identifying operation being processed. Needs to
096: * be valid for START events, can be 0 for STEP and STOP events.
097: */
098: public int getOperationType() {
099: return operationType;
100: }
101:
102: /** Returns step count.
103: * @return Number of step that the operation being processed consists of. Needs to
104: * be valid for START events, can be 0 for STEP and STOP events. If it is not 0
105: * for STEP events, it is a new progress.
106: */
107: public int getCount() {
108: return count;
109: }
110: }
|