本文整理汇总了Java中org.eclipse.jdt.core.IClasspathContainer.getDescription方法的典型用法代码示例。如果您正苦于以下问题:Java IClasspathContainer.getDescription方法的具体用法?Java IClasspathContainer.getDescription怎么用?Java IClasspathContainer.getDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IClasspathContainer
的用法示例。
在下文中一共展示了IClasspathContainer.getDescription方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleContainerEntry
import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
private IClasspathEntry handleContainerEntry(IPath containerPath, IJavaProject jproject, IPath jarPath) throws JavaModelException {
ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject);
if (initializer == null || container == null) {
setDescription(Messages.format(PreferencesMessages.JavadocConfigurationPropertyPage_invalid_container, BasicElementLabels.getPathLabel(containerPath, false)));
return null;
}
String containerName= container.getDescription();
IStatus status= initializer.getAttributeStatus(containerPath, jproject, IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME);
if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED) {
setDescription(Messages.format(PreferencesMessages.JavadocConfigurationPropertyPage_not_supported, containerName));
return null;
}
IClasspathEntry entry= JavaModelUtil.findEntryInContainer(container, jarPath);
if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY) {
setDescription(Messages.format(PreferencesMessages.JavadocConfigurationPropertyPage_read_only, containerName));
fIsReadOnly= true;
return entry;
}
Assert.isNotNull(entry);
setDescription(PreferencesMessages.JavadocConfigurationPropertyPage_IsPackageFragmentRoot_description);
return entry;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:JavadocConfigurationPropertyPage.java
示例2: handleContainerEntry
import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
private IClasspathEntry handleContainerEntry(IPath containerPath, IJavaProject jproject, IPath jarPath) throws JavaModelException {
ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject);
if (initializer == null || container == null) {
setDescription(Messages.format(PreferencesMessages.NativeLibrariesPropertyPage_invalid_container, BasicElementLabels.getPathLabel(containerPath, false)));
return null;
}
String containerName= container.getDescription();
IStatus status= initializer.getAttributeStatus(containerPath, jproject, JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY);
if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED) {
setDescription(Messages.format(PreferencesMessages.NativeLibrariesPropertyPage_not_supported, containerName));
return null;
}
IClasspathEntry entry= JavaModelUtil.findEntryInContainer(container, jarPath);
if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY) {
setDescription(Messages.format(PreferencesMessages.NativeLibrariesPropertyPage_read_only, containerName));
fIsReadOnly= true;
return entry;
}
Assert.isNotNull(entry);
return entry;
}
示例3: getStyledContainerEntryLabel
import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
/**
* Returns the styled label of a classpath container. The returned label is BiDi-processed with
* {@link TextProcessor#process(String, String)}.
*
* @param containerPath the path of the container
* @param project the project the container is resolved in
* @return the label of the classpath container
* @since 3.4
*/
public static StyledString getStyledContainerEntryLabel(
IPath containerPath, IJavaProject project) {
try {
IClasspathContainer container = JavaCore.getClasspathContainer(containerPath, project);
String description = null;
if (container != null) {
description = container.getDescription();
}
if (description == null) {
ClasspathContainerInitializer initializer =
JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
if (initializer != null) {
description = initializer.getDescription(containerPath, project);
}
}
if (description != null) {
StyledString str = new StyledString(description);
// if (containerPath.segmentCount() > 0 &&
// JavaRuntime.JRE_CONTAINER.equals(containerPath.segment(0))) {
// int index= description.indexOf('[');
// if (index != -1) {
// str.setStyle(index, description.length() - index, DECORATIONS_STYLE);
// }
// }
return Strings.markLTR(str);
}
} catch (JavaModelException e) {
// ignore
}
return new StyledString(BasicElementLabels.getPathLabel(containerPath, false));
}
示例4: getStyledContainerEntryLabel
import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
/**
* Returns the styled label of a classpath container.
* The returned label is BiDi-processed with {@link TextProcessor#process(String, String)}.
*
* @param containerPath the path of the container
* @param project the project the container is resolved in
* @return the label of the classpath container
*
* @since 3.4
*/
public static StyledString getStyledContainerEntryLabel(IPath containerPath, IJavaProject project) {
try {
IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, project);
String description= null;
if (container != null) {
description= container.getDescription();
}
if (description == null) {
ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
if (initializer != null) {
description= initializer.getDescription(containerPath, project);
}
}
if (description != null) {
StyledString str= new StyledString(description);
if (containerPath.segmentCount() > 0 && JavaRuntime.JRE_CONTAINER.equals(containerPath.segment(0))) {
int index= description.indexOf('[');
if (index != -1) {
str.setStyle(index, description.length() - index, DECORATIONS_STYLE);
}
}
return Strings.markLTR(str);
}
} catch (JavaModelException e) {
// ignore
}
return new StyledString(BasicElementLabels.getPathLabel(containerPath, false));
}
示例5: createSourceAttachmentControls
import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
private void createSourceAttachmentControls(Composite composite, IPackageFragmentRoot root) throws JavaModelException {
IClasspathEntry entry;
try {
entry= JavaModelUtil.getClasspathEntry(root);
} catch (JavaModelException ex) {
if (ex.isDoesNotExist())
entry= null;
else
throw ex;
}
IPath containerPath= null;
if (entry == null || root.getKind() != IPackageFragmentRoot.K_BINARY) {
createLabel(composite, Messages.format(JavaEditorMessages.SourceAttachmentForm_message_noSource, BasicElementLabels.getFileName( fFile)));
return;
}
IJavaProject jproject= root.getJavaProject();
boolean canEditEncoding= true;
if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
containerPath= entry.getPath();
ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject);
if (initializer == null || container == null) {
createLabel(composite, Messages.format(JavaEditorMessages.ClassFileEditor_SourceAttachmentForm_cannotconfigure, BasicElementLabels.getPathLabel(containerPath, false)));
return;
}
String containerName= container.getDescription();
IStatus status= initializer.getSourceAttachmentStatus(containerPath, jproject);
if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED) {
createLabel(composite, Messages.format(JavaEditorMessages.ClassFileEditor_SourceAttachmentForm_notsupported, containerName));
return;
}
if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY) {
createLabel(composite, Messages.format(JavaEditorMessages.ClassFileEditor_SourceAttachmentForm_readonly, containerName));
return;
}
IStatus attributeStatus= initializer.getAttributeStatus(containerPath, jproject, IClasspathAttribute.SOURCE_ATTACHMENT_ENCODING);
canEditEncoding= !(attributeStatus.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED || attributeStatus.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY);
entry= JavaModelUtil.findEntryInContainer(container, root.getPath());
Assert.isNotNull(entry);
}
Button button;
IPath path= entry.getSourceAttachmentPath();
if (path == null || path.isEmpty()) {
String rootLabel= JavaElementLabels.getElementLabel(root, JavaElementLabels.ALL_DEFAULT);
createLabel(composite, Messages.format(JavaEditorMessages.SourceAttachmentForm_message_noSourceAttachment, rootLabel));
createLabel(composite, JavaEditorMessages.SourceAttachmentForm_message_pressButtonToAttach);
createLabel(composite, null);
button= createButton(composite, JavaEditorMessages.SourceAttachmentForm_button_attachSource);
} else {
createLabel(composite, Messages.format(JavaEditorMessages.SourceAttachmentForm_message_noSourceInAttachment, BasicElementLabels.getFileName(fFile)));
createLabel(composite, JavaEditorMessages.SourceAttachmentForm_message_pressButtonToChange);
createLabel(composite, null);
button= createButton(composite, JavaEditorMessages.SourceAttachmentForm_button_changeAttachedSource);
}
button.addSelectionListener(getButtonListener(entry, containerPath, jproject, canEditEncoding));
}
示例6: createPageContent
import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
private Control createPageContent(Composite composite) {
try {
fContainerPath= null;
fEntry= null;
fRoot= getJARPackageFragmentRoot();
if (fRoot == null || fRoot.getKind() != IPackageFragmentRoot.K_BINARY) {
return createMessageContent(composite, PreferencesMessages.SourceAttachmentPropertyPage_noarchive_message, null);
}
IPath containerPath= null;
IJavaProject jproject= fRoot.getJavaProject();
IClasspathEntry entry= JavaModelUtil.getClasspathEntry(fRoot);
boolean canEditEncoding= true;
if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
containerPath= entry.getPath();
ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject);
if (initializer == null || container == null) {
return createMessageContent(composite, Messages.format(PreferencesMessages.SourceAttachmentPropertyPage_invalid_container, BasicElementLabels.getPathLabel(containerPath, false)), fRoot);
}
String containerName= container.getDescription();
IStatus status= initializer.getSourceAttachmentStatus(containerPath, jproject);
if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED) {
return createMessageContent(composite, Messages.format(PreferencesMessages.SourceAttachmentPropertyPage_not_supported, containerName), null);
}
if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY) {
return createMessageContent(composite, Messages.format(PreferencesMessages.SourceAttachmentPropertyPage_read_only, containerName), fRoot);
}
IStatus attributeStatus= initializer.getAttributeStatus(containerPath, jproject, IClasspathAttribute.SOURCE_ATTACHMENT_ENCODING);
canEditEncoding= !(attributeStatus.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED || attributeStatus.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY);
entry= JavaModelUtil.findEntryInContainer(container, fRoot.getPath());
}
fContainerPath= containerPath;
fEntry= entry;
fSourceAttachmentBlock= new SourceAttachmentBlock(this, entry, canEditEncoding);
return fSourceAttachmentBlock.createControl(composite);
} catch (CoreException e) {
JavaPlugin.log(e);
return createMessageContent(composite, PreferencesMessages.SourceAttachmentPropertyPage_noarchive_message, null);
}
}