本文整理了Java中org.eclipse.e4.core.contexts.IEclipseContext.set()
方法的一些代码示例,展示了IEclipseContext.set()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IEclipseContext.set()
方法的具体详情如下:
包路径:org.eclipse.e4.core.contexts.IEclipseContext
类名称:IEclipseContext
方法名:set
[英]Sets a value to be associated with a given class in this context.
[中]设置要在此上下文中与给定类关联的值。
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.e4.core.commands
@Override
public void activateHandler(String commandId, Object handler) {
String handlerId = H_ID + commandId;
context.set(handlerId, handler);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt
@PostConstruct
public void init(IEclipseContext context) {
this.cOntext= context;
this.context.set(SHARED_ELEMENTS_STORE, new HashMap
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.e4.core.contexts
/**
* Creates and returns a new empty context.
* @return A new empty context.
*/
static public IEclipseContext create(String name) {
IEclipseContext result = create();
result.set(EclipseContext.DEBUG_STRING, name);
return result;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
private CommandService initializeCommandService(IEclipseContext appContext) {
CommandService service = new CommandService(commandManager, appContext);
appContext.set(ICommandService.class, service);
appContext.set(IUpdateService.class, service);
service.readRegistry();
return service;
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.workbench.renderers.base
private static void populateModelInterfaces(MApplicationElement element, IEclipseContext context, Class>[] interfaces) {
for (Class> intf : interfaces) {
context.set(intf.getName(), element);
populateModelInterfaces(element, context, intf.getInterfaces());
}
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.e4.ui.services
private void deferDeactivateContext(String id) {
@SuppressWarnings("unchecked")
LinkedList
if (locals == null) {
locals = new LinkedList<>();
eclipseContext.set(DEFERED_DEACTIVATES, locals);
}
locals.add(id);
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.workbench.base
private static void populateModelInterfaces(MContext contextModel, IEclipseContext context, Class>[] interfaces) {
for (Class> intf : interfaces) {
context.set(intf.getName(), contextModel);
populateModelInterfaces(contextModel, context, intf.getInterfaces());
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
@Override
public PerspectiveBuilder createPerspectiveBuilder(PerspectiveReader perspReader) {
IEclipseContext childCOntext= context.createChild();
childContext.set(PerspectiveReader.class, perspReader);
return ContextInjectionFactory.make(PerspectiveBuilder.class, childContext);
}
代码示例来源:origin: org.eclipse.e4.ui/bindings
@PostConstruct
public void init(IEclipseContext context) {
ContextManager cOntextManager= context.get(ContextManager.class);
ContextSet.setComparator(new ContextSet.CComp(contextManager));
context.set(BindingTableManager.class,
ContextInjectionFactory.make(BindingTableManager.class, context));
context.set(EBindingService.class.getName(), new BindingServiceCreationFunction());
}
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.keybindings.e4
@SuppressWarnings("static-method")
@PostConstruct
void init(IEclipseContext context) {
ContextManager cOntextManager= context.get(ContextManager.class);
ContextSet.setComparator(new ContextSet.CComp(contextManager));
context.set(BindingTableManager.class, ContextInjectionFactory.make(BindingTableManager.class, context));
context.set(EBindingService.class.getName(), new BindingServiceCreationFunction());
}
}
代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt
public void widgetSelected(SelectionEvent e) {
lclContext.set(MItem.class.getName(), item);
ContextInjectionFactory.invoke(contrib.getObject(),
Execute.class, lclContext);
lclContext.remove(MItem.class.getName());
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.e4.ui.services
@Override
public Object compute(IEclipseContext context, String contextKey) {
EventBroker broker = context.getLocal(EventBroker.class);
if (broker == null) {
broker = ContextInjectionFactory.make(EventBroker.class, context);
context.set(EventBroker.class, broker);
}
return broker;
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.e4.core.commands
@Override
public Object compute(IEclipseContext context, String contextKey) {
if (service == null) {
IEclipseContext root = getRootContext(context);
manager = new CommandManager();
root.set(CommandManager.class.getName(), manager);
service = ContextInjectionFactory.make(CommandServiceImpl.class, root);
}
return service;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
private void handleContextSet(Event event) {
Object element = event.getProperty(UIEvents.EventTags.ELEMENT);
MPart part = getModel();
if (element == part) {
IEclipseContext cOntext= part.getContext();
if (context != null) {
context.set(getClass().getName(), this);
unsubscribe();
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
public void updateShowInSources(MPart part) {
IWorkbenchPart workbenchPart = getWorkbenchPart(part);
ShowInContext cOntext= getContext(workbenchPart);
if (context != null) {
window.getContext().set(ISources.SHOW_IN_INPUT, context.getInput());
window.getContext().set(ISources.SHOW_IN_SELECTION, context.getSelection());
}
}
代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt
public void showPopup(final Event event, final Menu menu,
final MPopupMenu menuModel) {
// System.err.println("showPopup: " + menuModel + "\n\t" + menu);
// we need some context foolery here
final IEclipseContext popupCOntext= menuModel.getContext();
final IEclipseContext parentCOntext= popupContext.getParent();
final IEclipseContext originalChild = parentContext.getActiveChild();
popupContext.activate();
popupContext.set(TMP_ORIGINAL_CONTEXT, originalChild);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.e4.ui.workbench
@Override
public void changeApplicationLocale(Locale locale) {
// the TranslationService.LOCALE context parameter is specified as String
// so we put the String representation of the given Locale to the context
this.application.getContext().set(TranslationService.LOCALE, locale);
// update model
updateLocalization(this.application.getChildren());
// fire event
broker.post(LOCALE_CHANGE, locale);
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.workbench.fx
@Override
public void stop() {
if (this.app != null) {
this.app.getContext().set("__efx_engine_shutdown", Boolean.TRUE); //$NON-NLS-1$
for (MWindow w : this.app.getChildren()) {
ElementRenderer
if (r != null) {
removeGui(w);
}
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt
private void showPopup(final Menu menu, final MPopupMenu menuModel,
MenuManager menuManager) {
// System.err.println("showPopup: " + menuModel + "\n\t" + menu);
// we need some context foolery here
final IEclipseContext popupCOntext= menuModel.getContext();
final IEclipseContext parentCOntext= popupContext.getParent();
final IEclipseContext originalChild = parentContext.getActiveChild();
popupContext.activate();
popupContext.set(MenuManagerRendererFilter.TMP_ORIGINAL_CONTEXT,
originalChild);
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.code.editor.e4
void handlePartDirty(Event
Object element = event.getData();
// TODO remove once we run on Neon See https://bugs.eclipse.org/bugs/show_bug.cgi?id=480934
if( element == null ) {
element = event.getProperties().get(EventTags.ELEMENT);
}
if( element instanceof MContext ) {
((MContext) element).getContext().set(Constants.EDITOR_DIRTY_FLAG_KEY, event.getProperties().get(EventTags.NEW_VALUE));
broker.publish(TOPIC_REQUEST_ENABLEMENT_UPDATE_STRING, UIEvents.ALL_ELEMENT_ID,true);
}
}