本文整理匯總了Java中com.intellij.openapi.progress.ProgressIndicator.setFraction方法的典型用法代碼示例。如果您正苦於以下問題:Java ProgressIndicator.setFraction方法的具體用法?Java ProgressIndicator.setFraction怎麽用?Java ProgressIndicator.setFraction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.progress.ProgressIndicator
的用法示例。
在下文中一共展示了ProgressIndicator.setFraction方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doFilter
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
/**
* Filters the console
*/
private synchronized void doFilter(ProgressIndicator progressIndicator) {
final ConsoleView console = getConsole();
String allLInes = getOriginalDocument().toString();
final String[] lines = allLInes.split("\n");
if (console != null) {
console.clear();
}
myLogFilterModel.processingStarted();
int size = lines.length;
float current = 0;
for (String line : lines) {
printMessageToConsole(line);
current++;
progressIndicator.setFraction(current / size);
}
if (console != null) {
((ConsoleViewImpl) console).requestScrollingToEnd();
}
}
示例2: downloadFiles
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private ArrayList<File> downloadFiles(ArrayList<String> fileIds, ProgressIndicator progressIndicator) {
ArrayList<File> files = new ArrayList<File>();
progressIndicator.setText("Downloading selected file(s) from NetSuite File Cabinet");
double numberOfFilesToDownload = fileIds.size();
double currentFileNumber = 1;
for (String fileId : fileIds) {
progressIndicator.setFraction(currentFileNumber/numberOfFilesToDownload);
progressIndicator.setText("Downloading selected file(s) from NetSuite File Cabinet: " + decimalFormat.format((currentFileNumber/numberOfFilesToDownload) * 100) + "% Complete");
try {
File downloadedFile = nsClient.downloadFile(fileId);
if (downloadedFile != null) {
files.add(nsClient.downloadFile(fileId));
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "Exception downloading file from NetSuite File Cabinet: " + ex.getMessage(), "ERROR", JOptionPane.ERROR_MESSAGE);
}
currentFileNumber++;
}
progressIndicator.setFraction(1);
return files;
}
示例3: copyToMirror
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@NotNull
private File copyToMirror(@NotNull File original, @NotNull File mirror) {
ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
if (progress != null) {
progress.pushState();
progress.setText(VfsBundle.message("jar.copy.progress", original.getPath()));
progress.setFraction(0);
}
try {
FileUtil.copy(original, mirror);
}
catch (final IOException e) {
reportIOErrorWithJars(original, mirror, e);
return original;
}
if (progress != null) {
progress.popState();
}
return mirror;
}
示例4: iteration
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@Override
public boolean iteration() {
final CommonProblemDescriptor descriptor = myDescriptors[myCount++];
ProgressIndicator indicator = myTask.getIndicator();
if (indicator != null) {
indicator.setFraction((double)myCount / myDescriptors.length);
String presentableText = "usages";
if (descriptor instanceof ProblemDescriptor) {
final PsiElement psiElement = ((ProblemDescriptor)descriptor).getPsiElement();
if (psiElement != null) {
presentableText = SymbolPresentationUtil.getSymbolPresentableText(psiElement);
}
}
indicator.setText("Processing " + presentableText);
}
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
myDocumentManager.commitAllDocuments();
applyFix(myProject, descriptor);
}
});
return isDone();
}
示例5: iteration
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@Override
public boolean iteration() {
popUntilCurrentTaskUnfinishedOrNull();
if (myCurrentTask != null) {
ProgressIndicator indicator = myProgressTask.getIndicator();
if (indicator != null) {
if (myProgressText != null) indicator.setText(myProgressText);
if (myProgressText2 != null) indicator.setText2(myProgressText2);
indicator.setFraction((double)myIterationsFinished++ / myTotalIterations);
}
myCurrentTask.iteration();
}
return true;
}
示例6: perform
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@NotNull
@Override
protected File perform(@NotNull ProgressIndicator indicator, @NotNull File file) throws WizardException {
indicator.setText("Moving downloaded SDK");
indicator.start();
try {
File root = getSdkRoot(file);
if (!root.renameTo(myDestination)) {
FileUtil.copyDir(root, myDestination);
FileUtil.delete(root); // Failure to delete it is not critical, the source is in temp folder.
// No need to abort installation.
}
return myDestination;
}
catch (IOException e) {
throw new WizardException("Unable to move Android SDK", e);
}
finally {
indicator.setFraction(1.0);
indicator.stop();
}
}
示例7: iteration
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@Override
public boolean iteration() {
final ProgressIndicator indicator = myProgressTask.getIndicator();
if (indicator != null) {
indicator.setFraction((double) myIdx/mySize);
}
myRunnables.next().run();
myIdx++;
return true;
}
示例8: iteration
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@Override
public boolean iteration() {
final ProgressIndicator indicator = myTask.getIndicator();
if (indicator != null) {
indicator.setFraction(((double)myCount) / myTotal);
}
NullityInferrer.apply(myProject, myNotNullManager, myInfos[myCount++]);
return isDone();
}
示例9: execute
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private void execute(@NotNull Collection<VirtualFile> files, @Nullable ProgressIndicator indicator) {
final Map<VirtualFile, Collection<VirtualFile>> sorted = HgUtil.sortByHgRoots(myProject, files);
for (Map.Entry<VirtualFile, Collection<VirtualFile>> entry : sorted.entrySet()) {
if (indicator != null) {
if (indicator.isCanceled()) { return; }
indicator.setFraction(0);
indicator.setText2("Adding files to " + entry.getKey().getPresentableUrl());
}
addFiles(entry.getKey(), entry.getValue(), indicator);
}
}
示例10: initializeProgress
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private void initializeProgress() {
ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null) {
indicator.setText(IdeBundle.message("loading.editors"));
indicator.setText2("");
indicator.setIndeterminate(false);
indicator.setFraction(0);
myProgressMaximum = countFiles(mySplittersElement);
myCurrentProgress = 0;
}
}
示例11: generateSkeletonsForList
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private boolean generateSkeletonsForList(@NotNull final PySkeletonRefresher refresher,
ProgressIndicator indicator,
@Nullable final String currentBinaryFilesPath) throws InvalidSdkException {
final PySkeletonGenerator generator = new PySkeletonGenerator(refresher.getSkeletonsPath(), mySdk, currentBinaryFilesPath);
indicator.setIndeterminate(false);
final String homePath = mySdk.getHomePath();
if (homePath == null) return false;
GeneralCommandLine cmd = PythonHelper.EXTRA_SYSPATH.newCommandLine(homePath, Lists.newArrayList(myQualifiedName));
final ProcessOutput runResult = PySdkUtil.getProcessOutput(cmd,
new File(homePath).getParent(),
PythonSdkType.getVirtualEnvExtraEnv(homePath), 5000
);
if (runResult.getExitCode() == 0 && !runResult.isTimeout()) {
final String extraPath = runResult.getStdout();
final PySkeletonGenerator.ListBinariesResult binaries = generator.listBinaries(mySdk, extraPath);
final List<String> names = Lists.newArrayList(binaries.modules.keySet());
Collections.sort(names);
final int size = names.size();
for (int i = 0; i != size; ++i) {
final String name = names.get(i);
indicator.setFraction((double)i / size);
if (needBinaryList(name)) {
indicator.setText2(name);
final PySkeletonRefresher.PyBinaryItem item = binaries.modules.get(name);
final String modulePath = item != null ? item.getPath() : "";
//noinspection unchecked
refresher.generateSkeleton(name, modulePath, new ArrayList<String>(), Consumer.EMPTY_CONSUMER);
}
}
}
return true;
}
示例12: collectAndShowDuplicates
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private static void collectAndShowDuplicates(final Project project) {
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null && !indicator.isCanceled()) {
indicator.setText("Collecting project images...");
indicator.setIndeterminate(false);
final List<VirtualFile> images = new ArrayList<VirtualFile>();
for (String ext : IMAGE_EXTENSIONS) {
images.addAll(FilenameIndex.getAllFilesByExt(project, ext));
}
final Map<Long, Set<VirtualFile>> duplicates = new HashMap<Long, Set<VirtualFile>>();
final Map<Long, VirtualFile> all = new HashMap<Long, VirtualFile>();
for (int i = 0; i < images.size(); i++) {
indicator.setFraction((double)(i + 1) / (double)images.size());
final VirtualFile file = images.get(i);
if (!(file.getFileSystem() instanceof LocalFileSystem)) continue;
final long length = file.getLength();
if (all.containsKey(length)) {
if (!duplicates.containsKey(length)) {
final HashSet<VirtualFile> files = new HashSet<VirtualFile>();
files.add(all.get(length));
duplicates.put(length, files);
}
duplicates.get(length).add(file);
} else {
all.put(length, file);
}
indicator.checkCanceled();
}
showResults(project, images, duplicates, all);
}
}
示例13: updateIndicator
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private static int updateIndicator(final ProgressIndicator indicator, final int totalCount, int count, final PsiFile psiFile) {
if (indicator != null) {
if (indicator.isCanceled()) throw new ProcessCanceledException();
indicator.setFraction(((double)++count) / totalCount);
final VirtualFile virtualFile = psiFile.getVirtualFile();
if (virtualFile != null) {
indicator.setText(AnalysisScopeBundle.message("find.dependencies.progress.text", virtualFile.getPresentableUrl()));
}
}
return count;
}
示例14: update
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private static void update(ProgressIndicator indicator, boolean indeterminate, double fraction) {
if (indicator instanceof PanelProgressIndicator) {
((PanelProgressIndicator)indicator).update(SCANNING_PACKAGES_MESSAGE, indeterminate, fraction);
} else {
if (fraction != -1) {
indicator.setFraction(fraction);
}
}
}
示例15: postCourse
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private static void postCourse(final Project project, @NotNull Course course) {
if (!checkIfAuthorized(project, "post course")) return;
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null) {
indicator.setText("Uploading course to " + EduStepicNames.STEPIC_URL);
indicator.setIndeterminate(false);
}
final HttpPost request = new HttpPost(EduStepicNames.STEPIC_API_URL + "/courses");
final StepicUser currentUser = EduStepicAuthorizedClient.getCurrentUser();
if (currentUser != null) {
final List<StepicUser> courseAuthors = course.getAuthors();
for (int i = 0; i < courseAuthors.size(); i++) {
if (courseAuthors.size() > i) {
final StepicUser courseAuthor = courseAuthors.get(i);
currentUser.setFirstName(courseAuthor.getFirstName());
currentUser.setLastName(courseAuthor.getLastName());
}
}
course.setAuthors(Collections.singletonList(currentUser));
}
String requestBody = new Gson().toJson(new StepicWrappers.CourseWrapper(course));
request.setEntity(new StringEntity(requestBody, ContentType.APPLICATION_JSON));
try {
final CloseableHttpClient client = EduStepicAuthorizedClient.getHttpClient();
if (client == null) {
LOG.warn("Http client is null");
return;
}
final CloseableHttpResponse response = client.execute(request);
final HttpEntity responseEntity = response.getEntity();
final String responseString = responseEntity != null ? EntityUtils.toString(responseEntity) : "";
final StatusLine line = response.getStatusLine();
EntityUtils.consume(responseEntity);
if (line.getStatusCode() != HttpStatus.SC_CREATED) {
final String message = FAILED_TITLE + "course ";
LOG.error(message + responseString);
showErrorNotification(project, FAILED_TITLE, responseString);
return;
}
final RemoteCourse postedCourse = new Gson().fromJson(responseString, StepicWrappers.CoursesContainer.class).courses.get(0);
postedCourse.setLessons(course.getLessons(true));
postedCourse.setAuthors(course.getAuthors());
postedCourse.setCourseMode(CCUtils.COURSE_MODE);
postedCourse.setLanguage(course.getLanguageID());
final int sectionId = postModule(postedCourse.getId(), 1, String.valueOf(postedCourse.getName()), project);
int position = 1;
for (Lesson lesson : course.getLessons()) {
if (indicator != null) {
indicator.checkCanceled();
indicator.setText2("Publishing lesson " + lesson.getIndex());
}
final int lessonId = postLesson(project, lesson);
postUnit(lessonId, position, sectionId, project);
if (indicator != null) {
indicator.setFraction((double)lesson.getIndex()/course.getLessons().size());
indicator.checkCanceled();
}
position += 1;
}
ApplicationManager.getApplication().runReadAction(() -> postAdditionalFiles(course, project, postedCourse.getId()));
StudyTaskManager.getInstance(project).setCourse(postedCourse);
showNotification(project, "Course published");
}
catch (IOException e) {
LOG.error(e.getMessage());
}
}