本文整理汇总了Java中org.eclipse.e4.core.contexts.EclipseContextFactory.getServiceContext方法的典型用法代码示例。如果您正苦于以下问题:Java EclipseContextFactory.getServiceContext方法的具体用法?Java EclipseContextFactory.getServiceContext怎么用?Java EclipseContextFactory.getServiceContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.e4.core.contexts.EclipseContextFactory
的用法示例。
在下文中一共展示了EclipseContextFactory.getServiceContext方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runContainerResolverJob
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入方法依赖的package包/类
public static void runContainerResolverJob(IJavaProject javaProject) {
IEclipseContext context = EclipseContextFactory.getServiceContext(
FrameworkUtil.getBundle(BuildPath.class).getBundleContext());
final IEclipseContext childContext =
context.createChild(LibraryClasspathContainerResolverJob.class.getName());
childContext.set(IJavaProject.class, javaProject);
Job job =
ContextInjectionFactory.make(LibraryClasspathContainerResolverJob.class, childContext);
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
childContext.dispose();
}
});
job.schedule();
}
示例2: initProvisioningAgent
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入方法依赖的package包/类
protected void initProvisioningAgent() {
try {
// Inject references
BundleContext bundleContext = FrameworkUtil.getBundle(CheckUpdatesManager.class).getBundleContext();
IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext);
ContextInjectionFactory.inject(this, serviceContext);
// get p2 agent for current system(Eclipse instance in this
// case)
// the location for the currently running system is null (see
// docs)
p2Agent = agentProvider.createAgent(null);
session = new ProvisioningSession(p2Agent);
artifactRepoManager = (IArtifactRepositoryManager) p2Agent
.getService(IArtifactRepositoryManager.class.getName());
metadataRepoManager = (IMetadataRepositoryManager) p2Agent
.getService(IMetadataRepositoryManager.class.getName());
} catch (Exception e) {
System.exit(1);
}
}
示例3: initProvisioningAgent
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入方法依赖的package包/类
protected void initProvisioningAgent() throws RuntimeException {
try {
// Inject references
BundleContext bundleContext = FrameworkUtil.getBundle(UpdateManager.class).getBundleContext();
IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext);
ContextInjectionFactory.inject(this, serviceContext);
// get p2 agent for current system(Eclipse instance in this
// case)
// the location for the currently running system is null (see
// docs)
p2Agent = agentProvider.createAgent(null);
session = new ProvisioningSession(p2Agent);
artifactRepoManager = (IArtifactRepositoryManager) p2Agent
.getService(IArtifactRepositoryManager.class.getName());
metadataRepoManager = (IMetadataRepositoryManager) p2Agent
.getService(IMetadataRepositoryManager.class.getName());
} catch (Exception e) {
throw new RuntimeException(Messages.UpdateManager_14, e);
}
}
示例4: setUp
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入方法依赖的package包/类
/** Set up. */
@Before
public void setUp() {
BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
context = EclipseContextFactory.getServiceContext(bundleContext);
assertNotNull(context);
}
示例5: execute
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入方法依赖的package包/类
@Execute
public void execute() {
TextViewerOperationAction action = null;
Bundle bundle = FrameworkUtil.getBundle(getClass());
BundleContext bundleContext = bundle.getBundleContext();
IEclipseContext context = EclipseContextFactory.getServiceContext(bundleContext);
action = (TextViewerOperationAction) context.get(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
// TextViewerOperationAction action = new TextViewerOperationAction(bundle, prefix, viewer, operationCode);
action.run();
}
示例6: CreateBroker
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入方法依赖的package包/类
public static void CreateBroker(String pluginId) {
Bundle bundle = Platform.getBundle(pluginId);
IEclipseContext eclipseContext = EclipseContextFactory.getServiceContext(bundle.getBundleContext());
eclipseContext.set(org.eclipse.e4.core.services.log.Logger.class, null);
iEventBroker = eclipseContext.get(IEventBroker.class);
}
示例7: CloudScaleProjectWizard
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入方法依赖的package包/类
public CloudScaleProjectWizard() {
super();
IEclipseContext context = EclipseContextFactory
.getServiceContext(Activator.getContext());
ContextInjectionFactory.inject(this, context);
}
示例8: create
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入方法依赖的package包/类
@Override
public Object create() throws CoreException {
BundleContext bundleContext = FrameworkUtil.getBundle(clazz).getBundleContext();
IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext);
return ContextInjectionFactory.make(clazz, serviceContext);
}
示例9: getEclipseContext
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入方法依赖的package包/类
public static IEclipseContext getEclipseContext() {
final IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(FrameworkUtil.getBundle(
Activator.class).getBundleContext());
return serviceContext.get(IWorkbench.class).getApplication().getContext();
}
示例10: ContributedPreferenceNode
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入方法依赖的package包/类
/**
* Create a new ContributedPreferenceNode.
*
* @param id
* the node id
* @param label
* the label used to display the node in the preference dialog's
* tree
* @param imageDescriptor
* the image displayed left of the label in the preference
* dialog's tree, or null if none
* @param pageClass
* the preference page implementation, this class must implement
* {@link IPreferencePage}
* @param path
* the path of the node to which the contributed node should be
* added to
* @param nodeQualifier
* the qualifier used to look up the preference node
*/
public ContributedPreferenceNode(
String id,
String label,
ImageDescriptor imageDescriptor,
Class<? extends IPreferencePage> pageClass,
String path,
String nodeQualifier) {
super(id, label, imageDescriptor, pageClass.getName());
this.path = path;
this.pageClass = pageClass;
this.nodeQualifier = (nodeQualifier != null)
? nodeQualifier : FrameworkUtil.getBundle(pageClass).getSymbolicName();
this.context = EclipseContextFactory.getServiceContext(
FrameworkUtil.getBundle(pageClass).getBundleContext());
this.logger = context.get(LogService.class);
}
示例11: E4ContextRootImpl
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入方法依赖的package包/类
public E4ContextRootImpl(BundleContext bundleContext, String name) {
super(bundleContext, name);
this.eclipseContext = EclipseContextFactory.getServiceContext(bundleContext);
initializeContext(this.eclipseContext);
}