alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 *
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 *
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */
package org.netbeans.modules.refactoring.api;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import org.netbeans.modules.javacore.internalapi.JavaMetamodel;
import org.netbeans.modules.refactoring.classpath.RefactoringClassPathImplementation;
import org.netbeans.spi.java.classpath.ClassPathFactory;
import org.openide.ErrorManager;
import org.netbeans.modules.javacore.*;
import org.netbeans.modules.javacore.internalapi.ProgressListener;
import org.netbeans.modules.javacore.internalapi.ProgressSupport;
import org.openide.loaders.DataObject;
import org.openide.nodes.Node;
import org.openide.windows.TopComponent;

/** Abstract superclass for API for particular refactorings.
 * Subclasses of this class will typically be stateful classes
 * enforcing the following order of method calls:
 * 
    *
  • preCheck *
  • setParameters (this method will typically be added by the subclass * to allow parametrization of the implemented refactoring) *
  • prepare *
* * @author Martin Matula */ public abstract class AbstractRefactoring { /** Pre-check state. */ public static final int PRE_CHECK = 1; /** Parameters check state. */ public static final int PARAMETERS_CHECK = 2; /** Prepare state. */ public static final int PREPARE = 3; private ProgressSupport progressSupport; /** Perform checks to ensure that the preconditions are met for the implemented * refactoring. * @return Chain of problems encountered or null if no problems * were found. */ public abstract Problem preCheck(); /** Collects and returns a set of refactoring elements - objects that * will be affected by the refactoring. * @param elements Collection that the operation will use to return * instances of {@link org.netbeans.modules.refactoring.api.RefactoringElement} class representing objects that * will be affected by the refactoring. * @return Chain of problems encountered or null in no problems * were found. */ public abstract Problem prepare(Collection elements); /** Registers ProgressListener to receive events. * @param listener The listener to register. * */ public synchronized void addProgressListener(ProgressListener listener) { if (progressSupport == null ) { progressSupport = new ProgressSupport(); } progressSupport.addProgressListener(listener); } /** Removes ProgressListener from the list of listeners. * @param listener The listener to remove. * */ public synchronized void removeProgressListener(ProgressListener listener) { if (progressSupport != null ) { progressSupport.removeProgressListener(listener); } } /** Notifies all registered listeners about the event. * * @param type Type of operation that is starting. * @param count Number of steps the operation consists of. * */ protected void fireProgressListenerStart(int type, int count) { if (progressSupport != null) progressSupport.fireProgressListenerStart(type, count); } /** Notifies all registered listeners about the event. */ protected void fireProgressListenerStep() { if (progressSupport != null) progressSupport.fireProgressListenerStep(); } /** Notifies all registered listeners about the event. */ protected void fireProgressListenerStop() { if (progressSupport != null) progressSupport.fireProgressListenerStop(); } public abstract void setClassPath(); public abstract void cancelPrepare(); }
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.