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

Java EverywhereContextType类代码示例

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

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



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

示例1: isEnabled

import com.intellij.codeInsight.template.EverywhereContextType; //导入依赖的package包/类
public boolean isEnabled(TemplateContextType contextType) {
  synchronized (myContextStates) {
    Boolean storedValue = getOwnValue(contextType);
    if (storedValue == null) {
      TemplateContextType baseContextType = contextType.getBaseContextType();
      if (baseContextType != null && !(baseContextType instanceof EverywhereContextType)) {
        return isEnabled(baseContextType);
      }
      return false;
    }
    return storedValue.booleanValue();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:TemplateContext.java


示例2: isEnabled

import com.intellij.codeInsight.template.EverywhereContextType; //导入依赖的package包/类
public boolean isEnabled(TemplateContextType contextType) {
  Boolean storedValue = isEnabledBare(contextType);
  if (storedValue == null) {
    TemplateContextType baseContextType = contextType.getBaseContextType();
    if (baseContextType != null && !(baseContextType instanceof EverywhereContextType)) {
      return isEnabled(baseContextType);
    }
    return false;
  }
  return storedValue.booleanValue();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:TemplateContext.java


示例3: createShortContextPanel

import com.intellij.codeInsight.template.EverywhereContextType; //导入依赖的package包/类
private JPanel createShortContextPanel(final boolean allowNoContexts) {
  JPanel panel = new JPanel(new BorderLayout());

  final JLabel ctxLabel = new JLabel();
  final JLabel change = new JLabel();
  change.setForeground(PlatformColors.BLUE);
  change.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  panel.add(ctxLabel, BorderLayout.CENTER);
  panel.add(change, BorderLayout.EAST);

  final Runnable updateLabel = new Runnable() {
    @Override
    public void run() {
      myExpandByCombo.setEnabled(isExpandableFromEditor());
      updateHighlighter();

      StringBuilder sb = new StringBuilder();
      String oldPrefix = "";
      for (TemplateContextType type : getApplicableContexts()) {
        final TemplateContextType base = type.getBaseContextType();
        String ownName = UIUtil.removeMnemonic(type.getPresentableName());
        String prefix = "";
        if (base != null && !(base instanceof EverywhereContextType)) {
          prefix = UIUtil.removeMnemonic(base.getPresentableName()) + ": ";
          ownName = StringUtil.decapitalize(ownName);
        }
        if (type instanceof EverywhereContextType) {
          ownName = "Other";
        }
        if (sb.length() > 0) {
          sb.append(oldPrefix.equals(prefix) ? ", " : "; ");
        }
        if (!oldPrefix.equals(prefix)) {
          sb.append(prefix);
          oldPrefix = prefix;
        }
        sb.append(ownName);
      }
      final boolean noContexts = sb.length() == 0;
      String contexts = (noContexts ? "No applicable contexts" + (allowNoContexts ? "" : " yet") : "Applicable in " + sb.toString()) + ".  ";
      ctxLabel.setText(StringUtil.first(contexts, 100, true));
      ctxLabel.setForeground(noContexts ? allowNoContexts ? JBColor.GRAY : JBColor.RED : UIUtil.getLabelForeground());
      change.setText(noContexts ? "Define" : "Change");
    }
  };

  new ClickListener() {
    @Override
    public boolean onClick(@NotNull MouseEvent e, int clickCount) {
      if (disposeContextPopup()) return false;

      final JPanel content = createPopupContextPanel(updateLabel, myContext);
      Dimension prefSize = content.getPreferredSize();
      if (myLastSize != null && (myLastSize.width > prefSize.width || myLastSize.height > prefSize.height)) {
        content.setPreferredSize(new Dimension(Math.max(prefSize.width, myLastSize.width), Math.max(prefSize.height, myLastSize.height)));
      }
      myContextPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(content, null).setResizable(true).createPopup();
      myContextPopup.show(new RelativePoint(change, new Point(change.getWidth() , -content.getPreferredSize().height - 10)));
      myContextPopup.addListener(new JBPopupAdapter() {
        @Override
        public void onClosed(LightweightWindowEvent event) {
          myLastSize = content.getSize();
        }
      });
      return true;
    }
  }.installOn(change);

  updateLabel.run();

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


示例4: Generic

import com.intellij.codeInsight.template.EverywhereContextType; //导入依赖的package包/类
public Generic() {
  super("GROOVY", "Groovy", EverywhereContextType.class);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:GroovyTemplateContextType.java


示例5: createShortContextPanel

import com.intellij.codeInsight.template.EverywhereContextType; //导入依赖的package包/类
private JPanel createShortContextPanel(final boolean allowNoContexts) {
  JPanel panel = new JPanel(new BorderLayout());

  final JLabel ctxLabel = new JLabel();
  final JLabel change = new JLabel();
  change.setForeground(PlatformColors.BLUE);
  change.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  panel.add(ctxLabel, BorderLayout.CENTER);
  panel.add(change, BorderLayout.EAST);

  final Runnable updateLabel = new Runnable() {
    @Override
    public void run() {
      StringBuilder sb = new StringBuilder();
      String oldPrefix = "";
      for (TemplateContextType type : getApplicableContexts()) {
        final TemplateContextType base = type.getBaseContextType();
        String ownName = UIUtil.removeMnemonic(type.getPresentableName());
        String prefix = "";
        if (base != null && !(base instanceof EverywhereContextType)) {
          prefix = UIUtil.removeMnemonic(base.getPresentableName()) + ": ";
          ownName = StringUtil.decapitalize(ownName);
        }
        if (type instanceof EverywhereContextType) {
          ownName = "Other";
        }
        if (sb.length() > 0) {
          sb.append(oldPrefix.equals(prefix) ? ", " : "; ");
        }
        if (!oldPrefix.equals(prefix)) {
          sb.append(prefix);
          oldPrefix = prefix;
        }
        sb.append(ownName);
      }
      final boolean noContexts = sb.length() == 0;
      ctxLabel.setText((noContexts ? "No applicable contexts" + (allowNoContexts ? "" : " yet") : "Applicable in " + sb.toString()) + ".  ");
      ctxLabel.setForeground(noContexts ? allowNoContexts ? JBColor.GRAY : JBColor.RED : UIUtil.getLabelForeground());
      change.setText(noContexts ? "Define" : "Change");
    }
  };

  new ClickListener() {
    @Override
    public boolean onClick(MouseEvent e, int clickCount) {
      if (disposeContextPopup()) return false;

      final JPanel content = createPopupContextPanel(updateLabel);
      Dimension prefSize = content.getPreferredSize();
      if (myLastSize != null && (myLastSize.width > prefSize.width || myLastSize.height > prefSize.height)) {
        content.setPreferredSize(new Dimension(Math.max(prefSize.width, myLastSize.width), Math.max(prefSize.height, myLastSize.height)));
      }
      myContextPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(content, null).setResizable(true).createPopup();
      myContextPopup.show(new RelativePoint(change, new Point(change.getWidth() , -content.getPreferredSize().height - 10)));
      myContextPopup.addListener(new JBPopupAdapter() {
        @Override
        public void onClosed(LightweightWindowEvent event) {
          myLastSize = content.getSize();
        }
      });
      return true;
    }
  }.installOn(change);

  updateLabel.run();

  return panel;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:69,代码来源:LiveTemplateSettingsEditor.java


示例6: Generic

import com.intellij.codeInsight.template.EverywhereContextType; //导入依赖的package包/类
protected Generic() {
    super("XQUERY_CODE", "XQuery", EverywhereContextType.class);
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:4,代码来源:XQueryContextType.java


示例7: ANTLRGenericContext

import com.intellij.codeInsight.template.EverywhereContextType; //导入依赖的package包/类
public ANTLRGenericContext() {
	super("ANTLR", "ANTLR", EverywhereContextType.class);
}
 
开发者ID:antlr,项目名称:intellij-plugin-v4,代码行数:4,代码来源:ANTLRGenericContext.java


示例8: File

import com.intellij.codeInsight.template.EverywhereContextType; //导入依赖的package包/类
protected File() {
  super("AsciiDoc", "AsciiDoc file", EverywhereContextType.class);
}
 
开发者ID:asciidoctor,项目名称:asciidoctor-intellij-plugin,代码行数:4,代码来源:AsciiDocTemplateContextType.java


示例9: Generic

import com.intellij.codeInsight.template.EverywhereContextType; //导入依赖的package包/类
protected Generic() {
  super("DYLAN_CODE", "Dylan", EverywhereContextType.class);
}
 
开发者ID:dylan-foundry,项目名称:DeftIDEA,代码行数:4,代码来源:DylanContextType.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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