当前位置: 首页>>代码示例>>Java>>正文


Java ProgressHandle.start方法代码示例

本文整理汇总了Java中org.netbeans.api.progress.ProgressHandle.start方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressHandle.start方法的具体用法?Java ProgressHandle.start怎么用?Java ProgressHandle.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.api.progress.ProgressHandle的用法示例。


在下文中一共展示了ProgressHandle.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveToFile

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private void saveToFile() {
    final File file = new FileChooserBuilder(AttachmentsPanel.class)
            .setFilesOnly(true).showSaveDialog();
    if (file != null) {
        String progressFormat = NbBundle.getMessage(
                                    SaveAttachmentAction.class,
                                    "Attachment.saveToFile.progress"); //NOI18N
        String progressMessage = MessageFormat.format(progressFormat, getFilename());
        final ProgressHandle handle = ProgressHandleFactory.createHandle(progressMessage);
        handle.start();
        handle.switchToIndeterminate();
        Support.getInstance().getParallelRP().post(new Runnable() {
            @Override
            public void run() {
                try {
                    getAttachmentData(file);
                } catch (IOException ioex) {
                    LOG.log(Level.INFO, ioex.getMessage(), ioex);
                } finally {
                    handle.finish();
                }
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:AttachmentsPanel.java

示例2: ProgressInfo

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
public ProgressInfo(String name, DataObject root) {
    final Cancellable can;
    if (root instanceof DataFolder) {
        can = new Cancellable() {

            @Override
            public boolean cancel() {
                terminated.set(true);
                return true;
            }
        };
    } else {
        can = null;
    }
    ProgressHandle ph = ProgressHandleFactory.createHandle(name, can);
    ph.setInitialDelay(500);
    ph.start();
    this.progressHandle = ph;
    this.root = root;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:DataObject.java

示例3: testMainProjectFlagNotMovedForNonMainProject

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
public void testMainProjectFlagNotMovedForNonMainProject() throws Exception {
    OpenProjects.getDefault().open(new Project[] {prj}, false);
    
    Project main = OpenProjects.getDefault().getMainProject();
    
    assertTrue(main == null || !prj.getProjectDirectory().equals(main.getProjectDirectory()));
    
    ProgressHandle handle = ProgressHandleFactory.createHandle("test-handle");
    handle.start(DefaultProjectOperationsImplementation.MAX_WORK);
    FileObject oldProject = prj.getProjectDirectory();
    File       oldProjectFile = FileUtil.toFile(oldProject);
    FileObject newTarget = oldProject.getParent();
    
    DefaultProjectOperationsImplementation.doMoveProject(handle, prj, "projMove", "projMove", newTarget, "ERR_Cannot_Move");
    
    Project newProject = ProjectManager.getDefault().findProject(newTarget.getFileObject("projMove"));
    
    main = OpenProjects.getDefault().getMainProject();
    
    assertTrue(    main == null
                || (    !prj.getProjectDirectory().equals(main.getProjectDirectory())
                     && !newProject.getProjectDirectory().equals(main.getProjectDirectory())));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:DefaultProjectOperationsImplementationTest.java

示例4: testMainProjectFlagMovedForMainProject

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
public void testMainProjectFlagMovedForMainProject() throws Exception {
    OpenProjects.getDefault().open(new Project[] {prj}, false);
    OpenProjects.getDefault().setMainProject(prj);
    assertEquals(prj, OpenProjects.getDefault().getMainProject());
    ProgressHandle handle = ProgressHandleFactory.createHandle("test-handle");
    handle.start(DefaultProjectOperationsImplementation.MAX_WORK);
    FileObject oldProject = prj.getProjectDirectory();
    File       oldProjectFile = FileUtil.toFile(oldProject);
    FileObject newTarget = oldProject.getParent();
    
    DefaultProjectOperationsImplementation.doMoveProject(handle, prj, "projMove", "projMove", newTarget, "ERR_Cannot_Move");
    
    Project newProject = ProjectManager.getDefault().findProject(newTarget.getFileObject("projMove"));
    
    assertEquals(OpenProjects.getDefault().getMainProject(), newProject);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:DefaultProjectOperationsImplementationTest.java

示例5: doActivate

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private static void doActivate() {
    if (!helper.canBundleDerby()) {
        LOGGER.fine("Default platform cannot bundle Derby"); // NOI18N
        return;
    }

    ProgressHandle handle = ProgressHandleFactory.createSystemHandle(NbBundle.getMessage(DerbyActivator.class, "MSG_RegisterJavaDB"));
    handle.start();
    try {
        if (registerDerby()) {
            registerSampleDatabase();
        }
    } finally {
        handle.finish();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:DerbyActivator.java

示例6: refreshModuleList

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private static void refreshModuleList() {
    if (catalogRefreshed.compareAndSet(false, true)) {
        final ProgressHandle refreshHandle = ProgressHandle.createHandle(NbBundle.getMessage(
                MissingModuleProblemsProvider.class,
                "TXT_ModuleListRefresh"));
        refreshHandle.start();
        try {
            for (UpdateUnitProvider provider : UpdateUnitProviderFactory.getDefault().getUpdateUnitProviders(false)) {
                try {
                    provider.refresh(refreshHandle, true);
                } catch (IOException ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
        } finally {
            refreshHandle.finish();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:MissingModuleProblemsProvider.java

示例7: checkLogin

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private static boolean checkLogin(final BugzillaRepository repo) {
    if(repo.getUsername() != null && !repo.getUsername().equals("")) { // NOI18N
        return true;
    }

    String errorMsg = NbBundle.getMessage(NBLoginPanel.class, "MSG_MISSING_USERNAME_PASSWORD");  // NOI18N
    while(NBLoginPanel.show(repo, errorMsg)) {

        ValidateCommand cmd = new ValidateCommand(repo.getTaskRepository());
        ProgressHandle handle = ProgressHandleFactory.createHandle(NbBundle.getMessage(NBLoginPanel.class, "MSG_CONNECTING_2_NBORG")); // NOI18N
        handle.start();
        try {
            repo.getExecutor().execute(cmd, false, false, false);
        } finally {
            handle.finish();
        }
        if(cmd.hasFailed()) {
            errorMsg = cmd.getErrorMessage();
            continue;
        }
        return true;
    }
    repo.setCredentials(null, null, null, null); // reset
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:NBRepositorySupport.java

示例8: instantiate

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
@Messages({"PRG_Dir=Creating directory", "PRG_FINISH=Finishing..."})
public Set<FileObject> instantiate (ProgressHandle handle) throws IOException {
    handle.start();
    try {
        handle.progress(Bundle.PRG_Dir());
        ProjectInfo vi = new ProjectInfo((String) wiz.getProperty("groupId"), (String) wiz.getProperty("artifactId"), (String) wiz.getProperty("version"), (String) wiz.getProperty("package")); //NOI18N
        String[] splitlog = StringUtils.split(log, ":");
        ArchetypeWizardUtils.logUsage(splitlog[0], splitlog[1], splitlog[2]);
        File projFile = FileUtil.normalizeFile((File) wiz.getProperty(CommonProjectActions.PROJECT_PARENT_FOLDER)); // NOI18N
        CreateProjectBuilder builder = createBuilder(projFile, vi, handle);
        builder.create();
        handle.progress(Bundle.PRG_FINISH());
        return ArchetypeWizardUtils.openProjects(projFile, null);   
    } finally {
        handle.finish();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:IDENativeMavenWizardIterator.java

示例9: testCopyWithInnerProjectComplex

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
public void testCopyWithInnerProjectComplex() throws Exception {
    TestUtil.createFileFromContent(DefaultProjectOperationsImplementationTest.class.getResource("data/test.txt"), projdir, "lib/test.txt");
    FileObject projdir2 = projdir.getFileObject("lib").createFolder("proj2");
    
    createProject(projdir2);
    
    ProgressHandle handle = ProgressHandleFactory.createHandle("test-handle");
    handle.start(DefaultProjectOperationsImplementation.MAX_WORK);
    
    FileObject newTarget = prj.getProjectDirectory().getParent();
    
    DefaultProjectOperationsImplementation.doCopyProject(handle, prj, "projCopy", newTarget);
    
    File newProject = new File(FileUtil.toFile(newTarget), "projCopy");
    
    assertTrue(newProject.isDirectory());
    assertTrue(new File(newProject, "nbproject").isDirectory());
    assertTrue(new File(newProject, "src").isDirectory());
    assertTrue(new File(newProject, "lib").isDirectory());
    assertFalse(new File(new File(newProject, "lib"), "proj2").exists());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:DefaultProjectOperationsImplementationTest.java

示例10: execute

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
public void execute() throws Exception {
    ProgressHandle handle = ProgressHandleFactory.createHandle(Utils.getMessage("LBL_StoppingMySQLServer"), this);
    try {
        handle.start();
        handle.switchToIndeterminate();
        proc = runProcess(getStopPath(), getStopArgs());
        // wait until server is shut down
        proc.waitFor();
    } finally {
        if (proc != null) {
            proc.destroy();
            closeOutput();
        }
        handle.finish();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:MySQLDatabaseServer.java

示例11: testMoveWithInnerProjectComplex

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
public void testMoveWithInnerProjectComplex() throws Exception {
    TestUtil.createFileFromContent(DefaultProjectOperationsImplementationTest.class.getResource("data/test.txt"), projdir, "lib/test.txt");
    FileObject projdir2 = projdir.getFileObject("lib").createFolder("proj2");
    
    createProject(projdir2);
    
    ProgressHandle handle = ProgressHandleFactory.createHandle("test-handle");
    handle.start(DefaultProjectOperationsImplementation.MAX_WORK);
    
    FileObject oldProject     = prj.getProjectDirectory();
    File       oldProjectFile = FileUtil.toFile(oldProject);
    FileObject newTarget      = oldProject.getParent();
    
    DefaultProjectOperationsImplementation.doMoveProject(handle, prj, "projMove", "projMove", newTarget, "ERR_Cannot_Move");
    
    File newProject = new File(FileUtil.toFile(newTarget), "projMove");
    
    assertTrue(newProject.isDirectory());
    assertTrue(new File(newProject, "nbproject").isDirectory());
    assertTrue(new File(newProject, "src").isDirectory());
    assertTrue(new File(newProject, "lib").isDirectory());
    assertTrue(new File(new File(newProject, "lib"), "proj2").isDirectory());
    assertFalse(new File(new File(oldProjectFile, "lib"), "proj2").exists());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:DefaultProjectOperationsImplementationTest.java

示例12: instantiate

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
public Set instantiate(ProgressHandle handle) throws IOException {
    try {
        handle.start();
        return instantiateWProgress(handle);
    } finally {
        handle.finish();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:PersistenceUnitWizard.java

示例13: findAndRunAction

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
/**
 * Find action by display name and run it.
 */
@NbBundle.Messages({
    "LBL_SearchingRecentResult=Searching for a Quick Search Item",
    "MSG_RecentResultNotFound=Recent Quick Search Item was not found."})
private void findAndRunAction() {
    final AtomicBoolean cancelled = new AtomicBoolean(false);
    ProgressHandle handle = ProgressHandleFactory.createHandle(
            Bundle.LBL_SearchingRecentResult(), new Cancellable() {
        @Override
        public boolean cancel() {
            cancelled.set(true);
            return true;
        }
    });
    handle.start();
    ResultsModel model = ResultsModel.getInstance();
    Task evaluate = CommandEvaluator.evaluate(
            stripHTMLandPackageNames(name), model);
    RP.post(evaluate);
    int tries = 0;
    boolean found = false;
    while (tries++ < 30 && !cancelled.get()) {
        if (checkActionWasFound(model, true)) {
            found = true;
            break;
        } else if (evaluate.isFinished()) {
            found = checkActionWasFound(model, false);
            break;
        }
    }
    handle.finish();
    if (!found && !cancelled.get()) {
        NotifyDescriptor nd = new NotifyDescriptor.Message(
                Bundle.MSG_RecentResultNotFound(),
                NotifyDescriptor.INFORMATION_MESSAGE);
        DialogDisplayer.getDefault().notifyLater(nd);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:RecentSearches.java

示例14: instantiate

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
public Set instantiate(ProgressHandle handle) throws IOException {
    handle.start(3);
    try {
        generateClasses(helper.getRevengFile(), handle);
        handle.progress(NbBundle.getMessage(HibernateCodeGenWizard.class, "HibernateCodeGenerationPanel_WizardProgress_UpdateConf"), 3); // NOI18N
        updateConfiguration();
        return Collections.singleton(helper.getRevengFile());
    } catch (Exception e) {
        return Collections.EMPTY_SET;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:HibernateCodeGenWizard.java

示例15: initSamples

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private void initSamples() throws IOException {
    SamplesInputStream stream = new SamplesInputStream(npssFile.getInputStream());
    int samplesGuess = (int)(npssFile.getSize()/130);
    ProgressHandle ph = ProgressHandle.createSystemHandle("Computing snapshot samples", null);
    ph.start(samplesGuess);
    
    for(ThreadsSample s = stream.readSample(); s != null; s = stream.readSample()) {
        samples++;
        lastTimestamp = s.getTime();
        if (samples < samplesGuess) {
            ph.progress(samples);
        }
    }
    ph.finish();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:SampledCPUSnapshot.java


注:本文中的org.netbeans.api.progress.ProgressHandle.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。