本文整理汇总了Java中org.eclipse.e4.core.contexts.EclipseContextFactory类的典型用法代码示例。如果您正苦于以下问题:Java EclipseContextFactory类的具体用法?Java EclipseContextFactory怎么用?Java EclipseContextFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EclipseContextFactory类属于org.eclipse.e4.core.contexts包,在下文中一共展示了EclipseContextFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: openResourceEditor
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入依赖的package包/类
public synchronized void openResourceEditor(final IEditorInputResource eir){
if(eir == null){
logger.severe("Can not open editor! Specified editor resource is NULL!");
return;
}
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
IExplorerService explorerService = CloudscaleContext.getGlobalContext().get(IExplorerService.class);
explorerService.setSelection(eir);
IEclipseContext staticContext = EclipseContextFactory.create();
staticContext.set(IEditorInputResource.class, eir);
CommandExecutor.getInstance().execute("eu.cloudscaleproject.env.toolchain.openAlternative", staticContext);
staticContext.dispose();
}
});
}
示例5: createConfigAlternative
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入依赖的package包/类
private void createConfigAlternative()
{
ResourceProvider resourceProvider = ResourceRegistry.getInstance().getResourceProvider(alternative.getProject(), alternative.getTool().getConfig().getID());
IConfigurationElement e = ToolchainExtensions.getInstance().findResourceProviderFactoryElement(alternative.getTool().getConfig().getID());
String wizardCmd = e.getAttribute("wizard");
if (wizardCmd == null)
{
throw new IllegalStateException("Wizard command missing...");
}
IEclipseContext staticContext = EclipseContextFactory.create();
staticContext.set(ResourceProvider.class, resourceProvider);
staticContext.set(IEditorInputResource.class, alternative);
CommandExecutor.getInstance().execute(wizardCmd, staticContext);
}
示例6: ExplorerNode
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入依赖的package包/类
public ExplorerNode(IEclipseContext context, String id, IExplorerNodeChildren children) {
this.id = id;
this.context = EclipseContextFactory.create(this.getClass().getSimpleName() + "("+ id + ")");
if(context != null){
this.context.setParent(context);
CloudscaleContext.inject(this, this.context);
}
if(children != null){
addNodeChildren(children);
}
//retrieve children from extension points
for(IExplorerNodeChildrenProvider childrenProvider : ExplorerExtensions.getInstance().getNodeChildrenProviders()){
if(childrenProvider.canCreate(this)){
addNodeChildren(childrenProvider.create(this));
}
}
}
示例7: setUp
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
image = new Image(device, 1, 1);
languages = new LanguageService(Locale.ENGLISH.getLanguage());
context = EclipseContextFactory.create("test context");
context.set(Logger.class, log);
context.set(IEventBroker.class, eventBroker);
context.set(LanguageService.class, languages);
context.set(IDataService.class, dataService);
context.set(IBrowserManager.class, browserManager);
term1 = data.createTerm("term 1");
term2 = data.createTerm("term 2");
person1 = data.createPerson("person1", "1");
person2 = data.createPerson("person2", "2");
person3 = data.createPerson("person3", "3");
}
示例8: startSimulator
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入依赖的package包/类
public static Object startSimulator(final ExecutionEvent event, final String engineTypeId) {
try {
final SimulationUIService simulationUiService = Objects.requireNonNull(EclipseContextFactory.getServiceContext(FrameworkUtil.getBundle(SimulatorHandlerHelper.class).getBundleContext()).get(SimulationUIService.class), "unable to get simulation UI service");
if(simulationUiService.getCurrentState().getSimulationEngine() != null) {
final MessageBox messageBox = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
messageBox.setMessage("A simulation is already active. Do you want to stop the current simulation?");
messageBox.setText("Stop Current Simulation");
if(messageBox.open() == SWT.NO) {
return null;
}
}
if(event.getApplicationContext() instanceof IEvaluationContext) {
final IEvaluationContext appContext = (IEvaluationContext)event.getApplicationContext();
final ISelection selection = (ISelection)appContext.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
final SimulationLaunchShortcut launchShortcut = new SimulationLaunchShortcut();
launchShortcut.launch(selection, engineTypeId, ILaunchManager.RUN_MODE);
}
} catch(final Exception ex) {
final Status status = new Status(IStatus.ERROR, FrameworkUtil.getBundle(SimulatorHandlerHelper.class).getSymbolicName(), "Error", ex);
StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.LOG);
}
return null;
}
示例9: 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);
}
示例10: 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();
}
示例11: 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);
}
示例12: createDiReader
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入依赖的package包/类
private void createDiReader() {
IEclipseContext staticContext = EclipseContextFactory.create();
staticContext.set("myViewer", tableViewer);
staticContext.set("myList", pluginAuthors);
extensionReader = ContextInjectionFactory.make(ExtensionReader.class,
context, staticContext);
staticContext.dispose();
}
示例13: CloudScaleProjectWizard
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入依赖的package包/类
public CloudScaleProjectWizard() {
super();
IEclipseContext context = EclipseContextFactory
.getServiceContext(Activator.getContext());
ContextInjectionFactory.inject(this, context);
}
示例14: execute
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException {
extractUniversalCount(event); // initialize uArg
// Pass the non-e4 handler so it can be injected into the command if necessary
IEclipseContext ctx = EclipseContextFactory.create();
addToContext(ctx);
return ContextInjectionFactory.invoke(e4cmd, Execute.class, getContext(), ctx, null);
}
示例15: setUp
import org.eclipse.e4.core.contexts.EclipseContextFactory; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
bibTex = new File(FILE_NAME);
context = EclipseContextFactory.create("test context");
context.set(Logger.class, log);
context.set(IDataService.class, data);
}