本文整理汇总了Java中com.intellij.usages.UsageView类的典型用法代码示例。如果您正苦于以下问题:Java UsageView类的具体用法?Java UsageView怎么用?Java UsageView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UsageView类属于com.intellij.usages包,在下文中一共展示了UsageView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFilteringActions
import com.intellij.usages.UsageView; //导入依赖的package包/类
@Override
@NotNull
public AnAction[] createFilteringActions(@NotNull UsageView view) {
final UsageViewImpl impl = (UsageViewImpl)view;
if (!view.getPresentation().isCodeUsages()) {
return AnAction.EMPTY_ARRAY;
}
final JComponent component = view.getComponent();
final ShowReadAccessUsagesAction read = new ShowReadAccessUsagesAction();
read.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK)), component, impl);
final ShowWriteAccessUsagesAction write = new ShowWriteAccessUsagesAction();
write.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK)), component, impl);
return new AnAction[] {read, write};
}
示例2: update
import com.intellij.usages.UsageView; //导入依赖的package包/类
public final void update(@NotNull UsageView view) {
boolean isDataValid = isDataValid();
boolean isReadOnly = isDataReadOnly();
boolean isExcluded = isDataExcluded();
String text = getText(view);
boolean cachedValid = isValid();
boolean cachedReadOnly = isFlagSet(READ_ONLY_MASK);
boolean cachedExcluded = isFlagSet(EXCLUDED_MASK);
if (isDataValid != cachedValid || isReadOnly != cachedReadOnly || isExcluded != cachedExcluded || !Comparing.equal(myCachedText, text)) {
setFlag(INVALID_MASK, !isDataValid);
setFlag(READ_ONLY_MASK, isReadOnly);
setFlag(EXCLUDED_MASK, isExcluded);
myCachedText = text;
updateNotify();
myTreeModel.nodeChanged(this);
}
setFlag(UPDATED_MASK, true);
}
示例3: updateInBackground
import com.intellij.usages.UsageView; //导入依赖的package包/类
private void updateInBackground(Editor editor,
@Nullable PsiElement element,
@NotNull ImplementationViewComponent component,
String title,
@NotNull AbstractPopup popup,
@NotNull Ref<UsageView> usageView) {
final ImplementationsUpdaterTask updaterTask = SoftReference.dereference(myTaskRef);
cancelTask(updaterTask);
if (element == null) return; //already found
final ImplementationsUpdaterTask task = new ImplementationsUpdaterTask(element, editor, title, isIncludeAlwaysSelf());
task.init(popup, component, usageView);
myTaskRef = new WeakReference<ImplementationsUpdaterTask>(task);
ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, new BackgroundableProcessIndicator(task));
}
示例4: isEnabled
import com.intellij.usages.UsageView; //导入依赖的package包/类
private static boolean isEnabled(DataContext dataContext) {
Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) {
return false;
}
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
if (editor == null) {
UsageTarget[] target = UsageView.USAGE_TARGETS_KEY.getData(dataContext);
return target != null && target.length > 0;
}
else {
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) {
return false;
}
Language language = PsiUtilBase.getLanguageInEditor(editor, project);
if (language == null) {
language = file.getLanguage();
}
return !(LanguageFindUsages.INSTANCE.forLanguage(language) instanceof EmptyFindUsagesProvider);
}
}
示例5: update
import com.intellij.usages.UsageView; //导入依赖的package包/类
public final void update(@NotNull UsageView view) {
boolean isDataValid = isDataValid();
boolean isReadOnly = isDataReadOnly();
boolean isExcluded = isDataExcluded();
String text = getText(view);
boolean cachedValid = isValid();
boolean cachedReadOnly = isFlagSet(READ_ONLY_FLAG);
boolean cachedExcluded = isFlagSet(EXCLUDED_FLAG);
if (isDataValid != cachedValid || isReadOnly != cachedReadOnly || isExcluded != cachedExcluded || !Comparing.equal(myCachedText, text)) {
setFlag(INVALID_FLAG, !isDataValid);
setFlag(READ_ONLY_FLAG, isReadOnly);
setFlag(EXCLUDED_FLAG, isExcluded);
myCachedText = text;
updateNotify();
myTreeModel.nodeChanged(this);
}
setFlag(UPDATED_FLAG, true);
}
示例6: updateInBackground
import com.intellij.usages.UsageView; //导入依赖的package包/类
private void updateInBackground(Editor editor,
@Nullable PsiElement element,
ImplementationViewComponent component,
String title,
AbstractPopup popup, Ref<UsageView> usageView) {
if (myTaskRef != null) {
final BackgroundUpdaterTask updaterTask = myTaskRef.get();
if (updaterTask != null) {
updaterTask.setCanceled();
}
}
if (element == null) return; //already found
final ImplementationsUpdaterTask task = new ImplementationsUpdaterTask(element, editor, title, isIncludeAlwaysSelf());
task.init(popup, component, usageView);
myTaskRef = new WeakReference<BackgroundUpdaterTask>(task);
ProgressManager.getInstance().run(task);
}
示例7: isAvailableFor
import com.intellij.usages.UsageView; //导入依赖的package包/类
@Override
public boolean isAvailableFor(@NotNull UsageView usageView) {
UsageTarget[] targets = ((UsageViewImpl)usageView).getTargets();
if (targets.length == 0) return false;
UsageTarget target = targets[0];
if (!(target instanceof PsiElementUsageTarget)) return false;
PsiElement element = ((PsiElementUsageTarget)target).getElement();
if (element == null || !element.isValid()) return false;
Project project = element.getProject();
DataContext context = SimpleDataContext.getSimpleContext(LangDataKeys.PSI_ELEMENT.getName(), element,
SimpleDataContext.getProjectContext(project));
HierarchyProvider provider = BrowseHierarchyActionBase.findBestHierarchyProvider(LanguageCallHierarchy.INSTANCE, element, context);
if (provider == null) return false;
PsiElement providerTarget = provider.getTarget(context);
return providerTarget != null;
}
示例8: isEnabled
import com.intellij.usages.UsageView; //导入依赖的package包/类
private static boolean isEnabled(DataContext dataContext) {
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
if (project == null) {
return false;
}
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
if (editor == null) {
UsageTarget[] target = UsageView.USAGE_TARGETS_KEY.getData(dataContext);
return target != null && target.length > 0;
}
else {
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) {
return false;
}
Language language = PsiUtilBase.getLanguageInEditor(editor, project);
if (language == null) {
language = file.getLanguage();
}
return !(LanguageFindUsages.INSTANCE.forLanguage(language) instanceof EmptyFindUsagesProvider);
}
}
示例9: calcData
import com.intellij.usages.UsageView; //导入依赖的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));
}
}
示例10: createFilteringActions
import com.intellij.usages.UsageView; //导入依赖的package包/类
@Override
@Nonnull
public AnAction[] createFilteringActions(@Nonnull UsageView view) {
final UsageViewImpl impl = (UsageViewImpl)view;
if (!view.getPresentation().isCodeUsages()) {
return AnAction.EMPTY_ARRAY;
}
final JComponent component = view.getComponent();
final ShowReadAccessUsagesAction read = new ShowReadAccessUsagesAction();
read.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK)), component, impl);
final ShowWriteAccessUsagesAction write = new ShowWriteAccessUsagesAction();
write.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK)), component, impl);
return new AnAction[] {read, write};
}
示例11: update
import com.intellij.usages.UsageView; //导入依赖的package包/类
final synchronized void update(@Nonnull UsageView view, @Nonnull Consumer<Node> edtNodeChangedQueue) {
boolean isDataValid = isDataValid();
boolean isReadOnly = isDataReadOnly();
String text = getText(view);
boolean cachedValid = isValid();
boolean cachedReadOnly = isFlagSet(CACHED_READ_ONLY_MASK);
if (isDataValid != cachedValid || isReadOnly != cachedReadOnly || myCachedTextHash != text.hashCode()) {
setFlag(CACHED_INVALID_MASK, !isDataValid);
setFlag(CACHED_READ_ONLY_MASK, isReadOnly);
myCachedTextHash = text.hashCode();
updateNotify();
edtNodeChangedQueue.consume(this);
}
setFlag(UPDATED_MASK, true);
}
示例12: updateInBackground
import com.intellij.usages.UsageView; //导入依赖的package包/类
private void updateInBackground(Editor editor,
@Nullable PsiElement element,
@Nonnull ImplementationViewComponent component,
String title,
@Nonnull AbstractPopup popup,
@Nonnull Ref<UsageView> usageView) {
final ImplementationsUpdaterTask updaterTask = SoftReference.dereference(myTaskRef);
if (updaterTask != null) {
updaterTask.cancelTask();
}
if (element == null) return; //already found
final ImplementationsUpdaterTask task = new ImplementationsUpdaterTask(element, editor, title, isIncludeAlwaysSelf());
task.init(popup, component, usageView);
myTaskRef = new WeakReference<>(task);
ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, new BackgroundableProcessIndicator(task));
}
示例13: isEnabled
import com.intellij.usages.UsageView; //导入依赖的package包/类
private static boolean isEnabled(DataContext dataContext) {
Project project = dataContext.getData(CommonDataKeys.PROJECT);
if (project == null) {
return false;
}
Editor editor = dataContext.getData(PlatformDataKeys.EDITOR);
if (editor == null) {
UsageTarget[] target = dataContext.getData(UsageView.USAGE_TARGETS_KEY);
return target != null && target.length > 0;
}
else {
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) {
return false;
}
Language language = PsiUtilBase.getLanguageInEditor(editor, project);
if (language == null) {
language = file.getLanguage();
}
return !(LanguageFindUsages.INSTANCE.forLanguage(language) instanceof EmptyFindUsagesProvider);
}
}
示例14: calcData
import com.intellij.usages.UsageView; //导入依赖的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));
}
}
}
示例15: isAvailableFor
import com.intellij.usages.UsageView; //导入依赖的package包/类
@Override
public boolean isAvailableFor(@NotNull UsageView usageView)
{
UsageTarget[] targets = ((UsageViewImpl) usageView).getTargets();
if(targets.length == 0)
{
return false;
}
UsageTarget target = targets[0];
if(!(target instanceof PsiElementUsageTarget))
{
return false;
}
PsiElement element = ((PsiElementUsageTarget) target).getElement();
if(element == null || !element.isValid())
{
return false;
}
if(!(element instanceof PsiVariable))
{
return false;
}
PsiFile file = element.getContainingFile();
return file instanceof PsiJavaFile;
}