use of org.eclipse.emf.common.util.URI in project Palladio-Editors-Sirius by PalladioSimulator.
the class NewPalladioProjectWizard method computeTemplatePath.
private URI computeTemplatePath(final AT selectedTemplate) {
final URI templateFolderURI = getRootURI(selectedTemplate).appendSegment(INITIATOR_TEMPLATES_FOLDER);
final String[] segments = URI.createURI(selectedTemplate.getDefaultInstanceURI()).segments();
return templateFolderURI.appendSegments(segments);
}
use of org.eclipse.emf.common.util.URI in project Palladio-Editors-Sirius by PalladioSimulator.
the class ResourceSelectorPage method getResult.
protected EObject getResult(Session session) {
EObject result = null;
URI uri = URI.createURI(path, true);
TransactionalEditingDomain domain = session.getTransactionalEditingDomain();
ResourceSet resourceSet = domain.getResourceSet();
try {
Resource resource = resourceSet.getResource(uri, true);
result = (EObject) resource.getContents().get(0);
} catch (WrappedException ex) {
// do nothing
}
return result;
}
use of org.eclipse.emf.common.util.URI in project xtext-xtend by eclipse.
the class XtendQuickfixProvider method getExceptions.
/**
* @param all but the last element in the issue data is considered to be a URI to an exception type.
*/
protected List<JvmType> getExceptions(String[] issueData, XtextResource resource) {
List<JvmType> exceptions = Lists.newArrayList();
for (int i = 0; i < issueData.length - 1; i++) {
URI exceptionURI = URI.createURI(issueData[i]);
EObject exception = resource.getResourceSet().getEObject(exceptionURI, true);
if (exception instanceof JvmType) {
exceptions.add((JvmType) exception);
}
}
return exceptions;
}
use of org.eclipse.emf.common.util.URI in project xtext-xtend by eclipse.
the class DispatchMethodRenameStrategy method initialize.
@Override
public boolean initialize(EObject xtendMethod, IRenameElementContext context) {
Assert.isLegal(xtendMethod instanceof XtendFunction);
Assert.isLegal(((XtendFunction) xtendMethod).isDispatch());
Assert.isLegal(context instanceof DispatchMethodRenameContext);
ResourceSet resourceSet = xtendMethod.eResource().getResourceSet();
Map<URI, IJavaElement> jvm2JavaElements = ((DispatchMethodRenameContext) context).getJvm2JavaElements();
for (URI dispatchOperationURI : jvm2JavaElements.keySet()) {
JvmOperation dispatchOperation = (JvmOperation) resourceSet.getEObject(dispatchOperationURI, true);
XtendFunction xtendDispatchMethod = associations.getXtendFunction(dispatchOperation);
if (xtendDispatchMethod != null) {
if (equal(xtendDispatchMethod.getName(), dispatchOperation.getSimpleName())) {
// synthetic dispatcher
dispatchers.add(dispatchOperation);
} else {
// xtend dispatch method
XtendDispatchMethodChildStrategy xtendChildStrategy = childStrategyProvider.get();
xtendChildStrategy.initialize(xtendDispatchMethod, context);
children.add(xtendChildStrategy);
}
} else {
// a dispatch method form a Java class
JavaDispatchMethodChildStrategy jvmChildStrategy = javaStrategyProvider.get();
jvmChildStrategy.initialize(dispatchOperation, context);
children.add(jvmChildStrategy);
}
}
return !children.isEmpty();
}
use of org.eclipse.emf.common.util.URI 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