mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
absolute paths for project by defaukt, module paths are still relative for deps which are outside module dir but inside project
This commit is contained in:
@@ -36,13 +36,13 @@ public class ChunkBuild extends CompositeGenerator{
|
||||
|
||||
final String outputPathUrl = chunk.getOutputDirUrl();
|
||||
String location = outputPathUrl != null?
|
||||
GenerationUtils.toRelativePath(VirtualFileManager.extractPath(outputPathUrl), chunkBaseDir, BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions, !chunk.isSavePathsRelative()) :
|
||||
GenerationUtils.toRelativePath(VirtualFileManager.extractPath(outputPathUrl), chunkBaseDir, BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions) :
|
||||
CompilerBundle.message("value.undefined");
|
||||
add(new Property(BuildProperties.getOutputPathProperty(chunk.getName()), location), 1);
|
||||
|
||||
final String testOutputPathUrl = chunk.getTestsOutputDirUrl();
|
||||
if (testOutputPathUrl != null) {
|
||||
location = GenerationUtils.toRelativePath(VirtualFileManager.extractPath(testOutputPathUrl), chunkBaseDir, BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions, !chunk.isSavePathsRelative());
|
||||
location = GenerationUtils.toRelativePath(VirtualFileManager.extractPath(testOutputPathUrl), chunkBaseDir, BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions);
|
||||
}
|
||||
add(new Property(BuildProperties.getOutputPathForTestsProperty(chunk.getName()), location));
|
||||
|
||||
|
||||
@@ -177,8 +177,7 @@ public class CompileModuleChunkTarget extends CompositeGenerator {
|
||||
composite.add(copy);
|
||||
}
|
||||
final FileSet fileSet = new FileSet(
|
||||
GenerationUtils.toRelativePath(root, baseDir, BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions,
|
||||
!chunk.isSavePathsRelative()));
|
||||
GenerationUtils.toRelativePath(root, baseDir, BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions));
|
||||
fileSet.add(resourcePatternsPatternSet);
|
||||
fileSet.add(filesSelector);
|
||||
if (excludes != null) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.intellij.compiler.ant.taskdefs.Exclude;
|
||||
import com.intellij.compiler.ant.taskdefs.PatternSet;
|
||||
import com.intellij.openapi.compiler.options.ExcludeEntryDescription;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ex.ProjectEx;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
@@ -24,10 +23,9 @@ public class CompilerExcludes extends Generator {
|
||||
compilerConfiguration.getExcludedEntriesConfiguration().getExcludeEntryDescriptions();
|
||||
myPatternSet = new PatternSet(BuildProperties.PROPERTY_COMPILER_EXCLUDES);
|
||||
for (final ExcludeEntryDescription entry : excludeEntryDescriptions) {
|
||||
final boolean relative = project instanceof ProjectEx && ((ProjectEx)project).isSavePathsRelative();
|
||||
final String path = GenerationUtils
|
||||
.toRelativePath(entry.getVirtualFile(), BuildProperties.getProjectBaseDir(project), BuildProperties.getProjectBaseDirProperty(),
|
||||
genOptions, !relative);
|
||||
genOptions);
|
||||
if (path == null) {
|
||||
// entry is invalid, skip it
|
||||
continue;
|
||||
|
||||
+2
-2
@@ -111,7 +111,7 @@ public class LibraryDefinitionsGeneratorFactory {
|
||||
TreeSet<String> visitedPaths = new TreeSet<String>();
|
||||
for (final VirtualFile file : files) {
|
||||
final String path = GenerationUtils
|
||||
.toRelativePath(file, baseDir, BuildProperties.getProjectBaseDirProperty(), genOptions, !project.isSavePathsRelative());
|
||||
.toRelativePath(file, baseDir, BuildProperties.getProjectBaseDirProperty(), genOptions);
|
||||
visitedPaths.add(path);
|
||||
}
|
||||
for (final String path : visitedPaths) {
|
||||
@@ -123,7 +123,7 @@ public class LibraryDefinitionsGeneratorFactory {
|
||||
for (String url : urls) {
|
||||
File file = fileFromUrl(url);
|
||||
final String path = GenerationUtils
|
||||
.toRelativePath(file.getPath(), baseDir, BuildProperties.getProjectBaseDirProperty(), genOptions, !project.isSavePathsRelative());
|
||||
.toRelativePath(file.getPath(), baseDir, BuildProperties.getProjectBaseDirProperty(), genOptions);
|
||||
if (url.startsWith(JarFileSystem.PROTOCOL_PREFIX)) {
|
||||
libraryPath.add(new PathElement(path));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.intellij.compiler.ant.taskdefs.Include;
|
||||
import com.intellij.compiler.ant.taskdefs.PatternSet;
|
||||
import com.intellij.openapi.fileTypes.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ex.ProjectEx;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
@@ -31,10 +30,9 @@ public class LibraryPatterns extends Generator {
|
||||
final List<FileNameMatcher> matchers = FileTypeManager.getInstance().getAssociations(type);
|
||||
for (FileNameMatcher m : matchers) {
|
||||
if (m instanceof ExactFileNameMatcher) {
|
||||
final boolean relative = project instanceof ProjectEx && ((ProjectEx)project).isSavePathsRelative();
|
||||
final String path = GenerationUtils
|
||||
.toRelativePath(m.getPresentableString(), BuildProperties.getProjectBaseDir(project), BuildProperties.getProjectBaseDirProperty(),
|
||||
genOptions, !relative);
|
||||
genOptions);
|
||||
myPatternSet.add(new Include(path));
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -147,8 +147,7 @@ public class ModuleChunkClasspath extends Path {
|
||||
else {
|
||||
final String path = VirtualFileManager.extractPath(url);
|
||||
pathItems.add(new PathElementItem(
|
||||
GenerationUtils.toRelativePath(path, chunk.getBaseDir(), moduleChunkBasedirProperty, genOptions,
|
||||
!chunk.isSavePathsRelative())));
|
||||
GenerationUtils.toRelativePath(path, chunk.getBaseDir(), moduleChunkBasedirProperty, genOptions)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,18 +5,17 @@
|
||||
package com.intellij.compiler.ant;
|
||||
|
||||
import com.intellij.compiler.ant.taskdefs.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.ModuleFileIndex;
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.ModuleFileIndex;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -61,7 +60,7 @@ public class ModuleChunkSourcepath extends CompositeGenerator{
|
||||
final VirtualFile dirSetRoot = getDirSetRoot(contentEntry);
|
||||
|
||||
final String dirSetRootRelativeToBasedir = GenerationUtils
|
||||
.toRelativePath(dirSetRoot, chunk.getBaseDir(), moduleChunkBasedirProperty, genOptions, !module.isSavePathsRelative());
|
||||
.toRelativePath(dirSetRoot, chunk.getBaseDir(), moduleChunkBasedirProperty, genOptions);
|
||||
final DirSet sourcesDirSet = new DirSet(dirSetRootRelativeToBasedir);
|
||||
final DirSet testSourcesDirSet = new DirSet(dirSetRootRelativeToBasedir);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.intellij.compiler.ant;
|
||||
|
||||
import com.intellij.compiler.ant.taskdefs.Import;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
import java.io.File;
|
||||
@@ -20,8 +19,7 @@ public class MultipleFileProjectBuild extends ProjectBuild{
|
||||
final String chunkBuildFile = BuildProperties.getModuleChunkBaseDir(chunk).getPath() + File.separator + BuildProperties.getModuleChunkBuildFileName(chunk) + ".xml";
|
||||
final File projectBaseDir = BuildProperties.getProjectBaseDir(myProject);
|
||||
final String pathToFile = GenerationUtils.toRelativePath(
|
||||
chunkBuildFile, projectBaseDir, BuildProperties.getProjectBaseDirProperty(), genOptions, !chunk.isSavePathsRelative()
|
||||
);
|
||||
chunkBuildFile, projectBaseDir, BuildProperties.getProjectBaseDirProperty(), genOptions);
|
||||
return new Import(pathToFile);
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -4,10 +4,9 @@ import com.intellij.compiler.ant.BuildProperties;
|
||||
import com.intellij.compiler.ant.GenerationOptions;
|
||||
import com.intellij.compiler.ant.GenerationUtils;
|
||||
import com.intellij.compiler.ant.Generator;
|
||||
import com.intellij.compiler.ant.taskdefs.Property;
|
||||
import com.intellij.compiler.ant.taskdefs.Mkdir;
|
||||
import com.intellij.compiler.ant.taskdefs.Property;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ex.ProjectEx;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
@@ -80,8 +79,7 @@ public class ArtifactAntGenerationContextImpl implements ArtifactAntGenerationCo
|
||||
}
|
||||
|
||||
public String getSubstitutedPath(String path) {
|
||||
return GenerationUtils.toRelativePath(path, VfsUtil.virtualToIoFile(myProject.getBaseDir()), BuildProperties.getProjectBaseDirProperty(), myGenerationOptions,
|
||||
((ProjectEx)myProject).isSavePathsRelative());
|
||||
return GenerationUtils.toRelativePath(path, VfsUtil.virtualToIoFile(myProject.getBaseDir()), BuildProperties.getProjectBaseDirProperty(), myGenerationOptions);
|
||||
}
|
||||
|
||||
public void runBeforeCurrentArtifact(Generator generator) {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CompositeBuildTarget extends CompositeGenerator {
|
||||
final String explodedPath = buildConfiguration.getExplodedPath();
|
||||
if (explodedPath != null) {
|
||||
String location = GenerationUtils.toRelativePath(VirtualFileManager.extractPath(explodedPath), moduleBaseDir, baseDirProperty,
|
||||
parameters.getGenerationOptions(), !containingModule.isSavePathsRelative());
|
||||
parameters.getGenerationOptions());
|
||||
add(new Property(parameters.getExplodedPathProperty(), location));
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class CompositeBuildTarget extends CompositeGenerator {
|
||||
|
||||
if (jarPath != null) {
|
||||
String location = GenerationUtils.toRelativePath(VirtualFileManager.extractPath(jarPath), moduleBaseDir, baseDirProperty,
|
||||
parameters.getGenerationOptions(), !containingModule.isSavePathsRelative());
|
||||
parameters.getGenerationOptions());
|
||||
add(new Property(parameters.getJarPathProperty(), location));
|
||||
|
||||
final AntCall antCall = new AntCall(parameters.getBuildJarTargetName());
|
||||
@@ -67,4 +67,4 @@ public class CompositeBuildTarget extends CompositeGenerator {
|
||||
protected static String getJarPath(BuildConfiguration buildConfiguration){
|
||||
return buildConfiguration.isJarEnabled() ? buildConfiguration.getJarPath() : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public class DefaultExplodedAndJarBuildGenerator extends ExplodedAndJarBuildGene
|
||||
|
||||
final String baseDirProperty = BuildProperties.getModuleBasedirProperty(instruction.getModule());
|
||||
final String sourceLocation = GenerationUtils.toRelativePath(sourceFile.getPath(), moduleBaseDir, baseDirProperty,
|
||||
parameters.getGenerationOptions(), !parameters.getContainingModule().isSavePathsRelative());
|
||||
parameters.getGenerationOptions());
|
||||
|
||||
final Copy copy;
|
||||
if (instruction.isDirectory()) {
|
||||
|
||||
@@ -48,17 +48,15 @@ public class GenerationUtils {
|
||||
public static String toRelativePath(final VirtualFile file, final ModuleChunk chunk, final GenerationOptions genOptions) {
|
||||
final Module module = chunk.getModules()[0];
|
||||
final File moduleBaseDir = chunk.getBaseDir();
|
||||
return toRelativePath(file, moduleBaseDir, BuildProperties.getModuleBasedirProperty(module), genOptions,
|
||||
!chunk.isSavePathsRelative());
|
||||
return toRelativePath(file, moduleBaseDir, BuildProperties.getModuleBasedirProperty(module), genOptions);
|
||||
}
|
||||
|
||||
public static String toRelativePath(final String file, final File baseDir, final Module module, final GenerationOptions genOptions) {
|
||||
return toRelativePath(file, baseDir, BuildProperties.getModuleBasedirProperty(module), genOptions, !module.isSavePathsRelative());
|
||||
return toRelativePath(file, baseDir, BuildProperties.getModuleBasedirProperty(module), genOptions);
|
||||
}
|
||||
|
||||
public static String toRelativePath(final String path, final ModuleChunk chunk, final GenerationOptions genOptions) {
|
||||
return GenerationUtils.toRelativePath(path, chunk.getBaseDir(), BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions,
|
||||
!chunk.isSavePathsRelative());
|
||||
return toRelativePath(path, chunk.getBaseDir(), BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,20 +74,18 @@ public class GenerationUtils {
|
||||
public static String toRelativePath(final VirtualFile file,
|
||||
final File baseDir,
|
||||
final String baseDirPropertyName,
|
||||
final GenerationOptions genOptions,
|
||||
final boolean useAbsolutePathsForOuterPaths) {
|
||||
final GenerationOptions genOptions) {
|
||||
final String localPath = PathUtil.getLocalPath(file);
|
||||
if (localPath == null) {
|
||||
return null;
|
||||
}
|
||||
return toRelativePath(localPath, baseDir, baseDirPropertyName, genOptions, useAbsolutePathsForOuterPaths);
|
||||
return toRelativePath(localPath, baseDir, baseDirPropertyName, genOptions);
|
||||
}
|
||||
|
||||
public static String toRelativePath(String path,
|
||||
File baseDir,
|
||||
@NonNls final String baseDirPropertyName,
|
||||
GenerationOptions genOptions,
|
||||
boolean useAbsolutePathsForOuterPaths) {
|
||||
GenerationOptions genOptions) {
|
||||
path = normalizePath(path);
|
||||
final String substitutedPath = genOptions.subsitutePathWithMacros(path);
|
||||
if (!substitutedPath.equals(path)) {
|
||||
@@ -107,7 +103,7 @@ public class GenerationUtils {
|
||||
}
|
||||
final String relativepath = FileUtil.getRelativePath(base, new File(path));
|
||||
if (relativepath != null) {
|
||||
final boolean shouldUseAbsolutePath = useAbsolutePathsForOuterPaths && relativepath.indexOf("..") >= 0;
|
||||
final boolean shouldUseAbsolutePath = relativepath.indexOf("..") >= 0;
|
||||
if (!shouldUseAbsolutePath) {
|
||||
final String _relativePath = relativepath.replace(File.separatorChar, '/');
|
||||
final String root = BuildProperties.propertyRef(baseDirPropertyName);
|
||||
|
||||
@@ -87,10 +87,6 @@ public class ModuleChunk {
|
||||
return CompilerModuleExtension.getInstance(myMainModule).getCompilerOutputUrlForTests();
|
||||
}
|
||||
|
||||
public boolean isSavePathsRelative() {
|
||||
return myMainModule.isSavePathsRelative();
|
||||
}
|
||||
|
||||
public boolean isJdkInherited() {
|
||||
return ModuleRootManager.getInstance(myMainModule).isSdkInherited();
|
||||
}
|
||||
|
||||
@@ -188,9 +188,6 @@ public class ProjectFromSourcesBuilder extends ProjectBuilder implements SourceP
|
||||
updater.updateModule(descriptor, module, modifiableModel);
|
||||
}
|
||||
modifiableModel.commit();
|
||||
|
||||
module.setSavePathsRelative(true); // default setting
|
||||
|
||||
return module;
|
||||
}
|
||||
|
||||
|
||||
+2
-37
@@ -2,6 +2,7 @@ package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.Patches;
|
||||
import com.intellij.ide.util.JavaUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.util.ProgressWindow;
|
||||
@@ -14,20 +15,16 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.util.concurrency.SwingWorker;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.awt.*;
|
||||
|
||||
public class JavaContentEntriesEditor extends CommonContentEntriesEditor {
|
||||
private JRadioButton myRbRelativePaths;
|
||||
|
||||
public JavaContentEntriesEditor(Project project, String moduleName, ModifiableRootModel model, ModulesProvider modulesProvider) {
|
||||
super(project, moduleName, model, modulesProvider);
|
||||
}
|
||||
@@ -121,38 +118,6 @@ public class JavaContentEntriesEditor extends CommonContentEntriesEditor {
|
||||
protected JPanel createBottomControl(Module module) {
|
||||
final JPanel innerPanel = new JPanel(new GridBagLayout());
|
||||
innerPanel.setBorder(BorderFactory.createEmptyBorder(6, 0, 0, 6));
|
||||
myRbRelativePaths = new JRadioButton(ProjectBundle.message("module.paths.outside.module.dir.relative.radio"));
|
||||
final JRadioButton rbAbsolutePaths = new JRadioButton(ProjectBundle.message("module.paths.outside.module.dir.absolute.radio"));
|
||||
ButtonGroup buttonGroup = new ButtonGroup();
|
||||
buttonGroup.add(myRbRelativePaths);
|
||||
buttonGroup.add(rbAbsolutePaths);
|
||||
innerPanel.add(new JLabel(ProjectBundle.message("module.paths.outside.module.dir.label")),
|
||||
new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0),
|
||||
0, 0));
|
||||
innerPanel.add(rbAbsolutePaths,
|
||||
new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0),
|
||||
0, 0));
|
||||
innerPanel.add(myRbRelativePaths,
|
||||
new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0),
|
||||
0, 0));
|
||||
if (module.isSavePathsRelative()) {
|
||||
myRbRelativePaths.setSelected(true);
|
||||
}
|
||||
else {
|
||||
rbAbsolutePaths.setSelected(true);
|
||||
}
|
||||
return innerPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
if (super.isModified()) return true;
|
||||
final Module selfModule = getModule();
|
||||
return selfModule != null && myRbRelativePaths != null && selfModule.isSavePathsRelative() != myRbRelativePaths.isSelected();
|
||||
}
|
||||
|
||||
public void apply() throws ConfigurationException {
|
||||
final Module module = getModule();
|
||||
module.setSavePathsRelative(myRbRelativePaths.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
+3
-37
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.openapi.roots.ui.configuration.ProjectConfigurable">
|
||||
<grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="10">
|
||||
<grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="10">
|
||||
<margin top="14" left="4" bottom="4" right="4"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="907" height="340"/>
|
||||
<xy x="20" y="20" width="907" height="282"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<vspacer id="2fb9d">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="e1ed8" class="javax.swing.JLabel">
|
||||
@@ -47,40 +47,6 @@
|
||||
<text resource-bundle="messages/ProjectBundle" key="project.compiler.output"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="51844" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="2">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="d8427" class="javax.swing.JRadioButton" binding="myRbRelativePaths">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="1" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="db78e" class="javax.swing.JRadioButton" binding="myRbAbsolutePaths">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="1" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="1a889" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/ProjectBundle" key="module.paths.outside.project.dir.label"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="faeb8" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="4" bottom="10" right="0"/>
|
||||
<constraints>
|
||||
|
||||
+1
-16
@@ -11,7 +11,6 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.project.ex.ProjectEx;
|
||||
import com.intellij.openapi.roots.CompilerProjectExtension;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
@@ -56,9 +55,6 @@ public class ProjectConfigurable extends NamedConfigurable<Project> implements D
|
||||
private boolean myStartModuleWizardOnShow;
|
||||
private LanguageLevelCombo myLanguageLevelCombo;
|
||||
private ProjectJdkConfigurable myProjectJdkConfigurable;
|
||||
private JRadioButton myRbRelativePaths;
|
||||
|
||||
private JRadioButton myRbAbsolutePaths;
|
||||
|
||||
private FieldPanel myProjectCompilerOutput;
|
||||
|
||||
@@ -98,16 +94,6 @@ public class ProjectConfigurable extends NamedConfigurable<Project> implements D
|
||||
myPanel = new MyJPanel();
|
||||
myPanel.setPreferredSize(new Dimension(700, 500));
|
||||
|
||||
myRbRelativePaths.setText(ProjectBundle.message("module.paths.outside.module.dir.relative.radio"));
|
||||
myRbAbsolutePaths.setText(ProjectBundle.message("module.paths.outside.module.dir.absolute.radio"));
|
||||
|
||||
if (((ProjectEx)myProject).isSavePathsRelative()) {
|
||||
myRbRelativePaths.setSelected(true);
|
||||
}
|
||||
else {
|
||||
myRbAbsolutePaths.setSelected(true);
|
||||
}
|
||||
|
||||
myProjectJdkConfigurable = new ProjectJdkConfigurable(myProject, model);
|
||||
myPanel.add(myProjectJdkConfigurable.createComponent(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
|
||||
@@ -215,7 +201,6 @@ public class ProjectConfigurable extends NamedConfigurable<Project> implements D
|
||||
|
||||
final LanguageLevel newLevel = (LanguageLevel)myLanguageLevelCombo.getSelectedItem();
|
||||
LanguageLevelProjectExtension.getInstance(myProject).setLanguageLevel(newLevel);
|
||||
((ProjectEx)myProject).setSavePathsRelative(myRbRelativePaths.isSelected());
|
||||
try {
|
||||
myProjectJdkConfigurable.apply();
|
||||
}
|
||||
@@ -264,7 +249,7 @@ public class ProjectConfigurable extends NamedConfigurable<Project> implements D
|
||||
if (!Comparing.strEqual(FileUtil.toSystemIndependentName(VfsUtil.urlToPath(compilerOutput)),
|
||||
FileUtil.toSystemIndependentName(myProjectCompilerOutput.getText()))) return true;
|
||||
if (myProjectJdkConfigurable.isModified()) return true;
|
||||
return ((ProjectEx)myProject).isSavePathsRelative() != myRbRelativePaths.isSelected();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
|
||||
@@ -129,8 +129,6 @@ public abstract class ModuleBuilder extends ProjectBuilder{
|
||||
}
|
||||
modifiableModel.commit();
|
||||
|
||||
module.setSavePathsRelative(true); // default setting
|
||||
|
||||
return module;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,22 +81,6 @@ public interface Module extends ComponentManager, AreaInstance, Disposable {
|
||||
|
||||
boolean isLoaded();
|
||||
|
||||
/**
|
||||
* Returns the value of the option "Use absolute/relative paths for files outside
|
||||
* the module file directory" for this module.
|
||||
*
|
||||
* @return true if relative paths are used, false if absolute paths are used.
|
||||
*/
|
||||
boolean isSavePathsRelative();
|
||||
|
||||
/**
|
||||
* Sets the value of the option "Use absolute/relative paths for files outside
|
||||
* the module file directory" for this module.
|
||||
*
|
||||
* @param b true if relative paths are used, false if absolute paths are used.
|
||||
*/
|
||||
void setSavePathsRelative(boolean b);
|
||||
|
||||
/**
|
||||
* Sets a custom option for this module.
|
||||
*
|
||||
|
||||
+3
-2
@@ -14,13 +14,14 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ModulePathMacroManager extends BasePathMacroManager {
|
||||
public class ModulePathMacroManager extends BasePathMacroManager /*ProjectPathMacroManager*/ {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.components.impl.ModulePathMacroManager");
|
||||
|
||||
private final Module myModule;
|
||||
|
||||
|
||||
public ModulePathMacroManager(final Module module) {
|
||||
//super((ProjectEx) module.getProject());
|
||||
myModule = module;
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ public class ModulePathMacroManager extends BasePathMacroManager {
|
||||
ReplacePathToMacroMap result = new ReplacePathToMacroMap();
|
||||
getModuleHomeReplacements(result, false);
|
||||
result.putAll(super.getReplacePathMap());
|
||||
getModuleHomeReplacements(result, myModule.isSavePathsRelative());
|
||||
getModuleHomeReplacements(result, true); // TODO: change to false and remove previous call to this method to save ABSOLUTE paths
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
-5
@@ -169,11 +169,6 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM
|
||||
return storage.getFileName();
|
||||
}
|
||||
|
||||
public void setSavePathsRelative(final boolean b) {
|
||||
super.setSavePathsRelative(b);
|
||||
setOption(RELATIVE_PATHS_OPTION, String.valueOf(b));
|
||||
}
|
||||
|
||||
public void setOption(final String optionName, final String optionValue) {
|
||||
try {
|
||||
getMainStorageData().setOption(optionName, optionValue);
|
||||
|
||||
@@ -207,10 +207,6 @@ public class ModuleImpl extends ComponentManagerImpl implements Module {
|
||||
return isModuleAdded;
|
||||
}
|
||||
|
||||
public boolean isSavePathsRelative() {
|
||||
return getStateStore().isSavePathsRelative();
|
||||
}
|
||||
|
||||
public void moduleAdded() {
|
||||
isModuleAdded = true;
|
||||
for (ModuleComponent component : getComponents(ModuleComponent.class)) {
|
||||
@@ -350,7 +346,4 @@ public class ModuleImpl extends ComponentManagerImpl implements Module {
|
||||
}
|
||||
|
||||
|
||||
public void setSavePathsRelative(final boolean b) {
|
||||
getStateStore().setSavePathsRelative(b);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -28,9 +28,8 @@ public class ProjectPathMacroManager extends BasePathMacroManager {
|
||||
|
||||
public ReplacePathToMacroMap getReplacePathMap() {
|
||||
ReplacePathToMacroMap result = new ReplacePathToMacroMap();
|
||||
getProjectHomeReplacements(result, false);
|
||||
result.putAll(super.getReplacePathMap());
|
||||
getProjectHomeReplacements(result, myProject.getStateStore().isSavePathsRelative());
|
||||
getProjectHomeReplacements(result, false);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
-26
@@ -18,7 +18,6 @@ import java.util.Set;
|
||||
abstract class BaseFileConfigurableStoreImpl extends ComponentStoreImpl {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.components.impl.stores.BaseFileConfigurableStoreImpl");
|
||||
|
||||
@NonNls protected static final String RELATIVE_PATHS_OPTION = "relativePaths";
|
||||
@NonNls protected static final String VERSION_OPTION = "version";
|
||||
@NonNls public static final String ATTRIBUTE_NAME = "name";
|
||||
private final ComponentManager myComponentManager;
|
||||
@@ -56,10 +55,7 @@ abstract class BaseFileConfigurableStoreImpl extends ComponentStoreImpl {
|
||||
protected void load(@NotNull final Element rootElement) throws IOException {
|
||||
super.load(rootElement);
|
||||
|
||||
final String rel = rootElement.getAttributeValue(RELATIVE_PATHS_OPTION);
|
||||
if (rel != null) mySavePathsRelative = Boolean.parseBoolean(rel);
|
||||
final String v = rootElement.getAttributeValue(VERSION_OPTION);
|
||||
|
||||
if (v != null) {
|
||||
myVersion = Integer.parseInt(v);
|
||||
}
|
||||
@@ -71,10 +67,7 @@ abstract class BaseFileConfigurableStoreImpl extends ComponentStoreImpl {
|
||||
@NotNull
|
||||
protected Element save() {
|
||||
final Element root = super.save();
|
||||
|
||||
root.setAttribute(RELATIVE_PATHS_OPTION, String.valueOf(mySavePathsRelative));
|
||||
root.setAttribute(VERSION_OPTION, Integer.toString(myVersion));
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -110,25 +103,6 @@ abstract class BaseFileConfigurableStoreImpl extends ComponentStoreImpl {
|
||||
getMainStorageData(); //load it
|
||||
}
|
||||
|
||||
public boolean isSavePathsRelative() {
|
||||
try {
|
||||
return getMainStorageData().mySavePathsRelative;
|
||||
}
|
||||
catch (StateStorage.StateStorageException e) {
|
||||
LOG.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSavePathsRelative(boolean b) {
|
||||
try {
|
||||
getMainStorageData().mySavePathsRelative = b;
|
||||
}
|
||||
catch (StateStorage.StateStorageException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public BaseStorageData getMainStorageData() throws StateStorage.StateStorageException {
|
||||
return (BaseStorageData) getMainStorage().getStorageData();
|
||||
}
|
||||
|
||||
-3
@@ -5,7 +5,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface IModuleStore extends IComponentStore {
|
||||
boolean isSavePathsRelative();
|
||||
|
||||
void setModuleFilePath(final String filePath);
|
||||
|
||||
@@ -18,8 +17,6 @@ public interface IModuleStore extends IComponentStore {
|
||||
@NotNull
|
||||
String getModuleFileName();
|
||||
|
||||
void setSavePathsRelative(final boolean b);
|
||||
|
||||
void setOption(final String optionName, final String optionValue);
|
||||
|
||||
void clearOption(final String optionName);
|
||||
|
||||
-5
@@ -19,13 +19,8 @@ public interface IProjectStore extends IComponentStore {
|
||||
|
||||
boolean checkVersion();
|
||||
|
||||
@SuppressWarnings({"EmptyMethod"})
|
||||
boolean isSavePathsRelative();
|
||||
|
||||
void setProjectFilePath(final String filePath);
|
||||
|
||||
void setSavePathsRelative(final boolean b);
|
||||
|
||||
@Nullable
|
||||
VirtualFile getProjectBaseDir();
|
||||
|
||||
|
||||
+1
-1
@@ -414,7 +414,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
|
||||
|
||||
@Override
|
||||
protected int computeHash() {
|
||||
return super.computeHash() + (((ProjectEx)myProject).isSavePathsRelative() ? 1 : 0);
|
||||
return super.computeHash();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,6 @@ import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface ProjectEx extends Project {
|
||||
boolean isSavePathsRelative();
|
||||
|
||||
void setSavePathsRelative(boolean b);
|
||||
|
||||
@NotNull
|
||||
IProjectStore getStateStore();
|
||||
|
||||
@@ -139,14 +139,6 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
|
||||
return (IProjectStore)super.getStateStore();
|
||||
}
|
||||
|
||||
public boolean isSavePathsRelative() {
|
||||
return getStateStore().isSavePathsRelative();
|
||||
}
|
||||
|
||||
public void setSavePathsRelative(boolean b) {
|
||||
getStateStore().setSavePathsRelative(b);
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
return ProjectManagerEx.getInstanceEx().isProjectOpened(this);
|
||||
}
|
||||
|
||||
@@ -108,9 +108,6 @@ project.language.level.reload.title=Language Level Changed
|
||||
project.root.change.loading.progress=Loading Files...
|
||||
library.global.settings=Global libraries
|
||||
module.paths.title=Sources
|
||||
module.paths.outside.module.dir.relative.radio=Relative
|
||||
module.paths.outside.module.dir.absolute.radio=Absolute
|
||||
module.paths.outside.module.dir.label=References to resources outside module file directory:
|
||||
module.paths.output.title=Select Output Path
|
||||
module.paths.test.output.title=Select Test Output Path
|
||||
module.paths.exclude.output.checkbox=Exclude output paths
|
||||
@@ -163,7 +160,6 @@ module.libraries.javadoc.attach.button=Attach D&ocumentation...
|
||||
module.libraries.attach.sources.button=Attach &Sources...
|
||||
module.libraries.attach.classes.button=Attach &Classes...
|
||||
module.libraries.add.button=&Add Library...
|
||||
module.paths.outside.project.dir.label=<html><b>References to resources outside project file directory:</b></html>
|
||||
module.module.language.level=&Language level (effective on project reload):
|
||||
module.circular.dependency.warning=<b>There {1, choice, 1#is circular dependency|2#are circular dependencies} between modules:</b> {0}
|
||||
module.add.error.message=Error adding module to project: {0}
|
||||
@@ -491,4 +487,4 @@ external.annotations.in.code.option=Add in &code
|
||||
external.annotations.external.option=Add &externally
|
||||
project.new.wizard.import.footnote=Import from external model is available from New Project Wizard only
|
||||
loading.components.for=Loading components for ''{0}''
|
||||
initializing.components=Initializing components
|
||||
initializing.components=Initializing components
|
||||
|
||||
@@ -19,13 +19,6 @@ public class MockProject extends MockComponentManager implements ProjectEx {
|
||||
super(ApplicationManager.getApplication() != null ? ApplicationManager.getApplication().getPicoContainer() : null);
|
||||
}
|
||||
|
||||
public boolean isSavePathsRelative() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setSavePathsRelative(boolean b) {
|
||||
}
|
||||
|
||||
public boolean isDefault() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -29,19 +29,10 @@ public class MockProjectStore implements IProjectStore {
|
||||
throw new UnsupportedOperationException("Method checkVersion is not yet implemented in " + getClass().getName());
|
||||
}
|
||||
|
||||
@SuppressWarnings({"EmptyMethod"})
|
||||
public boolean isSavePathsRelative() {
|
||||
throw new UnsupportedOperationException("Method isSavePathsRelative is not yet implemented in " + getClass().getName());
|
||||
}
|
||||
|
||||
public void setProjectFilePath(final String filePath) {
|
||||
throw new UnsupportedOperationException("Method setProjectFilePath is not yet implemented in " + getClass().getName());
|
||||
}
|
||||
|
||||
public void setSavePathsRelative(final boolean b) {
|
||||
throw new UnsupportedOperationException("Method setSavePathsRelative is not yet implemented in " + getClass().getName());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public VirtualFile getProjectBaseDir() {
|
||||
throw new UnsupportedOperationException("Method getProjectBaseDir is not yet implemented in " + getClass().getName());
|
||||
|
||||
-3
@@ -7,7 +7,6 @@ import com.intellij.openapi.module.ModifiableModuleModel;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ex.ProjectEx;
|
||||
import com.intellij.openapi.roots.LibraryOrderEntry;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.roots.ModuleRootModel;
|
||||
@@ -326,8 +325,6 @@ public class MavenProjectImporter {
|
||||
private void configSettings() {
|
||||
MavenUtil.invokeAndWaitWriteAction(myProject, new Runnable() {
|
||||
public void run() {
|
||||
((ProjectEx)myProject).setSavePathsRelative(true);
|
||||
|
||||
String level = calcTargetLevel();
|
||||
if (level == null) return;
|
||||
|
||||
|
||||
-1
@@ -41,7 +41,6 @@ public class MavenRootModelAdapter {
|
||||
myRootModel.inheritSdk();
|
||||
}
|
||||
if (newlyCreatedModule) {
|
||||
myRootModel.getModule().setSavePathsRelative(true);
|
||||
getCompilerExtension().setExcludeOutput(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.jetbrains.idea.maven;
|
||||
|
||||
import com.intellij.compiler.impl.javaCompiler.javac.JavacSettings;
|
||||
import com.intellij.openapi.project.ex.ProjectEx;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
@@ -13,24 +12,6 @@ import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class StructureImportingTest extends MavenImportingTestCase {
|
||||
public void testUsingRelativePathForTheProject() throws Exception {
|
||||
assertFalse(((ProjectEx)myProject).isSavePathsRelative());
|
||||
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>");
|
||||
|
||||
assertTrue(((ProjectEx)myProject).isSavePathsRelative());
|
||||
}
|
||||
|
||||
public void testUsingRelativePathForModules() throws Exception {
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>");
|
||||
|
||||
assertTrue(getModule("project").isSavePathsRelative());
|
||||
}
|
||||
|
||||
public void testInheritProjectJdkForModules() throws Exception {
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
@@ -44,11 +25,9 @@ public class StructureImportingTest extends MavenImportingTestCase {
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>");
|
||||
|
||||
getModule("project").setSavePathsRelative(false);
|
||||
Sdk sdk = setupJdkForModule("project");
|
||||
|
||||
importProject();
|
||||
assertFalse(getModule("project").isSavePathsRelative());
|
||||
assertFalse(ModuleRootManager.getInstance(getModule("project")).isSdkInherited());
|
||||
assertEquals(sdk, ModuleRootManager.getInstance(getModule("project")).getSdk());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user