use of org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryFooter in project freeplane by freeplane.
the class RibbonMenuFooterContributorFactory method getContributor.
/**
*********************************************************************************
* METHODS
*********************************************************************************
*/
/**
*********************************************************************************
* REQUIRED METHODS FOR INTERFACES
*********************************************************************************
*/
public ARibbonContributor getContributor(final Properties attributes) {
String accel = attributes.getProperty("accelerator", null);
final String actionKey = attributes.getProperty("action");
if (actionKey != null) {
if (accel != null) {
if (Compat.isMacOsX()) {
accel = accel.replaceFirst("CONTROL", "META").replaceFirst("control", "meta");
}
builder.getAcceleratorManager().setDefaultAccelerator(actionKey, accel);
}
}
return new ARibbonContributor() {
public String getKey() {
return attributes.getProperty("action");
}
public void contribute(RibbonBuildContext context, ARibbonContributor parent) {
final String key = attributes.getProperty("action");
if (key != null) {
AFreeplaneAction action = context.getBuilder().getMode().getAction(key);
if (action != null) {
String title = ActionUtils.getActionTitle(action);
ResizableIcon icon = ActionUtils.getActionIcon(action);
ActionListener listener = new RibbonActionContributorFactory.RibbonActionListener(action);
final RibbonApplicationMenuEntryFooter entry = new RibbonApplicationMenuEntryFooter(icon, title, listener);
KeyStroke ks = context.getBuilder().getAcceleratorManager().getAccelerator(key);
if (ks != null) {
RichTooltip tip = RibbonActionContributorFactory.getRichTooltip(action, ks);
if (tip != null) {
entry.setActionRichTooltip(tip);
}
}
parent.addChild(entry, new ChildProperties(parseOrderSettings(attributes.getProperty("orderPriority", ""))));
}
}
}
public void addChild(Object child, ChildProperties properties) {
}
};
}
use of org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryFooter in project freeplane by freeplane.
the class RibbonMenuContributorFactory method getContributor.
public ARibbonContributor getContributor(final Properties attributes) {
return new ARibbonContributor() {
private RibbonApplicationMenu menu;
public String getKey() {
return "app_menu";
}
public void contribute(RibbonBuildContext context, ARibbonContributor parent) {
menu = new RibbonApplicationMenu();
context.processChildren(context.getCurrentPath(), this);
parent.addChild(menu, null);
}
public void addChild(Object child, ChildProperties properties) {
if (child instanceof RibbonApplicationMenuEntryFooter) {
menu.addFooterEntry((RibbonApplicationMenuEntryFooter) child);
} else if (child instanceof RibbonApplicationMenuEntryPrimary) {
menu.addMenuEntry((RibbonApplicationMenuEntryPrimary) child);
}
}
};
}
Aggregations