本文整理汇总了Java中org.eclipse.core.expressions.IEvaluationContext.addVariable方法的典型用法代码示例。如果您正苦于以下问题:Java IEvaluationContext.addVariable方法的具体用法?Java IEvaluationContext.addVariable怎么用?Java IEvaluationContext.addVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.expressions.IEvaluationContext
的用法示例。
在下文中一共展示了IEvaluationContext.addVariable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCopyUrl
import org.eclipse.core.expressions.IEvaluationContext; //导入方法依赖的package包/类
@Test
public void testCopyUrl() throws ExecutionException {
// Given
String url = "https://github.com/cchabanois/mesfavoris";
Bookmark bookmark = new Bookmark(new BookmarkId(),
ImmutableMap.of(UrlBookmarkProperties.PROP_URL, url));
IEvaluationContext context = new EvaluationContext(null, new Object());
context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, new StructuredSelection(bookmark));
ExecutionEvent event = new ExecutionEvent(null, new HashMap<>(), null, context);
// When
CopyBookmarkUrlHandler handler = new CopyBookmarkUrlHandler();
executeHandler(handler, event);
// Then
assertEquals(url, getClipboardContents());
}
示例2: createEvaluationContext
import org.eclipse.core.expressions.IEvaluationContext; //导入方法依赖的package包/类
private IEvaluationContext createEvaluationContext( ISelection selection ) {
IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
IEvaluationContext result = new EvaluationContext( null, new Object() );
result.addVariable( ISources.ACTIVE_WORKBENCH_WINDOW_NAME, activeWorkbenchWindow );
result.addVariable( ISources.ACTIVE_CURRENT_SELECTION_NAME, selection );
return result;
}
示例3: createEvaluationContext
import org.eclipse.core.expressions.IEvaluationContext; //导入方法依赖的package包/类
private IEvaluationContext createEvaluationContext( Object editorInput ) {
IWorkbenchWindow activeWorkbenchWindow = workbenchPage.getWorkbenchWindow();
IEvaluationContext result = new EvaluationContext( null, new Object() );
result.addVariable( ISources.ACTIVE_WORKBENCH_WINDOW_NAME, activeWorkbenchWindow );
if( editorInput != null ) {
result.addVariable( ISources.ACTIVE_EDITOR_INPUT_NAME, editorInput );
}
return result;
}
示例4: createEvaluationContext
import org.eclipse.core.expressions.IEvaluationContext; //导入方法依赖的package包/类
private IEvaluationContext createEvaluationContext( IWorkbenchPart activePart ) {
IWorkbenchWindow activeWorkbenchWindow = workbenchPage.getWorkbenchWindow();
IEvaluationContext result = new EvaluationContext( null, new Object() );
result.addVariable( ISources.ACTIVE_WORKBENCH_WINDOW_NAME, activeWorkbenchWindow );
if( activePart != null ) {
result.addVariable( ISources.ACTIVE_PART_NAME, activePart );
}
return result;
}
示例5: getEnabledTextHoverDescriptors
import org.eclipse.core.expressions.IEvaluationContext; //导入方法依赖的package包/类
private List<TextHoverDescriptor> getEnabledTextHoverDescriptors(ITextViewer textViewer, int offset)
{
List<TextHoverDescriptor> result = new ArrayList<TextHoverDescriptor>();
if (fTextEditor == null)
{
return result;
}
try
{
QualifiedContentType contentType = CommonEditorPlugin.getDefault().getDocumentScopeManager()
.getContentType(textViewer.getDocument(), offset);
IEvaluationContext context = new EvaluationContext(null, textViewer);
IWorkbenchPartSite site = fTextEditor.getSite();
if (site != null)
{
context.addVariable(ISources.ACTIVE_EDITOR_ID_NAME, site.getId());
}
for (TextHoverDescriptor descriptor : TextHoverDescriptor.getContributedHovers())
{
if (descriptor.isEnabledFor(contentType, context))
{
result.add(descriptor);
}
}
}
catch (BadLocationException e)
{
}
return result;
}
示例6: createContext
import org.eclipse.core.expressions.IEvaluationContext; //导入方法依赖的package包/类
private IEvaluationContext createContext(Object selection) {
IEvaluationContext context = new EvaluationContext(null, selection);
context.addVariable("selection", selection); //$NON-NLS-1$
return context;
}
示例7: createEvaluationContext
import org.eclipse.core.expressions.IEvaluationContext; //导入方法依赖的package包/类
private IEvaluationContext createEvaluationContext() {
IEvaluationContext result = new EvaluationContext( null, new Object() );
result.addVariable( ACTIVE_WORKBENCH_WINDOW_NAME, workbenchWindow );
return result;
}
示例8: openFilterDialog
import org.eclipse.core.expressions.IEvaluationContext; //导入方法依赖的package包/类
void openFilterDialog() {
final IEvaluationContext ec = new EvaluationContext(null, this);
ec.addVariable(ISources.ACTIVE_PART_NAME, this);
final ExecutionEvent ev = new ExecutionEvent(null, new HashMap<>(), this, ec);
new ConfigureContentsDialogHandler().execute(ev);
}