• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DataKey类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: findDisposable

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的package包/类
private static AsyncResult<Disposable> findDisposable(Disposable defaultValue, final DataKey<? extends Disposable> key) {
  if (defaultValue == null) {
    if (ApplicationManager.getApplication() != null) {
      final AsyncResult<Disposable> result = new AsyncResult<Disposable>();
      DataManager.getInstance().getDataContextFromFocus().doWhenDone(new Consumer<DataContext>() {
        public void consume(DataContext context) {
          Disposable disposable = key.getData(context);
          if (disposable == null) {
            disposable = Disposer.get("ui");
          }
          result.setDone(disposable);
        }
      });
      return result;
    }
    else {
      return null;
    }
  }
  else {
    return new AsyncResult.Done<Disposable>(defaultValue);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:LazyUiDisposable.java


示例2: discoverPopup

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的package包/类
private static Component discoverPopup(final DataKey<JBPopup> datakey, Component focusOwner) {
  if (focusOwner == null) {
    focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
  }

  if (focusOwner == null) return null;

  final DataContext dataContext = DataManager.getInstance().getDataContext(focusOwner);
  if (dataContext == null) return null;

  final JBPopup popup = datakey.getData(dataContext);
  if (popup != null && popup.isVisible()) {
    return popup.getContent();
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PopupPositionManager.java


示例3: calcData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的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));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:EditorsPanel.java


示例4: findDisposable

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的package包/类
private static AsyncResult<Disposable> findDisposable(Disposable defaultValue, final DataKey<? extends Disposable> key) {
  if (defaultValue == null) {
    if (ApplicationManager.getApplication() != null) {
      final AsyncResult<Disposable> result = new AsyncResult<Disposable>();
      DataManager.getInstance().getDataContextFromFocus().doWhenDone(new AsyncResult.Handler<DataContext>() {
        public void run(DataContext context) {
          Disposable disposable = key.getData(context);
          if (disposable == null) {
            disposable = Disposer.get("ui");
          }
          result.setDone(disposable);
        }
      });
      return result;
    }
    else {
      return null;
    }
  }
  else {
    return new AsyncResult.Done<Disposable>(defaultValue);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:LazyUiDisposable.java


示例5: calcData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的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));
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:EditorsPanel.java


示例6: calcData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PackageGroupingRule.java


示例7: calcData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的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));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ClassGroupingRule.java


示例8: calcData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的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));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:MethodGroupingRule.java


示例9: calcData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的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));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:PsiElementUsageGroupBase.java


示例10: calcData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ModuleGroupingRule.java


示例11: calcData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的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());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:DirectoryGroupingRule.java


示例12: getMaxSearchScopeToWarnOfFallingOutOf

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的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
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:UsageViewManagerImpl.java


示例13: calcData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:UsageInfo2UsageAdapter.java


示例14: passForDataContext

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的package包/类
public void passForDataContext(final DataKey key, final Object value) {
  myGenericData.put(key.getName(), value);
  if (haveMultipleLayers()) {
    for (Pair<String, DiffRequest> pair : myAdditional) {
      pair.getSecond().passForDataContext(key, value);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DiffRequest.java


示例15: getData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的package包/类
@Override
@Nullable
public synchronized Object getData(@NonNls String dataId) {
  myValue = null;
  myLastKey = DataKey.create(dataId);
  myProvider.calcData(myLastKey, this);
  return myValue;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:TypeSafeDataProviderAdapter.java


示例16: getData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的package包/类
@Nullable
public static <T> T getData(DataKey<T> key, @NotNull Component component) {
  DataContext dataContext = DataManager.getInstance().getDataContext(component);
  ViewContext viewContext = ViewContext.CONTEXT_KEY.getData(dataContext);
  ContentManager contentManager = viewContext == null ? null : viewContext.getContentManager();
  if (contentManager != null) {
    T data = key.getData(DataManager.getInstance().getDataContext(contentManager.getComponent()));
    if (data != null) {
      return data;
    }
  }
  return key.getData(dataContext);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:XDebugView.java


示例17: calcData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:CommitChangeListDialog.java


示例18: calcData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:PsiElement2UsageTargetAdapter.java


示例19: calcData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的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());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AbstractMemberSelectionTable.java


示例20: calcData

import com.intellij.openapi.actionSystem.DataKey; //导入依赖的package包/类
@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));
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:ClassGroupingRule.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PlayerBucketFillEvent类代码示例发布时间:2022-05-22
下一篇:
Java Console类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap