本文整理汇总了Java中com.intellij.openapi.actionSystem.DataSink类的典型用法代码示例。如果您正苦于以下问题:Java DataSink类的具体用法?Java DataSink怎么用?Java DataSink使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataSink类属于com.intellij.openapi.actionSystem包,在下文中一共展示了DataSink类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
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));
}
}
}
示例2: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
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));
}
}
}
示例3: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
@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));
}
}
示例4: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
@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));
}
}
}
示例5: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
@Override
public void calcData(final DataKey key, final DataSink sink) {
if (!isValid()) return;
if (CommonDataKeys.PSI_ELEMENT == key) {
sink.put(CommonDataKeys.PSI_ELEMENT, myPackage);
}
}
示例6: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
@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));
}
}
}
示例7: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
@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));
}
}
}
示例8: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
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));
}
}
}
示例9: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
@Override
public void calcData(final DataKey key, final DataSink sink) {
if (!isValid()) return;
if (LangDataKeys.MODULE_CONTEXT == key) {
sink.put(LangDataKeys.MODULE_CONTEXT, myModule);
}
}
示例10: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
@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());
}
}
示例11: getMaxSearchScopeToWarnOfFallingOutOf
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
@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
}
示例12: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
@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);
}
}
示例13: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
@Override
public void calcData(DataKey key, DataSink sink) {
if (key == Refreshable.PANEL_KEY) {
sink.put(Refreshable.PANEL_KEY, this);
}
else {
myBrowser.calcData(key, sink);
}
}
示例14: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
@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);
}
}
示例15: calcData
import com.intellij.openapi.actionSystem.DataSink; //导入依赖的package包/类
@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());
}
}
}