Index: apichanges.xml =================================================================== RCS file: /cvs/java/source/apichanges.xml,v retrieving revision 1.10 diff -u -r1.10 apichanges.xml --- apichanges.xml 5 Jun 2007 13:08:54 -0000 1.10 +++ apichanges.xml 13 Jun 2007 16:29:00 -0000 @@ -82,7 +82,21 @@ - + + + CancellableTask split into Task and CancellableTask. + + + + + + The JavaSource.runModificationTask(), runWhenScanFinished() and runUserActionTask() never call the cancel method of the + CancellableTask, the implementor of such a CancellableTask just writes an empty cancel method. The compatible API + change splits the CancellableTask into Task with run method and CancellableTask which extends the Task by cancel method. + The JavaSource methods mentioned above take Task rather than CancellableTask. The CancellableTask is used only for tasks + registered by factories. + + Added a method to obtain top level elements defined in the source/class file. Index: nbproject/project.properties =================================================================== RCS file: /cvs/java/source/nbproject/project.properties,v retrieving revision 1.22 diff -u -r1.22 project.properties --- nbproject/project.properties 12 Jun 2007 13:14:59 -0000 1.22 +++ nbproject/project.properties 13 Jun 2007 16:29:00 -0000 @@ -21,5 +21,5 @@ javadoc.title=Java Source javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml -spec.version.base=0.15.0 +spec.version.base=0.17.0 test.unit.run.cp.extra=${core.dir}/core/core.jar:${core.dir}/lib/boot.jar:../../junit/external/insanelib.jar Index: src/org/netbeans/api/java/source/CancellableTask.java =================================================================== RCS file: /cvs/java/source/src/org/netbeans/api/java/source/CancellableTask.java,v retrieving revision 1.2 diff -u -r1.2 CancellableTask.java --- src/org/netbeans/api/java/source/CancellableTask.java 24 Oct 2006 12:57:45 -0000 1.2 +++ src/org/netbeans/api/java/source/CancellableTask.java 13 Jun 2007 16:29:00 -0000 @@ -23,17 +23,10 @@ * * @author Petr Hrebejk */ -public interface CancellableTask

{ +public interface CancellableTask

extends Task

{ /** After this method is called the task if running should exit the run * method immediately. */ - public void cancel(); - - - /** Implement the functionality here. - *@param parameter Parameter depending on the context or null. - */ - public void run( P parameter ) throws Exception; - + public void cancel(); } Index: src/org/netbeans/api/java/source/JavaSource.java =================================================================== RCS file: /cvs/java/source/src/org/netbeans/api/java/source/JavaSource.java,v retrieving revision 1.60 diff -u -r1.60 JavaSource.java --- src/org/netbeans/api/java/source/JavaSource.java 5 Jun 2007 13:08:55 -0000 1.60 +++ src/org/netbeans/api/java/source/JavaSource.java 13 Jun 2007 16:29:04 -0000 @@ -477,7 +477,7 @@ *

* */ - public void runUserActionTask( final CancellableTask task, final boolean shared) throws IOException { + public void runUserActionTask( final Task task, final boolean shared) throws IOException { if (task == null) { throw new IllegalArgumentException ("Task cannot be null"); //NOI18N } @@ -632,7 +632,7 @@ * @throws IOException encapsulating the exception thrown by {@link CancellableTasks#run} * @since 0.12 */ - public Future runWhenScanFinished (final CancellableTask task, final boolean shared) throws IOException { + public Future runWhenScanFinished (final Task task, final boolean shared) throws IOException { assert task != null; final ScanSync sync = new ScanSync (task); final DeferredTask r = new DeferredTask (this,task,shared,sync); @@ -697,10 +697,10 @@ /** Runs a task which permits for modifying the sources. * Call to this method will cancel processig of all the phase completion tasks until * this task does not finish.
- * @see CancellableTask for information about implementation requirements + * @see Task for information about implementation requirements * @param task The task which. */ - public ModificationResult runModificationTask(CancellableTask task) throws IOException { + public ModificationResult runModificationTask(Task task) throws IOException { if (task == null) { throw new IllegalArgumentException ("Task cannot be null"); //NOI18N } @@ -1984,11 +1984,11 @@ static final class ScanSync implements Future { - private CancellableTask task; + private Task task; private final CountDownLatch sync; private final AtomicBoolean canceled; - public ScanSync (final CancellableTask task) { + public ScanSync (final Task task) { assert task != null; this.task = task; this.sync = new CountDownLatch (1); @@ -2039,11 +2039,11 @@ static final class DeferredTask { final JavaSource js; - final CancellableTask task; + final Task task; final boolean shared; final ScanSync sync; - public DeferredTask (final JavaSource js, final CancellableTask task, final boolean shared, final ScanSync sync) { + public DeferredTask (final JavaSource js, final Task task, final boolean shared, final ScanSync sync) { assert js != null; assert task != null; assert sync != null; Index: src/org/netbeans/api/java/source/Task.java =================================================================== RCS file: src/org/netbeans/api/java/source/Task.java diff -N src/org/netbeans/api/java/source/Task.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/netbeans/api/java/source/Task.java 13 Jun 2007 16:29:04 -0000 @@ -0,0 +1,33 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun + * Microsystems, Inc. All Rights Reserved. + */ +package org.netbeans.api.java.source; + +/** + * Runnable which takes parameter of a given type. + * @author Petr Hrebejk, Tomas Zezula + * @since 0.17 + */ +public interface Task

{ + + /** Implement the functionality here. + *@param parameter Parameter depending on the context or null. + */ + public void run( P parameter ) throws Exception; + +}