本文整理匯總了Java中org.eclipse.core.runtime.IExtension.getLabel方法的典型用法代碼示例。如果您正苦於以下問題:Java IExtension.getLabel方法的具體用法?Java IExtension.getLabel怎麽用?Java IExtension.getLabel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.runtime.IExtension
的用法示例。
在下文中一共展示了IExtension.getLabel方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseExtension
import org.eclipse.core.runtime.IExtension; //導入方法依賴的package包/類
/**
* Parses the extension's XML data and returns a proxy that now contains the static (=XML) attribute
* values of the extension.
*
* @param extension
* the extension to parse
* @return <i>null</i> on failure to parse
*/
static ValidExtension parseExtension(final IExtension extension) {
String sid = extension.getSimpleIdentifier();
String name = extension.getLabel();
String id = !Strings.isNullOrEmpty(sid.trim()) ? sid : (!Strings.isNullOrEmpty(name.trim()) ? name : "Unknown"); //$NON-NLS-1$
ValidExtension validExtension = new ValidExtension(extension);
try {
validExtension.getTopLevelElements(); // force parsing of first level of element containment
return validExtension;
// CHECKSTYLE:OFF
} catch (Exception e) {
// CHECKSTYLE:ON
final String message = MessageFormat.format(FAILED_TO_LOAD_EXTENSION, new Object[] {ValidExtension.class.getSimpleName(), id,
extension.getNamespaceIdentifier()});
AbstractValidElementBase.logException(e, message);
return null;
}
}
示例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);
}
}
}
示例3: 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;
}
示例4: 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