本文整理汇总了Java中org.netbeans.api.progress.ProgressHandle.progress方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressHandle.progress方法的具体用法?Java ProgressHandle.progress怎么用?Java ProgressHandle.progress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.progress.ProgressHandle
的用法示例。
在下文中一共展示了ProgressHandle.progress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: instantiate
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
public Set instantiate(ProgressHandle handle) throws IOException {
Project project = Templates.getProject(wiz);
FileObject tFolder = Templates.getTargetFolder(wiz);
try {
handle.start(100);
handle.progress(NbBundle.getMessage(DBScriptWizard.class, "MSG_CreateFile"),5);
FileObject sqlFile = tFolder.createData(Templates.getTargetName(wiz), EXTENSION);//NOI18N
PersistenceEnvironment pe = project.getLookup().lookup(PersistenceEnvironment.class);
if (sqlFile != null) {
//execution
run(project, sqlFile, pe, handle, false);
}
return Collections.singleton(sqlFile);
} finally {
handle.finish();
}
}
示例2: visitSubprojects
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private static void visitSubprojects(Project p, Set<Project> projects, boolean main, ProgressHandle h, int[] startEnd) {
if ((main || !ProjectConvertors.isConvertorProject(p)) && projects.add(p)) {
if (h != null) {
h.progress(progressMessage(p), Math.min(++startEnd[0], startEnd[1]));
}
ProjectContainerProvider pcp = p.getLookup().lookup(ProjectContainerProvider.class);
if (pcp != null) {
ProjectContainerProvider.Result res = pcp.getContainedProjects();
projects.addAll(res.getProjects());
if (!res.isRecursive()) {
visitSubprojects(p, projects, false, h, startEnd);
}
} else {
//fallback to semi-deprecated subprojectprovider
SubprojectProvider spp = p.getLookup().lookup(SubprojectProvider.class);
if (spp != null) {
for (Project p2 : spp.getSubprojects()) {
visitSubprojects(p2, projects, false, h, startEnd);
}
}
}
}
}
示例3: instantiate
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
public Set instantiate(ProgressHandle handle) throws IOException {
try {
handle.start(2);
handle.progress(1);
RequestProcessor.getDefault().post(new Runnable() {
@Override
public void run() {
tryOpenProject();
}
});
return Collections.EMPTY_SET;
} finally {
handle.finish();
}
}
示例4: finnishProgress
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
protected void finnishProgress() {
// TODO add failed and restart texts
if (isCanceled()) {
getLogger().logCommandLine("==[IDE]== " + DateFormat.getDateTimeInstance().format(new Date()) + " " + runningName + " " + NbBundle.getMessage(ContextAction.class, "MSG_Progress_Canceled")); // NOI18N
} else {
final ProgressHandle progress = getProgressHandle();
progress.switchToDeterminate(100);
progress.progress(NbBundle.getMessage(ContextAction.class, "MSG_Progress_Done"), 100); // NOI18N
if (System.currentTimeMillis() > progressStamp) {
Subversion.getInstance().getParallelRequestProcessor().post(new Runnable() {
@Override
public void run() {
progress.finish();
}
}, 15 * 1000);
} else {
progress.finish();
}
getLogger().logCommandLine("==[IDE]== " + DateFormat.getDateTimeInstance().format(new Date()) + " " + runningName + " " + NbBundle.getMessage(ContextAction.class, "MSG_Progress_Finished")); // NOI18N
}
}
示例5: refresh
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
/** Make refresh of content of the provider. The content can by read from
* a cache. The <code>force</code> parameter forces reading content from
* remote server.
*
* @param force if true then forces to reread the content from server
* @return true if refresh succeed
* @throws java.io.IOException when any network problem is encountered
*/
public boolean refresh (ProgressHandle handle, boolean force) throws IOException {
boolean res = false;
if (handle != null) {
handle.progress (NbBundle.getMessage (UpdateUnitProviderImpl.class, "UpdateUnitProviderImpl_FormatCheckingForUpdates", getDisplayName ()));
}
final UpdateProvider updateProvider = getUpdateProvider();
updateProvider.refresh (force);
if (force) {
// store time of the last check
AutoupdateSettings.setLastCheck (new Date ());
AutoupdateSettings.setLastCheck (updateProvider.getName(),new Date ());
}
// don't remember update units while refreshing the content
UpdateManagerImpl.getInstance().clearCache ();
return res;
}
示例6: performDeleteOnProject
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private static int performDeleteOnProject(Project project, List<FileObject> toDelete ,ProgressHandle handle, int done) throws IOException {
handle.progress(NbBundle.getMessage(DefaultSuiteProjectOperationsImplementation.class, "LBL_Progress_Cleaning_Project"));
ProjectOperations.notifyDeleting(project);
handle.progress(++done);
for (FileObject f : toDelete) {
handle.progress(NbBundle.getMessage(DefaultSuiteProjectOperationsImplementation.class, "LBL_Progress_Deleting_File", FileUtil.getFileDisplayName(f)));
if (f != null && f.isValid()) {
f.delete();
}
handle.progress(++done);
}
FileObject projectFolder = project.getProjectDirectory();
projectFolder.refresh(); // #190983
if (!projectFolder.isValid()) {
LOG.log(Level.WARNING, "invalid project folder: {0}", projectFolder);
} else if (projectFolder.getChildren().length == 0) {
projectFolder.delete();
} else {
LOG.log(Level.WARNING, "project folder {0} was not empty: {1}", new Object[] {projectFolder, Arrays.asList(projectFolder.getChildren())});
}
ProjectOperations.notifyDeleted(project);
return done;
}
示例7: run
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
public String run(ProgressHandle handle) {
handle.switchToDeterminate(5);
for (int i= 0; i < 5; i++) {
handle.progress("Job " + i, i);
}
return "Done";
}
示例8: processFolderChildren
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private void processFolderChildren(FileObject fo, Set<Project> projects, ProgressHandle h, Counter counter, boolean checkShare) throws IllegalArgumentException {
Enumeration<? extends FileObject> e = fo.getFolders(false);
while (e.hasMoreElements()) {
try {
FileObject em = e.nextElement();
SharabilityQuery.Sharability share = SharabilityQuery.Sharability.UNKNOWN;
if (checkShare) {
share = SharabilityQuery.getSharability(fo);
if (share == SharabilityQuery.Sharability.NOT_SHARABLE) {
continue;
}
}
Project p = ProjectManager.getDefault().findProject(em);
if (p != null && !ProjectConvertors.isConvertorProject(p)) {
projects.add(p);
if (h != null) {
h.progress(progressMessage(p), Math.min(++counter.start, counter.end));
}
}
checkShare = share != SharabilityQuery.Sharability.SHARABLE;
// don't need to check the sharability if the current folder is marked as recursively sharable
processFolderChildren(em, projects, h, counter, checkShare);
} catch (IOException x) {
Exceptions.printStackTrace(x);
}
}
}
示例9: findProjects
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override protected void findProjects(Set<Project> projects, ProgressHandle h, int start, int end) {
List<String> paths = projectPaths();
for (String path : paths) {
Project p = projectForPath(path);
if (p != null) {
if (h != null) {
h.progress(progressMessage(p), start += ((end - start) / paths.size()));
}
projects.add(p);
}
}
}
示例10: 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();
}
示例11: 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;
}
}
示例12: execute
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
/**
* Executes given HQL query and returns the result.
* @param hql the query
* @param configFileObject hibernate configuration object.
* @return HQLResult containing the execution result (including any errors).
*/
public HQLResult execute(String hql,
SessionFactory sessionFactory,
int maxRowCount,
ProgressHandle ph) {
HQLResult result = new HQLResult();
try {
ph.progress(60);
Session session = sessionFactory.openSession();
session.beginTransaction();
ph.progress(70);
Query query = session.createQuery(hql);
query.setMaxResults(maxRowCount);
hql = hql.trim();
hql = hql.toUpperCase();
if (hql.startsWith("UPDATE") || hql.startsWith("DELETE")) { //NOI18N
result.setUpdateOrDeleteResult(query.executeUpdate());
} else {
result.setQueryResults(query.list());
}
session.getTransaction().commit();
} catch (Exception e) {
result.getExceptions().add(e);
}
return result;
}
示例13: instantiate
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
public Set<FileObject> instantiate (ProgressHandle handle) throws IOException {
final WizardDescriptor myWiz = this.wiz;
if (myWiz == null) {
LOG.warning("The uninitialize called before instantiate."); //NOI18N
return Collections.emptySet();
}
handle.start (3);
Set<FileObject> resultSet = new HashSet<>();
File dirF = (File)myWiz.getProperty("projdir"); //NOI18N
if (dirF == null) {
throw new NullPointerException ("projdir == null, props:" + myWiz.getProperties()); //NOI18N
}
dirF = FileUtil.normalizeFile(dirF);
String name = (String)myWiz.getProperty("name"); //NOI18N
JavaPlatform platform = (JavaPlatform)myWiz.getProperty("javaPlatform"); //NOI18N
handle.progress (NbBundle.getMessage (NewJ2SEModularProjectWizardIterator.class, "LBL_NewJ2SEModuleProjectWizardIterator_WizardProgress_CreatingProject"), 1);
J2SEModularProjectGenerator.createProject(dirF, name, platform);
handle.progress (2);
FileObject dir = FileUtil.toFileObject(dirF);
// Returning FileObject of project diretory.
// Project will be open and set as main
final Integer ind = (Integer) myWiz.getProperty(PROP_NAME_INDEX);
if (ind != null) {
WizardSettings.setNewProjectCount(ind);
}
resultSet.add (dir);
handle.progress (NbBundle.getMessage (NewJ2SEModularProjectWizardIterator.class, "LBL_NewJ2SEModuleProjectWizardIterator_WizardProgress_PreparingToOpen"), 3);
dirF = (dirF != null) ? dirF.getParentFile() : null;
if (dirF != null && dirF.exists()) {
ProjectChooser.setProjectsFolder (dirF);
}
SharableLibrariesUtils.setLastProjectSharable(false);
return resultSet;
}
示例14: setProgress
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private static ChangeListener setProgress(final ProgressHandle pHandle) {
final BoundedRangeModel progress = HeapProgress.getProgress();
ChangeListener cl = new ChangeListener() {
public void stateChanged(ChangeEvent e) {
pHandle.progress(progress.getValue());
}
};
progress.addChangeListener(cl);
return cl;
}
示例15: downloadFully
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
public static void downloadFully(URL url, File target) throws IOException {
// We don't use the settings here explicitly, since HttpRequests picks up the network settings from studio directly.
ProgressHandle handle = ProgressHandle.createHandle("Downloading " + url);
try {
URLConnection connection = url.openConnection();
if (connection instanceof HttpsURLConnection) {
((HttpsURLConnection) connection).setInstanceFollowRedirects(true);
((HttpsURLConnection) connection).setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; PPC; en-US; rv:1.3.1)");
((HttpsURLConnection) connection).setRequestProperty("Accept-Charset", "UTF-8");
((HttpsURLConnection) connection).setDoOutput(true);
((HttpsURLConnection) connection).setDoInput(true);
}
connection.setConnectTimeout(3000);
connection.connect();
int contentLength = connection.getContentLength();
if (contentLength < 1) {
throw new FileNotFoundException();
}
handle.start(contentLength);
OutputStream dest = new FileOutputStream(target);
InputStream in = connection.getInputStream();
int count;
int done = 0;
byte data[] = new byte[BUFFER_SIZE];
while ((count = in.read(data, 0, BUFFER_SIZE)) != -1) {
done += count;
handle.progress(done);
dest.write(data, 0, count);
}
dest.close();
in.close();
} finally {
handle.finish();
if (target.length() == 0) {
try {
target.delete();
} catch (Exception e) {
}
}
}
}