use of com.intellij.openapi.actionSystem.ex.ComboBoxAction in project android by JetBrains.
the class AllocationsView method getMainActions.
private ActionGroup getMainActions() {
DefaultActionGroup group = new DefaultActionGroup();
group.add(new ComboBoxAction() {
@NotNull
@Override
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
DefaultActionGroup group = new DefaultActionGroup();
group.add(new ChangeGroupAction(GroupByMethod.NAME));
group.add(new ChangeGroupAction(GroupByAllocator.NAME));
return group;
}
@Override
public void update(AnActionEvent e) {
super.update(e);
getTemplatePresentation().setText(myGroupBy.get(myGroupByName).getName());
e.getPresentation().setText(myGroupBy.get(myGroupByName).getName());
}
});
group.add(new EditMultipleSourcesAction());
group.add(new ShowChartAction());
group.add(new Separator());
group.add(new BrowserHelpAction("Hprof Viewer", "http://developer.android.com/r/studio-ui/am-allocation.html"));
return group;
}
use of com.intellij.openapi.actionSystem.ex.ComboBoxAction in project android by JetBrains.
the class AllocationsView method getChartActions.
private ActionGroup getChartActions() {
DefaultActionGroup group = new DefaultActionGroup();
group.add(new ComboBoxAction() {
@NotNull
@Override
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
DefaultActionGroup group = new DefaultActionGroup();
group.add(new AnAction("Sunburst") {
@Override
public void actionPerformed(AnActionEvent e) {
myChartOrientation = "Sunburst";
myLayout.setAngle(360.0f);
}
});
group.add(new AnAction("Layout") {
@Override
public void actionPerformed(AnActionEvent e) {
myChartOrientation = "Layout";
myLayout.setAngle(0.0f);
}
});
return group;
}
@Override
public void update(AnActionEvent e) {
super.update(e);
getTemplatePresentation().setText(myChartOrientation);
e.getPresentation().setText(myChartOrientation);
}
});
group.add(new ComboBoxAction() {
@NotNull
@Override
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
DefaultActionGroup group = new DefaultActionGroup();
group.add(new AnAction("Size") {
@Override
public void actionPerformed(AnActionEvent e) {
myChartUnit = "Size";
myLayout.setUseCount(false);
}
});
group.add(new AnAction("Count") {
@Override
public void actionPerformed(AnActionEvent e) {
myChartUnit = "Count";
myLayout.setUseCount(true);
}
});
return group;
}
@Override
public void update(AnActionEvent e) {
super.update(e);
getTemplatePresentation().setText(myChartUnit);
e.getPresentation().setText(myChartUnit);
}
});
return group;
}
use of com.intellij.openapi.actionSystem.ex.ComboBoxAction in project intellij-community by JetBrains.
the class PerFileConfigurableBase method createValueAction.
@NotNull
protected final AnAction createValueAction(@Nullable Object target, @NotNull Value<T> value) {
return new ComboBoxAction() {
void updateText() {
String text = renderValue(value.get(), StringUtil.notNullize(getNullValueText(target)));
getTemplatePresentation().setText(StringUtil.shortenTextWithEllipsis(text, 40, 0));
}
@Override
public void update(AnActionEvent e) {
updateText();
}
@NotNull
@Override
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
throw new UnsupportedOperationException();
}
@Override
protected ComboBoxButton createComboBoxButton(Presentation presentation) {
return new ComboBoxButton(presentation) {
protected JBPopup createPopup(Runnable onDispose) {
JBPopup popup = createValueEditorPopup(target, value.get(), onDispose, getDataContext(), o -> {
value.set(o);
updateText();
}, value::commit);
popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight()));
return popup;
}
@Nullable
@Override
public String getToolTipText() {
boolean cellEditor = UIUtil.uiParents(this, true).take(4).filter(JBTable.class).first() != null;
return cellEditor ? null : getToolTipFor(value.get());
}
};
}
};
}
Aggregations