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


Java ProgressIndicatorBase类代码示例

本文整理汇总了Java中com.intellij.openapi.progress.util.ProgressIndicatorBase的典型用法代码示例。如果您正苦于以下问题:Java ProgressIndicatorBase类的具体用法?Java ProgressIndicatorBase怎么用?Java ProgressIndicatorBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: mouseClicked

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
  if (e.getClickCount() == 1 && isEnabled()) {
    final com.jetbrains.edu.learning.courseFormat.tasks.Task task = StudyUtils.getCurrentTask(myProject);
    if (task != null && task.getStatus() != StudyStatus.Solved) {
      final ProgressIndicatorBase progress = new ProgressIndicatorBase();
      progress.setText(EduAdaptiveStepicConnector.LOADING_NEXT_RECOMMENDATION);
      ProgressManager.getInstance().run(new Task.Backgroundable(myProject,
                                                                EduAdaptiveStepicConnector.LOADING_NEXT_RECOMMENDATION) {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
          StepicAdaptiveReactionsPanel.this.setEnabledRecursive(false);
          ApplicationManager.getApplication().invokeLater(()->setBackground(UIUtil.getLabelBackground()));
          EduAdaptiveStepicConnector.addNextRecommendedTask(StepicAdaptiveReactionsPanel.this.myProject, task.getLesson(), indicator,
                                                            myReaction);
          StepicAdaptiveReactionsPanel.this.setEnabledRecursive(true);
        }
      });
    }
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:22,代码来源:StepicAdaptiveReactionsPanel.java

示例2: dropResolveCacheRegularly

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
private static void dropResolveCacheRegularly(ProgressIndicator indicator, final Project project) {
    if (indicator instanceof ProgressIndicatorEx) {
        ((ProgressIndicatorEx)indicator).addStateDelegate(new ProgressIndicatorBase() {
            volatile long lastCleared = System.currentTimeMillis();

            public void setFraction(double fraction) {
                super.setFraction(fraction);
                long current = System.currentTimeMillis();
                if (current - this.lastCleared >= 500L) {
                    this.lastCleared = current;
                    PsiManager.getInstance(project).dropResolveCaches();
                }

            }
        });
    }

}
 
开发者ID:niorgai,项目名称:Android-Resource-Usage-Count,代码行数:19,代码来源:FindUsageUtils.java

示例3: testUnbalancedTaskJobUtilPerformance

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
public void testUnbalancedTaskJobUtilPerformance() {
  List<Integer> things = new ArrayList<Integer>(Collections.<Integer>nCopies(10000, null));
  int sum = 0;
  for (int i = 0; i < things.size(); i++) {
    int v = i < 9950 ? 1 : 1000;
    things.set(i, v);
    sum += things.get(i);
  }
  assertEquals(59950, sum);

  long start = System.currentTimeMillis();
  boolean b = JobLauncher.getInstance().invokeConcurrentlyUnderProgress(things, new ProgressIndicatorBase(), false, false, new Processor<Integer>() {
    @Override
    public boolean process(Integer o) {
      busySleep(o);
      return true;
    }
  });
  assertTrue(b);
  long elapsed = System.currentTimeMillis() - start;
  int expected = 2 * (9950 + 50 * 1000) / JobSchedulerImpl.CORES_COUNT;
  String message = "Elapsed: " + elapsed + "; expected: " + expected;
  System.out.println(message);
  assertTrue(message, elapsed < expected);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:JobUtilTest.java

示例4: testProgressManagerCheckCanceledWorksRightAfterIndicatorBeenCanceled

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
public void testProgressManagerCheckCanceledWorksRightAfterIndicatorBeenCanceled() {
  for (int i=0; i<1000;i++) {
    final ProgressIndicatorBase indicator = new ProgressIndicatorBase();
    ProgressManager.getInstance().runProcess(new Runnable() {
      @Override
      public void run() {
        ProgressManager.checkCanceled();
        try {
          indicator.cancel();
          ProgressManager.checkCanceled();
          fail("checkCanceled() must have caught just canceled indicator");
        }
        catch (ProcessCanceledException ignored) {
        }
      }
    }, indicator);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ProgressIndicatorTest.java

示例5: getChildren

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
@Override
@NotNull
public Collection<? extends AbstractTreeNode> getChildren() {
  ProgressIndicator current = ProgressManager.getInstance().getProgressIndicator();
  ProgressIndicator indicator = current == null ? new ProgressIndicatorBase() : current;
  if (current == null) {
    indicator.start();
  }
  final Collection[] nodes = new Collection[1];
  ProgressManager.getInstance().executeProcessUnderProgress(new Runnable() {
    @Override
    public void run() {
      nodes[0] = getChildrenUnderProgress(ProgressManager.getInstance().getProgressIndicator());
    }
  }, indicator);
  if (current == null) {
    indicator.stop();
  }
  return nodes[0];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SliceNode.java

示例6: dropResolveCacheRegularly

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
private static void dropResolveCacheRegularly(ProgressIndicator indicator, @NotNull final Project project) {
  if (indicator instanceof ProgressIndicatorEx) {
    ((ProgressIndicatorEx)indicator).addStateDelegate(new ProgressIndicatorBase() {
      volatile long lastCleared = System.currentTimeMillis();

      @Override
      public void setFraction(double fraction) {
        super.setFraction(fraction);
        long current = System.currentTimeMillis();
        if (current - lastCleared >= 500) {
          lastCleared = current;
          // fraction is changed when each file is processed =>
          // resolve caches used when searching in that file are likely to be not needed anymore
          PsiManager.getInstance(project).dropResolveCaches();
        }
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FindUsagesManager.java

示例7: getItemsWithTimeout

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
/**
 * Runs the getter under a progress indicator that cancels itself after a certain timeout (assumes
 * that the getter will check for cancellation cooperatively).
 *
 * @param getter computes the GotoRelatedItems.
 * @return a list of items computed, or Optional.empty if timed out.
 */
private Optional<List<? extends GotoRelatedItem>> getItemsWithTimeout(
    ThrowableComputable<List<? extends GotoRelatedItem>, RuntimeException> getter) {
  try {
    ProgressIndicator indicator = new ProgressIndicatorBase();
    ProgressIndicator wrappedIndicator =
        new WatchdogIndicator(indicator, TIMEOUT_MS, TimeUnit.MILLISECONDS);
    // We don't use "runProcessWithProgressSynchronously" because that pops up a ProgressWindow,
    // and that will cause the event IDs to bump up and no longer match the event ID stored in
    // DataContexts which may be used in one of the GotoRelatedProvider#getItems overloads.
    return Optional.of(
        ProgressManager.getInstance()
            .runProcess(() -> ReadAction.compute(getter), wrappedIndicator));
  } catch (ProcessCanceledException e) {
    return Optional.empty();
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:24,代码来源:DelegatingSwitchToHeaderOrSourceProvider.java

示例8: getChildren

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
@Override
@NotNull
public Collection<? extends AbstractTreeNode> getChildren() {
  ProgressIndicator current = ProgressManager.getInstance().getProgressIndicator();
  ProgressIndicator indicator = current == null ? new ProgressIndicatorBase() : current;
  if (current == null) {
    indicator.start();
  }
  final Collection[] nodes = new Collection[1];
  ((ProgressManagerImpl)ProgressManager.getInstance()).executeProcessUnderProgress(new Runnable(){
    @Override
    public void run() {
      nodes[0] = getChildrenUnderProgress(ProgressManager.getInstance().getProgressIndicator());
    }
  }, indicator);
  if (current == null) {
    indicator.stop();
  }
  return nodes[0];
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:SliceNode.java

示例9: createCallHierarchyPanel

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
@Nullable
private static HierarchyBrowser createCallHierarchyPanel(@NotNull PsiElement element) {
  DataContext context = SimpleDataContext.getSimpleContext(LangDataKeys.PSI_ELEMENT.getName(), element, SimpleDataContext.getProjectContext(element.getProject()));
  HierarchyProvider provider = BrowseHierarchyActionBase.findBestHierarchyProvider(LanguageCallHierarchy.INSTANCE, element, context);
  if (provider == null) return null;
  PsiElement providerTarget = provider.getTarget(context);
  if (providerTarget == null) return null;

  HierarchyBrowser browser = provider.createHierarchyBrowser(providerTarget);
  if (browser instanceof HierarchyBrowserBaseEx) {
    HierarchyBrowserBaseEx browserEx = (HierarchyBrowserBaseEx)browser;
    browserEx.changeView(CallHierarchyBrowserBase.CALLER_TYPE);
    final ProgressIndicatorBase indicator = new ProgressIndicatorBase();
    Disposer.register(browserEx, new Disposable() {
      @Override
      public void dispose() {
        indicator.cancel();
      }
    });
    browserEx.setProgressIndicator(indicator);
  }
  return browser;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:UsageContextCallHierarchyPanel.java

示例10: dropResolveCacheRegularly

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
private static void dropResolveCacheRegularly(ProgressIndicator indicator, final Project project) {
  if (indicator instanceof ProgressIndicatorEx) {
    ((ProgressIndicatorEx)indicator).addStateDelegate(new ProgressIndicatorBase() {
      volatile long lastCleared = System.currentTimeMillis();

      @Override
      public void setFraction(double fraction) {
        super.setFraction(fraction);
        long current = System.currentTimeMillis();
        if (current - lastCleared >= 500) {
          lastCleared = current;
          // fraction is changed when each file is processed =>
          // resolve caches used when searching in that file are likely to be not needed anymore
          PsiManager.getInstance(project).dropResolveCaches();
        }
      }
    });
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:FindUsagesManager.java

示例11: testReporting

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
@Test
public void testReporting() throws IOException {
    final LinkedList<Double> fractions = new LinkedList<Double>();
    fractions.add(0.25);
    fractions.add(0.75);
    fractions.add(0.80);
    fractions.add(1.0);

    handler.async(4);
    IndicatingInputStream iis = new IndicatingInputStream(file, new ProgressIndicatorBase() {
        @Override
        public void setFraction(final double fraction) {
            handler.done(new Runnable() {
                @Override
                public void run() {
                    Assert.assertEquals(fractions.removeFirst(), (Double)fraction);
                }
            });
        }
    });
    byte[] buf = new byte[10];
    Assert.assertEquals(5, iis.read(buf, 0, 5));
    Assert.assertEquals(10, iis.read(buf));
    Assert.assertEquals('5', iis.read());
    Assert.assertEquals(4, iis.read(buf));
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:27,代码来源:IndicatingInputStreamTest.java

示例12: testCancel

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
@Test
public void testCancel() throws IOException {
    IndicatingInputStream iis = new IndicatingInputStream(file, new ProgressIndicatorBase() {
        @Override
        public void setFraction(final double fraction) {
            cancel();
        }
    });
    byte[] buf = new byte[5];
    Assert.assertEquals(5, iis.read(buf));
    try {
        iis.read(buf);
        Assert.fail("Should have failed");
    } catch (CanceledException e) {
        // ok
    }

    Assert.assertEquals("1234\n", new String(buf));
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:20,代码来源:IndicatingInputStreamTest.java

示例13: testCancel

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
@Test
public void testCancel() throws IOException {
    IndicatingOutputStream ios = new IndicatingOutputStream(file, 20, new ProgressIndicatorBase() {
        @Override
        public void setFraction(final double fraction) {
            cancel();
        }
    });
    ios.write("1234\n".getBytes());
    try {
        ios.write("123456789\n".getBytes());
        Assert.fail("Should have failed");
    } catch (CanceledException e) {
        // ok
    }

    Assert.assertEquals("1234\n", FileUtils.readFileToString(file));
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:19,代码来源:IndicatingOutputStreamTest.java

示例14: dropResolveCacheRegularly

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
private static void dropResolveCacheRegularly(ProgressIndicator indicator, @Nonnull final Project project) {
  if (indicator instanceof ProgressIndicatorEx) {
    ((ProgressIndicatorEx)indicator).addStateDelegate(new ProgressIndicatorBase() {
      volatile long lastCleared = System.currentTimeMillis();

      @Override
      public void setFraction(double fraction) {
        super.setFraction(fraction);
        long current = System.currentTimeMillis();
        if (current - lastCleared >= 500) {
          lastCleared = current;
          // fraction is changed when each file is processed =>
          // resolve caches used when searching in that file are likely to be not needed anymore
          PsiManager.getInstance(project).dropResolveCaches();
        }
      }
    });
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:FindUsagesManager.java

示例15: getChildren

import com.intellij.openapi.progress.util.ProgressIndicatorBase; //导入依赖的package包/类
@Override
@NotNull
public Collection<? extends AbstractTreeNode> getChildren()
{
	ProgressIndicator current = ProgressManager.getInstance().getProgressIndicator();
	ProgressIndicator indicator = current == null ? new ProgressIndicatorBase() : current;
	if(current == null)
	{
		indicator.start();
	}
	final Collection[] nodes = new Collection[1];
	ProgressManager.getInstance().executeProcessUnderProgress(new Runnable()
	{
		@Override
		public void run()
		{
			nodes[0] = getChildrenUnderProgress(ProgressManager.getInstance().getProgressIndicator());
		}
	}, indicator);
	if(current == null)
	{
		indicator.stop();
	}
	return nodes[0];
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:SliceNode.java


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