mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
converting packaging related parts of javaee facets to artifacts - 3
This commit is contained in:
+3
-1
@@ -15,6 +15,7 @@ import com.intellij.packaging.ui.ArtifactEditorContext;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -26,6 +27,7 @@ import java.util.List;
|
||||
public class ArtifactPackagingElement extends ComplexPackagingElement<ArtifactPackagingElement.ArtifactPackagingElementState> {
|
||||
private final Project myProject;
|
||||
private ArtifactPointer myArtifactPointer;
|
||||
@NonNls public static final String ARTIFACT_NAME_ATTRIBUTE = "artifact-name";
|
||||
|
||||
public ArtifactPackagingElement(@NotNull Project project) {
|
||||
super(ArtifactElementType.ARTIFACT_ELEMENT_TYPE);
|
||||
@@ -125,7 +127,7 @@ public class ArtifactPackagingElement extends ComplexPackagingElement<ArtifactPa
|
||||
public static class ArtifactPackagingElementState {
|
||||
private String myArtifactName;
|
||||
|
||||
@Attribute("artifact-name")
|
||||
@Attribute(ARTIFACT_NAME_ATTRIBUTE)
|
||||
public String getArtifactName() {
|
||||
return myArtifactName;
|
||||
}
|
||||
|
||||
+4
-4
@@ -3,7 +3,6 @@ package com.intellij.packaging.impl.elements;
|
||||
import com.intellij.compiler.ant.Generator;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -11,8 +10,9 @@ import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.packaging.artifacts.ArtifactType;
|
||||
import com.intellij.packaging.elements.*;
|
||||
import com.intellij.packaging.impl.ui.FileCopyPresentation;
|
||||
import com.intellij.packaging.ui.PackagingElementPresentation;
|
||||
import com.intellij.packaging.ui.ArtifactEditorContext;
|
||||
import com.intellij.packaging.ui.PackagingElementPresentation;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -66,7 +66,7 @@ public class FileCopyPackagingElement extends PackagingElement<FileCopyPackaging
|
||||
}
|
||||
|
||||
public String getOutputFileName() {
|
||||
return myRenamedOutputFileName != null ? myRenamedOutputFileName : StringUtil.getShortName(myFilePath, '/');
|
||||
return myRenamedOutputFileName != null ? myRenamedOutputFileName : PathUtil.getFileName(myFilePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,7 +144,7 @@ public class FileCopyPackagingElement extends PackagingElement<FileCopyPackaging
|
||||
}
|
||||
|
||||
public void rename(@NotNull String newName) {
|
||||
myRenamedOutputFileName = newName.equals(StringUtil.getShortName(myFilePath, '/')) ? null : newName;
|
||||
myRenamedOutputFileName = newName.equals(PathUtil.getFileName(myFilePath)) ? null : newName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -5,8 +5,6 @@ import com.intellij.openapi.deployment.DeploymentUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.packaging.impl.artifacts.ArtifactUtil;
|
||||
import com.intellij.packaging.impl.artifacts.PackagingElementProcessor;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
@@ -16,7 +14,10 @@ import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElementFactory;
|
||||
import com.intellij.packaging.elements.PackagingElementResolvingContext;
|
||||
import com.intellij.packaging.impl.artifacts.ArtifactUtil;
|
||||
import com.intellij.packaging.impl.artifacts.PackagingElementProcessor;
|
||||
import com.intellij.packaging.ui.ManifestFileConfiguration;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.Processor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -36,8 +37,8 @@ import java.util.jar.Manifest;
|
||||
public class ManifestFileUtil {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactEditorContextImpl");
|
||||
public static final String MANIFEST_PATH = JarFile.MANIFEST_NAME;
|
||||
public static final String MANIFEST_FILE_NAME = StringUtil.getShortName(MANIFEST_PATH, '/');
|
||||
public static final String MANIFEST_DIR_NAME = StringUtil.getPackageName(MANIFEST_PATH, '/');
|
||||
public static final String MANIFEST_FILE_NAME = PathUtil.getFileName(MANIFEST_PATH);
|
||||
public static final String MANIFEST_DIR_NAME = PathUtil.getParentPath(MANIFEST_PATH);
|
||||
|
||||
@Nullable
|
||||
public static VirtualFile findManifestFile(@NotNull CompositePackagingElement<?> root, PackagingElementResolvingContext context, ArtifactType artifactType) {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.intellij.packaging.impl.ui;
|
||||
|
||||
import com.intellij.ide.projectView.PresentationData;
|
||||
import com.intellij.openapi.compiler.CompilerBundle;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packaging.ui.PackagingElementPresentation;
|
||||
import com.intellij.packaging.ui.PackagingElementWeights;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.ide.projectView.PresentationData;
|
||||
import com.intellij.util.PathUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -26,7 +26,7 @@ public class FileCopyPresentation extends PackagingElementPresentation {
|
||||
private final boolean myIsDirectory;
|
||||
|
||||
public FileCopyPresentation(String filePath, String outputFileName) {
|
||||
mySourceFileName = StringUtil.getShortName(filePath, '/');
|
||||
mySourceFileName = PathUtil.getFileName(filePath);
|
||||
myOutputFileName = outputFileName;
|
||||
|
||||
String parentPath;
|
||||
@@ -37,7 +37,7 @@ public class FileCopyPresentation extends PackagingElementPresentation {
|
||||
myIsDirectory = myFile.isDirectory();
|
||||
}
|
||||
else {
|
||||
parentPath = FileUtil.toSystemDependentName(StringUtil.getPackageName(filePath, '/'));
|
||||
parentPath = FileUtil.toSystemDependentName(PathUtil.getParentPath(filePath));
|
||||
myIsDirectory = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class IdeaProjectManagerImpl extends ProjectManagerImpl {
|
||||
final String fp = canonicalize(filePath);
|
||||
|
||||
final File f = new File(fp);
|
||||
if (fp != null && f.exists() && f.isFile() && !ApplicationManager.getApplication().isHeadlessEnvironment()) {
|
||||
if (fp != null && f.exists() && !ApplicationManager.getApplication().isHeadlessEnvironment()) {
|
||||
final boolean converted = ConversionService.getInstance().convert(fp);
|
||||
if (!converted) {
|
||||
throw new ProcessCanceledException();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.intellij.conversion;
|
||||
|
||||
import org.jdom.Element;
|
||||
import org.jdom.Document;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -13,4 +14,9 @@ public interface ComponentManagerSettings {
|
||||
@Nullable
|
||||
Element getComponentElement(@NotNull @NonNls String componentName);
|
||||
|
||||
@NotNull
|
||||
Element getRootElement();
|
||||
|
||||
@NotNull
|
||||
Document getDocument();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.intellij.conversion;
|
||||
|
||||
import com.intellij.openapi.components.StorageScheme;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
@@ -10,4 +11,21 @@ import java.io.File;
|
||||
public interface ConversionContext {
|
||||
@NotNull
|
||||
File getProjectBaseDir();
|
||||
|
||||
File getProjectFile();
|
||||
|
||||
StorageScheme getStorageScheme();
|
||||
|
||||
File getSettingsBaseDir();
|
||||
|
||||
ProjectSettings getProjectSettings() throws CannotConvertException;
|
||||
|
||||
RunManagerSettings getRunManagerSettings() throws CannotConvertException;
|
||||
|
||||
WorkspaceSettings getWorkspaceSettings() throws CannotConvertException;
|
||||
|
||||
ModuleSettings getModuleSettings(File moduleFile) throws CannotConvertException;
|
||||
|
||||
@NotNull
|
||||
String collapsePath(@NotNull String path);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.intellij.conversion;
|
||||
|
||||
import org.jdom.Element;
|
||||
import org.jdom.Document;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -25,11 +24,8 @@ public interface ModuleSettings extends ComponentManagerSettings {
|
||||
@NotNull
|
||||
Collection<? extends Element> getFacetElements(@NotNull String facetTypeId);
|
||||
|
||||
@NotNull
|
||||
Element getRootElement();
|
||||
|
||||
@NotNull
|
||||
Document getDocument();
|
||||
|
||||
void setModuleType(@NotNull String moduleType);
|
||||
|
||||
@NotNull
|
||||
String expandPath(@NotNull String path);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@ package com.intellij.conversion;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
@@ -26,6 +30,16 @@ public abstract class ProjectConverter {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void postProcess() {
|
||||
}
|
||||
public Collection<File> getAdditionalAffectedFiles() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public void preProcessingFinished() throws CannotConvertException {
|
||||
}
|
||||
|
||||
public void processingFinished() throws CannotConvertException {
|
||||
}
|
||||
|
||||
public void postProcessingFinished() throws CannotConvertException {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
package com.intellij.conversion;
|
||||
|
||||
import org.jdom.Document;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public interface WorkspaceSettings extends ComponentManagerSettings {
|
||||
|
||||
@NotNull
|
||||
Element getRootElement();
|
||||
|
||||
@NotNull
|
||||
Document getDocument();
|
||||
}
|
||||
|
||||
@@ -15,8 +15,10 @@ import java.io.IOException;
|
||||
*/
|
||||
public abstract class ComponentManagerSettingsImpl implements ComponentManagerSettings {
|
||||
protected final SettingsXmlFile mySettingsFile;
|
||||
protected final ConversionContextImpl myContext;
|
||||
|
||||
protected ComponentManagerSettingsImpl(File file, ConversionContextImpl context) throws CannotConvertException {
|
||||
myContext = context;
|
||||
mySettingsFile = context.getOrCreateFile(file);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.intellij.conversion.impl;
|
||||
|
||||
import com.intellij.application.options.PathMacrosImpl;
|
||||
import com.intellij.application.options.ReplacePathToMacroMap;
|
||||
import com.intellij.conversion.*;
|
||||
import com.intellij.ide.highlighter.ProjectFileType;
|
||||
import com.intellij.ide.highlighter.WorkspaceFileType;
|
||||
@@ -8,6 +9,7 @@ import com.intellij.ide.impl.convert.JDomConvertingUtil;
|
||||
import com.intellij.openapi.components.ExpandMacroToPathMap;
|
||||
import com.intellij.openapi.components.StorageScheme;
|
||||
import com.intellij.openapi.module.impl.ModuleManagerImpl;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jdom.Element;
|
||||
@@ -15,7 +17,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
@@ -72,10 +77,7 @@ public class ConversionContextImpl implements ConversionContext {
|
||||
final Element modules = modulesManager.getChild(ModuleManagerImpl.ELEMENT_MODULES);
|
||||
if (modules == null) return new File[0];
|
||||
|
||||
final ExpandMacroToPathMap macros = new ExpandMacroToPathMap();
|
||||
final String projectDir = FileUtil.toSystemIndependentName(myProjectBaseDir.getAbsolutePath());
|
||||
macros.addMacroExpand(PathMacrosImpl.PROJECT_DIR_MACRO_NAME, projectDir);
|
||||
PathMacrosImpl.getInstanceEx().addMacroExpands(macros);
|
||||
final ExpandMacroToPathMap macros = createExpandMacroMap();
|
||||
|
||||
List<File> files = new ArrayList<File>();
|
||||
for (Element module : JDomConvertingUtil.getChildren(modules, ModuleManagerImpl.ELEMENT_MODULE)) {
|
||||
@@ -86,6 +88,35 @@ public class ConversionContextImpl implements ConversionContext {
|
||||
return files.toArray(new File[files.size()]);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String expandPath(@NotNull String path, @NotNull ModuleSettingsImpl moduleSettings) {
|
||||
final ExpandMacroToPathMap map = createExpandMacroMap();
|
||||
final String modulePath = FileUtil.toSystemIndependentName(moduleSettings.getModuleFile().getParentFile().getAbsolutePath());
|
||||
map.addMacroExpand(PathMacrosImpl.MODULE_DIR_MACRO_NAME, modulePath);
|
||||
return map.substitute(path, true, null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String collapsePath(@NotNull String path) {
|
||||
ReplacePathToMacroMap map = new ReplacePathToMacroMap();
|
||||
final String projectDir = FileUtil.toSystemIndependentName(myProjectBaseDir.getAbsolutePath());
|
||||
map.addMacroReplacement(projectDir, PathMacrosImpl.PROJECT_DIR_MACRO_NAME);
|
||||
PathMacrosImpl.getInstanceEx().addMacroReplacements(map);
|
||||
return map.substitute(path, SystemInfo.isFileSystemCaseSensitive, null);
|
||||
}
|
||||
|
||||
private ExpandMacroToPathMap createExpandMacroMap() {
|
||||
final ExpandMacroToPathMap macros = new ExpandMacroToPathMap();
|
||||
final String projectDir = FileUtil.toSystemIndependentName(myProjectBaseDir.getAbsolutePath());
|
||||
macros.addMacroExpand(PathMacrosImpl.PROJECT_DIR_MACRO_NAME, projectDir);
|
||||
PathMacrosImpl.getInstanceEx().addMacroExpands(macros);
|
||||
return macros;
|
||||
}
|
||||
|
||||
public File getSettingsBaseDir() {
|
||||
return mySettingsBaseDir;
|
||||
}
|
||||
|
||||
public File getProjectFile() {
|
||||
return myProjectFile;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@ import com.intellij.conversion.*;
|
||||
import com.intellij.openapi.components.StorageScheme;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
@@ -59,6 +57,26 @@ public class ConversionRunner {
|
||||
return myModuleFileConverter != null && myModuleFileConverter.isConversionNeeded(myContext.getModuleSettings(moduleFile));
|
||||
}
|
||||
|
||||
public Set<File> getAffectedFiles() {
|
||||
Set<File> affectedFiles = new HashSet<File>();
|
||||
if (myProcessProjectFile) {
|
||||
affectedFiles.add(myContext.getProjectFile());
|
||||
}
|
||||
if (myProcessWorkspaceFile) {
|
||||
affectedFiles.add(myContext.getWorkspaceFile());
|
||||
}
|
||||
affectedFiles.addAll(myModulesFilesToProcess);
|
||||
if (myProcessRunConfigurations) {
|
||||
try {
|
||||
affectedFiles.addAll(myContext.getRunManagerSettings().getAffectedFiles());
|
||||
}
|
||||
catch (CannotConvertException ignored) {
|
||||
}
|
||||
}
|
||||
affectedFiles.addAll(myConverter.getAdditionalAffectedFiles());
|
||||
return affectedFiles;
|
||||
}
|
||||
|
||||
public void preProcess() throws CannotConvertException {
|
||||
if (myProcessProjectFile) {
|
||||
myProjectFileConverter.preProcess(myContext.getProjectSettings());
|
||||
@@ -75,25 +93,8 @@ public class ConversionRunner {
|
||||
if (myProcessRunConfigurations) {
|
||||
myRunConfigurationsConverter.preProcess(myContext.getRunManagerSettings());
|
||||
}
|
||||
}
|
||||
|
||||
public List<File> getAffectedFiles() {
|
||||
List<File> affectedFiles = new ArrayList<File>();
|
||||
if (myProcessProjectFile) {
|
||||
affectedFiles.add(myContext.getProjectFile());
|
||||
}
|
||||
if (myProcessWorkspaceFile) {
|
||||
affectedFiles.add(myContext.getWorkspaceFile());
|
||||
}
|
||||
affectedFiles.addAll(myModulesFilesToProcess);
|
||||
if (myProcessRunConfigurations) {
|
||||
try {
|
||||
affectedFiles.addAll(myContext.getRunManagerSettings().getAffectedFiles());
|
||||
}
|
||||
catch (CannotConvertException ignored) {
|
||||
}
|
||||
}
|
||||
return affectedFiles;
|
||||
myConverter.preProcessingFinished();
|
||||
}
|
||||
|
||||
public void process() throws CannotConvertException {
|
||||
@@ -112,6 +113,7 @@ public class ConversionRunner {
|
||||
if (myProcessRunConfigurations) {
|
||||
myRunConfigurationsConverter.process(myContext.getRunManagerSettings());
|
||||
}
|
||||
myConverter.processingFinished();
|
||||
}
|
||||
|
||||
public void postProcess() throws CannotConvertException {
|
||||
@@ -131,7 +133,7 @@ public class ConversionRunner {
|
||||
myRunConfigurationsConverter.postProcess(myContext.getRunManagerSettings());
|
||||
}
|
||||
|
||||
myConverter.postProcess();
|
||||
myConverter.postProcessingFinished();
|
||||
}
|
||||
|
||||
public ConverterProvider getProvider() {
|
||||
|
||||
@@ -56,4 +56,9 @@ public class ModuleSettingsImpl extends ComponentManagerSettingsImpl implements
|
||||
public void setModuleType(@NotNull String moduleType) {
|
||||
getRootElement().setAttribute(ModuleImpl.ELEMENT_TYPE, moduleType);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String expandPath(@NotNull String path) {
|
||||
return myContext.expandPath(path, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,6 +156,16 @@ public class JDomConvertingUtil {
|
||||
return element;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Element findOrCreateComponentElement(@NotNull Element root, @NotNull String componentName) {
|
||||
Element component = findComponent(root, componentName);
|
||||
if (component == null) {
|
||||
component = createComponentElement(componentName);
|
||||
addComponent(root, component);
|
||||
}
|
||||
return component;
|
||||
}
|
||||
|
||||
public static void addComponent(final Element root, final Element component) {
|
||||
String componentName = component.getAttributeValue(NAME_ATTRIBUTE);
|
||||
final Element old = findComponent(root, componentName);
|
||||
|
||||
@@ -102,6 +102,29 @@ public class PathUtil {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getFileName(@NotNull String path) {
|
||||
if (path.length() == 0) {
|
||||
return "";
|
||||
}
|
||||
final char c = path.charAt(path.length() - 1);
|
||||
int end = c == '/' || c == '\\' ? path.length() - 1 : path.length();
|
||||
int start = Math.max(path.lastIndexOf('/', end - 1), path.lastIndexOf('\\', end - 1)) + 1;
|
||||
return path.substring(start, end);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getParentPath(@NotNull String path) {
|
||||
if (path.length() == 0) {
|
||||
return "";
|
||||
}
|
||||
int end = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\'));
|
||||
if (end == path.length() - 1) {
|
||||
end = path.lastIndexOf('/', end - 1);
|
||||
}
|
||||
return end == -1 ? "" : path.substring(0, end);
|
||||
}
|
||||
|
||||
public static String suggestFileName(final String text) {
|
||||
return text.replace(' ', '_')
|
||||
.replace('.', '_')
|
||||
|
||||
@@ -250,7 +250,7 @@ error.project.file.is.corrupted=Project file is corrupted
|
||||
|
||||
title.cannot.convert.project=Cannot Convert Project
|
||||
dialog.title.convert.project=Convert Project
|
||||
label.text.project.has.older.format=<html><body>The project ''{0}'' has an older format and will be converted. You will not be able to open the project by earlier versions of IDEA. <a href="details">Details</a></body></html>
|
||||
label.text.project.has.older.format=<html><body>The project ''{0}'' has an older format and will be converted. You won''t be able to open the project by earlier versions of IDEA. <a href="details">Details</a></body></html>
|
||||
label.text.unlock.read.only.files=The following files are read only. IDEA will unlock them.
|
||||
error.message.cannot.make.files.writable=Cannot make the following files writable:\n{0}
|
||||
label.text.project.was.succesfully.converted.old.version.was.saved.to.0=<html><body>Your project was succesfully converted. \
|
||||
|
||||
+4
-3
@@ -4,6 +4,7 @@
|
||||
|
||||
package com.intellij.testFramework.fixtures.impl;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionProgressIndicator;
|
||||
import com.intellij.ide.highlighter.ProjectFileType;
|
||||
import com.intellij.ide.startup.impl.StartupManagerImpl;
|
||||
import com.intellij.idea.IdeaTestApplication;
|
||||
@@ -32,11 +33,11 @@ import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.EditorListenerTracker;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.builders.ModuleFixtureBuilder;
|
||||
import com.intellij.testFramework.fixtures.HeavyIdeaTestFixture;
|
||||
import com.intellij.codeInsight.completion.CompletionProgressIndicator;
|
||||
import com.intellij.util.PathUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -188,7 +189,7 @@ class HeavyIdeaTestFixtureImpl extends BaseFixture implements HeavyIdeaTestFixtu
|
||||
root = roots[0];
|
||||
}
|
||||
final VirtualFile[] virtualFile = new VirtualFile[1];
|
||||
final VirtualFile dir = VfsUtil.createDirectories(root.getPath() + "/" + StringUtil.getPackageName(relativePath, '/'));
|
||||
final VirtualFile dir = VfsUtil.createDirectories(root.getPath() + "/" + PathUtil.getParentPath(relativePath));
|
||||
|
||||
new WriteCommandAction.Simple(getProject()) {
|
||||
protected void run() throws Throwable {
|
||||
|
||||
+4
-3
@@ -7,8 +7,9 @@ import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.testFramework.fixtures.TempDirTestFixture;
|
||||
import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.testFramework.fixtures.TempDirTestFixture;
|
||||
import com.intellij.util.PathUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -124,8 +125,8 @@ public class LightTempDirTestFixtureImpl extends BaseFixture implements TempDirT
|
||||
|
||||
@NotNull
|
||||
public VirtualFile createFile(String targetPath) {
|
||||
final String path = StringUtil.getPackageName(targetPath, '/');
|
||||
final String name = StringUtil.getShortName(targetPath, '/');
|
||||
final String path = PathUtil.getParentPath(targetPath);
|
||||
final String name = PathUtil.getFileName(targetPath);
|
||||
return ApplicationManager.getApplication().runWriteAction(new Computable<VirtualFile>() {
|
||||
public VirtualFile compute() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user