本文整理匯總了Java中org.eclipse.emf.ecore.util.EcoreUtil.getURI方法的典型用法代碼示例。如果您正苦於以下問題:Java EcoreUtil.getURI方法的具體用法?Java EcoreUtil.getURI怎麽用?Java EcoreUtil.getURI使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.emf.ecore.util.EcoreUtil
的用法示例。
在下文中一共展示了EcoreUtil.getURI方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toValidInstanceOrNull
import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
@Override
protected EObject toValidInstanceOrNull(Resource resource, Predicate<URI> targetURIs, EObject value) {
EObject result = value;
if (result.eIsProxy()) {
URI proxyURI = EcoreUtil.getURI(result);
if (uriEncoder.isCrossLinkFragment(resource, proxyURI.fragment())) {
INode node = uriEncoder.decode(resource, proxyURI.fragment()).getThird();
String string = linkingHelper.getCrossRefNodeAsString(node, true);
if (((TargetURIs) targetURIs).getUserData(TargetURIKey.KEY).isMatchingConcreteSyntax(string)) {
result = resolveInternalProxy(value, resource);
} else {
result = null;
}
} else {
result = resolveInternalProxy(value, resource);
}
}
return result;
}
示例2: getBreakpoints
import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*
* @see org.eclipse.debug.core.model.IThread#getBreakpoints()
*/
public IBreakpoint[] getBreakpoints() {
final List<IBreakpoint> res = new ArrayList<IBreakpoint>();
if (isSuspended()) {
final URI instructionUri = EcoreUtil.getURI(getHost().getTopStackFrame().getCurrentInstruction());
for (IBreakpoint breakpoint : DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(
getModelIdentifier())) {
if (breakpoint instanceof DSLBreakpoint
&& (((DSLBreakpoint)breakpoint).getURI().equals(instructionUri))) {
res.add(breakpoint);
}
}
}
return res.toArray(new IBreakpoint[res.size()]);
}
示例3: getBreakpoint
import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
/**
* Gets the {@link DSLBreakpoint} for the given {@link EObject instruction}.
*
* @param instruction
* the {@link EObject instruction}
* @return the {@link DSLBreakpoint} for the given {@link EObject instruction} if nay, <code>null</code>
* otherwise
*/
protected DSLBreakpoint getBreakpoint(EObject instruction) {
DSLBreakpoint res = null;
IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager()
.getBreakpoints(identifier);
final URI instructionURI = EcoreUtil.getURI(instruction);
for (IBreakpoint breakpoint : breakpoints) {
if (breakpoint instanceof DSLBreakpoint && ((DSLBreakpoint)breakpoint).getURI() != null
&& ((DSLBreakpoint)breakpoint).getURI().equals(instructionURI)) {
res = (DSLBreakpoint)breakpoint;
break;
}
}
return res;
}
示例4: close
import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
@Override
public boolean close ()
{
if ( getReturnCode () == OK )
{
final MasterServer master = getMaster ();
if ( master != null )
{
final URI uri = EcoreUtil.getURI ( master );
if ( uri != null )
{
this.dialogSettings.put ( SETTINGS_LAST_SELECTION, uri.toString () );
}
}
}
return super.close ();
}
示例5: getLocationForEditorInput
import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
/**
* Derives a location URI as expected by {@link TestDiscoveryHelper#collectTests(URI...)} from an editor input.
*/
public static final URI getLocationForEditorInput(IFileEditorInput fileEditorInput) {
if (null == fileEditorInput) {
return null;
}
final XtextEditor editor = getActiveEditor(XtextEditor.class).orNull();
if (null != editor && fileEditorInput.equals(editor.getEditorInput())) {
if (currentThread() == getDefault().getThread()) { // Iff accessed from the UI thread
if (editor.getSelectionProvider().getSelection() instanceof ITextSelection) {
final ITextSelection textSelection = (ITextSelection) editor.getSelectionProvider().getSelection();
final EObject selectedElement = getSelectedElement(editor, textSelection);
if (selectedElement instanceof N4MethodDeclaration) {
final N4MethodDeclaration method = (N4MethodDeclaration) selectedElement;
if (!method.eIsProxy() && TEST_METHOD.hasAnnotation(method)) {
final TModule module = N4JSResource.getModule(method.eResource());
if (null != module) {
return EcoreUtil.getURI(method);
}
}
}
}
}
}
return getFileURI(fileEditorInput);
}
示例6: getNode
import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
@Override
public Node getNode(Object element) {
final String type;
final String name;
final String desc;
if (element instanceof Resource) {
// case: Resource
final URI uri = ((Resource) element).getURI();
type = "Resource";
name = uri != null ? uri.lastSegment() : null;
desc = null;
} else if (element instanceof EObject) {
final EObject eobj = (EObject) element;
if (eobj.eIsProxy()) {
// case: proxy
type = "PROXY(" + eobj.eClass().getName() + ")";
name = null;
desc = "proxy URI:\n" + EcoreUtil.getURI(eobj);
} else {
// case: non-proxy EObject
type = eobj.eClass().getName();
name = getName(eobj);
desc = getDescription(eobj);
}
} else {
// case: any POJO
type = element.getClass().getSimpleName();
name = null;
desc = null;
}
final String title = type + (name != null ? " " + name : "");
return new Node(element, title, desc);
}
示例7: DSLBreakpoint
import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
/**
* Constructor.
*
* @param identifier
* the debug model identifier
* @param instruction
* the {@link EObject} representing the instruction
* @param persistent
* should be persisted
* @throws CoreException
* if marker can't be installed
*/
public DSLBreakpoint(String identifier, EObject instruction, boolean persistent) throws CoreException {
super();
this.identifier = identifier;
this.instructionUri = EcoreUtil.getURI(instruction);
final URI resourceURI = ((EObject)instruction).eResource().getURI();
final String pathString = resourceURI.toPlatformString(true);
final IFile resource = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(pathString));
if (resource != null) {
IWorkspaceRunnable runnable = new CreateMarker(resource, instruction, persistent);
run(getMarkerRule(resource), runnable);
}
}
示例8: addAnnotations
import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*
* @see org.eclipse.debug.ui.IDebugEditorPresentation#addAnnotations(org.eclipse.ui.IEditorPart,
* org.eclipse.debug.core.model.IStackFrame)
*/
public boolean addAnnotations(IEditorPart editorPart, IStackFrame frame) {
if (frame instanceof DSLStackFrameAdapter) {
final EObject instruction = ((DSLStackFrameAdapter)frame).getCurrentInstruction();
final URI instructionUri = EcoreUtil.getURI(instruction);
EMFEditorUtils.selectInstruction(editorPart, instructionUri);
}
return true;
}
示例9: hasBeenActivated
import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
/**
* Tells if the given {@link EObject instruction} is a currently
* {@link IModelAnimator#activate(LogicalStep) activated}.
*
* This service works in a similar way as {@link AbstractGemocDebuggerServices isCurrentInstruction}
* but will be activated even if the engine in not paused in order to act as an animation.
*
* @param instruction
* the {@link EObject instruction}
* @return <code>true</code> if the given {@link EObject instruction} is a
* currently {@link IModelAnimator#activate(LogicalStep) activated},
* <code>false</code> otherwise
*/
public boolean hasBeenActivated(EObject instruction) {
boolean res = false;
final URI uri = EcoreUtil.getURI(instruction);
for (Set<URI> instructions : ANIMATOR.activatedInstructions.values()) {
if (instructions.contains(uri)) {
res = true;
break;
}
}
return res;
}
示例10: getErrorInfoForDanglingEObject
import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
private static final String getErrorInfoForDanglingEObject(EObject base, EReference ref) {
return "in " + base.eClass().getName() + " at " + EcoreUtil.getURI(base) + " via reference " + ref.getName();
}
示例11: createTestCase
import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
private TestCase createTestCase(final TMethod method, final TModule module, final String clazzFqnStr) {
final TestCase testCase = new TestCase(createTestCaseId(clazzFqnStr, method), clazzFqnStr,
module.getProjectId(), method.getName(), method.getName(), EcoreUtil.getURI(method));
return testCase;
}
示例12: getEditorInput
import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
@Override
public IEditorInput getEditorInput(Object element) {
final IEditorInput res;
final URI instructionURI;
if (element instanceof EObject) {
instructionURI = EcoreUtil.getURI((EObject)element);
} else if (element instanceof DSLBreakpoint) {
instructionURI = ((DSLBreakpoint)element).getURI();
} else {
instructionURI = null;
}
editor = null;
if (instructionURI != null) {
final Session session;
final Session inSession;
if (element instanceof EObject) {
inSession = SessionManager.INSTANCE.getSession((EObject)element);
} else {
inSession = null;
}
if (inSession != null) {
session = inSession;
} else {
List<Session> sessions = SiriusEditorUtils.getSessions(instructionURI);
if (sessions.size() > 1) {
session = selectSession(sessions);
} else if (sessions.size() == 1) {
session = sessions.get(0);
} else {
session = null;
}
}
if (session != null) {
List<DRepresentation> representations = SiriusEditorUtils.getRepresentations(session,
instructionURI);
final DRepresentation representation;
if (representations.size() > 1) {
representation = selectRepresentation(representations);
} else if (representations.size() == 1) {
representation = representations.get(0);
} else {
representation = null;
}
if (representation != null) {
editor = DialectUIManager.INSTANCE.openEditor(session, representation,
new NullProgressMonitor());
res = editor.getEditorInput();
} else {
res = super.getEditorInput(instructionURI);
}
} else {
res = super.getEditorInput(instructionURI);
}
} else {
return null;
}
return res;
}