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


Java ProgressUtils.runOffEventDispatchThread方法代码示例

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


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

示例1: open

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
/**
 * Opens given {@link TreePathHandle}.
 * @param toSearch the {@link FileObject} used to resolve the {@link TreePathHandle} in
 * @param toOpen   {@link TreePathHandle} of the {@link Tree} which should be opened.
 * @return true if and only if the declaration was correctly opened,
 *                false otherwise
 * @since 1.45
 */
public static boolean open(
        @NonNull final FileObject toSearch,
        @NonNull final TreePathHandle toOpen) {
    final AtomicBoolean cancel = new AtomicBoolean();
    if (SwingUtilities.isEventDispatchThread() && !JavaSourceAccessor.holdsParserLock()) {
        final boolean[] result = new boolean[1];
        ProgressUtils.runOffEventDispatchThread(new Runnable() {
                public void run() {
                    result[0] = open(toSearch, toOpen, cancel);
                }
            },
            NbBundle.getMessage(ElementOpen.class, "TXT_CalculatingDeclPos"),
            cancel,
            false);
        return result[0];
    } else {
        return open(toSearch, toOpen, cancel);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:ElementOpen.java

示例2: showCustomizer

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@Messages({
    "PROGRESS_loading_data=Loading project information",
    "# {0} - project display name", "LBL_CustomizerTitle=Project Properties - {0}"
})
public void showCustomizer(String preselectedCategory, final String preselectedSubCategory) {
    if (dialog != null) {
        dialog.setVisible(true);
    } else {
        final String category = (preselectedCategory != null) ? preselectedCategory : lastSelectedCategory;
        final AtomicReference<Lookup> context = new AtomicReference<Lookup>();
        ProgressUtils.runOffEventDispatchThread(new Runnable() {
            @Override public void run() {
                context.set(new ProxyLookup(prepareData(), Lookups.fixed(new SubCategoryProvider(category, preselectedSubCategory))));
            }
        }, PROGRESS_loading_data(), /* currently unused */new AtomicBoolean(), false);
        if (context.get() == null) { // canceled
            return;
        }
        OptionListener listener = new OptionListener();
        dialog = ProjectCustomizer.createCustomizerDialog(layerPath, context.get(), category, listener, null);
        dialog.addWindowListener(listener);
        dialog.setTitle(LBL_CustomizerTitle(ProjectUtils.getInformation(getProject()).getDisplayName()));
        dialog.setVisible(true);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:BasicCustomizer.java

示例3: findAndOpenJavaClass

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@NbBundle.Messages("JavaUtils.title.class.searching=Searching Class...")
public static void findAndOpenJavaClass(final String classBinaryName, FileObject fileObject) {
    if (classBinaryName == null || fileObject == null) {
        return;
    }

    final JavaSource js = JavaUtils.getJavaSource(fileObject);
    if (js != null) {
        final AtomicBoolean cancel = new AtomicBoolean(false);
        final ClassFinder classFinder = new ClassFinder(js, classBinaryName, cancel);
        if (SourceUtils.isScanInProgress()) {
            ScanDialog.runWhenScanFinished(new Runnable() {
                @Override
                public void run() {
                    ProgressUtils.runOffEventDispatchThread(classFinder, Bundle.JavaUtils_title_class_searching(), cancel, false);
                }
            }, Bundle.JavaUtils_title_class_searching());
        } else {
            ProgressUtils.runOffEventDispatchThread(classFinder, Bundle.JavaUtils_title_class_searching(), cancel, false);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:JavaUtils.java

示例4: propertyChange

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@NbBundle.Messages({"Loading_HelpCtx_Lengthy_Operation=Please wait while help context is being loaded."})
@Override
public void propertyChange (PropertyChangeEvent ev) {
    if (ev.getPropertyName ().equals ("buran" + OptionsPanelController.PROP_HELP_CTX)) {               //NOI18N
        AtomicBoolean helpCtxLoadingCancelled = new AtomicBoolean(false);
        ProgressUtils.runOffEventDispatchThread(new Runnable() {
            @Override
            public void run() {
                helpCtx = optionsPanel.getHelpCtx();
            }
        }, Bundle.Loading_HelpCtx_Lengthy_Operation(), helpCtxLoadingCancelled, false, 50, 5000);
        if(helpCtxLoadingCancelled.get()) {
            log.fine("Options Dialog - HelpCtx loading cancelled by user."); //NOI18N
        }
        descriptor.setHelpCtx(helpCtx);
    } else if (ev.getPropertyName ().equals ("buran" + OptionsPanelController.PROP_VALID)) {                  //NOI18N            
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                bOK.setEnabled(optionsPanel.dataValid());
                bAPPLY.setEnabled(optionsPanel.isChanged() && optionsPanel.dataValid());
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:OptionsDisplayerImpl.java

示例5: actionPerformed

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent evt, final JTextComponent target) {
    final JavaSource js = JavaSource.forDocument(target.getDocument());
    
    if (js == null) {
        StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(GoToSupport.class, "WARN_CannotGoToGeneric",1));
        return;
    }
    
    final int caretPos = target.getCaretPosition();
    final AtomicBoolean cancel = new AtomicBoolean();
    
    ProgressUtils.runOffEventDispatchThread(new Runnable() {
        @Override
        public void run() {
            goToImpl(target, js, caretPos, cancel);
        }
    }, NbBundle.getMessage(JavaKit.class, "goto-super-implementation"), cancel, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:GoToSuperTypeAction.java

示例6: findLocalFile

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
public static File findLocalFile(String productName, boolean runOffEDT, boolean showError) {
    File productFile;

    if (runOffEDT) {
        AtomicReference<File> returnValue = new AtomicReference<>();
        Runnable operation = () -> returnValue.set(findLocalFile(productName));
        ProgressUtils.runOffEventDispatchThread(operation, "Find Local Product", new AtomicBoolean(), false, 50, 1000);
        productFile = returnValue.get();
    } else {
        productFile = findLocalFile(productName);
    }

    if (productFile == null && showError) {
        Dialogs.showError(String.format("A product named '%s'\n" +
                                                    "couldn't be found in any of your local search paths.\n" +
                                                    "(See tab 'ESA PFA' in the Tools / Options dialog.)", productName));
        return null;
    }

    return productFile;
}
 
开发者ID:bcdev,项目名称:esa-pfa,代码行数:22,代码来源:ProductAccessUtils.java

示例7: openProduct

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
public static Product openProduct(final File productFile) {

        Product product = ProductAccessUtils.findOpenedProduct(productFile);
        if (product != null) {
            return product;
        }

        AtomicReference<Product> returnValue = new AtomicReference<>();
        Runnable operation = () -> {
            try {
                returnValue.set(ProductIO.readProduct(productFile));
            } catch (IOException e) {
                SystemUtils.LOG.log(Level.SEVERE, "Failed to open product.", e);
                Dialogs.showError("Failed to open product.");
            }
        };
        ProgressUtils.runOffEventDispatchThread(operation, "Open Product", new AtomicBoolean(), false, 100, 2000);

        return returnValue.get();
    }
 
开发者ID:bcdev,项目名称:esa-pfa,代码行数:21,代码来源:OpenProductAction.java

示例8: performGoTo

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
private static void performGoTo(final Document doc, final int offset, final boolean goToSource, final boolean javadoc) {
    final AtomicBoolean cancel = new AtomicBoolean();
    ProgressUtils.runOffEventDispatchThread(new Runnable() {
        @Override
        public void run() {
            performGoToImpl(doc, offset, goToSource, javadoc, cancel);
        }
    }, NbBundle.getMessage(GoToSupport.class, javadoc ? "LBL_GoToJavadoc" : goToSource ? "LBL_GoToSource" : "LBL_GoToDeclaration"), cancel, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:GoToSupport.java

示例9: addLibraryToProject

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
/**
 * add library to the project to specified classpath
 * Method is called off of AWT thread
 * @param project
 * @param library
 * @param classpathType
 */
public static void addLibraryToProject(Project project, Library library, String classpathType) {
    if(SwingUtilities.isEventDispatchThread()){
        AtomicBoolean cancel = new AtomicBoolean();
        ProgressUtils.runOffEventDispatchThread( new AddLibrary(project, library, classpathType), 
               NbBundle.getMessage(Util.class, 
             "TTL_ExtendProjectClasspath"), cancel, false );  // NOI18N
    } else {
        addLibraryToProject0(project, library, classpathType);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:Util.java

示例10: performClickAction

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@Override
public void performClickAction(final Document doc, final int offset, HyperlinkType type) {
    final AtomicBoolean cancel = new AtomicBoolean();
    ProgressUtils.runOffEventDispatchThread(new Runnable() {
        @Override
        public void run() {
            goToNQ(doc, offset);
        }
    }, NbBundle.getMessage(NamedQueryHyperlinkProvider.class, "LBL_GoToNamedQuery"), cancel, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:NamedQueryHyperlinkProvider.java

示例11: computeOffAWT

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
public static <T> T computeOffAWT(Worker<T> w, String featureName, final JavaSource source, Phase phase) {
    AtomicBoolean cancel = new AtomicBoolean();
    Compute<T> c = new Compute(cancel, source, phase, w);

    ProgressUtils.runOffEventDispatchThread(c, featureName, cancel, false);

    return c.result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ComputeOffAWT.java

示例12: showCustomizer

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@Messages({
    "PROGRESS_checking_for_upgrade=Checking for old harnesses to upgrade",
    "CTL_Close=&Close",
    "CTL_NbPlatformManager_Title=NetBeans Platform Manager"
})
public static Object showCustomizer() {
    final AtomicBoolean canceled = new AtomicBoolean();
    ProgressUtils.runOffEventDispatchThread(new Runnable() { // #207451
        @Override public void run() {
            HarnessUpgrader.checkForUpgrade();
        }
    }, PROGRESS_checking_for_upgrade(), canceled, false);
    NbPlatformCustomizer customizer = new NbPlatformCustomizer();
    JButton closeButton = new JButton();
    Mnemonics.setLocalizedText(closeButton, CTL_Close());
    DialogDescriptor descriptor = new DialogDescriptor(
            customizer,
            CTL_NbPlatformManager_Title(),
            true,
            new Object[] {closeButton},
            closeButton,
            DialogDescriptor.DEFAULT_ALIGN,
            new HelpCtx("org.netbeans.modules.apisupport.project.ui.platform.NbPlatformCustomizer"),
            null);
    Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
    dlg.setVisible(true);
    dlg.dispose();
    return customizer.getSelectedNbPlatform();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:NbPlatformCustomizer.java

示例13: actionPerformed

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@Override
@NbBundle.Messages({
    "MSG_GitAction.savingFiles.progress=Preparing Git action"
})
public void actionPerformed (ActionEvent e) {
    final AbstractMap.SimpleImmutableEntry<File, File[]> roots = GitUtils.getActionRoots(ctx);
    if (roots != null) {
        final File root = roots.getKey();
        final AtomicBoolean canceled = new AtomicBoolean(false);
        Runnable run = new Runnable() {

            @Override
            public void run () {
                LifecycleManager.getDefault().saveAll();
                Utils.logVCSActionEvent("Git"); //NOI18N
                if (!canceled.get()) {
                    EventQueue.invokeLater(new Runnable() {

                        @Override
                        public void run () {
                            SystemAction.get(SwitchBranchAction.class).checkoutRevision(root, branchName, null,
                                    Bundle.SwitchBranchAction_KnownBranchAction_progress(branchName));
                        }
                    });
                }
            }
        };
        ProgressUtils.runOffEventDispatchThread(run, Bundle.MSG_GitAction_savingFiles_progress(), canceled, false);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:SwitchBranchAction.java

示例14: performGoTo

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
public static void performGoTo(final Document doc, final int offset) {
    final AtomicBoolean cancel = new AtomicBoolean();
    String name = NbBundle.getMessage(GoToSupport.class, "NM_GoToDeclaration");

    ProgressUtils.runOffEventDispatchThread(new Runnable() {

        public void run() {
            perform(doc, offset, false, cancel);
        }
    }, name, cancel, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:GoToSupport.java

示例15: goToImplementation

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
public static void goToImplementation(final JTextComponent c) {
    final Document doc = c.getDocument();
    final int caretPos = c.getCaretPosition();
    final AtomicBoolean cancel = new AtomicBoolean();
    
    ProgressUtils.runOffEventDispatchThread(new Runnable() {
        @Override
        public void run() {
            goToImpl(c, doc, caretPos, cancel);
        }
    }, NbBundle.getMessage(GoToImplementation.class, "CTL_GoToImplementation"), cancel, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:GoToImplementation.java


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