本文整理匯總了Java中com.intellij.openapi.project.DumbService.getInstance方法的典型用法代碼示例。如果您正苦於以下問題:Java DumbService.getInstance方法的具體用法?Java DumbService.getInstance怎麽用?Java DumbService.getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.project.DumbService
的用法示例。
在下文中一共展示了DumbService.getInstance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: actionPerformed
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
Project project = PsiUtil.getProject(anActionEvent);
DumbService dumbService = DumbService.getInstance(project);
if (dumbService.isDumb()) {
dumbService.showDumbModeNotification(CodeGenBundle.message("codegen.plugin.is.not.available.during.indexing"));
return;
}
JFrame frame = new JFrame();
frame.setTitle("CodeGen-SQL");
frame.setContentPane(new SqlEditorPanel(new IdeaContext(project)).getRootComponent());
frame.setSize(600, 400);
frame.setResizable(false);
frame.setAlwaysOnTop(true);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
示例2: after
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public void after( final List<? extends VFileEvent> events )
{
if( _project.isDisposed() )
{
return;
}
DumbService dumb = DumbService.getInstance( _project );
if( dumb.isDumb() )
{
dumb.smartInvokeLater( () -> _after( events ) );
}
else
{
ApplicationManager.getApplication().invokeLater( () ->_after( events ) );
}
}
示例3: commitAndRunInSmartMode
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
private static void commitAndRunInSmartMode(final Runnable runnable, final Project project) {
while (true) {
final DumbService dumbService = DumbService.getInstance(project);
dumbService.waitForSmartMode();
boolean passed = PsiDocumentManager.getInstance(project).commitAndRunReadAction(new Computable<Boolean>() {
@Override
public Boolean compute() {
if (dumbService.isDumb()) return false;
runnable.run();
return true;
}
});
if (passed) {
break;
}
}
}
示例4: getUrlsToOpen
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@NotNull
@Override
public Collection<Url> getUrlsToOpen(@NotNull OpenInBrowserRequest request, boolean preferLocalUrl) throws WebBrowserUrlProvider.BrowserException {
boolean isHtmlOrXml = isHtmlOrXmlFile(request.getFile().getViewProvider().getBaseLanguage());
if (!preferLocalUrl || !isHtmlOrXml) {
DumbService dumbService = DumbService.getInstance(request.getProject());
for (WebBrowserUrlProvider urlProvider : WebBrowserUrlProvider.EP_NAME.getExtensions()) {
if ((!dumbService.isDumb() || DumbService.isDumbAware(urlProvider)) && urlProvider.canHandleElement(request)) {
Collection<Url> urls = getUrls(urlProvider, request);
if (!urls.isEmpty()) {
return urls;
}
}
}
if (!isHtmlOrXml) {
return Collections.emptyList();
}
}
VirtualFile file = request.getVirtualFile();
return file instanceof LightVirtualFile || !request.getFile().getViewProvider().isPhysical()
? Collections.<Url>emptyList()
: Collections.singletonList(Urls.newFromVirtualFile(file));
}
示例5: createJavaParameters
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
protected JavaParameters createJavaParameters() throws ExecutionException {
final JavaParameters javaParameters = super.createJavaParameters();
final JUnitConfiguration.Data data = getConfiguration().getPersistentData();
final DumbService dumbService = DumbService.getInstance(getConfiguration().getProject());
try {
dumbService.setAlternativeResolveEnabled(true);
getClassFilter(data);//check if junit found
}
finally {
dumbService.setAlternativeResolveEnabled(false);
}
createTempFiles(javaParameters);
createServerSocket(javaParameters);
return javaParameters;
}
示例6: actionPerformed
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
Project project = PsiUtil.getProject(e);
DumbService dumbService = DumbService.getInstance(project);
if (dumbService.isDumb()) {
dumbService.showDumbModeNotification(CodeGenBundle.message("codegen.plugin.is.not.available.during.indexing"));
return;
}
Iterator<DbElement> iterator = DatabaseView.getSelectedElements(e.getDataContext(), DbElement.class).iterator();
List<DbTable> tables = new ArrayList<>();
while (iterator.hasNext()) {
DbElement table = iterator.next();
if (table instanceof DbTable) {
tables.add((DbTable) table);
}
}
ColumnEditorFrame frame = new ColumnEditorFrame();
frame.newColumnEditorByDb(new IdeaContext(project), tables);
frame.setSize(800, 550);
frame.setLocationRelativeTo(null);
frame.setAlwaysOnTop(true);
frame.setResizable(false);
frame.setVisible(true);
}
示例7: before
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public void before( final List<? extends VFileEvent> events )
{
if( _project.isDisposed() )
{
return;
}
DumbService dumb = DumbService.getInstance( _project );
if( !dumb.isDumb() )
{
_before( events );
}
}
示例8: filteredFinders
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@NotNull
private PsiElementFinder[] filteredFinders() {
DumbService dumbService = DumbService.getInstance(getProject());
PsiElementFinder[] finders = finders();
if (dumbService.isDumb()) {
List<PsiElementFinder> list = dumbService.filterByDumbAwareness(finders);
finders = list.toArray(new PsiElementFinder[list.size()]);
}
return finders;
}
示例9: isDumbMode
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
private boolean isDumbMode() {
final DumbService dumbService = DumbService.getInstance(myProject);
boolean isDumb = dumbService.isDumb();
if (isDumb) {
// wait some time
for (int idx = 0; idx < 5; idx++) {
TimeoutUtil.sleep(10L);
isDumb = dumbService.isDumb();
if (!isDumb) {
break;
}
}
}
return isDumb;
}
示例10: DefaultHighlightVisitor
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public DefaultHighlightVisitor(@NotNull Project project, boolean highlightErrorElements, boolean runAnnotators, boolean batchMode) {
myProject = project;
myHighlightErrorElements = highlightErrorElements;
myRunAnnotators = runAnnotators;
myErrorFilters = Extensions.getExtensions(HighlightErrorFilter.EP_NAME, project);
myDumbService = DumbService.getInstance(project);
myBatchMode = batchMode;
}
示例11: navigate
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void navigate(@Nullable final MouseEvent event, @Nullable final PsiElement elt) {
final List<PsiElement> list;
DumbService dumbService = elt != null ? DumbService.getInstance(elt.getProject()) : null;
if (dumbService != null) dumbService.setAlternativeResolveEnabled(true);
try {
list = getTargetElements();
}
finally {
if (dumbService != null) dumbService.setAlternativeResolveEnabled(false);
}
if (list.isEmpty()) {
if (myEmptyText != null) {
if (event != null) {
final JComponent label = HintUtil.createErrorLabel(myEmptyText);
label.setBorder(IdeBorderFactory.createEmptyBorder(2, 7, 2, 7));
JBPopupFactory.getInstance().createBalloonBuilder(label)
.setFadeoutTime(3000)
.setFillColor(HintUtil.ERROR_COLOR)
.createBalloon()
.show(new RelativePoint(event), Balloon.Position.above);
}
}
return;
}
if (list.size() == 1) {
PsiNavigateUtil.navigate(list.iterator().next());
}
else {
if (event != null) {
final JBPopup popup = NavigationUtil.getPsiElementPopup(PsiUtilCore.toPsiElementArray(list), myCellRenderer.compute(), myPopupTitle);
popup.show(new RelativePoint(event));
}
}
}
示例12: getProvider
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Nullable
public static WebBrowserUrlProvider getProvider(@NotNull OpenInBrowserRequest request) {
DumbService dumbService = DumbService.getInstance(request.getProject());
for (WebBrowserUrlProvider urlProvider : WebBrowserUrlProvider.EP_NAME.getExtensions()) {
if ((!dumbService.isDumb() || DumbService.isDumbAware(urlProvider)) && urlProvider.canHandleElement(request)) {
return urlProvider;
}
}
return null;
}
示例13: afterSync
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void afterSync(
Project project, BlazeContext context, SyncMode syncMode, SyncResult syncResult) {
if (syncResult.successful()) {
DumbService dumbService = DumbService.getInstance(project);
dumbService.queueTask(new ResourceFolderRegistry.PopulateCachesTask(project));
}
}
示例14: processTypeVars
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
private String processTypeVars( PsiDirectory dir, String fqnExtended, Function<PsiTypeParameter,String> processor )
{
boolean alt = false;
DumbService dumbService = DumbService.getInstance( dir.getProject() );
if( dumbService.isDumb() )
{
dumbService.setAlternativeResolveEnabled( alt = true );
}
try
{
PsiClass extendedClass = JavaPsiFacadeEx.getInstanceEx( dir.getProject() ).findClass( fqnExtended );
if( extendedClass == null )
{
return "";
}
PsiTypeParameter[] typeParameters = extendedClass.getTypeParameters();
if( typeParameters.length == 0 )
{
return "";
}
StringBuilder sb = new StringBuilder();
sb.append( "<" );
for( int i = 0; i < typeParameters.length; i++ )
{
PsiTypeParameter tp = typeParameters[i];
if( i > 0 )
{
sb.append( ", " );
}
sb.append( processor.fun( tp ) );
}
sb.append( "> " );
return sb.toString();
}
finally
{
if( alt )
{
dumbService.setAlternativeResolveEnabled( false );
}
}
}
示例15: run
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void run() {
final DumbService dumbService = DumbService.getInstance(myProject);
if (dumbService.isDumb()) dumbService.runWhenSmart(new InitRunnable());
else init(myProject);
}