Java Code Examples for org.eclipse.core.expressions.IEvaluationContext#addVariable()

The following examples show how to use org.eclipse.core.expressions.IEvaluationContext#addVariable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenWithQuickMenuHandlerPDETest.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example 2
Source File: DeleteEditorFileHandler_ResourcePDETest.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example 3
Source File: DeleteEditorFileHandler_FilePDETest.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example 4
Source File: CloseViewHandlerPDETest.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example 5
Source File: CommonSourceViewerConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example 6
Source File: OpenLaunchDialogHanderPDETest.java    From eclipse-extras with Eclipse Public License 1.0 4 votes vote down vote up
private IEvaluationContext createEvaluationContext() {
  IEvaluationContext result = new EvaluationContext( null, new Object() );
  result.addVariable( ACTIVE_WORKBENCH_WINDOW_NAME, workbenchWindow );
  return result;
}
 
Example 7
Source File: SyntaxErrorsView.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
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);
}