本文整理汇总了Java中com.intellij.openapi.roots.impl.storage.ClassPathStorageUtil类的典型用法代码示例。如果您正苦于以下问题:Java ClassPathStorageUtil类的具体用法?Java ClassPathStorageUtil怎么用?Java ClassPathStorageUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClassPathStorageUtil类属于com.intellij.openapi.roots.impl.storage包,在下文中一共展示了ClassPathStorageUtil类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ClasspathFormatPanel
import com.intellij.openapi.roots.impl.storage.ClassPathStorageUtil; //导入依赖的package包/类
private ClasspathFormatPanel(@NotNull ClasspathStorageProvider[] providers) {
super(new GridBagLayout());
add(new JLabel(ProjectBundle.message("project.roots.classpath.format.label")),
new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 6, 6, 0), 0, 0));
formatIdToDescription.put(ClassPathStorageUtil.DEFAULT_STORAGE, ProjectBundle.message("project.roots.classpath.format.default.descr"));
for (ClasspathStorageProvider provider : providers) {
formatIdToDescription.put(provider.getID(), provider.getDescription());
}
comboBoxClasspathFormat = new ComboBox(formatIdToDescription.values().toArray());
updateClasspathFormat();
add(comboBoxClasspathFormat,
new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 0), 0, 0));
}
示例2: getID
import com.intellij.openapi.roots.impl.storage.ClassPathStorageUtil; //导入依赖的package包/类
@Nullable
static String getID(@NotNull PsiElement place, String alternativeID) {
if (alternativeID != null) {
final Module module = ModuleUtilCore.findModuleForPsiElement(place);
if (module != null) {
if (!ClassPathStorageUtil.isDefaultStorage(module)) {
return alternativeID;
}
}
}
return null;
}
示例3: getResolution
import com.intellij.openapi.roots.impl.storage.ClassPathStorageUtil; //导入依赖的package包/类
@NotNull
@Override
public Resolution getResolution(@NotNull Storage storage, @NotNull StateStorageOperation operation) {
boolean isEffectiveStorage = storage.id().equals(ClassPathStorageUtil.isDefaultStorage(getModule()) ? ClassPathStorageUtil.DEFAULT_STORAGE : ClasspathStorage.SPECIAL_STORAGE);
if (operation == StateStorageOperation.READ) {
return isEffectiveStorage ? Resolution.DO : Resolution.SKIP;
}
else {
// IDEA-133480 Eclipse integration: .iml content is not reduced on setting Dependencies Storage Format = Eclipse
return isEffectiveStorage ? Resolution.DO : (storage.id().equals(ClassPathStorageUtil.DEFAULT_STORAGE) ? Resolution.CLEAR : Resolution.SKIP);
}
}
示例4: selectStorages
import com.intellij.openapi.roots.impl.storage.ClassPathStorageUtil; //导入依赖的package包/类
@Override
public Storage[] selectStorages(Storage[] storages, ModuleRootManagerImpl moduleRootManager, final StateStorageOperation operation) {
final boolean isDefaultStorageType = ClassPathStorageUtil.isDefaultStorage(moduleRootManager.getModule());
final String id = isDefaultStorageType ? ClassPathStorageUtil.DEFAULT_STORAGE: ClasspathStorage.SPECIAL_STORAGE;
for (Storage storage : storages) {
if (storage.id().equals(id)) return new Storage[]{storage};
}
throw new IllegalArgumentException();
}
示例5: moduleRenamed
import com.intellij.openapi.roots.impl.storage.ClassPathStorageUtil; //导入依赖的package包/类
@Override
public void moduleRenamed(final Module module, String newName) {
if (ClassPathStorageUtil.getStorageType(module).equals(JpsEclipseClasspathSerializer.CLASSPATH_STORAGE_ID)) {
try {
final CachedXmlDocumentSet documentSet = getFileCache(module);
final String oldEmlName = module.getName() + EclipseXml.IDEA_SETTINGS_POSTFIX;
final String root = documentSet.getParent(oldEmlName);
final File source = new File(root, oldEmlName);
if (source.exists()) {
final File target = new File(root, newName + EclipseXml.IDEA_SETTINGS_POSTFIX);
FileUtil.rename(source, target);
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(target);
}
final CachedXmlDocumentSet fileCache = getFileCache(module);
DotProjectFileHelper.saveDotProjectFile(module, fileCache.getParent(EclipseXml.PROJECT_FILE));
fileCache.delete(oldEmlName);
fileCache.register(newName + EclipseXml.IDEA_SETTINGS_POSTFIX, ClasspathStorage.getModuleDir(module));
fileCache.load(newName + EclipseXml.IDEA_SETTINGS_POSTFIX);
}
catch (IOException ignore) {
}
catch (JDOMException e) {
}
}
}
示例6: getModuleClasspathFormat
import com.intellij.openapi.roots.impl.storage.ClassPathStorageUtil; //导入依赖的package包/类
@NotNull
private String getModuleClasspathFormat() {
return ClassPathStorageUtil.getStorageType(getModel().getModule());
}
示例7: isEclipseStorage
import com.intellij.openapi.roots.impl.storage.ClassPathStorageUtil; //导入依赖的package包/类
public static boolean isEclipseStorage(@NotNull Module module) {
return JpsEclipseClasspathSerializer.CLASSPATH_STORAGE_ID.equals(ClassPathStorageUtil.getStorageType(module));
}
示例8: getState
import com.intellij.openapi.roots.impl.storage.ClassPathStorageUtil; //导入依赖的package包/类
@Override
public Element getState() {
if (!ClassPathStorageUtil.getStorageType(myModule).equals(JpsEclipseClasspathSerializer.CLASSPATH_STORAGE_ID)) {
if (!myEclipseUrls.isEmpty() || !myEclipseVariablePaths.isEmpty() || myForceConfigureJDK || !myUnknownCons.isEmpty()) {
Element root = new Element("EclipseModuleSettings");
for (String eclipseUrl : myEclipseUrls) {
final Element libElement = new Element(LIBELEMENT);
libElement.setAttribute(VALUE_ATTR, eclipseUrl);
root.addContent(libElement);
}
for (String var : myEclipseVariablePaths.keySet()) {
Element varElement = new Element(VARELEMENT);
if (var.startsWith(SRC_PREFIX)) {
varElement.setAttribute(VAR_ATTRIBUTE, StringUtil.trimStart(var, SRC_PREFIX));
varElement.setAttribute(PREFIX_ATTR, SRC_PREFIX);
} else if (var.startsWith(SRC_LINK_PREFIX)) {
varElement.setAttribute(VAR_ATTRIBUTE, StringUtil.trimStart(var, SRC_LINK_PREFIX));
varElement.setAttribute(PREFIX_ATTR, SRC_LINK_PREFIX);
} else if (var.startsWith(LINK_PREFIX)) {
varElement.setAttribute(VAR_ATTRIBUTE, StringUtil.trimStart(var, LINK_PREFIX));
varElement.setAttribute(PREFIX_ATTR, LINK_PREFIX);
}
else {
varElement.setAttribute(VAR_ATTRIBUTE, var);
}
varElement.setAttribute(VALUE_ATTR, myEclipseVariablePaths.get(var));
root.addContent(varElement);
}
for (String unknownCon : myUnknownCons) {
Element conElement = new Element(CONELEMENT);
conElement.setAttribute(VALUE_ATTR, unknownCon);
root.addContent(conElement);
}
if (myForceConfigureJDK) {
root.setAttribute(FORCED_JDK, String.valueOf(true));
}
final Element srcDescriptionElement = new Element(SRC_DESCRIPTION);
srcDescriptionElement.setAttribute(EXPECTED_POSITION, String.valueOf(myExpectedModuleSourcePlace));
for (String srcUrl : mySrcPlace.keySet()) {
final Element srcFolder = new Element(SRC_FOLDER);
srcFolder.setAttribute(VALUE_ATTR, srcUrl);
srcFolder.setAttribute(EXPECTED_POSITION, mySrcPlace.get(srcUrl).toString());
srcDescriptionElement.addContent(srcFolder);
}
root.addContent(srcDescriptionElement);
return root;
}
}
return null;
}