Java 类org.openide.util.Task 实例源码

项目:incubator-netbeans    文件:RequestProcessorTest.java   
public void testStartCreatedJob() throws Exception {
    final RequestProcessor rp = new RequestProcessor("testStartCreatedJob");
    final boolean[] executed = new boolean[1];
    rp.post (new Runnable() {
        @Override
        public void run() {
            RequestProcessor.Task t = rp.create(new Runnable() {
                @Override
                public void run() {
                    executed[0] = true;
                }
            });
            t.waitFinished();
        }
    }).waitFinished();
    assertTrue("Inner created task finished", executed[0]);
}
项目:incubator-netbeans    文件:Deadlock169717Test.java   
/** 
 * Test that ChangeEvent is not fired under document lock during loading document.
 *
 * NbLikeEditorKit is used so document can be write locked using NbDocument.runAtomic in CES.prepareDocument.
 * 
 * @throws java.lang.Exception
 */
public void testDeadlock () throws Exception {
    support.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent evt) {
            Document doc = ((EnhancedChangeEvent) evt).getDocument();
            if (doc != null) {
                isDocumentLocked = Deadlock169717Test.isReadLocked(doc);
            }
        }
    });
    //Use prepare document to make sure stateChanged above is called BEFORE test ends
    //so isDocumentLocked is set.
    Task t = support.prepareDocument();
    t.waitFinished();
    assertFalse("Document cannot be locked", isDocumentLocked);
}
项目:incubator-netbeans    文件:KeymapViewModel.java   
public Task postUpdate() {
    Task t = initTask;
    if (t != null && t.isFinished()) {
        scheduleUpdate();
        return t;
    }
    if (t == null) {
        return initTask = KeymapModel.RP.post(new Runnable() {
            public void run() {
                // just initialize
                mutableModel.getCategories();
                mutableModel.getItems("");

                scheduleUpdate();
            }
        });
    } else if (t.isFinished()) {
        scheduleUpdate();
    }
    return t;
}
项目:incubator-netbeans    文件:TaskTest.java   
public void testWaitOnStrangeTaskThatStartsItsExecutionInOverridenWaitFinishedMethodLikeFolderInstancesDo () throws Exception {
    class MyTask extends Task {
        private int values;

        public MyTask () {
            notifyFinished ();
        }

        public void waitFinished () {
            notifyRunning ();
            values++;
            notifyFinished ();
        }
    }

    MyTask my = new MyTask ();
    assertTrue ("The task thinks that he is finished", my.isFinished ());
    assertTrue ("Ok, even with timeout we got the result", my.waitFinished (1000));
    assertEquals ("But the old waitFinished is called", 1, my.values);
}
项目:incubator-netbeans    文件:ProxyTaskTest.java   
@Test
public void testSomeMethod() throws Exception {
    T t1 = new T();
    T t2 = new T();

    List<Task> l = new ArrayList<Task>();
    l.add(t1);
    l.add(Task.EMPTY);
    l.add(t2);

    Task p = new ProxyTask(l);

    assertFalse("Not finished yet", p.waitFinished(100));

    t2.done();

    assertFalse("Still not finished yet", p.waitFinished(100));

    t1.done();
    p.waitFinished();
}
项目:incubator-netbeans    文件:NbStartStopTest.java   
public void testStop() {
    final boolean[] ok = { false };

    onStartStop.initialize();
    onStartStop.waitOnStart();
    final Runnable run = new Runnable() {
        @Override public void run() {
            ok[0] = true;
        }
    };
    stop.add(run);
    List<ModuleInfo> modules = Collections.singletonList(Modules.getDefault().ownerOf(run.getClass()));
    for (Task t : onStartStop.startClose(modules)) {
        t.waitFinished();
    }

    assertTrue("Initialized", ok[0]);
}
项目:incubator-netbeans    文件:TaskTest.java   
public void testWaitFinished0WaitsUntilFinished() throws Exception {
    Task task = new Task(new Runnable() {
        @Override
        public void run() {
            try {
                Thread.sleep(5000);
            } catch (InterruptedException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
    });
    Thread thread = new Thread(task);
    thread.start();
    task.waitFinished(0);
    assertTrue ("Should be finished", task.isFinished());
}
项目:incubator-netbeans    文件:AWTTask.java   
public static boolean waitFor(Task t) {
    assert EventQueue.isDispatchThread();
    if (!PENDING.isEmpty()) {
        PROCESSOR.run();
        return false;
    }
    Thread previous = null;
    try {
        previous = WAKE_UP.enter();
        if (!t.waitFinished(10000)) {
            flush();
            return false;
        }
    } catch (InterruptedException ex) {
        flush();
        return false;
    } finally {
        WAKE_UP.exit(previous);
    }
    return true;
}
项目:incubator-netbeans    文件:AWTTaskTest.java   
public void testWaitForItself() {
    final Semaphore s = new Semaphore(0);
    class R implements Runnable {
        int cnt;
        volatile Task waitFor;

        @Override
        public void run() {
            cnt++;
            try {
                s.acquire(); // Ensure waitFor != null.
            } catch (InterruptedException ex) {
                Exceptions.printStackTrace(ex);
            }
            waitFor.waitFinished();
        }
    }

    R r = new R();
    r.waitFor = new AWTTask(r, null);
    s.release();
    r.waitFor.waitFinished();

    assertEquals("Executed once", 1, r.cnt);
}
项目:incubator-netbeans    文件:ShellSession.java   
private Task detach() {
        Task t;
        synchronized (allSessions) {
            Reference<ShellSession> refS = allSessions.get(consoleDocument);
            if (refS != null && refS.get() == this) {
                allSessions.remove(consoleDocument);
                detached = true;
            } else {
                return Task.EMPTY;
            }
        }
//        closed = true;
        model.detach();
        closed();
        if (exec != null) {
            FORCE_CLOSE_RP.post(this::forceCloseStreams, 300);
        }
        // leave the model
        gsm.getGuardedSections().forEach((GuardedSection gs) -> gs.removeSection());
        return sendJShellClose();
    }
项目:incubator-netbeans    文件:ShellSession.java   
private synchronized Task sendJShellClose() {
    RemoteJShellService e;
    synchronized (this) {
        if (launcher == null) {
            return Task.EMPTY;
        }
        e = this.exec;
    }
    if (e != null) {
        e.requestShutdown();
    }
    // possibly delayed, if the evaluator is just processing some remote call.
    return evaluator.post(() -> {
        try {
            launcher.closeState();
        } catch (InternalError ex) {
            // ignore
        }
        forceCloseStreams();
    });
}
项目:incubator-netbeans    文件:RequestProcessorTest.java   
public void testCheckFinishedWithTrue () {
    RequestProcessor rp = new RequestProcessor ("Finish");

    class R extends Object implements Runnable {
        RequestProcessor.Task t;

        public void run () {
            if (t.isFinished ()) {
                fail ("Finished when running");
            }
        }
    }

    R r = new R ();
    RequestProcessor.Task task = rp.create(r, true);
    r.t = task;

    assertTrue("It has to be finished after creation", task.isFinished());

    task.waitFinished();

    // rest is the same
    doCommonTestWithScheduling(task);
}
项目:incubator-netbeans    文件:AutoupdateCheckScheduler.java   
private static RequestProcessor.Task getReqularlyTimerTask () {
    if (regularlyCheck == null) {
        // only for ordinary periods
        if (getWaitPeriod () > 0) {
            int waitPeriod = getWaitPeriod ();
            int restTime = waitPeriod;
            // calculate rest time to check
            if (AutoupdateSettings.getLastCheck () != null) {
                restTime = waitPeriod - (int)(System.currentTimeMillis () - AutoupdateSettings.getLastCheck ().getTime ());
            }

            // if restTime < 0 then schedule next round by given period
            if (restTime <= 0) {
                restTime = waitPeriod;
            }

            regularlyCheck = REGULARLY_CHECK_TIMER.post (doCheck, restTime, Thread.MIN_PRIORITY);

        }
    }
    return regularlyCheck;
}
项目:incubator-netbeans    文件:TaskTest.java   
public void testWaitOnStrangeTaskThatTakesReallyLongTime () throws Exception {
    class MyTask extends Task {
        public MyTask () {
            notifyFinished ();
        }

        public void waitFinished () {
            try {
                Thread.sleep (5000);
            } catch (InterruptedException ex) {
                fail ("Should not happen");
            }
        }
    }

    MyTask my = new MyTask ();
    assertTrue ("The task thinks that he is finished", my.isFinished ());
    assertFalse ("but still it get's called, but timeouts", my.waitFinished (1000));
}
项目:incubator-netbeans    文件:Manager.java   
/**
 */
@Override
public void taskFinished(Task task) {
    Runnable rTask;
    synchronized (Manager.this) {
        rTask = Manager.this.tasksMap.remove(task);
    }
    if (rTask != null) {
        Manager.this.taskFinished(rTask);
    }
}
项目:incubator-netbeans    文件:DetectPanel.java   
/**
 * Revalidates the Wizard Panel
 */
@Override
public void taskFinished(Task task) {
    final NewJ2SEPlatform platform = iterator.getPlatform();
    List<URL> jdoc = platform.getJavadocFolders();
    if (jdoc.isEmpty()) {
        jdoc = platform.defaultJavadoc();
    }
    final String jdocStr = urlsToString(jdoc);
    List<URL> src = cpToUrls(platform.getSourceFolders());
    if (src.isEmpty()) {
        src = platform.defaultSources();
    }
    final String srcStr = urlsToString(src);
    detected.set(
        platform.isValid() ?
            (isSupported(platform.getSpecification().getVersion()) ? PlatformState.VALID : PlatformState.UNSUPPORTED):
            PlatformState.INVALID);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run () {
            component.updatePlatformName(platform);
            component.setJavadoc(jdocStr);
            component.setSources(srcStr);
            assert progressHandle != null;
            progressHandle.finish ();
            component.progressPanel.setVisible (false);
            component.progressLabel.setVisible (false);
            checkValid ();
        }
    });
}
项目:incubator-netbeans    文件:ActionsManager.java   
private Task postActionWithLazyInit(final Object action) {
    final AsynchActionTask task = new AsynchActionTask(Collections.emptyList());
    new RequestProcessor(ActionsManager.class).post(new Runnable() {
        @Override
        public void run() {
            try {
                doAction(action);
            } finally {
                task.actionDone();
            }
        }
    });
    return task;
}
项目:incubator-netbeans    文件:CLIHandler.java   
/**
 * Some measure of success.
 * @param l the lock file (not null)
 * @param p the server port (not 0)
 * @param c a status code (0 or not)
 */
Status(File l, int p, int c, Task parael) {
    lockFile = l;
    port = p;
    exitCode = c;
    this.parael = parael;
}
项目:incubator-netbeans    文件:TaskFutureTest.java   
@Test
public void testRealTask() throws Exception {
    class T extends Task {
        public T() {
            notifyRunning();
        }
        public void done() {
            notifyFinished();
        }
    }

    T t = new T();
    assertFalse("Not finished yet", t.isFinished());

    TaskFuture tf = new TaskFuture(false, t);


    try {
        tf.get(100, TimeUnit.MILLISECONDS);
        fail("Should time out");
    } catch (TimeoutException timeoutException) {
        // OK
    }
    t.done();

    assertFalse("Really false", tf.get());
}
项目:incubator-netbeans    文件:SuiteActions.java   
@Override
public Task execute(String... args) throws IOException {
    StringBuilder sb = new StringBuilder();
    for (String r : args) {
        sb.append(r).append(' ');
    }
    Properties p = new Properties();
    p.setProperty("run.args", sb.substring(0, sb.length() - 1));

    return ActionUtils.runTarget(findBuildXml(project), new String[]{"run"}, p);
}
项目:incubator-netbeans    文件:ModuleActions.java   
@Override
public Task execute(String... args) throws IOException {
    StringBuilder sb = new StringBuilder();
    for (String r : args) {
        sb.append(r).append(' ');
    }
    Properties p = new Properties();
    p.setProperty("run.args", sb.substring(0, sb.length() - 1));

    return ActionUtils.runTarget(findBuildXml(project), new String[]{"run"}, p);
}
项目:incubator-netbeans    文件:MavenExecProject.java   
@Messages({"# {0} - project display name", "MavenExecProject_run=Run {0}"})
@Override public Task execute(String... args) throws IOException {
    Project app = MavenNbModuleImpl.findAppProject(p);
    if (app == null) {
        NbMavenProject prj = p.getLookup().lookup(NbMavenProject.class);
        throw new IOException("No open nbm-application project found to contain " + prj.getMavenProject().getId() + ". Please open the aplication project and try again.");
    }
    // XXX build w/ deps first? to do so, RP.post a Runnable which does both actions and calls result()
    RunConfig cfg = RunUtils.createRunConfig(FileUtil.toFile(app.getProjectDirectory()), app,
            // cf. platformActionMappings.xml
            MavenExecProject_run(ProjectUtils.getInformation(app).getDisplayName()), Arrays.asList("install", "nbm:run-platform"));
    StringBuilder argsS = new StringBuilder();
    for (String arg : args) {
        if (argsS.length() > 0) {
            argsS.append(' ');
        }
        argsS.append(arg);
    }
    NbMavenProject appPrj = app.getLookup().lookup(NbMavenProject.class);
    if (NetBeansRunParamsIDEChecker.usingNbmPlugin311(appPrj.getMavenProject())) {
        cfg.setProperty(NetBeansRunParamsIDEChecker.PROPERTY, argsS.toString());
    } else {
        cfg.setProperty(NetBeansRunParamsIDEChecker.OLD_PROPERTY, argsS.toString());
    }

    return RunUtils.run(cfg);
}
项目:incubator-netbeans    文件:RequestProcessorTest.java   
public void testTheCancelOfRunningTask() throws InterruptedException {
    final CountDownLatch started = new CountDownLatch(1);
    final CountDownLatch allowedToFinish = new CountDownLatch(1);
    Counter x = new Counter () {
        @Override
        public void run() {
            started.countDown();
            super.run();
            for (;;) try {
                allowedToFinish.await();
                break;
            } catch (InterruptedException ex) {
                continue;
            }
        }
    };
    RequestProcessor rp = new RequestProcessor ("testTheCancelOfRunningTask");
    final RequestProcessor.Task task = rp.post(x);
    started.await();
    assertFalse("Finished", task.isFinished());
    assertFalse("Too late to cancel", task.cancel());
    allowedToFinish.countDown();
    assertFalse("nothing to cancel", task.cancel());
    task.waitFinished();
    assertTrue("Now it is finished", task.isFinished());
    assertFalse("Still nothing to cancel", task.cancel());
}
项目:incubator-netbeans    文件:RequestProcessorTest.java   
public void testTheCancelOfFinishedTask() {
    Counter x = new Counter ();
    RequestProcessor rp = new RequestProcessor ("testTheCancelOfFinishedTask");
    final RequestProcessor.Task task = rp.post(x);
    task.waitFinished();
    assertTrue("Finished", task.isFinished());
    assertFalse("Too late to cancel", task.cancel());
}
项目:incubator-netbeans    文件:DocumentOpenClose.java   
private void waitForCloseFinish() {
    Task closeTask;
    synchronized (lock) {
        closeTask = activeCloseTask;
    }
    // Must wait for finishing outside of "lock" otherwise deadlock with close task processing
    if (closeTask != null) {
        closeTask.waitFinished();
    }
}
项目:incubator-netbeans    文件:RequestProcessorTest.java   
/** Test to check the waiting in request processor.
*/
public void testWaitFinishedOnNotStartedTaskFromRPThread () throws Exception {
    Counter x = new Counter ();
    RequestProcessor rp = new RequestProcessor ("testWaitFinishedOnNotStartedTaskFromRPThread");
    final RequestProcessor.Task task = rp.post(x, Integer.MAX_VALUE);

    //
    // Following code tests whether the RP.create().waitFinished really blocks
    // until somebody schedules the task.
    //
    class WaitTask implements Runnable {
        public boolean finished;

        public synchronized void run () {
            task.waitFinished ();
            finished = true;
            notifyAll ();
        }

        public synchronized void w (int timeOut) throws Exception {
            if (!finished) {
                wait (timeOut);
            }
        }
    }
    WaitTask wt = new WaitTask ();
    rp.post (wt);
    wt.w (0);
    assertTrue ("The task.waitFinished has to finish, otherwise the RequestProcessor thread will stay occupied forever", wt.finished);
    x.assertCnt ("The task has been executed - wait from RP made it start", 1);
}
项目:incubator-netbeans    文件:CloneableEditorSupportTest.java   
public void testPrepareDocument() throws Exception {
    content = "Ahoj\nMyDoc";
    Task task = support.prepareDocument();
    task.waitFinished();

    try {
        Object o = new Object();
        assertGC("", new WeakReference<Object>(o));
    } catch (AssertionFailedError e) {
        // ignore, intentional
    }

    Document doc = support.getDoc();
    assertNotNull("Document should not be GCed while its loading task exists", doc);

    Task task2 = support.prepareDocument();
    assertTrue("Loading task should be finished", task2.isFinished());
    assertNotSame("Expecting different task instance", task, task2);
    task2 = null;

    Reference<Task> taskRef = new WeakReference<Task>(task);
    Reference<Document> docRef = new WeakReference<Document>(doc);
    task = null;
    doc = null;
    assertGC("Can't GC document loading task", taskRef);
    assertGC("Can't GC document", docRef);
}
项目:incubator-netbeans    文件:ReloadTest.java   
public void testRefreshProblem46885 () throws Exception {
    StyledDocument doc = support.openDocument ();

    doc.insertString (0, "A text", null);
    support.saveDocument ();

    content = "New";
    propL.firePropertyChange (CloneableEditorSupport.Env.PROP_TIME, null, null);

    waitAWT ();
    Task reloadTask = support.reloadDocument();
    reloadTask.waitFinished();

    String s = doc.getText (0, doc.getLength ());
    assertEquals ("Text has been updated", content, s);


    long oldtime = System.currentTimeMillis ();
    Thread.sleep(300);
    err.info("Document modified");
    doc.insertString (0, "A text", null);
    err.info("Document about to save");
    support.saveDocument ();
    err.info("Document saved");
    s = doc.getText (0, doc.getLength ());

    err.info("Current content: " + s);
    content = "NOT TO be loaded";
    propL.firePropertyChange (CloneableEditorSupport.Env.PROP_TIME, null, new Date (oldtime));

    waitAWT ();

    String s1 = doc.getText (0, doc.getLength ());
    err.info("New content: " + s1);
    assertEquals ("Text has not been updated", s, s1);
}
项目:incubator-netbeans    文件:RequestProcessorTest.java   
/** Test to check the waiting in request processor.
*/
public void testWaitFinishedOnNotStartedTask () throws Exception {
    Counter x = new Counter ();
    final RequestProcessor.Task task = RequestProcessor.getDefault().create (x);

    //
    // Following code tests whether the RP.create().waitFinished really blocks
    // until somebody schedules the task.
    //
    class WaitThread extends Thread {
        public boolean finished;

        @Override
        public void run () {
            task.waitFinished ();
            synchronized (this) {
                finished = true;
                notifyAll ();
            }
        }

        public synchronized void w (int timeOut) throws Exception {
            if (!finished) {
                wait (timeOut);
            }
        }
    }
    WaitThread wt = new WaitThread ();
    wt.start ();
    wt.w (100);
    assertTrue ("The waitFinished has not ended, because the task has not been planned", !wt.finished);
    task.schedule (0);
    wt.w (0);
    assertTrue ("The waitFinished finished, as the task is now planned", wt.finished);
    x.assertCnt ("The task has been executed", 1);
}
项目:incubator-netbeans    文件:MavenCommandLineExecutor.java   
public ExecutorTask execute(RunConfig config, InputOutput io, TabContext tc) {
    LifecycleManager.getDefault().saveAll();
    MavenExecutor exec = new MavenCommandLineExecutor(config, io, tc);
    ExecutorTask task = ExecutionEngine.getDefault().execute(config.getTaskDisplayName(), exec, new ProxyNonSelectableInputOutput(exec.getInputOutput()));
    exec.setTask(task);
    task.addTaskListener(new TaskListener() {
        @Override
        public void taskFinished(Task t) {
            MavenProject mp = config.getMavenProject();
            if (mp == null) {
                return;
            }
            final List<Artifact> arts = new ArrayList<Artifact>();
            Artifact main = mp.getArtifact();
            if (main != null) {
                arts.add(main);
            }
            arts.addAll(mp.getArtifacts());
            UPDATE_INDEX_RP.post(new Runnable() {
                @Override
                public void run() {
                    RepositoryIndexer.updateIndexWithArtifacts(RepositoryPreferences.getInstance().getLocalRepository(), arts);
                }
            });
        }
    });
    return task;
}
项目:incubator-netbeans    文件:NbInstaller.java   
@Override
public Task closeAsync(List<Module> modules) {
    Util.err.fine("close: " + modules);
    ev.log(Events.CLOSE);
    moduleList.shutDown();
    List<Task> waitFor = onStartStop.startClose(modules);
    // [PENDING] this may need to write out changed ModuleInstall externalized
    // forms...is that really necessary to do here, or isn't it enough to
    // do right after loading etc.? Currently these are only written when
    // a ModuleInstall has just been restored etc. which is probably fine.
    for (Module m : modules) {
        Class<? extends ModuleInstall> instClazz = installs.get(m);
        if (instClazz != null) {
            try {
                ModuleInstall inst = SharedClassObject.findObject(instClazz, true);
                if (inst == null) throw new IllegalStateException("Inconsistent state: " + instClazz); // NOI18N
                inst.close();
            } catch (ThreadDeath td) {
                throw td;
            } catch (Throwable t) {
                // Catch even the heavy stuff here, we are going away.
                Util.err.log(Level.SEVERE, null, t);
                // oh well
            }
        }
    }
    waitFor.add(WarmUpSupport.waitTask());
    return new ProxyTask(waitFor);
}
项目:incubator-netbeans    文件:RequestProcessorTest.java   
/** Make sure it is safe to call waitFinished() on a task from within
 * a task listener.
 */
public void testWaitFinishedFromNotification() throws Exception {
    class X implements Runnable {
        private Task task;
        private int cnt;
        public synchronized Task start() {
            if (task == null) {
                task = RequestProcessor.postRequest(this);
            }
            return task;
        }
        public void run() {
            cnt++;
        }
        public int getCount() {
            return cnt;
        }
        public void block() {
            start().waitFinished();
        }
    }
    final X x = new X();
    final Object lock = "wait for task to finish";
    final boolean[] finished = new boolean[1];
    x.start().addTaskListener(new TaskListener() {
        public void taskFinished(Task t) {
            x.block();
            finished[0] = true;
            synchronized (lock) {
                lock.notify();
            }
        }
    });
    synchronized (lock) {
        lock.wait(5000);
    }
    assertTrue(finished[0]);
    assertEquals(1, x.getCount());
}
项目:incubator-netbeans    文件:NbStartStop.java   
void initialize() {
    for (Lookup.Item<Runnable> item : onStart().allItems()) {
        synchronized (onStart) {
            RequestProcessor.Task already = onStart.get(item.getId());
            if (already == null) {
                Runnable r = item.getInstance();
                if (r != null) {
                    onStart.put(item.getId(), RP.post(r));
                }
            }
        }
    }

}
项目:incubator-netbeans    文件:NbStartStop.java   
void waitOnStart() {
    RequestProcessor.Task[] all;
    synchronized (onStart) {
        Collection<RequestProcessor.Task> values = onStart.values();
        all = values.toArray(new RequestProcessor.Task[values.size()]);
    }
    for (RequestProcessor.Task t : all) {
        t.waitFinished();
    }
}
项目:incubator-netbeans    文件:CheckoutAction.java   
public static RequestProcessor.Task performCheckout(
    final SVNUrl repository,
    final SvnClient client,
    final RepositoryFile[] repositoryFiles,
    final File workingDir,
    final boolean atWorkingDirLevel,
    final boolean doExport,
    final boolean showCheckoutCompleted)
{
    SvnProgressSupport support = new SvnProgressSupport() {
        @Override
        public void perform() {
            try {
                setDisplayName(java.util.ResourceBundle.getBundle("org/netbeans/modules/subversion/ui/checkout/Bundle").getString("LBL_Checkout_Progress"));
                setCancellableDelegate(client);
                client.addNotifyListener(this);
                checkout(client, repository, repositoryFiles, workingDir, atWorkingDirLevel, doExport, this);
            } catch (SVNClientException ex) {
                annotate(ex);
                return;
            } finally {
                Subversion.getInstance().versionedFilesChanged();
                client.removeNotifyListener(this);
            }
            if(isCanceled()) {
                return;
            }
            setDisplayName(java.util.ResourceBundle.getBundle("org/netbeans/modules/subversion/ui/checkout/Bundle").getString("LBL_ScanFolders_Progress"));
            if(showCheckoutCompleted) showCheckoutCompletet(repositoryFiles, workingDir, atWorkingDirLevel, doExport, this);
        }
    };
    return support.start(Subversion.getInstance().getRequestProcessor(repository), repository, java.util.ResourceBundle.getBundle("org/netbeans/modules/subversion/ui/checkout/Bundle").getString("LBL_Checkout_Progress"));
}
项目:incubator-netbeans    文件:NbLifeExit.java   
private void doApproved(boolean isApproved, int status) throws ThreadDeath {
    if (isApproved) {
        try {
            try {
                NbLoaderPool.store();
            } catch (IOException ioe) {
                Logger.getLogger(NbLifecycleManager.class.getName()).log(Level.WARNING, null, ioe);
            }
            //#46940 -saving just once..
            //                        // save window system, [PENDING] remove this after the winsys will
            //                        // persist its state automaticaly
            //                        if (windowSystem != null) {
            //                            windowSystem.save();
            //                        }
            SessionManager.getDefault().close();
        } catch (ThreadDeath td) {
            throw td;
        } catch (Throwable t) {
            // Do not let problems here prevent system shutdown. The module
            // system is down; the IDE cannot be used further.
            Exceptions.printStackTrace(t);
        }
        // #37231 Someone (e.g. Jemmy) can install its own EventQueue and then
        // exit is dispatched through that proprietary queue and it
        // can be refused by security check. So, we need to replan
        // to RequestProcessor to avoid security problems.
        Task exitTask = new Task(new NbLifeExit(5, status, null, onExit));
        RP.post(exitTask);
    } else {
        // end of exit
        onExit.countDown();
    }
}
项目:incubator-netbeans    文件:FolderChildren.java   
public final boolean waitFinished() {
    RequestProcessor.Task t;
    synchronized (this) {
        t = task;
        if (t == null) {
            return false;
        }
    }
    err.log(Level.FINE, "original before wait: {0}", getOriginal());
    t.waitFinished();
    err.log(Level.FINE, "original after wait: {0}", getOriginal());
    err.log(Level.FINE, "task after waitFinished {0}", task);
    return true;
}
项目:incubator-netbeans    文件:DesignSupport.java   
public static void redefineLayout(Project p, JButton toEnable) {
    try {
        AtomicReference<FileObject> userDir = new AtomicReference<FileObject>();
        Task task = invokeDesignMode(p, userDir);
        if (task == null) {
            toEnable.setEnabled(true);
        }
        task.addTaskListener(new DesignSupport(p, toEnable, userDir));
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
    }
}
项目:incubator-netbeans    文件:FolderInstance.java   
/** Checks whether recreation has already started and starts it if if was
 *  was not yet started during the live of this <code>FolderInstance</code>.
 * @return the latest started task for children computation */
private final synchronized Task checkRecognizingStarted () {
    if(recognizingTask == null) {
        recreate();
    }

    return recognizingTask;
}
项目:incubator-netbeans    文件:FolderInstance.java   
/** Recomputes the list of tasks we should wait for (i.e. the tasks associated
 *  with the children of the folder).
 */
private void updateWaitFor (HoldInstance[] arr) {
    ArrayList<Task> out = new ArrayList<Task> (arr.length);
    for (int i = 0; i < arr.length; i++) {
        Task t = arr[i].getTask ();
        if (t != null) {
            out.add (t);
        }
    }
    waitFor = out.toArray (new Task[out.size ()]);
}