Examples of CancellationSource


Examples of org.jtrim.cancel.CancellationSource

            final CommandCompleteListener listener) {
        ExceptionHelper.checkNotNullArgument(executor, "executor");
        ExceptionHelper.checkNotNullArgument(taskDefFactory, "taskDefFactory");
        ExceptionHelper.checkNotNullArgument(listener, "listener");

        final CancellationSource cancel = Cancellation.createCancellationSource();
        final String origDisplayName = taskDefFactory.getDisplayName();

        final ReplaceableProgressHandle progress = new ReplaceableProgressHandle(cancel.getController());
        final AtomicBoolean inProgress = new AtomicBoolean(false);

        cancel.getToken().addCancellationListener(new Runnable() {
            @Override
            public void run() {
                if (!inProgress.get()) {
                    progress.finish();
                }
            }
        });

        progress.start(origDisplayName);
        executor.execute(cancel.getToken(), new CancelableTask() {
            @Override
            public void execute(CancellationToken cancelToken) throws Exception {
                inProgress.set(true);
                cancelToken.checkCanceled();
View Full Code Here

Examples of org.jtrim.cancel.CancellationSource

        String title = NbStrings.getConfirmDeleteProjectTitle();
        if (JOptionPane.showOptionDialog(null, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, answers, answers[1]) != 0) {
            return;
        }

        CancellationSource cancel = Cancellation.createCancellationSource();
        final ProgressHandle progress = createProgress(cancel.getController());

        progress.start();
        PROJECT_PROCESSOR.execute(cancel.getToken(), new CancelableTask() {
            @Override
            public void execute(CancellationToken cancelToken) {
                doRemoveProject(cancelToken);
            }
        }, new CleanupTask() {
View Full Code Here

Examples of org.jtrim.cancel.CancellationSource

            }
        }

        @Override
        public void actionPerformed(final ActionEvent e) {
            final CancellationSource cancel = Cancellation.createCancellationSource();
            final ProgressHandle progress = ProgressHandleFactory.createHandle(NbStrings.getJumpToSource(), new Cancellable() {
                @Override
                public boolean cancel() {
                    cancel.getController().cancel();
                    return true;
                }
            });

            ShowTestUtils.FILE_OPEN_PROCESSOR.execute(cancel.getToken(), new CancelableTask() {
                @Override
                public void execute(CancellationToken cancelToken) {
                    progress.start();
                    try {
                        doActionNow(cancelToken, e);
View Full Code Here

Examples of org.jtrim.cancel.CancellationSource

    }

    private static SingleExecutionOutputProcessor attachDebuggerListener(
            final JavaExtension javaExt,
            CustomCommandActions.Builder customActions) {
        final CancellationSource cancel = Cancellation.createCancellationSource();
        customActions.setCancelToken(cancel.getToken());

        return new SingleExecutionOutputProcessor() {
            @Override
            public TaskOutputProcessor startExecution(Project project) {
                return new DebugTextListener(new AttacherListener(javaExt, cancel.getController()));
            }
        };
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.