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


Java ProgressHandleFactory.createHandle方法代码示例

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


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

示例1: testMainProjectFlagNotMovedWhenCopying

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的package包/类
public void testMainProjectFlagNotMovedWhenCopying() throws Exception {
    OpenProjects.getDefault().close(OpenProjects.getDefault().getOpenProjects());
    OpenProjects.getDefault().open(new Project[] {prj}, false);
    
    //set the project to be copied as main.
    OpenProjects.getDefault().setMainProject(prj);       
    assertTrue(prj.getProjectDirectory().equals(OpenProjects.getDefault().getMainProject().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.doCopyProject(handle, prj, "projCopy", newTarget);
    
    //test that after copying the main project is still the original one.
    Project main = OpenProjects.getDefault().getMainProject();
    assertTrue(main != null && main.getProjectDirectory().equals(prj.getProjectDirectory()));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:DefaultProjectOperationsImplementationTest.java

示例2: ProgressPanel

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的package包/类
/** Creates new form ProgressPanel */
public ProgressPanel() {
    initComponents();
    handle = ProgressHandleFactory.createHandle(
            NbBundle.getMessage(ImportProjectAction.class, "CTL_ProgressDialogTitle")); // NOI18N
    progress = ProgressHandleFactory.createProgressComponent(handle);
    setLayout(new GridBagLayout());
    setPreferredSize(new Dimension(450, 80));
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new Insets(0, 5, 0, 5);
    add(progress, gridBagConstraints);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ProgressPanel.java

示例3: LoadOpenProjects

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的package包/类
@Messages("CAP_Opening_Projects=Opening Projects")
@SuppressWarnings("LeakingThisInConstructor")
public LoadOpenProjects(int a) {
    action = a;
    currentFiles = Utilities.actionsGlobalContext().lookupResult(FileObject.class);
    currentFiles.addLookupListener(WeakListeners.create(LookupListener.class, this, currentFiles));
    progress = ProgressHandleFactory.createHandle(CAP_Opening_Projects());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:OpenProjectList.java

示例4: readFromDataModel

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的package包/类
@NbBundle.Messages({
    "MSG_LaunchingApplication=Launching your application"
})
@Override
protected void readFromDataModel() {
    checkValidity();
    if (task == null) {
        try {
            task = DesignSupport.invokeDesignMode(data.getProject(), userDir, false, !data.isIgnorePreviousRun());
        } catch (IOException ex) {
            setError(ex.getMessage());
        }
        if(task != null) {
            handle = ProgressHandleFactory.createHandle(Bundle.MSG_LaunchingApplication());
            JComponent pc = ProgressHandleFactory.createProgressComponent(handle);
            JLabel ml = ProgressHandleFactory.createMainLabelComponent(handle);

            progress.add(ml);
            progress.add(pc);

            handle.start();
            markInvalid();
            /* XXX what was the purpose of this? cannot do it now, we are in EQ
            try {
                DesignSupport.existingModes(data);
            } catch (IOException ex) {
                Exceptions.printStackTrace(ex);
            }
            */
            task.addTaskListener(this);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:LayoutLaunchingPanel.java

示例5: findAndRunAction

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:RecentSearches.java

示例6: waitStart

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的package包/类
private boolean waitStart(final ExecSupport execSupport, int waitTime) {
    boolean started = false;
    final Holder<Boolean> forceExit = new Holder<>(false);
    String waitMessage = NbBundle.getMessage(RegisterDerby.class, "MSG_StartingDerby");
    ProgressHandle progress = ProgressHandleFactory.createHandle(waitMessage, new Cancellable() {
        @Override
        public boolean cancel() {
            forceExit.value = true;
            return execSupport.interruptWaiting();
        }
    });
    progress.start();
    try {
        while (!started) {
            started = execSupport.waitForMessage(waitTime * 1000);
            if (!started) {
                if (waitTime > 0 && (!forceExit.value)) {
                    String title = NbBundle.getMessage(RegisterDerby.class, "LBL_DerbyDatabase");
                    String message = NbBundle.getMessage(RegisterDerby.class, "MSG_WaitStart", waitTime);
                    NotifyDescriptor waitConfirmation = new NotifyDescriptor.Confirmation(message, title, NotifyDescriptor.YES_NO_OPTION);
                    if (DialogDisplayer.getDefault().notify(waitConfirmation)
                            != NotifyDescriptor.YES_OPTION) {
                        break;
                    }
                } else {
                    break;
                }
            }
        }
        if (!started) {
            execSupport.terminate();
            LOGGER.log(Level.WARNING, "Derby server failed to start"); // NOI18N
        }
    } finally {
        progress.finish();
    }
    return started;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:RegisterDerby.java

示例7: getProgressHandle

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的package包/类
protected ProgressHandle getProgressHandle () {
    if (progressHandle == null) {
        Action openAction = getLogger().getOpenOutputAction();
        if (openAction == null) {
            progressHandle = ProgressHandleFactory.createHandle(displayName, this);
        } else {
            progressHandle = ProgressHandleFactory.createHandle(displayName, this, openAction);
        }
    }
    return progressHandle;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:GitProgressSupport.java

示例8: runHQLButtonActionPerformed

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的package包/类
private void runHQLButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runHQLButtonActionPerformed
// Fix - 138856
if(hqlEditor.getText().trim().equals("")) {
    switchToResultView();
    setStatus(NbBundle.getMessage(HQLEditorTopComponent.class, "emptyQuery"));
    return;
}
if (hibernateConfigurationComboBox.getSelectedItem() == null) {
    logger.info("hibernate configuration combo box is empty.");
    switchToResultView();
    setStatus(NbBundle.getMessage(HQLEditorTopComponent.class, "emptyConfiguration"));
    return;
}
runHQLButton.setEnabled(false);                                            
try {
    ph = ProgressHandleFactory.createHandle(//GEN-HEADEREND:event_runHQLButtonActionPerformed
            NbBundle.getMessage(HQLEditorTopComponent.class, "progressTaskname"));//GEN-LAST:event_runHQLButtonActionPerformed
        FileObject selectedConfigFile = (FileObject) hibernateConfigMap.get(hibernateConfigurationComboBox.getSelectedItem());
        ph.start(100);
        controller.executeHQLQuery(hqlEditor.getText(),
                selectedConfigFile,
                getMaxRowCount(),
                ph);
    } catch (Exception ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:HQLEditorTopComponent.java

示例9: getProgressHandle

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的package包/类
protected ProgressHandle getProgressHandle() {
    if(progressHandle == null) {
        if(repositoryRoot != null) {
            progressHandle = ProgressHandleFactory.createHandle(displayName, this, getLogger().getOpenOutputAction());
        } else {
            progressHandle = ProgressHandleFactory.createHandle(displayName, this);
        }
    }
    return progressHandle;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:SvnProgressSupport.java

示例10: testCopyWithLib

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的package包/类
public void testCopyWithLib() throws Exception {
    TestUtil.createFileFromContent(DefaultProjectOperationsImplementationTest.class.getResource("data/test.txt"), projdir, "lib/test.txt");
    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());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:DefaultProjectOperationsImplementationTest.java

示例11: invokeHandlers

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的package包/类
private void invokeHandlers(final List/*<Handler>*/ handlers, final Parameters params) {
    final ProgressPanel progressPanel = new ProgressPanel();
    
    ProgressHandle progressHandle = ProgressHandleFactory.createHandle(null);
    JComponent progressComponent = ProgressHandleFactory.createProgressComponent(progressHandle);
    
    progressHandle.start();
    progressHandle.switchToIndeterminate();
    
    final int[] index = new int[1];
    
    try {
        RequestProcessor.Task task = RequestProcessor.getDefault().create(new Runnable() {
            public void run() {
                index[0] = invokeHandlers(handlers, index[0], params, progressPanel);
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        progressPanel.close();
                    }
                });
            }
        });
        
        while (index[0] < handlers.size()) {
            index[0] = invokeHandlers(handlers, index[0], params, null);
            if (index[0] < handlers.size()) {
                task.schedule(0);
                progressPanel.open(progressComponent);
            }
        }
    } finally {
        progressHandle.finish();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:DBSchemaTablesPanel.java

示例12: actionPerformed

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的package包/类
@Messages({
    "ResumeAction_scanning=Searching for faulty module",
    "ResumeAction_could_not_find_module=Could not determine module from which to resume build."
})
@Override public void actionPerformed(ActionEvent e) {
    final Project p = config.getProject();
    if (p == null) {
        setFinder(null);
        StatusDisplayer.getDefault().setStatusText(ResumeAction_could_not_find_module());
        return;
    }
    final AtomicReference<Thread> t = new AtomicReference<Thread>();
    final ProgressHandle handle = ProgressHandleFactory.createHandle(ResumeAction_scanning(), new Cancellable() {
        @Override public boolean cancel() {
            Thread _t = t.get();
            if (_t != null) {
                _t.interrupt();
                return true;
            } else {
                return false;
            }
        }
    });
    RP.post(new Runnable() {
        @Override public void run() {
            t.set(Thread.currentThread());
            handle.start();
            NbMavenProject nbmp;
            try {
                nbmp = finder.find(p);
            } finally {
                handle.finish();
            }
            t.set(null);
            if (nbmp == null || NbMavenProject.isErrorPlaceholder(nbmp.getMavenProject())) {
                setFinder(null);
                StatusDisplayer.getDefault().setStatusText(ResumeAction_could_not_find_module());
                return;
            }
            File root = config.getExecutionDirectory();
            File module = nbmp.getMavenProject().getBasedir();
            String rel = root != null && module != null ? FileUtilities.relativizeFile(root, module) : null;
            String id = rel != null ? rel : nbmp.getMavenProject().getGroupId() + ':' + nbmp.getMavenProject().getArtifactId();
            BeanRunConfig newConfig = new BeanRunConfig(config);
            List<String> goals = new ArrayList<String>(config.getGoals());
            int rf = goals.indexOf("--resume-from");
            if (rf != -1) {
                goals.set(rf + 1, id);
            } else {
                goals.add(0, "--resume-from");
                goals.add(1, id);
            }
            newConfig.setGoals(goals);
            RunUtils.executeMaven(newConfig);
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:58,代码来源:AbstractMavenExecutor.java

示例13: getProgressHandle

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的package包/类
protected ProgressHandle getProgressHandle() {
    if(progressHandle==null) {
        progressHandle = ProgressHandleFactory.createHandle(displayName, this,  getLogger().getOpenOutputAction());
    }
    return progressHandle;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:HgProgressSupport.java

示例14: show

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的package包/类
void show () {
    String name = className.replace('.', '/');
    final List<String> resources = new ArrayList<>();
    resources.add(name + ".java"); //NOI18N
    int idx = name.lastIndexOf('$');
    while (idx >= 0) {
        name = name.substring(0, idx);
        resources.add(name + ".java"); //NOI18N
        idx = name.lastIndexOf('$');
    }
    final ProgressHandle handle = ProgressHandleFactory.createHandle(
        NbBundle.getMessage(StackLineAnalyser.class, "TXT_OpeningSource", resources.get(0)));
    handle.start();
    RP.execute(
        new Runnable() {
            @Override
            public void run() {
                DataObject dobj = null;
                try {
                    final ClassPath classPath = ClassPathSupport.createClassPath(
                    GlobalPathRegistry.getDefault().getSourceRoots().toArray(new FileObject[0]));
                    for (String resource : resources) {
                        dobj = findDataObject(classPath.findResource(resource));
                        if (dobj != null)
                            break;
                    }
                } finally {
                    final DataObject dataObject = dobj;
                    Mutex.EVENT.readAccess(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                if (dataObject == null) {
                                    StatusDisplayer.getDefault().setStatusText(
                                    NbBundle.getMessage(StackLineAnalyser.class,
                                    "AnalyzeStackTopComponent.sourceNotFound",
                                    new Object[]{resources.get(0)}));
                                    return;
                                }
                                try {
                                    EditorCookie editorCookie = (EditorCookie) dataObject.getCookie(EditorCookie.class);
                                    LineCookie lineCookie = (LineCookie) dataObject.getCookie(LineCookie.class);
                                    if (editorCookie != null && lineCookie != null && lineNumber != -1) {
                                        StyledDocument doc = editorCookie.openDocument();
                                        if (doc != null) {
                                            if (lineNumber != -1) {
                                                try {
                                                    Line l = lineCookie.getLineSet().getCurrent(lineNumber - 1);

                                                    if (l != null) {
                                                        l.show(Line.SHOW_GOTO);
                                                        return;
                                                    }
                                                } catch (IndexOutOfBoundsException oob) {
                                                    //line number is no more valid, do not report as an error
                                                    StatusDisplayer.getDefault().setStatusText(
                                                    NbBundle.getMessage(StackLineAnalyser.class,
                                                    "AnalyzeStackTopComponent.lineNotFound",
                                                    new Object[]{lineNumber}));
                                                }
                                            }
                                        }
                                    }
                                    OpenCookie openCookie = (OpenCookie) dataObject.getCookie(OpenCookie.class);
                                    if (openCookie != null) {
                                        openCookie.open();
                                        return;
                                    }
                                } catch (IOException e) {
                                    Exceptions.printStackTrace(e);
                                }
                            } finally {
                                handle.finish();
                            }
                        }
                    });
                }
            }
        });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:81,代码来源:StackLineAnalyser.java

示例15: reloadTask

import org.netbeans.api.progress.ProgressHandleFactory; //导入方法依赖的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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:42,代码来源:UnitTab.java


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