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


Java ProgressHandle类代码示例

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


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

示例1: applyPatch

import org.netbeans.api.progress.ProgressHandle; //导入依赖的package包/类
private void applyPatch() {
    String progressFormat = NbBundle.getMessage(AttachmentsPanel.class,"Attachment.applyPatch.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() {
                IDEServices ideServices = Support.getInstance().getIDEServices();
                if(ideServices != null) {
                    try {
                        ideServices.applyPatch(saveToTempFile());
                    } catch (IOException ex) {
                        LOG.log(Level.WARNING, ex.getMessage(), ex);
                    } finally {
                        handle.finish();
                    }
                }            
            }
        });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:AttachmentsPanel.java

示例2: 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

示例3: uploadLogs

import org.netbeans.api.progress.ProgressHandle; //导入依赖的package包/类
private static URL uploadLogs(URL postURL, String id, Map<String,String> attrs,
        List<LogRecord> recs, DataType dataType, boolean isErrorReport,
        SlownessData slownData, boolean isOOM, boolean isAfterRestart) throws IOException {
    ProgressHandle h = null;
    //Do not show progress UI for metrics upload
    if (dataType != DataType.DATA_METRICS) {
        h = ProgressHandleFactory.createHandle(NbBundle.getMessage(Installer.class, "MSG_UploadProgressHandle"));
    }
    try {
        return uLogs(h, postURL, id, attrs, recs, dataType, isErrorReport, slownData, isOOM, isAfterRestart);
    } finally {
        if (h != null) {
            h.finish();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:Installer.java

示例4: markForDisable

import org.netbeans.api.progress.ProgressHandle; //导入依赖的package包/类
public Collection<File> markForDisable (Collection<ModuleInfo> modules, ProgressHandle handle) {
    if (modules == null) {
        throw new IllegalArgumentException ("ModuleInfo argument cannot be null.");
    }
    
    if (handle != null) {
        handle.switchToDeterminate (modules.size() + 1);
    }
    
    Collection<File> configs = new HashSet<File> ();
    int i = 0;
    for (ModuleInfo moduleInfo : modules) {
        File config = locateConfigFile (moduleInfo);
        assert config != null : "Located config file for " + moduleInfo.getCodeName ();
        assert config.exists () : config + " config file must exists for " + moduleInfo.getCodeName ();
        err.log(Level.FINE, "Locate config file of " + moduleInfo.getCodeNameBase () + ": " + config);
        if(config!=null) {
            configs.add (config);
        }
        if (handle != null) {
            handle.progress (++i);
        }
    }

    return configs;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ModuleDeleterImpl.java

示例5: createHeap

import org.netbeans.api.progress.ProgressHandle; //导入依赖的package包/类
private static Heap createHeap(File heapFile) throws FileNotFoundException, IOException {
    ProgressHandle pHandle = null;

    try {
        pHandle = ProgressHandle.createHandle(Bundle.ClassesListController_LoadingDumpMsg());
        pHandle.setInitialDelay(0);
        pHandle.start(HeapProgress.PROGRESS_MAX*2);
        
        setProgress(pHandle,0);
        Heap heap = HeapFactory.createHeap(heapFile);
        setProgress(pHandle,HeapProgress.PROGRESS_MAX);
        heap.getSummary(); // Precompute HeapSummary within progress

        return heap;
    } finally {
        if (pHandle != null) {
            pHandle.finish();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:HeapWalker.java

示例6: refreshUpdateCenters

import org.netbeans.api.progress.ProgressHandle; //导入依赖的package包/类
/**
 * @param progress
 * @return collection of strings with description of problems in update process
 */
private static Collection<String> refreshUpdateCenters (ProgressHandle progress) {
    final long startTime = System.currentTimeMillis ();
    Collection<String> problems = new HashSet<String> ();
    assert ! SwingUtilities.isEventDispatchThread () : "Cannot run refreshProviders in EQ!";
    Collection<RequestProcessor.Task> refreshTasks = new HashSet<RequestProcessor.Task> ();
    List <UpdateUnitProvider> providers = UpdateUnitProviderFactory.getDefault ().getUpdateUnitProviders (true);
    RequestProcessor rp = new RequestProcessor("autoupdate-refresh-providers", providers.size(), false);
    for (UpdateUnitProvider p : providers) {
        RequestProcessor.Task t = rp.post (getRefresher (p, problems, progress));
        refreshTasks.add (t);
    }
    err.log (Level.FINEST, "Waiting for all refreshTasks...");
    for (RequestProcessor.Task t : refreshTasks) {
        t.waitFinished ();
    }
    err.log (Level.FINEST, "Waiting for all refreshTasks is done.");
    long time = (System.currentTimeMillis () - startTime) / 1000;
    if (time > 0) {
        Utilities.putTimeOfRefreshUpdateCenters (time);
    }
    return problems;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:AutoupdateCheckScheduler.java

示例7: DefaultProjectRenamePanel

import org.netbeans.api.progress.ProgressHandle; //导入依赖的package包/类
/**
 * Creates new form DefaultProjectRenamePanel
 */
public DefaultProjectRenamePanel(ProgressHandle handle, Project project, String name) {
    this.project = project;
    this.handle = handle;
    
    if (name == null) {
        name = ProjectUtils.getInformation(project).getDisplayName();
    }
    
    initComponents();
    
    projectName.setText(name);
    projectName.getDocument().addDocumentListener(this);
    updateProjectFolder();
    validateDialog();
    
    if (Boolean.getBoolean("org.netbeans.modules.project.uiapi.DefaultProjectOperations.showProgress")) {
        ((CardLayout) progress.getLayout()).show(progress, "progress");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:DefaultProjectRenamePanel.java

示例8: ConfirmationPanel

import org.netbeans.api.progress.ProgressHandle; //导入依赖的package包/类
@Messages({
    "LBL_FormattingQuestion=Recursively format the selected files and folders?",
    "LBL_FormattingInProgress=Formatting:"
})
public ConfirmationPanel(ProgressHandle handle) {
    initComponents();
    setLayout(new CardLayout());
    add(new JLabel(Bundle.LBL_FormattingQuestion()), PANEL_QUESTION);
    JPanel progress = new JPanel(new BorderLayout());
    JLabel inProgressLabel = new JLabel(Bundle.LBL_FormattingInProgress());
    inProgressLabel.setBorder(new EmptyBorder(0, 0, 6, 0));
    progress.add(inProgressLabel, BorderLayout.NORTH);
    progress.add(ProgressHandleFactory.createProgressComponent(handle), BorderLayout.CENTER);
    add(progress, PANEL_PROGRESS);
    ((CardLayout) getLayout()).show(this, PANEL_QUESTION);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ConfirmationPanel.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: actionPerformed

import org.netbeans.api.progress.ProgressHandle; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    RP.post(new Runnable() {
        @Override
        public void run() {
            ProgressHandle markProgress = getProgress();
            markProgress.start(tasks.size());
            int workunits = 0;
            for (IssueImpl task : tasks) {
                if (canceled) {
                    break;
                }
                markProgress.progress(NbBundle.getMessage(Actions.class, "LBL_MarkTaskProgress", task.getDisplayName()));
                task.setSeen(setAsSeen);
                workunits++;
                markProgress.progress(workunits);
            }
            markProgress.finish();
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:Actions.java

示例11: 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

示例12: 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

示例13: download

import org.netbeans.api.progress.ProgressHandle; //导入依赖的package包/类
@NonNull
public static Future<String> download(
        @NonNull final URL url,
        @NonNull final Callable<Boolean> cancel) {
    return RP.submit(()-> {
        if (cancel.call()) {
            return "";  //NOI18N
        }
        final ProgressHandle handle = ProgressHandle.createHandle(NbBundle.getMessage(DocDownloader.class, "LBL_DownloadingDoc"));
        handle.start();
        try {
            final ByteArrayOutputStream out = new ByteArrayOutputStream();
            try(BufferedInputStream in = new BufferedInputStream(url.openStream())) {
                FileUtil.copy(in, out);
            }
            return cancel.call() ?
                    ""  //NOI18N
                    : new String(out.toByteArray(),"UTF-8");  //NOI18N
        } finally {
            handle.finish();
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:DocDownloader.java

示例14: showProgressDialogAndRunLater

import org.netbeans.api.progress.ProgressHandle; //导入依赖的package包/类
@Override
public <T> Future<T> showProgressDialogAndRunLater (ProgressRunnable<T> operation, ProgressHandle handle, boolean includeDetailLabel) {
   AbstractWindowRunner<T> wr = new ProgressBackgroundRunner<T>(operation, 
           handle, includeDetailLabel, operation instanceof Cancellable);
   Future<T> result = wr.start();
   assert EventQueue.isDispatchThread() == (result != null);
   if (result == null) {
       try {
           result = wr.waitForStart();
       } catch (InterruptedException ex) {
           LOG.log(Level.FINE, "Interrupted/cancelled during start {0}", operation); //NOI18N
           LOG.log(Level.FINER, "Interrupted/cancelled during start", ex); //NOI18N
           return null;
       }
   }
   return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:RunOffEDTImpl.java

示例15: performPatch

import org.netbeans.api.progress.ProgressHandle; //导入依赖的package包/类
public static boolean performPatch(File patch, File file) throws MissingResourceException {
    ProgressHandle ph = ProgressHandleFactory.createHandle(NbBundle.getMessage(PatchAction.class, "MSG_AplyingPatch", new Object[] {patch.getName()}));
    List<ContextualPatch.PatchReport> report = null;
    try {
        ph.start();
        ContextualPatch cp = ContextualPatch.create(patch, file);
        try {
            report = cp.patch(false, ph);
        } catch (Exception ioex) {
            ErrorManager.getDefault().annotate(ioex, NbBundle.getMessage(PatchAction.class, "EXC_PatchParsingFailed", ioex.getLocalizedMessage()));
            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ioex);
            ErrorManager.getDefault().notify(ErrorManager.USER, ioex);
            return false;
        }
    } finally {
        ph.finish();
    }
    return displayPatchReport(report, patch);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:PatchAction.java


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