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


Java ClasspathContainerInitializer类代码示例

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


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


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