当前位置: 首页>>代码示例>>Java>>正文


Java PopupStep类代码示例

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


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

示例1: invoke

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
@Override
public void invoke(@NotNull final Project project, final Editor editor, @NotNull final PsiElement psiElement) throws IncorrectOperationException {

    JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<String>("Chosen", "Document", "Sample") {

        @Override
        public PopupStep onChosen(String selectedValue, boolean finalChoice) {

            if ("Document".equals(selectedValue)) {
                openDocument(psiElement.getText());
            } else if ("Sample".equals(selectedValue)) {
                openSample(project, editor);
            }

            return super.onChosen(selectedValue, finalChoice);
        }
    }).showInBestPositionFor(editor);
}
 
开发者ID:misakuo,项目名称:weex-language-support,代码行数:19,代码来源:DocumentIntention.java

示例2: selectTargets

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
@Override
protected void selectTargets(List<PsiLiteralExpression> targets, final Consumer<List<PsiLiteralExpression>> selectionConsumer) {
  if (targets.size() == 1) {
    selectionConsumer.consume(targets);
  } else {
    JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<PsiLiteralExpression>("Choose Inspections to Highlight Suppressed Problems from", targets){
      @Override
      public PopupStep onChosen(PsiLiteralExpression selectedValue, boolean finalChoice) {
        selectionConsumer.consume(Collections.singletonList(selectedValue));
        return FINAL_CHOICE;
      }

      @NotNull
      @Override
      public String getTextFor(PsiLiteralExpression value) {
        final Object o = value.getValue();
        LOG.assertTrue(o instanceof String);
        return (String)o;
      }
    }).showInBestPositionFor(myEditor);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:HighlightSuppressedWarningsHandler.java

示例3: fix

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
@Override
public void fix(final JComponent contextComponent, RelativePoint relativePoint) {
  JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<ConfigurationErrorQuickFix>(null, myDescription.getFixes()) {
    @NotNull
    @Override
    public String getTextFor(ConfigurationErrorQuickFix value) {
      return value.getActionName();
    }

    @Override
    public PopupStep onChosen(final ConfigurationErrorQuickFix selectedValue, boolean finalChoice) {
      return doFinalStep(new Runnable() {
        @Override
        public void run() {
          selectedValue.performFix();
        }
      });
    }
  }).show(relativePoint);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ProjectConfigurationProblem.java

示例4: createChooseTypeStep

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
public static BaseListPopupStep<LibraryType> createChooseTypeStep(final ClasspathPanel classpathPanel,
                                                                  final ParameterizedRunnable<LibraryType> action) {
  return new BaseListPopupStep<LibraryType>(IdeBundle.message("popup.title.select.library.type"), getSuitableTypes(classpathPanel)) {
        @NotNull
        @Override
        public String getTextFor(LibraryType value) {
          return value != null ? value.getCreateActionName() : IdeBundle.message("create.default.library.type.action.name");
        }

        @Override
        public Icon getIconFor(LibraryType aValue) {
          return aValue != null ? aValue.getIcon(null) : PlatformIcons.LIBRARY_ICON;
        }

        @Override
        public PopupStep onChosen(final LibraryType selectedValue, boolean finalChoice) {
          return doFinalStep(new Runnable() {
            @Override
            public void run() {
              action.run(selectedValue);
            }
          });
        }
      };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:LibraryEditingUtil.java

示例5: buildStep

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
private static ListPopupStep buildStep(@NotNull final List<Pair<AnAction, KeyStroke>> actions, final DataContext ctx) {
  return new BaseListPopupStep<Pair<AnAction, KeyStroke>>("Choose an action", ContainerUtil.findAll(actions, new Condition<Pair<AnAction, KeyStroke>>() {
    @Override
    public boolean value(Pair<AnAction, KeyStroke> pair) {
      final AnAction action = pair.getFirst();
      final Presentation presentation = action.getTemplatePresentation().clone();
      AnActionEvent event = new AnActionEvent(null, ctx,
                                              ActionPlaces.UNKNOWN,
                                              presentation,
                                              ActionManager.getInstance(),
                                              0);

      ActionUtil.performDumbAwareUpdate(action, event, true);
      return presentation.isEnabled() && presentation.isVisible();
    }
  })) {
    @Override
    public PopupStep onChosen(Pair<AnAction, KeyStroke> selectedValue, boolean finalChoice) {
      invokeAction(selectedValue.getFirst(), ctx);
      return FINAL_CHOICE;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:IdeKeyEventDispatcher.java

示例6: createPopup

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
private static ListPopup createPopup(final ArrayList<VirtualFile> files, final ArrayList<Icon> icons) {
  final BaseListPopupStep<VirtualFile> step = new BaseListPopupStep<VirtualFile>("File Path", files, icons) {
    @NotNull
    @Override
    public String getTextFor(final VirtualFile value) {
      return value.getPresentableName();
    }

    @Override
    public PopupStep onChosen(final VirtualFile selectedValue, final boolean finalChoice) {
      final File selectedFile = new File(getPresentableUrl(selectedValue));
      if (selectedFile.exists()) {
        ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
          @Override
          public void run() {
            openFile(selectedFile);
          }
        });
      }
      return FINAL_CHOICE;
    }
  };

  return JBPopupFactory.getInstance().createListPopup(step);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ShowFilePathAction.java

示例7: showHistory

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
private void showHistory() {
  List<XExpression> expressions = myExpressionEditor.getRecentExpressions();
  if (!expressions.isEmpty()) {
    ListPopupImpl popup = new ListPopupImpl(new BaseListPopupStep<XExpression>(null, expressions) {
      @Override
      public PopupStep onChosen(XExpression selectedValue, boolean finalChoice) {
        myExpressionEditor.setExpression(selectedValue);
        myExpressionEditor.requestFocusInEditor();
        return FINAL_CHOICE;
      }
    }) {
      @Override
      protected ListCellRenderer getListElementRenderer() {
        return new ColoredListCellRenderer<XExpression>() {
          @Override
          protected void customizeCellRenderer(JList list, XExpression value, int index, boolean selected, boolean hasFocus) {
            append(value.getExpression());
          }
        };
      }
    };
    popup.getList().setFont(EditorUtil.getEditorFont());
    popup.showUnderneathOf(myExpressionEditor.getEditorComponent());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ExpressionInputComponent.java

示例8: onChosen

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
@Override
public PopupStep onChosen(final VirtualFile selectedValue, boolean finalChoice) {
  if (selectedValue == null) {
    myNewBaseSelector.run();
    return null;
  }
  final List<AbstractFilePatchInProgress.PatchChange> selectedChanges = myChangesTreeList.getSelectedChanges();
  if (selectedChanges.size() >= 1) {
    for (AbstractFilePatchInProgress.PatchChange patchChange : selectedChanges) {
      final AbstractFilePatchInProgress patch = patchChange.getPatchInProgress();
      patch.setNewBase(selectedValue);
    }
    updateTree(false);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ApplyPatchDifferentiatedDialog.java

示例9: onChosen

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
@Override
public PopupStep onChosen(LookupElementAction selectedValue, boolean finalChoice) {
  final LookupElementAction.Result result = selectedValue.performLookupAction();
  if (result == LookupElementAction.Result.HIDE_LOOKUP) {
    myLookup.hideLookup(true);
  } else if (result == LookupElementAction.Result.REFRESH_ITEM) {
    myLookup.updateLookupWidth(myLookupElement);
    myLookup.requestResize();
    myLookup.refreshUi(false, true);
  } else if (result instanceof LookupElementAction.Result.ChooseItem) {
    myLookup.setCurrentItem(((LookupElementAction.Result.ChooseItem)result).item);
    CommandProcessor.getInstance().executeCommand(myLookup.getEditor().getProject(), new Runnable() {
      @Override
      public void run() {
        myLookup.finishLookup(Lookup.AUTO_INSERT_SELECT_CHAR);
      }
    }, null, null);
  }
  return FINAL_CHOICE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LookupActionsStep.java

示例10: addExcludedFramework

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
private PopupStep addExcludedFramework(final @NotNull FrameworkType frameworkType) {
  final String projectItem = "In the whole project";
  return new BaseListPopupStep<String>(null, new String[]{projectItem, "In directory..."}) {
    @Override
    public PopupStep onChosen(String selectedValue, boolean finalChoice) {
      if (selectedValue.equals(projectItem)) {
        addAndRemoveDuplicates(frameworkType, null);
        return FINAL_CHOICE;
      }
      else {
        return doFinalStep(new Runnable() {
          @Override
          public void run() {
            chooseDirectoryAndAdd(frameworkType);
          }
        });
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:DetectionExcludesConfigurable.java

示例11: onChosen

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
public PopupStep onChosen(final ErrorWithFix selectedValue, final boolean finalChoice) {
  if (selectedValue.second instanceof PopupQuickFix) {
    return ((PopupQuickFix) selectedValue.second).getPopupStep();
  }
  if (finalChoice || !myShowSuppresses) {
    return doFinalStep(new Runnable() {
      public void run() {
        CommandProcessor.getInstance().executeCommand(myEditor.getProject(), new Runnable() {
          public void run() {
            selectedValue.second.run();
          }
        }, selectedValue.second.getName(), null);
      }
    });
  }
  if (selectedValue.first.getInspectionId() != null && selectedValue.second.getComponent() != null &&
      !(selectedValue.second instanceof SuppressFix)) {
    ArrayList<ErrorWithFix> suppressList = new ArrayList<ErrorWithFix>();
    buildSuppressFixes(selectedValue.first, suppressList, false);
    return new QuickFixPopupStep(suppressList, false);
  }
  return FINAL_CHOICE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:QuickFixManager.java

示例12: doFix

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
private void doFix(Editor editor, final DomFileElement<IdeaPlugin> element) {
  if (myEPCandidates.size() == 1) {
    registerExtension(element, myEPCandidates.get(0));
  }
  else {
    final BaseListPopupStep<ExtensionPointCandidate> popupStep =
      new BaseListPopupStep<ExtensionPointCandidate>("Choose Extension Point", myEPCandidates) {
        @Override
        public PopupStep onChosen(ExtensionPointCandidate selectedValue, boolean finalChoice) {
          registerExtension(element, selectedValue);
          return FINAL_CHOICE;
        }
      };
    JBPopupFactory.getInstance().createListPopup(popupStep).showInBestPositionFor(editor);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RegisterExtensionFix.java

示例13: invoke

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
@Override
public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
  final PsiModifierListOwner modifierListOwner = getElement(editor, file);
  if (modifierListOwner == null) throw new IncorrectOperationException();

  BaseListPopupStep<Nls.Capitalization> step =
    new BaseListPopupStep<Nls.Capitalization>(null, Nls.Capitalization.Title, Nls.Capitalization.Sentence) {
      @Override
      public PopupStep onChosen(final Nls.Capitalization selectedValue, boolean finalChoice) {
        new WriteCommandAction.Simple(project) {
          @Override
          protected void run() throws Throwable {
            String nls = Nls.class.getName();
            PsiAnnotation annotation = JavaPsiFacade.getInstance(project).getElementFactory()
              .createAnnotationFromText("@" + nls + "(capitalization = " +
                                        nls + ".Capitalization." + selectedValue.toString() + ")", modifierListOwner);
            new AddAnnotationFix(Nls.class.getName(), modifierListOwner, annotation.getParameterList().getAttributes()).applyFix();
          }
        }.execute();
        return FINAL_CHOICE;
      }
    };
  JBPopupFactory.getInstance().createListPopup(step).showInBestPositionFor(editor);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:AnnotateCapitalizationIntention.java

示例14: createChooseTypeStep

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
public static BaseListPopupStep<LibraryType> createChooseTypeStep(final ClasspathPanel classpathPanel,
                                                                  final ParameterizedRunnable<LibraryType> action) {
  return new BaseListPopupStep<LibraryType>(IdeBundle.message("popup.title.select.library.type"), getSuitableTypes(classpathPanel)) {
        @NotNull
        @Override
        public String getTextFor(LibraryType value) {
          return value != null ? value.getCreateActionName() : IdeBundle.message("create.default.library.type.action.name");
        }

        @Override
        public Icon getIconFor(LibraryType aValue) {
          return aValue != null ? aValue.getIcon() : PlatformIcons.LIBRARY_ICON;
        }

        @Override
        public PopupStep onChosen(final LibraryType selectedValue, boolean finalChoice) {
          return doFinalStep(new Runnable() {
            @Override
            public void run() {
              action.run(selectedValue);
            }
          });
        }
      };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:LibraryEditingUtil.java

示例15: createPopup

import com.intellij.openapi.ui.popup.PopupStep; //导入依赖的package包/类
private static ListPopup createPopup(final ArrayList<VirtualFile> files, final ArrayList<Icon> icons) {
  final BaseListPopupStep<VirtualFile> step = new BaseListPopupStep<VirtualFile>("File Path", files, icons) {
    @NotNull
    @Override
    public String getTextFor(final VirtualFile value) {
      return value.getPresentableName();
    }

    @Override
    public PopupStep onChosen(final VirtualFile selectedValue, final boolean finalChoice) {
      final File selectedFile = new File(getPresentableUrl(selectedValue));
      if (selectedFile.exists()) {
        ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
          public void run() {
            openFile(selectedFile);
          }
        });
      }
      return FINAL_CHOICE;
    }
  };

  return JBPopupFactory.getInstance().createListPopup(step);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:ShowFilePathAction.java


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