Java 类com.intellij.openapi.actionSystem.DataSink 实例源码

项目:intellij-ce-playground    文件:EditorsPanel.java   
public void calcData(DataKey key, DataSink sink) {
  if (key.equals(CommonDataKeys.PROJECT)) {
    sink.put(CommonDataKeys.PROJECT, myProject);
  }
  else if (key.equals(CommonDataKeys.NAVIGATABLE)) {
    final EditorInfo editorInfo = myTable.getSelectedObject();
    if (editorInfo == null) {
      return;
    }
    String filePath = editorInfo.getFilePath();
    final int pos = filePath.lastIndexOf('/');
    if (pos >= 0) {
      filePath = filePath.substring(pos+1);
    }
    final File file = new File(editorInfo.getPath(), filePath);
    final VirtualFile vf = LocalFileSystem.getInstance().findFileByIoFile(file);
    if (vf != null) {
      sink.put(CommonDataKeys.NAVIGATABLE, new OpenFileDescriptor(myProject, vf));
    }
  }
}
项目:tools-idea    文件:EditorsPanel.java   
public void calcData(DataKey key, DataSink sink) {
  if (key.equals(PlatformDataKeys.PROJECT)) {
    sink.put(PlatformDataKeys.PROJECT, myProject);
  }
  else if (key.equals(PlatformDataKeys.NAVIGATABLE)) {
    final EditorInfo editorInfo = myTable.getSelectedObject();
    if (editorInfo == null) {
      return;
    }
    String filePath = editorInfo.getFilePath();
    final int pos = filePath.lastIndexOf('/');
    if (pos >= 0) {
      filePath = filePath.substring(pos+1);
    }
    final File file = new File(editorInfo.getPath(), filePath);
    final VirtualFile vf = LocalFileSystem.getInstance().findFileByIoFile(file);
    if (vf != null) {
      sink.put(PlatformDataKeys.NAVIGATABLE, new OpenFileDescriptor(myProject, vf));
    }
  }
}
项目:consulo-csharp    文件:CSharpBaseGroupingRule.java   
@Override
public void calcData(final Key<?> key, final DataSink sink)
{
    T element = myPointer.getElement();
    if(element == null)
    {
        return;
    }
    if(LangDataKeys.PSI_ELEMENT == key)
    {
        sink.put(LangDataKeys.PSI_ELEMENT, element);
    }
    if(UsageView.USAGE_INFO_KEY == key)
    {
        sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(element));
    }
}
项目:consulo-javascript    文件:JavaScriptGroupRuleProviderBase.java   
@Override
public void calcData(final Key<?> key, final DataSink sink)
{
    if(!isValid())
    {
        return;
    }
    if(LangDataKeys.PSI_ELEMENT == key)
    {
        sink.put(LangDataKeys.PSI_ELEMENT, getElement());
    }
    if(UsageView.USAGE_INFO_KEY == key)
    {
        T element = getElement();
        if(element != null)
        {
            sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(element));
        }
    }
}
项目:intellij-ce-playground    文件:PackageGroupingRule.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (!isValid()) return;
  if (CommonDataKeys.PSI_ELEMENT == key) {
    sink.put(CommonDataKeys.PSI_ELEMENT, myPackage);
  }
}
项目:intellij-ce-playground    文件:ClassGroupingRule.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (!isValid()) return;
  if (CommonDataKeys.PSI_ELEMENT == key) {
    sink.put(CommonDataKeys.PSI_ELEMENT, getPsiClass());
  }
  if (UsageView.USAGE_INFO_KEY == key) {
    PsiClass psiClass = getPsiClass();
    if (psiClass != null) {
      sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(psiClass));
    }
  }
}
项目:intellij-ce-playground    文件:MethodGroupingRule.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (!isValid()) return;
  if (CommonDataKeys.PSI_ELEMENT == key) {
    sink.put(CommonDataKeys.PSI_ELEMENT, getMethod());
  }
  if (UsageView.USAGE_INFO_KEY == key) {
    PsiMethod method = getMethod();
    if (method != null) {
      sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(method));
    }
  }
}
项目:intellij-ce-playground    文件:PsiElementUsageGroupBase.java   
public void calcData(final DataKey key, final DataSink sink) {
  if (!isValid()) return;
  if (CommonDataKeys.PSI_ELEMENT == key) {
    sink.put(CommonDataKeys.PSI_ELEMENT, getElement());
  }
  if (UsageView.USAGE_INFO_KEY == key) {
    T element = getElement();
    if (element != null) {
      sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(element));
    }
  }
}
项目:intellij-ce-playground    文件:ModuleGroupingRule.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (!isValid()) return;
  if (LangDataKeys.MODULE_CONTEXT == key) {
    sink.put(LangDataKeys.MODULE_CONTEXT, myModule);
  }
}
项目:intellij-ce-playground    文件:DirectoryGroupingRule.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (!isValid()) return;
  if (CommonDataKeys.VIRTUAL_FILE == key) {
    sink.put(CommonDataKeys.VIRTUAL_FILE, myDir);
  }
  if (CommonDataKeys.PSI_ELEMENT == key) {
    sink.put(CommonDataKeys.PSI_ELEMENT, getDirectory());
  }
}
项目:intellij-ce-playground    文件:UsageViewManagerImpl.java   
@NotNull
SearchScope getMaxSearchScopeToWarnOfFallingOutOf(@NotNull UsageTarget[] searchFor) {
  UsageTarget target = searchFor[0];
  if (target instanceof TypeSafeDataProvider) {
    final SearchScope[] scope = new SearchScope[1];
    ((TypeSafeDataProvider)target).calcData(UsageView.USAGE_SCOPE, new DataSink() {
      @Override
      public <T> void put(DataKey<T> key, T data) {
        scope[0] = (SearchScope)data;
      }
    });
    return scope[0];
  }
  return GlobalSearchScope.allScope(myProject); // by default do not warn of falling out of scope
}
项目:intellij-ce-playground    文件:UsageInfo2UsageAdapter.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (key == UsageView.USAGE_INFO_KEY) {
    sink.put(UsageView.USAGE_INFO_KEY, getUsageInfo());
  }
  if (key == UsageView.USAGE_INFO_LIST_KEY) {
    List<UsageInfo> list = Arrays.asList(getMergedInfos());
    sink.put(UsageView.USAGE_INFO_LIST_KEY, list);
  }
}
项目:intellij-ce-playground    文件:CommitChangeListDialog.java   
@Override
public void calcData(DataKey key, DataSink sink) {
  if (key == Refreshable.PANEL_KEY) {
    sink.put(Refreshable.PANEL_KEY, this);
  }
  else {
    myBrowser.calcData(key, sink);
  }
}
项目:intellij-ce-playground    文件:PsiElement2UsageTargetAdapter.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (key == UsageView.USAGE_INFO_KEY) {
    PsiElement element = getElement();
    if (element != null && element.getTextRange() != null) {
      sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(element));
    }
  }
  else if (key == UsageView.USAGE_SCOPE) {
    sink.put(UsageView.USAGE_SCOPE, myOptions.searchScope);
  }
}
项目:intellij-ce-playground    文件:AbstractMemberSelectionTable.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (key == CommonDataKeys.PSI_ELEMENT) {
    final Collection<M> memberInfos = getSelectedMemberInfos();
    if (memberInfos.size() > 0) {
      sink.put(CommonDataKeys.PSI_ELEMENT, memberInfos.iterator().next().getMember());
    }
  }
}
项目:tools-idea    文件:ClassGroupingRule.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (!isValid()) return;
  if (LangDataKeys.PSI_ELEMENT == key) {
    sink.put(LangDataKeys.PSI_ELEMENT, getPsiClass());
  }
  if (UsageView.USAGE_INFO_KEY == key) {
    PsiClass psiClass = getPsiClass();
    if (psiClass != null) {
      sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(psiClass));
    }
  }
}
项目:tools-idea    文件:MethodGroupingRule.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (!isValid()) return;
  if (LangDataKeys.PSI_ELEMENT == key) {
    sink.put(LangDataKeys.PSI_ELEMENT, getMethod());
  }
  if (UsageView.USAGE_INFO_KEY == key) {
    PsiMethod method = getMethod();
    if (method != null) {
      sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(method));
    }
  }
}
项目:tools-idea    文件:ModuleGroupingRule.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (!isValid()) return;
  if (LangDataKeys.MODULE_CONTEXT == key) {
    sink.put(LangDataKeys.MODULE_CONTEXT, myModule);
  }
}
项目:tools-idea    文件:UsageInfo2UsageAdapter.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (key == UsageView.USAGE_INFO_KEY) {
    sink.put(UsageView.USAGE_INFO_KEY, getUsageInfo());
  }
  if (key == UsageView.USAGE_INFO_LIST_KEY) {
    List<UsageInfo> list = Arrays.asList(getMergedInfos());
    sink.put(UsageView.USAGE_INFO_LIST_KEY, list);
  }
}
项目:tools-idea    文件:PsiNamedElementUsageGroupBase.java   
public void calcData(final DataKey key, final DataSink sink) {
  if (!isValid()) return;
  if (LangDataKeys.PSI_ELEMENT == key) {
    sink.put(LangDataKeys.PSI_ELEMENT, getElement());
  }
  if (UsageView.USAGE_INFO_KEY == key) {
    T element = getElement();
    if (element != null) {
      sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(element));
    }
  }
}
项目:tools-idea    文件:CommitChangeListDialog.java   
public void calcData(DataKey key, DataSink sink) {
  if (key == CheckinProjectPanel.PANEL_KEY) {
    sink.put(CheckinProjectPanel.PANEL_KEY, this);
  }
  else {
    myBrowser.calcData(key, sink);
  }
}
项目:tools-idea    文件:PsiElement2UsageTargetAdapter.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (key == UsageView.USAGE_INFO_KEY) {
    PsiElement element = getElement();
    if (element != null && element.getTextRange() != null) {
      sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(element));
    }
  }
}
项目:tools-idea    文件:AbstractMemberSelectionTable.java   
@Override
public void calcData(final DataKey key, final DataSink sink) {
  if (key == LangDataKeys.PSI_ELEMENT) {
    final Collection<M> memberInfos = getSelectedMemberInfos();
    if (memberInfos.size() > 0) {
      sink.put(LangDataKeys.PSI_ELEMENT, memberInfos.iterator().next().getMember());
    }
  }
}
项目:tools-idea    文件:GitPushLog.java   
@Override
public void calcData(DataKey key, DataSink sink) {
  if (VcsDataKeys.CHANGES.equals(key)) {
    DefaultMutableTreeNode[] selectedNodes = myTree.getSelectedNodes(DefaultMutableTreeNode.class, null);
    if (selectedNodes.length == 0) {
      return;
    }
    Object object = selectedNodes[0].getUserObject();
    if (object instanceof GitCommit) {
      sink.put(key, ArrayUtil.toObjectArray(((GitCommit)object).getChanges(), Change.class));
    }
  }
}
项目:consulo    文件:PsiElementUsageGroupBase.java   
public void calcData(final Key<?> key, final DataSink sink) {
  if (!isValid()) return;
  if (CommonDataKeys.PSI_ELEMENT == key) {
    sink.put(CommonDataKeys.PSI_ELEMENT, getElement());
  }
  if (UsageView.USAGE_INFO_KEY == key) {
    T element = getElement();
    if (element != null) {
      sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(element));
    }
  }
}
项目:consulo    文件:FileGroupingRule.java   
@Override
public void calcData(final Key<?> key, final DataSink sink) {
  if (!isValid()) return;
  if (key == CommonDataKeys.VIRTUAL_FILE) {
    sink.put(CommonDataKeys.VIRTUAL_FILE, myFile);
  }
  if (key == CommonDataKeys.PSI_ELEMENT) {
    sink.put(CommonDataKeys.PSI_ELEMENT, getPsiFile());
  }
}
项目:consulo    文件:ModuleGroupingRule.java   
@Override
public void calcData(final Key<?> key, final DataSink sink) {
  if (!isValid()) return;
  if (LangDataKeys.MODULE_CONTEXT == key) {
    sink.put(LangDataKeys.MODULE_CONTEXT, myModule);
  }
}
项目:consulo    文件:UsageViewManagerImpl.java   
@Nonnull
SearchScope getMaxSearchScopeToWarnOfFallingOutOf(@Nonnull UsageTarget[] searchFor) {
  UsageTarget target = searchFor.length > 0 ? searchFor[0] : null;
  if (target instanceof TypeSafeDataProvider) {
    final SearchScope[] scope = new SearchScope[1];
    ((TypeSafeDataProvider)target).calcData(UsageView.USAGE_SCOPE, new DataSink() {
      @Override
      public <T> void put(Key<T> key, T data) {
        scope[0] = (SearchScope)data;
      }
    });
    return scope[0];
  }
  return GlobalSearchScope.allScope(myProject); // by default do not warn of falling out of scope
}
项目:consulo    文件:UsageInfo2UsageAdapter.java   
@Override
public void calcData(final Key<?> key, final DataSink sink) {
  if (key == UsageView.USAGE_INFO_KEY) {
    sink.put(UsageView.USAGE_INFO_KEY, getUsageInfo());
  }
  if (key == UsageView.USAGE_INFO_LIST_KEY) {
    List<UsageInfo> list = Arrays.asList(getMergedInfos());
    sink.put(UsageView.USAGE_INFO_LIST_KEY, list);
  }
}
项目:consulo    文件:CommitChangeListDialog.java   
@Override
public void calcData(Key<?> key, DataSink sink) {
  if (key == Refreshable.PANEL_KEY) {
    sink.put(Refreshable.PANEL_KEY, this);
  }
  else {
    myBrowser.calcData(key, sink);
  }
}
项目:consulo    文件:PsiElement2UsageTargetAdapter.java   
@Override
public void calcData(final Key<?> key, final DataSink sink) {
  if (key == UsageView.USAGE_INFO_KEY) {
    PsiElement element = getElement();
    if (element != null && element.getTextRange() != null) {
      sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(element));
    }
  }
  else if (key == UsageView.USAGE_SCOPE) {
    sink.put(UsageView.USAGE_SCOPE, myOptions.searchScope);
  }
}
项目:consulo    文件:AbstractMemberSelectionTable.java   
@Override
public void calcData(final Key key, final DataSink sink) {
  if (key == CommonDataKeys.PSI_ELEMENT) {
    final Collection<M> memberInfos = getSelectedMemberInfos();
    if (memberInfos.size() > 0) {
      sink.put(CommonDataKeys.PSI_ELEMENT, memberInfos.iterator().next().getMember());
    }
  }
}
项目:consulo-java    文件:ClassGroupingRule.java   
@Override
public void calcData(final Key<?> key, final DataSink sink) {
  if (!isValid()) return;
  if (LangDataKeys.PSI_ELEMENT == key) {
    sink.put(LangDataKeys.PSI_ELEMENT, getPsiClass());
  }
  if (UsageView.USAGE_INFO_KEY == key) {
    PsiClass psiClass = getPsiClass();
    if (psiClass != null) {
      sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(psiClass));
    }
  }
}
项目:consulo-java    文件:MethodGroupingRule.java   
@Override
public void calcData(final Key<?> key, final DataSink sink) {
  if (!isValid()) return;
  if (LangDataKeys.PSI_ELEMENT == key) {
    sink.put(LangDataKeys.PSI_ELEMENT, getMethod());
  }
  if (UsageView.USAGE_INFO_KEY == key) {
    PsiMethod method = getMethod();
    if (method != null) {
      sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(method));
    }
  }
}
项目:consulo-java    文件:MethodParameterPanel.java   
public void calcData(final Key<?> key, final DataSink sink) {
  if (LangDataKeys.PSI_ELEMENT == key) {
    final Collection selection = getSelection();
    if (!selection.isEmpty()) {
      final Object o = ((DefaultMutableTreeNode)selection.iterator().next()).getUserObject();
      if (o instanceof PsiElement) sink.put(LangDataKeys.PSI_ELEMENT, (PsiElement)o);
    }
  }
}
项目:google-cloud-intellij    文件:SetupCloudRepositoryAction.java   
@Override
public void calcData(DataKey key, DataSink sink) {
  if (key == VcsDataKeys.COMMIT_MESSAGE_CONTROL) {
    sink.put(VcsDataKeys.COMMIT_MESSAGE_CONTROL, commitMessagePanel);
  }
}
项目:tools-idea    文件:PackageGroupingRule.java   
public void calcData(final DataKey key, final DataSink sink) {
  if (!isValid()) return;
  if (LangDataKeys.PSI_ELEMENT == key) {
    sink.put(LangDataKeys.PSI_ELEMENT, myPackage);
  }
}
项目:tools-idea    文件:JBPanel.java   
@Override
public void calcData(DataKey key, DataSink sink) {
  // override this to provide additional context
}
项目:tools-idea    文件:ConfigurationSettingsEditorWrapper.java   
@Override
public void calcData(DataKey key, DataSink sink) {
  if (key.equals(CONFIGURATION_EDITOR_KEY)) {
    sink.put(CONFIGURATION_EDITOR_KEY, ConfigurationSettingsEditorWrapper.this);
  }
}
项目:consulo    文件:ConfigurationSettingsEditorWrapper.java   
@Override
public void calcData(Key key, DataSink sink) {
  if (CONFIGURATION_EDITOR_KEY == key) {
    sink.put(CONFIGURATION_EDITOR_KEY, ConfigurationSettingsEditorWrapper.this);
  }
}