本文整理汇总了Java中org.netbeans.api.progress.ProgressHandle.setInitialDelay方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressHandle.setInitialDelay方法的具体用法?Java ProgressHandle.setInitialDelay怎么用?Java ProgressHandle.setInitialDelay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.progress.ProgressHandle
的用法示例。
在下文中一共展示了ProgressHandle.setInitialDelay方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createProgressHandle
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private ProgressHandle createProgressHandle(InputOutput inputOutput,
String displayName, Cancellable cancellable) {
if (!descriptor.showProgress() && !descriptor.showSuspended()) {
return null;
}
ProgressHandle handle = ProgressHandleFactory.createHandle(displayName,
cancellable, new ProgressAction(inputOutput));
handle.setInitialDelay(0);
handle.start();
handle.switchToIndeterminate();
if (descriptor.showSuspended()) {
handle.suspend(NbBundle.getMessage(ExecutionService.class, "Running"));
}
return handle;
}
示例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: getReferences
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
protected List getReferences() {
if (hasInstance()) {
ProgressHandle pHandle = null;
ChangeListener cl = null;
try {
pHandle = ProgressHandle.createHandle(Bundle.InstanceNode_References());
pHandle.setInitialDelay(200);
pHandle.start(HeapProgress.PROGRESS_MAX);
cl = setProgress(pHandle);
return getInstance().getReferences();
} finally {
if (pHandle != null) {
pHandle.finish();
}
if (cl != null) {
HeapProgress.getProgress().removeChangeListener(cl);
}
}
}
return Collections.EMPTY_LIST;
}
示例4: 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();
}
}
}
示例5: startProgress
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
protected void startProgress() {
getLogger().logCommandLine("==[IDE]== " + DateFormat.getDateTimeInstance().format(new Date()) + " " + runningName); // NOI18N
ProgressHandle progress = getProgressHandle();
progress.setInitialDelay(500);
progressStamp = System.currentTimeMillis() + 500;
progress.start();
}
示例6: export
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private static void export(final FileObject sourceFO, final File targetFile) {
final ProgressHandle progress = ProgressHandle.createHandle(
Bundle.ExportSnapshotAction_ProgressMsg());
progress.setInitialDelay(500);
RequestProcessor.getDefault().post(new Runnable() {
public void run() {
progress.start();
try {
if (targetFile.exists() && !targetFile.delete()) {
ProfilerDialogs.displayError(
Bundle.ExportSnapshotAction_CannotReplaceMsg(targetFile.getName()));
} else {
targetFile.toPath();
File targetParent = FileUtil.normalizeFile(targetFile.getParentFile());
FileObject targetFO = FileUtil.toFileObject(targetParent);
String targetName = targetFile.getName();
FileUtil.copyFile(sourceFO, targetFO, targetName, null);
}
} catch (Throwable t) {
ProfilerLogger.log("Failed to export NPSS snapshot: " + t.getMessage()); // NOI18N
String msg = t.getLocalizedMessage().replace("<", "<").replace(">", ">"); // NOI18N
ProfilerDialogs.displayError("<html><b>" + Bundle.ExportSnapshotAction_ExportFailedMsg() + // NOI18N
"</b><br><br>" + msg + "</html>"); // NOI18N
} finally {
progress.finish();
}
}
});
}
示例7: getContextSubclasses
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@NbBundle.Messages("ClassesListController_AnalyzingClassesMsg=Analyzing classes...")
private static Collection getContextSubclasses(Heap heap, String className, Lookup.Provider project) {
ProgressHandle pHandle = null;
try {
pHandle = ProgressHandle.createHandle(Bundle.ClassesListController_AnalyzingClassesMsg());
pHandle.setInitialDelay(0);
pHandle.start();
HashSet subclasses = new HashSet();
SourceClassInfo sci = ProfilerTypeUtils.resolveClass(className, project);
Collection<SourceClassInfo> impls = sci != null ? sci.getSubclasses() : Collections.EMPTY_LIST;
for (SourceClassInfo ci : impls) {
JavaClass jClass = heap.getJavaClassByName(ci.getQualifiedName());
if ((jClass != null) && subclasses.add(jClass)) { // instanceof approach rather than subclassof
subclasses.addAll(jClass.getSubClasses());
}
}
return subclasses;
} finally {
if (pHandle != null) {
pHandle.finish();
}
}
}
示例8: export
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
public String export(final String exportPath, final String hostOS, final String jvm) throws IOException {
if (impl == null) {
throw new IOException();
}
ProgressHandle ph = ProgressHandle.createHandle(
Bundle.RemotePackExporter_GeneratingRemotePack(impl.getRemotePackPath(exportPath, hostOS)));
ph.setInitialDelay(500);
ph.start();
try {
return impl.export(exportPath, hostOS, jvm);
} finally {
ph.finish();
}
}
示例9: createProgress
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private ProgressHandle createProgress() {
ProgressHandle ph = ProgressHandleFactory.createHandle(NbBundle.getMessage(TakeScreenshotActionProvider.class, "MSG_TakingApplicationScreenshot"));
ph.setInitialDelay(500);
ph.start();
return ph;
}
示例10: exportSnapshots
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
public void exportSnapshots(final FileObject[] selectedSnapshots) {
assert (selectedSnapshots != null);
assert (selectedSnapshots.length > 0);
final String[] fileName = new String[1], fileExt = new String[1];
final FileObject[] dir = new FileObject[1];
if (selectedSnapshots.length == 1) {
SelectedFile sf = selectSnapshotTargetFile(selectedSnapshots[0].getName(),
selectedSnapshots[0].getExt().equals(HEAPDUMP_EXTENSION));
if ((sf != null) && checkFileExists(sf)) {
fileName[0] = sf.fileName;
fileExt[0] = sf.fileExt;
dir[0] = sf.folder;
} else { // dialog cancelled by the user
return;
}
} else {
JFileChooser chooser = new JFileChooser();
if (exportDir != null) {
chooser.setCurrentDirectory(exportDir);
}
chooser.setDialogTitle(Bundle.ResultsManager_SelectDirDialogCaption());
chooser.setApproveButtonText(Bundle.ResultsManager_SaveButtonName());
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setMultiSelectionEnabled(false);
if (chooser.showSaveDialog(WindowManager.getDefault().getMainWindow()) == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
if (!file.exists()) {
if (!ProfilerDialogs.displayConfirmation(
Bundle.ResultsManager_DirectoryDoesntExistMsg(),
Bundle.ResultsManager_DirectoryDoesntExistCaption())) {
return; // cancelled by the user
}
file.mkdir();
}
exportDir = file;
dir[0] = FileUtil.toFileObject(FileUtil.normalizeFile(file));
} else { // dialog cancelled
return;
}
}
final ProgressHandle ph = ProgressHandle.createHandle(Bundle.MSG_SavingSnapshots());
ph.setInitialDelay(500);
ph.start();
ProfilerUtils.runInProfilerRequestProcessor(new Runnable() {
@Override
public void run() {
try {
for (int i = 0; i < selectedSnapshots.length; i++) {
exportSnapshot(selectedSnapshots[i], dir[0], fileName[0] != null ? fileName[0] : selectedSnapshots[i].getName(), fileExt[0] != null ? fileExt[0] : selectedSnapshots[i].getExt());
}
} finally {
ph.finish();
}
}
});
}
示例11: connectToStartedApp
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
/**
* Connects to an application started using the specified sessionSettings, and will start its profiling
* with the provided profilingSettings.
*
* @param profilingSettings Settings to use for profiling
* @param sessionSettings Session settings for profiling
* @param cancel shared cancel flag
* @return true if connected successfully, false otherwise
*/
public boolean connectToStartedApp(final ProfilingSettings profilingSettings, final SessionSettings sessionSettings, final AtomicBoolean cancel) {
profilingMode = MODE_PROFILE;
lastProfilingSettings = profilingSettings;
lastSessionSettings = sessionSettings;
lastMode = MODE_PROFILE;
ProgressHandle ph = ProgressHandle.createHandle(Bundle.NetBeansProfiler_StartingSession());
try {
ph.setInitialDelay(500);
ph.start();
if (getTargetAppRunner().targetJVMIsAlive()) {
getTargetAppRunner().terminateTargetJVM();
}
final ProfilerEngineSettings sSettings = getTargetAppRunner().getProfilerEngineSettings();
sessionSettings.applySettings(sSettings);
profilingSettings.applySettings(sSettings); // can override the session settings
sSettings.setInstrumentObjectInit(false); // clear instrument object.<init>
//sSettings.setRemoteHost(""); // NOI18N // clear remote profiling host
//getThreadsManager().setSupportsSleepingStateMonitoring(
// Platform.supportsThreadSleepingStateMonitoring(sharedSettings.getTargetJDKVersionString()));
logActionConfig("connectToStartedApp", profilingSettings, sessionSettings, null, sSettings.getInstrumentationFilter()); // NOI18N
if (prepareProfilingSession(profilingSettings, sessionSettings)) {
RequestProcessor.getDefault().post(new Runnable() {
@Override
public void run() {
// should propagate the result of the following operation somehow; current workflow doesn't allow it
if (tryInitiateSession(sessionSettings, cancel)) {
connectToApp();
}
}
});
return true;
}
return false;
} finally {
ph.finish();
}
}
示例12: reloadTask
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private Task reloadTask (final boolean force) {
final Runnable checkUpdates = new Runnable (){
@Override
public void run () {
ProgressHandle handle = ProgressHandleFactory.createHandle (NbBundle.getMessage (UnitTab.class, ("UnitTab_ReloadAction")));
JComponent progressComp = ProgressHandleFactory.createProgressComponent (handle);
JLabel detailLabel = new JLabel (NbBundle.getMessage (UnitTab.class, "UnitTab_PrepareReloadAction"));
manager.setProgressComponent (detailLabel, progressComp);
handle.setInitialDelay (0);
handle.start ();
manager.initTask.waitFinished ();
setWaitingState (true);
if (getDownloadSizeTask != null && ! getDownloadSizeTask.isFinished ()) {
if (getDownloadSizeTask.getDelay () > 0) {
getDownloadSizeTask.cancel ();
} else {
getDownloadSizeTask.waitFinished ();
}
}
final int row = getSelectedRow ();
final Map<String, Boolean> state = UnitCategoryTableModel.captureState (model.getUnits ());
if (model instanceof LocallyDownloadedTableModel) {
((LocallyDownloadedTableModel) model).removeInstalledUnits ();
((LocallyDownloadedTableModel) model).setUnits (null);
}
manager.unsetProgressComponent (detailLabel, progressComp);
Utilities.presentRefreshProviders (manager, force);
SwingUtilities.invokeLater (new Runnable () {
@Override
public void run () {
fireUpdataUnitChange ();
UnitCategoryTableModel.restoreState (model.getUnits (), state, model.isMarkedAsDefault ());
restoreSelectedRow (row);
refreshState ();
setWaitingState (false);
}
});
}
};
return Utilities.startAsWorkerThread (checkUpdates);
}
示例13: tryRefreshProviders
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private static boolean tryRefreshProviders (Collection<UpdateUnitProvider> providers, PluginManagerUI manager, boolean force) {
ProgressHandle handle = ProgressHandleFactory.createHandle (NbBundle.getMessage(SettingsTableModel.class, ("Utilities_CheckingForUpdates")));
JComponent progressComp = ProgressHandleFactory.createProgressComponent (handle);
JLabel detailLabel = ProgressHandleFactory.createDetailLabelComponent (handle);
detailLabel.setHorizontalAlignment (SwingConstants.LEFT);
try {
manager.setProgressComponent (detailLabel, progressComp);
handle.setInitialDelay (0);
handle.start ();
if (providers == null) {
providers = UpdateUnitProviderFactory.getDefault ().getUpdateUnitProviders (true);
}
for (UpdateUnitProvider p : providers) {
try {
p.refresh (handle, force);
showProviderNotification(p);
} catch (IOException ioe) {
logger.log (Level.INFO, ioe.getMessage (), ioe);
JButton cancel = new JButton ();
Mnemonics.setLocalizedText (cancel, getBundle ("Utilities_NetworkProblem_Cancel")); // NOI18N
JButton skip = new JButton ();
Mnemonics.setLocalizedText (skip, getBundle ("Utilities_NetworkProblem_Skip")); // NOI18N
skip.setEnabled (providers.size() > 1);
JButton tryAgain = new JButton ();
Mnemonics.setLocalizedText (tryAgain, getBundle ("Utilities_NetworkProblem_Continue")); // NOI18N
ProblemPanel problem = new ProblemPanel (
getBundle ("Utilities_NetworkProblem_Text", p.getDisplayName (), ioe.getLocalizedMessage ()), // NOI18N
new JButton [] { tryAgain, skip, cancel });
Object ret = problem.showNetworkProblemDialog ();
if (skip.equals (ret)) {
// skip UpdateUnitProvider and try next one
continue;
} else if (tryAgain.equals (ret)) {
// try again
return false;
}
return true;
}
}
} finally {
if (handle != null) {
handle.finish ();
}
// XXX: Avoid NPE when called refresh providers on selected units
// #101836: OperationContainer.contains() sometimes fails
Containers.initNotify ();
manager.unsetProgressComponent (detailLabel, progressComp);
}
return true;
}
示例14: install
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@NbBundle.Messages({
"# {0} - module name",
"# {1} - module version",
"MSG_Installing=Installing {0}@{1}",
"# {0} - paterns",
"MSG_InstallNoMatch=Cannot install. No match for {0}."
})
private void install(final Env env, String... pattern) throws CommandException {
if (! initialized()) {
refresh(env);
}
Pattern[] pats = findMatcher(env, pattern);
List<UpdateUnit> units = UpdateManager.getDefault().getUpdateUnits();
OperationContainer<InstallSupport> operate = OperationContainer.createForInstall();
for (UpdateUnit uu : units) {
if (uu.getInstalled() != null) {
continue;
}
if (!matches(uu.getCodeName(), pats)) {
continue;
}
if (uu.getAvailableUpdates().isEmpty()) {
continue;
}
UpdateElement ue = uu.getAvailableUpdates().get(0);
env.getOutputStream().println(
Bundle.MSG_Installing(uu.getCodeName(), ue.getSpecificationVersion()));
operate.add(ue);
}
final InstallSupport support = operate.getSupport();
if (support == null) {
env.getOutputStream().println(Bundle.MSG_InstallNoMatch(Arrays.asList(pats)));
return;
}
try {
env.getOutputStream().println("modules=" + operate.listAll().size()); // NOI18N
ProgressHandle downloadHandle = new CLIInternalHandle("downloading-modules", env).createProgressHandle(); // NOI18N
downloadHandle.setInitialDelay(0);
final Validator res1 = support.doDownload(downloadHandle, null, false);
Installer res2 = support.doValidate(res1, null);
ProgressHandle installHandle = new CLIInternalHandle("installing-modules", env).createProgressHandle(); // NOI18N
installHandle.setInitialDelay(0);
Restarter res3 = support.doInstall(res2, installHandle);
if (res3 != null) {
support.doRestart(res3, null);
}
} catch (OperationException ex) {
// a hack
if (OperationException.ERROR_TYPE.INSTALL.equals(ex.getErrorType())) {
// probably timeout of loading
env.getErrorStream().println(ex.getLocalizedMessage());
throw (CommandException) new CommandException(34, ex.getMessage()).initCause(ex);
} else {
try {
support.doCancel();
throw (CommandException) new CommandException(32, ex.getMessage()).initCause(ex);
} catch (OperationException ex1) {
throw (CommandException) new CommandException(32, ex1.getMessage()).initCause(ex1);
}
}
}
}