當前位置: 首頁>>代碼示例>>Java>>正文


Java FileEditor.putUserData方法代碼示例

本文整理匯總了Java中com.intellij.openapi.fileEditor.FileEditor.putUserData方法的典型用法代碼示例。如果您正苦於以下問題:Java FileEditor.putUserData方法的具體用法?Java FileEditor.putUserData怎麽用?Java FileEditor.putUserData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.fileEditor.FileEditor的用法示例。


在下文中一共展示了FileEditor.putUserData方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addFileLevelHighlight

import com.intellij.openapi.fileEditor.FileEditor; //導入方法依賴的package包/類
@Override
public void addFileLevelHighlight(@NotNull final Project project,
                                  final int group,
                                  @NotNull final HighlightInfo info,
                                  @NotNull final PsiFile psiFile) {
  VirtualFile vFile = psiFile.getViewProvider().getVirtualFile();
  final FileEditorManager manager = FileEditorManager.getInstance(project);
  for (FileEditor fileEditor : manager.getEditors(vFile)) {
    if (fileEditor instanceof TextEditor) {
      FileLevelIntentionComponent component = new FileLevelIntentionComponent(info.getDescription(), info.getSeverity(),
                                                                              info.getGutterIconRenderer(), info.quickFixActionRanges,
                                                                              project, psiFile, ((TextEditor)fileEditor).getEditor());
      manager.addTopComponent(fileEditor, component);
      List<HighlightInfo> fileLevelInfos = fileEditor.getUserData(FILE_LEVEL_HIGHLIGHTS);
      if (fileLevelInfos == null) {
        fileLevelInfos = new ArrayList<HighlightInfo>();
        fileEditor.putUserData(FILE_LEVEL_HIGHLIGHTS, fileLevelInfos);
      }
      info.fileLevelComponent = component;
      info.setGroup(group);
      fileLevelInfos.add(info);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:DaemonCodeAnalyzerImpl.java

示例2: updateIndentNotification

import com.intellij.openapi.fileEditor.FileEditor; //導入方法依賴的package包/類
public static void updateIndentNotification(@NotNull PsiFile file, boolean enforce) {
  VirtualFile vFile = file.getVirtualFile();
  if (vFile == null) return;

  if (!ApplicationManager.getApplication().isHeadlessEnvironment()
      || ApplicationManager.getApplication().isUnitTestMode() && myShowNotificationInTest)
  {
    Project project = file.getProject();
    FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
    FileEditor fileEditor = fileEditorManager.getSelectedEditor(vFile);
    if (fileEditor != null) {
      Boolean notifiedFlag = fileEditor.getUserData(NOTIFIED_FLAG);
      if (notifiedFlag == null || enforce) {
        fileEditor.putUserData(NOTIFIED_FLAG, Boolean.TRUE);
        EditorNotifications.getInstance(project).updateNotifications(vFile);
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:DetectedIndentOptionsNotificationProvider.java

示例3: startFindUsages

import com.intellij.openapi.fileEditor.FileEditor; //導入方法依賴的package包/類
private void startFindUsages(@NotNull FindUsagesOptions findUsagesOptions,
                             @NotNull FindUsagesHandler handler,
                             PsiFile scopeFile,
                             FileEditor editor) {
  boolean singleFile = scopeFile != null;

  clearFindingNextUsageInFile();
  LOG.assertTrue(handler.getPsiElement().isValid());
  PsiElement[] primaryElements = handler.getPrimaryElements();
  checkNotNull(primaryElements, handler, "getPrimaryElements()");
  PsiElement[] secondaryElements = handler.getSecondaryElements();
  checkNotNull(secondaryElements, handler, "getSecondaryElements()");
  if (singleFile) {
    editor.putUserData(KEY_START_USAGE_AGAIN, null);
    findUsagesInEditor(primaryElements, secondaryElements, handler, scopeFile, FileSearchScope.FROM_START, findUsagesOptions.clone(), editor);
  }
  else {
    boolean skipResultsWithOneUsage = FindSettings.getInstance().isSkipResultsWithOneUsage();
    findUsages(primaryElements, secondaryElements, handler, findUsagesOptions, skipResultsWithOneUsage);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:FindUsagesManager.java

示例4: updateNotification

import com.intellij.openapi.fileEditor.FileEditor; //導入方法依賴的package包/類
private void updateNotification(@NotNull FileEditor editor, @NotNull Key<? extends JComponent> key, @Nullable JComponent component) {
  JComponent old = editor.getUserData(key);
  if (old != null) {
    FileEditorManager.getInstance(myProject).removeTopComponent(editor, old);
  }
  if (component != null) {
    FileEditorManager.getInstance(myProject).addTopComponent(editor, component);
    @SuppressWarnings("unchecked") Key<JComponent> _key = (Key<JComponent>)key;
    editor.putUserData(_key, component);
  }
  else {
    editor.putUserData(key, null);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:EditorNotificationsImpl.java

示例5: installAnathema

import com.intellij.openapi.fileEditor.FileEditor; //導入方法依賴的package包/類
private void installAnathema() {
  myAnathemaThrown = true;
  final FileEditor[] editors = myFileEditorManager.getAllEditors(myVirtualFile);
  for (FileEditor editor : editors) {
    CanNotCalculateDiffPanel panel = editor.getUserData(PANEL_KEY);
    if (panel == null) {
      final CanNotCalculateDiffPanel newPanel = new CanNotCalculateDiffPanel();
      editor.putUserData(PANEL_KEY, newPanel);
      myFileEditorManager.addTopComponent(editor, newPanel);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:LineStatusTracker.java

示例6: removeAnathema

import com.intellij.openapi.fileEditor.FileEditor; //導入方法依賴的package包/類
private void removeAnathema() {
  if (!myAnathemaThrown) return;
  myAnathemaThrown = false;
  final FileEditor[] editors = myFileEditorManager.getEditors(myVirtualFile);
  for (FileEditor editor : editors) {
    final CanNotCalculateDiffPanel panel = editor.getUserData(PANEL_KEY);
    if (panel != null) {
      myFileEditorManager.removeTopComponent(editor, panel);
      editor.putUserData(PANEL_KEY, null);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:LineStatusTracker.java

示例7: updateAllEditors

import com.intellij.openapi.fileEditor.FileEditor; //導入方法依賴的package包/類
private void updateAllEditors() {
  if (myCache.getCachedIncomingChanges() == null) {
    requestLoadIncomingChanges();
    return;
  }
  debug("Updating editors");
  final VirtualFile[] files = myFileEditorManager.getOpenFiles();
  for(VirtualFile file: files) {
    final Pair<CommittedChangeList,Change> pair = myCache.getIncomingChangeList(file);
    final FileEditor[] fileEditors = myFileEditorManager.getEditors(file);
    for(FileEditor editor: fileEditors) {
      final OutdatedRevisionPanel oldPanel = editor.getUserData(PANEL_KEY);
      if (pair != null) {
        if (oldPanel != null) {
          oldPanel.setChangeList(pair.first, pair.second);
        }
        else {
          initPanel(pair.first, pair.second, editor);
        }
      }
      else if (oldPanel != null) {
        myFileEditorManager.removeTopComponent(editor, oldPanel);
        editor.putUserData(PANEL_KEY, null);
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:OutdatedVersionNotifier.java

示例8: initPanel

import com.intellij.openapi.fileEditor.FileEditor; //導入方法依賴的package包/類
private void initPanel(final CommittedChangeList list, final Change c, final FileEditor editor) {
  if (!isIncomingChangesSupported(list)) {
    return;
  }
  final OutdatedRevisionPanel component = new OutdatedRevisionPanel(list, c);
  editor.putUserData(PANEL_KEY, component);
  myFileEditorManager.addTopComponent(editor, component);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:OutdatedVersionNotifier.java

示例9: findUsagesInEditor

import com.intellij.openapi.fileEditor.FileEditor; //導入方法依賴的package包/類
private void findUsagesInEditor(@NotNull final PsiElement[] primaryElements,
                                @NotNull final PsiElement[] secondaryElements,
                                @NotNull FindUsagesHandler handler,
                                @NotNull PsiFile scopeFile,
                                @NotNull FileSearchScope direction,
                                @NotNull final FindUsagesOptions findUsagesOptions,
                                @NotNull FileEditor fileEditor) {
  initLastSearchElement(findUsagesOptions, primaryElements, secondaryElements);

  clearStatusBar();

  final FileEditorLocation currentLocation = fileEditor.getCurrentLocation();

  final UsageSearcher usageSearcher = createUsageSearcher(primaryElements, secondaryElements, handler, findUsagesOptions, scopeFile);
  AtomicBoolean usagesWereFound = new AtomicBoolean();

  Usage fUsage = findSiblingUsage(usageSearcher, direction, currentLocation, usagesWereFound, fileEditor);

  if (fUsage != null) {
    fUsage.navigate(true);
    fUsage.selectInEditor();
  }
  else if (!usagesWereFound.get()) {
    String message = getNoUsagesFoundMessage(primaryElements[0]) + " in " + scopeFile.getName();
    showHintOrStatusBarMessage(message, fileEditor);
  }
  else {
    fileEditor.putUserData(KEY_START_USAGE_AGAIN, VALUE_START_USAGE_AGAIN);
    showHintOrStatusBarMessage(getSearchAgainMessage(primaryElements[0], direction), fileEditor);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:FindUsagesManager.java

示例10: findSiblingUsage

import com.intellij.openapi.fileEditor.FileEditor; //導入方法依賴的package包/類
private static Usage findSiblingUsage(@NotNull final UsageSearcher usageSearcher,
                                      @NotNull FileSearchScope dir,
                                      final FileEditorLocation currentLocation,
                                      @NotNull final AtomicBoolean usagesWereFound,
                                      @NotNull FileEditor fileEditor) {
  if (fileEditor.getUserData(KEY_START_USAGE_AGAIN) != null) {
    dir = dir == FileSearchScope.AFTER_CARET ? FileSearchScope.FROM_START : FileSearchScope.FROM_END;
  }

  final FileSearchScope direction = dir;

  final AtomicReference<Usage> foundUsage = new AtomicReference<Usage>();
  usageSearcher.generate(new Processor<Usage>() {
    @Override
    public boolean process(Usage usage) {
      usagesWereFound.set(true);
      if (direction == FileSearchScope.FROM_START) {
        foundUsage.compareAndSet(null, usage);
        return false;
      }
      if (direction == FileSearchScope.FROM_END) {
        foundUsage.set(usage);
      }
      else if (direction == FileSearchScope.AFTER_CARET) {
        if (Comparing.compare(usage.getLocation(), currentLocation) > 0) {
          foundUsage.set(usage);
          return false;
        }
      }
      else if (direction == FileSearchScope.BEFORE_CARET) {
        if (Comparing.compare(usage.getLocation(), currentLocation) >= 0) {
          return false;
        }
        while (true) {
          Usage found = foundUsage.get();
          if (found == null) {
            if (foundUsage.compareAndSet(null, usage)) break;
          }
          else {
            if (Comparing.compare(found.getLocation(), usage.getLocation()) < 0 && foundUsage.compareAndSet(found, usage)) break;
          }
        }
      }

      return true;
    }
  });

  fileEditor.putUserData(KEY_START_USAGE_AGAIN, null);

  return foundUsage.get();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:53,代碼來源:FindUsagesManager.java


注:本文中的com.intellij.openapi.fileEditor.FileEditor.putUserData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。