use of org.eclipse.xtext.ui.editor.embedded.IEditedResourceProvider in project xtext-xtend by eclipse.
the class ExtractMethodUserInputPage method createSignaturePreview.
protected void createSignaturePreview(Composite composite) {
Label previewLabel = new Label(composite, SWT.NONE);
previewLabel.setText("Method signature preview:");
GridData gridData = new GridData(SWT.FILL);
gridData.horizontalSpan = 2;
previewLabel.setLayoutData(gridData);
signaturePreview = editorFactory.newEditor(new IEditedResourceProvider() {
@Override
public XtextResource createResource() {
URI resourceURI = EcoreUtil2.getPlatformResourceOrNormalizedURI(refactoring.getXtendClass()).trimFragment();
IProject project = projectUtil.getProject(resourceURI);
ResourceSet resourceSet = resourceSetProvider.get(project);
return (XtextResource) resourceSet.getResource(resourceURI, true);
}
}).readOnly().withParent(composite);
GridData gridData2 = new GridData(GridData.FILL_HORIZONTAL);
gridData2.horizontalSpan = 2;
signaturePreview.getViewer().getControl().setLayoutData(gridData2);
partialEditor = signaturePreview.createPartialEditor(getPartialEditorModelPrefix(), refactoring.getMethodSignature(), getPartialEditorModelSuffix(), true);
}
Aggregations