private void fillViewerInput(final EObject context) { final Set<Parameter> input = new HashSet<Parameter>(); final IExpressionProvider provider = ExpressionEditorService.getInstance() .getExpressionProvider(ExpressionConstants.PARAMETER_TYPE); for (final Expression e : provider.getExpressions(context)) { if (editorInputExpression.isReturnTypeFixed()) { if (compatibleReturnType(editorInputExpression, e)) { input.add((Parameter) e.getReferencedElements().get(0)); } } else { input.add((Parameter) e.getReferencedElements().get(0)); } } viewer.setInput(input); }
@Override public void create() { super.create(); String expressionType = inputExpression.getType(); if (ExpressionConstants.CONSTANT_TYPE.equals(expressionType)) { if (!isSupportedConstantType(inputExpression.getReturnType())) { expressionType = ExpressionConstants.SCRIPT_TYPE; } } IExpressionProvider currentProvider = ExpressionEditorService.getInstance().getExpressionProvider(expressionType); if (currentProvider != null && expressionTypeViewer != null) { expressionTypeViewer.setSelection(new StructuredSelection(currentProvider)); } getShell().layout(true, true); }
protected void showContent(String type) { IExpressionProvider provider = ExpressionEditorService.getInstance().getExpressionProvider(type); Assert.isNotNull(provider); for (Control c : contentComposite.getChildren()) { c.dispose(); } if (currentExpressionEditor != null) { currentExpressionEditor.dispose(); } currentExpressionEditor = provider.getExpressionEditor(inputExpression, context); currentExpressionEditor.setIsPageFlowContext(isPageFlowContext); if (currentExpressionEditor != null) { currentExpressionEditor.createExpressionEditor(contentComposite, isPassword); contentComposite.layout(true, true); if (helpControl != null) { // helpControl.setVisible(currentExpressionEditor.provideDialogTray()); helpControl.setVisible(false); if (currentExpressionEditor.provideDialogTray()) { ToolItem item = ((ToolBar) helpControl).getItem(0); item.setSelection(true); openTrayListener.handleEvent(new Event()); } else if (getTray() != null) { closeTray(); } } if (dataBindingContext != null) { dataBindingContext.dispose(); } dataBindingContext = new EMFDataBindingContext(); UpdateValueStrategy selectionToExpressionType = new UpdateValueStrategy(); IConverter convert = new Converter(IExpressionProvider.class, String.class) { @Override public Object convert(Object arg0) { return ((IExpressionProvider) arg0).getExpressionType(); } }; selectionToExpressionType.setConverter(convert); if (domain != null) { domain .getCommandStack() .execute( SetCommand.create( domain, inputExpression, ExpressionPackage.Literals.EXPRESSION__TYPE, type)); } else { inputExpression.setType(type); } currentExpressionEditor.bindExpression( dataBindingContext, context, inputExpression, viewerTypeFilters, expressionViewer); currentExpressionEditor.addListener( new Listener() { @Override public void handleEvent(Event event) { Button okButton = getButton(OK); if (okButton != null && !okButton.isDisposed()) { okButton.setEnabled(currentExpressionEditor.canFinish()); } } }); DialogSupport.create(this, dataBindingContext); } }