本文整理汇总了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();
}
}
});
}
}
示例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;
}
示例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())));
}
示例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);
}
示例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();
}
}
示例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();
}
}
}
示例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;
}
示例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();
}
}
示例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());
}
示例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();
}
}
示例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());
}
示例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();
}
}
示例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);
}
}
示例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;
}
}
示例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();
}