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


Java NonFocusableCheckBox.addActionListener方法代码示例

本文整理汇总了Java中com.intellij.ui.NonFocusableCheckBox.addActionListener方法的典型用法代码示例。如果您正苦于以下问题:Java NonFocusableCheckBox.addActionListener方法的具体用法?Java NonFocusableCheckBox.addActionListener怎么用?Java NonFocusableCheckBox.addActionListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ui.NonFocusableCheckBox的用法示例。


在下文中一共展示了NonFocusableCheckBox.addActionListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getComponent

import com.intellij.ui.NonFocusableCheckBox; //导入方法依赖的package包/类
@Nullable
protected JComponent getComponent() {
  if (!myCantChangeFinalModifier) {
    myCanBeFinalCb = new NonFocusableCheckBox("Declare final");
    myCanBeFinalCb.setSelected(createFinals());
    myCanBeFinalCb.setMnemonic('f');
    final FinalListener finalListener = new FinalListener(myEditor);
    myCanBeFinalCb.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        new WriteCommandAction(myProject, getCommandName(), getCommandName()) {
          @Override
          protected void run(@NotNull Result result) throws Throwable {
            PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
            final PsiVariable variable = getVariable();
            if (variable != null) {
              finalListener.perform(myCanBeFinalCb.isSelected(), variable);
            }
          }
        }.execute();
      }
    });
  } else {
    return null;
  }
  final JPanel panel = new JPanel(new GridBagLayout());
  panel.setBorder(null);

  if (myCanBeFinalCb != null) {
    panel.add(myCanBeFinalCb, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
  }

  panel.add(Box.createVerticalBox(), new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0,0,0,0), 0,0));

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

示例2: getComponent

import com.intellij.ui.NonFocusableCheckBox; //导入方法依赖的package包/类
@Override
protected JComponent getComponent() {
  myCanBeFinalCb = new NonFocusableCheckBox("Declare final");
  myCanBeFinalCb.setSelected(false);
  myCanBeFinalCb.setMnemonic('f');
  final GrFinalListener finalListener = new GrFinalListener(myEditor);
  myCanBeFinalCb.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      new WriteCommandAction(myProject, getCommandName(), getCommandName()) {
        @Override
        protected void run(@NotNull Result result) throws Throwable {
          PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
          final GrVariable variable = getVariable();
          if (variable != null) {
            finalListener.perform(myCanBeFinalCb.isSelected(), variable);
          }
        }
      }.execute();
    }
  });
  final JPanel panel = new JPanel(new GridBagLayout());
  panel.setBorder(null);

  if (myCanBeFinalCb != null) {
    panel.add(myCanBeFinalCb, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
                                                     new Insets(5, 5, 5, 5), 0, 0));
  }

  panel.add(Box.createVerticalBox(),
            new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

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

示例3: getComponent

import com.intellij.ui.NonFocusableCheckBox; //导入方法依赖的package包/类
@Nullable
protected JComponent getComponent() {
  if (!myCantChangeFinalModifier) {
    myCanBeFinalCb = new NonFocusableCheckBox("Declare final");
    myCanBeFinalCb.setSelected(createFinals());
    myCanBeFinalCb.setMnemonic('f');
    final FinalListener finalListener = new FinalListener(myEditor);
    myCanBeFinalCb.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        new WriteCommandAction(myProject, getCommandName(), getCommandName()) {
          @Override
          protected void run(com.intellij.openapi.application.Result result) throws Throwable {
            PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
            final PsiVariable variable = getVariable();
            if (variable != null) {
              finalListener.perform(myCanBeFinalCb.isSelected(), variable);
            }
          }
        }.execute();
      }
    });
  } else {
    return null;
  }
  final JPanel panel = new JPanel(new GridBagLayout());
  panel.setBorder(null);

  if (myCanBeFinalCb != null) {
    panel.add(myCanBeFinalCb, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
  }

  panel.add(Box.createVerticalBox(), new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0,0,0,0), 0,0));

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

示例4: getComponent

import com.intellij.ui.NonFocusableCheckBox; //导入方法依赖的package包/类
@Nullable
@Override
protected JComponent getComponent() {
  myCanBeFinalCb = new NonFocusableCheckBox("Declare final");
  myCanBeFinalCb.setSelected(false);
  myCanBeFinalCb.setMnemonic('f');
  final GrFinalListener finalListener = new GrFinalListener(myEditor);
  myCanBeFinalCb.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      new WriteCommandAction(myProject, getCommandName(), getCommandName()) {
        @Override
        protected void run(Result result) throws Throwable {
          PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
          final GrVariable variable = getVariable();
          if (variable != null) {
            finalListener.perform(myCanBeFinalCb.isSelected(), variable);
          }
        }
      }.execute();
    }
  });
  final JPanel panel = new JPanel(new GridBagLayout());
  panel.setBorder(null);

  if (myCanBeFinalCb != null) {
    panel.add(myCanBeFinalCb, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
  }

  panel.add(Box.createVerticalBox(), new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0,0,0,0), 0,0));

  return panel;

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:GrInplaceVariableIntroducer.java

示例5: showBalloon

import com.intellij.ui.NonFocusableCheckBox; //导入方法依赖的package包/类
protected void showBalloon() {
  NonFocusableCheckBox checkBox = new NonFocusableCheckBox(RefactoringBundle.message("delegation.panel.delegate.via.overloading.method"));
  checkBox.addActionListener(e -> {
    myDelegate = checkBox.isSelected();
    updateCurrentInfo();
  });
  JPanel content = new JPanel(new BorderLayout());
  content.add(new JBLabel("Performed signature modifications:"), BorderLayout.NORTH);
  content.add(myPreview.getComponent(), BorderLayout.CENTER);
  updateMethodSignature(myStableChange);
  content.add(checkBox, BorderLayout.SOUTH);
  final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(content, null).setSmallVariant(true);
  myBalloon = balloonBuilder.createBalloon();
  myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
  myBalloon.show(new PositionTracker<Balloon>(myEditor.getContentComponent()) {
    @Override
    public RelativePoint recalculateLocation(Balloon object) {
      int offset = myStableChange.getMethod().getTextOffset();
      VisualPosition visualPosition = myEditor.offsetToVisualPosition(offset);
      Point point = myEditor.visualPositionToXY(new VisualPosition(visualPosition.line, visualPosition.column));
      return new RelativePoint(myEditor.getContentComponent(), point);
    }
  }, Balloon.Position.above);
  Disposer.register(myBalloon, () -> {
    EditorFactory.getInstance().releaseEditor(myPreview);
    myPreview = null;
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:29,代码来源:InplaceChangeSignature.java


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