/** * @param bindingTables * @param id * @return true if this BT already exists */ private boolean contains(List<MBindingTable> bindingTables, String id) { for (MBindingTable bt : bindingTables) { if (id.equals(bt.getBindingContext().getElementId())) { return true; } } return false; }
private void gatherTables(List<MBindingTable> bindingTables) { for (MBindingTable table : bindingTables) { tables.put(table.getBindingContext().getElementId(), table); keys.addAll(table.getBindings()); } }
/** * @param ctx */ private void gatherContexts(MBindingContext ctx) { if (ctx == null) { return; } contexts.put(ctx.getElementId(), ctx); gatherContexts(ctx.getChildren()); }
private void gatherContexts(MBindingContext ctx) { if (ctx == null) { return; } contexts.put(ctx.getElementId(), ctx); gatherContexts(ctx.getChildren()); } }
private MBindingContext searchContexts(String id, List<MBindingContext> rootContext) { for (MBindingContext context : rootContext) { if (context.getElementId().equals(id)) { return context; } MBindingContext result = searchContexts(id, context.getChildren()); if (result != null) { return result; } } return null; }
private void undefineContext(MBindingContext current) { Context context = contextManager.getContext(current.getElementId()); context.undefine(); }
/** * @param id * @param rootContext * @return */ private MBindingContext searchContexts(String id, List<MBindingContext> rootContext) { for (MBindingContext context : rootContext) { if (context.getElementId().equals(id)) { return context; } MBindingContext result = searchContexts(id, context.getChildren()); if (result != null) { return result; } } return null; } private void defineBindingTable(String id) {
/** * @param id * @param rootContext * @return */ private MBindingContext searchContexts(String id, List<MBindingContext> rootContext) { for (MBindingContext context : rootContext) { if (context.getElementId().equals(id)) { return context; } MBindingContext result = searchContexts(id, context.getChildren()); if (result != null) { return result; } } return null; }
private MBindingTable createTable(MApplication application, String contextId) { MBindingTable table = CommandsFactoryImpl.eINSTANCE.createBindingTable(); table.setBindingContext(getBindingContext(application, contextId)); table.setElementId(contextId); application.getBindingTables().add(table); tables.put(table.getBindingContext().getElementId(), table); return table; }
private void activateContexts(Object me) { if (me instanceof MBindings) { MContext contextModel = (MContext) me; MBindings container = (MBindings) me; List<MBindingContext> bindingContexts = container.getBindingContexts(); IEclipseContext context = contextModel.getContext(); if (context != null && !bindingContexts.isEmpty()) { EContextService cs = context.get(EContextService.class); for (MBindingContext element : bindingContexts) { cs.activateContext(element.getElementId()); } } } if (me instanceof MElementContainer) { @SuppressWarnings("unchecked") List<MUIElement> children = ((MElementContainer<MUIElement>) me).getChildren(); Iterator<MUIElement> i = children.iterator(); while (i.hasNext()) { MUIElement e = i.next(); activateContexts(e); } } }
MBindingContext dialogAndWindow = null; for (MBindingContext c : bindingContexts) { if ("org.eclipse.ui.contexts.dialogAndWindow".equals(c.getElementId())) { //$NON-NLS-1$ dialogAndWindow = c; break;
/** * @param bindingTable */ private void defineBindingTable(MBindingTable bindingTable) { final Context bindingContext = this.contextManager.getContext(bindingTable.getBindingContext().getElementId()); BindingTable table = this.bindingTables.getTable(bindingTable.getBindingContext().getElementId()); if (table == null && bindingContext != null) { table = new BindingTable(bindingContext); this.bindingTables.addTable(table); } for (MKeyBinding binding : bindingTable.getBindings()) { defineBinding(table, bindingContext, binding); } }
/** * @param contextId * @return */ private MBindingTable getMTable(String contextId) { for (MBindingTable bt : application.getBindingTables()) { if (bt.getBindingContext().getElementId().equals(contextId)) { return bt; } } // create a new table if we couldn't find one MBindingTable table = CommandsFactoryImpl.eINSTANCE.createBindingTable(); table.setBindingContext(getBindingContext(contextId)); table.setElementId(contextId); application.getBindingTables().add(table); return table; }
private void defineContexts(MBindingContext parent, MBindingContext current) { if (current.getName() == null || current.getElementId() == null) { logger.error("Binding context name or id is null for: " + current); //$NON-NLS-1$ return; } Context context = contextManager.getContext(current.getElementId()); if (!context.isDefined()) { String localizedName = LocalizationHelper.getLocalized(current.getName(), current, application.getContext()); String localizedDescriptor = LocalizationHelper.getLocalized(current.getDescription(), current, application.getContext()); context.define(localizedName, localizedDescriptor, parent == null ? null : parent.getElementId()); } for (MBindingContext child : current.getChildren()) { defineContexts(current, child); } }
MBindingTable table = null; for (MBindingTable bt : application.getBindingTables()) { if (bt.getBindingContext().getElementId().equals(binding.getContextId())) { table = bt; break;
if (UIEvents.EventTypes.ADD.equals(event.getProperty(UIEvents.EventTags.TYPE)) && newObj instanceof MBindingTable) { MBindingTable bt = (MBindingTable) newObj; final Context bindingContext = this.contextManager.getContext(bt.getBindingContext().getElementId()); if (bindingContext != null) { final BindingTable table = new BindingTable(bindingContext);
final Context bindingContext = this.contextManager.getContext(bt.getBindingContext().getElementId()); BindingTable table = this.bindingTables.getTable(bindingContext.getId()); if (table == null) {