本文整理汇总了Java中com.intellij.debugger.impl.DebuggerUtilsEx.getCodeFragmentFactories方法的典型用法代码示例。如果您正苦于以下问题:Java DebuggerUtilsEx.getCodeFragmentFactories方法的具体用法?Java DebuggerUtilsEx.getCodeFragmentFactories怎么用?Java DebuggerUtilsEx.getCodeFragmentFactories使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.debugger.impl.DebuggerUtilsEx
的用法示例。
在下文中一共展示了DebuggerUtilsEx.getCodeFragmentFactories方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLanguagePopup
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
private ListPopup createLanguagePopup() {
DefaultActionGroup actions = new DefaultActionGroup();
for (final CodeFragmentFactory fragmentFactory : DebuggerUtilsEx.getCodeFragmentFactories(myContext)) {
actions.add(new AnAction(fragmentFactory.getFileType().getLanguage().getDisplayName(), null, fragmentFactory.getFileType().getIcon()) {
@Override
public void actionPerformed(AnActionEvent e) {
setFactory(fragmentFactory);
setText(getText());
IdeFocusManager.getInstance(getProject()).requestFocus(DebuggerEditorImpl.this, true);
}
});
}
DataContext dataContext = DataManager.getInstance().getDataContext(this);
return JBPopupFactory.getInstance().createActionGroupPopup("Choose Language", actions, dataContext,
JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
false);
}
示例2: setContext
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
@Override
public void setContext(@Nullable PsiElement context) {
myContext = context;
List<CodeFragmentFactory> factories = DebuggerUtilsEx.getCodeFragmentFactories(context);
boolean many = factories.size() > 1;
if (myInitialFactory) {
myInitialFactory = false;
setFactory(factories.get(0));
myChooseFactory.setVisible(many);
}
myChooseFactory.setVisible(myChooseFactory.isVisible() || many);
myChooseFactory.setEnabled(many && factories.contains(myFactory));
updateEditorUi();
}
示例3: createLanguagePopup
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
private ListPopup createLanguagePopup() {
DefaultActionGroup actions = new DefaultActionGroup();
for (final CodeFragmentFactory fragmentFactory : DebuggerUtilsEx.getCodeFragmentFactories(myContext)) {
actions.add(new AnAction(fragmentFactory.getFileType().getLanguage().getDisplayName(), null, fragmentFactory.getFileType().getIcon()) {
@Override
public void actionPerformed(AnActionEvent e) {
setFactory(fragmentFactory);
setText(getText());
IdeFocusManager.getInstance(getProject()).requestFocus(DebuggerEditorImpl.this, true);
}
});
}
DataContext dataContext = DataManager.getInstance().getDataContext(this);
return JBPopupFactory.getInstance().createActionGroupPopup("Choose language", actions, dataContext,
JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
false);
}
示例4: getSupportedLanguages
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<Language> getSupportedLanguages(@NotNull Project project, @Nullable XSourcePosition sourcePosition)
{
if(sourcePosition != null)
{
PsiElement context = getContextElement(sourcePosition.getFile(), sourcePosition.getOffset(), project);
Collection<Language> res = new ArrayList<Language>();
for(CodeFragmentFactory factory : DebuggerUtilsEx.getCodeFragmentFactories(context))
{
res.add(factory.getFileType().getLanguage());
}
return res;
}
return Collections.emptyList();
}
示例5: getSupportedLanguages
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<Language> getSupportedLanguages(@NotNull Project project, @Nullable XSourcePosition sourcePosition) {
if (sourcePosition != null) {
PsiElement context = getContextElement(sourcePosition.getFile(), sourcePosition.getOffset(), project);
Collection<Language> res = new ArrayList<Language>();
for (CodeFragmentFactory factory : DebuggerUtilsEx.getCodeFragmentFactories(context)) {
res.add(factory.getFileType().getLanguage());
}
return res;
}
return Collections.emptyList();
}
示例6: findAppropriateFactory
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
@NotNull
private static CodeFragmentFactory findAppropriateFactory(@NotNull TextWithImports text, @Nullable PsiElement context) {
for (CodeFragmentFactory factory : DebuggerUtilsEx.getCodeFragmentFactories(context)) {
if (factory.getFileType().equals(text.getFileType())) {
return factory;
}
}
return DefaultCodeFragmentFactory.getInstance();
}
示例7: setContext
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
public void setContext(@Nullable PsiElement context) {
myContext = context;
List<CodeFragmentFactory> factories = DebuggerUtilsEx.getCodeFragmentFactories(context);
boolean many = factories.size() > 1;
if (myInitialFactory) {
myInitialFactory = false;
setFactory(factories.get(0));
myChooseFactory.setVisible(many);
}
myChooseFactory.setVisible(myChooseFactory.isVisible() || many);
myChooseFactory.setEnabled(many && factories.contains(myFactory));
updateEditorUi();
}
示例8: findAppropriateFactory
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
@NotNull
public static CodeFragmentFactory findAppropriateFactory(@NotNull TextWithImports text, @NotNull PsiElement context) {
for (CodeFragmentFactory factory : DebuggerUtilsEx.getCodeFragmentFactories(context)) {
if (factory.getFileType().equals(text.getFileType())) {
return factory;
}
}
return DefaultCodeFragmentFactory.getInstance();
}