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


Java ProgressHandle.createHandle方法代码示例

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


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

示例1: performAction

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
protected final void performAction(Node[] activatedNodes) {
    for (final Node node : activatedNodes) {
        final StatefulDockerContainer container = node.getLookup().lookup(StatefulDockerContainer.class);
        if (container != null) {
            final ProgressHandle handle = ProgressHandle.createHandle(getProgressMessage(container.getContainer()));
            handle.start();
            Runnable task = new Runnable() {
                @Override
                public void run() {
                    try {
                        performAction(container.getContainer());
                    } catch (Exception ex) {
                        handleException(ex);
                    } finally {
                        handle.finish();
                    }
                }
            };
            requestProcessor.post(task);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:AbstractContainerAction.java

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

示例3: installUpdate

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private static InstallationResult installUpdate(@NonNull final UpdateElement update) {
    final ProgressHandle installHandle = ProgressHandle.createHandle(NbBundle.getMessage(
            MissingModuleProblemsProvider.class,
            "TXT_InstallModule",
            update.getDisplayName()));
    installHandle.start();
    try {
        final OperationContainer<InstallSupport> container = OperationContainer.createForInstall();
        container.add(Collections.singleton(update));
        final InstallSupport support = container.getSupport();
        try {
            final InstallSupport.Validator v = support.doDownload(installHandle, true, true);
            final InstallSupport.Installer i = support.doValidate(v, installHandle);
            final Restarter r = support.doInstall(i, installHandle);
            return InstallationResult.success(support, r);
        } catch (OperationException ex) {
            Exceptions.printStackTrace(ex);
        }
    } finally {
        installHandle.finish();
    }
    return InstallationResult.failure();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:MissingModuleProblemsProvider.java

示例4: 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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:InstanceNode.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: scanningStarted

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Messages({
    "# {0} - repo name", "LBL_indexing_repo=Indexing Maven repository: {0}",
    "LBL_findIndexableDirs=Counting indexable directories..."
})
@Override public void scanningStarted(IndexingContext ctx) {
    if (handle != null) {
        handle.finish();
    }
    expectedDirs.clear();
    encounteredDirs.clear();
    handle = ProgressHandle.createHandle(Bundle.LBL_indexing_repo(ri != null ? ri.getName() : indexingContext.getId()), this);
    handle.start();
    handle.progress(Bundle.LBL_findIndexableDirs());
    findIndexableDirs(ctx.getRepository());
    handle.switchToDeterminate(expectedDirs.size());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:RepositoryIndexerListener.java

示例7: openStream

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
/**
 * Like {@link URL#openStream} but uses the platform's user JAR cache ({@code ArchiveURLMapper}) when available.
 * @param url a url to open
 * @return its input stream
 * @throws IOException for the usual reasons
 */
@NonNull
private static InputStream openStream(@NonNull final URL url, @NullAllowed final String message) throws IOException {
    ProgressHandle progress = null;
    if (message != null) {
        progress = ProgressHandle.createHandle(message);
        progress.start();
    }
    try {
        if (url.getProtocol().equals("jar")) { // NOI18N
            FileObject f = URLMapper.findFileObject(url);
            if (f != null) {
                return f.getInputStream();
            }
        }
        if (isRemote(url)) {
            LOG.log(Level.FINE, "opening network stream: {0}", url);
        }
        final URLConnection c = url.openConnection();
        c.setConnectTimeout(REMOTE_CONNECTION_TIMEOUT);
        return c.getInputStream();
    } finally {
        if (progress != null) {
            progress.finish();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:JavadocHelper.java

示例8: performAction

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@NbBundle.Messages({
    "# {0} - image id",
    "MSG_RemovingTag=Removing image {0}"
})
@Override
protected void performAction(Node[] activatedNodes) {
    for (final Node node : activatedNodes) {
        final DockerTag tag = node.getLookup().lookup(DockerTag.class);
        if (tag != null) {
            final ProgressHandle handle = ProgressHandle.createHandle(Bundle.MSG_RemovingTag(tag.getShortId()));
            handle.start();
            Runnable task = new Runnable() {
                @Override
                public void run() {
                    try {
                        DockerInstance instance = tag.getImage().getInstance();
                        DockerAction facade = new DockerAction(instance);
                        facade.remove(tag);
                    } catch (Exception ex) {
                        // FIXME offer force remove ?
                        LOGGER.log(Level.INFO, null, ex);
                        String msg = ex.getLocalizedMessage();
                        NotifyDescriptor desc = new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE);
                        DialogDisplayer.getDefault().notify(desc);
                    } finally {
                        handle.finish();
                    }
                }
            };
            requestProcessor.post(task);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:RemoveTagAction.java

示例9: 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("<", "&lt;").replace(">", "&gt;"); // NOI18N
                ProfilerDialogs.displayError("<html><b>" + Bundle.ExportSnapshotAction_ExportFailedMsg() + // NOI18N
                                                           "</b><br><br>" + msg + "</html>"); // NOI18N
            } finally {
                progress.finish();
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:ExportSnapshotAction.java

示例10: computeRetainedSizes

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
public final int computeRetainedSizes(boolean masterAction, boolean interactive) {
    
    synchronized(this) {
       if (retainedSizesStatus == RETAINED_SIZES_UNSUPPORTED ||
           retainedSizesStatus == RETAINED_SIZES_COMPUTED)
           return retainedSizesStatus;
    }

    if (interactive && !ProfilerDialogs.displayConfirmationDNSA(
            Bundle.HeapFragmentWalker_ComputeRetainedMsg(), 
            Bundle.HeapFragmentWalker_ComputeRetainedCaption(),
            null, "HeapFragmentWalker.computeRetainedSizes", false)) { //NOI18N
        return changeState(RETAINED_SIZES_CANCELLED, masterAction);
    } else {
        changeState(RETAINED_SIZES_COMPUTING, masterAction);
        List<JavaClass> classes = heapFragment.getAllClasses();
        if (classes.size() > 0) {
            ProgressHandle pd = interactive ? ProgressHandle.createHandle(Bundle.HeapFragmentWalker_ComputingRetainedMsg()) : null;
            if (pd != null) {
                pd.start();
            }
            classes.get(0).getRetainedSizeByClass();
            if (pd != null) pd.finish();
        }
        
        return changeState(RETAINED_SIZES_COMPUTED, masterAction);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:HeapFragmentWalker.java

示例11: 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();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:ClassesListController.java

示例12: 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();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:RemotePackExporter.java

示例13: 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();
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:66,代码来源:ResultsManager.java

示例14: 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();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:57,代码来源:NetBeansProfiler.java

示例15: updateProgress

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private void updateProgress() {
    boolean display = profiler.getProfilingState() != Profiler.PROFILING_INACTIVE &&
                      profiler.getServerState() != CommonConstants.SERVER_RUNNING;
    if (display) {
        int serverProgress = profiler.getServerProgress();
        int serverState = profiler.getServerState();
        if (progressHandle == null) {
            progressHandle = ProgressHandle.createHandle(Bundle.ServerStateMonitor_ProfilerBusy());
            if (serverProgress == CommonConstants.SERVER_PROGRESS_INDETERMINATE) {
                progressHandle.start();
            } else {
                progressHandle.start(CommonConstants.SERVER_PROGRESS_WORKUNITS);
            }
            activeServerState = -1;
            activeServerProgress = serverProgress;
        }
        if (serverProgress != activeServerProgress) {
            if (activeServerProgress == CommonConstants.SERVER_PROGRESS_INDETERMINATE) {
                progressHandle.switchToDeterminate(CommonConstants.SERVER_PROGRESS_WORKUNITS);
                progressHandle.progress(serverProgress);
                activeServerProgressValue = serverProgress;
            } else if (serverProgress == CommonConstants.SERVER_PROGRESS_INDETERMINATE) {
                progressHandle.switchToIndeterminate();
            } else {
                if (serverProgress > activeServerProgressValue) {
                    progressHandle.progress(serverProgress);
                    activeServerProgressValue = serverProgress;
                }
            }
            activeServerProgress = serverProgress;
        }

        if (serverState != activeServerState) {
            activeServerState = serverState;
            switch (activeServerState) {
                case CommonConstants.SERVER_INITIALIZING:
                    progressHandle.progress(Bundle.ServerStateMonitor_ServerInitializing());
                    break;
                case CommonConstants.SERVER_INSTRUMENTING:
                    progressHandle.progress(Bundle.ServerStateMonitor_ServerInstrumenting());
                    break;
                case CommonConstants.SERVER_PREPARING:
                    progressHandle.progress(Bundle.ServerStateMonitor_ServerPreparing());
                    break;
                default:
                    progressHandle.progress(""); // NOI18N
                    break;
            }
        }
    } else {
        closeProgress();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:54,代码来源:ServerStateMonitor.java


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