當前位置: 首頁>>代碼示例>>Java>>正文


Java IExtension.getUniqueIdentifier方法代碼示例

本文整理匯總了Java中org.eclipse.core.runtime.IExtension.getUniqueIdentifier方法的典型用法代碼示例。如果您正苦於以下問題:Java IExtension.getUniqueIdentifier方法的具體用法?Java IExtension.getUniqueIdentifier怎麽用?Java IExtension.getUniqueIdentifier使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.runtime.IExtension的用法示例。


在下文中一共展示了IExtension.getUniqueIdentifier方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: compare

import org.eclipse.core.runtime.IExtension; //導入方法依賴的package包/類
@Override
public int compare(IExtension o1, IExtension o2) {
	List<String> needs1 = new ArrayList<String>();
	List<String> provides1 = new ArrayList<String>();
	gatherViewDependencies(o1, needs1, provides1);
	List<String> needs2 = new ArrayList<String>();
	List<String> provides2 = new ArrayList<String>();
	gatherViewDependencies(o2, needs2, provides2);
	provides1.retainAll(needs2);
	provides2.retainAll(needs1);
	boolean extension2dependsOnExtension1 = !provides1.isEmpty();
	boolean extension1dependsOnExtension2 = !provides2.isEmpty();
	if (extension2dependsOnExtension1 && extension1dependsOnExtension2) {
		String message = "cyclical dependency between extensions: "; 
		message += o1.getUniqueIdentifier() + " & " + o2.getUniqueIdentifier();
		LogUtil.warn(message);
	} else if (extension1dependsOnExtension2) {
		return -1;
	} else if (extension2dependsOnExtension1) {
		return 1;
	}
	return 0;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:24,代碼來源:ForbiddenWorkbenchUtils.java

示例2: initializeMarkerTypeNames

import org.eclipse.core.runtime.IExtension; //導入方法依賴的package包/類
private static void initializeMarkerTypeNames() {
	IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PT_MARKERS);
	if (point != null) {
		IExtension[] extensions = point.getExtensions();
		for (int i = 0; i < extensions.length; ++i) {
			IExtension ext = extensions[i];
			String id = ext.getUniqueIdentifier();
			String label = ext.getLabel();
			if (label.equals("")) {
				if (id.equals(IMarker.PROBLEM)) {
					label = "Problem";
				} else {
					label = id;
				}
			}
			MARKER_TYPE_LABELS.put(id, label);
		}
	}
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:20,代碼來源:MarkerViolation.java

示例3: getNatureId

import org.eclipse.core.runtime.IExtension; //導入方法依賴的package包/類
/**
 * Given a class implementing a nature, return the id for the
 * nature, as specified in the plugin.xml
 * Returns null if not found.
 * 
 * @param klass
 * @return
 */
public static String getNatureId(Class klass) {
	String className = klass.getCanonicalName();
	IExtensionRegistry registry = Platform.getExtensionRegistry();
	if (registry != null) {
		IExtensionPoint extensionPoint = registry.getExtensionPoint(NATURES_EXTENSION_POINT_ID);
		if (extensionPoint == null) {
			LogUtil.error("can't find extension point with id: " + NATURES_EXTENSION_POINT_ID);
		} else {
			IExtension[] extensions = extensionPoint.getExtensions();
			for (IExtension extension : extensions) {
				for (IConfigurationElement element : extension.getConfigurationElements()) {
					if ("runtime".equals(element.getName())) {
						for (IConfigurationElement runtimeElement : element.getChildren("run")) {
							String runClass = runtimeElement.getAttribute("class");
							if (className.equals(runClass)) {
								String identifier = extension.getUniqueIdentifier();
								return identifier;
							}
						}
					}
				}
			}
			LogUtil.error("couldn't find nature corresponding to: " + className);
		}
	}
	return null;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:36,代碼來源:GenericNature.java

示例4: CompletionProposalCategory

import org.eclipse.core.runtime.IExtension; //導入方法依賴的package包/類
CompletionProposalCategory(IConfigurationElement element, CompletionProposalComputerRegistry registry) throws CoreException {
	fElement= element;
	fRegistry= registry;
	IExtension parent= (IExtension) element.getParent();
	fId= parent.getUniqueIdentifier();
	checkNotNull(fId, "id"); //$NON-NLS-1$
	String name= parent.getLabel();
	if (name == null)
		fName= fId;
	else
		fName= name;
	
	IConfigurationElement[] children= fElement.getChildren(ExpressionTagNames.ENABLEMENT);
	if (children.length == 1) {
		ExpressionConverter parser= ExpressionConverter.getDefault();
		fEnablementExpression = parser.perform(children[0]);
	}
	else {
		fEnablementExpression = null;
	}
	
	String icon= element.getAttribute(ICON);
	ImageDescriptor img= null;
	if (icon != null) {
		Bundle bundle= getBundle();
		if (bundle != null) {
			Path path= new Path(icon);
			URL url= FileLocator.find(bundle, path, null);
			img= ImageDescriptor.createFromURL(url);
		}
	}
	fImage= img;

}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:35,代碼來源:CompletionProposalCategory.java

示例5: accepts

import org.eclipse.core.runtime.IExtension; //導入方法依賴的package包/類
/**
 * Detects whether the target extension is accepted or not.
 * @param extension the target extension
 * @return {@code true} if this accepts the target extension, or otherwise {@code false}
 * @throws InvalidRegistryObjectException if target extension is not valid
 */
public boolean accepts(IExtension extension) {
    String id = extension.getUniqueIdentifier();
    if (id == null) {
        return true;
    }
    Map<String, IExtensionFilter> filters = getExtensionFilters();
    IExtensionFilter filter = filters.get(id);
    if (filter == null) {
        return true;
    }
    return filter.accept(extension);
}
 
開發者ID:asakusafw,項目名稱:asakusafw-shafu,代碼行數:19,代碼來源:ExtensionManager.java

示例6: CompletionProposalComputerDescriptor

import org.eclipse.core.runtime.IExtension; //導入方法依賴的package包/類
/**
 * Creates a new descriptor.
 *
 * @param element the configuration element to read
 * @param registry the computer registry creating this descriptor
 * @param categories the categories
 * @throws InvalidRegistryObjectException if this extension is no longer valid
 * @throws CoreException if the extension contains invalid values
 */
CompletionProposalComputerDescriptor(IConfigurationElement element, CompletionProposalComputerRegistry registry, List<CompletionProposalCategory> categories) throws InvalidRegistryObjectException, CoreException {
	Assert.isLegal(registry != null);
	Assert.isLegal(element != null);

	fRegistry= registry;
	fElement= element;
	IExtension extension= element.getDeclaringExtension();
	fId= extension.getUniqueIdentifier();
	checkNotNull(fId, "id"); //$NON-NLS-1$

	String name= extension.getLabel();
	if (name.length() == 0)
		fName= fId;
	else
		fName= name;

	Set<String> partitions= new HashSet<String>();
	IConfigurationElement[] children= element.getChildren(PARTITION);
	if (children.length == 0) {
		fPartitions= PARTITION_SET; // add to all partition types if no partition is configured
	} else {
		for (int i= 0; i < children.length; i++) {
			String type= children[i].getAttribute(TYPE);
			checkNotNull(type, TYPE);
			partitions.add(type);
		}
		fPartitions= Collections.unmodifiableSet(partitions);
	}

	String activateAttribute= element.getAttribute(ACTIVATE);
	fActivate= Boolean.valueOf(activateAttribute).booleanValue();

	String needsSortingAfterFilteringAttribute= element.getAttribute(NEEDS_SORTING_AFTER_FILTERING);
	fNeedsSortingAfterFiltering= Boolean.valueOf(needsSortingAfterFilteringAttribute).booleanValue();

	fClass= element.getAttribute(CLASS);
	checkNotNull(fClass, CLASS);

	String categoryId= element.getAttribute(CATEGORY_ID);
	if (categoryId == null)
		categoryId= DEFAULT_CATEGORY_ID;
	CompletionProposalCategory category= null;
	for (Iterator<CompletionProposalCategory> it= categories.iterator(); it.hasNext();) {
		CompletionProposalCategory cat= it.next();
		if (cat.getId().equals(categoryId)) {
			category= cat;
			break;
		}
	}
	if (category == null) {
		// create a category if it does not exist
		fCategory= new CompletionProposalCategory(categoryId, fName, registry);
		categories.add(fCategory);
	} else {
		fCategory= category;
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:67,代碼來源:CompletionProposalComputerDescriptor.java


注:本文中的org.eclipse.core.runtime.IExtension.getUniqueIdentifier方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。