本文整理汇总了Java中org.eclipse.jdt.core.ClasspathContainerInitializer类的典型用法代码示例。如果您正苦于以下问题:Java ClasspathContainerInitializer类的具体用法?Java ClasspathContainerInitializer怎么用?Java ClasspathContainerInitializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClasspathContainerInitializer类属于org.eclipse.jdt.core包,在下文中一共展示了ClasspathContainerInitializer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: canModifyAccessRules
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
private static boolean canModifyAccessRules(IBinding binding) {
IJavaElement element = binding.getJavaElement();
if (element == null) return false;
IPackageFragmentRoot root = JavaModelUtil.getPackageFragmentRoot(element);
if (root == null) return false;
try {
IClasspathEntry classpathEntry = root.getRawClasspathEntry();
if (classpathEntry == null) return false;
if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) return true;
if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
ClasspathContainerInitializer classpathContainerInitializer =
JavaCore.getClasspathContainerInitializer(classpathEntry.getPath().segment(0));
IStatus status =
classpathContainerInitializer.getAccessRulesStatus(
classpathEntry.getPath(), root.getJavaProject());
return status.isOK();
}
} catch (JavaModelException e) {
return false;
}
return false;
}
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:ReorgCorrectionsSubProcessor.java
示例2: canModifyAccessRules
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
private static boolean canModifyAccessRules(IBinding binding) {
IJavaElement element= binding.getJavaElement();
if (element == null)
return false;
IPackageFragmentRoot root= JavaModelUtil.getPackageFragmentRoot(element);
if (root == null)
return false;
try {
IClasspathEntry classpathEntry= root.getRawClasspathEntry();
if (classpathEntry == null)
return false;
if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY)
return true;
if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
ClasspathContainerInitializer classpathContainerInitializer= JavaCore.getClasspathContainerInitializer(classpathEntry.getPath().segment(0));
IStatus status= classpathContainerInitializer.getAccessRulesStatus(classpathEntry.getPath(), root.getJavaProject());
return status.isOK();
}
} catch (JavaModelException e) {
return false;
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:ReorgCorrectionsSubProcessor.java
示例3: handleContainerEntry
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的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
示例4: handleContainerEntry
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的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;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:NativeLibrariesPropertyPage.java
示例5: evaluateContainerChildStatus
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
private IStatus evaluateContainerChildStatus(CPListElementAttribute attrib) {
if (fProject != null) {
ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(fPath.segment(0));
if (initializer != null && initializer.canUpdateClasspathContainer(fPath, fProject)) {
if (attrib.isBuiltIn()) {
if (CPListElement.SOURCEATTACHMENT.equals(attrib.getKey())) {
return initializer.getSourceAttachmentStatus(fPath, fProject);
} else if (CPListElement.ACCESSRULES.equals(attrib.getKey())) {
return initializer.getAccessRulesStatus(fPath, fProject);
}
} else {
return initializer.getAttributeStatus(fPath, fProject, attrib.getKey());
}
}
return new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY, "", null); //$NON-NLS-1$
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:CPListElement.java
示例6: getContainerEntryLabel
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
/**
* Returns the 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
* @throws JavaModelException when resolving of the container failed
*/
public static String getContainerEntryLabel(IPath containerPath, IJavaProject project) throws JavaModelException {
IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, project);
if (container != null) {
return org.eclipse.jdt.internal.core.manipulation.util.Strings.markLTR(container.getDescription());
}
ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
if (initializer != null) {
return org.eclipse.jdt.internal.core.manipulation.util.Strings.markLTR(initializer.getDescription(containerPath, project));
}
return BasicElementLabels.getPathLabel(containerPath, false);
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:21,代码来源:JavaElementLabels.java
示例7: getContainerEntryLabel
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
/**
* Returns the 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
* @throws JavaModelException when resolving of the container failed
*/
public static String getContainerEntryLabel(IPath containerPath, IJavaProject project)
throws JavaModelException {
IClasspathContainer container = JavaCore.getClasspathContainer(containerPath, project);
if (container != null) {
return Strings.markLTR(container.getDescription());
}
ClasspathContainerInitializer initializer =
JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
if (initializer != null) {
return Strings.markLTR(initializer.getDescription(containerPath, project));
}
return BasicElementLabels.getPathLabel(containerPath, false);
}
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:JavaElementLabels.java
示例8: getStyledContainerEntryLabel
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的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));
}
开发者ID:eclipse,项目名称:che,代码行数:41,代码来源:JavaElementLabels.java
示例9: getContainerEntryLabel
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
/**
* Returns the 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
* @throws JavaModelException when resolving of the container failed
*/
public static String getContainerEntryLabel(IPath containerPath, IJavaProject project) throws JavaModelException {
IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, project);
if (container != null) {
return Strings.markLTR(container.getDescription());
}
ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
if (initializer != null) {
return Strings.markLTR(initializer.getDescription(containerPath, project));
}
return BasicElementLabels.getPathLabel(containerPath, false);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:JavaElementLabels.java
示例10: getStyledContainerEntryLabel
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的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));
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:39,代码来源:JavaElementLabels.java
示例11: getLabel
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
@Override
public String getLabel() {
if (fContainer != null)
return fContainer.getDescription();
IPath path= fClassPathEntry.getPath();
String containerId= path.segment(0);
ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerId);
if (initializer != null) {
String description= initializer.getDescription(path, getJavaProject());
return Messages.format(PackagesMessages.ClassPathContainer_unbound_label, description);
}
return Messages.format(PackagesMessages.ClassPathContainer_unknown_label, BasicElementLabels.getPathLabel(path, false));
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:ClassPathContainer.java
示例12: requestContainerUpdate
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
/**
* Request a container update.
* @param jproject The project of the container
* @param container The container to request a change to
* @param newEntries The updated entries
* @throws CoreException if the request failed
*/
public static void requestContainerUpdate(IJavaProject jproject, IClasspathContainer container, IClasspathEntry[] newEntries) throws CoreException {
IPath containerPath= container.getPath();
IClasspathContainer updatedContainer= new UpdatedClasspathContainer(container, newEntries);
ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
if (initializer != null) {
initializer.requestClasspathContainerUpdate(containerPath, jproject, updatedContainer);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:BuildPathSupport.java
示例13: performOk
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
@Override
public boolean performOk() {
boolean b = super.performOk();
ClasspathContainerInitializer init = JavaCore.getClasspathContainerInitializer(LeJOSEV3LibContainer.ID);
Path p1 = new Path(LeJOSEV3LibContainer.ID+"/"+LeJOSEV3Util.LIBSUBDIR_EV3);
Path p2 = new Path(LeJOSEV3LibContainer.ID+"/"+LeJOSEV3Util.LIBSUBDIR_PC);
IWorkspace ws = ResourcesPlugin.getWorkspace();
IWorkspaceRoot wsr = ws.getRoot();
IProject[] projects = wsr.getProjects();
for (IProject p : projects)
{
try
{
if (p.isOpen() && p.isNatureEnabled(JavaCore.NATURE_ID))
{
IJavaProject jp = JavaCore.create(p);
if (JavaCore.getClasspathContainer(p1, jp) != null)
init.initialize(p1, jp);
if (JavaCore.getClasspathContainer(p2, jp) != null)
init.initialize(p2, jp);
}
}
catch (Exception e)
{
LeJOSEV3Util.log(e);
}
}
return b;
}
开发者ID:JanKoehnlein,项目名称:XRobot,代码行数:33,代码来源:PreferencePage.java
示例14: initializeContainer
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
private IClasspathContainer initializeContainer(IJavaProject project, IPath containerPath)
throws JavaModelException {
ClasspathContainerInitializer initializer =
containerInitializersCache.get(containerPath.segment(0));
IClasspathContainer container = null;
if (initializer != null) {
containerPut(
project,
containerPath,
CONTAINER_INITIALIZATION_IN_PROGRESS); // avoid initialization cycles
try {
initializer.initialize(containerPath, project);
// if (monitor != null)
// monitor.subTask(""); //$NON-NLS-1$
// retrieve value (if initialization was successful)
container = containerBeingInitializedGet(project, containerPath);
if (container == null && containerGet(project, containerPath) == null) {
// initializer failed to do its job: redirect to the failure container
container = initializer.getFailureContainer(containerPath, project);
// if (container == null) {
// if (CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE)
// verbose_container_null_failure_container(project, containerPath,
// initializer);
// return null; // break cycle
// }
// if (CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE)
// verbose_container_using_failure_container(project, containerPath,
// initializer);
containerPut(project, containerPath, container);
}
} catch (CoreException e) {
if (e instanceof JavaModelException) {
throw (JavaModelException) e;
} else {
throw new JavaModelException(e);
}
}
} else {
// create a dummy initializer and get the default failure container
container =
(new ClasspathContainerInitializer() {
public void initialize(IPath path, IJavaProject javaProject) throws CoreException {
// not used
}
})
.getFailureContainer(containerPath, project);
}
return container;
}
开发者ID:eclipse,项目名称:che,代码行数:52,代码来源:JavaModelManager.java
示例15: performFinish
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
@Override
public boolean performFinish() {
if (!super.performFinish())
return false;
IProject newProject = getNewProject();
try {
IProjectDescription description = newProject.getDescription();
String[] newNatures = new String[2];
newNatures[0] = JavaCore.NATURE_ID;
newNatures[1] = ActivitiProjectNature.NATURE_ID;
description.setNatureIds(newNatures);
newProject.setDescription(description, null);
IJavaProject javaProject = JavaCore.create(newProject);
createSourceFolders(newProject);
createOutputLocation(javaProject);
IFile pomFile = newProject.getFile("pom.xml");
InputStream pomSource = new ByteArrayInputStream(createPOMFile().getBytes());
pomFile.create(pomSource, true, null);
pomSource.close();
String[] userLibraryNames = JavaCore.getUserLibraryNames();
boolean activitiExtensionLibraryPresent = false;
if(userLibraryNames != null && userLibraryNames.length > 0) {
for(String userLibraryName : userLibraryNames) {
if(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS.equals(userLibraryName)) {
activitiExtensionLibraryPresent = true;
}
}
}
if(activitiExtensionLibraryPresent == false) {
ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID);
IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID);
initializer.requestClasspathContainerUpdate(containerPath.append(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS),
null, new IClasspathContainer() {
public IPath getPath() {
return new Path(JavaCore.USER_LIBRARY_CONTAINER_ID).append(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS) ;
}
public int getKind() {
return K_APPLICATION;
}
public String getDescription() {
return ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS;
}
public IClasspathEntry[] getClasspathEntries() {
return new IClasspathEntry[] {};
}
});
}
IClasspathEntry[] entries = createClasspathEntries(javaProject);
javaProject.setRawClasspath(entries, null);
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:68,代码来源:CreateActivitiProjectWizard.java
示例16: performFinish
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
@Override
public boolean performFinish() {
if (!super.performFinish())
return false;
IProject newProject = getNewProject();
try {
IProjectDescription description = newProject.getDescription();
String[] newNatures = new String[2];
newNatures[0] = JavaCore.NATURE_ID;
newNatures[1] = ActivitiProjectNature.NATURE_ID;
description.setNatureIds(newNatures);
newProject.setDescription(description, null);
IJavaProject javaProject = JavaCore.create(newProject);
createSourceFolders(newProject);
createOutputLocation(javaProject);
IFile pomFile = newProject.getFile("pom.xml");
InputStream pomSource = new ByteArrayInputStream(createPOMFile().getBytes());
pomFile.create(pomSource, true, null);
pomSource.close();
String[] userLibraryNames = JavaCore.getUserLibraryNames();
boolean activitiExtensionLibraryPresent = false;
if (userLibraryNames != null && userLibraryNames.length > 0) {
for (String userLibraryName : userLibraryNames) {
if (ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS.equals(userLibraryName)) {
activitiExtensionLibraryPresent = true;
}
}
}
if (activitiExtensionLibraryPresent == false) {
ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID);
IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID);
initializer.requestClasspathContainerUpdate(containerPath.append(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS), null, new IClasspathContainer() {
public IPath getPath() {
return new Path(JavaCore.USER_LIBRARY_CONTAINER_ID).append(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS);
}
public int getKind() {
return K_APPLICATION;
}
public String getDescription() {
return ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS;
}
public IClasspathEntry[] getClasspathEntries() {
return new IClasspathEntry[] {};
}
});
}
IClasspathEntry[] entries = createClasspathEntries(javaProject);
javaProject.setRawClasspath(entries, null);
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:70,代码来源:CreateDefaultActivitiProjectWizard.java
示例17: createSourceAttachmentControls
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的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));
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:66,代码来源:ClassFileEditor.java
示例18: createPageContent
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的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);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:45,代码来源:SourceAttachmentPropertyPage.java
示例19: isNotSupported
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
/**
* @return Returns <code>true</code> if the attribute a on a container child and is not supported
*/
public boolean isNotSupported() {
return fStatus != null && fStatus.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:CPListElementAttribute.java
示例20: getClasspathEntryToEdit
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入依赖的package包/类
/**
* Helper method that tests if an classpath entry can be found in a
* container. <code>null</code> is returned if the entry can not be found
* or if the container does not allows the configuration of source
* attachments
* @param jproject The container's parent project
* @param containerPath The path of the container
* @param libPath The path of the library to be found
* @return IClasspathEntry A classpath entry from the container of
* <code>null</code> if the container can not be modified.
* @throws JavaModelException thrown if accessing the container failed
*/
public static IClasspathEntry getClasspathEntryToEdit(IJavaProject jproject, IPath containerPath, IPath libPath) throws JavaModelException {
IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject);
ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
if (container != null && initializer != null && initializer.canUpdateClasspathContainer(containerPath, jproject)) {
return findEntryInContainer(container, libPath);
}
return null; // attachment not possible
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:JavaModelUtil.java
注:本文中的org.eclipse.jdt.core.ClasspathContainerInitializer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论