当前位置: 首页>>代码示例>>Java>>正文


Java IEObjectDescription类代码示例

本文整理汇总了Java中org.eclipse.xtext.resource.IEObjectDescription的典型用法代码示例。如果您正苦于以下问题:Java IEObjectDescription类的具体用法?Java IEObjectDescription怎么用?Java IEObjectDescription使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IEObjectDescription类属于org.eclipse.xtext.resource包,在下文中一共展示了IEObjectDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isAccepted

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@Override
protected boolean isAccepted(IEObjectDescription description) {
	EObject proxyOrInstance = description.getEObjectOrProxy();
	if (proxyOrInstance instanceof TVariable && !proxyOrInstance.eIsProxy()) {
		TVariable type = (TVariable) proxyOrInstance;

		TypeVisibility visibility = checker.isVisible(this.contextResource, type);

		if (!visibility.visibility) {
			this.accessModifierSuggestionStore.put(description.getEObjectURI().toString(),
					visibility.accessModifierSuggestion);
		}

		return visibility.visibility;
	}
	return super.isAccepted(description);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:VisibilityAwareIdentifiableScope.java

示例2: getSingleLocalElementByName

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
/**
 * Returns description for given element, name is assumed to consist of a single segment containing the simple name
 * of the member. If no subScope contains a member with given name, null is returned. In other error cases (no or
 * wrong access, mixed types etc.), {@link IEObjectDescriptionWithError}, and in particular
 * {@link UnionMemberDescriptionWithError}, will be returned.
 */
@Override
protected IEObjectDescription getSingleLocalElementByName(QualifiedName qualifiedName) {
	String name = qualifiedName.getLastSegment();
	TMember member = getOrCreateComposedMember(name);
	if (member == null) { // no such member, no need for "merging" descriptions, there won't be any
		return null;
	}

	if (isErrorPlaceholder(member)) {
		return createComposedMemberDescriptionWithErrors(EObjectDescription.create(member.getName(), member));
	}

	IEObjectDescription description = getCheckedDescription(name, member);

	return description;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:ComposedMemberScope.java

示例3: getItemsComparator

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@Override
@SuppressWarnings({ "rawtypes", "unchecked", "static-access" })
protected Comparator getItemsComparator() {
	return Ordering.natural().nullsLast().from(new Comparator() {

		@Override
		public int compare(final Object o1, final Object o2) {
			if (o1 instanceof IEObjectDescription && o2 instanceof IEObjectDescription) {
				final IEObjectDescription d1 = (IEObjectDescription) o1;
				final IEObjectDescription d2 = (IEObjectDescription) o2;
				final QualifiedName fqn1 = d1.getQualifiedName();
				final QualifiedName fqn2 = d2.getQualifiedName();
				if (null != fqn1 && null != fqn2) {
					return nullToEmpty(fqn1.getLastSegment()).compareToIgnoreCase(
							nullToEmpty(fqn2.getLastSegment()));
				}
			}
			return Objects.hashCode(o1) - Objects.hashCode(o2);
		}
	});
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:OpenTypeSelectionDialog.java

示例4: createScope

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
/**
 * Factory method to produce a scope. The factory pattern allows to bypass the explicit object creation if the
 * produced scope would be empty.
 *
 * @param canLoadFromDescriptionHelper
 *            utility to decide if a resource must be loaded from source or may be loaded from the index.
 */
public static IScope createScope(
		IScope outer,
		ISelectable selectable,
		Predicate<IEObjectDescription> filter,
		EClass type, boolean ignoreCase,
		ResourceSet resourceSet,
		CanLoadFromDescriptionHelper canLoadFromDescriptionHelper,
		IContainer container) {
	if (selectable == null || selectable.isEmpty())
		return outer;
	IScope scope = new UserDataAwareScope(outer, selectable, filter, type, ignoreCase, resourceSet,
			canLoadFromDescriptionHelper,
			container);
	return scope;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:UserDataAwareScope.java

示例5: setupDialog

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
private void setupDialog() {
	browseButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			SingleClassSelectionDialog dialog = singleClassSelectionDialogProvider.get();
			dialog.setInitialPattern(model.getSuperClass().getFullSpecifier());

			dialog.open();

			if (dialog.getReturnCode() == Window.CANCEL) {
				return;
			}

			Object result = dialog.getFirstResult();

			if (result instanceof IEObjectDescription) {
				IEObjectDescription objectDescription = (IEObjectDescription) result;

				URI objectUri = ((IEObjectDescription) result).getEObjectURI();
				model.setSuperClass(
						new ClassifierReference(objectDescription.getQualifiedName(), objectUri));
			}

		}
	});
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:SuperClassComponentProvider.java

示例6: isSignificantChange

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
private boolean isSignificantChange(IResourceDescription.Delta delta) {
	if (delta.haveEObjectDescriptionsChanged()) {
		IResourceDescription newDescription = delta.getNew();
		IResourceDescription oldDescription = delta.getOld();
		if ((newDescription != null) != (oldDescription != null)) {
			return true;
		}
		if (newDescription == null || oldDescription == null) {
			throw new IllegalStateException();
		}
		List<IEObjectDescription> newDescriptions = Lists.newArrayList(newDescription.getExportedObjects());
		List<IEObjectDescription> oldDescriptions = Lists.newArrayList(oldDescription.getExportedObjects());
		if (newDescriptions.size() != oldDescriptions.size()) {
			return true;
		}
		URI resourceURI = delta.getUri();
		for (int i = 0; i < newDescriptions.size(); i++) {
			if (!equalDescriptions(newDescriptions.get(i), oldDescriptions.get(i), resourceURI)) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:25,代码来源:N4JSDirtyStateEditorSupport.java

示例7: getTypes

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
public ArrayList<IEObjectDescription> getTypes(final Extension ext) {
  ArrayList<IEObjectDescription> _xblockexpression = null;
  {
    ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>();
    EList<DataType> _types = ext.getTypes();
    for (final DataType k : _types) {
      res.add(EObjectDescription.create(QualifiedName.create(k.getName()), k));
    }
    EList<Extension> _import = ext.getImport();
    for (final Extension importExtension : _import) {
      EList<DataType> _types_1 = importExtension.getTypes();
      for (final DataType k_1 : _types_1) {
        res.add(EObjectDescription.create(QualifiedName.create(importExtension.getName(), k_1.getName()), k_1));
      }
    }
    _xblockexpression = res;
  }
  return _xblockexpression;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:20,代码来源:OCCIScopeProvider.java

示例8: registerDescription

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void registerDescription(final IResourceDescription description,
		final Map<QualifiedName, Object> target) {

	for (final IEObjectDescription object : description.getExportedObjects()) {
		final QualifiedName lowerCase = object.getName().toLowerCase();
		final Object existing = target.put(lowerCase, description);
		if (existing != null && existing != description) {
			Set<IResourceDescription> set = null;
			if (existing instanceof IResourceDescription) {
				// The linked hash set is the difference comparing to the super class.
				set = Sets.newLinkedHashSetWithExpectedSize(2);
				set.add((IResourceDescription) existing);
			} else {
				set = (Set<IResourceDescription>) existing;
			}
			set.add(description);
			target.put(lowerCase, set);
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:OrderedResourceDescriptionsData.java

示例9: createEObjectDescriptions

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@Override
public boolean createEObjectDescriptions(final EObject eObject, IAcceptor<IEObjectDescription> acceptor) {
	if (getQualifiedNameProvider() == null)
		return false;
	if (eObject instanceof TModule) {
		TModule module = (TModule) eObject;
		internalCreateEObjectDescriptionForRoot(module, acceptor);
		for (Type type : module.getTopLevelTypes()) {
			internalCreateEObjectDescription(type, acceptor);
		}
		for (TVariable variable : module.getVariables()) {
			internalCreateEObjectDescription(variable, acceptor);
		}
	}
	// export is only possible for top-level elements
	return false;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:N4JSResourceDescriptionStrategy.java

示例10: testResolveSuperTypeOfBuiltInType

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@SuppressWarnings("javadoc")
@Test
public void testResolveSuperTypeOfBuiltInType() {
	BuiltInTypeScope scope = BuiltInTypeScope.get(resourceSet);
	IEObjectDescription intDescription = scope.getSingleElement(QualifiedName.create("i18nKey")); // trigger loading
	PrimitiveType intType = (PrimitiveType) intDescription.getEObjectOrProxy();
	PrimitiveType assCompatType = intType.getAssignmentCompatible();
	Assert.assertFalse(assCompatType.eIsProxy());
	Assert.assertEquals("string", assCompatType.getName());
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:BuiltInTypeScopeTest.java

示例11: findLaunchConfig

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
/**
 * Finds a launch configuration with the given name from the current EMF index. The index contains all
 * launch configurations from projects that have the Xtext nature. Launch configurations from projects
 * without the Xtext nature are not found. Use {@link #findLaunchConfig(String, IFile)} in this case.
 *
 * @param name the name of the configuration to find
 * @return the configuration or <code>null</code>
 */
public LaunchConfig findLaunchConfig(String name) {
    Iterable<IEObjectDescription> indexed = index.getExportedObjectsByType(LcDslPackage.eINSTANCE.getLaunchConfig());

    for (IEObjectDescription o : indexed) {
        if (o.getName().getLastSegment().equals(name)) {
            EObject obj = EcoreUtil.resolve(o.getEObjectOrProxy(), rsProvider.get());
            EcoreUtil.resolveAll(obj);
            return (LaunchConfig) obj;
        }
    }
    return null;
}
 
开发者ID:mduft,项目名称:lcdsl,代码行数:21,代码来源:LcDslHelper.java

示例12: getElements

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@Override
public Iterable<IEObjectDescription> getElements(final QualifiedName name) {
	return new Iterable<IEObjectDescription>() {
		@Override
		public Iterator<IEObjectDescription> iterator() {
			getImportedNames().add(name);
			final Iterable<IEObjectDescription> elements = delegate.getElements(name);
			return elements.iterator();
		}
	};
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:12,代码来源:N4JSImportedNamesAdapter.java

示例13: getElements

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@Override
public Iterable<IEObjectDescription> getElements(QualifiedName name) {
	Iterable<IEObjectDescription> parent = super.getElements(name);
	return Iterables.transform(parent, new Function<IEObjectDescription, IEObjectDescription>() {
		@Override
		public IEObjectDescription apply(IEObjectDescription input) {
			return resolve(input);
		}
	});
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:UserDataAwareScope.java

示例14: getAllLocalElements

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@Override
protected Iterable<IEObjectDescription> getAllLocalElements() {
	if (elements == null) {
		elements = createElements();
	}
	return elements.values();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:EnumerableScope.java

示例15: getEObjectOrProxy

import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
/**
 * Returns a reference to the instance with the given qualified name.
 *
 * @return an optional reference.
 */
protected <T extends EObject> T getEObjectOrProxy(QualifiedName qn) {
	IEObjectDescription description = getSingleElement(qn);
	if (description == null)
		throw new IllegalStateException(qn + " is not contained in this scope");
	@SuppressWarnings("unchecked")
	T result = (T) description.getEObjectOrProxy();
	return result;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:EnumerableScope.java


注:本文中的org.eclipse.xtext.resource.IEObjectDescription类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。