List of usage examples for com.intellij.openapi.actionSystem ToggleAction ToggleAction
public ToggleAction(@Nullable @Nls(capitalization = Nls.Capitalization.Title) final String text)
From source file:com.intellij.ide.structureView.newStructureView.StructureViewComponent.java
License:Apache License
public ActionGroup getGearActions() { DefaultActionGroup group = createActionGroup(true); group.addAction(new ToggleAction("Show Toolbar") { @Override//from w w w .j a va 2 s . com public boolean isDumbAware() { return true; } @Override public boolean isSelected(AnActionEvent e) { return getSettings().SHOW_TOOLBAR; } @Override public void setSelected(AnActionEvent e, boolean state) { setToolbar(state ? createToolbar() : null); getSettings().SHOW_TOOLBAR = state; } }).setAsSecondary(true); return group; }
From source file:pl.otros.intellij.JumpToCode.logic.OtrosJumpToCodeApplicationComponent.java
License:Apache License
public OtrosJumpToCodeApplicationComponent() { LOGGER.debug("constructed OtrosJumpToCodeApplicationComponent"); ToggleAction toggleAction = new ToggleAction("OtrosJumpToCode: Enable") { @Override//from ww w . j av a 2 s . co m public boolean isSelected(AnActionEvent anActionEvent) { return config.isEnabled(); } @Override public void setSelected(AnActionEvent anActionEvent, boolean b) { LOGGER.info("Setting enabled OtrosJumpToCode: " + b); config.setEnabled(b); HttpServer.getInstance().configure(config); } @Override public void update(AnActionEvent e) { super.update(e); final boolean selected = this.isSelected(e); LOGGER.info("Updating, selected: " + selected); e.getPresentation().setText("OtrosJumpToCode enabled: " + config.isEnabled()); } }; ActionManager.getInstance().registerAction("OtrosJumpToCode-toggle", toggleAction); }